gtk3 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gtk3/extconf.rb +1 -1
- data/ext/gtk3/rbgtk-color-button.c +7 -1
- data/ext/gtk3/rbgtk-dialog.c +26 -6
- data/ext/gtk3/rbgtk-image.c +1 -0
- data/ext/gtk3/rbgtk-selection-data.c +4 -5
- data/ext/gtk3/rbgtk-stack-switcher.c +41 -0
- data/ext/gtk3/rbgtk-window.c +8 -0
- data/ext/gtk3/rbgtk.c +158 -0
- data/ext/gtk3/rbgtk3.h +33 -0
- data/ext/gtk3/rbgtk3conversions.h +60 -1
- data/ext/gtk3/rbgtk3private.h +1 -1
- data/lib/gtk3.rb +1 -0
- data/sample/gtk-demo/cairo-arc-negative.rb +1 -1
- data/sample/gtk-demo/cairo-arc.rb +1 -1
- data/sample/gtk-demo/cairo-clip-image.rb +6 -6
- data/sample/gtk-demo/cairo-clip-rectangle.rb +2 -2
- data/sample/gtk-demo/cairo-curve-rectangle.rb +2 -2
- data/sample/gtk-demo/cairo-curve-to.rb +2 -2
- data/sample/gtk-demo/cairo-dash.rb +1 -1
- data/sample/gtk-demo/cairo-fill-and-stroke.rb +1 -1
- data/sample/gtk-demo/cairo-fill-and-stroke2.rb +2 -2
- data/sample/gtk-demo/cairo-gradient.rb +1 -1
- data/sample/gtk-demo/cairo-image-pattern.rb +5 -5
- data/sample/gtk-demo/cairo-image.rb +4 -4
- data/sample/gtk-demo/cairo-line-cap.rb +8 -8
- data/sample/gtk-demo/cairo-line-join.rb +3 -3
- data/sample/gtk-demo/cairo-long-lines.rb +3 -3
- data/sample/gtk-demo/cairo-pattern-fill.rb +11 -11
- data/sample/gtk-demo/cairo-self-intersect.rb +2 -2
- data/sample/gtk-demo/cairo-text-align-center.rb +4 -4
- data/sample/gtk-demo/cairo-text-extents.rb +5 -5
- data/sample/gtk-demo/cairo-text.rb +3 -3
- data/sample/gtk-demo/common.rb +0 -1
- data/sample/gtk-demo/dialog.rb +23 -23
- data/sample/gtk-demo/drawingarea.rb +5 -1
- data/sample/gtk-demo/editable_cells.rb +28 -28
- data/sample/gtk-demo/entry_completion.rb +3 -3
- data/sample/gtk-demo/images.rb +75 -75
- data/sample/gtk-demo/item_factory.rb +40 -40
- data/sample/gtk-demo/list_store.rb +13 -13
- data/sample/gtk-demo/menus.rb +34 -34
- data/sample/gtk-demo/panes.rb +28 -28
- data/sample/gtk-demo/rotated_text.rb +41 -53
- data/sample/gtk-demo/sizegroup.rb +17 -17
- data/sample/gtk-demo/spinner.rb +1 -1
- data/sample/gtk-demo/textview.rb +137 -137
- data/sample/gtk-demo/theming.ui +319 -0
- data/sample/gtk-demo/theming_style_classes.rb +48 -0
- data/sample/gtk-demo/tree_store.rb +127 -127
- data/sample/misc/assistant.rb +6 -66
- data/sample/misc/bindings.rb +22 -32
- data/sample/misc/button.rb +8 -5
- data/sample/misc/buttonbox.rb +2 -2
- data/sample/misc/checkbutton.rb +4 -1
- data/sample/misc/colorselection.rb +7 -10
- data/sample/misc/combo_check.rb +34 -26
- data/sample/misc/combobox.rb +10 -11
- data/sample/misc/cursor.rb +3 -1
- data/sample/misc/dialog.rb +12 -12
- data/sample/misc/dialog2.rb +13 -16
- data/sample/misc/drawing.rb +40 -21
- data/sample/misc/statusicon.rb +28 -45
- data/sample/misc/threads.rb +16 -18
- data/sample/misc/tree_progress.rb +10 -12
- data/test/run-test.rb +17 -9
- data/test/test_gtk_search_bar.rb +1 -1
- data/test/test_gtk_stack_switcher.rb +30 -0
- metadata +25 -21
@@ -0,0 +1,319 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<interface>
|
3
|
+
<object class="GtkGrid" id="grid">
|
4
|
+
<property name="row-spacing">6</property>
|
5
|
+
<property name="orientation">vertical</property>
|
6
|
+
<child>
|
7
|
+
<object class="GtkToolbar" id="toolbar1">
|
8
|
+
<property name="visible">True</property>
|
9
|
+
<property name="can_focus">False</property>
|
10
|
+
<property name="hexpand">True</property>
|
11
|
+
<property name="show-arrow">False</property>
|
12
|
+
<style>
|
13
|
+
<class name="primary-toolbar"/>
|
14
|
+
</style>
|
15
|
+
<child>
|
16
|
+
<object class="GtkToggleToolButton" id="toolbutton1">
|
17
|
+
<property name="use_action_appearance">False</property>
|
18
|
+
<property name="visible">True</property>
|
19
|
+
<property name="can_focus">False</property>
|
20
|
+
<property name="use_action_appearance">False</property>
|
21
|
+
<property name="label" translatable="yes">Normal</property>
|
22
|
+
<property name="use_underline">True</property>
|
23
|
+
<property name="is_important">True</property>
|
24
|
+
<property name="icon_name">edit-find</property>
|
25
|
+
</object>
|
26
|
+
<packing>
|
27
|
+
<property name="expand">False</property>
|
28
|
+
<property name="homogeneous">True</property>
|
29
|
+
</packing>
|
30
|
+
</child>
|
31
|
+
<child>
|
32
|
+
<object class="GtkToggleToolButton" id="toolbutton2">
|
33
|
+
<property name="use_action_appearance">False</property>
|
34
|
+
<property name="visible">True</property>
|
35
|
+
<property name="can_focus">False</property>
|
36
|
+
<property name="use_action_appearance">False</property>
|
37
|
+
<property name="label" translatable="yes">Active</property>
|
38
|
+
<property name="use_underline">True</property>
|
39
|
+
<property name="is_important">True</property>
|
40
|
+
<property name="icon_name">edit-find</property>
|
41
|
+
<property name="active">True</property>
|
42
|
+
</object>
|
43
|
+
<packing>
|
44
|
+
<property name="expand">False</property>
|
45
|
+
<property name="homogeneous">True</property>
|
46
|
+
</packing>
|
47
|
+
</child>
|
48
|
+
<child>
|
49
|
+
<object class="GtkToggleToolButton" id="toolbutton3">
|
50
|
+
<property name="use_action_appearance">False</property>
|
51
|
+
<property name="visible">True</property>
|
52
|
+
<property name="sensitive">False</property>
|
53
|
+
<property name="can_focus">False</property>
|
54
|
+
<property name="label" translatable="yes">Insensitive</property>
|
55
|
+
<property name="use_underline">True</property>
|
56
|
+
<property name="is_important">True</property>
|
57
|
+
<property name="icon_name">edit-find</property>
|
58
|
+
</object>
|
59
|
+
<packing>
|
60
|
+
<property name="expand">False</property>
|
61
|
+
<property name="homogeneous">True</property>
|
62
|
+
</packing>
|
63
|
+
</child>
|
64
|
+
<child>
|
65
|
+
<object class="GtkToggleToolButton" id="toolbutton5">
|
66
|
+
<property name="use_action_appearance">False</property>
|
67
|
+
<property name="visible">True</property>
|
68
|
+
<property name="can_focus">False</property>
|
69
|
+
<property name="label" translatable="yes">Raised</property>
|
70
|
+
<property name="use_underline">True</property>
|
71
|
+
<property name="is_important">True</property>
|
72
|
+
<property name="icon_name">edit-find-symbolic</property>
|
73
|
+
<style>
|
74
|
+
<class name="raised"/>
|
75
|
+
</style>
|
76
|
+
</object>
|
77
|
+
<packing>
|
78
|
+
<property name="expand">False</property>
|
79
|
+
<property name="homogeneous">True</property>
|
80
|
+
</packing>
|
81
|
+
</child>
|
82
|
+
<child>
|
83
|
+
<object class="GtkToggleToolButton" id="toolbutton6">
|
84
|
+
<property name="use_action_appearance">False</property>
|
85
|
+
<property name="visible">True</property>
|
86
|
+
<property name="can_focus">False</property>
|
87
|
+
<property name="label" translatable="yes">Raised Active</property>
|
88
|
+
<property name="use_underline">True</property>
|
89
|
+
<property name="is_important">True</property>
|
90
|
+
<property name="icon_name">edit-find-symbolic</property>
|
91
|
+
<property name="active">True</property>
|
92
|
+
<style>
|
93
|
+
<class name="raised"/>
|
94
|
+
</style>
|
95
|
+
</object>
|
96
|
+
<packing>
|
97
|
+
<property name="expand">False</property>
|
98
|
+
<property name="homogeneous">True</property>
|
99
|
+
</packing>
|
100
|
+
</child>
|
101
|
+
<child>
|
102
|
+
<object class="GtkToggleToolButton" id="toolbutton4">
|
103
|
+
<property name="use_action_appearance">False</property>
|
104
|
+
<property name="visible">True</property>
|
105
|
+
<property name="sensitive">False</property>
|
106
|
+
<property name="can_focus">False</property>
|
107
|
+
<property name="label" translatable="yes">Insensitive Active</property>
|
108
|
+
<property name="use_underline">True</property>
|
109
|
+
<property name="icon_name">edit-find</property>
|
110
|
+
<property name="is_important">True</property>
|
111
|
+
<property name="active">True</property>
|
112
|
+
</object>
|
113
|
+
<packing>
|
114
|
+
<property name="expand">False</property>
|
115
|
+
<property name="homogeneous">True</property>
|
116
|
+
</packing>
|
117
|
+
</child>
|
118
|
+
<child>
|
119
|
+
<object class="GtkToolItem" id="toolitementry">
|
120
|
+
<property name="use_action_appearance">False</property>
|
121
|
+
<property name="visible">True</property>
|
122
|
+
<property name="can_focus">False</property>
|
123
|
+
<child>
|
124
|
+
<object class="GtkEntry" id="entry1">
|
125
|
+
<property name="visible">True</property>
|
126
|
+
<property name="can_focus">True</property>
|
127
|
+
<property name="invisible_char">•</property>
|
128
|
+
<property name="placeholder-text" translatable="yes">Search...</property>
|
129
|
+
<property name="secondary-icon-name">edit-find-symbolic</property>
|
130
|
+
</object>
|
131
|
+
</child>
|
132
|
+
</object>
|
133
|
+
<packing>
|
134
|
+
<property name="expand">False</property>
|
135
|
+
</packing>
|
136
|
+
</child>
|
137
|
+
<child>
|
138
|
+
<object class="GtkToolItem" id="toolitemswitch">
|
139
|
+
<property name="use_action_appearance">False</property>
|
140
|
+
<property name="visible">True</property>
|
141
|
+
<property name="can_focus">False</property>
|
142
|
+
<child>
|
143
|
+
<object class="GtkSwitch" id="switch1">
|
144
|
+
<property name="visible">True</property>
|
145
|
+
<property name="can_focus">True</property>
|
146
|
+
</object>
|
147
|
+
</child>
|
148
|
+
</object>
|
149
|
+
<packing>
|
150
|
+
<property name="expand">False</property>
|
151
|
+
</packing>
|
152
|
+
</child>
|
153
|
+
</object>
|
154
|
+
</child>
|
155
|
+
<child>
|
156
|
+
<object class="GtkBox" id="box1">
|
157
|
+
<property name="visible">True</property>
|
158
|
+
<property name="can_focus">False</property>
|
159
|
+
<property name="orientation">horizontal</property>
|
160
|
+
<property name="valign">center</property>
|
161
|
+
<property name="halign">center</property>
|
162
|
+
<style>
|
163
|
+
<class name="linked"/>
|
164
|
+
</style>
|
165
|
+
<child>
|
166
|
+
<object class="GtkButton" id="button1">
|
167
|
+
<property name="label" translatable="yes">Hi, I am a button</property>
|
168
|
+
<property name="use_action_appearance">False</property>
|
169
|
+
<property name="visible">True</property>
|
170
|
+
<property name="can_focus">True</property>
|
171
|
+
<property name="receives_default">True</property>
|
172
|
+
<property name="use_action_appearance">False</property>
|
173
|
+
</object>
|
174
|
+
<packing>
|
175
|
+
<property name="expand">False</property>
|
176
|
+
<property name="fill">True</property>
|
177
|
+
<property name="position">0</property>
|
178
|
+
</packing>
|
179
|
+
</child>
|
180
|
+
<child>
|
181
|
+
<object class="GtkButton" id="button2">
|
182
|
+
<property name="label" translatable="yes">And I'm another button</property>
|
183
|
+
<property name="use_action_appearance">False</property>
|
184
|
+
<property name="visible">True</property>
|
185
|
+
<property name="can_focus">True</property>
|
186
|
+
<property name="receives_default">True</property>
|
187
|
+
<property name="use_action_appearance">False</property>
|
188
|
+
</object>
|
189
|
+
<packing>
|
190
|
+
<property name="expand">False</property>
|
191
|
+
<property name="fill">True</property>
|
192
|
+
<property name="position">1</property>
|
193
|
+
</packing>
|
194
|
+
</child>
|
195
|
+
<child>
|
196
|
+
<object class="GtkButton" id="button3">
|
197
|
+
<property name="label" translatable="yes">This is a button party!</property>
|
198
|
+
<property name="use_action_appearance">False</property>
|
199
|
+
<property name="visible">True</property>
|
200
|
+
<property name="can_focus">True</property>
|
201
|
+
<property name="receives_default">True</property>
|
202
|
+
<property name="use_action_appearance">False</property>
|
203
|
+
</object>
|
204
|
+
<packing>
|
205
|
+
<property name="expand">False</property>
|
206
|
+
<property name="fill">True</property>
|
207
|
+
<property name="position">2</property>
|
208
|
+
</packing>
|
209
|
+
</child>
|
210
|
+
</object>
|
211
|
+
</child>
|
212
|
+
<child>
|
213
|
+
<object class="GtkToolbar" id="itoolbar1">
|
214
|
+
<property name="visible">True</property>
|
215
|
+
<property name="can_focus">False</property>
|
216
|
+
<property name="hexpand">True</property>
|
217
|
+
<property name="icon_size">1</property>
|
218
|
+
<style>
|
219
|
+
<class name="inline-toolbar"/>
|
220
|
+
</style>
|
221
|
+
<child>
|
222
|
+
<object class="GtkToggleToolButton" id="itoolbutton1">
|
223
|
+
<property name="use_action_appearance">False</property>
|
224
|
+
<property name="visible">True</property>
|
225
|
+
<property name="can_focus">False</property>
|
226
|
+
<property name="use_action_appearance">False</property>
|
227
|
+
<property name="label" translatable="yes">Normal</property>
|
228
|
+
<property name="use_underline">True</property>
|
229
|
+
<property name="icon_name">list-add-symbolic</property>
|
230
|
+
</object>
|
231
|
+
<packing>
|
232
|
+
<property name="expand">False</property>
|
233
|
+
<property name="homogeneous">True</property>
|
234
|
+
</packing>
|
235
|
+
</child>
|
236
|
+
<child>
|
237
|
+
<object class="GtkToggleToolButton" id="itoolbutton2">
|
238
|
+
<property name="use_action_appearance">False</property>
|
239
|
+
<property name="visible">True</property>
|
240
|
+
<property name="can_focus">False</property>
|
241
|
+
<property name="use_action_appearance">False</property>
|
242
|
+
<property name="label" translatable="yes">Normal</property>
|
243
|
+
<property name="use_underline">True</property>
|
244
|
+
<property name="icon_name">list-add-symbolic</property>
|
245
|
+
</object>
|
246
|
+
<packing>
|
247
|
+
<property name="expand">False</property>
|
248
|
+
<property name="homogeneous">True</property>
|
249
|
+
</packing>
|
250
|
+
</child>
|
251
|
+
<child>
|
252
|
+
<object class="GtkToggleToolButton" id="itoolbutton3">
|
253
|
+
<property name="use_action_appearance">False</property>
|
254
|
+
<property name="visible">True</property>
|
255
|
+
<property name="can_focus">False</property>
|
256
|
+
<property name="use_action_appearance">False</property>
|
257
|
+
<property name="label" translatable="yes">Active</property>
|
258
|
+
<property name="use_underline">True</property>
|
259
|
+
<property name="icon_name">list-remove-symbolic</property>
|
260
|
+
<property name="active">True</property>
|
261
|
+
</object>
|
262
|
+
<packing>
|
263
|
+
<property name="expand">False</property>
|
264
|
+
<property name="homogeneous">True</property>
|
265
|
+
</packing>
|
266
|
+
</child>
|
267
|
+
<child>
|
268
|
+
<object class="GtkToggleToolButton" id="itoolbutton4">
|
269
|
+
<property name="use_action_appearance">False</property>
|
270
|
+
<property name="visible">True</property>
|
271
|
+
<property name="can_focus">False</property>
|
272
|
+
<property name="use_action_appearance">False</property>
|
273
|
+
<property name="label" translatable="yes">Active</property>
|
274
|
+
<property name="use_underline">True</property>
|
275
|
+
<property name="icon_name">list-remove-symbolic</property>
|
276
|
+
<property name="active">True</property>
|
277
|
+
</object>
|
278
|
+
<packing>
|
279
|
+
<property name="expand">False</property>
|
280
|
+
<property name="homogeneous">True</property>
|
281
|
+
</packing>
|
282
|
+
</child>
|
283
|
+
<child>
|
284
|
+
<object class="GtkToggleToolButton" id="itoolbutton5">
|
285
|
+
<property name="use_action_appearance">False</property>
|
286
|
+
<property name="visible">True</property>
|
287
|
+
<property name="sensitive">False</property>
|
288
|
+
<property name="can_focus">False</property>
|
289
|
+
<property name="use_action_appearance">False</property>
|
290
|
+
<property name="label" translatable="yes">Insensitive</property>
|
291
|
+
<property name="use_underline">True</property>
|
292
|
+
<property name="icon_name">edit-find-symbolic</property>
|
293
|
+
</object>
|
294
|
+
<packing>
|
295
|
+
<property name="expand">False</property>
|
296
|
+
<property name="homogeneous">True</property>
|
297
|
+
</packing>
|
298
|
+
</child>
|
299
|
+
<child>
|
300
|
+
<object class="GtkToggleToolButton" id="itoolbutton6">
|
301
|
+
<property name="use_action_appearance">False</property>
|
302
|
+
<property name="visible">True</property>
|
303
|
+
<property name="sensitive">False</property>
|
304
|
+
<property name="can_focus">False</property>
|
305
|
+
<property name="use_action_appearance">False</property>
|
306
|
+
<property name="label" translatable="yes">Insensitive Active</property>
|
307
|
+
<property name="use_underline">True</property>
|
308
|
+
<property name="icon_name">go-up-symbolic</property>
|
309
|
+
<property name="active">True</property>
|
310
|
+
</object>
|
311
|
+
<packing>
|
312
|
+
<property name="expand">False</property>
|
313
|
+
<property name="homogeneous">True</property>
|
314
|
+
</packing>
|
315
|
+
</child>
|
316
|
+
</object>
|
317
|
+
</child>
|
318
|
+
</object>
|
319
|
+
</interface>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#
|
2
|
+
# This sample code is a port of gtk3/demos/gtk-demo/theming_style_classes.c.
|
3
|
+
# The UI file used in this sample code is copied from gtk3/demos/gtk-demo.
|
4
|
+
# This is licensed under the terms of the GNU Lesser General Public
|
5
|
+
# License, version 2.1 or (at your option) later.
|
6
|
+
#
|
7
|
+
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
8
|
+
#
|
9
|
+
# This library is free software; you can redistribute it and/or
|
10
|
+
# modify it under the terms of the GNU Lesser General Public
|
11
|
+
# License as published by the Free Software Foundation; either
|
12
|
+
# version 2.1 of the License, or (at your option) any later version.
|
13
|
+
#
|
14
|
+
# This library is distributed in the hope that it will be useful,
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
# Lesser General Public License for more details.
|
18
|
+
#
|
19
|
+
# You should have received a copy of the GNU Lesser General Public
|
20
|
+
# License along with this library; if not, write to the Free Software
|
21
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22
|
+
=begin
|
23
|
+
= CSS Theming/Style Classes
|
24
|
+
|
25
|
+
GTK+ uses CSS for theming. Style classes can be associated
|
26
|
+
with widgets to inform the theme about intended rendering.
|
27
|
+
|
28
|
+
This demo shows some common examples where theming features
|
29
|
+
of GTK+ are used for certain effects: primary toolbars,
|
30
|
+
inline toolbars and linked buttons.
|
31
|
+
=end
|
32
|
+
|
33
|
+
require "common"
|
34
|
+
|
35
|
+
module Demo
|
36
|
+
class ThemingStyleClasses < BasicWindow
|
37
|
+
def initialize
|
38
|
+
super("Style Claases")
|
39
|
+
self.border_width = 12
|
40
|
+
|
41
|
+
builder = Gtk::Builder.new
|
42
|
+
builder.add("theming.ui")
|
43
|
+
|
44
|
+
grid = builder.get_object("grid")
|
45
|
+
add(grid)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -17,9 +17,9 @@ module Demo
|
|
17
17
|
class TreeStore < BasicWindow
|
18
18
|
# TreeItem structure
|
19
19
|
TreeItem = Struct.new('TreeItem',
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
:label,
|
21
|
+
:alex, :havoc, :tim, :owen, :dave,
|
22
|
+
:world_holiday) # shared by the European hackers
|
23
23
|
|
24
24
|
# columns
|
25
25
|
(
|
@@ -39,98 +39,98 @@ module Demo
|
|
39
39
|
# tree data
|
40
40
|
TOPLEVEL = [
|
41
41
|
['January',
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
[
|
43
|
+
["New Years Day", true, true, true, true, false, true],
|
44
|
+
["Presidential Inauguration", false, true, false, true, false, false],
|
45
|
+
["Martin Luther King Jr. day", false, true, false, true, false, false],
|
46
|
+
]
|
47
47
|
],
|
48
48
|
['February',
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
[
|
50
|
+
["Presidents' Day", false, true, false, true, false, false],
|
51
|
+
["Groundhog Day", false, false, false, false, false, false],
|
52
|
+
["Valentine's Day", false, false, false, false, true, true],
|
53
|
+
]
|
54
54
|
],
|
55
55
|
['March',
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
[
|
57
|
+
["National Tree Planting Day", false, false, false, false, false, false],
|
58
|
+
[ "St Patrick's Day", false, false, false, false, false, true],
|
59
|
+
]
|
60
60
|
],
|
61
61
|
['April',
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
[
|
63
|
+
[ "April Fools' Day", false, false, false, false, false, true ],
|
64
|
+
[ "Army Day", false, false, false, false, false, false ],
|
65
|
+
[ "Earth Day", false, false, false, false, false, true ],
|
66
|
+
[ "Administrative Professionals' Day", false, false, false, false, false, false ],
|
67
|
+
]],
|
68
68
|
['May',
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
[
|
70
|
+
[ "Nurses' Day", false, false, false, false, false, false ],
|
71
|
+
[ "National Day of Prayer", false, false, false, false, false, false ],
|
72
|
+
[ "Mothers' Day", false, false, false, false, false, true ],
|
73
|
+
[ "Armed Forces Day", false, false, false, false, false, false ],
|
74
|
+
[ "Memorial Day", true, true, true, true, false, true ],
|
75
|
+
|
76
|
+
]
|
77
77
|
],
|
78
78
|
['June',
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
[
|
80
|
+
[ "June Fathers' Day", false, false, false, false, false, true ],
|
81
|
+
[ "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false ],
|
82
|
+
[ "Flag Day", false, true, false, true, false, false ],
|
83
|
+
]
|
84
84
|
],
|
85
85
|
['July',
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
[
|
87
|
+
[ "Parents' Day", false, false, false, false, false, true ],
|
88
|
+
[ "Independence Day", false, true, false, true, false, false ],
|
89
|
+
]
|
90
90
|
],
|
91
91
|
['August',
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
[
|
93
|
+
[ "Air Force Day", false, false, false, false, false, false ],
|
94
|
+
[ "Coast Guard Day", false, false, false, false, false, false ],
|
95
|
+
[ "Friendship Day", false, false, false, false, false, false ],
|
96
|
+
]
|
97
97
|
],
|
98
98
|
['September',
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
[
|
100
|
+
[ "Grandparents' Day", false, false, false, false, false, true ],
|
101
|
+
[ "Citizenship Day or Constitution Day", false, false, false, false, false, false ],
|
102
|
+
[ "Labor Day", true, true, true, true, false, true ],
|
103
|
+
]
|
104
104
|
],
|
105
105
|
['October',
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
106
|
+
[
|
107
|
+
[ "National Children's Day", false, false, false, false, false, false ],
|
108
|
+
[ "Bosses' Day", false, false, false, false, false, false ],
|
109
|
+
[ "Sweetest Day", false, false, false, false, false, false ],
|
110
|
+
[ "Mother-in-Law's Day", false, false, false, false, false, false ],
|
111
|
+
[ "Navy Day", false, false, false, false, false, false ],
|
112
|
+
[ "Columbus Day", false, true, false, true, false, false ],
|
113
|
+
[ "Halloween", false, false, false, false, false, true ],
|
114
|
+
]
|
115
115
|
],
|
116
116
|
['November',
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
[
|
118
|
+
[ "Marine Corps Day", false, false, false, false, false, false ],
|
119
|
+
[ "Veterans' Day", true, true, true, true, false, true ],
|
120
|
+
[ "Thanksgiving", false, true, false, true, false, false ],
|
121
|
+
]
|
122
122
|
],
|
123
123
|
['December',
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
[
|
125
|
+
[ 'Pearl Harbor Remembrance Day', false, false, false, false, false, false ],
|
126
|
+
[ 'Christmas', true, true, true, true, false, true ],
|
127
|
+
[ 'Kwanzaa', false, false, false, false, false, false ],
|
128
|
+
]
|
129
129
|
],
|
130
130
|
].collect do |month_name, holidays|
|
131
131
|
[
|
132
|
-
|
133
|
-
|
132
|
+
month_name,
|
133
|
+
holidays.collect do |args| TreeItem.new(args) end,
|
134
134
|
]
|
135
135
|
end
|
136
136
|
|
@@ -143,12 +143,12 @@ module Demo
|
|
143
143
|
add(vbox)
|
144
144
|
|
145
145
|
vbox.pack_start(Gtk::Label.new("Jonathan's Holiday Card Planning Sheet"),
|
146
|
-
|
146
|
+
:expand => false, :fill => false, :padding => 0)
|
147
147
|
|
148
148
|
sw = Gtk::ScrolledWindow.new(nil, nil)
|
149
149
|
sw.shadow_type = Gtk::SHADOW_ETCHED_IN
|
150
150
|
sw.set_policy(:automatic,
|
151
|
-
|
151
|
+
:automatic)
|
152
152
|
vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0)
|
153
153
|
|
154
154
|
# create model
|
@@ -165,7 +165,7 @@ module Demo
|
|
165
165
|
|
166
166
|
# expand all rows after the treeview widget has been realized
|
167
167
|
treeview.signal_connect('realize') do
|
168
|
-
|
168
|
+
treeview.expand_all
|
169
169
|
end
|
170
170
|
set_default_size(650, 400)
|
171
171
|
end
|
@@ -173,33 +173,33 @@ module Demo
|
|
173
173
|
def create_model
|
174
174
|
# create tree store
|
175
175
|
model = Gtk::TreeStore.new(String,
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
176
|
+
TrueClass,
|
177
|
+
TrueClass,
|
178
|
+
TrueClass,
|
179
|
+
TrueClass,
|
180
|
+
TrueClass,
|
181
|
+
TrueClass,
|
182
|
+
TrueClass)
|
183
183
|
|
184
184
|
# add data to the tree store
|
185
185
|
TOPLEVEL.each do |month_name, holidays|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
186
|
+
iter = model.append(nil)
|
187
|
+
|
188
|
+
iter[HOLIDAY_NAME_COLUMN] = month_name
|
189
|
+
(ALEX_COLUMN..DAVE_COLUMN).each do |index|
|
190
|
+
iter[index] = false
|
191
|
+
end
|
192
|
+
|
193
|
+
# add children
|
194
|
+
holidays.each do |holiday|
|
195
|
+
child_iter = model.append(iter)
|
196
|
+
child_iter[HOLIDAY_NAME_COLUMN] = holiday.label[0]
|
197
|
+
%w(alex havoc tim owen dave).each_with_index do |person, i|
|
198
|
+
child_iter[ALEX_COLUMN + i] = holiday[person]
|
199
|
+
end
|
200
|
+
child_iter[VISIBLE_COLUMN] = true
|
201
|
+
child_iter[WORLD_COLUMN] = holiday.world_holiday
|
202
|
+
end
|
203
203
|
|
204
204
|
end
|
205
205
|
|
@@ -214,40 +214,40 @@ module Demo
|
|
214
214
|
renderer.xalign = 0.0
|
215
215
|
|
216
216
|
col_offset = treeview.insert_column(-1, 'Holiday',
|
217
|
-
|
218
|
-
|
217
|
+
renderer,
|
218
|
+
'text' => HOLIDAY_NAME_COLUMN)
|
219
219
|
column = treeview.get_column(col_offset - 1)
|
220
220
|
column.clickable = true
|
221
221
|
|
222
222
|
[
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
223
|
+
['Alex', true ],
|
224
|
+
['Havoc', false],
|
225
|
+
['Tim', true ],
|
226
|
+
['Owen', false],
|
227
|
+
['Dave', false],
|
228
228
|
].each_with_index do |args, i|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
229
|
+
person, european = *args
|
230
|
+
renderer = Gtk::CellRendererToggle.new
|
231
|
+
renderer.xalign = 0.0
|
232
|
+
eval(%Q[def renderer.column; #{ALEX_COLUMN + i}; end])
|
233
|
+
|
234
|
+
renderer.signal_connect('toggled') do |cell, path|
|
235
|
+
item_toggled(cell, path, model)
|
236
|
+
end
|
237
|
+
|
238
|
+
attributes = {
|
239
|
+
'active' => (ALEX_COLUMN + i),
|
240
|
+
'visible' => VISIBLE_COLUMN,
|
241
|
+
}
|
242
|
+
if european
|
243
|
+
attributes['activatable'] = WORLD_COLUMN
|
244
|
+
end
|
245
|
+
col_offset = treeview.insert_column(-1, person, renderer, attributes)
|
246
|
+
|
247
|
+
column = treeview.get_column(col_offset - 1)
|
248
|
+
column.sizing = Gtk::TreeViewColumn::FIXED
|
249
|
+
column.fixed_width = 50
|
250
|
+
column.clickable = true
|
251
251
|
end
|
252
252
|
end
|
253
253
|
|