GTK+ utilities — Assorted macros and backward compatible fallbacks
GdkWindow * gtk_widget_get_window (GtkWidget *widget); void adg_gtk_window_hide_here (GtkWindow *window); void adg_gtk_toggle_button_sensitivize (GtkToggleButton *toggle_button, GtkWidget *widget); void adg_canvas_set_paper (AdgCanvas *canvas, const gchar *paper_name, GtkPageOrientation orientation); void adg_canvas_set_page_setup (AdgCanvas *canvas, GtkPageSetup *page_setup);
GdkWindow * gtk_widget_get_window (GtkWidget *widget);
Returns the widget's window if it is realized, NULL otherwise. This is an API fallback for GTK+ prior to 2.14.
|
|
a GtkWidget |
|
Returns : |
widget's window.
|
void adg_gtk_window_hide_here (GtkWindow *window);
A convenient function that hides window and tries to store the
current position. Any subsequent call to gtk_widget_show() will
hopefully reopen the window at the same position.
It can be used instead of gtk_widget_hide() or by connecting it to a "response" signal, for instance:
g_signal_connect(dialog, "response",
G_CALLBACK(adg_gtk_window_hide_here), NULL);
|
|
a GtkWindow |
void adg_gtk_toggle_button_sensitivize (GtkToggleButton *toggle_button,
GtkWidget *widget);
Assigns the value of the "active" property of
toggle_button to the "sensitive" property of widget.
Useful to set or reset the sensitiveness of widget depending
of the state of a check button, for example:
g_signal_connect(toggle_button, "toggled",
G_CALLBACK(adg_gtk_toggle_button_sensitivize), widget1);
g_signal_connect(toggle_button, "toggled",
G_CALLBACK(adg_gtk_toggle_button_sensitivize), widget2);
g_signal_connect(toggle_button, "toggled",
G_CALLBACK(adg_gtk_toggle_button_sensitivize), widget3);
|
|
a GtkToggleButton |
|
|
the GtkWidget |
void adg_canvas_set_paper (AdgCanvas *canvas, const gchar *paper_name, GtkPageOrientation orientation);
A convenient function to set the size of canvas using a
paper_name and an orientation value. This should be a
PWG 5101.1-2002 paper name and it will be passed as is to
gtk_paper_size_new(), so use any valid name accepted by
that function.
To reset this size, you could use adg_canvas_set_size() with a
NULL size: in this way the size will match the boundary boxes
of the entities contained by the canvas.
Furthermore, the margins will be set to their default values, that is the margins returned by the GtkPaperSize API. If you want to use your own margins on a named paper size, set them after the call to this function.
|
|
an AdgCanvas |
|
|
a paper name |
|
|
the page orientation |
void adg_canvas_set_page_setup (AdgCanvas *canvas, GtkPageSetup *page_setup);
A convenient function to setup the page of canvas so it can
also be subsequentially used for printing. It is allowed to
pass NULL for page_setup to unset the setup data from canvas.
A reference to page_setup is added, so there is no need to keep
alive this object outside this function. The page_setup pointer
is stored in the associative key _adg_page_setup and can be
retrieved at any time with:
page_setup = g_object_get_data(G_OBJECT(canvas), "_adg_page_setup");
The size and margins provided by page_setup are used to set the
size and margins of canvas much in the same way as what
adg_canvas_set_paper() does. This means if you set a page and
then unset it, the canvas will retain size and margins of the
original page although page_setup will not be used for printing.
You must unset the size with adg_canvas_set_size() with a NULL size.
// By default, canvas does not have an explicit size adg_canvas_set_page_setup(canvas, a4); // Here canvas has the size and margins specified by a4 adg_canvas_set_page_setup(canvas, NULL); // Now the only difference is that canvas is no more bound // to the a4 page setup, so the following will return NULL: page_setup = g_object_get_data(G_OBJECT(canvas), "_adg_page_setup"); // To restore the original status and have an autocomputed size: adg_canvas_set_size(canvas, NULL);
|
|
an AdgCanvas |
|
|
the page setup |
GTK+ utilitieswas last modified by gtk-doc on Sat 24 Jul 2010 09:35:29 AM CEST