File: rulers.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 (46 lines) | stat: -rw-r--r-- 1,021 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
34
35
36
37
38
39
40
41
42
43
44
45
46
=begin header

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

  Copyright (C) 2002-2005 Ruby-GNOME2 Project Team

  $Id: rulers.rb,v 1.9 2005/07/18 17:13:33 mutoh Exp $

=end

require 'sample'

class RulerSample < SampleWindow
  def initialize
    super("rulers")

    set_default_size(300, 300)

    set_events(Gdk::Event::POINTER_MOTION_MASK | 
	       Gdk::Event::POINTER_MOTION_HINT_MASK)

    table = Gtk::Table.new(2, 2, false)
    add(table)

    hruler = Gtk::HRuler.new
    hruler.metric = Gtk::CENTIMETERS
    hruler.set_range(100, 0, 0, 20)

    vruler = Gtk::VRuler.new
    vruler.set_range(5, 15, 0, 20)

    signal_connect("motion_notify_event"){ |w, e|
      vruler.signal_emit("motion_notify_event", e)
    }

    table.attach(hruler, 1, 2, 0, 1,
		 Gtk::EXPAND | Gtk::FILL, Gtk::FILL, 0, 0)

    signal_connect("motion_notify_event"){ |w, e|
       hruler.signal_emit("motion_notify_event", e)
    }

    table.attach(vruler, 0, 1, 1, 2,
		 Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0)
  end
end