File: colorselect.rb

package info (click to toggle)
ruby-gnome2 0.15.0-1.1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 7,704 kB
  • ctags: 8,558
  • sloc: ansic: 69,912; ruby: 19,511; makefile: 97; xml: 35; sql: 13
file content (33 lines) | stat: -rw-r--r-- 772 bytes parent folder | download | duplicates (10)
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("color selection dialog")
    @destroyed = false
    signal_connect("destroy"){destroy}

    colorsel.set_has_opacity_control(true)
    set_window_position(Gtk::Window::POS_MOUSE)

    colorsel.signal_connect("color_changed"){
      colorsel.current_color
    }
    ok_button.signal_connect("clicked"){
      color = colorsel.current_color
      colorsel.set_current_color(color)
    }
    cancel_button.signal_connect("clicked"){destroy}
  end
end