-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The user is enforced to set a non-default username (default: lanty). This is done by the following methods: 1) The application starts with the SettingsBrowser, when the default username is still set at application start. 2) The user can not set and save the default username in the SettingsBrowser view.
- Loading branch information
Showing
8 changed files
with
173 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package widget | ||
|
||
import ( | ||
"fyne.io/fyne/v2" | ||
"fyne.io/fyne/v2/canvas" | ||
fynetheme "fyne.io/fyne/v2/theme" | ||
"fyne.io/fyne/v2/widget" | ||
"github.com/seternate/go-lanty-client/pkg/controller" | ||
) | ||
|
||
type DefaultUsernameBrowser struct { | ||
widget.BaseWidget | ||
|
||
controller *controller.Controller | ||
|
||
settingsbrowser *SettingsBrowser | ||
} | ||
|
||
func NewDefaultUsernameBrowser(controller *controller.Controller, window fyne.Window) (browser *DefaultUsernameBrowser) { | ||
browser = &DefaultUsernameBrowser{ | ||
controller: controller, | ||
settingsbrowser: NewSettingsBrowser(controller, window), | ||
} | ||
browser.ExtendBaseWidget(browser) | ||
|
||
return | ||
} | ||
|
||
func (widget *DefaultUsernameBrowser) SetOnSubmit(onSubmit func()) { | ||
widget.settingsbrowser.SetOnSubmit(onSubmit) | ||
} | ||
|
||
func (widget *DefaultUsernameBrowser) CreateRenderer() fyne.WidgetRenderer { | ||
return newDefaulusernamebrowserRenderer(widget) | ||
} | ||
|
||
type defaultusernamebrowserRenderer struct { | ||
widget *DefaultUsernameBrowser | ||
background *canvas.Rectangle | ||
} | ||
|
||
func newDefaulusernamebrowserRenderer(widget *DefaultUsernameBrowser) *defaultusernamebrowserRenderer { | ||
renderer := &defaultusernamebrowserRenderer{ | ||
widget: widget, | ||
background: canvas.NewRectangle(fynetheme.BackgroundColor()), | ||
} | ||
|
||
return renderer | ||
} | ||
|
||
func (renderer *defaultusernamebrowserRenderer) Objects() []fyne.CanvasObject { | ||
objects := []fyne.CanvasObject{ | ||
renderer.background, | ||
renderer.widget.settingsbrowser, | ||
} | ||
|
||
return objects | ||
} | ||
|
||
func (renderer *defaultusernamebrowserRenderer) Layout(size fyne.Size) { | ||
renderer.background.Move(fyne.NewPos(0, 0)) | ||
renderer.background.Resize(size) | ||
renderer.widget.settingsbrowser.Move(fyne.NewPos(0, 0)) | ||
renderer.widget.settingsbrowser.Resize(size) | ||
} | ||
|
||
func (renderer *defaultusernamebrowserRenderer) MinSize() fyne.Size { | ||
return renderer.widget.settingsbrowser.MinSize() | ||
} | ||
|
||
func (renderer *defaultusernamebrowserRenderer) Refresh() { | ||
renderer.background.Refresh() | ||
renderer.widget.settingsbrowser.Refresh() | ||
} | ||
|
||
func (renderer *defaultusernamebrowserRenderer) Destroy() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters