From 9f1363013fe5e3def58a007b6c109be93d4e5702 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 25 Feb 2002 01:47:44 +0000 Subject: More GTK+ 2.0 updates. * docs/tutorial/gtk-tut.sgml, docs/tutorial/images/*, examples/*: More GTK+ 2.0 updates. * docs/tutorial/Makefile.am: build and dist the new tutorial, not the old Linuxdoc one. --- docs/tutorial/Makefile.am | 200 ++-- docs/tutorial/gtk-tut.sgml | 1965 ++++++++++++-------------------------- docs/tutorial/images/buttons.png | Bin 5269 -> 4063 bytes 3 files changed, 654 insertions(+), 1511 deletions(-) (limited to 'docs/tutorial') diff --git a/docs/tutorial/Makefile.am b/docs/tutorial/Makefile.am index 94826e5efe..3954b4b4d3 100644 --- a/docs/tutorial/Makefile.am +++ b/docs/tutorial/Makefile.am @@ -1,156 +1,68 @@ -TUTORIAL_FR_FILES=html/gtk_tut_fr-1.html \ -html/gtk_tut_fr-2.html \ -html/gtk_tut_fr-3.html \ -html/gtk_tut_fr-4.html \ -html/gtk_tut_fr-5.html \ -html/gtk_tut_fr-6.html \ -html/gtk_tut_fr-7.html \ -html/gtk_tut_fr-8.html \ -html/gtk_tut_fr-9.html \ -html/gtk_tut_fr-10.html \ -html/gtk_tut_fr-11.html \ -html/gtk_tut_fr-12.html \ -html/gtk_tut_fr-13.html \ -html/gtk_tut_fr-14.html \ -html/gtk_tut_fr-15.html \ -html/gtk_tut_fr-16.html \ -html/gtk_tut_fr-17.html \ -html/gtk_tut_fr-18.html \ -html/gtk_tut_fr-19.html \ -html/gtk_tut_fr-20.html \ -html/gtk_tut_fr-21.html \ -html/gtk_tut_fr-22.html \ -html/gtk_tut_fr-23.html \ -html/gtk_tut_fr-24.html \ -html/gtk_tut_fr.html text/gtk_tut_fr.txt +.PHONY: html pdf -TUTORIAL_FILES=text/gtk_tut.txt html/gtk_tut.html \ -html/gtk_tut.html \ -html/gtk_tut-1.html \ -html/gtk_tut-2.html \ -html/gtk_tut-3.html \ -html/gtk_tut-4.html \ -html/gtk_tut-5.html \ -html/gtk_tut-6.html \ -html/gtk_tut-7.html \ -html/gtk_tut-8.html \ -html/gtk_tut-9.html \ -html/gtk_tut-10.html \ -html/gtk_tut-11.html \ -html/gtk_tut-12.html \ -html/gtk_tut-13.html \ -html/gtk_tut-14.html \ -html/gtk_tut-15.html \ -html/gtk_tut-16.html \ -html/gtk_tut-17.html \ -html/gtk_tut-18.html \ -html/gtk_tut-19.html \ -html/gtk_tut-20.html \ -html/gtk_tut-21.html \ -html/gtk_tut-22.html \ -html/gtk_tut-23.html \ -html/gtk_tut-24.html \ -html/gtk_tut-25.html \ -html/gtk_tut-26.html \ -html/gtk_tut-27.html \ -html/gtk_tut-28.html \ -html/gtk_tut-29.html \ -html/gtk_tut-30.html \ -html/gtk_tut-31.html - -TUTORIAL_IT_FILES= html/gtk_tut_it.html \ - html/gtk_tut_it-1.html \ - html/gtk_tut_it-2.html \ - html/gtk_tut_it-3.html \ - html/gtk_tut_it-4.html \ - html/gtk_tut_it-5.html \ - html/gtk_tut_it-6.html \ - html/gtk_tut_it-7.html \ - html/gtk_tut_it-8.html \ - html/gtk_tut_it-9.html \ - html/gtk_tut_it-10.html \ - html/gtk_tut_it-11.html \ - html/gtk_tut_it-12.html \ - html/gtk_tut_it-13.html \ - html/gtk_tut_it-14.html \ - html/gtk_tut_it-15.html \ - html/gtk_tut_it-16.html \ - html/gtk_tut_it-17.html \ - html/gtk_tut_it-18.html \ - html/gtk_tut_it-19.html \ - html/gtk_tut_it-20.html \ - html/gtk_tut_it-21.html \ - html/gtk_tut_it-22.html \ - html/gtk_tut_it-23.html \ - html/gtk_tut_it-24.html \ - text/gtk_tut_it.txt - -GTKDOCS_FIX=$(srcdir)/../gtkdocs_fix - -.PHONY: htmldir textdir tutorial tutorial_it tutorial_fr - -htmldir: - (cd $(srcdir); mkdir -p html; cp gtk_tut*gif html) - -textdir: - mkdir -p $(srcdir)/text - -$(TUTORIAL_FILES): tutorial - -$(TUTORIAL_FR_FILES): tutorial_fr - -$(TUTORIAL_IT_FILES): tutorial_it - -tutorial: htmldir textdir - (cd $(srcdir); sgml2html gtk_tut.sgml; \ - perl $(GTKDOCS_FIX) gtk_tut*html; \ - mv gtk_tut*html html/; \ - sgml2txt gtk_tut.sgml; \ - mv gtk_tut.txt text/) +EXTRA_DIST = \ + gtk-tut.sgml \ + images/arrow.png \ + images/aspectframe.png \ + images/base.png \ + images/buttonbox.png \ + images/buttons.png \ + images/calendar.png \ + images/colorsel.png \ + images/entry.png \ + images/eventbox.png \ + images/filesel.png \ + images/fixed.png \ + images/frame.png \ + images/gtkdial.png \ + images/helloworld.png \ + images/helloworld2.png \ + images/label.png \ + images/menu.png \ + images/notebook.png \ + images/packbox1.png \ + images/packbox2.png \ + images/paned.png \ + images/progressbar.png \ + images/radiobuttons.png \ + images/rangewidgets.png \ + images/rulers.png \ + images/scribble.png \ + images/scrolledwin.png \ + images/spinbutton.png \ + images/statusbar.png \ + images/table.png \ + images/tictactoe.png -tutorial_it: htmldir textdir - (cd $(srcdir); sgml2html --language=it gtk_tut_it.sgml; \ - perl $(GTKDOCS_FIX) gtk_tut_it*html; \ - mv gtk_tut_it*html html/; \ - sgml2txt --language=it gtk_tut_it.sgml; \ - mv gtk_tut_it.txt text/) +if HAVE_DOCBOOK +html: + (cd $(srcdir); \ + db2html gtk-tut.sgml; \ + mv gtk-tut html; \ + mkdir html/images; \ + cp images/*.png html/images) -tutorial_fr: htmldir textdir - (cd $(srcdir); sgml2html --language=fr gtk_tut_fr.sgml; \ - perl $(GTKDOCS_FIX) gtk_tut_fr*html; \ - mv gtk_tut_fr*html html/; \ - sgml2txt --language=fr gtk_tut_fr.sgml; \ - mv gtk_tut_fr.txt text/) +pdf: + (cd $(srcdir); db2pdf gtk-tut.sgml) +dist-hook: html pdf + cp -Rp $(srcdir)/html $(distdir) + cp -p $(srcdir)/gtk-tut.pdf $(distdir) +else +html: + echo "***" + echo "*** Warning: Tutorial not built" + echo "***" -EXTRA_DIST = \ - gtk_tut.sgml \ - gtk_tut_12.es.sgml \ - gtk_tut_it.sgml \ - gtk_tut_fr.sgml \ - gtk_tut_packbox1.gif \ - gtk_tut_packbox1.eps \ - gtk_tut_packbox1.jpg \ - gtk_tut_packbox2.gif \ - gtk_tut_packbox2.eps \ - gtk_tut_packbox2.jpg \ - gtk_tut_table.gif \ - gtk_tut_table.eps \ - gtk_tut_table.jpg \ - package_tutorial.sh \ - package-db-tutorial.sh +pdf: + echo "***" + echo "*** Warning: Tutorial not built" + echo "***" -if HAVE_SGML2HTML -dist-hook: tutorial tutorial_it tutorial_fr - mkdir $(distdir)/html - cp -p $(srcdir)/html/*.html $(distdir)/html - cp -p $(srcdir)/html/*.gif $(distdir)/html - mkdir $(distdir)/text - cp -p $(srcdir)/text/*.txt $(distdir)/text -else dist-hook: echo "***" echo "*** Warning: Tutorial not built" echo "*** DISTRIBUTION IS INCOMPLETE" echo "***" endif + diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml index 0261a65e03..7b4a4305a6 100755 --- a/docs/tutorial/gtk-tut.sgml +++ b/docs/tutorial/gtk-tut.sgml @@ -162,7 +162,7 @@ has no way of exiting except to be killed by using the shell. - + @@ -277,7 +277,7 @@ hello world a la GTK. - + @@ -1040,7 +1040,7 @@ topic, packing widgets. - + @@ -1212,7 +1212,7 @@ different styles. - + @@ -1271,7 +1271,7 @@ following figure should make it clearer: - + @@ -1756,7 +1756,7 @@ Which means it should look something like this: - + @@ -2101,8 +2101,6 @@ is the testgtk program that comes with GTK. It can be found i - - The Button Widget @@ -2112,23 +2110,24 @@ is the testgtk program that comes with GTK. It can be found i Normal Buttons We've almost seen all there is to see of the button widget. It's -pretty simple. There are however two ways to create a button. You can -use the gtk_button_new_with_label() to create a button with a label, -or use gtk_button_new() to create a blank button. It's then up to you -to pack a label or pixmap into this new button. To do this, create a -new box, and then pack your objects into this box using the usual -gtk_box_pack_start, and then use gtk_container_add to pack the box -into the button. - -Here's an example of using gtk_button_new to create a button with a -picture and a label in it. I've broken up the code to create a box -from the rest so you can use it in your programs. There are further -examples of using pixmaps later in the tutorial. +pretty simple. There is however more than one way to create a button. You can +use the gtk_button_new_with_label() or gtk_button_new_with_mnemonic() to create +a button with a label, use gtk_button_new_from_stock() to create a button +containing the image and text from a stock item or use gtk_button_new() to +create a blank button. It's then up to you to pack a label or pixmap into +this new button. To do this, create a new box, and then pack your objects into +this box using the usual gtk_box_pack_start(), and then use gtk_container_add() +to pack the box into the button. + +Here's an example of using gtk_button_new() to create a button with a +image and a label in it. I've broken up the code to create a box from the rest +so you can use it in your programs. There are further examples of using images +later in the tutorial. - + @@ -2142,44 +2141,31 @@ examples of using pixmaps later in the tutorial. /* Create a new hbox with an image and a label packed into it * and return the box. */ -GtkWidget *xpm_label_box( GtkWidget *parent, - gchar *xpm_filename, +GtkWidget *xpm_label_box( gchar *xpm_filename, gchar *label_text ) { - GtkWidget *box1; + GtkWidget *box; GtkWidget *label; - GtkWidget *pixmapwid; - GdkPixmap *pixmap; - GdkBitmap *mask; - GtkStyle *style; + GtkWidget *image; - /* Create box for xpm and label */ - box1 = gtk_hbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (box1), 2); + /* Create box for image and label */ + box = gtk_hbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (box), 2); - /* Get the style of the button to get the - * background color. */ - style = gtk_widget_get_style (parent); - - /* Now on to the xpm stuff */ - pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask, - &style->bg[GTK_STATE_NORMAL], - xpm_filename); - pixmapwid = gtk_image_new_from_file (xpm_filename); + /* Now on to the image stuff */ + image = gtk_image_new_from_file (xpm_filename); /* Create a label for the button */ label = gtk_label_new (label_text); - /* Pack the pixmap and label into the box */ - gtk_box_pack_start (GTK_BOX (box1), - pixmapwid, FALSE, FALSE, 3); - - gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3); + /* Pack the image and label into the box */ + gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 3); - gtk_widget_show (pixmapwid); + gtk_widget_show (image); gtk_widget_show (label); - return box1; + return box; } /* Our usual callback function */ @@ -2195,7 +2181,7 @@ int main( int argc, /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *button; - GtkWidget *box1; + GtkWidget *box; gtk_init (&argc, &argv); @@ -2213,7 +2199,6 @@ int main( int argc, /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_widget_realize (window); /* Create a new button */ button = gtk_button_new (); @@ -2223,12 +2208,12 @@ int main( int argc, G_CALLBACK (callback), (gpointer) "cool button"); /* This calls our box creating function */ - box1 = xpm_label_box(window, "info.xpm", "cool button"); + box = xpm_label_box ("info.xpm", "cool button"); /* Pack and show all our widgets */ - gtk_widget_show (box1); + gtk_widget_show (box); - gtk_container_add (GTK_CONTAINER (button), box1); + gtk_container_add (GTK_CONTAINER (button), box); gtk_widget_show (button); @@ -2244,27 +2229,9 @@ int main( int argc, -The xpm_label_box function could be used to pack xpm's and labels into +The xpm_label_box() function could be used to pack images and labels into any widget that can be a container. -Notice in xpm_label_box how there is a call to -gtk_widget_get_style. Every widget has a "style", consisting of -foreground and background colors for a variety of situations, font -selection, and other graphics data relevant to a widget. These style -values are defaulted in each widget, and are required by many GDK -function calls, such as gdk_pixmap_create_from_xpm, which here is -given the "normal" background color. The style data of widgets may -be customized, using GTK's rc files. - -Also notice the call to gtk_widget_realize after setting the -window's border width. This function uses GDK to create the X -windows related to the widget. The function is automatically called -when you invoke gtk_widget_show for a widget, and so has not been -shown in earlier examples. But the call to -gdk_pixmap_create_from_xpm requires that its window argument -refer to a real X window, so it is necessary to realize the widget -before this GDK call. - The Button widget has the following signals: @@ -2303,16 +2270,19 @@ and check buttons. I will point these out when we come to them. GtkWidget *gtk_toggle_button_new( void ); -GtkWidget *gtk_toggle_button_new_with_label( gchar *label ); +GtkWidget *gtk_toggle_button_new_with_label( const gchar *label ); + +GtkWidget *gtk_toggle_button_new_with_mnemonic( const gchar *label ); As you can imagine, these work identically to the normal button widget -calls. The first creates a blank toggle button, and the second, a -button with a label widget already packed into it. +calls. The first creates a blank toggle button, and the last two, a +button with a label widget already packed into it. The _mnemonic() variant +additionally parses the label for '_'-prefixed mnemonic characters. To retrieve the state of the toggle widget, including radio and check buttons, we use a construct as shown in our example below. This tests -the state of the toggle, by accessing the active field of the +the state of the toggle button, by accessing the active field of the toggle widget's structure, after first using the GTK_TOGGLE_BUTTON macro to cast the widget pointer into a toggle widget pointer. The signal of interest to us emitted by toggle @@ -2324,7 +2294,7 @@ to determine its state. The callback will look something like: void toggle_button_callback (GtkWidget *widget, gpointer data) { - if (GTK_TOGGLE_BUTTON (widget)->active) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { /* If control reaches here, the toggle button is down */ @@ -2340,7 +2310,7 @@ check buttons, use this function: void gtk_toggle_button_set_active( GtkToggleButton *toggle_button, - gint state ); + gboolean is_active ); The above call can be used to set the state of the toggle button, and @@ -2372,16 +2342,18 @@ buttons with text inside them, they are small squares with the text to the right of them. These are often used for toggling options on and off in applications. -The two creation functions are similar to those of the normal button. +The creation functions are similar to those of the normal button. GtkWidget *gtk_check_button_new( void ); -GtkWidget *gtk_check_button_new_with_label ( gchar *label ); +GtkWidget *gtk_check_button_new_with_label ( const gchar *label ); + +GtkWidget *gtk_check_button_new_with_mnemonic ( const gchar *label ); -The new_with_label function creates a check button with a label beside -it. +The gtk_check_button_new_with_label() function creates a check button +with a label beside it. Checking the state of the check button is identical to that of the toggle button. @@ -2402,33 +2374,55 @@ of options. GtkWidget *gtk_radio_button_new( GSList *group ); +GtkWidget *gtk_radio_button_new_from_widget( GtkRadioButton *group ); + GtkWidget *gtk_radio_button_new_with_label( GSList *group, - gchar *label ); + const gchar *label ); + +GtkWidget* gtk_radio_button_new_with_label_from_widget( GtkRadioButton *group, + const gchar *label ); + +GtkWidget *gtk_radio_button_new_with_mnemonic( GSList *group, + const gchar *label ); + +GtkWidget *gtk_radio_button_new_with_mnemonic_from_widget( GtkRadioButton *group, + const gchar *label ); + You'll notice the extra argument to these calls. They require a group -to perform their duty properly. The first call to -gtk_radio_button_new or gtk_radio_button_new_with_label -should pass NULL as the first argument. Then create a group using: +to perform their duty properly. The first call to gtk_radio_button_new() or +gtk_radio_button_new_with_label() should pass NULL as the first argument. +Then create a group using: -GSList *gtk_radio_button_group( GtkRadioButton *radio_button ); +GSList *gtk_radio_button_get_group( GtkRadioButton *radio_button ); -The important thing to remember is that gtk_radio_button_group must be -called for each new button added to the group, with the previous -button passed in as an argument. The result is then passed into the -next call to gtk_radio_button_new or -gtk_radio_button_new_with_label. This allows a chain of buttons to be -established. The example below should make this clear. +The important thing to remember is that gtk_radio_button_get_group() must be +called for each new button added to the group, with the previous button passed +in as an argument. The result is then passed into the next call to +gtk_radio_button_new() or gtk_radio_button_new_with_label(). This allows a +chain of buttons to be established. The example below should make this clear. You can shorten this slightly by using the following syntax, which -removes the need for a variable to hold the list of buttons. This form -is used in the example to create the third button: +removes the need for a variable to hold the list of buttons: button2 = gtk_radio_button_new_with_label( - gtk_radio_button_group (GTK_RADIO_BUTTON (button1)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button1)), + "button2"); + + + +The _from_widget() variants of the creation functions allow you to shorten this +further, by omitting the gtk_radio_button_get_group() call. This form is used +in the example to create the third button: + + + + button2 = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON (button1), "button2"); @@ -2437,7 +2431,7 @@ default depressed button with: void gtk_toggle_button_set_active( GtkToggleButton *toggle_button, - gint state ); + gboolean state ); This is described in the section on toggle buttons, and works in @@ -2452,7 +2446,7 @@ the second will emit its "toggled" signal (to report becoming active). - + @@ -2511,9 +2505,8 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); - button = gtk_radio_button_new_with_label( - gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), - "button3"); + button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), + "button3"); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); @@ -2543,8 +2536,6 @@ int main( int argc, - - @@ -2599,12 +2590,12 @@ but some cases will be shown in later examples where you may need to create one yourself. You create an adjustment using: -GtkObject *gtk_adjustment_new( gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - gfloat page_size ); +GtkObject *gtk_adjustment_new( gdouble value, + gdouble lower, + gdouble upper, + gdouble step_increment, + gdouble page_increment, + gdouble page_size ); The value argument is the initial value you want to give to the @@ -2651,16 +2642,16 @@ find out, and it may be different from widget to widget). Now, you're probably thinking, since text widgets and viewports insist on setting everything except the value of their adjustments, -while scrollbars will only touch the adjustment's value, if -you share an adjustment object between a scrollbar and a text -widget, manipulating the scrollbar will automagically adjust the text -widget? Of course it will! Just like this: +while scrollbars will only touch the adjustment's +value, if you share an adjustment +object between a scrollbar and a text widget, manipulating the scrollbar will +automagically adjust the viewport widget? Of course it will! Just like this: /* creates its own adjustments */ - text = gtk_text_new (NULL, NULL); + viewport = gtk_viewport_new (NULL, NULL); /* uses the newly-created adjustment for the scrollbar as well */ - vscrollbar = gtk_vscrollbar_new (GTK_TEXT(text)->vadj); + vscrollbar = gtk_vscrollbar_new (gtk_viewport_get_vadjustment (viewport)); @@ -2678,31 +2669,32 @@ answer these questions and more, let's start by taking a look at struct _GtkAdjustment { - GtkData data; + GtkObject parent_instance; - gfloat lower; - gfloat upper; - gfloat value; - gfloat step_increment; - gfloat page_increment; - gfloat page_size; + gdouble lower; + gdouble upper; + gdouble value; + gdouble step_increment; + gdouble page_increment; + gdouble page_size; }; -The first thing you should know is that there aren't any handy-dandy -macros or accessor functions for getting the value out of an -Adjustment, so you'll have to (horror of horrors) do it like a -real C programmer. Don't worry - the GTK_ADJUSTMENT -(Object) macro does run-time type checking (as do all the GTK -type-casting macros, actually). +If you don't like to poke directly at struct internals like a +real C programmer, you can use the following accessor to +inspect the value of an adjustment: + + +gdouble gtk_adjustment_get_value( GtkAdjustment *adjustment); + -Since, when you set the value of an adjustment, you generally +Since, when you set the value of an Adjustment, you generally want the change to be reflected by every widget that uses this adjustment, GTK provides this convenience function to do this: void gtk_adjustment_set_value( GtkAdjustment *adjustment, - gfloat value ); + gdouble value ); As mentioned earlier, Adjustment is a subclass of Object just @@ -2721,22 +2713,22 @@ of this signal in struct _GtkAdjustmentClass: signal on an adjustment whenever they change its value. This happens both when user input causes the slider to move on a range widget, as well as when the program explicitly changes the value with -gtk_adjustment_set_value(). So, for example, if you have a scale +gtk_adjustment_set_value(). So, for example, if you have a scale widget, and you want to change the rotation of a picture whenever its value changes, you would create a callback like this: void cb_rotate_picture (GtkAdjustment *adj, GtkWidget *picture) { - set_picture_rotation (picture, adj->value); + set_picture_rotation (picture, gtk_adjustment_get_value (adj)); ... and connect it to the scale widget's adjustment like this: -gtk_signal_connect (GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (cb_rotate_picture), picture); +g_signal_connect (G_OBJECT (adj), "value_changed", + G_CALLBACK (cb_rotate_picture), picture); What about when a widget reconfigures the upper or lower @@ -2761,7 +2753,7 @@ this signal on it to reconfigure whatever widgets are using it, like this: -gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "changed"); +g_signal_emit_by_name (G_OBJECT (adjustment), "changed"); Now go forth and adjust! @@ -2774,7 +2766,7 @@ gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "changed"); Range Widgets The category of range widgets includes the ubiquitous scrollbar widget -and the less common "scale" widget. Though these two types of widgets +and the less common scale widget. Though these two types of widgets are generally used for different purposes, they are quite similar in function and implementation. All range widgets share a set of common graphic elements, each of which has its own X window and receives @@ -2803,8 +2795,7 @@ widgets, as they are friendlier and more featureful. There are separate types for horizontal and vertical scrollbars. There really isn't much to say about these. You create them with the -following functions, defined in <gtk/gtkhscrollbar.h> -and <gtk/gtkvscrollbar.h>: +following functions: GtkWidget *gtk_hscrollbar_new( GtkAdjustment *adjustment ); @@ -2840,27 +2831,35 @@ takes over the screen. As with scrollbars, there are separate widget types for horizontal and vertical scale widgets. (Most programmers seem to favour horizontal scale widgets.) Since they work essentially the same way, there's no -need to treat them separately here. The following functions, defined -in <gtk/gtkvscale.h> and -<gtk/gtkhscale.h>, create vertical and horizontal scale -widgets, respectively: +need to treat them separately here. The following functions create vertical and +horizontal scale widgets, respectively: GtkWidget *gtk_vscale_new( GtkAdjustment *adjustment ); +GtkWidget *gtk_vscale_new_with_range( gdouble min, + gdouble max, + gdouble step ); + GtkWidget *gtk_hscale_new( GtkAdjustment *adjustment ); + +GtkWidget *gtk_hscale_new_with_range( gdouble min, + gdouble max, + gdouble step ); The adjustment argument can either be an adjustment which has -already been created with gtk_adjustment_new(), or NULL, in +already been created with gtk_adjustment_new(), or NULL, in which case, an anonymous Adjustment is created with all of its -values set to 0.0 (which isn't very useful in this case). In -order to avoid confusing yourself, you probably want to create your -adjustment with a page_size of 0.0 so that its upper -value actually corresponds to the highest value the user can select. -(If you're already thoroughly confused, read the section on Adjustments again for an explanation of -what exactly adjustments do and how to create and manipulate them.) +values set to 0.0 (which isn't very useful in this case). +In order to avoid confusing yourself, you probably want to create your +adjustment with a page_size of 0.0 so +that its upper value actually corresponds to the highest +value the user can select. The _new_with_range() variants take care of creating +a suitable adjustment. (If you're already thoroughly +confused, read the section on Adjustments +again for an explanation of what exactly adjustments do and how to create and +manipulate them.) @@ -2874,14 +2873,14 @@ this with this function: void gtk_scale_set_draw_value( GtkScale *scale, - gint draw_value ); + gboolean draw_value ); As you might have guessed, draw_value is either TRUE or FALSE, with predictable consequences for either one. The value displayed by a scale widget is rounded to one decimal point -by default, as is the value field in its GtkAdjustment. You can +by default, as is the value field in its Adjustment. You can change this with: @@ -2901,9 +2900,8 @@ void gtk_scale_set_value_pos( GtkScale *scale, GtkPositionType pos ); -The argument pos is of type GtkPositionType, which is -defined in <gtk/gtkenums.h>, and can take one of the -following values: +The argument pos is of type GtkPositionType, +which can take one of the following values: GTK_POS_LEFT @@ -2920,7 +2918,8 @@ slider up and down the trough. <gtk/gtkscale.h>. The header files for all GTK widgets are automatically included when you include <gtk/gtk.h>. But you should look over the header files -of all widgets that interest you, +of all widgets that interest you, in order to learn more about their functions +and features. @@ -2948,25 +2947,32 @@ Adjustment. The update policies, defined in <gtk/gtkenums.h> as type enum GtkUpdateType, are: - -GTK_UPDATE_CONTINUOUS - This is the default. The + + +GTK_UPDATE_CONTINUOUS +This is the default. The "value_changed" signal is emitted continuously, i.e., whenever the -slider is moved by even the tiniest amount. +slider is moved by even the tiniest amount. - -GTK_UPDATE_DISCONTINUOUS - The "value_changed" signal is + + +GTK_UPDATE_DISCONTINUOUS +The "value_changed" signal is only emitted once the slider has stopped moving and the user has -released the mouse button. +released the mouse button. - -GTK_UPDATE_DELAYED - The "value_changed" signal is emitted + + +GTK_UPDATE_DELAYED +The "value_changed" signal is emitted when the user releases the mouse button, or if the slider stops moving -for a short period of time. +for a short period of time. - + + The update policy of a range widget can be set by casting it using the -GTK_RANGE (Widget) macro and passing it to this function: +GTK_RANGE(widget) macro and passing it to this function: void gtk_range_set_update_policy( GtkRange *range, @@ -3005,7 +3011,7 @@ when you modify its values directly, you should emit the "changed" signal on it, like this: -gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "changed"); +g_signal_emit_by_name (G_OBJECT (adjustment), "changed"); @@ -3020,57 +3026,25 @@ the same way. Clicking button-1 in the trough will cause its adjustment's page_increment to be added or subtracted from its value, and the slider to be moved accordingly. Clicking mouse button-2 in the trough will jump the slider to the point at which the -button was clicked. Clicking any button on a scrollbar's arrows will -cause its adjustment's value to change step_increment at a time. - -It may take a little while to get used to, but by default, scrollbars -as well as scale widgets can take the keyboard focus in GTK. If you -think your users will find this too confusing, you can always disable -this by unsetting the GTK_CAN_FOCUS flag on the scrollbar, like -this: +button was clicked. Clicking button-3 in the trough of a range or any button on +a scrollbar's arrows will cause its adjustment's value to change by +step_increment at a time. - -GTK_WIDGET_UNSET_FLAGS (scrollbar, GTK_CAN_FOCUS); - +Scrollbars are not focusable, thus have no key bindings. The key bindings +for the other range widgets (which are, of course, only active when the widget +has focus) are do not differentiate between horizontal and +vertical range widgets. -The key bindings (which are, of course, only active when the widget -has focus) are slightly different between horizontal and vertical -range widgets, for obvious reasons. They are also not quite the same -for scale widgets as they are for scrollbars, for somewhat less -obvious reasons (possibly to avoid confusion between the keys for -horizontal and vertical scrollbars in scrolled windows, where both -operate on the same area). - - - -Vertical Range Widgets - -All vertical range widgets can be operated with the up and down arrow -keys, as well as with the Page Up and Page Down keys. The -arrows move the slider up and down by step_increment, while -Page Up and Page Down move it by page_increment. +All range widgets can be operated with the left, right, up and down arrow +keys, as well as with the Page Up and Page Down +keys. The arrows move the slider up and down by step_increment, while +Page Up and Page Down move it by +page_increment. The user can also move the slider all the way to one end or the other -of the trough using the keyboard. With the VScale widget, this is -done with the Home and End keys, whereas with the -VScrollbar widget, this is done by typing Control-Page Up -and Control-Page Down. +of the trough using the keyboard. This is done with the Home +and End keys. - - - - -Horizontal Range Widgets - -The left and right arrow keys work as you might expect in these -widgets, moving the slider back and forth by step_increment. The -Home and End keys move the slider to the ends of the trough. -For the HScale widget, moving the slider by page_increment is -accomplished with Control-Left and Control-Right, -while for HScrollbar, it's done with Control-Home and -Control-End. - - @@ -3078,7 +3052,7 @@ while for HScrollbar, it's done with Control-Home and Example This example is a somewhat modified version of the "range controls" -test from testgtk.c. It basically puts up a window with three +test from testgtk.c. It basically puts up a window with three range widgets all connected to the same adjustment, and a couple of controls for adjusting some of the parameters mentioned above and in the section on adjustments, so you can see how they affect the way @@ -3087,7 +3061,7 @@ these widgets work for the user. - + @@ -3389,7 +3363,7 @@ int main( int argc, -You will notice that the program does not call gtk_signal_connect +You will notice that the program does not call g_signal_connect() for the "delete_event", but only for the "destroy" signal. This will still perform the desired function, because an unhandled "delete_event" will result in a "destroy" signal being given to the @@ -3414,7 +3388,9 @@ EventBox widget or a Button widget. To create a new label, use: -GtkWidget *gtk_label_new( char *str ); +GtkWidget *gtk_label_new( const char *str ); + +GtkWidget *gtk_label_new_with_mnemonic( const char *str ); The sole argument is the string you wish the label to display. @@ -3422,8 +3398,8 @@ GtkWidget *gtk_label_new( char *str ); To change the label's text after creation, use the function: -void gtk_label_set_text( GtkLabel *label, - char *str ); +void gtk_label_set_text( GtkLabel *label, + const char *str ); The first argument is the label you created previously (cast @@ -3436,13 +3412,10 @@ the label string. To retrieve the current string, use: -void gtk_label_get( GtkLabel *label, - char **str ); +const gchar* gtk_label_get_text( GtkLabel *label ); -The first argument is the label you've created, and the second, -the return for the string. Do not free the return string, as it is -used internally by GTK. +Do not free the returned string, as it is used internally by GTK. The label text can be justified using: @@ -3483,14 +3456,24 @@ indicates that the corresponding character in the label should be underlined. For example, the string "__ __" would underline the first two characters and eight and ninth characters. +If you simply want to have an underlined accelerator ("mnemonic") +in your label, you should use gtk_label_new_with_mnemonic() or +gtk_label_set_text_with_mnemonic(), not gtk_label_set_pattern(). + + Below is a short example to illustrate these functions. This example makes use of the Frame widget to better demonstrate the label -styles. You can ignore this for now as the Frame widget is explained later on. +styles. You can ignore this for now as the Frame +widget is explained later on. + +In GTK+ 2.0, label texts can contain markup for font and other text attribute +changes, and labels may be selectable (for copy-and-paste). These advanced features +won't be explained here. - + @@ -3649,7 +3632,7 @@ point. The shadow_type argument may take one of these values: - + @@ -3740,7 +3723,7 @@ int main( int argc, These are the little text strings that pop up when you leave your pointer over a button or other widget for a few seconds. They are easy to use, so I will just explain them without giving an example. If you -want to see some code, take a look at the testgtk.c program +want to see some code, take a look at the testgtk.c program distributed with GTK. Widgets that do not receive events (widgets that do not have their @@ -3803,23 +3786,6 @@ void gtk_tooltips_disable( GtkTooltips *tooltips ); Disable an enabled set of tooltips. - -void gtk_tooltips_set_delay( GtkTooltips *tooltips, - gint delay ); - - -Sets how many milliseconds you have to hold your pointer over the -widget before the tooltip will pop up. The default is 500 -milliseconds (half a second). - - -void gtk_tooltips_set_colors( GtkTooltips *tooltips, - GdkColor *background, - GdkColor *foreground ); - - -Set the foreground and background color of the tooltips. - And that's all the functions associated with tooltips. More than you'll ever want to know :-) @@ -3833,32 +3799,15 @@ you'll ever want to know :-) pretty easy to use, as you will see with the code below. But first lets start out with the calls to create a new progress bar. -There are two ways to create a progress bar, one simple that takes -no arguments, and one that takes an Adjustment object as an -argument. If the former is used, the progress bar creates its own -adjustment object. - GtkWidget *gtk_progress_bar_new( void ); - -GtkWidget *gtk_progress_bar_new_with_adjustment( GtkAdjustment *adjustment ); - - -The second method has the advantage that we can use the adjustment -object to specify our own range parameters for the progress bar. - -The adjustment of a progress object can be changed dynamically using: - - -void gtk_progress_set_adjustment( GtkProgress *progress, - GtkAdjustment *adjustment ); Now that the progress bar has been created we can use it. -void gtk_progress_bar_update( GtkProgressBar *pbar, - gfloat percentage ); +void gtk_progress_bar_set_fraction ( GtkProgressBar *pbar, + gdouble fraction ); The first argument is the progress bar you wish to operate on, and the @@ -3888,155 +3837,51 @@ values to indicate the direction in which the progress bar moves: GTK_PROGRESS_TOP_TO_BOTTOM -When used as a measure of how far a process has progressed, the -ProgressBar can be set to display its value in either a continuous -or discrete mode. In continuous mode, the progress bar is updated for -each value. In discrete mode, the progress bar is updated in a number -of discrete blocks. The number of blocks is also configurable. - -The style of a progress bar can be set using the following function. - - -void gtk_progress_bar_set_bar_style( GtkProgressBar *pbar, - GtkProgressBarStyle style ); - - -The style parameter can take one of two values: - - - GTK_PROGRESS_CONTINUOUS - GTK_PROGRESS_DISCRETE - - -The number of discrete blocks can be set by calling - - -void gtk_progress_bar_set_discrete_blocks( GtkProgressBar *pbar, - guint blocks ); - - As well as indicating the amount of progress that has occured, the -progress bar may be set to just indicate that there is some -activity. This can be useful in situations where progress cannot be -measured against a value range. Activity mode is not effected by the -bar style that is described above, and overrides it. This mode is -either TRUE or FALSE, and is selected by the following function. +progress bar may be set to just indicate that there is some activity. +This can be useful in situations where progress cannot be measured against +a value range. To following function indicates that some progress has been +made. -void gtk_progress_set_activity_mode( GtkProgress *progress, - guint activity_mode ); +void gtk_progress_bar_pulse ( GtkProgressBar *progress ); -The step size of the activity indicator, and the number of blocks are -set using the following functions. +The step size of the activity indicator is set using the following +function. -void gtk_progress_bar_set_activity_step( GtkProgressBar *pbar, - guint step ); - -void gtk_progress_bar_set_activity_blocks( GtkProgressBar *pbar, - guint blocks ); +void gtk_progress_bar_set_pulse_step( GtkProgressBar *pbar, + gdouble fraction ); -When in continuous mode, the progress bar can also display a +When not in activity mode, the progress bar can also display a configurable text string within its trough, using the following function. -void gtk_progress_set_format_string( GtkProgress *progress, - gchar *format); +void gtk_progress_bar_set_text( GtkProgressBar *progress, + const gchar *text ); -The format argument is similiar to one that would be used in a C -printf statement. The following directives may be used within the -format string: +Note that gtk_progress_set_text() doesn't support the printf()-like formatting +of the GTK+ 1.2 Progressbar. - - %p - percentage - - %v - value - - %l - lower range value - - %u - upper range value - - +You can turn off the display of the string by calling gtk_progess_bar_set_text() +again with NULL as second argument. -The displaying of this text string can be toggled using: +The current text setting of a progressbar can be retrieved with the +following function. Do not free the returned string. -void gtk_progress_set_show_text( GtkProgress *progress, - gint show_text ); +const gchar *gtk_progress_bar_get_text( GtkProgressBar *pbar ); -The show_text argument is a boolean TRUE/FALSE value. The -appearance of the text can be modified further using: - - -void gtk_progress_set_text_alignment( GtkProgress *progress, - gfloat x_align, - gfloat y_align ); - - -The x_align and y_align arguments take values between 0.0 -and 1.0. Their values indicate the position of the text string within -the trough. Values of 0.0 for both would place the string in the top -left hand corner; values of 0.5 (the default) centres the text, and -values of 1.0 places the text in the lower right hand corner. - -The current text setting of a progress object can be retrieved using -the current or a specified adjustment value using the following two -functions. The character string returned by these functions should be -freed by the application (using the g_free() function). These -functions return the formatted string that would be displayed within -the trough. - - -gchar *gtk_progress_get_current_text( GtkProgress *progress ); - -gchar *gtk_progress_get_text_from_value( GtkProgress *progress, - gfloat value ); - - -There is yet another way to change the range and value of a progress -object using the following function: - - -void gtk_progress_configure( GtkProgress *progress, - gfloat value, - gfloat min, - gfloat max ); - - -This function provides quite a simple interface to the range and value -of a progress object. - -The remaining functions can be used to get and set the current value -of a progess object in various types and formats: - - -void gtk_progress_set_percentage( GtkProgress *progress, - gfloat percentage ); - -void gtk_progress_set_value( GtkProgress *progress, - gfloat value ); - -gfloat gtk_progress_get_value( GtkProgress *progress ); - -gfloat gtk_progress_get_current_percentage( GtkProgress *progress ); - -gfloat gtk_progress_get_percentage_from_value( GtkProgress *progress, - gfloat value ); - - -These functions are pretty self explanatory. The last function uses -the the adjustment of the specified progess object to compute the -percentage value of the given range value. - Progress Bars are usually used with timeouts or other such functions -(see section on Timeouts, I/O and Idle Functions) to give -the illusion of multitasking. All will employ the -gtk_progress_bar_update function in the same manner. +(see section on Timeouts, I/O and Idle Functions) +to give the illusion of multitasking. All will employ the +gtk_progress_bar_set_fraction() or gtk_progress_bar_pulse() functions in the +same manner. Here is an example of the progress bar, updated using timeouts. This code also shows you how to reset the Progress Bar. @@ -4044,7 +3889,7 @@ code also shows you how to reset the Progress Bar. - + @@ -4275,22 +4120,20 @@ top, which contains a separator and then an hbox called the "action_area". The Dialog widget can be used for pop-up messages to the user, and -other similar tasks. It is really basic, and there is only one -function for the dialog box, which is: +other similar tasks. There are two functions to create a new Dialog. GtkWidget *gtk_dialog_new( void ); - - -So to create a new dialog box, use, - - GtkWidget *window; - window = gtk_dialog_new (); +GtkWidget *gtk_dialog_new_with_buttons( const gchar *title, + GtkWindow *parent, + GtkDialogFlags flags, + const gchar *first_button_text, + ... ); -This will create the dialog box, and it is now up to you to use it. -You could pack a button in the action_area by doing something like this: +The first function will create an empty dialog, and it is now up to you to use + it. You could pack a button in the action_area by doing something like this: button = ... @@ -4321,462 +4164,26 @@ your application, then you can simply pack another layout widget into the boxes provided. For example, you could pack a table into the vertical box. - - - - -Pixmaps - -Pixmaps are data structures that contain pictures. These pictures can -be used in various places, but most commonly as icons on the X -desktop, or as cursors. - -A pixmap which only has 2 colors is called a bitmap, and there are a -few additional routines for handling this common special case. - -To understand pixmaps, it would help to understand how X window -system works. Under X, applications do not need to be running on the -same computer that is interacting with the user. Instead, the various -applications, called "clients", all communicate with a program which -displays the graphics and handles the keyboard and mouse. This -program which interacts directly with the user is called a "display -server" or "X server." Since the communication might take place over -a network, it's important to keep some information with the X server. -Pixmaps, for example, are stored in the memory of the X server. This -means that once pixmap values are set, they don't need to keep getting -transmitted over the network; instead a command is sent to "display -pixmap number XYZ here." Even if you aren't using X with GTK -currently, using constructs such as Pixmaps will make your programs -work acceptably under X. - -To use pixmaps in GTK, we must first build a GdkPixmap structure using -routines from the GDK layer. Pixmaps can either be created from -in-memory data, or from data read from a file. We'll go through each -of the calls to create a pixmap. - - -GdkPixmap *gdk_bitmap_create_from_data( GdkWindow *window, - gchar *data, - gint width, - gint height ); - - -This routine is used to create a single-plane pixmap (2 colors) from -data in memory. Each bit of the data represents whether that pixel is -off or on. Width and height are in pixels. The GdkWindow pointer is to -the current window, since a pixmap's resources are meaningful only in -the context of the screen where it is to be displayed. - - -GdkPixmap *gdk_pixmap_create_from_data( GdkWindow *window, - gchar *data, - gint width, - gint height, - gint depth, - GdkColor *fg, - GdkColor *bg ); - - -This is used to create a pixmap of the given depth (number of colors) from -the bitmap data specified. fg and bg are the foreground and -background color to use. - - -GdkPixmap *gdk_pixmap_create_from_xpm( GdkWindow *window, - GdkBitmap **mask, - GdkColor *transparent_color, - const gchar *filename ); - - -XPM format is a readable pixmap representation for the X Window -System. It is widely used and many different utilities are available -for creating image files in this format. The file specified by -filename must contain an image in that format and it is loaded into -the pixmap structure. The mask specifies which bits of the pixmap are -opaque. All other bits are colored using the color specified by -transparent_color. An example using this follows below. - - -GdkPixmap *gdk_pixmap_create_from_xpm_d( GdkWindow *window, - GdkBitmap **mask, - GdkColor *transparent_color, - gchar **data ); - - -Small images can be incorporated into a program as data in the XPM -format. A pixmap is created using this data, instead of reading it -from a file. An example of such data is - - -/* XPM */ -static const char * xpm_data[] = { -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ...... ", -" .XXX.X. ", -" .XXX.XX. ", -" .XXX.XXX. ", -" .XXX..... ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" ......... ", -" ", -" "}; - - -When we're done using a pixmap and not likely to reuse it again soon, -it is a good idea to release the resource using -gdk_pixmap_unref(). Pixmaps should be considered a precious resource, -because they take up memory in the end-user's X server process. Even -though the X client you write may run on a powerful "server" computer, -the user may be running the X server on a small personal computer. - -Once we've created a pixmap, we can display it as a GTK widget. We -must create a GTK pixmap widget to contain the GDK pixmap. This is -done using - - -GtkWidget *gtk_pixmap_new( GdkPixmap *pixmap, - GdkBitmap *mask ); - - -The other pixmap widget calls are - - -guint gtk_pixmap_get_type( void ); - -void gtk_pixmap_set( GtkPixmap *pixmap, - GdkPixmap *val, - GdkBitmap *mask ); - -void gtk_pixmap_get( GtkPixmap *pixmap, - GdkPixmap **val, - GdkBitmap **mask); - - -gtk_pixmap_set is used to change the pixmap that the widget is currently -managing. Val is the pixmap created using GDK. - -The following is an example of using a pixmap in a button. - - - - -#include <gtk/gtk.h> - - -/* XPM data of Open-File icon */ -static const char * xpm_data[] = { -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ...... ", -" .XXX.X. ", -" .XXX.XX. ", -" .XXX.XXX. ", -" .XXX..... ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" ......... ", -" ", -" "}; - - -/* when invoked (via signal delete_event), terminates the application. - */ -gint close_application( GtkWidget *widget, - GdkEvent *event, - gpointer data ) -{ - gtk_main_quit (); - return FALSE; -} - - -/* is invoked when the button is clicked. It just prints a message. - */ -void button_clicked( GtkWidget *widget, - gpointer data ) { - g_print ("button clicked\n"); -} - -int main( int argc, - char *argv[] ) -{ - /* GtkWidget is the storage type for widgets */ - GtkWidget *window, *pixmapwid, *button; - GdkPixmap *pixmap; - GdkBitmap *mask; - GtkStyle *style; - - /* create the main window, and attach delete_event signal to terminating - the application */ - gtk_init (&argc, &argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_signal_connect (G_OBJECT (window), "delete_event", - G_CALLBACK (close_application), NULL); - gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_widget_show (window); - - /* now for the pixmap from gdk */ - style = gtk_widget_get_style (window); - pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask, - &style->bg[GTK_STATE_NORMAL], - (gchar **)xpm_data); - - /* a pixmap widget to contain the pixmap */ - pixmapwid = gtk_pixmap_new (pixmap, mask); - gtk_widget_show (pixmapwid); - - /* a button to contain the pixmap widget */ - button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), pixmapwid); - gtk_container_add (GTK_CONTAINER (window), button); - gtk_widget_show (button); - - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (button_clicked), NULL); - - /* show the window */ - gtk_main (); - - return 0; -} - - - -To load a file from an XPM data file called icon0.xpm in the current -directory, we would have created the pixmap thus - - - /* load a pixmap from a file */ - pixmap = gdk_pixmap_create_from_xpm( window->window, &mask, - &style->bg[GTK_STATE_NORMAL], - "./icon0.xpm" ); - pixmapwid = gtk_pixmap_new( pixmap, mask ); - gtk_widget_show( pixmapwid ); - gtk_container_add( GTK_CONTAINER(window), pixmapwid ); - - -A disadvantage of using pixmaps is that the displayed object is always -rectangular, regardless of the image. We would like to create desktops -and applications with icons that have more natural shapes. For -example, for a game interface, we would like to have round buttons to -push. The way to do this is using shaped windows. - -A shaped window is simply a pixmap where the background pixels are -transparent. This way, when the background image is multi-colored, we -don't overwrite it with a rectangular, non-matching border around our -icon. The following example displays a full wheelbarrow image on the -desktop. - - - - -#include <gtk/gtk.h> - -/* XPM */ -static char * WheelbarrowFull_xpm[] = { -"48 48 64 1", -" c None", -". c #DF7DCF3CC71B", -"X c #965875D669A6", -"o c #71C671C671C6", -"O c #A699A289A699", -"+ c #965892489658", -"@ c #8E38410330C2", -"# c #D75C7DF769A6", -"$ c #F7DECF3CC71B", -"% c #96588A288E38", -"& c #A69992489E79", -"* c #8E3886178E38", -"= c #104008200820", -"- c #596510401040", -"; c #C71B30C230C2", -": c #C71B9A699658", -"> c #618561856185", -", c #20811C712081", -"< c #104000000000", -"1 c #861720812081", -"2 c #DF7D4D344103", -"3 c #79E769A671C6", -"4 c #861782078617", -"5 c #41033CF34103", -"6 c #000000000000", -"7 c #49241C711040", -"8 c #492445144924", -"9 c #082008200820", -"0 c #69A618611861", -"q c #B6DA71C65144", -"w c #410330C238E3", -"e c #CF3CBAEAB6DA", -"r c #71C6451430C2", -"t c #EFBEDB6CD75C", -"y c #28A208200820", -"u c #186110401040", -"i c #596528A21861", -"p c #71C661855965", -"a c #A69996589658", -"s c #30C228A230C2", -"d c #BEFBA289AEBA", -"f c #596545145144", -"g c #30C230C230C2", -"h c #8E3882078617", -"j c #208118612081", -"k c #38E30C300820", -"l c #30C2208128A2", -"z c #38E328A238E3", -"x c #514438E34924", -"c c #618555555965", -"v c #30C2208130C2", -"b c #38E328A230C2", -"n c #28A228A228A2", -"m c #41032CB228A2", -"M c #104010401040", -"N c #492438E34103", -"B c #28A2208128A2", -"V c #A699596538E3", -"C c #30C21C711040", -"Z c #30C218611040", -"A c #965865955965", -"S c #618534D32081", -"D c #38E31C711040", -"F c #082000000820", -" ", -" .XoO ", -" +@#$%o& ", -" *=-;#::o+ ", -" >,<12#:34 ", -" 45671#:X3 ", -" +89<02qwo ", -"e* >,67;ro ", -"ty> 459@>+&& ", -"$2u+ ><ipas8* ", -"%$;=* *3:.Xa.dfg> ", -"Oh$;ya *3d.a8j,Xe.d3g8+ ", -" Oh$;ka *3d$a8lz,,xxc:.e3g54 ", -" Oh$;kO *pd$%svbzz,sxxxxfX..&wn> ", -" Oh$@mO *3dthwlsslszjzxxxxxxx3:td8M4 ", -" Oh$@g& *3d$XNlvvvlllm,mNwxxxxxxxfa.:,B* ", -" Oh$@,Od.czlllllzlmmqV@V#V@fxxxxxxxf:%j5& ", -" Oh$1hd5lllslllCCZrV#r#:#2AxxxxxxxxxcdwM* ", -" OXq6c.%8vvvllZZiqqApA:mq:Xxcpcxxxxxfdc9* ", -" 2r<6gde3bllZZrVi7S@SV77A::qApxxxxxxfdcM ", -" :,q-6MN.dfmZZrrSS:#riirDSAX@Af5xxxxxfevo", -" +A26jguXtAZZZC7iDiCCrVVii7Cmmmxxxxxx%3g", -" *#16jszN..3DZZZZrCVSA2rZrV7Dmmwxxxx&en", -" p2yFvzssXe:fCZZCiiD7iiZDiDSSZwwxx8e*>", -" OA1<jzxwwc:$d%NDZZZZCCCZCCZZCmxxfd.B ", -" 3206Bwxxszx%et.eaAp77m77mmmf3&eeeg* ", -" @26MvzxNzvlbwfpdettttttttttt.c,n& ", -" *;16=lsNwwNwgsvslbwwvccc3pcfu<o ", -" p;<69BvwwsszslllbBlllllllu<5+ ", -" OS0y6FBlvvvzvzss,u=Blllj=54 ", -" c1-699Blvlllllu7k96MMMg4 ", -" *10y8n6FjvllllB<166668 ", -" S-kg+>666<M<996-y6n<8* ", -" p71=4 m69996kD8Z-66698&& ", -" &i0ycm6n4 ogk17,0<6666g ", -" N-k-<> >=01-kuu666> ", -" ,6ky& &46-10ul,66, ", -" Ou0<> o66y<ulw<66& ", -" *kk5 >66By7=xu664 ", -" <<M4 466lj<Mxu66o ", -" *>> +66uv,zN666* ", -" 566,xxj669 ", -" 4666FF666> ", -" >966666M ", -" oM6668+ ", -" *4 ", -" ", -" "}; - - -/* When invoked (via signal delete_event), terminates the application */ -gint close_application( GtkWidget *widget, - GdkEvent *event, - gpointer data ) -{ - gtk_main_quit(); - return(FALSE); -} - -int main (int argc, - char *argv[] ) -{ - /* GtkWidget is the storage type for widgets */ - GtkWidget *window, *pixmap, *fixed; - GdkPixmap *gdk_pixmap; - GdkBitmap *mask; - GtkStyle *style; - GdkGC *gc; - - /* Create the main window, and attach delete_event signal to terminate - * the application. Note that the main window will not have a titlebar - * since we're making it a popup. */ - gtk_init (&argc, &argv); - window = gtk_window_new (GTK_WINDOW_POPUP); - g_signal_connect (G_OBJECT (window), "delete_event", - G_CALLBACK (close_application), NULL); - gtk_widget_show (window); - - /* Now for the pixmap and the pixmap widget */ - style = gtk_widget_get_default_style(); - gc = style->black_gc; - gdk_pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask, - &style->bg[GTK_STATE_NORMAL], - WheelbarrowFull_xpm); - pixmap = gtk_image_new_from_pixmap (gdk_pixmap, mask); - gtk_widget_show (pixmap); - - /* To display the pixmap, we use a fixed widget to place the pixmap */ - fixed = gtk_fixed_new (); - gtk_widget_set_size_request (fixed, 200, 200); - gtk_fixed_put (GTK_FIXED (fixed), pixmap, 0, 0); - gtk_container_add (GTK_CONTAINER (window), fixed); - gtk_widget_show (fixed); - - /* This masks out everything except for the image itself */ - gtk_widget_shape_combine_mask (window, mask, 0, 0); - - /* show the window */ - gtk_widget_show (window); - gtk_main (); - - return 0; -} - - - -To make the wheelbarrow image sensitive, we could attach the button -press event signal to make it do something. The following few lines -would make the picture sensitive to a mouse button being pressed which -makes the application terminate. - - - gtk_widget_set_events( window, - gtk_widget_get_events( window ) | - GDK_BUTTON_PRESS_MASK ); - - gtk_signal_connect( GTK_OBJECT(window), "button_press_event", - GTK_SIGNAL_FUNC(close_application), NULL ); - +The more complicated _new_with_buttons() variant allows to set one or +more of the following flags. + + +GTK_DIALOG_MODAL +make the dialog modal. + + + +GTK_DIALOG_DESTROY_WITH_PARENTS +ensures that the dialog window is destroyed together with the specified +parent. + + +GTK_DIALOG_NO_SEPARATOR +omits the separator between the vbox and the action_area. + + + @@ -4819,10 +4226,10 @@ are set for a ruler using void gtk_ruler_set_range( GtkRuler *ruler, - gfloat lower, - gfloat upper, - gfloat position, - gfloat max_size ); + gdouble lower, + gdouble upper, + gdouble position, + gdouble max_size ); The lower and upper arguments define the extent of the ruler, and @@ -4853,9 +4260,9 @@ To follow all mouse movements within a window area, we would use #define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x - gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", - (GtkSignalFunc)EVENT_METHOD(ruler, motion_notify_event), - GTK_OBJECT(ruler) ); + g_signal_connect_swapped (G_OBJECT (area), "motion_notify_event", + G_CALLBACK (EVENT_METHOD (ruler, motion_notify_event)), + G_OBJECT (ruler)); The following example creates a drawing area with a horizontal ruler @@ -4868,7 +4275,7 @@ Placement of the drawing area and the rulers is done using a table. - + @@ -4989,7 +4396,7 @@ guint gtk_statusbar_get_context_id( GtkStatusbar *statusbar, guint gtk_statusbar_push( GtkStatusbar *statusbar, guint context_id, - gchar *text ); + const gchar *text ); void gtk_statusbar_pop( GtkStatusbar *statusbar) guint context_id ); @@ -4999,14 +4406,26 @@ void gtk_statusbar_remove( GtkStatusbar *statusbar, guint message_id ); -The first, gtk_statusbar_push, is used to add a new message to the +The first, gtk_statusbar_push(), is used to add a new message to the statusbar. It returns a Message Identifier, which can be passed later to the function gtk_statusbar_remove to remove the message with the given Message and Context Identifiers from the statusbar's stack. -The function gtk_statusbar_pop removes the message highest in the +The function gtk_statusbar_pop() removes the message highest in the stack with the given Context Identifier. +In addition to messages, statusbars may also display a resize grip, which +can be dragged with the mouse to resize the toplevel window containing the statusbar, +similar to dragging the window frame. The following functions control the display +of the resize grip. + + +void gtk_statusbar_set_has_resize_grip( GtkStatusbar *statusbar, + gboolean setting ); + +gboolean gtk_statusbar_get_has_resize_grip( GtkStatusbar *statusbar ); + + The following example creates a statusbar and two buttons, one for pushing items onto the statusbar, and one for popping the last item back off. @@ -5014,7 +4433,7 @@ back off. - + @@ -5110,59 +4529,42 @@ int main( int argc, text box. The text may be set with function calls that allow new text to replace, prepend or append the current contents of the Entry widget. -There are two functions for creating Entry widgets: +Create a new Entry widget with the following function. GtkWidget *gtk_entry_new( void ); - -GtkWidget *gtk_entry_new_with_max_length( guint16 max ); -The first just creates a new Entry widget, whilst the second creates a -new Entry and sets a limit on the length of the text within the Entry. - -There are several functions for altering the text which is currently +The next function alters the text which is currently within the Entry widget. void gtk_entry_set_text( GtkEntry *entry, const gchar *text ); - -void gtk_entry_append_text( GtkEntry *entry, - const gchar *text ); - -void gtk_entry_prepend_text( GtkEntry *entry, - const gchar *text ); -The function gtk_entry_set_text sets the contents of the Entry widget, -replacing the current contents. The functions gtk_entry_append_text -and gtk_entry_prepend_text allow the current contents to be appended -and prepended to. - -The next function allows the current insertion point to be set. - - -void gtk_entry_set_position( GtkEntry *entry, - gint position ); - +The function gtk_entry_set_text() sets the contents of the Entry widget, +replacing the current contents. Note that the class Entry implements the Editable +interface (yes, gobject supports Java-like interfaces) which contains some more +functions for manipulating the contents. + The contents of the Entry can be retrieved by using a call to the following function. This is useful in the callback functions described below. -gchar *gtk_entry_get_text( GtkEntry *entry ); +const gchar *gtk_entry_get_text( GtkEntry *entry ); The value returned by this function is used internally, and must not -be freed using either free() or g_free() +be freed using either free() or g_free(). If we don't want the contents of the Entry to be changed by someone typing into it, we can change its editable state. -void gtk_entry_set_editable( GtkEntry *entry, - gboolean editable ); +void gtk_editable_set_editable( GtkEditable *entry, + gboolean editable ); The function above allows us to toggle the editable state of the @@ -5183,9 +4585,9 @@ function. This would most often be used after setting some default text in an Entry, making it easy for the user to remove it. -void gtk_entry_select_region( GtkEntry *entry, - gint start, - gint end ); +void gtk_editable_select_region( GtkEditable *entry, + gint start, + gint end ); If we want to catch when the user has entered text, we can connect to @@ -5199,7 +4601,7 @@ removed. - + @@ -5336,12 +4738,12 @@ button can take. This makes for a powerful Spin Button widget. function, which illustrates the information that it holds: -GtkObject *gtk_adjustment_new( gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - gfloat page_size ); +GtkObject *gtk_adjustment_new( gdouble value, + gdouble lower, + gdouble upper, + gdouble step_increment, + gdouble page_increment, + gdouble page_size ); These attributes of an Adjustment are used by the Spin Button in the @@ -5370,7 +4772,7 @@ buttons. Lets look at how to create a Spin Button: GtkWidget *gtk_spin_button_new( GtkAdjustment *adjustment, - gfloat climb_rate, + gdouble climb_rate, guint digits ); @@ -5385,7 +4787,7 @@ function: void gtk_spin_button_configure( GtkSpinButton *spin_button, GtkAdjustment *adjustment, - gfloat climb_rate, + gdouble climb_rate, guint digits ); @@ -5414,25 +4816,25 @@ using the following function: void gtk_spin_button_set_value( GtkSpinButton *spin_button, - gfloat value ); + gdouble value ); The current value of a Spin Button can be retrieved as either a floating point or integer value with the following functions: -gfloat gtk_spin_button_get_value_as_float( GtkSpinButton *spin_button ); +gdouble gtk_spin_button_get_value ( GtkSpinButton *spin_button ); gint gtk_spin_button_get_value_as_int( GtkSpinButton *spin_button ); -If you want to alter the value of a Spin Value relative to its current +If you want to alter the value of a Spin Button relative to its current value, then the following function can be used: void gtk_spin_button_spin( GtkSpinButton *spin_button, GtkSpinType direction, - gfloat increment ); + gdouble increment ); The direction parameter can take one of the following values: @@ -5508,8 +4910,6 @@ void gtk_spin_button_set_update_policy( GtkSpinButton *spin_button, GtkSpinButtonUpdatePolicy policy ); - - The possible values of policy are either GTK_UPDATE_ALWAYS or GTK_UPDATE_IF_VALID. @@ -5525,23 +4925,6 @@ current value. In case of GTK_UPDATE_ALWAYS we ignore errors while converting text into a numeric value. -The appearance of the buttons used in a Spin Button can be changed -using the following function: - - -void gtk_spin_button_set_shadow_type( GtkSpinButton *spin_button, - GtkShadowType shadow_type ); - - -As usual, the shadow_type can be one of: - - - GTK_SHADOW_IN - GTK_SHADOW_OUT - GTK_SHADOW_ETCHED_IN - GTK_SHADOW_ETCHED_OUT - - Finally, you can explicitly request that a Spin Button update itself: @@ -5553,7 +4936,7 @@ void gtk_spin_button_update( GtkSpinButton *spin_button ); - + @@ -5822,7 +5205,7 @@ GtkWidget *gtk_combo_new( void ); box, this is done by manipulating the entry widget directly: - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), "My String."); + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), "My String."); To set the values in the popdown list, one uses the function: @@ -5834,7 +5217,7 @@ void gtk_combo_set_popdown_strings( GtkCombo *combo, Before you can do this, you have to assemble a GList of the strings that you want. GList is a linked list implementation that is part of -GLib, a library supporing GTK. For the +GLib, a library supporting GTK. For the moment, the quick and dirty explanation is that you need to set up a GList pointer, set it equal to NULL, then append strings to it with @@ -5844,20 +5227,20 @@ GList *g_list_append( GList *glist, It is important that you set the initial GList pointer to NULL. The -value returned from the g_list_append function must be used as the new +value returned from the g_list_append() function must be used as the new pointer to the GList. Here's a typical code segment for creating a set of options: - GList *glist=NULL; + GList *glist = NULL; - glist = g_list_append(glist, "String 1"); - glist = g_list_append(glist, "String 2"); - glist = g_list_append(glist, "String 3"); - glist = g_list_append(glist, "String 4"); + glist = g_list_append (glist, "String 1"); + glist = g_list_append (glist, "String 2"); + glist = g_list_append (glist, "String 3"); + glist = g_list_append (glist, "String 4"); - gtk_combo_set_popdown_strings( GTK_COMBO(combo), glist) ; + gtk_combo_set_popdown_strings (GTK_COMBO (combo), glist); /* can free glist now, combo takes a copy */ @@ -5872,16 +5255,16 @@ are accomplished with the functions: void gtk_combo_set_use_arrows( GtkCombo *combo, - gint val ); + gboolean val ); void gtk_combo_set_use_arrows_always( GtkCombo *combo, - gint val ); + gboolean val ); void gtk_combo_set_case_sensitive( GtkCombo *combo, - gint val ); + gboolean val ); -gtk_combo_set_use_arrows() lets the user change the value in the +gtk_combo_set_use_arrows() lets the user change the value in the entry using the up/down arrow keys. This doesn't bring up the list, but rather replaces the current text in the entry with the next list entry (up or down, as your key choice indicates). It does this by searching @@ -5893,14 +5276,14 @@ and you press arrow-down it changes the focus (the same applies with the first item and arrow-up). If the current value in the entry is not in the list, then the -function of gtk_combo_set_use_arrows() is disabled. +function of gtk_combo_set_use_arrows() is disabled. -gtk_combo_set_use_arrows_always() similarly allows the use the +gtk_combo_set_use_arrows_always() similarly allows the use the the up/down arrow keys to cycle through the choices in the dropdown list, except that it wraps around the values in the list, completely disabling the use of the up and down arrow keys for changing focus. -gtk_combo_set_case_sensitive() toggles whether or not GTK +gtk_combo_set_case_sensitive() toggles whether or not GTK searches for entries in a case sensitive manner. This is used when the Combo widget is asked to find a value from the list using the current entry in the text box. This completion can be performed in either a @@ -5915,36 +5298,36 @@ will override its use within GTK. all that remains is being able to get data from the combo box. This is relatively straightforward. The majority of the time, all you are going to care about getting data from is the entry. The entry is -accessed simply by GTK_ENTRY(GTK_COMBO(combo)->entry). The +accessed simply by GTK_ENTRY (GTK_COMBO (combo)->entry). The two principal things that you are going to want to do with it are -attach to the activate signal, which indicates that the user has +connect to the activate signal, which indicates that the user has pressed the Return or Enter key, and read the text. The first is accomplished using something like: - gtk_signal_connect(GTK_OBJECT(GTK_COMB(combo)->entry), "activate", - GTK_SIGNAL_FUNC (my_callback_function), my_data); + g_signal_connect (G_OBJECT (GTK_COMBO (combo)->entry), "activate", + G_CALLBACK (my_callback_function), my_data); Getting the text at any arbitrary time is accomplished by simply using the entry function: -gchar *gtk_entry_get_text(GtkEntry *entry); +gchar *gtk_entry_get_text( GtkEntry *entry ); Such as: - char *string; + gchar *string; - string = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)); + string = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (combo)->entry)); That's about all there is to it. There is a function -void gtk_combo_disable_activate(GtkCombo *combo); +void gtk_combo_disable_activate( GtkCombo *combo ); that will disable the activate signal on the entry widget in the combo @@ -5970,7 +5353,7 @@ and work with. Creating a GtkCalendar widget is a simple as: -GtkWidget *gtk_calendar_new(); +GtkWidget *gtk_calendar_new( void ); There might be times where you need to change a lot of information @@ -5981,7 +5364,7 @@ on-screen updates. void gtk_calendar_freeze( GtkCalendar *Calendar ); -void gtk_calendar_thaw ( GtkCalendar *Calendar ); +void gtk_calendar_thaw( GtkCalendar *Calendar ); They work just like the freeze/thaw functions of every other @@ -5998,34 +5381,44 @@ void gtk_calendar_display_options( GtkCalendar *calendar, The flags argument can be formed by combining either of the following five options using the logical bitwise OR (|) operation: - - GTK_CALENDAR_SHOW_HEADING - this option specifies that -the month and year should be shown when drawing the calendar. + + +GTK_CALENDAR_SHOW_HEADING +this option specifies that the month and year should be shown +when drawing the calendar. - - GTK_CALENDAR_SHOW_DAY_NAMES - this option specifies that the -three letter descriptions should be displayed for each day (eg -Mon,Tue, etc.). + + +GTK_CALENDAR_SHOW_DAY_NAMES +this option specifies that the three letter descriptions should +be displayed for each day (eg Mon,Tue, etc.). - - GTK_CALENDAR_NO_MONTH_CHANGE - this option states that the user + + +GTK_CALENDAR_NO_MONTH_CHANGE +this option states that the user should not and can not change the currently displayed month. This can be good if you only need to display a particular month such as if you are displaying 12 calendar widgets for every month in a particular -year. +year. - - GTK_CALENDAR_SHOW_WEEK_NUMBERS - this option specifies that the + + +GTK_CALENDAR_SHOW_WEEK_NUMBERS +this option specifies that the number for each week should be displayed down the left side of the -calendar. (eg. Jan 1 = Week 1,Dec 31 = Week 52). +calendar. (eg. Jan 1 = Week 1,Dec 31 = Week 52). - - GTK_CALENDAR_WEEK_START_MONDAY - this option states that the + + +GTK_CALENDAR_WEEK_START_MONDAY +this option states that the calander week will start on Monday instead of Sunday which is the default. This only affects the order in which days are displayed from -left to right. +left to right. - + + The following functions are used to set the the currently displayed date: @@ -6069,7 +5462,7 @@ elements are numbered 0 to n-1). For example: GtkCalendar *calendar; - calendar = gtk_calendar_new(); + calendar = gtk_calendar_new (); ... @@ -6121,7 +5514,7 @@ example code. - + @@ -6573,8 +5966,8 @@ widget changes, either when the user changes it or if it's set explicitly through gtk_color_selection_set_color(). Lets have a look at what the color selection widget has to offer -us. The widget comes in two flavours: gtk_color_selection and -gtk_color_selection_dialog. +us. The widget comes in two flavours: GtkColorSelection and +GtkColorSelectionDialog. GtkWidget *gtk_color_selection_new( void ); @@ -6595,53 +5988,43 @@ ColorSelection widget, an HSeparator and an HBox with three buttons, "Ok", "Cancel" and "Help". You can reach these buttons by accessing the "ok_button", "cancel_button" and "help_button" widgets in the ColorSelectionDialog structure, -(i.e., GTK_COLOR_SELECTION_DIALOG(colorseldialog)->ok_button)). - - -void gtk_color_selection_set_update_policy( GtkColorSelection *colorsel, - GtkUpdateType policy ); - - -This function sets the update policy. The default policy is -GTK_UPDATE_CONTINUOUS which means that the current color is -updated continuously when the user drags the sliders or presses the -mouse and drags in the hue-saturation wheel or value bar. If you -experience performance problems, you may want to set the policy to -GTK_UPDATE_DISCONTINUOUS or GTK_UPDATE_DELAYED. +(i.e., GTK_COLOR_SELECTION_DIALOG (colorseldialog)->ok_button)). -void gtk_color_selection_set_opacity( GtkColorSelection *colorsel, - gint use_opacity ); +void gtk_color_selection_set_has_opacity_control( GtkColorSelection *colorsel, + gboolean has_opacity ); The color selection widget supports adjusting the opacity of a color (also known as the alpha channel). This is disabled by -default. Calling this function with use_opacity set to TRUE enables -opacity. Likewise, use_opacity set to FALSE will disable opacity. +default. Calling this function with has_opacity set to TRUE enables +opacity. Likewise, has_opacity set to FALSE will disable opacity. -void gtk_color_selection_set_color( GtkColorSelection *colorsel, - gdouble *color ); +void gtk_color_selection_set_current_color( GtkColorSelection *colorsel, + GdkColor *color ); + +void gtk_color_selection_set_current_alpha( GtkColorSelection *colorsel, + guint16 alpha ); -You can set the current color explicitly by calling this function with -a pointer to an array of colors (gdouble). The length of the array -depends on whether opacity is enabled or not. Position 0 contains the -red component, 1 is green, 2 is blue and opacity is at position 3 -(only if opacity is enabled, see -gtk_color_selection_set_opacity()). All values are between 0.0 and -1.0. +You can set the current color explicitly by calling +gtk_color_selection_set_current_color() with a pointer to a GdkColor. +Setting the opacity (alpha channel) is done with +gtk_color_selection_set_current_alpha(). The alpha value should be between +0 (fully transparent) and 65636 (fully opaque). + -void gtk_color_selection_get_color( GtkColorSelection *colorsel, - gdouble *color ); +void gtk_color_selection_get_current_color( GtkColorSelection *colorsel, + GdkColor *color ); + +void gtk_color_selection_get_current_alpha( GtkColorSelection *colorsel, + guint16 *alpha ); When you need to query the current color, typically when you've -received a "color_changed" signal, you use this function. Color is a -pointer to the array of colors to fill in. See the -gtk_color_selection_set_color() function for the description of this -array. +received a "color_changed" signal, you use these functions. + Managing Selections @@ -11457,7 +10688,7 @@ depressed. - + @@ -11984,7 +11215,7 @@ set the value. - + @@ -12912,7 +12143,7 @@ pressure and tilt, from such devices quite easy. - + diff --git a/docs/tutorial/images/buttons.png b/docs/tutorial/images/buttons.png index edd6422f37..24e85cfbd6 100644 Binary files a/docs/tutorial/images/buttons.png and b/docs/tutorial/images/buttons.png differ -- cgit v1.2.1