forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanvasobject.go
47 lines (41 loc) · 1.46 KB
/
canvasobject.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package fyne
// CanvasObject describes any graphical object that can be added to a canvas.
// Objects have a size and position that can be controlled through this API.
// MinSize is used to determine the minimum size which this object should be displayed.
// An object will be visible by default but can be hidden with Hide() and re-shown with Show().
//
// Note: If this object is controlled as part of a Layout you should not call
// Resize(Size) or Move(Position).
type CanvasObject interface {
// geometry
CurrentSize() Size
Resize(Size)
CurrentPosition() Position
Move(Position)
MinSize() Size
// visibility
IsVisible() bool
Show()
Hide()
}
// ThemedObject indicates that the associated CanvasObject responds to theme
// changes. When the settings detect a theme change the object will be informed
// through the invocation of ApplyTheme().
type ThemedObject interface {
ApplyTheme()
}
// ClickableObject describes any CanvasObject that can also be clicked
// (i.e. has mouse handlers). This should be implemented by buttons etc that
// wish to handle pointer interactions.
type ClickableObject interface {
OnMouseDown(*MouseEvent)
}
// FocusableObject describes any CanvasObject that can respond to being focused.
// It will receive the OnFocusGained and OnFocusLost events appropriately and,
// when focussed, it will also have OnKeyDown called as keys are pressed.
type FocusableObject interface {
OnFocusGained()
OnFocusLost()
Focused() bool
OnKeyDown(*KeyEvent)
}