lib/cyberarm_engine/ui/dsl.rb in cyberarm_engine-0.14.0 vs lib/cyberarm_engine/ui/dsl.rb in cyberarm_engine-0.15.0

- old
+ new

@@ -10,60 +10,74 @@ def label(text, options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::Label.new(text, options, block) ) + add_element(Element::Label.new(text, options, block)) end def button(text, options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::Button.new(text, options, block) { if block.is_a?(Proc); block.call; end } ) + add_element(Element::Button.new(text, options, block) { block.call if block.is_a?(Proc) }) end + def list_box(options = {}, &block) + options[:parent] = element_parent + options[:theme] = current_theme + + add_element(Element::ListBox.new(options, block) { block.call if block.is_a?(Proc) }) + end + def edit_line(text, options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::EditLine.new(text, options, block) ) + add_element(Element::EditLine.new(text, options, block)) end + def edit_box(text, options = {}, &block) + options[:parent] = element_parent + options[:theme] = current_theme + + add_element(Element::EditBox.new(text, options, block)) + end + def toggle_button(options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::ToggleButton.new(options, block) ) + add_element(Element::ToggleButton.new(options, block)) end def check_box(text, options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::CheckBox.new(text, options, block) ) + add_element(Element::CheckBox.new(text, options, block)) end def image(path, options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::Image.new(path, options, block) ) + add_element(Element::Image.new(path, options, block)) end def progress(options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::Progress.new(options, block) ) + add_element(Element::Progress.new(options, block)) end def slider(options = {}, &block) options[:parent] = element_parent options[:theme] = current_theme - add_element( Element::Slider.new(options, block) ) + add_element(Element::Slider.new(options, block)) end def background(color = Gosu::Color::NONE) element_parent.style.background = color end @@ -77,11 +91,11 @@ end private def add_element(element) element_parent.add(element) - return element + element end private def element_parent $__current_container__ end @@ -98,9 +112,9 @@ _container.build _container.parent.add(_container) $__current_container__ = old_parent - return _container + _container end end -end \ No newline at end of file +end