glimmer-dsl-wx 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d5a658d9129e3c8ebf9c27f75d090d8d3f987a56866d1072d8ee17c757a7845
4
- data.tar.gz: 31fc334221373c19a3461742fac4c201caf513b79413fa3738e09b4aa7a7b752
3
+ metadata.gz: cf55c367fb4ec68158af5d891e0247aeb504438f094b454658440eb6d1089758
4
+ data.tar.gz: 8c1e5efaf64398f4daecf1b784ed4a5a42b0cc172748398d24d00f16c2a5cf9b
5
5
  SHA512:
6
- metadata.gz: 1516d96c79fdcd492d647092af6eed155b36091b7c2499c60384c24666a16e2cb5d2f397d92dd4c5f408d5d9cb947d24b50f7797ca70c644831ceafd89b6225a
7
- data.tar.gz: e55a50420ee69b41e8406367151320aa29dd9d1d4ba57481475877e6e1624b2fcd1e157c00705ae9f43fb0b417ec4214079a8fa0377f32095c75c06300995368
6
+ metadata.gz: 1c3a8d1510fb4887b4395fad8105145ad229beb0e4d954577abea4db2527093563bbd1cb4900b5d06dff5a3b431626a14a098559314de32e769ba7c53ae89059
7
+ data.tar.gz: e59f34e898c4b4e7c3b979ad112bf34d916efac91e3d7a6a66bda068896a2a9a51025a67534380f451aa11db093eae0931de40187e819a89a3ed0297877117bb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.6
4
+
5
+ - Sizer (layout) support
6
+ - samples/glimmer_new/hello_sizer.rb
7
+ - Refactor/move `glimmer_new` samples to `hello` directory
8
+ - Fix `ControlProxy#frame_proxy` method, which grabs the parent frame (going all the way to the top of the hierarchy)
9
+
3
10
  ## 0.0.5
4
11
 
5
12
  - Nested child control support
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for WX 0.0.5
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for WX 0.0.6
2
2
  ## wxWidgets Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-wx.svg)](http://badge.fury.io/rb/glimmer-dsl-wx)
4
4
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -51,16 +51,20 @@ require 'glimmer-dsl-wx'
51
51
 
52
52
  include Glimmer
53
53
 
54
- frame(title: 'Hello, Button!') { |f|
55
- button(label: 'Click To Find Who Built This!') {
56
- on_button do
57
- about_box(
58
- name: f.title,
59
- version: Wx::WXRUBY_VERSION,
60
- description: "This is the Hello, Button! sample",
61
- developers: ['The Glimmer DSL for WX Development Team']
62
- )
63
- end
54
+ frame(title: 'Hello, Button!') { |main_frame|
55
+ h_box_sizer {
56
+ button(label: 'Click To Find Who Built This!') {
57
+ sizer_args 0, Wx::RIGHT, 10
58
+
59
+ on_button do
60
+ about_box(
61
+ name: main_frame.title,
62
+ version: Wx::WXRUBY_VERSION,
63
+ description: "This is the Hello, Button! sample",
64
+ developers: ['The Glimmer DSL for WX Development Team']
65
+ )
66
+ end
67
+ }
64
68
  }
65
69
  }
66
70
  ```
@@ -72,20 +76,76 @@ require 'glimmer-dsl-wx'
72
76
 
73
77
  include Glimmer
74
78
 
75
- frame { |f|
79
+ frame { |main_frame|
76
80
  title 'Hello, Button!'
77
81
 
78
- button {
79
- label 'Click To Find Who Built This!'
82
+ h_box_sizer {
83
+ button {
84
+ sizer_args 0, Wx::RIGHT, 10
85
+ label 'Click To Find Who Built This!'
86
+
87
+ on_button do
88
+ about_box(
89
+ name: main_frame.title,
90
+ version: Wx::WXRUBY_VERSION,
91
+ description: "This is the Hello, Button! sample",
92
+ developers: ['The Glimmer DSL for WX Development Team']
93
+ )
94
+ end
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ **Hello Sizer!**
101
+
102
+ ```ruby
103
+ require 'glimmer-dsl-wx'
104
+
105
+ include Glimmer
106
+
107
+ frame { |main_frame|
108
+ title 'Hello, Sizer!'
109
+
110
+ v_box_sizer {
111
+ button {
112
+ sizer_args 0, Wx::DOWN, 10
113
+ label 'Greeting 1'
114
+
115
+ on_button do
116
+ message_dialog(
117
+ "Hello",
118
+ "Greeting",
119
+ Wx::OK | Wx::ICON_INFORMATION
120
+ ).show_modal
121
+ end
122
+ }
123
+
124
+ button {
125
+ sizer_args 0, Wx::DOWN, 10
126
+ label 'Greeting 2'
127
+
128
+ on_button do
129
+ message_dialog(
130
+ "Howdy",
131
+ "Greeting",
132
+ Wx::OK | Wx::ICON_INFORMATION
133
+ ).show_modal
134
+ end
135
+ }
80
136
 
81
- on_button do
82
- about_box(
83
- name: f.title,
84
- version: Wx::WXRUBY_VERSION,
85
- description: "This is the Hello, Button! sample",
86
- developers: ['The Glimmer DSL for WX Development Team']
87
- )
88
- end
137
+ button {
138
+ sizer_args 0, Wx::DOWN, 10
139
+ label 'Greeting 3'
140
+
141
+ on_button do
142
+ message_dialog(
143
+ "Aloha",
144
+ "Greeting",
145
+ Wx::OK | Wx::ICON_INFORMATION
146
+ ).show_modal
147
+ end
148
+ }
89
149
  }
90
150
  }
91
151
  ```
@@ -109,6 +169,8 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
109
169
 
110
170
  - [Glimmer DSL for WX](#)
111
171
  - [Usage](#usage)
172
+ - [GIRB (Glimmer IRB)](#girb-glimmer-irb)
173
+ - [Smart Defaults and Conventions](#smart-defaults-and-conventions)
112
174
  - [Process](#process)
113
175
  - [Resources](#resources)
114
176
  - [Help](#help)
@@ -134,21 +196,36 @@ gem install glimmer-dsl-wx
134
196
  Or install via Bundler `Gemfile`:
135
197
 
136
198
  ```ruby
137
- gem 'glimmer-dsl-wx', '~> 0.0.5'
199
+ gem 'glimmer-dsl-wx', '~> 0.0.6'
138
200
  ```
139
201
 
140
202
  Test that installation worked by running a sample:
141
203
 
142
204
  ```
143
- ruby -r glimmer-dsl-wx -e "require 'samples/glimmer_new/hello_world'"
205
+ ruby -r glimmer-dsl-wx -e "require 'samples/hello/hello_world'"
144
206
  ```
145
207
 
146
208
  If you cloned project, test by running a sample locally:
147
209
 
148
210
  ```
149
- ruby -r ./lib/glimmer-dsl-wx.rb samples/glimmer_new/hello_world.rb
211
+ ruby -r ./lib/glimmer-dsl-wx.rb samples/hello/hello_world.rb
212
+ ```
213
+
214
+ ## GIRB (Glimmer IRB)
215
+
216
+ You can run the `girb` command (`bin/girb` if you cloned the project locally) to do some quick and dirty experimentation and learning:
217
+
218
+ ```
219
+ girb
150
220
  ```
151
221
 
222
+ This gives you `irb` with the `glimmer-dsl-wx` gem loaded and the `Glimmer` module mixed into the main object for easy experimentation with GUI.
223
+
224
+ ## Smart Defaults and Conventions
225
+
226
+ - Instantiate any wxWidgets control by using its underscored name (e.g. `Button` becomes `button`)
227
+ - `frame` will automatically execute within a `Wx::App.run` block and `show` the Frame
228
+
152
229
  ## Process
153
230
 
154
231
  [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
Binary file
@@ -37,6 +37,7 @@ module Glimmer
37
37
  end
38
38
 
39
39
  def around(parent, keyword, args, block, &interpret_and_add_content)
40
+ # TODO refactor/extract this logic to a FrameExpression
40
41
  if keyword == 'frame'
41
42
  ::Wx::App.run do
42
43
  frame_proxy = interpret_and_add_content.call
@@ -43,6 +43,8 @@ module Glimmer
43
43
  # control
44
44
  %w[
45
45
  listener
46
+ sizer_args
47
+ sizer
46
48
  property
47
49
  control
48
50
  ]
@@ -0,0 +1,43 @@
1
+ # Copyright (c) 2023 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/static_expression'
23
+ require 'glimmer/wx/control_proxy'
24
+ require 'glimmer/wx/sizer_proxy'
25
+
26
+ module Glimmer
27
+ module DSL
28
+ module Wx
29
+ class SizerArgsExpression < StaticExpression
30
+ def can_interpret?(parent, keyword, *args, &block)
31
+ keyword == 'sizer_args' and
32
+ parent.is_a?(Glimmer::Wx::ControlProxy) and
33
+ parent&.parent_proxy&.is_a?(Glimmer::Wx::SizerProxy)
34
+ end
35
+
36
+ def interpret(parent, keyword, *args, &block)
37
+ parent.parent_proxy.add(parent, *args, &block)
38
+ end
39
+ end
40
+ SizerArgumentsExpression = SizerArgsExpression
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,53 @@
1
+ # Copyright (c) 2023 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/expression'
23
+ require 'glimmer/wx/control_proxy'
24
+ require 'glimmer/wx/sizer_proxy'
25
+
26
+ module Glimmer
27
+ module DSL
28
+ module Wx
29
+ class SizerExpression < Expression
30
+ include ParentExpression
31
+
32
+ def can_interpret?(parent, keyword, *args, &block)
33
+ (
34
+ parent.is_a?(Glimmer::Wx::ControlProxy) or
35
+ parent.is_a?(Glimmer::Wx::SizerProxy)
36
+ ) and
37
+ Glimmer::Wx::SizerProxy.exists?(keyword)
38
+ end
39
+
40
+ def interpret(parent, keyword, *args, &block)
41
+ Glimmer::Wx::SizerProxy.create(keyword, parent, args, &block)
42
+ end
43
+
44
+ def add_content(parent, keyword, *args, &block)
45
+ options = args.last.is_a?(Hash) ? args.last : {post_add_content: true}
46
+ options[:post_add_content] = true if options[:post_add_content].nil?
47
+ super
48
+ parent&.post_add_content if options[:post_add_content]
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -116,9 +116,19 @@ module Glimmer
116
116
  # No Op by default
117
117
  end
118
118
 
119
+ # Returns closest frame ancestor or self if it is a frame
119
120
  def frame_proxy
120
121
  found_proxy = self
121
- until found_proxy.nil? || found_proxy.is_a?(WindowProxy)
122
+ until found_proxy.nil? || found_proxy.is_a?(FrameProxy)
123
+ found_proxy = found_proxy.parent_proxy
124
+ end
125
+ found_proxy
126
+ end
127
+
128
+ # Returns closest control ancestor
129
+ def control_proxy
130
+ found_proxy = parent_proxy
131
+ until found_proxy.nil? || found_proxy.is_a?(ControlProxy)
122
132
  found_proxy = found_proxy.parent_proxy
123
133
  end
124
134
  found_proxy
@@ -132,7 +142,7 @@ module Glimmer
132
142
 
133
143
  def handle_listener(listener_name, &listener)
134
144
  event = listener_name.to_s.sub('on_', '')
135
- @parent_proxy.wx.send("evt_#{event}", @wx, &listener)
145
+ frame_proxy.wx.send("evt_#{event}", @wx, &listener)
136
146
  # elsif has_custom_listener?(listener_name)
137
147
  # handle_custom_listener(listener_name, &listener)
138
148
  # end
@@ -210,15 +220,8 @@ module Glimmer
210
220
  private
211
221
 
212
222
  def build_control
213
- if is_a?(Parent)
214
- @wx = ControlProxy.new_control(@keyword, @parent_proxy&.wx, @args)
215
- else
216
- sizer = ::Wx::HBoxSizer.new
217
- @parent_proxy.sizer = sizer
218
- @wx = ControlProxy.new_control(@keyword, @parent_proxy&.wx, @args)
219
- sizer.add @wx, 0, ::Wx::RIGHT, 8
220
- end
221
- @wx
223
+ # must pass control_proxy.wx as parent because the direct parent might be a sizer
224
+ @wx = ControlProxy.new_control(@keyword, control_proxy&.wx, @args)
222
225
  end
223
226
  end
224
227
  end
@@ -0,0 +1,150 @@
1
+ # Copyright (c) 2023 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/wx/data_bindable'
23
+ require 'glimmer/wx/parent'
24
+
25
+ module Glimmer
26
+ module Wx
27
+ # Proxy for Wx sizer objects
28
+ #
29
+ # Follows the Proxy Design Pattern
30
+ class SizerProxy
31
+ class << self
32
+ def exists?(keyword)
33
+ keyword.end_with?('_sizer') and
34
+ (
35
+ ::Wx.constants.include?(wx_constant_symbol(keyword)) or
36
+ descendant_keyword_constant_map.keys.include?(keyword)
37
+ )
38
+ end
39
+
40
+ def create(keyword, parent, args, &block)
41
+ sizer_proxy_class(keyword).new(keyword, parent, args, &block)
42
+ end
43
+
44
+ def sizer_proxy_class(keyword)
45
+ descendant_keyword_constant_map[keyword] || SizerProxy
46
+ end
47
+
48
+ def new_sizer(keyword, parent, args)
49
+ args = args.clone || []
50
+ if args.last.is_a?(Hash)
51
+ args[-1] = args[-1].clone
52
+ end
53
+ ::Wx.const_get(wx_constant_symbol(keyword)).new(*args)
54
+ end
55
+
56
+ def wx_constant_symbol(keyword)
57
+ keyword.to_s.camelcase(:upper).to_sym
58
+ end
59
+
60
+ def constant_symbol(keyword)
61
+ "#{keyword.to_s.camelcase(:upper)}Proxy".to_sym
62
+ end
63
+
64
+ def keyword(constant_symbol)
65
+ constant_symbol.to_s.underscore.sub(/_proxy$/, '')
66
+ end
67
+
68
+ def descendant_keyword_constant_map
69
+ @descendant_keyword_constant_map ||= map_descendant_keyword_constants_for(self)
70
+ end
71
+
72
+ def reset_descendant_keyword_constant_map
73
+ @descendant_keyword_constant_map = nil
74
+ descendant_keyword_constant_map
75
+ end
76
+
77
+ def map_descendant_keyword_constants_for(klass, accumulator: {})
78
+ klass.constants.map do |constant_symbol|
79
+ [constant_symbol, klass.const_get(constant_symbol)]
80
+ end.select do |constant_symbol, constant|
81
+ constant.is_a?(Module) && !accumulator.values.include?(constant)
82
+ end.each do |constant_symbol, constant|
83
+ accumulator[keyword(constant_symbol)] = constant
84
+ map_descendant_keyword_constants_for(constant, accumulator: accumulator)
85
+ end
86
+ accumulator
87
+ end
88
+ end
89
+
90
+ include DataBindable
91
+
92
+ # wx returns the contained LibUI object
93
+ attr_reader :parent_proxy, :wx, :args, :keyword, :block, :content_added
94
+ alias content_added? content_added
95
+
96
+ def initialize(keyword, parent, args, &block)
97
+ @keyword = keyword
98
+ @parent_proxy = parent
99
+ @args = args
100
+ @block = block
101
+ build_sizer
102
+ post_add_content if @block.nil?
103
+ end
104
+
105
+ # Subclasses may override to perform post add_content work (normally must call super)
106
+ def post_add_content
107
+ unless @content_added
108
+ @parent_proxy&.post_initialize_child(self)
109
+ @content_added = true
110
+ end
111
+ end
112
+
113
+ # Subclasses may override to perform post initialization work on an added child
114
+ def post_initialize_child(child)
115
+ # No Op by default
116
+ end
117
+
118
+ def respond_to?(method_name, *args, &block)
119
+ @wx.respond_to?(method_name, true) ||
120
+ super(method_name, true)
121
+ end
122
+
123
+ def method_missing(method_name, *args, &block)
124
+ if @wx.respond_to?(method_name, true)
125
+ @wx.send(method_name, *args, &block)
126
+ else
127
+ super
128
+ end
129
+ end
130
+
131
+ def content(&block)
132
+ Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Libui::SizerExpression.new, @keyword, {post_add_content: @content_added}, &block)
133
+ end
134
+
135
+ def add(control_proxy, *args, &block)
136
+ @wx.add(control_proxy.wx, *args)
137
+ end
138
+
139
+ private
140
+
141
+ def build_sizer
142
+ @wx = SizerProxy.new_sizer(@keyword, @parent_proxy.wx, @args)
143
+ parent_proxy.sizer = @wx if parent_proxy.is_a?(Glimmer::Wx::ControlProxy)
144
+ @wx
145
+ end
146
+ end
147
+ end
148
+ end
149
+
150
+ Dir[File.expand_path("./#{File.basename(__FILE__, '.rb')}/*.rb", __dir__)].each {|f| require f}
@@ -23,15 +23,19 @@ require 'glimmer-dsl-wx'
23
23
 
24
24
  include Glimmer
25
25
 
26
- frame(title: 'Hello, Button!') { |f|
27
- button(label: 'Click To Find Who Built This!') {
28
- on_button do
29
- about_box(
30
- name: f.title,
31
- version: Wx::WXRUBY_VERSION,
32
- description: "This is the Hello, Button! sample",
33
- developers: ['The Glimmer DSL for WX Development Team']
34
- )
35
- end
26
+ frame(title: 'Hello, Button!') { |main_frame|
27
+ h_box_sizer {
28
+ button(label: 'Click To Find Who Built This!') {
29
+ sizer_args 0, Wx::RIGHT, 10
30
+
31
+ on_button do
32
+ about_box(
33
+ name: main_frame.title,
34
+ version: Wx::WXRUBY_VERSION,
35
+ description: "This is the Hello, Button! sample",
36
+ developers: ['The Glimmer DSL for WX Development Team']
37
+ )
38
+ end
39
+ }
36
40
  }
37
41
  }
@@ -23,19 +23,22 @@ require 'glimmer-dsl-wx'
23
23
 
24
24
  include Glimmer
25
25
 
26
- frame { |f|
26
+ frame { |main_frame|
27
27
  title 'Hello, Button!'
28
28
 
29
- button {
30
- label 'Click To Find Who Built This!'
31
-
32
- on_button do
33
- about_box(
34
- name: f.title,
35
- version: Wx::WXRUBY_VERSION,
36
- description: "This is the Hello, Button! sample",
37
- developers: ['The Glimmer DSL for WX Development Team']
38
- )
39
- end
29
+ h_box_sizer {
30
+ button {
31
+ sizer_args 0, Wx::RIGHT, 10
32
+ label 'Click To Find Who Built This!'
33
+
34
+ on_button do
35
+ about_box(
36
+ name: main_frame.title,
37
+ version: Wx::WXRUBY_VERSION,
38
+ description: "This is the Hello, Button! sample",
39
+ developers: ['The Glimmer DSL for WX Development Team']
40
+ )
41
+ end
42
+ }
40
43
  }
41
44
  }
@@ -0,0 +1,69 @@
1
+ # Copyright (c) 2023 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-wx'
23
+
24
+ include Glimmer
25
+
26
+ frame { |main_frame|
27
+ title 'Hello, Sizer!'
28
+
29
+ v_box_sizer {
30
+ button {
31
+ sizer_args 0, Wx::DOWN, 10
32
+ label 'Greeting 1'
33
+
34
+ on_button do
35
+ message_dialog(
36
+ "Hello",
37
+ "Greeting",
38
+ Wx::OK | Wx::ICON_INFORMATION
39
+ ).show_modal
40
+ end
41
+ }
42
+
43
+ button {
44
+ sizer_args 0, Wx::DOWN, 10
45
+ label 'Greeting 2'
46
+
47
+ on_button do
48
+ message_dialog(
49
+ "Howdy",
50
+ "Greeting",
51
+ Wx::OK | Wx::ICON_INFORMATION
52
+ ).show_modal
53
+ end
54
+ }
55
+
56
+ button {
57
+ sizer_args 0, Wx::DOWN, 10
58
+ label 'Greeting 3'
59
+
60
+ on_button do
61
+ message_dialog(
62
+ "Aloha",
63
+ "Greeting",
64
+ Wx::OK | Wx::ICON_INFORMATION
65
+ ).show_modal
66
+ end
67
+ }
68
+ }
69
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-wx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-24 00:00:00.000000000 Z
11
+ date: 2023-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -240,20 +240,24 @@ files:
240
240
  - lib/glimmer/dsl/wx/operation_expression.rb
241
241
  - lib/glimmer/dsl/wx/property_expression.rb
242
242
  - lib/glimmer/dsl/wx/shine_data_binding_expression.rb
243
+ - lib/glimmer/dsl/wx/sizer_args_expression.rb
244
+ - lib/glimmer/dsl/wx/sizer_expression.rb
243
245
  - lib/glimmer/proc_tracker.rb
244
246
  - lib/glimmer/wx/control_proxy.rb
245
247
  - lib/glimmer/wx/control_proxy/frame_proxy.rb
246
248
  - lib/glimmer/wx/data_bindable.rb
247
249
  - lib/glimmer/wx/parent.rb
250
+ - lib/glimmer/wx/sizer_proxy.rb
248
251
  - samples/art/wxruby-128x128.png
249
252
  - samples/art/wxruby-256x256.png
250
253
  - samples/art/wxruby-64x64.png
251
254
  - samples/art/wxruby.ico
252
255
  - samples/art/wxruby.png
253
- - samples/glimmer_new/hello_button.rb
254
- - samples/glimmer_new/hello_button2.rb
255
- - samples/glimmer_new/hello_world.rb
256
- - samples/glimmer_new/hello_world2.rb
256
+ - samples/hello/hello_button.rb
257
+ - samples/hello/hello_button2.rb
258
+ - samples/hello/hello_sizer.rb
259
+ - samples/hello/hello_world.rb
260
+ - samples/hello/hello_world2.rb
257
261
  - samples/minimal/mondrian.ico
258
262
  - samples/minimal/mondrian.png
259
263
  - samples/minimal/nothing.rb
File without changes
File without changes