glimmer-dsl-tk 0.0.37 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/README.md +522 -6
- data/VERSION +1 -1
- data/glimmer-dsl-tk.gemspec +0 -0
- data/lib/glimmer/dsl/tk/block_attribute_expression.rb +6 -2
- data/lib/glimmer/dsl/tk/dsl.rb +1 -1
- data/lib/glimmer/tk/checkbutton_proxy.rb +0 -2
- data/lib/glimmer/tk/menu_item_proxy.rb +202 -0
- data/lib/glimmer/tk/menu_proxy.rb +88 -0
- data/lib/glimmer/tk/radiobutton_proxy.rb +0 -3
- data/lib/glimmer/tk/root_proxy.rb +0 -16
- data/lib/glimmer/tk/scrollbar_frame_proxy.rb +133 -0
- data/lib/glimmer/tk/toplevel_proxy.rb +16 -0
- data/lib/glimmer/tk/widget_proxy.rb +45 -22
- data/lib/glimmer-dsl-tk.rb +16 -0
- data/samples/hello/hello_button.rb +4 -4
- data/samples/hello/hello_checkbutton.rb +1 -1
- data/samples/hello/hello_menu_bar.rb +265 -0
- data/{lib/glimmer/tk/commandable.rb → samples/hello/hello_scrollbar.rb} +43 -19
- data/samples/hello/hello_scrollbar_frame.rb +77 -0
- data/samples/hello/hello_text.rb +16 -6
- data/samples/hello/hello_toplevel.rb +1 -1
- metadata +8 -4
- data/lib/glimmer/tk/button_proxy.rb +0 -34
data/lib/glimmer-dsl-tk.rb
CHANGED
@@ -27,16 +27,32 @@ require 'glimmer'
|
|
27
27
|
require 'puts_debuggerer' if ENV['pd'].to_s.downcase == 'true'
|
28
28
|
# require 'super_module'
|
29
29
|
require 'tk'
|
30
|
+
require 'tkextlib/bwidget'
|
31
|
+
require 'tkextlib/iwidgets'
|
30
32
|
require 'os'
|
31
33
|
require 'facets/hash/symbolize_keys'
|
34
|
+
require 'facets/string/underscore'
|
35
|
+
require 'facets/string/camelcase'
|
36
|
+
require 'delegate'
|
32
37
|
|
33
38
|
# Internal requires
|
34
39
|
# require 'ext/glimmer/config'
|
35
40
|
# require 'ext/glimmer'
|
36
41
|
require 'glimmer/dsl/tk/dsl'
|
42
|
+
|
37
43
|
Glimmer::Config.loop_max_count = -1
|
44
|
+
|
38
45
|
Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
|
39
46
|
method = method_symbol.to_s
|
40
47
|
result = false
|
41
48
|
result ||= method == 'load_iseq'
|
42
49
|
end
|
50
|
+
|
51
|
+
Tk::Tile::Style.theme_use 'alt' if OS.linux?
|
52
|
+
|
53
|
+
::TkOption.add '*tearOff', 0
|
54
|
+
|
55
|
+
class ::Tk::TkSysMenu_Window < Tk::Menu
|
56
|
+
include Tk::SystemMenu
|
57
|
+
SYSMENU_NAME = 'window'
|
58
|
+
end
|
@@ -47,7 +47,7 @@ class HelloButton
|
|
47
47
|
default 'active'
|
48
48
|
focus true
|
49
49
|
|
50
|
-
command {
|
50
|
+
on('command') {
|
51
51
|
self.count += 1
|
52
52
|
}
|
53
53
|
}
|
@@ -64,7 +64,7 @@ class HelloButton
|
|
64
64
|
button {
|
65
65
|
image File.expand_path('../../icons/glimmer.png', __dir__), subsample: 5
|
66
66
|
|
67
|
-
command {
|
67
|
+
on('command') {
|
68
68
|
message_box(title: 'Image Button', message: 'Image Button Clicked!')
|
69
69
|
}
|
70
70
|
}
|
@@ -81,10 +81,10 @@ class HelloButton
|
|
81
81
|
['center', 'top', 'bottom', 'left', 'right'].each do |compound_option|
|
82
82
|
button {
|
83
83
|
image File.expand_path('../../icons/glimmer.png', __dir__), subsample: 5
|
84
|
-
text
|
84
|
+
text "#{compound_option.capitalize} Image"
|
85
85
|
compound compound_option
|
86
86
|
|
87
|
-
command {
|
87
|
+
on('command') {
|
88
88
|
message_box(title: 'Text Image Button', message: 'Text Image Button Clicked!', detail: "(#{compound_option})")
|
89
89
|
}
|
90
90
|
}
|
@@ -0,0 +1,265 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
COLORS = [:white, :red, :yellow, :green, :blue, :magenta, :gray, :black]
|
27
|
+
|
28
|
+
Tk::Tile::Style.theme_use "classic" # this enables setting background on label just for demo purposes
|
29
|
+
|
30
|
+
root { |r|
|
31
|
+
title 'Hello, Menu Bar!'
|
32
|
+
|
33
|
+
@label = label {
|
34
|
+
grid row_weight: 1, column_weight: 1
|
35
|
+
text 'Check Out The Menu Bar Above!'
|
36
|
+
font size: 50
|
37
|
+
anchor 'center'
|
38
|
+
}
|
39
|
+
|
40
|
+
menu {
|
41
|
+
# Mac-specific application menu (right next to the Apple menu)
|
42
|
+
if OS.mac?
|
43
|
+
menu(:application) {
|
44
|
+
menu_item(:about, label: 'About My Application') {
|
45
|
+
accelerator 'Command+A'
|
46
|
+
|
47
|
+
on('command') do
|
48
|
+
message_box(parent: r, title: 'About', message: 'About my application.')
|
49
|
+
end
|
50
|
+
}
|
51
|
+
|
52
|
+
menu_item(:preferences) {
|
53
|
+
on('command') do
|
54
|
+
message_box(parent: r, title: 'Preferences', message: 'Preferences of my application.')
|
55
|
+
end
|
56
|
+
}
|
57
|
+
|
58
|
+
# If not defined, application simply quits upon selecting Quit menu item
|
59
|
+
menu_item(:quit) {
|
60
|
+
on('command') do
|
61
|
+
message_box(parent: r, title: 'Quit', message: 'Quitting my application...')
|
62
|
+
exit(0)
|
63
|
+
end
|
64
|
+
}
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Windows-specific system menu (to the top-left of the window frame)
|
69
|
+
if OS.windows?
|
70
|
+
menu(label: 'System')
|
71
|
+
end
|
72
|
+
|
73
|
+
menu(label: 'File', underline: 0) {
|
74
|
+
menu_item(label: 'New', underline: 0) {
|
75
|
+
accelerator OS.mac? ? 'Command+N' : 'Control+N'
|
76
|
+
|
77
|
+
on('command') do
|
78
|
+
message_box(parent: r, title: 'New', message: 'New file created.')
|
79
|
+
end
|
80
|
+
}
|
81
|
+
|
82
|
+
menu_item(label: 'Open...', underline: 0) {
|
83
|
+
accelerator OS.mac? ? 'Command+O' : 'Control+O'
|
84
|
+
|
85
|
+
on('command') do
|
86
|
+
message_box(parent: r, title: 'Open', message: 'Opening File...')
|
87
|
+
end
|
88
|
+
}
|
89
|
+
|
90
|
+
menu(label: 'Open Recent', underline: 5) {
|
91
|
+
menu_item(label: 'File 1') {
|
92
|
+
on('command') do
|
93
|
+
message_box(parent: r, title: 'File 1', message: 'File 1 Contents')
|
94
|
+
end
|
95
|
+
}
|
96
|
+
|
97
|
+
menu_item(label: 'File 2') {
|
98
|
+
on('command') do
|
99
|
+
message_box(parent: r, title: 'File 2', message: 'File 2 Contents')
|
100
|
+
end
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
menu_item(:separator)
|
105
|
+
|
106
|
+
menu_item(label: 'Exit', underline: 1) {
|
107
|
+
on('command') do
|
108
|
+
exit(0)
|
109
|
+
end
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
menu(label: 'Edit', underline: 0) {
|
114
|
+
menu_item(label: 'Cut', underline: 2) {
|
115
|
+
accelerator OS.mac? ? 'Command+X' : 'Control+X'
|
116
|
+
}
|
117
|
+
|
118
|
+
menu_item(label: 'Copy', underline: 0) {
|
119
|
+
accelerator OS.mac? ? 'Command+C' : 'Control+C'
|
120
|
+
}
|
121
|
+
|
122
|
+
menu_item(label: 'Paste', underline: 0) {
|
123
|
+
accelerator OS.mac? ? 'Command+V' : 'Control+V'
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
menu(label: 'Options', underline: 0) {
|
128
|
+
menu_item(:checkbutton, label: 'Enabled', underline: 0) {
|
129
|
+
on('command') do
|
130
|
+
@select_one_menu.children.each { |menu_item| menu_item.state = menu_item.state == 'disabled' ? 'normal' : 'disabled' }
|
131
|
+
@select_multiple_menu.children.each { |menu_item| menu_item.state = menu_item.state == 'disabled' ? 'normal' : 'disabled' }
|
132
|
+
end
|
133
|
+
}
|
134
|
+
|
135
|
+
@select_one_menu = menu(label: 'Select One', underline: 7) {
|
136
|
+
menu_item(:radiobutton, label: 'Option 1') {
|
137
|
+
state 'disabled'
|
138
|
+
}
|
139
|
+
menu_item(:radiobutton, label: 'Option 2') {
|
140
|
+
state 'disabled'
|
141
|
+
}
|
142
|
+
menu_item(:radiobutton, label: 'Option 3') {
|
143
|
+
state 'disabled'
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
@select_multiple_menu = menu(label: 'Select Multiple', underline: 7) {
|
148
|
+
menu_item(:checkbutton, label: 'Option 4') {
|
149
|
+
state 'disabled'
|
150
|
+
}
|
151
|
+
menu_item(:checkbutton, label: 'Option 5') {
|
152
|
+
state 'disabled'
|
153
|
+
}
|
154
|
+
menu_item(:checkbutton, label: 'Option 6') {
|
155
|
+
state 'disabled'
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
menu(label: 'Language', underline: 3) {
|
161
|
+
['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
|
162
|
+
menu_item(:radiobutton, label: image_name.capitalize) {
|
163
|
+
selection image_name == 'usa'
|
164
|
+
image File.expand_path("images/#{image_name}.png", __dir__)
|
165
|
+
}
|
166
|
+
end
|
167
|
+
}
|
168
|
+
|
169
|
+
menu(label: 'Country', underline: 3) {
|
170
|
+
['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
|
171
|
+
menu_item(:radiobutton, label: image_name.capitalize) {
|
172
|
+
selection image_name == 'usa'
|
173
|
+
image File.expand_path("images/#{image_name}.png", __dir__)
|
174
|
+
compound 'left'
|
175
|
+
}
|
176
|
+
end
|
177
|
+
}
|
178
|
+
|
179
|
+
menu(label: 'Format', underline: 0) {
|
180
|
+
menu(label: 'Background Color', underline: 0) {
|
181
|
+
COLORS.each { |color_style|
|
182
|
+
menu_item(:radiobutton, label: color_style.to_s.split('_').map(&:capitalize).join(' ')) {
|
183
|
+
on('command') do
|
184
|
+
@label.background = color_style
|
185
|
+
end
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
menu(label: 'Foreground Color', underline: 11) {
|
191
|
+
COLORS.each { |color_style|
|
192
|
+
menu_item(:radiobutton, label: color_style.to_s.split('_').map(&:capitalize).join(' ')) {
|
193
|
+
on('command') do
|
194
|
+
@label.foreground = color_style
|
195
|
+
end
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
menu(label: 'View', underline: 0) {
|
202
|
+
menu_item(:radiobutton, label: 'Small', underline: 0) {
|
203
|
+
accelerator OS.mac? ? 'Command+S' : 'Control+S'
|
204
|
+
|
205
|
+
on('command') do
|
206
|
+
@label.font = {size: 25}
|
207
|
+
end
|
208
|
+
}
|
209
|
+
|
210
|
+
menu_item(:radiobutton, label: 'Medium', underline: 0) {
|
211
|
+
accelerator OS.mac? ? 'Command+M' : 'Control+M'
|
212
|
+
selection true
|
213
|
+
|
214
|
+
on('command') do
|
215
|
+
@label.font = {size: 50}
|
216
|
+
end
|
217
|
+
}
|
218
|
+
|
219
|
+
menu_item(:radiobutton, label: 'Large', underline: 0) {
|
220
|
+
accelerator OS.mac? ? 'Command+L' : 'Control+L'
|
221
|
+
|
222
|
+
on('command') do
|
223
|
+
@label.font = {size: 75}
|
224
|
+
end
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
# Mac-specific window menu (containing zooming/resizing menu items)
|
229
|
+
menu(label: 'Window', underline: 0) if OS.mac?
|
230
|
+
|
231
|
+
menu(label: 'Help', underline: 0) {
|
232
|
+
if OS.mac?
|
233
|
+
menu_item(:help) {
|
234
|
+
on('command') do
|
235
|
+
message_box(parent: r, title: 'Help', message: 'Help for my application.')
|
236
|
+
end
|
237
|
+
}
|
238
|
+
end
|
239
|
+
|
240
|
+
menu_item(label: 'Manual', underline: 0) {
|
241
|
+
accelerator OS.mac? ? 'Command+Shift+M' : 'Control+U'
|
242
|
+
|
243
|
+
on('command') do
|
244
|
+
message_box(parent: r, title: 'Manual', message: 'Manual Contents')
|
245
|
+
end
|
246
|
+
}
|
247
|
+
|
248
|
+
menu_item(label: 'Tutorial', underline: 0) {
|
249
|
+
accelerator OS.mac? ? 'Command+Shift+T' : 'Control+T'
|
250
|
+
|
251
|
+
on('command') do
|
252
|
+
message_box(parent: r, title: 'Tutorial', message: 'Tutorial Contents')
|
253
|
+
end
|
254
|
+
}
|
255
|
+
|
256
|
+
menu_item(:separator)
|
257
|
+
|
258
|
+
menu_item(label: 'Report an Issue...', underline: 0) {
|
259
|
+
on('command') do
|
260
|
+
message_box(parent: r, title: 'Report an Issue', message: 'Reporting an issue...')
|
261
|
+
end
|
262
|
+
}
|
263
|
+
}
|
264
|
+
}
|
265
|
+
}.open
|
@@ -19,24 +19,48 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
-
require 'glimmer
|
22
|
+
require 'glimmer-dsl-tk'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
root {
|
27
|
+
title 'Hello, Scrollbar!'
|
28
|
+
width 400
|
29
|
+
height 500
|
30
|
+
|
31
|
+
notebook {
|
32
|
+
grid sticky: 'nsew'
|
33
|
+
|
34
|
+
frame(text: 'Scrollable List') {
|
35
|
+
@list = list {
|
36
|
+
grid sticky: 'nsew', row: 0, column: 0, row_weight: 1, column_weight: 1
|
37
|
+
items 40.times.map {|n| "Item #{n + 1} of a very long list" }
|
38
|
+
}
|
39
|
+
|
40
|
+
@scrollbar = scrollbar {
|
41
|
+
grid row: 0, column: 1
|
42
|
+
# orient 'vertical' # default
|
43
|
+
}
|
44
|
+
@list.yscrollbar @scrollbar
|
45
|
+
}
|
46
|
+
|
47
|
+
frame(text: 'Scrollable Text') {
|
48
|
+
@text = text {
|
49
|
+
grid sticky: 'nsew', row: 0, column: 0, row_weight: 1, column_weight: 1
|
50
|
+
value ("This is a random sample of text that will repeat over and over and over"*2 + "\n")*40
|
51
|
+
}
|
31
52
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
53
|
+
@yscrollbar = scrollbar {
|
54
|
+
grid row: 0, column: 1
|
55
|
+
# orient 'vertical' # default
|
56
|
+
}
|
57
|
+
@text.yscrollbar @yscrollbar
|
58
|
+
|
59
|
+
@xscrollbar = scrollbar {
|
60
|
+
grid row: 1, column: 0, column_span: 2, row_weight: 0
|
61
|
+
orient 'horizontal'
|
62
|
+
}
|
63
|
+
@text.xscrollbar @xscrollbar
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}.open
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer-dsl-tk'
|
23
|
+
|
24
|
+
include Glimmer
|
25
|
+
|
26
|
+
root {
|
27
|
+
title 'Hello, Scrollbar Frame!'
|
28
|
+
width 400
|
29
|
+
height 400
|
30
|
+
|
31
|
+
notebook {
|
32
|
+
grid sticky: 'nsew'
|
33
|
+
|
34
|
+
frame(text: 'X/Y Scroll') {
|
35
|
+
scrollbar_frame {
|
36
|
+
30.times do |row|
|
37
|
+
10.times do |column|
|
38
|
+
button {
|
39
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
40
|
+
text "Row #{row} | Column #{column}"
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
frame(text: 'Y Scroll') {
|
48
|
+
scrollbar_frame {
|
49
|
+
xscrollbar false
|
50
|
+
|
51
|
+
30.times do |row|
|
52
|
+
2.times do |column|
|
53
|
+
button {
|
54
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
55
|
+
text "Row #{row} | Column #{column}"
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
frame(text: 'X Scroll') {
|
63
|
+
scrollbar_frame {
|
64
|
+
yscrollbar false
|
65
|
+
|
66
|
+
13.times do |row|
|
67
|
+
10.times do |column|
|
68
|
+
button {
|
69
|
+
grid row: row, column: column, row_weight: 0, column_weight: 0
|
70
|
+
text "Row #{row} | Column #{column}"
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}.open
|
data/samples/hello/hello_text.rb
CHANGED
@@ -105,32 +105,32 @@ class HelloText
|
|
105
105
|
height 800
|
106
106
|
|
107
107
|
frame {
|
108
|
-
grid row: 0, column: 0
|
108
|
+
grid row: 0, column: 0, column_span: 2
|
109
109
|
|
110
110
|
column_index = -1
|
111
111
|
|
112
112
|
combobox { |cb|
|
113
113
|
grid row: 1, column: column_index += 1, column_weight: 1
|
114
114
|
readonly true
|
115
|
-
text <=> [self, :font_family, after_write: ->(value) { @text.toggle_selection_font_format('family', value == FONT_FAMILY_PROMPT ? 'Courier New' : value, focus: 100) }]
|
115
|
+
text <=> [self, :font_family, after_write: ->(value) { @text.toggle_selection_font_format('family', value == FONT_FAMILY_PROMPT ? 'Courier New' : value, focus: OS.mac? ? 100 : true) }]
|
116
116
|
}
|
117
117
|
|
118
118
|
combobox {
|
119
119
|
grid row: 1, column: column_index += 1, column_weight: 1
|
120
120
|
readonly true
|
121
|
-
text <=> [self, :font_size, after_write: ->(value) { @text.toggle_selection_font_format('size', value == FONT_SIZE_PROMPT ? 13 : value, focus: 100) }]
|
121
|
+
text <=> [self, :font_size, after_write: ->(value) { @text.toggle_selection_font_format('size', value == FONT_SIZE_PROMPT ? 13 : value, focus: OS.mac? ? 100 : true) }]
|
122
122
|
}
|
123
123
|
|
124
124
|
combobox {
|
125
125
|
grid row: 1, column: column_index += 1, column_weight: 1
|
126
126
|
readonly true
|
127
|
-
text <=> [self, :foreground, after_write: ->(value) { @text.add_selection_format('foreground', value == FOREGROUND_PROMPT ? 'black' : value, focus: 100) }]
|
127
|
+
text <=> [self, :foreground, after_write: ->(value) { @text.add_selection_format('foreground', value == FOREGROUND_PROMPT ? 'black' : value, focus: OS.mac? ? 100 : true) }]
|
128
128
|
}
|
129
129
|
|
130
130
|
combobox {
|
131
131
|
grid row: 1, column: column_index += 1, column_weight: 1
|
132
132
|
readonly true
|
133
|
-
text <=> [self, :background, after_write: ->(value) { @text.add_selection_format('background', value == BACKGROUND_PROMPT ? 'white' : value, focus: 100) }]
|
133
|
+
text <=> [self, :background, after_write: ->(value) { @text.add_selection_format('background', value == BACKGROUND_PROMPT ? 'white' : value, focus: OS.mac? ? 100 : true) }]
|
134
134
|
}
|
135
135
|
|
136
136
|
separator {
|
@@ -282,7 +282,7 @@ class HelloText
|
|
282
282
|
|
283
283
|
@text = text {
|
284
284
|
grid row: 1, column: 0, row_weight: 1
|
285
|
-
|
285
|
+
# wrap 'word'
|
286
286
|
undo true
|
287
287
|
value <=> [self, :document]
|
288
288
|
|
@@ -303,6 +303,16 @@ class HelloText
|
|
303
303
|
show_find_dialog if (event.keysym == 'f') && ((OS.mac? && event.state == 8) || (!OS.mac? && event.state == 4))
|
304
304
|
end
|
305
305
|
}
|
306
|
+
|
307
|
+
@yscrollbar = y_scrollbar {
|
308
|
+
grid row: 1, column: 1
|
309
|
+
}
|
310
|
+
@text.yscrollbar @yscrollbar
|
311
|
+
|
312
|
+
@xscrollbar = x_scrollbar {
|
313
|
+
grid row: 2, column: 0, column_span: 2, row_weight: 0
|
314
|
+
}
|
315
|
+
@text.xscrollbar @xscrollbar
|
306
316
|
}
|
307
317
|
@root.open
|
308
318
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-tk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -226,18 +226,19 @@ files:
|
|
226
226
|
- lib/glimmer/dsl/tk/root_expression.rb
|
227
227
|
- lib/glimmer/dsl/tk/shine_data_binding_expression.rb
|
228
228
|
- lib/glimmer/dsl/tk/widget_expression.rb
|
229
|
-
- lib/glimmer/tk/button_proxy.rb
|
230
229
|
- lib/glimmer/tk/checkbutton_proxy.rb
|
231
230
|
- lib/glimmer/tk/combobox_proxy.rb
|
232
|
-
- lib/glimmer/tk/commandable.rb
|
233
231
|
- lib/glimmer/tk/drag_and_drop_extension.rb
|
234
232
|
- lib/glimmer/tk/entry_proxy.rb
|
235
233
|
- lib/glimmer/tk/frame_proxy.rb
|
236
234
|
- lib/glimmer/tk/label_proxy.rb
|
237
235
|
- lib/glimmer/tk/list_proxy.rb
|
236
|
+
- lib/glimmer/tk/menu_item_proxy.rb
|
237
|
+
- lib/glimmer/tk/menu_proxy.rb
|
238
238
|
- lib/glimmer/tk/notebook_proxy.rb
|
239
239
|
- lib/glimmer/tk/radiobutton_proxy.rb
|
240
240
|
- lib/glimmer/tk/root_proxy.rb
|
241
|
+
- lib/glimmer/tk/scrollbar_frame_proxy.rb
|
241
242
|
- lib/glimmer/tk/spinbox_proxy.rb
|
242
243
|
- lib/glimmer/tk/text_proxy.rb
|
243
244
|
- lib/glimmer/tk/text_variable_owner.rb
|
@@ -258,10 +259,13 @@ files:
|
|
258
259
|
- samples/hello/hello_label.rb
|
259
260
|
- samples/hello/hello_list_multi_selection.rb
|
260
261
|
- samples/hello/hello_list_single_selection.rb
|
262
|
+
- samples/hello/hello_menu_bar.rb
|
261
263
|
- samples/hello/hello_message_box.rb
|
262
264
|
- samples/hello/hello_notebook.rb
|
263
265
|
- samples/hello/hello_radiobutton.rb
|
264
266
|
- samples/hello/hello_root.rb
|
267
|
+
- samples/hello/hello_scrollbar.rb
|
268
|
+
- samples/hello/hello_scrollbar_frame.rb
|
265
269
|
- samples/hello/hello_separator.rb
|
266
270
|
- samples/hello/hello_spinbox.rb
|
267
271
|
- samples/hello/hello_text.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
# a copy of this software and associated documentation files (the
|
5
|
-
# "Software"), to deal in the Software without restriction, including
|
6
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
# the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be
|
12
|
-
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
require 'glimmer/tk/widget_proxy'
|
23
|
-
require 'glimmer/tk/commandable'
|
24
|
-
|
25
|
-
module Glimmer
|
26
|
-
module Tk
|
27
|
-
# Proxy for Tk::Tile::Button
|
28
|
-
#
|
29
|
-
# Follows the Proxy Design Pattern
|
30
|
-
class ButtonProxy < WidgetProxy
|
31
|
-
include Commandable
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|