forked from bonzini/gst-visualgst
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGtkSidebarWidget.st
96 lines (69 loc) · 1.86 KB
/
GtkSidebarWidget.st
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
GtkConcreteWidget subclass: GtkSidebarWidget [
| activeWidget widgets widgetEvents paned |
initialize [
<category: 'initialization'>
paned := GTK.GtkNotebook new
setTabPos: GTK.Gtk gtkPosBottom;
connectSignal: 'switch-page' to: self selector: #'switchPageOn:page:number:';
yourself.
self mainWidget: paned.
widgetEvents := Dictionary new.
activeWidget := GtkAbstractConcreteWidget new.
widgets := OrderedCollection new
]
postInitialize [
<category: 'initialization'>
self hideAll
]
add: aGtkWidget labeled: aString [
<category: 'notebook'>
paned
appendPage: aGtkWidget tabLabel: (GTK.GtkLabel new: aString).
widgets add: aGtkWidget
]
addAll: anArray [
<category: 'notebook'>
anArray do: [ :each | self add: each key labeled: each value ]
]
show: anIndex [
<category: 'notebook'>
activeWidget hideAll.
self mainWidget showAll.
self mainWidget setCurrentPage: anIndex - 1.
activeWidget := (widgets at: anIndex)
showAll;
yourself
]
showAll [
<category: 'notebook'>
self mainWidget show
]
hideTabs [
<category: 'notebook'>
self mainWidget setShowTabs: false
]
hide [
<category: 'notebook'>
self hideMainPained
]
hideAll [
<category: 'notebook'>
self hideMainPained
]
hideMainPained [
<category: 'notebook'>
self mainWidget hideAll
]
panedOrientation [
<category: 'accessing'>
^ self subclassResponsibility
]
switchPageOn: aGtkNotebook page: aGtkNotebookPage number: anInteger [
<category: 'notebook events'>
widgetEvents at: (aGtkNotebook getNthPage: anInteger) ifPresent: [ :msg | msg value ]
]
whenWidgetIsVisible: aGtkWidget send: aSymbol to: anObject [
<category: 'notebook events'>
widgetEvents at: aGtkWidget put: (DirectedMessage receiver: anObject selector: aSymbol arguments: #())
]
]