class ColorselDemo

Color Chooser

A GtkColorChooser lets the user choose a color. There are several implementations of the GtkColorChooser interface in GTK+. The GtkColorChooserDialog is a prebuilt dialog containing a GtkColorChooserWidget.

Public Class Methods

new(main_window) click to toggle source
# File gtk3/sample/gtk-demo/colorsel.rb, line 13
def initialize(main_window)
  @color = Gdk::RGBA.new(0, 0, 1, 1)

  @window = Gtk::Window.new(:toplevel)
  @window.screen = main_window.screen
  @window.title = "Color Chooser"

  vbox = Gtk::Box.new(:vertical, 8)
  vbox.margin = 12
  @window.add(vbox)
  frame = initialize_drawing_area_frame
  vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0)

  button = initialize_color_chooser_button
  vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
end

Public Instance Methods

run() click to toggle source
# File gtk3/sample/gtk-demo/colorsel.rb, line 30
def run
  if !@window.visible?
    @window.show_all
  else
    @window.destroy
  end
  @window
end