Sha256: 47023eb7814dff658dbd7c55903174763f784af5c3c71336ab9531faa518df37

Contents?: true

Size: 1.37 KB

Versions: 125

Compression:

Stored size: 1.37 KB

Contents

# Copyright (c) 2008-2016 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
=begin
= Model Button

GtkModelButton is a button widget that is designed to be used with
a GAction as model. The button will adjust its appearance according
to the kind of action it is connected to.

It is also possible to use GtkModelButton without a GAction. In this
case, you should set the "role" attribute yourself, and connect to the
"clicked" signal as you would for any other button.

A common use of GtkModelButton is to implement menu-like content
in popovers.
=end
class ModelbuttonDemo
  def initialize(main_window)
    builder = Gtk::Builder.new(:resource => "/modelbutton/modelbutton.ui")

    builder.connect_signals do |name|
      if name == "tool_clicked"
        proc do |button|
          button.active = !button.active?
        end
      end
    end
    @window = builder["window1"]
    @window.screen = main_window.screen
    actions = Gio::SimpleActionGroup.new
    actions.add_actions([
      { :name => "color", :parameter_type => "s", :state => "'red'" },
      { :name => "chocolate", :state => "true" },
      { :name => "vanilla", :state => "false" },
      { :name => "sprinkles" }
    ])

    @window.insert_action_group("win", actions)
  end

  def run
    if !@window.visible?
      @window.show_all
    else
      @window.destroy
    end
  end
end

Version data entries

125 entries across 117 versions & 2 rubygems

Version Path
gtk3-3.1.2-x64-mingw32 sample/gtk-demo/modelbutton.rb
gtk3-3.1.2-x86-mingw32 sample/gtk-demo/modelbutton.rb
gtk3-3.1.2 sample/gtk-demo/modelbutton.rb
savant-echo-1.0.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-1.0.4 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
gtk3-3.1.1-x64-mingw32 sample/gtk-demo/modelbutton.rb
gtk3-3.1.1-x86-mingw32 sample/gtk-demo/modelbutton.rb
gtk3-3.1.1 sample/gtk-demo/modelbutton.rb
savant-echo-1.0.1 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-1.0.1 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.91 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.91 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.9 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.9 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.6 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.6 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.5 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.5 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb
savant-echo-0.1.4 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/modelbutton.rb