gtk3 3.0.9 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gtk3/rb-gtk3-private.h +1 -0
- data/ext/gtk3/rb-gtk3-spin-button.c +85 -0
- data/ext/gtk3/rb-gtk3.c +3 -0
- data/lib/gtk3/deprecated.rb +0 -8
- data/lib/gtk3/loader.rb +1 -7
- data/lib/gtk3/tree-model.rb +2 -0
- data/sample/gtk-demo/TODO +10 -10
- data/sample/gtk-demo/assistant.rb +44 -39
- data/sample/gtk-demo/builder.rb +71 -50
- data/sample/gtk-demo/button_box.rb +39 -28
- data/sample/gtk-demo/clipboard.rb +139 -46
- data/sample/gtk-demo/colorsel.rb +50 -36
- data/sample/gtk-demo/css_accordion.rb +18 -17
- data/sample/gtk-demo/css_basics.rb +60 -47
- data/sample/gtk-demo/css_multiplebgs.rb +92 -71
- data/sample/gtk-demo/css_pixbufs.rb +61 -48
- data/sample/gtk-demo/css_shadows.rb +63 -50
- data/sample/gtk-demo/cursors.rb +95 -64
- data/sample/gtk-demo/dialog.rb +95 -78
- data/sample/gtk-demo/drawingarea.rb +138 -171
- data/sample/gtk-demo/editable_cells.rb +169 -130
- data/sample/gtk-demo/entry_buffer.rb +15 -13
- data/sample/gtk-demo/entry_completion.rb +22 -17
- data/sample/gtk-demo/expander.rb +39 -31
- data/sample/gtk-demo/filtermodel.rb +67 -63
- data/sample/gtk-demo/font_features.rb +91 -60
- data/sample/gtk-demo/glarea.rb +277 -0
- data/sample/gtk-demo/headerbar.rb +17 -15
- data/sample/gtk-demo/hypertext.rb +146 -167
- data/sample/gtk-demo/iconview.rb +132 -91
- data/sample/gtk-demo/iconview_edit.rb +49 -38
- data/sample/gtk-demo/infobar.rb +81 -62
- data/sample/gtk-demo/links.rb +35 -30
- data/sample/gtk-demo/list_store.rb +169 -114
- data/sample/gtk-demo/listbox.rb +183 -0
- data/sample/gtk-demo/main.rb +32 -21
- data/sample/gtk-demo/markup.rb +65 -52
- data/sample/gtk-demo/menus.rb +57 -58
- data/sample/gtk-demo/modelbutton.rb +11 -9
- data/sample/gtk-demo/modelbutton.ui +3 -0
- data/sample/gtk-demo/overlay.rb +39 -32
- data/sample/gtk-demo/overlay2.rb +68 -54
- data/sample/gtk-demo/panes.rb +56 -68
- data/sample/gtk-demo/pickers.rb +46 -45
- data/sample/gtk-demo/pixbufs.rb +27 -25
- data/sample/gtk-demo/popover.rb +70 -63
- data/sample/gtk-demo/printing.rb +94 -69
- data/sample/gtk-demo/revealer.rb +46 -38
- data/sample/gtk-demo/rotated_text.rb +75 -54
- data/sample/gtk-demo/scale.rb +10 -8
- data/sample/gtk-demo/search_entry.rb +195 -0
- data/sample/gtk-demo/search_entry2.rb +71 -59
- data/sample/gtk-demo/sidebar.rb +20 -19
- data/sample/gtk-demo/sizegroup.rb +36 -35
- data/sample/gtk-demo/spinbutton.rb +128 -0
- data/sample/gtk-demo/spinner.rb +55 -40
- data/sample/gtk-demo/stack.rb +11 -8
- data/sample/gtk-demo/textmask.rb +14 -13
- data/sample/gtk-demo/textscroll.rb +16 -12
- data/sample/gtk-demo/theming_style_classes.rb +14 -12
- data/sample/gtk-demo/transparent.rb +17 -13
- data/sample/misc/treemodelfilter.rb +1 -1
- metadata +21 -16
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2008-
|
1
|
+
# Copyright (c) 2008-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -8,20 +8,20 @@ Gtk::EntryBuffer provides the text content in a Gtk::Entry.
|
|
8
8
|
Applications can provide their own buffer implementation,
|
9
9
|
e.g. to provide secure handling for passwords in memory.
|
10
10
|
=end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
window =
|
15
|
-
window.
|
16
|
-
window.
|
17
|
-
window.set_resizable(false)
|
11
|
+
class EntryBufferDemo
|
12
|
+
def initialize(main_window)
|
13
|
+
@window = Gtk::Window.new(:toplevel)
|
14
|
+
@window.screen = main_window.screen
|
15
|
+
@window.title = "Entry Buffer"
|
16
|
+
@window.resizable = false
|
18
17
|
|
19
18
|
vbox = Gtk::Box.new(:vertical, 5)
|
20
|
-
window.add(vbox)
|
19
|
+
@window.add(vbox)
|
21
20
|
vbox.set_border_width(5)
|
22
21
|
|
23
22
|
label = Gtk::Label.new
|
24
|
-
|
23
|
+
markup = "Entries share a buffer. Typing in one is reflected in the other."
|
24
|
+
label.markup = markup
|
25
25
|
vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
|
26
26
|
|
27
27
|
# Create the buffer that will be shared
|
@@ -34,11 +34,13 @@ module EntryBufferDemo
|
|
34
34
|
# second entry
|
35
35
|
entry = Gtk::Entry.new(buffer)
|
36
36
|
vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0)
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
def run
|
40
|
+
if !@window.visible?
|
41
|
+
@window.show_all
|
40
42
|
else
|
41
|
-
window.destroy
|
43
|
+
@window.destroy
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -7,19 +7,20 @@
|
|
7
7
|
GtkEntryCompletion provides a mechanism for adding support for
|
8
8
|
completion in GtkEntry.
|
9
9
|
=end
|
10
|
-
|
11
|
-
def
|
12
|
-
window = Gtk::Window.new(:toplevel)
|
13
|
-
window.screen = main_window.screen
|
14
|
-
window.
|
15
|
-
window.
|
10
|
+
class EntryCompletionDemo
|
11
|
+
def initialize(main_window)
|
12
|
+
@window = Gtk::Window.new(:toplevel)
|
13
|
+
@window.screen = main_window.screen
|
14
|
+
@window.title = "Entry Completion"
|
15
|
+
@window.resizable = true
|
16
16
|
|
17
17
|
vbox = Gtk::Box.new(:vertical, 5)
|
18
|
-
window.add(vbox)
|
19
|
-
vbox.
|
18
|
+
@window.add(vbox)
|
19
|
+
vbox.border_width = 5
|
20
20
|
|
21
21
|
label = Gtk::Label.new
|
22
|
-
|
22
|
+
markup = "Completion demo, try writing <b>total</b> or <b>gnome</b> for example."
|
23
|
+
label.markup = markup
|
23
24
|
vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
|
24
25
|
|
25
26
|
entry = Gtk::Entry.new
|
@@ -28,18 +29,22 @@ module EntryCompletionDemo
|
|
28
29
|
completion = Gtk::EntryCompletion.new
|
29
30
|
entry.completion = completion
|
30
31
|
|
31
|
-
completion.
|
32
|
-
completion.
|
32
|
+
completion.model = create_completion_model
|
33
|
+
completion.text_column = 0
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
+
def run
|
37
|
+
if !@window.visible?
|
38
|
+
@window.show_all
|
36
39
|
else
|
37
|
-
window.destroy
|
40
|
+
@window.destroy
|
38
41
|
end
|
39
|
-
window
|
42
|
+
@window
|
40
43
|
end
|
41
44
|
|
42
|
-
|
45
|
+
private
|
46
|
+
|
47
|
+
def create_completion_model
|
43
48
|
store = Gtk::ListStore.new(String)
|
44
49
|
%w(GNOME total totally).each do |word|
|
45
50
|
iter = store.append
|
data/sample/gtk-demo/expander.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -9,22 +9,22 @@ This is also known as "disclosure triangle".
|
|
9
9
|
|
10
10
|
This example also shows how to make the window resizable only if the expander is expanded.
|
11
11
|
=end
|
12
|
-
|
13
|
-
def
|
12
|
+
class ExpanderDemo
|
13
|
+
def initialize(main_window)
|
14
14
|
toplevel = main_window.toplevel
|
15
15
|
message = "<big><b>Something went wrong</b></big>"
|
16
|
-
window = Gtk::MessageDialog.new(:parent => toplevel,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
@window = Gtk::MessageDialog.new(:parent => toplevel,
|
17
|
+
:flags => :destroy_with_parent,
|
18
|
+
:type => :error,
|
19
|
+
:buttons_type => :close,
|
20
|
+
:message => message)
|
21
21
|
|
22
|
-
window.
|
22
|
+
@window.use_markup = true
|
23
23
|
|
24
24
|
message = "Here are some more details but not the full story."
|
25
|
-
window.
|
25
|
+
@window.secondary_text = message
|
26
26
|
|
27
|
-
area = window.message_area
|
27
|
+
area = @window.message_area
|
28
28
|
box = area.parent
|
29
29
|
box.parent.child_set_property(box, "expand", true)
|
30
30
|
box.parent.child_set_property(box, "fill", true)
|
@@ -39,38 +39,46 @@ module ExpanderDemo
|
|
39
39
|
sw.set_shadow_type(:in)
|
40
40
|
sw.set_policy(:never, :automatic)
|
41
41
|
|
42
|
-
tv =
|
43
|
-
tv.set_editable(false)
|
44
|
-
tv.set_wrap_mode(:word)
|
45
|
-
tv.buffer.text = <<TEXT
|
46
|
-
Finally, the full story with all details.
|
47
|
-
And all the inside information, including
|
48
|
-
error codes, etc etc. Pages of information,
|
49
|
-
you might have to scroll down to read it all,
|
50
|
-
or even resize the window - it works !
|
51
|
-
|
52
|
-
A second paragraph will contain even more
|
53
|
-
innuendo, just to make you scroll down or
|
54
|
-
resize the window. Do it already !"
|
55
|
-
TEXT
|
56
|
-
|
42
|
+
tv = initialize_text_view
|
57
43
|
sw.add(tv)
|
58
44
|
expander.add(sw)
|
59
45
|
area.pack_end(expander, :expand => true, :fill => true, :padding => 0)
|
60
46
|
expander.show_all
|
61
47
|
|
62
48
|
expander.signal_connect "notify::expanded" do
|
63
|
-
window.
|
49
|
+
@window.resizable = expander.expanded?
|
64
50
|
end
|
65
51
|
|
66
|
-
window.signal_connect "response" do |dialog, _response_id|
|
52
|
+
@window.signal_connect "response" do |dialog, _response_id|
|
67
53
|
dialog.destroy
|
68
54
|
end
|
55
|
+
end
|
69
56
|
|
70
|
-
|
71
|
-
|
57
|
+
def run
|
58
|
+
if !@window.visible?
|
59
|
+
@window.show_all
|
72
60
|
else
|
73
|
-
window.destroy
|
61
|
+
@window.destroy
|
74
62
|
end
|
75
63
|
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def initialize_text_view
|
68
|
+
tv = Gtk::TextView.new
|
69
|
+
tv.editable = false
|
70
|
+
tv.wrap_mode = :word
|
71
|
+
tv.buffer.text = <<TEXT
|
72
|
+
Finally, the full story with all details.
|
73
|
+
And all the inside information, including
|
74
|
+
error codes, etc etc. Pages of information,
|
75
|
+
you might have to scroll down to read it all,
|
76
|
+
or even resize the window - it works !
|
77
|
+
|
78
|
+
A second paragraph will contain even more
|
79
|
+
innuendo, just to make you scroll down or
|
80
|
+
resize the window. Do it already !"
|
81
|
+
TEXT
|
82
|
+
tv
|
83
|
+
end
|
76
84
|
end
|
@@ -8,64 +8,87 @@
|
|
8
8
|
just to show a subset of the rows, but also to compute columns
|
9
9
|
that are not actually present in the underlying model.
|
10
10
|
=end
|
11
|
-
|
11
|
+
class FiltermodelDemo
|
12
12
|
WIDTH_COLUMN = 0
|
13
13
|
HEIGHT_COLUMN = 1
|
14
14
|
AREA_COLUMN = 2
|
15
15
|
SQUARE_COLUMN = 3
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
builder.connect_signals {}
|
17
|
+
def initialize(main_window)
|
18
|
+
initialize_builder
|
20
19
|
|
21
|
-
window = builder["window1"]
|
22
|
-
window.screen = main_window.screen
|
20
|
+
@window = @builder["window1"]
|
21
|
+
@window.screen = main_window.screen
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn1",
|
24
|
+
"cellrenderertext1",
|
25
|
+
WIDTH_COLUMN)
|
26
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn2",
|
27
|
+
"cellrenderertext2",
|
28
|
+
HEIGHT_COLUMN)
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
num = current_iter[HEIGHT_COLUMN]
|
35
|
-
current_cell.text = num.to_s
|
36
|
-
end
|
30
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn3",
|
31
|
+
"cellrenderertext3",
|
32
|
+
WIDTH_COLUMN)
|
37
33
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
num = current_iter[WIDTH_COLUMN]
|
42
|
-
current_cell.text = num.to_s
|
43
|
-
end
|
34
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn4",
|
35
|
+
"cellrenderertext4",
|
36
|
+
HEIGHT_COLUMN)
|
44
37
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn5",
|
39
|
+
"cellrenderertext5",
|
40
|
+
AREA_COLUMN)
|
41
|
+
|
42
|
+
column = @builder["treeviewcolumn6"]
|
43
|
+
cell = @builder["cellrendererpixbuf1"]
|
44
|
+
column.add_attribute(cell, "visible", SQUARE_COLUMN)
|
45
|
+
|
46
|
+
@store = @builder["liststore1"]
|
47
|
+
|
48
|
+
initialize_tree_model_filter_computed
|
49
|
+
|
50
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn7",
|
51
|
+
"cellrenderertext6",
|
52
|
+
WIDTH_COLUMN)
|
53
|
+
|
54
|
+
set_treeview_column_data_from_int_to_string("treeviewcolumn8",
|
55
|
+
"cellrenderertext7",
|
56
|
+
HEIGHT_COLUMN)
|
57
|
+
|
58
|
+
initialize_tree_model_filter_selected
|
59
|
+
end
|
60
|
+
|
61
|
+
def run
|
62
|
+
if !@window.visible?
|
63
|
+
@window.show_all
|
64
|
+
else
|
65
|
+
@window.destroy
|
50
66
|
end
|
67
|
+
@window
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
51
71
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
72
|
+
def initialize_builder
|
73
|
+
@builder = Gtk::Builder.new(:resource => "/filtermodel/filtermodel.ui")
|
74
|
+
@builder.connect_signals {}
|
75
|
+
end
|
76
|
+
|
77
|
+
def set_treeview_column_data_from_int_to_string(column_name, cell_name, col_index)
|
78
|
+
column = @builder[column_name]
|
79
|
+
cell = @builder[cell_name]
|
80
|
+
column.set_cell_data_func(cell) do |_col, current_cell, _current_model, current_iter|
|
81
|
+
num = current_iter[col_index]
|
56
82
|
current_cell.text = num.to_s
|
57
83
|
end
|
84
|
+
end
|
58
85
|
|
59
|
-
|
60
|
-
|
61
|
-
column.add_attribute(cell, "visible", SQUARE_COLUMN)
|
62
|
-
|
63
|
-
store = builder["liststore1"]
|
64
|
-
tree = builder["treeview2"]
|
86
|
+
def initialize_tree_model_filter_computed
|
87
|
+
tree = @builder["treeview2"]
|
65
88
|
|
66
89
|
types = [Integer, Integer, Integer, TrueClass]
|
67
90
|
|
68
|
-
model =
|
91
|
+
model = @store.create_filter
|
69
92
|
model.set_modify_func(*types) do |filter_model, filter_iter, filter_column|
|
70
93
|
value = nil
|
71
94
|
child_iter = filter_model.convert_iter_to_child_iter(filter_iter)
|
@@ -85,35 +108,16 @@ module FiltermodelDemo
|
|
85
108
|
end
|
86
109
|
|
87
110
|
tree.model = model
|
111
|
+
end
|
88
112
|
|
89
|
-
|
90
|
-
|
91
|
-
column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
|
92
|
-
num = current_iter[WIDTH_COLUMN]
|
93
|
-
current_cell.text = num.to_s
|
94
|
-
end
|
95
|
-
|
96
|
-
column = builder["treeviewcolumn8"]
|
97
|
-
cell = builder["cellrenderertext7"]
|
98
|
-
column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
|
99
|
-
num = current_iter[HEIGHT_COLUMN]
|
100
|
-
current_cell.text = num.to_s
|
101
|
-
end
|
102
|
-
|
103
|
-
tree = builder["treeview3"]
|
113
|
+
def initialize_tree_model_filter_selected
|
114
|
+
tree = @builder["treeview3"]
|
104
115
|
|
105
|
-
model =
|
116
|
+
model = @store.create_filter
|
106
117
|
model.set_visible_func do |_current_model, current_iter|
|
107
118
|
current_iter[WIDTH_COLUMN] < 10
|
108
119
|
end
|
109
120
|
|
110
121
|
tree.model = model
|
111
|
-
|
112
|
-
if !window.visible?
|
113
|
-
window.show_all
|
114
|
-
else
|
115
|
-
window.destroy
|
116
|
-
end
|
117
|
-
window
|
118
122
|
end
|
119
123
|
end
|
@@ -8,80 +8,115 @@
|
|
8
8
|
Pango attributes. The attributes can be used manually or
|
9
9
|
via Pango markup.
|
10
10
|
=end
|
11
|
-
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
class FontFeaturesDemo
|
12
|
+
def initialize(_main_window)
|
13
|
+
initialize_builder
|
14
|
+
initialize_widgets
|
15
|
+
builder_add_callback_symbols
|
16
|
+
|
17
|
+
update(@toggle, @entry, @font, @settings, @label)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
if !@window.visible?
|
22
|
+
@window.show_all
|
23
|
+
else
|
24
|
+
@window.destroy
|
25
|
+
end
|
26
|
+
@window
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def initialize_builder
|
32
|
+
@builder = Gtk::Builder.new(:resource => "/font_features/font-features.ui")
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize_widgets
|
36
|
+
@window = @builder["window"]
|
37
|
+
@label = @builder["label"]
|
38
|
+
@settings = @builder["settings"]
|
39
|
+
@resetbutton = @builder["reset"]
|
40
|
+
@font = @builder["font"]
|
41
|
+
@numcasedefault = @builder["numcasedefault"]
|
42
|
+
@numspacedefault = @builder["numspacedefault"]
|
43
|
+
@fractiondefault = @builder["fractiondefault"]
|
44
|
+
@stack = @builder["stack"]
|
45
|
+
@entry = @builder["entry"]
|
46
|
+
@toggle = []
|
25
47
|
|
26
48
|
%w(kern liga dlig hlig clig smcp c2sc lnum onum pnum tnum frac afrc zero
|
27
49
|
nalt swsh calt hist salt ss01 ss02 ss03 ss04 ss05).each do |name|
|
28
|
-
toggle << builder[name]
|
50
|
+
@toggle << @builder[name]
|
29
51
|
end
|
30
|
-
text = nil
|
52
|
+
@text = nil
|
53
|
+
end
|
31
54
|
|
32
|
-
|
55
|
+
def builder_add_callback_symbols
|
56
|
+
@builder.connect_signals do |name|
|
33
57
|
case name
|
34
58
|
when "reset"
|
35
|
-
|
36
|
-
numcasedefault.active = true
|
37
|
-
numspacedefault.active = true
|
38
|
-
fractiondefault.active = true
|
39
|
-
toggle.each do |widget|
|
40
|
-
if widget.class != Gtk::RadioButton
|
41
|
-
widget.active = false
|
42
|
-
widget.sensitive = false
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
59
|
+
reset_callback
|
46
60
|
when "update"
|
47
|
-
|
48
|
-
update(toggle, entry, font, settings, label)
|
49
|
-
end
|
61
|
+
update_callback
|
50
62
|
when "switch_to_entry"
|
51
|
-
|
52
|
-
text = entry.text
|
53
|
-
stack.visible_child_name = "entry"
|
54
|
-
end
|
63
|
+
switch_to_entry_callback
|
55
64
|
when "switch_to_label"
|
56
|
-
|
57
|
-
text = nil
|
58
|
-
stack.set_visible_child_name("label")
|
59
|
-
update(toggle, entry, font, settings, label)
|
60
|
-
end
|
65
|
+
switch_to_label_callback
|
61
66
|
when "entry_key_press"
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
entry_key_press_callback
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def reset_callback
|
73
|
+
proc do
|
74
|
+
@numcasedefault.active = true
|
75
|
+
@numspacedefault.active = true
|
76
|
+
@fractiondefault.active = true
|
77
|
+
@toggle.each do |widget|
|
78
|
+
if widget.class != Gtk::RadioButton
|
79
|
+
widget.active = false
|
80
|
+
widget.sensitive = false
|
70
81
|
end
|
71
82
|
end
|
72
83
|
end
|
84
|
+
end
|
73
85
|
|
74
|
-
|
86
|
+
def update_callback
|
87
|
+
proc do
|
88
|
+
update(@toggle, @entry, @font, @settings, @label)
|
89
|
+
end
|
90
|
+
end
|
75
91
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
92
|
+
def switch_to_entry_callback
|
93
|
+
proc do
|
94
|
+
@text = @entry.text
|
95
|
+
@stack.visible_child_name = "entry"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def switch_to_label_callback
|
100
|
+
proc do
|
101
|
+
@text = nil
|
102
|
+
@stack.set_visible_child_name("label")
|
103
|
+
update(@toggle, @entry, @font, @settings, @label)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def entry_key_press_callback
|
108
|
+
proc do |_entry, event|
|
109
|
+
if event.keyval == Gdk::Keyval::KEY_Escape
|
110
|
+
@entry.text = @text
|
111
|
+
@text = nil
|
112
|
+
@stack.set_visible_child_name("label")
|
113
|
+
update(@toggle, @entry, @font, @settings, @label)
|
114
|
+
end
|
115
|
+
Gdk::Event::PROPAGATE
|
80
116
|
end
|
81
|
-
window
|
82
117
|
end
|
83
118
|
|
84
|
-
def
|
119
|
+
def update(toggle, entry, font, settings, label)
|
85
120
|
text = entry.text
|
86
121
|
font_desc = font.font
|
87
122
|
s = ""
|
@@ -100,11 +135,7 @@ module FontFeaturesDemo
|
|
100
135
|
else
|
101
136
|
s += ", " if has_feature
|
102
137
|
s += widget.builder_name
|
103
|
-
|
104
|
-
s += " 1"
|
105
|
-
else
|
106
|
-
s += " 0"
|
107
|
-
end
|
138
|
+
s += widget.active? ? " 1" : " 0"
|
108
139
|
has_feature = true
|
109
140
|
end
|
110
141
|
end
|