lib/cyberarm_engine/ui/dsl.rb in cyberarm_engine-0.8.1 vs lib/cyberarm_engine/ui/dsl.rb in cyberarm_engine-0.9.0
- old
+ new
@@ -1,11 +1,11 @@
module CyberarmEngine
module DSL
def flow(options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _container = Flow.new(options, block)
+ _container = Element::Flow.new(options, block)
@containers << _container
_container.build
_container.parent.add(_container)
@containers.pop
@@ -13,11 +13,11 @@
end
def stack(options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _container = Stack.new(options, block)
+ _container = Element::Stack.new(options, block)
@containers << _container
_container.build
_container.parent.add(_container)
@containers.pop
@@ -25,55 +25,64 @@
end
def label(text, options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _element = Label.new(text, options, block)
+ _element = Element::Label.new(text, options, block)
@containers.last.add(_element)
return _element
end
def button(text, options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _element = Button.new(text, options, block) { if block.is_a?(Proc); block.call; end }
+ _element = Element::Button.new(text, options, block) { if block.is_a?(Proc); block.call; end }
@containers.last.add(_element)
return _element
end
def edit_line(text, options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _element = EditLine.new(text, options, block)
+ _element = Element::EditLine.new(text, options, block)
@containers.last.add(_element)
return _element
end
def toggle_button(options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _element = ToggleButton.new(options, block)
+ _element = Element::ToggleButton.new(options, block)
@containers.last.add(_element)
return _element
end
def check_box(text, options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _element = CheckBox.new(text, options, block)
+ _element = Element::CheckBox.new(text, options, block)
@containers.last.add(_element)
return _element
end
def image(path, options = {}, &block)
options[:parent] = @containers.last
options[:theme] = current_theme
- _element = Image.new(path, options, block)
+ _element = Element::Image.new(path, options, block)
+ @containers.last.add(_element)
+
+ return _element
+ end
+
+ 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
\ No newline at end of file