Sha256: 63210f4c65d0ffaed79646971434ecfbc1f9543deb16aa6a64a7206531150bbc

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

# Copyright (c) 2009-2010 Paolo Capriotti <p.capriotti@gmail.com>
# 
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.

require 'rubygems' rescue nil
require 'rui/observer_utils'
require 'rui/utils'
require 'builder'

case ($toolkit || :kde)
when :qt
  require 'Qt4'
  KDE = Qt
  RUI = Qt
  require 'rui/toolkits/qt/qt'
when :kde
  require 'korundum4'
  require 'rui/toolkits/kde/kde'
  module RUI
    MainWindow = KDE::XmlGuiWindow

    def self.const_missing(c)
      if KDE.const_defined?(c)
        KDE.const_get(c)
      else
        Qt.const_get(c)
      end
    end
  end
end

module RUI
  #
  # 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:
  #
  #   widget.gui = RUI::autogui do
  #     button(:text => "Hello world")
  #   end
  #
  # See {Descriptor} for more details on the general descriptor DSL.
  #
  # See {RUI::GuiBuilder} for a list of supported descriptor tags for GUI
  # descriptors.
  #
  def self.autogui(name = :gui, opts = { }, &blk)
    Descriptor.build(:gui, opts.merge(:gui_name => name), &blk)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rui-0.1.2 lib/rui.rb
rui-0.1.0 lib/rui.rb