glimmer-dsl-tk 0.0.50 → 0.0.54

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +243 -32
  5. data/VERSION +1 -1
  6. data/bin/girb +1 -1
  7. data/bin/girb_runner.rb +1 -1
  8. data/glimmer-dsl-tk.gemspec +0 -0
  9. data/lib/glimmer/data_binding/tk/list_selection_binding.rb +1 -1
  10. data/lib/glimmer/data_binding/tk/one_time_observer.rb +1 -1
  11. data/lib/glimmer/data_binding/tk/widget_binding.rb +1 -1
  12. data/lib/glimmer/dsl/tk/attribute_expression.rb +1 -1
  13. data/lib/glimmer/dsl/tk/bind_expression.rb +1 -1
  14. data/lib/glimmer/dsl/tk/block_attribute_expression.rb +1 -1
  15. data/lib/glimmer/dsl/tk/built_in_dialog_expression.rb +1 -1
  16. data/lib/glimmer/dsl/tk/data_binding_expression.rb +1 -1
  17. data/lib/glimmer/dsl/tk/dsl.rb +1 -1
  18. data/lib/glimmer/dsl/tk/format_expression.rb +1 -1
  19. data/lib/glimmer/dsl/tk/list_selection_data_binding_expression.rb +1 -1
  20. data/lib/glimmer/dsl/tk/message_box_expression.rb +1 -1
  21. data/lib/glimmer/dsl/tk/on_expression.rb +1 -1
  22. data/lib/glimmer/dsl/tk/root_expression.rb +1 -1
  23. data/lib/glimmer/dsl/tk/shine_data_binding_expression.rb +1 -1
  24. data/lib/glimmer/dsl/tk/widget_expression.rb +1 -1
  25. data/lib/glimmer/tk/checkbutton_proxy.rb +1 -1
  26. data/lib/glimmer/tk/combobox_proxy.rb +1 -1
  27. data/lib/glimmer/tk/drag_and_drop_event.rb +21 -0
  28. data/lib/glimmer/tk/draggable_and_droppable.rb +1 -1
  29. data/lib/glimmer/tk/entry_proxy.rb +1 -1
  30. data/lib/glimmer/tk/frame_proxy.rb +1 -1
  31. data/lib/glimmer/tk/label_proxy.rb +1 -1
  32. data/lib/glimmer/tk/labelframe_proxy.rb +39 -0
  33. data/lib/glimmer/tk/lbl_proxy.rb +1 -1
  34. data/lib/glimmer/tk/list_proxy.rb +1 -1
  35. data/lib/glimmer/tk/menu_item_proxy.rb +46 -11
  36. data/lib/glimmer/tk/menu_proxy.rb +1 -1
  37. data/lib/glimmer/tk/notebook_proxy.rb +1 -1
  38. data/lib/glimmer/tk/os.rb +1 -1
  39. data/lib/glimmer/tk/radiobutton_proxy.rb +1 -1
  40. data/lib/glimmer/tk/root_proxy.rb +1 -1
  41. data/lib/glimmer/tk/scrollbar_frame_proxy.rb +1 -1
  42. data/lib/glimmer/tk/spinbox_proxy.rb +1 -1
  43. data/lib/glimmer/tk/text_proxy.rb +1 -1
  44. data/lib/glimmer/tk/text_variable_owner.rb +1 -1
  45. data/lib/glimmer/tk/toplevel_proxy.rb +16 -2
  46. data/lib/glimmer/tk/treeview_proxy.rb +1 -1
  47. data/lib/glimmer/tk/variable_owner.rb +1 -1
  48. data/lib/glimmer/tk/widget.rb +1 -1
  49. data/lib/glimmer/tk/widget_proxy.rb +8 -3
  50. data/lib/glimmer-dsl-tk.rb +1 -1
  51. data/samples/elaborate/meta_sample.rb +1 -1
  52. data/samples/hello/hello_built_in_dialog.rb +1 -1
  53. data/samples/hello/hello_button.rb +1 -1
  54. data/samples/hello/hello_checkbutton.rb +1 -1
  55. data/samples/hello/hello_combobox.rb +1 -2
  56. data/samples/hello/hello_computed.rb +1 -1
  57. data/samples/hello/hello_contextual_menu.rb +9 -1
  58. data/samples/hello/hello_drag_and_drop.rb +1 -1
  59. data/samples/hello/hello_entry.rb +1 -1
  60. data/samples/hello/hello_frame.rb +1 -1
  61. data/samples/hello/hello_label.rb +1 -1
  62. data/samples/hello/hello_labelframe.rb +161 -0
  63. data/samples/hello/hello_list_multi_selection.rb +1 -1
  64. data/samples/hello/hello_list_single_selection.rb +1 -1
  65. data/samples/hello/hello_menu_bar.rb +13 -2
  66. data/samples/hello/hello_message_box.rb +1 -1
  67. data/samples/hello/hello_notebook.rb +1 -1
  68. data/samples/hello/hello_radiobutton.rb +1 -1
  69. data/samples/hello/hello_root.rb +1 -1
  70. data/samples/hello/hello_scrollbar.rb +1 -1
  71. data/samples/hello/hello_scrollbar_frame.rb +1 -1
  72. data/samples/hello/hello_separator.rb +1 -1
  73. data/samples/hello/hello_spinbox.rb +1 -1
  74. data/samples/hello/hello_text.rb +1 -1
  75. data/samples/hello/hello_toplevel.rb +1 -1
  76. data/samples/hello/hello_world.rb +1 -1
  77. metadata +7 -5
@@ -1,3 +1,24 @@
1
+ # Copyright (c) 2020-2022 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
+
1
22
  module Glimmer
2
23
  module Tk
3
24
  DragAndDropEvent = Struct.new(:source, :target, :tooltip, :x_root, :y_root, :data, :drop_accepted) do
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -0,0 +1,39 @@
1
+ # Copyright (c) 2020-2022 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/notebook_proxy'
24
+
25
+ module Glimmer
26
+ module Tk
27
+ # Proxy for Tk::Tile::Labelframe
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class LabelframeProxy < WidgetProxy
31
+ private
32
+
33
+ def initialize_defaults
34
+ super
35
+ self.padding = 15
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -36,10 +36,14 @@ module Glimmer
36
36
  'Control' => 'Control',
37
37
  }
38
38
 
39
+ ATTRIBUTES = %w[activebackground activeforeground background bitmap columnbreak compound font foreground hidemargin indicatoron menu offvalue onvalue selectcolor selectimage state underline value]
40
+
39
41
  attr_reader :options
40
42
 
41
43
  def initialize(underscored_widget_name, parent_proxy, args, &block)
42
44
  @options = args.last.is_a?(Hash) ? args.last : {}
45
+ @label = @options[:label]
46
+ @label ||= 'About' if args.first == :about
43
47
  super
44
48
  end
45
49
 
@@ -58,21 +62,25 @@ module Glimmer
58
62
  def accelerator_event
59
63
  accelerator_parts = @accelerator.split('+')
60
64
  accelerator_parts.map do |accelerator_part|
61
- ACCELERATOR_MODIFIER_EVENT_MAP[accelerator_part.capitalize] || accelerator_part.downcase
65
+ ACCELERATOR_MODIFIER_EVENT_MAP[accelerator_part.capitalize] ||
66
+ (accelerator_part.size == 1 && accelerator_part.downcase) ||
67
+ (function_key?(accelerator_part) && accelerator_part.upcase) ||
68
+ accelerator_part
62
69
  end.join('-')
63
70
  end
64
71
 
65
- def state=(value)
66
- @state = value
67
- configure_menu_item_attribute(state: value)
72
+ def function_key?(string)
73
+ string.downcase.match(/^f\d+$/)
68
74
  end
69
75
 
70
- def state
71
- @state
76
+ def label=(value)
77
+ @last_label = @label
78
+ @label = value
79
+ configure_menu_item_attribute(label: @label)
72
80
  end
73
81
 
74
82
  def label
75
- @options[:label]
83
+ @label
76
84
  end
77
85
 
78
86
  def image=(*args)
@@ -151,9 +159,9 @@ module Glimmer
151
159
 
152
160
  def selection=(value)
153
161
  if value
154
- variable.value = label
162
+ self.value = variable.value = label
155
163
  elsif checkbutton?
156
- variable.value = ''
164
+ self.value = variable.value = ''
157
165
  end
158
166
  end
159
167
 
@@ -170,7 +178,34 @@ module Glimmer
170
178
  elsif quit? && attribute_value_hash[:command]
171
179
  ::Tk.ip_eval("proc ::tk::mac::Quit {} {#{::Tk.install_cmd(attribute_value_hash[:command])}}") if OS.mac?
172
180
  else
173
- @parent_proxy.tk.entryconfigure label, attribute_value_hash
181
+ if attribute_value_hash.keys.first.to_s == 'label'
182
+ @parent_proxy.tk.entryconfigure @last_label, attribute_value_hash
183
+ self.value = variable.value = attribute_value_hash.values.first if variable.value == @last_label
184
+ else
185
+ @parent_proxy.tk.entryconfigure label, attribute_value_hash
186
+ end
187
+ end
188
+ end
189
+
190
+ def has_attributes_attribute?(attribute)
191
+ attribute = attribute.to_s
192
+ attribute = attribute.sub(/\?$/, '').sub(/=$/, '')
193
+ ATTRIBUTES.include?(attribute)
194
+ end
195
+
196
+ def set_attribute(attribute, value)
197
+ if has_attributes_attribute?(attribute)
198
+ configure_menu_item_attribute(attribute => value)
199
+ else
200
+ super
201
+ end
202
+ end
203
+
204
+ def get_attribute(attribute)
205
+ if has_attributes_attribute?(attribute)
206
+ @parent_proxy.tk.entrycget label, attribute
207
+ else
208
+ super
174
209
  end
175
210
  end
176
211
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
data/lib/glimmer/tk/os.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -29,13 +29,14 @@ module Glimmer
29
29
  class ToplevelProxy < WidgetProxy
30
30
  REGEX_GEOMETRY = /[x+-]/
31
31
  DEFAULT_WIDTH = 190
32
- DEFAULT_HEIGHT = 95
32
+ DEFAULT_HEIGHT = 0
33
33
 
34
34
  attr_reader :tk
35
35
  attr_accessor :escapable
36
36
  alias escapable? escapable
37
37
 
38
38
  def post_add_content
39
+ center_within_screen unless @x || @y
39
40
  if escapable?
40
41
  on('KeyPress') do |event|
41
42
  if event.keysym == 'Escape'
@@ -93,10 +94,12 @@ module Glimmer
93
94
  end
94
95
 
95
96
  def x=(value)
97
+ @x = value
96
98
  self.geometry = "#{@width || DEFAULT_WIDTH}x#{@height || DEFAULT_HEIGHT}#{value.to_i > 0 ? '+' : '-'}#{value.to_i.abs}#{y_sign}#{abs_y}"
97
99
  end
98
100
 
99
101
  def y=(value)
102
+ @y = value
100
103
  self.geometry = "#{@width || DEFAULT_WIDTH}x#{@height || DEFAULT_HEIGHT}#{x_sign}#{abs_x}#{value.to_i > 0 ? '+' : '-'}#{value.to_i.abs}"
101
104
  end
102
105
 
@@ -110,6 +113,17 @@ module Glimmer
110
113
  end
111
114
  end
112
115
 
116
+ def center_within_screen
117
+ monitor_width, monitor_height = wm_maxsize
118
+ update :idletasks
119
+ current_width = width
120
+ current_height = height
121
+ self.x = (winfo_screenwidth - width) / 2
122
+ self.y = (winfo_screenheight - height) / 2
123
+ self.width = width
124
+ self.height = height
125
+ end
126
+
113
127
  private
114
128
 
115
129
  def sign_number(sign, number)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -393,8 +393,13 @@ module Glimmer
393
393
  if observer.is_a?(Glimmer::DataBinding::ModelBinding)
394
394
  model = observer.model
395
395
  options_model_property = observer.property_name + '_options'
396
- # TODO perform data-binding to values too
397
- @tk.values = model.send(options_model_property) if model.respond_to?(options_model_property)
396
+ if model.respond_to?(options_model_property)
397
+ options_observer = Glimmer::DataBinding::Observer.proc do
398
+ @tk.values = model.send(options_model_property)
399
+ end
400
+ options_observer.observe(model, options_model_property)
401
+ options_observer.call
402
+ end
398
403
  end
399
404
  @tk.bind('<ComboboxSelected>') {
400
405
  observer.call(@tk.textvariable.value)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,4 @@
1
-
2
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
3
2
  #
4
3
  # Permission is hereby granted, free of charge, to any person obtaining
5
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -92,6 +92,10 @@ root { |r|
92
92
  menu_item(:radiobutton, label: image_name.capitalize) {
93
93
  selection image_name == 'usa'
94
94
  image File.expand_path("images/#{image_name}.png", __dir__)
95
+
96
+ on('command') do
97
+ message_box(parent: r, title: 'Language Selection', message: "You selected the language of #{image_name.capitalize}!")
98
+ end
95
99
  }
96
100
  end
97
101
  }
@@ -102,6 +106,10 @@ root { |r|
102
106
  selection image_name == 'usa'
103
107
  image File.expand_path("images/#{image_name}.png", __dir__)
104
108
  compound 'left'
109
+
110
+ on('command') do
111
+ message_box(parent: r, title: 'Country Selection', message: "You selected the country of #{image_name.capitalize}!")
112
+ end
105
113
  }
106
114
  end
107
115
  }
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -0,0 +1,161 @@
1
+ # Copyright (c) 2020-2022 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, Labelframe!'
28
+
29
+ labelframe {
30
+ grid column: 0, row: 0, padx: 10, pady: 10
31
+ text 'Name:'
32
+ # labelanchor 'nw' # Default. Other options: 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'
33
+
34
+ label {
35
+ grid column: 0, row: 0, sticky: 'w'
36
+ text 'First Name:'
37
+ }
38
+ entry {
39
+ grid column: 1, row: 0
40
+ width 15
41
+ }
42
+
43
+ label {
44
+ grid column: 0, row: 1, sticky: 'w'
45
+ text 'Last Name:'
46
+ }
47
+ entry {
48
+ grid column: 1, row: 1
49
+ width 15
50
+ }
51
+ }
52
+
53
+ labelframe {
54
+ grid column: 0, row: 1, padx: 10, pady: 10
55
+ text 'Address:'
56
+
57
+ label {
58
+ grid column: 0, row: 0, sticky: 'w'
59
+ text 'Street:'
60
+ }
61
+ entry {
62
+ grid column: 1, row: 0
63
+ width 15
64
+ }
65
+
66
+ label {
67
+ grid column: 0, row: 1, sticky: 'w'
68
+ text 'City:'
69
+ }
70
+ entry {
71
+ grid column: 1, row: 1
72
+ width 15
73
+ }
74
+
75
+ label {
76
+ grid column: 0, row: 2, sticky: 'w'
77
+ text 'State:'
78
+ }
79
+ entry {
80
+ grid column: 1, row: 2
81
+ width 15
82
+ }
83
+
84
+ label {
85
+ grid column: 0, row: 3, sticky: 'w'
86
+ text 'Zip:'
87
+ }
88
+ entry {
89
+ grid column: 1, row: 3
90
+ width 15
91
+ }
92
+ }
93
+
94
+ labelframe {
95
+ grid column: 1, row: 0, rowspan: 2, padx: 10, pady: 10
96
+ text 'Medical Info:'
97
+
98
+ label {
99
+ grid column: 0, row: 0, sticky: 'w'
100
+ text 'Family Doctor:'
101
+ }
102
+ entry {
103
+ grid column: 1, row: 0
104
+ width 15
105
+ }
106
+
107
+ label {
108
+ grid column: 0, row: 1, sticky: 'w'
109
+ text 'Chronic Conditions:'
110
+ }
111
+ entry {
112
+ grid column: 1, row: 1
113
+ width 15
114
+ }
115
+
116
+ label {
117
+ grid column: 0, row: 2, sticky: 'w'
118
+ text 'Past Surgeries:'
119
+ }
120
+ entry {
121
+ grid column: 1, row: 2
122
+ width 15
123
+ }
124
+
125
+ label {
126
+ grid column: 0, row: 3, sticky: 'w'
127
+ text 'Health Insurance Info:'
128
+ }
129
+ entry {
130
+ grid column: 1, row: 3
131
+ width 15
132
+ }
133
+
134
+ label {
135
+ grid column: 0, row: 4, sticky: 'w'
136
+ text 'Dental Insurance Info:'
137
+ }
138
+ entry {
139
+ grid column: 1, row: 4
140
+ width 15
141
+ }
142
+
143
+ label {
144
+ grid column: 0, row: 5, sticky: 'w'
145
+ text 'Diet:'
146
+ }
147
+ entry {
148
+ grid column: 1, row: 5
149
+ width 15
150
+ }
151
+
152
+ label {
153
+ grid column: 0, row: 6, sticky: 'w'
154
+ text 'Exercise:'
155
+ }
156
+ entry {
157
+ grid column: 1, row: 6
158
+ width 15
159
+ }
160
+ }
161
+ }.open
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021 Andy Maleh
1
+ # Copyright (c) 2020-2022 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the