Module: RUI
- Defined in:
- lib/rui.rb,
lib/rui/toolkits/kde/kde.rb,
lib/rui/toolkits/qtbase/gui_builder.rb
Defined Under Namespace
Modules: GuiBuilder Classes: XmlGuiBuilder
Class Method Summary collapse
- .active_color ⇒ Object
-
.autogui(name = :gui, opts = { }, &blk) ⇒ Object
Create a GUI descriptor using the descriptor DSL.
- .gui(name, &blk) ⇒ Object
- .i18n(*args) ⇒ Object
- .std_shortcut(name) ⇒ Object
- .with_xml_gui(xml, &blk) ⇒ Object
Class Method Details
.active_color ⇒ Object
263 264 265 266 |
# File 'lib/rui/toolkits/kde/kde.rb', line 263 def self.active_color scheme = KDE::ColorScheme.new(Qt::Palette::Active, KDE::ColorScheme::Window) color = scheme.foreground(KDE::ColorScheme::PositiveText).color end |
.autogui(name = :gui, opts = { }, &blk) ⇒ Object
Create a GUI descriptor using the descriptor DSL.
A GUI descriptor, as returned by this function, can be applied to a Widget by settings the widget’s gui property to it. For example:
.gui = RUI::autogui do
(:text => "Hello world")
end
See Descriptor for more details on the general descriptor DSL.
See GuiBuilder for a list of supported descriptor tags for GUI descriptors.
51 52 53 |
# File 'lib/rui.rb', line 51 def self.autogui(name = :gui, opts = { }, &blk) Descriptor.build(:gui, opts.merge(:gui_name => name), &blk) end |
.gui(name, &blk) ⇒ Object
198 199 200 201 |
# File 'lib/rui/toolkits/kde/kde.rb', line 198 def self.gui(name, &blk) "<!DOCTYPE kpartgui SYSTEM \"kpartgui.dtd\">\n" + XmlGuiBuilder.new.gui({ :version => 2, :name => name }, &blk) end |
.i18n(*args) ⇒ Object
273 274 275 |
# File 'lib/rui/toolkits/kde/kde.rb', line 273 def self.i18n(*args) KDE.i18n(*args) end |
.std_shortcut(name) ⇒ Object
268 269 270 271 |
# File 'lib/rui/toolkits/kde/kde.rb', line 268 def self.std_shortcut(name) code = KDE::StandardShortcut.send(name.to_s.capitalize) StandardShortcut::shortcut(code) end |
.with_xml_gui(xml, &blk) ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/rui/toolkits/kde/kde.rb', line 203 def self.with_xml_gui(xml, &blk) tmp = TemporaryFile.new tmp.open ::File.open(tmp.file_name, 'w') do |f| f.write(xml) end blk[tmp.file_name] ensure tmp.close ::File.unlink(tmp.file_name) end |