gtk3 2.2.0-x86-mingw32 → 2.2.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/extconf.rb +3 -2
  3. data/ext/gtk3/rbgtk-color-button.c +7 -1
  4. data/ext/gtk3/rbgtk-dialog.c +26 -6
  5. data/ext/gtk3/rbgtk-image.c +1 -0
  6. data/ext/gtk3/rbgtk-selection-data.c +4 -5
  7. data/ext/gtk3/rbgtk-stack-switcher.c +41 -0
  8. data/ext/gtk3/rbgtk-window.c +8 -0
  9. data/ext/gtk3/rbgtk.c +158 -0
  10. data/ext/gtk3/rbgtk3.h +33 -0
  11. data/ext/gtk3/rbgtk3conversions.h +60 -1
  12. data/ext/gtk3/rbgtk3private.h +1 -1
  13. data/lib/2.0/gtk3.so +0 -0
  14. data/lib/gtk3.rb +1 -0
  15. data/sample/gtk-demo/cairo-arc-negative.rb +1 -1
  16. data/sample/gtk-demo/cairo-arc.rb +1 -1
  17. data/sample/gtk-demo/cairo-clip-image.rb +6 -6
  18. data/sample/gtk-demo/cairo-clip-rectangle.rb +2 -2
  19. data/sample/gtk-demo/cairo-curve-rectangle.rb +2 -2
  20. data/sample/gtk-demo/cairo-curve-to.rb +2 -2
  21. data/sample/gtk-demo/cairo-dash.rb +1 -1
  22. data/sample/gtk-demo/cairo-fill-and-stroke.rb +1 -1
  23. data/sample/gtk-demo/cairo-fill-and-stroke2.rb +2 -2
  24. data/sample/gtk-demo/cairo-gradient.rb +1 -1
  25. data/sample/gtk-demo/cairo-image-pattern.rb +5 -5
  26. data/sample/gtk-demo/cairo-image.rb +4 -4
  27. data/sample/gtk-demo/cairo-line-cap.rb +8 -8
  28. data/sample/gtk-demo/cairo-line-join.rb +3 -3
  29. data/sample/gtk-demo/cairo-long-lines.rb +3 -3
  30. data/sample/gtk-demo/cairo-pattern-fill.rb +11 -11
  31. data/sample/gtk-demo/cairo-self-intersect.rb +2 -2
  32. data/sample/gtk-demo/cairo-text-align-center.rb +4 -4
  33. data/sample/gtk-demo/cairo-text-extents.rb +5 -5
  34. data/sample/gtk-demo/cairo-text.rb +3 -3
  35. data/sample/gtk-demo/common.rb +0 -1
  36. data/sample/gtk-demo/dialog.rb +23 -23
  37. data/sample/gtk-demo/drawingarea.rb +5 -1
  38. data/sample/gtk-demo/editable_cells.rb +28 -28
  39. data/sample/gtk-demo/entry_completion.rb +3 -3
  40. data/sample/gtk-demo/images.rb +75 -75
  41. data/sample/gtk-demo/item_factory.rb +40 -40
  42. data/sample/gtk-demo/list_store.rb +13 -13
  43. data/sample/gtk-demo/menus.rb +34 -34
  44. data/sample/gtk-demo/panes.rb +28 -28
  45. data/sample/gtk-demo/rotated_text.rb +41 -53
  46. data/sample/gtk-demo/sizegroup.rb +17 -17
  47. data/sample/gtk-demo/spinner.rb +1 -1
  48. data/sample/gtk-demo/textview.rb +137 -137
  49. data/sample/gtk-demo/theming.ui +319 -0
  50. data/sample/gtk-demo/theming_style_classes.rb +48 -0
  51. data/sample/gtk-demo/tree_store.rb +127 -127
  52. data/sample/misc/assistant.rb +6 -66
  53. data/sample/misc/bindings.rb +22 -32
  54. data/sample/misc/button.rb +8 -5
  55. data/sample/misc/buttonbox.rb +2 -2
  56. data/sample/misc/checkbutton.rb +4 -1
  57. data/sample/misc/colorselection.rb +7 -10
  58. data/sample/misc/combo_check.rb +34 -26
  59. data/sample/misc/combobox.rb +10 -11
  60. data/sample/misc/cursor.rb +3 -1
  61. data/sample/misc/dialog.rb +12 -12
  62. data/sample/misc/dialog2.rb +13 -16
  63. data/sample/misc/drawing.rb +40 -21
  64. data/sample/misc/statusicon.rb +28 -45
  65. data/sample/misc/threads.rb +16 -18
  66. data/sample/misc/tree_progress.rb +10 -12
  67. data/test/run-test.rb +17 -9
  68. data/test/test_gtk_search_bar.rb +1 -1
  69. data/test/test_gtk_stack_switcher.rb +30 -0
  70. metadata +26 -24
  71. data/lib/1.9/gtk3.so +0 -0
  72. data/lib/2.1/gtk3.so +0 -0
@@ -23,7 +23,7 @@ module Demo
23
23
  class SizeGroup < Gtk::Dialog
24
24
  def initialize
25
25
  super('GtkSizeGroup', nil, 0,
26
- [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
26
+ [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])
27
27
 
28
28
  color_options = %w(Red Green Blue)
29
29
  dash_options = %w(Solid Dashed Dotted)
@@ -32,7 +32,7 @@ module Demo
32
32
  set_resizable(false)
33
33
 
34
34
  signal_connect('response') do
35
- destroy
35
+ destroy
36
36
  end
37
37
 
38
38
  vbox = Gtk::VBox.new(false, 5)
@@ -73,12 +73,12 @@ module Demo
73
73
 
74
74
  check_button.set_active(true)
75
75
  check_button.signal_connect('toggled', size_group) do |check_button, size_group|
76
- new_mode = if check_button.active?
77
- Gtk::SizeGroup::HORIZONTAL
78
- else
79
- Gtk::SizeGroup::VERTICAL
80
- end
81
- size_group.set_mode(new_mode)
76
+ new_mode = if check_button.active?
77
+ Gtk::SizeGroup::HORIZONTAL
78
+ else
79
+ Gtk::SizeGroup::VERTICAL
80
+ end
81
+ size_group.set_mode(new_mode)
82
82
  end
83
83
  end
84
84
 
@@ -86,27 +86,27 @@ module Demo
86
86
  label = Gtk::Label.new(label_text, true)
87
87
  label.set_alignment(0, 1)
88
88
  table.attach(label,
89
- 0, 1, row, row + 1,
90
- Gtk::EXPAND | Gtk::FILL, 0,
91
- 0, 0)
89
+ 0, 1, row, row + 1,
90
+ Gtk::EXPAND | Gtk::FILL, 0,
91
+ 0, 0)
92
92
 
93
93
  option_menu = create_option_menu(options)
94
94
  label.set_mnemonic_widget(option_menu)
95
95
  size_group.add_widget(option_menu)
96
96
  table.attach(option_menu,
97
- 1, 2, row, row + 1,
98
- 0, 0,
99
- 0, 0)
97
+ 1, 2, row, row + 1,
98
+ 0, 0,
99
+ 0, 0)
100
100
  end
101
101
 
102
102
  def create_option_menu(strings)
103
103
  menu = Gtk::Menu.new
104
104
 
105
105
  strings.each do |str|
106
- menu_item = Gtk::MenuItem.new(str)
107
- menu_item.show
106
+ menu_item = Gtk::MenuItem.new(str)
107
+ menu_item.show
108
108
 
109
- menu.append(menu_item)
109
+ menu.append(menu_item)
110
110
  end
111
111
 
112
112
  option_menu = Gtk::OptionMenu.new
@@ -20,7 +20,7 @@ module Demo
20
20
  signal_connect(:destroy) {self.destroy}
21
21
 
22
22
  self.resizable = false
23
-
23
+
24
24
  vbox = Gtk::Box.new :vertical, 5
25
25
 
26
26
  self.content_area.pack_start vbox, :expand => true, :fill => true, :padding => 0
@@ -6,9 +6,9 @@
6
6
  =begin
7
7
  = Text Widget/Multiple Views
8
8
 
9
- The Gtk::TextView widget displays a Gtk::TextBuffer.
10
- One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews.
11
- This demo has two views displaying a single buffer,
9
+ The Gtk::TextView widget displays a Gtk::TextBuffer.
10
+ One Gtk::TextBuffer can be displayed by multiple Gtk::TextViews.
11
+ This demo has two views displaying a single buffer,
12
12
  and shows off the widget's text formatting features.
13
13
  =end
14
14
  require 'common'
@@ -25,11 +25,11 @@ module Demo
25
25
  super("TextView Window")
26
26
 
27
27
  set_default_size(450, 450)
28
-
28
+
29
29
  set_title("TextView")
30
30
  set_border_width(0)
31
31
 
32
- vpaned = Gtk::VPaned.new
32
+ vpaned = Gtk::VPaned.new
33
33
  vpaned.set_border_width(5)
34
34
  add(vpaned)
35
35
  ##
@@ -37,21 +37,21 @@ module Demo
37
37
  # the first text view; you could also create the buffer
38
38
  # by itself with Gtk::TextBuffer.new, then later create
39
39
  # a view widget.
40
- #
40
+ #
41
41
  view1 = Gtk::TextView.new
42
42
  buffer = view1.buffer
43
43
  view2 = Gtk::TextView.new(buffer)
44
-
44
+
45
45
  sw = Gtk::ScrolledWindow.new(nil, nil)
46
46
  sw.set_policy(:automatic,
47
- :automatic)
47
+ :automatic)
48
48
  vpaned.add1(sw)
49
49
 
50
50
  sw.add(view1)
51
51
 
52
52
  sw = Gtk::ScrolledWindow.new(nil, nil)
53
53
  sw.set_policy(:automatic,
54
- :automatic)
54
+ :automatic)
55
55
  vpaned.add2(sw)
56
56
 
57
57
  sw.add(view2)
@@ -61,8 +61,8 @@ module Demo
61
61
 
62
62
  attach_widgets(view1)
63
63
  attach_widgets(view2)
64
-
65
- vpaned.show_all
64
+
65
+ vpaned.show_all
66
66
 
67
67
  self.show
68
68
  end
@@ -75,108 +75,108 @@ module Demo
75
75
  # just a convenience function. Also note that you don't have
76
76
  # to give tags a name; pass NULL for the name to create an
77
77
  # anonymous tag.
78
- #
78
+ #
79
79
  # In any real app, another useful optimization would be to create
80
80
  # a Gtk::TextTagTable in advance, and reuse the same tag table for
81
81
  # all the buffers with the same tag set, instead of creating
82
82
  # new copies of the same tags for every buffer.
83
- #
83
+ #
84
84
  # Tags are assigned default priorities in order of addition to the
85
- # tag table. That is, tags created later that affect the same text
85
+ # tag table. That is, tags created later that affect the same text
86
86
  # property affected by an earlier tag will override the earlier
87
87
  # tag. You can modify tag priorities with
88
88
  # Gtk::TextTag#set_priority.
89
89
  #
90
90
 
91
91
  buffer.create_tag('heading',
92
- 'weight' => Pango::FontDescription::WEIGHT_BOLD,
93
- 'size' => 15 * Pango::SCALE)
94
-
92
+ 'weight' => Pango::FontDescription::WEIGHT_BOLD,
93
+ 'size' => 15 * Pango::SCALE)
94
+
95
95
  buffer.create_tag("italic",
96
- "style" => Pango::FontDescription::STYLE_ITALIC)
96
+ "style" => Pango::FontDescription::STYLE_ITALIC)
97
97
 
98
98
  buffer.create_tag("bold",
99
- "weight" => Pango::FontDescription::WEIGHT_BOLD)
100
-
99
+ "weight" => Pango::FontDescription::WEIGHT_BOLD)
100
+
101
101
  buffer.create_tag("big",
102
- # points times the PANGO_SCALE factor
103
- "size" => 20 * Pango::SCALE)
102
+ # points times the PANGO_SCALE factor
103
+ "size" => 20 * Pango::SCALE)
104
104
 
105
105
  buffer.create_tag("xx-small",
106
- "scale" => Pango::AttrScale::XX_SMALL)
106
+ "scale" => Pango::AttrScale::XX_SMALL)
107
107
 
108
108
  buffer.create_tag("x-large",
109
- "scale" => Pango::AttrScale::X_LARGE)
110
-
109
+ "scale" => Pango::AttrScale::X_LARGE)
110
+
111
111
  buffer.create_tag("monospace", "family" => "monospace")
112
-
112
+
113
113
  buffer.create_tag("blue_foreground", "foreground" => "blue")
114
114
 
115
115
  buffer.create_tag("red_background", "background" => "red")
116
116
 
117
117
  stipple = Gdk::Pixmap.create_from_data(nil, GRAY50_BITS, GRAY50_WIDTH,
118
- GRAY50_HEIGHT)
119
-
118
+ GRAY50_HEIGHT)
119
+
120
120
  buffer.create_tag("background_stipple",
121
- "background_stipple" => stipple)
121
+ "background_stipple" => stipple)
122
122
 
123
123
  buffer.create_tag("foreground_stipple",
124
- "foreground_stipple" => stipple)
124
+ "foreground_stipple" => stipple)
125
125
 
126
126
  buffer.create_tag("big_gap_before_line",
127
- "pixels_above_lines" => 30)
127
+ "pixels_above_lines" => 30)
128
128
 
129
129
  buffer.create_tag("big_gap_after_line",
130
- "pixels_below_lines" => 30)
130
+ "pixels_below_lines" => 30)
131
131
 
132
132
  buffer.create_tag("double_spaced_line",
133
- "pixels_inside_wrap" => 10)
133
+ "pixels_inside_wrap" => 10)
134
134
 
135
135
  buffer.create_tag("not_editable",
136
- "editable" => false)
137
-
136
+ "editable" => false)
137
+
138
138
  buffer.create_tag("word_wrap",
139
- "wrap_mode" => :word)
139
+ "wrap_mode" => :word)
140
140
 
141
141
  buffer.create_tag("char_wrap",
142
- "wrap_mode" => Gtk::TextTag::WRAP_CHAR)
142
+ "wrap_mode" => Gtk::TextTag::WRAP_CHAR)
143
143
 
144
144
  buffer.create_tag("no_wrap",
145
- "wrap_mode" => :none)
146
-
145
+ "wrap_mode" => :none)
146
+
147
147
  buffer.create_tag("center",
148
- "justification" => Gtk::JUSTIFY_CENTER)
148
+ "justification" => Gtk::JUSTIFY_CENTER)
149
149
 
150
150
  buffer.create_tag("right_justify",
151
- "justification" => Gtk::JUSTIFY_RIGHT)
151
+ "justification" => Gtk::JUSTIFY_RIGHT)
152
152
 
153
153
  buffer.create_tag("wide_margins",
154
- "left_margin" => 50,
155
- "right_margin" => 50)
156
-
154
+ "left_margin" => 50,
155
+ "right_margin" => 50)
156
+
157
157
  buffer.create_tag("strikethrough",
158
- "strikethrough" => true)
159
-
158
+ "strikethrough" => true)
159
+
160
160
  buffer.create_tag("underline",
161
- "underline" => Pango::AttrUnderline::SINGLE)
161
+ "underline" => Pango::AttrUnderline::SINGLE)
162
162
 
163
163
  buffer.create_tag("double_underline",
164
- "underline" => Pango::AttrUnderline::DOUBLE)
164
+ "underline" => Pango::AttrUnderline::DOUBLE)
165
165
 
166
166
  buffer.create_tag("superscript",
167
- "rise" => 10 * Pango::SCALE, # 10 pixels
168
- "size" => 8 * Pango::SCALE) # 8 points
169
-
167
+ "rise" => 10 * Pango::SCALE, # 10 pixels
168
+ "size" => 8 * Pango::SCALE) # 8 points
169
+
170
170
  buffer.create_tag("subscript",
171
- "rise" => -10 * Pango::SCALE, # 10 pixels
172
- "size" => 8 * Pango::SCALE) # 8 points
171
+ "rise" => -10 * Pango::SCALE, # 10 pixels
172
+ "size" => 8 * Pango::SCALE) # 8 points
173
173
 
174
174
  buffer.create_tag("rtl_quote",
175
- "wrap_mode" => :word,
176
- "direction" => Gtk::Widget::TEXT_DIR_RTL,
177
- "indent" => 30,
178
- "left_margin" => 20,
179
- "right_margin" => 20)
175
+ "wrap_mode" => :word,
176
+ "direction" => Gtk::Widget::TEXT_DIR_RTL,
177
+ "indent" => 30,
178
+ "left_margin" => 20,
179
+ "right_margin" => 20)
180
180
  end
181
181
 
182
182
  def insert_text(buffer)
@@ -185,14 +185,14 @@ module Demo
185
185
  # Demo.find_file looks in the the current directory first,
186
186
  # so you can run gtk-demo without installing GTK, then looks
187
187
  # in the location where the file is installed.
188
- #
188
+ #
189
189
 
190
190
  filename = Demo.find_file("gtk-logo-rgb.gif")
191
191
  pixbuf = Gdk::Pixbuf.new(filename) if filename
192
192
 
193
193
  unless pixbuf
194
- $stderr.print "Failed to load image file gtk-logo-rgb.gif\n"
195
- exit 1
194
+ $stderr.print "Failed to load image file gtk-logo-rgb.gif\n"
195
+ exit 1
196
196
  end
197
197
 
198
198
  scaled = pixbuf.scale(32, 32, Gdk::Pixbuf::INTERP_BILINEAR)
@@ -201,14 +201,14 @@ module Demo
201
201
  ##
202
202
  # get start of buffer; each insertion will revalidate the
203
203
  # iterator to point to just after the inserted text.
204
- #
204
+ #
205
205
 
206
206
  iter = buffer.get_iter_at(:offset => 0)
207
207
 
208
208
  buffer.insert(iter, "The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n")
209
209
 
210
210
  buffer.insert(iter, "Font styles. ", 'heading')
211
-
211
+
212
212
  buffer.insert(iter, "For example, you can have ")
213
213
  buffer.insert(iter, "italic", "italic")
214
214
  buffer.insert(iter, ", ")
@@ -223,25 +223,25 @@ module Demo
223
223
  buffer.insert(iter, " or ")
224
224
  buffer.insert(iter, "x-large", "x-large")
225
225
  buffer.insert(iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n")
226
-
226
+
227
227
  buffer.insert(iter, "Colors. ", "heading")
228
-
228
+
229
229
  buffer.insert(iter, "Colors such as ")
230
230
  buffer.insert(iter, "a blue foreground", "blue_foreground")
231
231
  buffer.insert(iter, " or ")
232
232
  buffer.insert(iter, "a red background", "red_background")
233
233
  buffer.insert(iter, " or even ")
234
234
  buffer.insert(iter, "a stippled red background",
235
- "red_background", "background_stipple")
235
+ "red_background", "background_stipple")
236
236
 
237
237
  buffer.insert(iter, " or ")
238
238
  buffer.insert(iter, "a stippled blue foreground on solid red background",
239
- "blue_foreground", "red_background", "foreground_stipple")
239
+ "blue_foreground", "red_background", "foreground_stipple")
240
240
 
241
241
  buffer.insert(iter, "(select that to read it) can be used.\n\n")
242
242
 
243
243
  buffer.insert(iter, "Underline, strikethrough, and rise. ", "heading")
244
-
244
+
245
245
  buffer.insert(iter, "Strikethrough", "strikethrough")
246
246
  buffer.insert(iter, ", ")
247
247
  buffer.insert(iter, "underline", "underline")
@@ -254,7 +254,7 @@ module Demo
254
254
  buffer.insert(iter, " are all supported.\n\n")
255
255
 
256
256
  buffer.insert(iter, "Images. ", "heading")
257
-
257
+
258
258
  buffer.insert(iter, "The buffer can have images in it: ")
259
259
  buffer.insert(iter, pixbuf)
260
260
  buffer.insert(iter, pixbuf)
@@ -264,46 +264,46 @@ module Demo
264
264
  buffer.insert(iter, "Spacing. ", "heading")
265
265
 
266
266
  buffer.insert(iter, "You can adjust the amount of space before each line.\n")
267
-
267
+
268
268
  buffer.insert(iter, "This line has a whole lot of space before it.\n",
269
- "big_gap_before_line", "wide_margins")
269
+ "big_gap_before_line", "wide_margins")
270
270
  buffer.insert(iter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n",
271
- "big_gap_after_line", "wide_margins")
272
-
271
+ "big_gap_after_line", "wide_margins")
272
+
273
273
  buffer.insert(iter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n",
274
- "double_spaced_line", "wide_margins")
274
+ "double_spaced_line", "wide_margins")
275
275
 
276
276
  buffer.insert(iter, "Also note that those lines have extra-wide margins.\n\n")
277
277
 
278
278
  buffer.insert(iter, "Editability. ", "heading")
279
-
279
+
280
280
  buffer.insert(iter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n",
281
- "not_editable")
281
+ "not_editable")
282
282
 
283
283
  buffer.insert(iter, "Wrapping. ", "heading")
284
284
 
285
285
  buffer.insert(iter, "This line(and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n")
286
-
286
+
287
287
  buffer.insert(iter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", "char_wrap")
288
-
288
+
289
289
  buffer.insert(iter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", "no_wrap")
290
290
 
291
291
  buffer.insert(iter, "Justification. ", "heading")
292
-
292
+
293
293
  buffer.insert(iter, "\nThis line has center justification.\n", "center")
294
294
 
295
295
  buffer.insert(iter, "This line has right justification.\n",
296
- "right_justify")
296
+ "right_justify")
297
297
 
298
298
  buffer.insert(iter, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", "wide_margins")
299
299
 
300
300
  buffer.insert(iter, "Internationalization. ", "heading")
301
301
 
302
- buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n")
302
+ buffer.insert(iter, "You can put all sorts of Unicode text in the buffer.\n\nGerman(Deutsch Süd) Grüß Gott\nGreek(Ελληνικά) Γειά σας\nHebrew שלום\nJapanese(日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n")
303
303
 
304
304
  buffer.insert(iter, "Here's a word-wrapped quote in a right-to-left language:\n")
305
305
  buffer.insert(iter, "??? ??? ???? ?? ???? ???????? ????? ?? ???? ?????? ??????? ??????? ?? ???? ?????? ?? ????? ?? ??????? ????? ??????? ??? ?????? ????? ?????? ????? ???? ?? ?????? ?????? ?? ???????? ?????? ????? ?? ???? ???? ????????? ???????. ???? ???? ??? ???????? ????? ?? »????????« ?? ???????.\n\n", "rtl_quote")
306
-
306
+
307
307
  buffer.insert(iter, "You can put widgets in the buffer: Here's a button: ")
308
308
  anchor = buffer.create_child_anchor(iter)
309
309
  buffer.insert(iter, " and a menu: ")
@@ -315,10 +315,10 @@ module Demo
315
315
  buffer.insert(iter, " finally a text entry: ")
316
316
  anchor = buffer.create_child_anchor(iter)
317
317
  buffer.insert(iter, ".\n")
318
-
318
+
319
319
  buffer.insert(iter, "\n\nThis demo doesn't demonstrate all the Gtk::TextBuffer features; it leaves out, for example: invisible/hidden text(doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...")
320
320
 
321
- # Apply word_wrap tag to whole buffer
321
+ # Apply word_wrap tag to whole buffer
322
322
 
323
323
  buf_start, buf_end = buffer.bounds
324
324
  buffer.apply_tag("word_wrap", buf_start, buf_end)
@@ -332,47 +332,47 @@ module Demo
332
332
  end
333
333
 
334
334
  def attach_widgets(text_view)
335
-
335
+
336
336
  buffer = text_view.buffer;
337
337
 
338
338
  iter = buffer.start_iter
339
339
 
340
340
  i = 0;
341
341
  while find_anchor(iter) do
342
- anchor = iter.child_anchor
343
-
344
- if i == 0
345
- widget = Gtk::Button.new("Click Me")
346
- widget.signal_connect('clicked') { |button|
347
- if @@nest_window and ! @@nest_window.destroyed?
348
- @@nest_window.present
349
- break
350
- end
351
-
352
- buffer = Gtk::TextBuffer.new
353
- iter = buffer.start_iter
354
-
355
- buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n")
356
- anchor = buffer.create_child_anchor(iter)
357
- buffer.insert(iter, "\nDon't do this in real applications, please.\n")
358
-
359
- view = Gtk::TextView.new(buffer)
360
-
361
- recursive_attach_view(0, view, anchor)
362
-
363
- @@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
364
- sw = Gtk::ScrolledWindow.new(nil, nil)
365
- sw.set_policy(:automatic,
366
- :automatic)
367
-
368
- @@nest_window.add(sw)
369
- sw.add(view)
370
-
371
- @@nest_window.set_default_size(300, 400)
372
- @@nest_window.show_all
373
- }
374
- elsif i == 1
375
- menu = Gtk::Menu.new
342
+ anchor = iter.child_anchor
343
+
344
+ if i == 0
345
+ widget = Gtk::Button.new("Click Me")
346
+ widget.signal_connect('clicked') { |button|
347
+ if @@nest_window and ! @@nest_window.destroyed?
348
+ @@nest_window.present
349
+ break
350
+ end
351
+
352
+ buffer = Gtk::TextBuffer.new
353
+ iter = buffer.start_iter
354
+
355
+ buffer.insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n")
356
+ anchor = buffer.create_child_anchor(iter)
357
+ buffer.insert(iter, "\nDon't do this in real applications, please.\n")
358
+
359
+ view = Gtk::TextView.new(buffer)
360
+
361
+ recursive_attach_view(0, view, anchor)
362
+
363
+ @@nest_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
364
+ sw = Gtk::ScrolledWindow.new(nil, nil)
365
+ sw.set_policy(:automatic,
366
+ :automatic)
367
+
368
+ @@nest_window.add(sw)
369
+ sw.add(view)
370
+
371
+ @@nest_window.set_default_size(300, 400)
372
+ @@nest_window.show_all
373
+ }
374
+ elsif i == 1
375
+ menu = Gtk::Menu.new
376
376
  widget = Gtk::OptionMenu.new
377
377
 
378
378
  menu_item = Gtk::MenuItem.new("Option 1")
@@ -382,30 +382,30 @@ module Demo
382
382
  menu_item = Gtk::MenuItem.new("Option 3")
383
383
  menu.append(menu_item)
384
384
 
385
- widget.menu = menu
385
+ widget.menu = menu
386
386
 
387
- elsif i == 2
388
- widget = Gtk::HScale.new
387
+ elsif i == 2
388
+ widget = Gtk::HScale.new
389
389
  widget.set_range(0, 100)
390
390
  widget.set_size_request(70, -1)
391
391
 
392
- elsif i == 3
393
- filename = Demo.find_file("floppybuddy.gif")
394
- widget = Gtk::Image.new(filename)
392
+ elsif i == 3
393
+ filename = Demo.find_file("floppybuddy.gif")
394
+ widget = Gtk::Image.new(filename)
395
395
 
396
- elsif i == 4
396
+ elsif i == 4
397
397
  widget = Gtk::Entry.new
398
398
 
399
- else
400
- #widget = nil; avoids a compiler warning
401
- #g_assert_not_reached ;
402
- end
399
+ else
400
+ #widget = nil; avoids a compiler warning
401
+ #g_assert_not_reached ;
402
+ end
403
403
 
404
- text_view.add_child_at_anchor(widget,
405
- anchor)
404
+ text_view.add_child_at_anchor(widget,
405
+ anchor)
406
406
 
407
- widget.show_all
408
- i += 1
407
+ widget.show_all
408
+ i += 1
409
409
  end
410
410
  end
411
411
 
@@ -415,17 +415,17 @@ module Demo
415
415
 
416
416
  child_view = Gtk::TextView.new(view.buffer)
417
417
 
418
- # Event box is to add a black border around each child view
418
+ # Event box is to add a black border around each child view
419
419
  event_box = Gtk::EventBox.new
420
420
  color = Gdk::Color.parse("black")
421
421
  event_box.modify_bg(Gtk::STATE_NORMAL, color)
422
422
 
423
423
  align = Gtk::Alignment.new(0.5, 0.5, 1.0, 1.0)
424
424
  align.set_border_width(1)
425
-
425
+
426
426
  event_box.add(align)
427
427
  align.add(child_view)
428
-
428
+
429
429
  view.add_child_at_anchor(event_box, anchor)
430
430
 
431
431
  recursive_attach_view(depth + 1, child_view, anchor)