File: colorselect.rb

package info (click to toggle)
ruby-gnome2 3.1.0-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,072 kB
  • ctags: 17,433
  • sloc: ansic: 93,621; ruby: 62,273; xml: 335; sh: 246; makefile: 25
file content (33 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
=begin

  colorselect.rb - a part of testgtk.c rewritten in Ruby/GTK2

  Copyright (C) 2002-2005 Ruby-GNOME2 Project
  $Id: colorselect.rb,v 1.5 2005/07/17 16:55:27 mutoh Exp $
=end

require 'sample'

class ColorSelectionSample < Gtk::ColorSelectionDialog
  include Sample
  extend SampleClass

  def initialize
    super(:title => "color selection dialog")
    @destroyed = false
    signal_connect("destroy"){destroy}

    color_selection.set_has_opacity_control(true)
    set_window_position(:mouse) # Gtk::Window::Position::MOUSE

    color_selection.signal_connect("color_changed"){
      color_selection.current_color
    }
    ok_button.signal_connect("clicked"){
      puts color_selection.current_color
      destroy
    }
    cancel_button.signal_connect("clicked"){destroy}
  end
end