summaryrefslogtreecommitdiff
path: root/examples/rulers
diff options
context:
space:
mode:
authorGMT 1999 Tony Gale <gale@gtk.org>1999-11-13 23:06:46 +0000
committerTony Gale <gale@src.gnome.org>1999-11-13 23:06:46 +0000
commitee3d13766031e30653d82764aef92ae444015c5e (patch)
treec0d025531a52bee6a44d65babd111b6d3f04bed7 /examples/rulers
parente4df9fa95b83ce233c2129c3098e2727316e982b (diff)
downloadgtk+-ee3d13766031e30653d82764aef92ae444015c5e.tar.gz
threads example from Erik Mouw. New question on GtkLabel background
Sat Nov 13 22:30:29 GMT 1999 Tony Gale <gale@gtk.org> * docs/gtkfaq.sgml: threads example from Erik Mouw. New question on GtkLabel background colors. * docs/gtk_tut.sgml: - Correct the example code callback function definitions. - Update the gtkdial example code, from Frans van Schaik. - Update setselection.c to current API. * examples/Makefile examples/*/*.c: Update to code listed in tutorial.
Diffstat (limited to 'examples/rulers')
-rw-r--r--examples/rulers/rulers.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/examples/rulers/rulers.c b/examples/rulers/rulers.c
index 41260c6bc8..fa933f172d 100644
--- a/examples/rulers/rulers.c
+++ b/examples/rulers/rulers.c
@@ -8,12 +8,17 @@
#define YSIZE 400
/* This routine gets control when the close button is clicked */
-void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
+gint close_application( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
gtk_main_quit();
+ return(FALSE);
}
/* The main routine */
-int main( int argc, char *argv[] ) {
+int main( int argc,
+ char *argv[] ) {
GtkWidget *window, *table, *area, *hrule, *vrule;
/* Initialize GTK and create the main window */
@@ -32,28 +37,33 @@ int main( int argc, char *argv[] ) {
gtk_drawing_area_size( (GtkDrawingArea *)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_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. */
+ /* 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 );
gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
- (GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event),
+ (GtkSignalFunc)EVENT_METHOD(hrule,
+ motion_notify_event),
GTK_OBJECT(hrule) );
/* GTK_WIDGET_CLASS(GTK_OBJECT(hrule)->klass)->motion_notify_event, */
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. */
+ /* 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 );
gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
(GtkSignalFunc)
- GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->motion_notify_event,
+ GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->
+ 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 );