Module: CyberarmEngine::DSL

Included in:
GuiState
Defined in:
lib/cyberarm_engine/ui/dsl.rb

Instance Method Summary collapse

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 button(text, options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::Button.new(text, options, 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, options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::CheckBox.new(text, options, block)
  @containers.last.add(_element)

  return _element
end

#current_themeObject



98
99
100
# File 'lib/cyberarm_engine/ui/dsl.rb', line 98

def current_theme
  @containers.last.options[: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, options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::EditLine.new(text, options, 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(options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _container = Element::Flow.new(options, 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, options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::Image.new(path, options, 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, options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::Label.new(text, options, 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(options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::Progress.new(options, 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(options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _container = Element::Stack.new(options, 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.options[: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 toggle_button(options = {}, &block)
  options[:parent] = @containers.last
  options[:theme] = current_theme
  _element = Element::ToggleButton.new(options, block)
  @containers.last.add(_element)

  return _element
end