|
|
|
@ -130,7 +130,7 @@ program possible. This program will create a 200x200 pixel window and
|
|
|
|
|
has no way of exiting except to be killed by using the shell.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start base base.c */
|
|
|
|
|
<!-- example-start base base.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>You can compile the above program with gcc using:</para>
|
|
|
|
@ -240,7 +240,7 @@ occur. In our simple example, however, events are ignored.</para>
|
|
|
|
|
hello world a la GTK.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start helloworld helloworld.c */
|
|
|
|
|
<!-- example-start helloworld helloworld.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -340,7 +340,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -955,7 +955,7 @@ better examples of callbacks. This will also introduce us to our next
|
|
|
|
|
topic, packing widgets.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start helloworld2 helloworld2.c */
|
|
|
|
|
<!-- example-start helloworld2 helloworld2.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -1050,7 +1050,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>Compile this program using the same linking arguments as our first
|
|
|
|
@ -1201,7 +1201,7 @@ it. Compile it yourself and play with it.</para>
|
|
|
|
|
<title>Packing Demonstration Program</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start packbox packbox.c */
|
|
|
|
|
<!-- example-start packbox packbox.c -->
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
@ -1493,7 +1493,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -1668,7 +1668,7 @@ Which means it should look something like this:</para>
|
|
|
|
|
<para>Here's the source code:</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start table table.c */
|
|
|
|
|
<!-- example-start table table.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -1766,7 +1766,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -2017,7 +2017,7 @@ from the rest so you can use it in your programs. There are further
|
|
|
|
|
examples of using pixmaps later in the tutorial.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start buttons buttons.c */
|
|
|
|
|
<!-- example-start buttons buttons.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -2123,7 +2123,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>The xpm_label_box function could be used to pack xpm's and labels into
|
|
|
|
@ -2332,7 +2332,7 @@ the second will emit its "toggled" signal (to report becoming active).</para>
|
|
|
|
|
<para>The following example creates a radio button group with three buttons.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start radiobuttons radiobuttons.c */
|
|
|
|
|
<!-- example-start radiobuttons radiobuttons.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include <glib.h>
|
|
|
|
@ -2414,7 +2414,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<!-- TODO: check out gtk_radio_button_new_from_widget function - TRG -->
|
|
|
|
@ -2959,7 +2959,7 @@ the section on adjustments, so you can see how they affect the way
|
|
|
|
|
these widgets work for the user.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start rangewidgets rangewidgets.c */
|
|
|
|
|
<!-- example-start rangewidgets rangewidgets.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -3249,7 +3249,7 @@ int main( int argc,
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>You will notice that the program does not call <literal>gtk_signal_connect</literal>
|
|
|
|
@ -3351,7 +3351,7 @@ makes use of the Frame widget to better demonstrate the label
|
|
|
|
|
styles. You can ignore this for now as the <link linkend="sec-Frames">Frame</link> widget is explained later on.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start label label.c */
|
|
|
|
|
<!-- example-start label label.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -3452,7 +3452,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -3502,7 +3502,7 @@ point. The <literal>shadow_type</literal> argument may take one of these values:
|
|
|
|
|
<para>Here's a brief example to illustrate their use.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start arrow arrow.c */
|
|
|
|
|
<!-- example-start arrow arrow.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -3575,7 +3575,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -3889,7 +3889,7 @@ gtk_progress_bar_update function in the same manner.</para>
|
|
|
|
|
code also shows you how to reset the Progress Bar.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start progressbar progressbar.c */
|
|
|
|
|
<!-- example-start progressbar progressbar.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -4109,7 +4109,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -4329,7 +4329,7 @@ managing. Val is the pixmap created using GDK.</para>
|
|
|
|
|
<para>The following is an example of using a pixmap in a button.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start pixmap pixmap.c */
|
|
|
|
|
<!-- example-start pixmap pixmap.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -4418,7 +4418,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>To load a file from an XPM data file called icon0.xpm in the current
|
|
|
|
@ -4447,7 +4447,7 @@ icon. The following example displays a full wheelbarrow image on the
|
|
|
|
|
desktop.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start wheelbarrow wheelbarrow.c */
|
|
|
|
|
<!-- example-start wheelbarrow wheelbarrow.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -4622,7 +4622,7 @@ int main (int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>To make the wheelbarrow image sensitive, we could attach the button
|
|
|
|
@ -4728,7 +4728,7 @@ vertical ruler spans from 0 to 400 with a mark every 100 pixels.
|
|
|
|
|
Placement of the drawing area and the rulers is done using a table.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start rulers rulers.c */
|
|
|
|
|
<!-- example-start rulers rulers.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -4806,7 +4806,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -4868,7 +4868,7 @@ pushing items onto the statusbar, and one for popping the last item
|
|
|
|
|
back off.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start statusbar statusbar.c */
|
|
|
|
|
<!-- example-start statusbar statusbar.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include <glib.h>
|
|
|
|
@ -4944,7 +4944,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -5044,7 +5044,7 @@ removed.</para>
|
|
|
|
|
<para>The following code is an example of using an Entry widget.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start entry entry.c */
|
|
|
|
|
<!-- example-start entry entry.c -->
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
@ -5137,7 +5137,7 @@ int main( int argc,
|
|
|
|
|
gtk_main();
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -5382,7 +5382,7 @@ void gtk_spin_button_update( GtkSpinButton *spin_button );
|
|
|
|
|
<para>It's example time again.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start spinbutton spinbutton.c */
|
|
|
|
|
<!-- example-start spinbutton spinbutton.c -->
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
@ -5602,7 +5602,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -5941,7 +5941,7 @@ and are:</para>
|
|
|
|
|
example code.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start calendar calendar.c */
|
|
|
|
|
<!-- example-start calendar calendar.c -->
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
|
|
|
|
|
* Copyright (C) 2000 Tony Gale
|
|
|
|
@ -6362,7 +6362,7 @@ int main(int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -6475,7 +6475,7 @@ changing the color in the color selection dialog changes the
|
|
|
|
|
background color.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start colorsel colorsel.c */
|
|
|
|
|
<!-- example-start colorsel colorsel.c -->
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
@ -6618,7 +6618,7 @@ gint main( gint argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -6675,7 +6675,7 @@ selection widget. While in this example the Help button appears on the
|
|
|
|
|
screen, it does nothing as there is not a signal attached to it.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start filesel filesel.c */
|
|
|
|
|
<!-- example-start filesel filesel.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -6723,7 +6723,7 @@ int main( int argc,
|
|
|
|
|
gtk_main ();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -6772,7 +6772,7 @@ mouse-click on the label causes the program to exit. Resizing the
|
|
|
|
|
window reveals varying amounts of the label.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start eventbox eventbox.c */
|
|
|
|
|
<!-- example-start eventbox eventbox.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -6825,7 +6825,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -6911,7 +6911,7 @@ position.</para>
|
|
|
|
|
<para>The following example illustrates how to use the Fixed Container.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start fixed fixed.c */
|
|
|
|
|
<!-- example-start fixed fixed.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -6984,7 +6984,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -7124,7 +7124,7 @@ void gtk_frame_set_shadow_type( GtkFrame *frame,
|
|
|
|
|
<para>The following code example illustrates the use of the Frame widget.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start frame frame.c */
|
|
|
|
|
<!-- example-start frame frame.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -7175,7 +7175,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -7222,7 +7222,7 @@ drawing area whose aspect ratio will always be 2:1, no matter how the
|
|
|
|
|
user resizes the top-level window.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start aspectframe aspectframe.c */
|
|
|
|
|
<!-- example-start aspectframe aspectframe.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -7265,7 +7265,7 @@ int main( int argc,
|
|
|
|
|
gtk_main ();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -7316,7 +7316,7 @@ correct portions shrink instead of being pushed off the bottom of the
|
|
|
|
|
window.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start paned paned.c */
|
|
|
|
|
<!-- example-start paned paned.c -->
|
|
|
|
|
|
|
|
|
|
#define GTK_ENABLE_BROKEN
|
|
|
|
|
#include <stdio.h>
|
|
|
|
@ -7454,7 +7454,7 @@ int main( int argc,
|
|
|
|
|
gtk_main ();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -7566,7 +7566,7 @@ into a scrolled window. I've only commented on the parts that may be
|
|
|
|
|
new to you.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start scrolledwin scrolledwin.c */
|
|
|
|
|
<!-- example-start scrolledwin scrolledwin.c -->
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
@ -7660,7 +7660,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>Try playing with resizing the window. You'll notice how the scrollbars
|
|
|
|
@ -7738,7 +7738,7 @@ GtkButtonBoxStyle gtk_vbutton_box_get_layout_default( void );
|
|
|
|
|
for Button Boxes.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start buttonbox buttonbox.c */
|
|
|
|
|
<!-- example-start buttonbox buttonbox.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -7859,7 +7859,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -8454,7 +8454,7 @@ the tabs and border, remove a page, change pages in both a forward and
|
|
|
|
|
backward manner, and exit the program.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start notebook notebook.c */
|
|
|
|
|
<!-- example-start notebook notebook.c -->
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
@ -8630,7 +8630,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>I hope this helps you on your way with creating notebooks for your
|
|
|
|
@ -9214,7 +9214,7 @@ gtk_signal_connect(GTK_OBJECT( clist),
|
|
|
|
|
<title>A CList example</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start clist clist.c */
|
|
|
|
|
<!-- example-start clist clist.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -9387,7 +9387,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -10298,7 +10298,7 @@ tree, and connects all the signals for the relevant objects, so you
|
|
|
|
|
can see when they are emitted.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start tree tree.c */
|
|
|
|
|
<!-- example-start tree tree.c -->
|
|
|
|
|
|
|
|
|
|
#define GTK_ENABLE_BROKEN
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
@ -10480,7 +10480,7 @@ int main( int argc,
|
|
|
|
|
gtk_main();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -10732,7 +10732,7 @@ by a menu bar, as shown in the sample code.</simpara>
|
|
|
|
|
<para>That should about do it. Let's take a look at an example to help clarify.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start menu menu.c */
|
|
|
|
|
<!-- example-start menu menu.c -->
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
@ -10865,7 +10865,7 @@ static void menuitem_response( gchar *string )
|
|
|
|
|
{
|
|
|
|
|
printf ("%s\n", string);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>You may also set a menu item to be insensitive and, using an accelerator
|
|
|
|
@ -10889,7 +10889,7 @@ gtk_item_factory calls.</para>
|
|
|
|
|
<para>Here is an example using the GTK item factory.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start menu itemfactory.c */
|
|
|
|
|
<!-- example-start menu itemfactory.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include <strings.h>
|
|
|
|
@ -11002,7 +11002,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
<para>For now, there's only this example. An explanation and lots 'o' comments
|
|
|
|
@ -11284,7 +11284,7 @@ extend the selection.</para>
|
|
|
|
|
<title>A GtkText Example</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start text text.c */
|
|
|
|
|
<!-- example-start text text.c -->
|
|
|
|
|
|
|
|
|
|
/* text.c */
|
|
|
|
|
|
|
|
|
@ -11468,7 +11468,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -12462,7 +12462,7 @@ which is a list of all targets into which the selection can be
|
|
|
|
|
converted.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start selection gettargets.c */
|
|
|
|
|
<!-- example-start selection gettargets.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
@ -12558,7 +12558,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -12631,7 +12631,7 @@ itself), is the "STRING" target. When this target is requested, a
|
|
|
|
|
string representation of the time is returned.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start selection setselection.c */
|
|
|
|
|
<!-- example-start selection setselection.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
@ -12738,7 +12738,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
@ -17485,7 +17485,7 @@ which are not included in complete form elsewhere.</para>
|
|
|
|
|
<title>tictactoe.h</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start tictactoe tictactoe.h */
|
|
|
|
|
<!-- example-start tictactoe tictactoe.h -->
|
|
|
|
|
|
|
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
@ -17549,7 +17549,7 @@ void tictactoe_clear (Tictactoe *ttt);
|
|
|
|
|
|
|
|
|
|
#endif /* __TICTACTOE_H__ */
|
|
|
|
|
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -17559,7 +17559,7 @@ void tictactoe_clear (Tictactoe *ttt);
|
|
|
|
|
<title>tictactoe.c</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start tictactoe tictactoe.c */
|
|
|
|
|
<!-- example-start tictactoe tictactoe.c -->
|
|
|
|
|
|
|
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
@ -17719,7 +17719,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -17729,7 +17729,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
|
|
|
|
|
<title>ttt_test.c</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start tictactoe ttt_test.c */
|
|
|
|
|
<!-- example-start tictactoe ttt_test.c -->
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include "tictactoe.h"
|
|
|
|
@ -17773,7 +17773,7 @@ int main( int argc,
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -17788,7 +17788,7 @@ int main( int argc,
|
|
|
|
|
<title>gtkdial.h</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start gtkdial gtkdial.h */
|
|
|
|
|
<!-- example-start gtkdial gtkdial.h -->
|
|
|
|
|
|
|
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
@ -17880,7 +17880,7 @@ void gtk_dial_set_adjustment (GtkDial *dial,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __GTK_DIAL_H__ */
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -17890,7 +17890,7 @@ void gtk_dial_set_adjustment (GtkDial *dial,
|
|
|
|
|
<title>gtkdial.c</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start gtkdial gtkdial.c */
|
|
|
|
|
<!-- example-start gtkdial gtkdial.c -->
|
|
|
|
|
|
|
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
@ -18545,7 +18545,7 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
|
|
|
|
dial->old_value = adjustment->value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -18634,7 +18634,7 @@ int main( int argc,
|
|
|
|
|
<title>scribble-simple.c</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start scribble-simple scribble-simple.c */
|
|
|
|
|
<!-- example-start scribble-simple scribble-simple.c -->
|
|
|
|
|
|
|
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
@ -18813,7 +18813,7 @@ int main( int argc,
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -18823,7 +18823,7 @@ int main( int argc,
|
|
|
|
|
<title>scribble-xinput.c</title>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start scribble-xinput scribble-xinput.c */
|
|
|
|
|
<!-- example-start scribble-xinput scribble-xinput.c -->
|
|
|
|
|
|
|
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
@ -18956,7 +18956,7 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
|
|
|
|
{
|
|
|
|
|
x = event->x;
|
|
|
|
|
y = event->y;
|
|
|
|
|
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure);
|
|
|
|
|
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure);
|
|
|
|
|
state = event->state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -19081,7 +19081,7 @@ main (int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
@ -19333,7 +19333,7 @@ selection of a List, and lets you "arrest" list items into a prison
|
|
|
|
|
by selecting them with the rightmost mouse button.</para>
|
|
|
|
|
|
|
|
|
|
<programlisting role="C">
|
|
|
|
|
/* example-start list list.c */
|
|
|
|
|
<!-- example-start list list.c -->
|
|
|
|
|
|
|
|
|
|
/* Include the GTK header files
|
|
|
|
|
* Include stdio.h, we need that for the printf() function
|
|
|
|
@ -19610,7 +19610,7 @@ void sigh_print_selection( GtkWidget *gtklist,
|
|
|
|
|
}
|
|
|
|
|
g_print("\n");
|
|
|
|
|
}
|
|
|
|
|
/* example-end */
|
|
|
|
|
<!-- example-end -->
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
|