Module: RUI::GuiBuilder

Included in:
Action, ActionList, Group, Gui, Label, Layout, Menu, MenuBar, Separator, Stretch, Tab, TabWidget, ToolBar, Widget
Defined in:
lib/rui/toolkits/qtbase/gui_builder.rb

Overview

Helper module used to interpret a GUI descriptor and build a Qt GUI.

Classes in this module correspond to valid descriptor tags.

Defined Under Namespace

Classes: Action, ActionList, Button, CheckBox, ComboBox, Group, Gui, Label, Layout, LineEdit, List, Menu, MenuBar, Separator, Stretch, Tab, TabWidget, ToolBar, UrlRequester, Widget

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(window, gui) ⇒ Object



17
18
19
# File 'lib/rui/toolkits/qtbase/gui_builder.rb', line 17

def self.build(window, gui)
  Gui.new.build(window, nil, gui)
end

Instance Method Details

#build(window, parent, desc) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/rui/toolkits/qtbase/gui_builder.rb', line 21

def build(window, parent, desc)
  element = create_element(window, parent, desc)
  desc.children.each do |child|
    b = builder(child.tag).new
    b.build(window, element, child)
  end
  element
end

#builder(name) ⇒ Object



37
38
39
# File 'lib/rui/toolkits/qtbase/gui_builder.rb', line 37

def builder(name)
  GuiBuilder.const_get(name.to_s.capitalize.camelize)
end

#setup_widget(widget, parent, layout, desc) ⇒ Object



30
31
32
33
34
35
# File 'lib/rui/toolkits/qtbase/gui_builder.rb', line 30

def setup_widget(widget, parent, layout, desc)
  layout.add_widget(widget)
  if desc.opts[:name]
    parent.add_accessor(desc.opts[:name], widget)
  end        
end