A.24. Rulers

function create_rulers ()
{
  local	table, ruler;
  
  win_rulers = new (GtkWindow);
  win_rulers.set_policy(TRUE, TRUE, FALSE);
  win_rulers.signal ("destroy", #win_rulers = nil);
  win_rulers.title = "rulers";
  win_rulers.set_usize(300, 300);
  win_rulers.set_events(GDK_POINTER_MOTION_MASK |
			GDK_POINTER_MOTION_HINT_MASK);
  win_rulers.border_width = 0;
  
  table = gtk_table_new(2,2,FALSE);
  win_rulers.add(table);
  table.show();
  
  ruler = new(GtkHRuler);
  ruler.set_metric(GTK_CENTIMETERS);
  ruler.set_range(100, 0, 0, 20);
  win_rulers.signal("motion_notify_event",
		    `(@ruler).signal_emit_by_name("motion_notify_event",
						  gtk_args_raw));
  
  table.attach(ruler, 1, 2, 0, 1,
	       GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
  ruler.show();
  
  ruler = new(GtkVRuler);
  ruler.set_range(5, 15, 0, 20);
  win_rulers.signal("motion_notify_event",
		    `(@ruler).signal_emit_by_name("motion_notify_event",
						  gtk_args_raw));
  table.attach(ruler, 0, 1, 1, 2,
	       GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
  ruler.show();
  
  win_rulers.show_all();
  win_rulers;
}

function main ()
{
  local window, win_rulers;
  TRUE=1;
  FALSE=0;
  window = create_rulers ();
  window.signal ("destroy", #exit_program(0));
  init_ipc("rulers", "rulersq");
  gtk_main ();
}