cyberarm_engine 0.5.1 → 0.6.0

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: bf5c5815639fb29c28cdace96b2204c356c4fc8eb680d88b7d0f2a5742814b3e
4
- data.tar.gz: d233385170165baa376d203829d944c5f7eba30d45b675846e39465b3e1b3c0b
3
+ metadata.gz: f11a60c76c06ce3939734baec31821815b26b779919cbcee7d0c289511a11c87
4
+ data.tar.gz: 403a8b5e1ed211ee4240887f1851df14507c398b5052defa79c28b0a0c06cae7
5
5
  SHA512:
6
- metadata.gz: b0b8128ffbf49f7484549e593fde9415c99a98dc061d49144edfd93bed83be7942d2769ffcc25d94101f423bb4978035e99cfdcb2c965f64df33bde4cc957de9
7
- data.tar.gz: 2c9c251bd592e108e70d206fc80aa59b9ee912f5dd2958edab9308a848249ba4f9d1868b38ba812f1896339183a40ac9fc920c3562fbad33554a6a60169c281f
6
+ metadata.gz: 4959236427d16fbf69636813f2cd013556b6633e80dce054f69273384af0ca73af944c109ebd51ace29e5329d56f8e2cda717b114cf63ba83dbedd28cae87e3d
7
+ data.tar.gz: cabf8137a4add3a2eda6cda2cd737ffafde764bf208777deaa1d86dcb21ee8ec54204546ed841416217ed92c908aed4b02fd229927cfcb26d5fa0ee2a0896cb9
@@ -2,6 +2,7 @@ module CyberarmEngine
2
2
  module DSL
3
3
  def flow(options = {}, &block)
4
4
  options[:parent] = @containers.last
5
+ options[:theme] = @current_theme
5
6
  _container = Flow.new(options, block)
6
7
  @containers << _container
7
8
  _container.build
@@ -13,6 +14,7 @@ module CyberarmEngine
13
14
 
14
15
  def stack(options = {}, &block)
15
16
  options[:parent] = @containers.last
17
+ options[:theme] = @current_theme
16
18
  _container = Stack.new(options, block)
17
19
  @containers << _container
18
20
  _container.build
@@ -24,6 +26,7 @@ module CyberarmEngine
24
26
 
25
27
  def label(text, options = {}, &block)
26
28
  options[:parent] = @containers.last
29
+ options[:theme] = @current_theme
27
30
  _element = Label.new(text, options, block)
28
31
  @containers.last.add(_element)
29
32
 
@@ -32,6 +35,7 @@ module CyberarmEngine
32
35
 
33
36
  def button(text, options = {}, &block)
34
37
  options[:parent] = @containers.last
38
+ options[:theme] = @current_theme
35
39
  _element = Button.new(text, options, block) { if block.is_a?(Proc); block.call; end }
36
40
  @containers.last.add(_element)
37
41
 
@@ -40,6 +44,7 @@ module CyberarmEngine
40
44
 
41
45
  def edit_line(text, options = {}, &block)
42
46
  options[:parent] = @containers.last
47
+ options[:theme] = @current_theme
43
48
  _element = EditLine.new(text, options, block)
44
49
  @containers.last.add(_element)
45
50
 
@@ -48,6 +53,7 @@ module CyberarmEngine
48
53
 
49
54
  def toggle_button(options = {}, &block)
50
55
  options[:parent] = @containers.last
56
+ options[:theme] = @current_theme
51
57
  _element = ToggleButton.new(options, block)
52
58
  @containers.last.add(_element)
53
59
 
@@ -56,6 +62,7 @@ module CyberarmEngine
56
62
 
57
63
  def check_box(text, options = {}, &block)
58
64
  options[:parent] = @containers.last
65
+ options[:theme] = @current_theme
59
66
  _element = CheckBox.new(text, options, block)
60
67
  @containers.last.add(_element)
61
68
 
@@ -64,6 +71,7 @@ module CyberarmEngine
64
71
 
65
72
  def image(path, options = {}, &block)
66
73
  options[:parent] = @containers.last
74
+ options[:theme] = @current_theme
67
75
  _element = Image.new(path, options, block)
68
76
  @containers.last.add(_element)
69
77
 
@@ -78,5 +86,9 @@ module CyberarmEngine
78
86
  def color(color)
79
87
  @containers.last.color(color)
80
88
  end
89
+
90
+ def set_theme(theme)
91
+ @current_theme = theme
92
+ end
81
93
  end
82
94
  end
@@ -15,7 +15,7 @@ module CyberarmEngine
15
15
 
16
16
  def initialize(options = {}, block = nil)
17
17
  @parent = options[:parent] # parent Container (i.e. flow/stack)
18
- options = theme_defaults.merge(options)
18
+ options = theme_defaults(options)
19
19
  @options = options
20
20
  @block = block
21
21
 
@@ -206,6 +206,10 @@ module CyberarmEngine
206
206
  raise "#{self.class}#recalculate was not overridden!"
207
207
  end
208
208
 
209
+ def reposition
210
+ raise "#{self.class}#reposition was not overridden!"
211
+ end
212
+
209
213
  def value
210
214
  raise "#{self.class}#value was not overridden!"
211
215
  end
@@ -9,21 +9,24 @@ module CyberarmEngine
9
9
  value
10
10
  end
11
11
 
12
- def theme_defaults
12
+ def theme_defaults(options)
13
13
  raise "Error" unless self.class.ancestors.include?(CyberarmEngine::Element)
14
+ _theme = THEME
15
+ _theme = _theme.merge(options[:theme]) if options[:theme]
16
+ options.delete(:theme)
14
17
 
15
18
  hash = {}
16
19
  class_names = self.class.ancestors
17
20
  class_names = class_names[0..class_names.index(CyberarmEngine::Element)].map! {|c| c.to_s.split("::").last.to_sym}.reverse!
18
21
 
19
22
  class_names.each do |klass|
20
- next unless data = THEME.dig(klass)
23
+ next unless data = _theme.dig(klass)
21
24
  data.each do |key, value|
22
25
  hash.merge!(data)
23
26
  end
24
27
  end
25
28
 
26
- hash
29
+ hash.merge(options)
27
30
  end
28
31
 
29
32
  THEME = {
@@ -86,6 +89,6 @@ module CyberarmEngine
86
89
  ToggleButton: { # < Button
87
90
  checkmark: "√"
88
91
  }
89
- }
92
+ }.freeze
90
93
  end
91
94
  end
@@ -1,4 +1,4 @@
1
1
  module CyberarmEngine
2
2
  NAME = "InDev"
3
- VERSION = "0.5.1"
3
+ VERSION = "0.6.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyberarm_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyberarm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-07 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu