Documentation ¶
Overview ¶
Package bone 一个跨平台的MVVM框架 可以方便的和native窗口结合起来 windows 可以参考bone/gwin来实现
Index ¶
- Constants
- func Import(key string, component Component) error
- type BLogger
- type Bone
- func (be *Bone) AddChild(child *Bone, index int)
- func (be *Bone) AddChildToBack(child *Bone)
- func (be *Bone) CallVM(method string)
- func (be *Bone) ChildAt(index int) *Bone
- func (be *Bone) ChildrenCount() int
- func (be *Bone) Parent() *Bone
- func (be *Bone) Remove(child *Bone)
- func (be *Bone) RemoveChildren()
- func (be *Bone) TopView() *View
- type Bootstrap
- type Canvas
- type Color
- type ColorF
- type Component
- type DepProperty
- type Dependence
- type Event
- type EventFlags
- type EventPhase
- type EventType
- type FocusChangeDirection
- type FocusChangeReason
- type FocusManager
- type FocusSearch
- type FocusTraversable
- type Injector
- type KeyboardCode
- type PMColor
- type Root
- type Scope
- type SliceDepProperty
- type TaskDispatcher
- type View
- func (v *View) AddChild(child *View, index int)
- func (v *View) AddChildToBack(child *View)
- func (v *View) ChildAt(index int) *View
- func (v *View) ChildrenCount() int
- func (v *View) ClassName() string
- func (v *View) GetWidget() *Widget
- func (v *View) IndexOfChild(child *View) int
- func (v *View) Parent() *View
- func (v *View) Remove(child *View)
- func (v *View) RemoveChildren()
- type WatchedTarget
- type Watcher
- type WatcherManager
- type Widget
Constants ¶
View Source
const ( ET_MOUSE_ENTER = iota ET_MOUSE_MOVE ET_MOUSE_DOWN ET_MOUSE_UP ET_MOUSE_CLICK ET_MOUSE_DCLICK ET_MOUSE_LEAVE ET_MOUSE_WHEEL ET_KEY_DOWN ET_CHAR ET_KEY_UP ET_COMPOSITION_START ET_COMPOSITION_UPDATE ET_COMPOSITION_END ET_FOCUS_OUT ET_FOCUS_IN ET_BLUR ET_FOCUS ET_CUSTOM ET_COUNT )
鼠标事件类型
View Source
const ( EF_NONE = 0 // Used to denote no flags explicitly EF_CAPS_LOCK_ON = 1 << 0 EF_SHIFT_DOWN = 1 << 1 EF_CONTROL_DOWN = 1 << 2 EF_ALT_DOWN = 1 << 3 EF_LEFT_MOUSE_DOWN = 1 << 4 EF_MIDDLE_MOUSE_DOWN = 1 << 5 EF_RIGHT_MOUSE_DOWN = 1 << 6 EF_COMMAND_DOWN = 1 << 7 // GUI Key (e.g. Command on OS X keyboards, // Search on Chromebook keyboards, // Windows on MS-oriented keyboards) EF_NUM_LOCK_ON = 1 << 8 EF_IS_KEY_PAD = 1 << 9 EF_IS_LEFT = 1 << 10 EF_IS_RIGHT = 1 << 11 )
EventFlags定义
View Source
const ( EP_CAPTURING = 1 + iota EP_TARGET EP_BUBBLING )
EventPhase 常量定义
View Source
const ( REASON_FOCUS_TRAVERSAL = iota REASON_FOCUS_STORE REASON_FOCUS_DIRECT_CHANGE )
View Source
const ( FOCUS_FORWARD = iota FOCUS_BACKWARD )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BLogger ¶
type BLogger interface { Trace(v ...interface{}) Tracef(format string, v ...interface{}) Debug(v ...interface{}) Debugf(format string, v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) }
BLogger 定义的日志接口 方便第三方实现
type Bone ¶
type Bone struct { *Injector // contains filtered or unexported fields }
func (*Bone) AddChildToBack ¶
func (*Bone) ChildrenCount ¶
func (*Bone) RemoveChildren ¶
func (be *Bone) RemoveChildren()
type Bootstrap ¶
type Bootstrap interface {
Run() //消息循环的空闲例程
}
Bootstrap 接口
func NewBootstrap ¶
NewBootstrap 返回1个Bootstrap
type Component ¶
type Component struct { Template string TemplateURI string Provider []reflect.Type //用于依赖注入 只能是结构的指针类型 可以实现Constructor方法来作为构造方法 DataContext reflect.Type //可以实现Constructor方法来作为构造方法 }
Component 元信息 根据Component创建1个Bone
type DepProperty ¶
type DepProperty interface { Set(value interface{}) Get() interface{} }
DepProperty 用于数据绑定
func NewDepProperty ¶
func NewDepProperty(value interface{}, setted, getted func(sender interface{}, value interface{})) DepProperty
NewDepProperty 返回1个依赖对象
type Dependence ¶
type Dependence struct {
// contains filtered or unexported fields
}
Dependence 依赖
func (*Dependence) AddSub ¶
func (dp *Dependence) AddSub(watcher *Watcher)
AddSub 添加订阅 当支持if 和 for指令时 可能需要实现RemoveSub
type Event ¶
type Event interface { Target() View Propagation() bool Bubble() bool // contains filtered or unexported methods }
Event 鼠标键盘及自定义事件对象
type FocusChangeDirection ¶
type FocusChangeDirection int
type FocusChangeReason ¶
type FocusChangeReason int
type FocusManager ¶
type FocusManager struct { }
type FocusSearch ¶
type FocusSearch interface { }
type FocusTraversable ¶
type FocusTraversable interface { FocusSearch() FocusSearch FocusTraversableParent() FocusTraversable FocusTraversableParentView() View }
type Injector ¶
type Injector struct { Parent *Injector Provider []interface{} }
Injector 依赖注入
type Scope ¶
type Scope interface { Parent() Scope FieldByName(key string, tp reflect.Type) (interface{}, error) MethodByName(key string, tp reflect.Type) (interface{}, error) InterfaceByName(keys []string, tp reflect.Type, find func(reflect.Value, string, bool) reflect.Value) (interface{}, error) }
Scope 数据绑定 上下文
func CreateScope ¶
CreateScope 创建上下文
type SliceDepProperty ¶
type SliceDepProperty interface { SetSlice(value []interface{}) GetSlice() []interface{} Push(item interface{}) int Pop() interface{} Unshift(item interface{}) int Shift() interface{} Splice(start, howmany int, items ...interface{}) []interface{} }
SliceDepProperty 用于数据绑定
func NewSliceDepProperty ¶
func NewSliceDepProperty(value []interface{}, setted, getted func(sender interface{}, value []interface{})) SliceDepProperty
NewSliceDepProperty 返回1个依赖对象
type View ¶
type View struct { //依赖属性 Widget DepProperty //通知 WhenCreated func(sender *View) WhenAttached func(sender *View, parent, child interface{}) WhenDeattached func(sender *View, parent, child interface{}) // contains filtered or unexported fields }
func (*View) AddChildToBack ¶
func (*View) ChildrenCount ¶
func (*View) IndexOfChild ¶
func (*View) RemoveChildren ¶
func (v *View) RemoveChildren()
type WatchedTarget ¶
type WatchedTarget interface { Get() interface{} SetFrom(WatchedTarget, interface{}) Equal(interface{}) bool AddSub(watcher *Watcher) }
WatchedTarget 可以被Watcher监听的接口
type WatcherManager ¶
type WatcherManager interface { Create(source, target WatchedTarget, computer func(sender interface{}, new interface{}) interface{}) *Watcher SetMode(async bool) Mode() bool }
WatcherManager 用于管理Watcher
Source Files ¶
Click to show internal directories.
Click to hide internal directories.