summaryrefslogtreecommitdiff
path: root/examples/rulers/rulers.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rulers/rulers.c')
-rw-r--r--examples/rulers/rulers.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/examples/rulers/rulers.c b/examples/rulers/rulers.c
index f001e9f826..bb216a3533 100644
--- a/examples/rulers/rulers.c
+++ b/examples/rulers/rulers.c
@@ -11,7 +11,7 @@ gint close_application( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
return FALSE;
}
@@ -21,57 +21,55 @@ int main( int argc,
GtkWidget *window, *table, *area, *hrule, *vrule;
/* Initialize GTK and create the main window */
- gtk_init( &argc, &argv );
+ gtk_init (&argc, &argv);
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC( close_application ), NULL);
+ GTK_SIGNAL_FUNC (close_application), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create a table for placing the ruler and the drawing area */
- table = gtk_table_new( 3, 2, FALSE );
- gtk_container_add( GTK_CONTAINER(window), table );
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_container_add (GTK_CONTAINER (window), table);
- area = gtk_drawing_area_new();
+ area = gtk_drawing_area_new ();
gtk_widget_set_size_request (GTK_WIDGET (area), XSIZE, YSIZE);
- gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2,
- GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 );
- gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK );
+ gtk_table_attach (GTK_TABLE (table), area, 1, 2, 1, 2,
+ GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_events (area, GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK);
/* The horizontal ruler goes on top. As the mouse moves across the
* drawing area, a motion_notify_event is passed to the
* appropriate event handler for the ruler. */
- hrule = gtk_hruler_new();
- gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS );
- gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 );
- g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event",
- (GtkSignalFunc)EVENT_METHOD(hrule,
- motion_notify_event),
- GTK_OBJECT(hrule) );
- gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1,
- GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0 );
+ hrule = gtk_hruler_new ();
+ gtk_ruler_set_metric (GTK_RULER (hrule), GTK_PIXELS);
+ gtk_ruler_set_range (GTK_RULER (hrule), 7, 13, 0, 20);
+ g_signal_connect_swapped (GTK_OBJECT (area), "motion_notify_event",
+ GTK_SIGNAL_FUNC (EVENT_METHOD (hrule, motion_notify_event)),
+ GTK_OBJECT (hrule));
+ gtk_table_attach (GTK_TABLE (table), hrule, 1, 2, 0, 1,
+ GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);
/* The vertical ruler goes on the left. As the mouse moves across
* the drawing area, a motion_notify_event is passed to the
* appropriate event handler for the ruler. */
- vrule = gtk_vruler_new();
- gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
- gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE );
- g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event",
- (GtkSignalFunc)EVENT_METHOD(vrule,
- motion_notify_event),
- GTK_OBJECT(vrule) );
- gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2,
- GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 );
+ vrule = gtk_vruler_new ();
+ gtk_ruler_set_metric (GTK_RULER (vrule), GTK_PIXELS);
+ gtk_ruler_set_range (GTK_RULER (vrule), 0, YSIZE, 10, YSIZE );
+ g_signal_connect_swapped (GTK_OBJECT (area), "motion_notify_event",
+ GTK_SIGNAL_FUNC (EVENT_METHOD (vrule, motion_notify_event)),
+ GTK_OBJECT (vrule));
+ gtk_table_attach (GTK_TABLE (table), vrule, 0, 1, 1, 2,
+ GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);
/* Now show everything */
- gtk_widget_show( area );
- gtk_widget_show( hrule );
- gtk_widget_show( vrule );
- gtk_widget_show( table );
- gtk_widget_show( window );
- gtk_main();
+ gtk_widget_show (area);
+ gtk_widget_show (hrule);
+ gtk_widget_show (vrule);
+ gtk_widget_show (table);
+ gtk_widget_show (window);
+ gtk_main ();
return 0;
}