Documentation
¶
Index ¶
- func BuildURL(target ViewID, params map[string]interface{}) url.URL
- type BaseView
- func (base *BaseView) Actions() []ViewAction
- func (base *BaseView) Finished() bool
- func (base *BaseView) ID() ViewID
- func (base *BaseView) Layout(gtx C, th *theme.Theme) D
- func (base *BaseView) Location() url.URL
- func (base *BaseView) OnFinish()
- func (base *BaseView) OnNavTo(intent Intent) error
- func (base *BaseView) Title() string
- type C
- type D
- type EmptyView
- type Intent
- type ModalView
- type SimpleView
- type View
- type ViewAction
- type ViewID
- type ViewManager
- type ViewProvider
- type ViewStack
- type Widget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseView ¶
type BaseView struct {
// contains filtered or unexported fields
}
func (*BaseView) Actions ¶
func (base *BaseView) Actions() []ViewAction
type D ¶
type D = layout.Dimensions
type EmptyView ¶
type EmptyView struct {
}
func (EmptyView) Actions ¶
func (v EmptyView) Actions() []ViewAction
type Intent ¶
type ModalView ¶
type ModalView struct {
View
// padding between the modal border and inner widget. If it is not set
// A default value will be used.
Padding layout.Inset
// The background color of the modal area.
Background color.NRGBA
// Maximum width of the modal area.
MaxWidth unit.Dp
// Maximum height of the modal in ratio relateive to the window.
// The max value is restricted to 0.9 to prevent it overflow.
MaxHeight float32
Radius unit.Dp
// Make the ModalView halted. Halted modal view will not receive key events.
Halted bool
// contains filtered or unexported fields
}
type SimpleView ¶
type SimpleView struct {
BaseView
// contains filtered or unexported fields
}
A helper view which implements the View interface.
func (*SimpleView) ID ¶
func (sv *SimpleView) ID() ViewID
func (*SimpleView) Location ¶
func (sv *SimpleView) Location() url.URL
func (*SimpleView) OnNavTo ¶
func (sv *SimpleView) OnNavTo(intent Intent) error
func (*SimpleView) Title ¶
func (sv *SimpleView) Title() string
type View ¶
type ViewManager ¶
type ViewManager interface {
// Register is used to register views before the view rendering happens.
// Use provider to enable us to use dynamically constructed views.
Register(ID ViewID, provider ViewProvider) error
// Try to swith the current view to the requested view. If referer of the intent equals to
// the current viewID of the current tab, the requested view should be routed and pushed to
// to the existing viewstack(current tab). Otherwise a new viewstack for the intent is created(a new tab)
// if there's no duplicate active view (first views of the stacks).
RequestSwitch(intent Intent) error
// OpenedViews return the views on top of the stack of each tab.
OpenedViews() []View
// Close the current tab and move backwards to the previous one if there's any.
CloseTab(idx int)
SwitchTab(idx int)
// CurrentView returns the top most view of the current tab.
CurrentView() View
// current tab index
CurrentViewIndex() int
// It returns the view that is to be rendered.
NavBack() View
// Check is there are any naviBack-able views in the current stack or not. This should not
// count for the current view.
HasPrev() bool
// return the next view that is intened to be shown in the modal layer. It returns nil if
// there's no shownAsModal intent request.
//
// Deprecated: Please use [ModalViews] to handle multple stacked modal views.
NextModalView() *ModalView
// ModalViews returns all stacked modal views from back to front.
ModalViews() iter.Seq[*ModalView]
// finish the last modal view handling.
FinishModalView()
// refresh the window
Invalidate()
//Reset resets internal states of the VM
Reset()
}
View manager is the core of gio-view. It can be used to:
- manages views and modals;
- dispatch view/modal requests via the Intent object.
- views navigation.
Views can have a bounded history stack depending its intent request. The history stack is bounded to a tab widget which is part of a tab bar. Most the the API of the view manager handles navigating between views.
func DefaultViewManager ¶
func DefaultViewManager(window *app.Window) ViewManager
type ViewProvider ¶
type ViewProvider func() View
ViewProvider is used to construct new View instance. Each view should provide its own provider. Usually this is the constructor of the view.
type ViewStack ¶
type ViewStack struct {
// contains filtered or unexported fields
}
ViewStack is for view navigation history
func NewViewStack ¶
func NewViewStack() *ViewStack
Click to show internal directories.
Click to hide internal directories.