Sha256: 3b138874fe53dd9499426a93093f261c00c2e33f9a44cf6d68a22ef2d99d9966

Contents?: true

Size: 1.48 KB

Versions: 12

Compression:

Stored size: 1.48 KB

Contents

# Copyright (c) 2013 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
=begin
= Spinner

GtkSpinner allows to show that background activity is on-going.
=end
require 'common'

module Demo
  class Spinner < Gtk::Dialog
    def initialize
      super(:title => 'Spinner',
            :parent => nil,
            :flags => nil,
            :buttons => [[:close, :none]])

      signal_connect(:response) {self.destroy}
      signal_connect(:destroy) {self.destroy}

      self.resizable = false
      
      vbox = Gtk::Box.new :vertical, 5

      self.content_area.pack_start vbox, :expand => true, :fill => true, :padding => 0
      vbox.border_width = 5

      # Sensitive
      hbox = Gtk::Box.new :horizontal, 5
      @spinner_sensitive = Gtk::Spinner.new
      hbox.add @spinner_sensitive
      hbox.add Gtk::Entry.new
      vbox.add hbox

      # Disabled
      hbox = Gtk::Box.new :horizontal, 5
      @spinner_insensitive = Gtk::Spinner.new
      hbox.add @spinner_insensitive
      hbox.add Gtk::Entry.new
      vbox.add hbox
      hbox.sensitive = false

      button = Gtk::Button.new :stock_id => :media_play
      button.signal_connect(:clicked) do
        @spinner_sensitive.start
        @spinner_insensitive.start
      end
      vbox.add button

      button = Gtk::Button.new :stock_id => :media_stop
      button.signal_connect(:clicked) do
        @spinner_sensitive.stop
        @spinner_insensitive.stop
      end
      vbox.add button
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gtk3-2.2.0-x86-mingw32 sample/gtk-demo/spinner.rb
gtk3-2.2.0 sample/gtk-demo/spinner.rb
gtk3-2.1.0-x86-mingw32 sample/gtk-demo/spinner.rb
gtk3-2.1.0 sample/gtk-demo/spinner.rb
gtk3-2.0.3-x86-mingw32 sample/gtk-demo/spinner.rb
gtk3-2.0.3 sample/gtk-demo/spinner.rb
gtk3-2.0.2-x86-mingw32 sample/gtk-demo/spinner.rb
gtk3-2.0.2 sample/gtk-demo/spinner.rb
gtk3-2.0.1-x86-mingw32 sample/gtk-demo/spinner.rb
gtk3-2.0.1 sample/gtk-demo/spinner.rb
gtk3-2.0.0-x86-mingw32 sample/gtk-demo/spinner.rb
gtk3-2.0.0 sample/gtk-demo/spinner.rb