+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
+Sun May 24 12:11:38 BST 1998 Tony Gale <gale@gtk.org>
+
+ * docs/gtk_tut.sgml:
+ - GtkTooltips, update to current API
+ - change all 'gpointer *data' to 'gpointer data'
+ - other minor changes
+
Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org>
* configure.in (LDFLAGS): Bombo out with a moderately
name="<imain@gtk.org>"></tt>,
Tony Gale <tt><htmlurl url="mailto:gale@gtk.org"
name="<gale@gtk.org>"></tt>
-<date>April 6th, 1998
+<date>May 24th, 1998
<!-- ***************************************************************** -->
<sect>Introduction
function", and should be of the form:
<tscreen><verb>
-void callback_func(GtkWidget *widget, gpointer *callback_data);
+void callback_func(GtkWidget *widget, gpointer callback_data);
</verb></tscreen>
<p>
Where the first argument will be a pointer to the widget that emitted the signal, and
argument to tell us which button was pressed.
<tscreen><verb>
-void hello (GtkWidget *widget, gpointer *data)
+void hello (GtkWidget *widget, gpointer data)
{
g_print ("Hello World\n");
}
when control is returned to it.
<tscreen><verb>
-void destroy (GtkWidget *widget, gpointer *data)
+void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
/* Our new improved callback. The data passed to this function is printed
* to stdout. */
-void callback (GtkWidget *widget, gpointer *data)
+void callback (GtkWidget *widget, gpointer data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* another callback */
-void delete_event (GtkWidget *widget, gpointer *data)
+void delete_event (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
#include "gtk/gtk.h"
void
-delete_event (GtkWidget *widget, gpointer *data)
+delete_event (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
/* our callback.
* the data passed to this function is printed to stdout */
-void callback (GtkWidget *widget, gpointer *data)
+void callback (GtkWidget *widget, gpointer data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* this callback quits the program */
-void delete_event (GtkWidget *widget, gpointer *data)
+void delete_event (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
}
/* our usual callback function */
-void callback (GtkWidget *widget, gpointer *data)
+void callback (GtkWidget *widget, gpointer data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
#include <gtk/gtk.h>
#include <glib.h>
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
Some widgets (such as the label) will not work with tooltips.
<p>
The first call you will use to create a new tooltip. You only need to do
-this once in a given function. The GtkTooltip this function returns can be
-used to create multiple tooltips.
+this once in a given function. The <tt/GtkTooltip/ this function
+returns can be used to create multiple tooltips.
<tscreen><verb>
GtkTooltips *gtk_tooltips_new (void);
simply use this call to set it.
<tscreen><verb>
-void gtk_tooltips_set_tips (GtkTooltips *tooltips,
- GtkWidget *widget,
- gchar *tips_text);
+void gtk_tooltips_set_tip (GtkTooltips *tooltips,
+ GtkWidget *widget,
+ const gchar *tip_text,
+ const gchar *tip_private);
</verb></tscreen>
The first argument is the tooltip you've already created, followed by the
widget you wish to have this tooltip pop up for, and the text you wish it to
-say.
+say. The last argument can be set to NULL.
<p>
Here's a short example:
tooltips = gtk_tooltips_new ();
button = gtk_button_new_with_label ("button 1");
...
-gtk_tooltips_set_tips (tooltips, button, "This is button 1");
+gtk_tooltips_set_tip (tooltips, button, "This is button 1", NULL);
</verb></tscreen>
-
There are other calls used with tooltips. I will just list them with a
brief description of what they do.
pstat = FALSE;
}
-void destroy (GtkWidget *widget, gpointer *data)
+void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
So to create a new dialog box, use,
<tscreen><verb>
-GtkWidget window;
+GtkWidget *window;
window = gtk_dialog_new ();
</verb></tscreen>
/* when invoked (via signal delete_event), terminates the application.
*/
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
/* is invoked when the button is clicked. It just prints a message.
*/
-void button_clicked( GtkWidget *widget, gpointer *data ) {
+void button_clicked( GtkWidget *widget, gpointer data ) {
printf( "button clicked\n" );
}
/* when invoked (via signal delete_event), terminates the application.
*/
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
/* this routine gets control when the close button is clicked
*/
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
GtkWidget *status_bar;
-void push_item (GtkWidget *widget, gpointer *data)
+void push_item (GtkWidget *widget, gpointer data)
{
static int count = 1;
char buff[20];
return;
}
-void pop_item (GtkWidget *widget, gpointer *data)
+void pop_item (GtkWidget *widget, gpointer data)
{
gtk_statusbar_pop( GTK_STATUSBAR(status_bar), (guint) &data );
return;
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
}
-void destroy (GtkWidget *widget, gpointer *data)
+void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
}
-void delete (GtkWidget *widget, gpointer *data)
+void delete (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
#include <gtk/gtk.h>
-void destroy(GtkWidget *widget, gpointer *data)
+void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
which in our case looks like this:
<tscreen><verb>
-gtk_menu_bar_append( menu_bar, file_item );
+gtk_menu_bar_append( GTK_MENU_BAR (menu_bar), file_item );
</verb></tscreen>
If we wanted the menu right justified on the menubar, such as help menus often are, we can
If you must use one of these widgets that are undocumented, I strongly
suggest you take a look at their respective header files in the GTK distro.
GTK's function names are very descriptive. Once you have an understanding
-of how things work, it's not easy to figure out how to use a widget simply
+of how things work, it's not difficult to figure out how to use a widget simply
by looking at it's function declarations. This, along with a few examples
from others' code, and it should be no problem.
name="<imain@gtk.org>"></tt>,
Tony Gale <tt><htmlurl url="mailto:gale@gtk.org"
name="<gale@gtk.org>"></tt>
-<date>April 6th, 1998
+<date>May 24th, 1998
<!-- ***************************************************************** -->
<sect>Introduction
function", and should be of the form:
<tscreen><verb>
-void callback_func(GtkWidget *widget, gpointer *callback_data);
+void callback_func(GtkWidget *widget, gpointer callback_data);
</verb></tscreen>
<p>
Where the first argument will be a pointer to the widget that emitted the signal, and
argument to tell us which button was pressed.
<tscreen><verb>
-void hello (GtkWidget *widget, gpointer *data)
+void hello (GtkWidget *widget, gpointer data)
{
g_print ("Hello World\n");
}
when control is returned to it.
<tscreen><verb>
-void destroy (GtkWidget *widget, gpointer *data)
+void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
/* Our new improved callback. The data passed to this function is printed
* to stdout. */
-void callback (GtkWidget *widget, gpointer *data)
+void callback (GtkWidget *widget, gpointer data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* another callback */
-void delete_event (GtkWidget *widget, gpointer *data)
+void delete_event (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
#include "gtk/gtk.h"
void
-delete_event (GtkWidget *widget, gpointer *data)
+delete_event (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
/* our callback.
* the data passed to this function is printed to stdout */
-void callback (GtkWidget *widget, gpointer *data)
+void callback (GtkWidget *widget, gpointer data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* this callback quits the program */
-void delete_event (GtkWidget *widget, gpointer *data)
+void delete_event (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
}
/* our usual callback function */
-void callback (GtkWidget *widget, gpointer *data)
+void callback (GtkWidget *widget, gpointer data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
#include <gtk/gtk.h>
#include <glib.h>
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
Some widgets (such as the label) will not work with tooltips.
<p>
The first call you will use to create a new tooltip. You only need to do
-this once in a given function. The GtkTooltip this function returns can be
-used to create multiple tooltips.
+this once in a given function. The <tt/GtkTooltip/ this function
+returns can be used to create multiple tooltips.
<tscreen><verb>
GtkTooltips *gtk_tooltips_new (void);
simply use this call to set it.
<tscreen><verb>
-void gtk_tooltips_set_tips (GtkTooltips *tooltips,
- GtkWidget *widget,
- gchar *tips_text);
+void gtk_tooltips_set_tip (GtkTooltips *tooltips,
+ GtkWidget *widget,
+ const gchar *tip_text,
+ const gchar *tip_private);
</verb></tscreen>
The first argument is the tooltip you've already created, followed by the
widget you wish to have this tooltip pop up for, and the text you wish it to
-say.
+say. The last argument can be set to NULL.
<p>
Here's a short example:
tooltips = gtk_tooltips_new ();
button = gtk_button_new_with_label ("button 1");
...
-gtk_tooltips_set_tips (tooltips, button, "This is button 1");
+gtk_tooltips_set_tip (tooltips, button, "This is button 1", NULL);
</verb></tscreen>
-
There are other calls used with tooltips. I will just list them with a
brief description of what they do.
pstat = FALSE;
}
-void destroy (GtkWidget *widget, gpointer *data)
+void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
So to create a new dialog box, use,
<tscreen><verb>
-GtkWidget window;
+GtkWidget *window;
window = gtk_dialog_new ();
</verb></tscreen>
/* when invoked (via signal delete_event), terminates the application.
*/
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
/* is invoked when the button is clicked. It just prints a message.
*/
-void button_clicked( GtkWidget *widget, gpointer *data ) {
+void button_clicked( GtkWidget *widget, gpointer data ) {
printf( "button clicked\n" );
}
/* when invoked (via signal delete_event), terminates the application.
*/
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
/* this routine gets control when the close button is clicked
*/
-void close_application( GtkWidget *widget, gpointer *data ) {
+void close_application( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
GtkWidget *status_bar;
-void push_item (GtkWidget *widget, gpointer *data)
+void push_item (GtkWidget *widget, gpointer data)
{
static int count = 1;
char buff[20];
return;
}
-void pop_item (GtkWidget *widget, gpointer *data)
+void pop_item (GtkWidget *widget, gpointer data)
{
gtk_statusbar_pop( GTK_STATUSBAR(status_bar), (guint) &data );
return;
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
}
-void destroy (GtkWidget *widget, gpointer *data)
+void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
}
-void delete (GtkWidget *widget, gpointer *data)
+void delete (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
#include <gtk/gtk.h>
-void destroy(GtkWidget *widget, gpointer *data)
+void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
which in our case looks like this:
<tscreen><verb>
-gtk_menu_bar_append( menu_bar, file_item );
+gtk_menu_bar_append( GTK_MENU_BAR (menu_bar), file_item );
</verb></tscreen>
If we wanted the menu right justified on the menubar, such as help menus often are, we can
If you must use one of these widgets that are undocumented, I strongly
suggest you take a look at their respective header files in the GTK distro.
GTK's function names are very descriptive. Once you have an understanding
-of how things work, it's not easy to figure out how to use a widget simply
+of how things work, it's not difficult to figure out how to use a widget simply
by looking at it's function declarations. This, along with a few examples
from others' code, and it should be no problem.