Commit 38218803 authored by GMT 1998  Tony Gale's avatar GMT 1998 Tony Gale Committed by Tony Gale

- re-write the GtkProgressBar section to the 1.1 API. - add an Appendix

Thu Dec 10 17:58:49 GMT 1998  Tony Gale  <gale@gtk.org>

        * docs/gtk_tut.sgml:
          - re-write the GtkProgressBar section to the 1.1 API.
          - add an Appendix listing all the signals
            (apologies to TimJ for taking so long in using his hard work
             in automating the extraction - thanx Tim).
        * examples/*: bring them all upto the tutorial versions
parent 600ef4e7
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
Thu Dec 10 17:58:49 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- re-write the GtkProgressBar section to the 1.1 API.
- add an Appendix listing all the signals
(apologies to TimJ for taking so long in using his hard work
in automating the extraction - thanx Tim).
* examples/*: bring them all upto the tutorial versions
Thu Dec 10 02:21:16 1998 Jeff Garzik <jgarzik@pobox.com>
* gtk/testdnd.c: use g_snprintf, eliminate need for string.h
......
This diff is collapsed.
This diff is collapsed.
/* aspectframe.c */
/* example-start aspectframe aspectframe.c */
#include <gtk/gtk.h>
......@@ -13,7 +13,7 @@ main (int argc, char *argv[])
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
/* Create an aspect_frame and add it to our toplevel window */
......@@ -41,3 +41,4 @@ main (int argc, char *argv[])
gtk_main ();
return 0;
}
/* example-end */
......@@ -10,10 +10,10 @@ int main( int argc,
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
gtk_widget_show (window);
gtk_main ();
return 0;
return(0);
}
/* example-end */
......@@ -39,7 +39,7 @@ gint main (int argc, gchar *argv[])
clist = gtk_clist_new_with_titles( 2, titles);
/* When a selection is made, we want to know about it. The callback
* used is selection_made, and it's code can be found further down */
* used is selection_made, and its code can be found further down */
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
GTK_SIGNAL_FUNC(selection_made),
NULL);
......
/* This file extracted from the GTK tutorial. */
/* entry.c */
/* example-start entry entry.c */
#include <gtk/gtk.h>
......@@ -90,3 +88,4 @@ int main (int argc, char *argv[])
gtk_main();
return(0);
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* eventbox.c */
/* example-start eventbox eventbox.c */
#include <gtk/gtk.h>
......@@ -53,3 +51,4 @@ main (int argc, char *argv[])
return 0;
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* filesel.c */
/* example-start filesel filesel.c */
#include <gtk/gtk.h>
......@@ -44,3 +42,4 @@ int main (int argc, char *argv[])
gtk_main ();
return 0;
}
/* example-end */
/* example-start gtkdial gtkdial.c */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
......@@ -26,7 +28,7 @@
#define SCROLL_DELAY_LENGTH 300
#define DIAL_DEFAULT_SIZE 100
/* Forward declararations */
/* Forward declarations */
static void gtk_dial_class_init (GtkDialClass *klass);
static void gtk_dial_init (GtkDial *dial);
......@@ -587,5 +589,4 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
dial->old_value = adjustment->value;
}
}
/* example-end */
/* example-start gtkdial gtkdial.h */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
......@@ -87,3 +89,4 @@ void gtk_dial_set_adjustment (GtkDial *dial,
#endif /* __GTK_DIAL_H__ */
/* example-end */
/* This file extracted from the GTK tutorial. */
/* list.c */
/* example-start list list.c */
/* include the gtk+ header files
* include stdio.h, we need that for the printf() function
......@@ -65,7 +63,7 @@ gint main (int argc, gchar *argv[])
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
/* this is the scolled window to put the GtkList widget inside */
/* this is the scrolled window to put the GtkList widget inside */
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
gtk_widget_set_usize(scrolled_window, 250, 150);
gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
......@@ -94,7 +92,7 @@ gint main (int argc, gchar *argv[])
gtk_widget_show(frame);
/* connect the sigh_button_event() signal handler to the GtkList
* wich will handle the "arresting" of list items
* which will handle the "arresting" of list items
*/
gtk_signal_connect(GTK_OBJECT(gtklist),
"button_release_event",
......@@ -107,8 +105,8 @@ gint main (int argc, gchar *argv[])
gtk_container_add(GTK_CONTAINER(vbox), separator);
gtk_widget_show(separator);
/* finaly create a button and connect its "clicked" signal
* to the destroyment of the window
/* finally create a button and connect its "clicked" signal
* to the destruction of the window
*/
button=gtk_button_new_with_label("Close");
gtk_container_add(GTK_CONTAINER(vbox), button);
......@@ -165,7 +163,7 @@ gint main (int argc, gchar *argv[])
}
gtk_list_append_items(GTK_LIST(gtklist), dlist);
/* finaly we want to see the window, dont we? ;)
/* finally we want to see the window, don't we? ;)
*/
gtk_widget_show(window);
......@@ -204,7 +202,7 @@ sigh_button_event (GtkWidget *gtklist,
else
new_prisoner=NULL;
/* look for already prisoned list items, we
/* look for already imprisoned list items, we
* will put them back into the list
* remember to free the doubly linked list that
* gtk_container_children() returns
......@@ -282,3 +280,4 @@ sigh_print_selection (GtkWidget *gtklist,
}
g_print("\n");
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* menu.c */
/* example-start menu menu.c */
#include <gtk/gtk.h>
......@@ -27,7 +25,7 @@ int main (int argc, char *argv[])
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
gtk_window_set_title(GTK_WINDOW (window), "GTK Menu Test");
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
(GtkSignalFunc) gtk_exit, NULL);
(GtkSignalFunc) gtk_main_quit, NULL);
/* Init the menu-widget, and remember -- never
* gtk_show_widget() the menu widget!!
......@@ -101,8 +99,6 @@ int main (int argc, char *argv[])
return 0;
}
/* Respond to a button-press by posting a menu passed in as widget.
*
* Note that the "widget" argument is the menu being posted, NOT
......@@ -132,3 +128,4 @@ static void menuitem_response (gchar *string)
{
printf("%s\n", string);
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* notebook.c */
/* example-start notebook notebook.c */
#include <gtk/gtk.h>
......@@ -36,7 +34,7 @@ void remove_book (GtkButton *button, GtkNotebook *notebook)
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
}
void delete (GtkWidget *widget, GdkEvent *event, gpointer data)
void delete (GtkWidget *widget, GtkWidget *event, gpointer data)
{
gtk_main_quit ();
}
......@@ -172,3 +170,4 @@ int main (int argc, char *argv[])
return 0;
}
/* example-end */
CC = gcc
packer: packer.c
packer: pack.c
$(CC) `gtk-config --cflags` pack.c -o packer `gtk-config --libs`
clean:
......
/* paned.c */
/* example-start paned paned.c */
#include <gtk/gtk.h>
......@@ -134,3 +134,4 @@ main (int argc, char *argv[])
gtk_main ();
return 0;
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* pixmap.c */
/* example-start pixmap pixmap.c */
#include <gtk/gtk.h>
......@@ -31,8 +29,7 @@ static const char * xpm_data[] = {
/* when invoked (via signal delete_event), terminates the application.
*/
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data )
{
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
gtk_main_quit();
}
......@@ -84,3 +81,4 @@ int main( int argc, char *argv[] )
return 0;
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* progressbar.c */
/* example-start progressbar progressbar.c */
#include <gtk/gtk.h>
static int ptimer = 0;
int pstat = TRUE;
typedef struct _ProgressData {
GtkWidget *window;
GtkWidget *pbar;
int timer;
} ProgressData;
/* This function increments and updates the progress bar, it also resets
the progress bar if pstat is FALSE */
gint progress (gpointer data)
/* Update the value of the progress bar so that we get
* some movement */
gint progress_timeout( gpointer data )
{
gfloat pvalue;
/* get the current value of the progress bar */
pvalue = GTK_PROGRESS_BAR (data)->percentage;
if ((pvalue >= 1.0) || (pstat == FALSE)) {
pvalue = 0.0;
pstat = TRUE;
}
pvalue += 0.01;
gtk_progress_bar_update (GTK_PROGRESS_BAR (data), pvalue);
return TRUE;
gfloat new_val;
GtkAdjustment *adj;
adj = GTK_PROGRESS (data)->adjustment;
/* Calculate the value of the progress bar using the
* value range set in the adjustment object */
new_val = adj->value + 1;
if (new_val > adj->upper)
new_val = adj->lower;
/* Set the new value */
gtk_progress_set_value (GTK_PROGRESS (data), new_val);
/* As this is a timeout function, return TRUE so that it
* continues to get called */
return(TRUE);
}
/* Callback that toggles the text display within the progress
* bar trough */
void toggle_show_text( GtkWidget *widget,
ProgressData *pdata )
{
gtk_progress_set_show_text (GTK_PROGRESS (pdata->pbar),
GTK_TOGGLE_BUTTON (widget)->active);
}
/* This function signals a reset of the progress bar */
void progress_r (void)
{
pstat = FALSE;
/* Callback that toggles the activity mode of the progress
* bar */
void toggle_activity_mode( GtkWidget *widget,
ProgressData *pdata )
{
gtk_progress_set_activity_mode (GTK_PROGRESS (pdata->pbar),
GTK_TOGGLE_BUTTON (widget)->active);
}
void destroy (GtkWidget *widget, GdkEvent *event, gpointer data)
/* Callback that toggles the continuous mode of the progress
* bar */
void set_continuous_mode( GtkWidget *widget,
ProgressData *pdata )
{
gtk_main_quit ();
gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR (pdata->pbar),
GTK_PROGRESS_CONTINUOUS);
}
int main (int argc, char *argv[])
/* Callback that toggles the discrete mode of the progress
* bar */
void set_discrete_mode( GtkWidget *widget,
ProgressData *pdata )
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *label;
gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR (pdata->pbar),
GTK_PROGRESS_DISCRETE);
}
/* Clean up allocated memory and remove the timer */
void destroy_progress( GtkWidget *widget,
ProgressData *pdata)
{
gtk_timeout_remove (pdata->timer);
pdata->timer = 0;
pdata->window = NULL;
g_free(pdata);
gtk_main_quit();
}
int main( int argc,
char *argv[])
{
ProgressData *pdata;
GtkWidget *align;
GtkWidget *separator;
GtkWidget *table;
GtkWidget *pbar;
GtkAdjustment *adj;
GtkWidget *button;
GtkWidget *check;
GtkWidget *vbox;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (destroy), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
table = gtk_table_new(3,2,TRUE);
gtk_container_add (GTK_CONTAINER (window), table);
label = gtk_label_new ("Progress Bar Example");
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,2,0,1);
gtk_widget_show(label);
/* Create a new progress bar, pack it into the table, and show it */
pbar = gtk_progress_bar_new ();
gtk_table_attach_defaults(GTK_TABLE(table), pbar, 0,2,1,2);
gtk_widget_show (pbar);
/* Set the timeout to handle automatic updating of the progress bar */
ptimer = gtk_timeout_add (100, progress, pbar);
/* This button signals the progress bar to be reset */
button = gtk_button_new_with_label ("Reset");
/* Allocate memory for the data that is passwd to the callbacks */
pdata = g_malloc( sizeof(ProgressData) );
pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_policy (GTK_WINDOW (pdata->window), FALSE, FALSE, TRUE);
gtk_signal_connect (GTK_OBJECT (pdata->window), "destroy",
GTK_SIGNAL_FUNC (destroy_progress),
pdata);
gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar");
gtk_container_set_border_width (GTK_CONTAINER (pdata->window), 0);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (pdata->window), vbox);
gtk_widget_show(vbox);
/* Create a centering alignment object */
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 5);
gtk_widget_show(align);
/* Create a GtkAdjusment object to hold the range of the
* progress bar */
adj = (GtkAdjustment *) gtk_adjustment_new (0, 1, 150, 0, 0, 0);
/* Create the GtkProgressBar using the adjustment */
pdata->pbar = gtk_progress_bar_new_with_adjustment (adj);
/* Set the format of the string that can be displayed in the
* trough of the progress bar:
* %p - percentage
* %v - value
* %l - lower range value
* %u - upper range value */
gtk_progress_set_format_string (GTK_PROGRESS (pdata->pbar),
"%v from [%l-%u] (=%p%%)");
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
gtk_widget_show(pdata->pbar);
/* Add a timer callback to update the value of the progress bar */
pdata->timer = gtk_timeout_add (100, progress_timeout, pdata->pbar);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
gtk_widget_show(separator);
/* rows, columns, homogeneous */
table = gtk_table_new (2, 3, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
gtk_widget_show(table);
/* Add a check button to select displaying of the trough text */
check = gtk_check_button_new_with_label ("Show text");
gtk_table_attach (GTK_TABLE (table), check, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
gtk_signal_connect (GTK_OBJECT (check), "clicked",
GTK_SIGNAL_FUNC (toggle_show_text),
pdata);
gtk_widget_show(check);
/* Add a check button to toggle activity mode */
check = gtk_check_button_new_with_label ("Activity mode");
gtk_table_attach (GTK_TABLE (table), check, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
gtk_signal_connect (GTK_OBJECT (check), "clicked",
GTK_SIGNAL_FUNC (toggle_activity_mode),
pdata);
gtk_widget_show(check);
separator = gtk_vseparator_new ();
gtk_table_attach (GTK_TABLE (table), separator, 1, 2, 0, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
gtk_widget_show(separator);
/* Add a radio button to select continuous display mode */
button = gtk_radio_button_new_with_label (NULL, "Continuous");
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (progress_r), NULL);
gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,2,3);
gtk_widget_show(button);
button = gtk_button_new_with_label ("Cancel");
GTK_SIGNAL_FUNC (set_continuous_mode),
pdata);
gtk_widget_show (button);
/* Add a radio button to select discrete display mode */
button = gtk_radio_button_new_with_label(
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
"Discrete");
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (destroy), NULL);
gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,2,3);
GTK_SIGNAL_FUNC (set_discrete_mode),
pdata);
gtk_widget_show (button);
gtk_widget_show(table);
gtk_widget_show(window);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
gtk_widget_show(separator);
/* Add a button to exit the program */
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
GTK_OBJECT (pdata->window));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
/* This makes it so the button is the default. */
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
/* This grabs this button to be the default button. Simply hitting
* the "Enter" key will cause this button to activate. */
gtk_widget_grab_default (button);
gtk_widget_show(button);
gtk_widget_show (pdata->window);
gtk_main ();
return 0;
return(0);
}
/* example-end */
/* This file extracted from the GTK tutorial. */
/* rulers.c */
/* example-start rulers rulers.c */
#include <gtk/gtk.h>
......@@ -9,20 +7,16 @@
#define XSIZE 600
#define YSIZE 400
/* this routine gets control when the close button is clicked
*/
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data )
{
/* This routine gets control when the close button is clicked */
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
gtk_main_quit();
}
/* the main routine
*/
/* The main routine */
int main( int argc, char *argv[] ) {
GtkWidget *window, *table, *area, *hrule, *vrule;
/* initialize gtk and create the main window */
/* Initialize GTK and create the main window */
gtk_init( &argc, &argv );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
......@@ -30,7 +24,7 @@ int main( int argc, char *argv[] ) {
GTK_SIGNAL_FUNC( close_application ), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
/* create a table for placing the ruler and the drawing area */
/* 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 );
......@@ -40,8 +34,8 @@ int main( int argc, char *argv[] ) {
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. */
/* 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 );
......@@ -52,8 +46,8 @@ int main( int argc, char *argv[] ) {
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 );
......@@ -64,7 +58,7 @@ int main( int argc, char *argv[] ) {
gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 );
/* now show everything */
/* Now show everything */
gtk_widget_show( area );
gtk_widget_show( hrule );
gtk_widget_show( vrule );
......@@ -72,5 +66,6 @@ int main( int argc, char *argv[] ) {
gtk_widget_show( window );
gtk_main();
return 0;
return(0);
}
/* example-end */
/* example-start scribble-simple scribble-simple.c */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
......@@ -175,3 +177,4 @@ main (int argc, char *argv[])
return 0;
}
/* example-end */
/* This file extracted from the GTK tutorial. */