Module: CyberarmEngine::DSL
- Included in:
- GuiState
- Defined in:
- lib/cyberarm_engine/ui/dsl.rb
Instance Method Summary collapse
- #background(color = Gosu::Color::NONE) ⇒ Object
- #button(text, options = {}, &block) ⇒ Object
- #check_box(text, options = {}, &block) ⇒ Object
- #current_theme ⇒ Object
- #edit_line(text, options = {}, &block) ⇒ Object
- #flow(options = {}, &block) ⇒ Object
- #image(path, options = {}, &block) ⇒ Object
- #label(text, options = {}, &block) ⇒ Object
- #progress(options = {}, &block) ⇒ Object
- #stack(options = {}, &block) ⇒ Object
- #theme(theme) ⇒ Object
- #toggle_button(options = {}, &block) ⇒ Object
Instance Method Details
#background(color = Gosu::Color::NONE) ⇒ Object
90 91 92 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 90 def background(color = Gosu::Color::NONE) @containers.last.style.background = color end |
#button(text, options = {}, &block) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 36 def (text, = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::Button.new(text, , block) { if block.is_a?(Proc); block.call; end } @containers.last.add(_element) return _element end |
#check_box(text, options = {}, &block) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 63 def check_box(text, = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::CheckBox.new(text, , block) @containers.last.add(_element) return _element end |
#current_theme ⇒ Object
98 99 100 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 98 def current_theme @containers.last.[:theme] end |
#edit_line(text, options = {}, &block) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 45 def edit_line(text, = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::EditLine.new(text, , block) @containers.last.add(_element) return _element end |
#flow(options = {}, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 3 def flow( = {}, &block) [:parent] = @containers.last [:theme] = current_theme _container = Element::Flow.new(, block) @containers << _container _container.build _container.parent.add(_container) @containers.pop return _container end |
#image(path, options = {}, &block) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 72 def image(path, = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::Image.new(path, , block) @containers.last.add(_element) return _element end |
#label(text, options = {}, &block) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 27 def label(text, = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::Label.new(text, , block) @containers.last.add(_element) return _element end |
#progress(options = {}, &block) ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 81 def progress( = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::Progress.new(, block) @containers.last.add(_element) return _element end |
#stack(options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 15 def stack( = {}, &block) [:parent] = @containers.last [:theme] = current_theme _container = Element::Stack.new(, block) @containers << _container _container.build _container.parent.add(_container) @containers.pop return _container end |
#theme(theme) ⇒ Object
94 95 96 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 94 def theme(theme) @containers.last.[:theme] = theme end |
#toggle_button(options = {}, &block) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/cyberarm_engine/ui/dsl.rb', line 54 def ( = {}, &block) [:parent] = @containers.last [:theme] = current_theme _element = Element::ToggleButton.new(, block) @containers.last.add(_element) return _element end |