diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-06-24 15:34:48 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-06-24 15:34:48 +0000 |
commit | cc223eeff6d60f1b4ab77b09d3d6cdede6372916 (patch) | |
tree | 14c6426d96a95a70756dce3dd7154b9aeda15616 | |
parent | 5a5580a8e77dda9b7746012405f8e813a0e6c87b (diff) | |
download | gtk+-cc223eeff6d60f1b4ab77b09d3d6cdede6372916.tar.gz |
Fix stupid error introduced last night that was making things decidedly
Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error
introduced last night that was making things decidedly not work.
* gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters
so that we have getter/setter pairing everywhere it makes
sense. (#55767)
* gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.:
Rename gtk_radio_button_group to gtk_radio_button_get_group, add a
deprecated compat macro. (#55516)
* gtk/gtklabel.[ch]: Add functions
gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(),
gtk_label_set_label(), which mirror the property API for GtkLabel.
Make gtk_label_get_attributes() only reflect the attributes
set by gtk_label_set_attributes.
* gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename
from gtk_notebook_set_page().
75 files changed, 2054 insertions, 125 deletions
@@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 4681cf051c..d822f272db 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4681cf051c..d822f272db 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 4681cf051c..d822f272db 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4681cf051c..d822f272db 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4681cf051c..d822f272db 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4681cf051c..d822f272db 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,25 @@ +Sun Jun 24 11:29:35 2001 Owen Taylor <otaylor@redhat.com> + + * gdk/x11/gdkimage-x11.c (gdk_image_new): Fix stupid error + introduced last night that was making things decidedly not work. + + * gtk/*.[ch]: Patch from Kristian Rietveld adding 80 getters + so that we have getter/setter pairing everywhere it makes + sense. (#55767) + + * gtk/gtkradiobutton.[ch] gtk/gtktoolbar.c tests/testgtk.: + Rename gtk_radio_button_group to gtk_radio_button_get_group, add a + deprecated compat macro. (#55516) + + * gtk/gtklabel.[ch]: Add functions + gtk_label_set/get_use_underline(), gtk_label_set/get_use_markup(), + gtk_label_set_label(), which mirror the property API for GtkLabel. + Make gtk_label_get_attributes() only reflect the attributes + set by gtk_label_set_attributes. + + * gtk/gtknotebook.c (gtk_notebook_set_current_page) gtk/gtkcompat.h: Rename + from gtk_notebook_set_page(). + Sat Jun 23 18:02:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in: Fix tests for XShm.h. diff --git a/docs/reference/gtk/tmpl/gtknotebook.sgml b/docs/reference/gtk/tmpl/gtknotebook.sgml index 338d8259d4..13ec1fa9f1 100644 --- a/docs/reference/gtk/tmpl/gtknotebook.sgml +++ b/docs/reference/gtk/tmpl/gtknotebook.sgml @@ -132,10 +132,11 @@ Compatibility macro; in gtkcompat.h. @Returns: -<!-- ##### FUNCTION gtk_notebook_set_page ##### --> +<!-- ##### MACRO gtk_notebook_set_page ##### --> <para> </para> +<!-- # Unused Parameters # --> @notebook: @page_num: diff --git a/docs/reference/gtk/tmpl/gtkradiobutton.sgml b/docs/reference/gtk/tmpl/gtkradiobutton.sgml index 2419f64d90..8c3a55eea4 100644 --- a/docs/reference/gtk/tmpl/gtkradiobutton.sgml +++ b/docs/reference/gtk/tmpl/gtkradiobutton.sgml @@ -129,14 +129,15 @@ as @group. @Returns: a new radio button. -<!-- ##### FUNCTION gtk_radio_button_group ##### --> +<!-- ##### MACRO gtk_radio_button_group ##### --> <para> Retrieves the group assigned to a radio button. </para> -@radio_button: a #GtkRadioButton. @Returns: a linked list containing all the radio buttons in the same group as @radio_button. +<!-- # Unused Parameters # --> +@radio_button: a #GtkRadioButton. <!-- ##### FUNCTION gtk_radio_button_set_group ##### --> diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c index 23d9dc7ba0..2f1c7f7240 100644 --- a/gdk/x11/gdkimage-x11.c +++ b/gdk/x11/gdkimage-x11.c @@ -313,9 +313,8 @@ gdk_image_new (GdkImageType type, image_list = g_list_prepend (image_list, image); } else -#else /* !USE_SHM */ - goto error; #endif /* USE_SHM */ + goto error; break; case GDK_IMAGE_NORMAL: private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth, diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 853e26fae5..c1998e5ec0 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -226,6 +226,24 @@ gtk_accel_label_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } +/** + * gtk_accel_label_get_accel_widget: + * @accel_label: a #GtkAccelLabel + * + * Fetches the widget monitored by this accelerator label. See + * gtk_accel_label_set_accel_widget(). + * + * Return value: the widget monitored by the accelerator label, + * or %NULL. + **/ +GtkWidget * +gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label) +{ + g_return_val_if_fail (GTK_IS_ACCEL_LABEL (accel_label), NULL); + + return accel_label->accel_widget; +} + guint gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label) { diff --git a/gtk/gtkaccellabel.h b/gtk/gtkaccellabel.h index 9e09de425a..9ed18a0628 100644 --- a/gtk/gtkaccellabel.h +++ b/gtk/gtkaccellabel.h @@ -78,6 +78,7 @@ struct _GtkAccelLabelClass GtkType gtk_accel_label_get_type (void) G_GNUC_CONST; GtkWidget* gtk_accel_label_new (const gchar *string); +GtkWidget* gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label); guint gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label); void gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label, GtkWidget *accel_widget); diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c index 6826028ba9..3b3e31d640 100644 --- a/gtk/gtkadjustment.c +++ b/gtk/gtkadjustment.c @@ -126,6 +126,23 @@ gtk_adjustment_new (gdouble value, return GTK_OBJECT (adjustment); } +/** + * gtk_adjustment_get_value: + * @adjustment: a #GtkAdjustment + * + * Gets the current value of the adjustment. See + * gtk_adjustment_set_value (). + * + * Return value: The current value of the adjustment. + **/ +gdouble +gtk_adjustment_get_value (GtkAdjustment *adjustment) +{ + g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), 0.); + + return adjustment->value; +} + void gtk_adjustment_set_value (GtkAdjustment *adjustment, gdouble value) diff --git a/gtk/gtkadjustment.h b/gtk/gtkadjustment.h index 39eded1bfd..c9dafc91ed 100644 --- a/gtk/gtkadjustment.h +++ b/gtk/gtkadjustment.h @@ -81,6 +81,7 @@ void gtk_adjustment_value_changed (GtkAdjustment *adjustment); void gtk_adjustment_clamp_page (GtkAdjustment *adjustment, gdouble lower, gdouble upper); +gdouble gtk_adjustment_get_value (GtkAdjustment *adjustment); void gtk_adjustment_set_value (GtkAdjustment *adjustment, gdouble value); diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 969d358f86..36ea538db8 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -478,6 +478,23 @@ gtk_box_set_homogeneous (GtkBox *box, } } +/** + * gtk_box_get_homogeneous: + * @box: a #GtkBox + * + * Returns whether the box is homogeneous (all children are the + * same size). See gtk_box_set_homogeneous (). + * + * Return value: %TRUE if the box is homogeneous. + **/ +gboolean +gtk_box_get_homogeneous (GtkBox *box) +{ + g_return_val_if_fail (GTK_IS_BOX (box), FALSE); + + return box->homogeneous; +} + void gtk_box_set_spacing (GtkBox *box, gint spacing) diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h index b6de573f5b..6b4055e6bc 100644 --- a/gtk/gtkbox.h +++ b/gtk/gtkbox.h @@ -90,6 +90,7 @@ void gtk_box_pack_end_defaults (GtkBox *box, GtkWidget *widget); void gtk_box_set_homogeneous (GtkBox *box, gboolean homogeneous); +gboolean gtk_box_get_homogeneous (GtkBox *box); void gtk_box_set_spacing (GtkBox *box, gint spacing); gint gtk_box_get_spacing (GtkBox *box); diff --git a/gtk/gtkcellrenderertoggle.h b/gtk/gtkcellrenderertoggle.h index 094258b7d6..f1918e1cfa 100644 --- a/gtk/gtkcellrenderertoggle.h +++ b/gtk/gtkcellrenderertoggle.h @@ -57,6 +57,7 @@ struct _GtkCellRendererToggleClass GtkType gtk_cell_renderer_toggle_get_type (void); GtkCellRenderer *gtk_cell_renderer_toggle_new (void); +gboolean gtk_cell_renderer_toggle_get_radio (GtkCellRendererToggle *toggle); void gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle, gboolean radio); diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index 914888fd7a..e008628679 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -210,6 +210,23 @@ gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item, } } +/** + * gtk_check_menu_item_get_active: + * @check_menu_item: a #GtkCheckMenuItem + * + * Returns whether the check menu item is active. See + * gtk_check_menu_item_set_active (). + * + * Return value: %TRUE if the menu item is checked. + */ +gboolean +gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item) +{ + g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE); + + return check_menu_item->active; +} + static void gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item, gint *requisition) diff --git a/gtk/gtkcheckmenuitem.h b/gtk/gtkcheckmenuitem.h index 15d9707afb..3e3fabc979 100644 --- a/gtk/gtkcheckmenuitem.h +++ b/gtk/gtkcheckmenuitem.h @@ -73,6 +73,7 @@ GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label); void gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item, gboolean is_active); +gboolean gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item); void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item); void gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item, gboolean setting); diff --git a/gtk/gtkcompat.h.in b/gtk/gtkcompat.h.in index e863e3797c..cb067cfe34 100644 --- a/gtk/gtkcompat.h.in +++ b/gtk/gtkcompat.h.in @@ -63,6 +63,7 @@ extern "C" { #define gtk_accel_label_accelerator_width gtk_accel_label_get_accel_width #define gtk_container_border_width gtk_container_set_border_width #define gtk_notebook_current_page gtk_notebook_get_current_page +#define gtk_notebook_set_page gtk_notebook_set_current_page #define gtk_packer_configure gtk_packer_set_child_packing #define gtk_paned_gutter_size(p,s) (void) 0 #define gtk_paned_set_gutter_size(p,s) (void) 0 diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index f0a587af32..75d155b101 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -816,6 +816,23 @@ gtk_container_set_border_width (GtkContainer *container, } /** + * gtk_container_get_border_width: + * @container: a #GtkContainer + * + * Retrieves the border width of the container. See + * gtk_container_set_border_width(). + * + * Return value: the current border width + **/ +guint +gtk_container_get_border_width (GtkContainer *container) +{ + g_return_val_if_fail (GTK_IS_CONTAINER (container), 0); + + return container->border_width; +} + +/** * gtk_container_add: * @container: a #GtkContainer * @widget: a widget to be placed inside @container @@ -938,6 +955,23 @@ gtk_container_set_resize_mode (GtkContainer *container, } } +/** + * gtk_container_get_resize_mode: + * @container: a #GtkContainer + * + * Returns the resize mode for the container. See + * gtk_container_set_resize_mode (). + * + * Return value: the current resize mode + **/ +GtkResizeMode +gtk_container_get_resize_mode (GtkContainer *container) +{ + g_return_val_if_fail (GTK_IS_CONTAINER (container), GTK_RESIZE_PARENT); + + return container->resize_mode; +} + void gtk_container_set_reallocate_redraws (GtkContainer *container, gboolean needs_redraws) @@ -1498,11 +1532,7 @@ gtk_container_real_set_focus_child (GtkContainer *container, static GList* get_focus_chain (GtkContainer *container) { - GList *chain; - - chain = g_object_get_data (G_OBJECT (container), "gtk-container-focus-chain"); - - return chain; + return g_object_get_data (G_OBJECT (container), "gtk-container-focus-chain"); } static GList* @@ -1561,11 +1591,7 @@ gtk_container_focus (GtkWidget *widget, */ if (container->has_focus_chain) { - GList *chain; - - chain = get_focus_chain (container); - - children = g_list_copy (chain); + children = g_list_copy (get_focus_chain (container)); } else { @@ -2082,6 +2108,41 @@ gtk_container_set_focus_chain (GtkContainer *container, chain); } +/** + * gtk_container_get_focus_chain: + * @container: a #GtkContainer + * @focusable_widgets: location to store the focus chain of the + * container, or %NULL. You should free this list + * using g_list_free() when you are done with it, however + * no additional reference count is added to the + * individual widgets in the focus chain. + * + * Retrieve the focus chain of the container, if one has been + * set explicitely. If no focus chain has been explicitely + * set, GTK+ computes the focus chain based on the positions + * of the children. In that case, GTK+ stores %NULL in + * @focusable_widgets and returns %FALSE. + * + * Return value: %TRUE if the focus chain of the container, + * has been set explicitely. + **/ +gboolean +gtk_container_get_focus_chain (GtkContainer *container, + GList **focus_chain) +{ + g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); + + if (focus_chain) + { + if (container->has_focus_chain) + *focus_chain = g_list_copy (get_focus_chain (container)); + else + *focus_chain = NULL; + } + + return container->has_focus_chain; +} + void gtk_container_unset_focus_chain (GtkContainer *container) { @@ -2131,6 +2192,29 @@ gtk_container_set_focus_vadjustment (GtkContainer *container, (GtkDestroyNotify) gtk_object_unref); } +/** + * gtk_container_get_focus_vadjustment: + * @container: a #GtkContainer + * + * Retrieves the vertical focus adjustment for the container. See + * gtk_container_set_focus_vadjustment (). + * + * Return value: the vertical focus adjustment, or %NULL if + * none has been set. + **/ +GtkAdjustment * +gtk_container_get_focus_vadjustment (GtkContainer *container) +{ + GtkAdjustment *vadjustment; + + g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); + + vadjustment = gtk_object_get_data_by_id (GTK_OBJECT (container), + vadjustment_key_id); + + return vadjustment; +} + void gtk_container_set_focus_hadjustment (GtkContainer *container, GtkAdjustment *adjustment) @@ -2149,6 +2233,29 @@ gtk_container_set_focus_hadjustment (GtkContainer *container, (GtkDestroyNotify) gtk_object_unref); } +/** + * gtk_container_get_focus_hadjustment: + * @container: a #GtkContainer + * + * Retrieves the horizontal focus adjustment for the container. See + * gtk_container_set_focus_hadjustment (). + * + * Return value: the horizontal focus adjustment, or %NULL if none + * none has been set. + **/ +GtkAdjustment * +gtk_container_get_focus_hadjustment (GtkContainer *container) +{ + GtkAdjustment *hadjustment; + + g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); + + hadjustment = gtk_object_get_data_by_id (GTK_OBJECT (container), + hadjustment_key_id); + + return hadjustment; +} + static void gtk_container_show_all (GtkWidget *widget) diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h index d8a9db2af5..d668a418fb 100644 --- a/gtk/gtkcontainer.h +++ b/gtk/gtkcontainer.h @@ -107,6 +107,7 @@ struct _GtkContainerClass GtkType gtk_container_get_type (void) G_GNUC_CONST; void gtk_container_set_border_width (GtkContainer *container, guint border_width); +guint gtk_container_get_border_width (GtkContainer *container); void gtk_container_add (GtkContainer *container, GtkWidget *widget); void gtk_container_remove (GtkContainer *container, @@ -114,6 +115,7 @@ void gtk_container_remove (GtkContainer *container, void gtk_container_set_resize_mode (GtkContainer *container, GtkResizeMode resize_mode); +GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container); void gtk_container_check_resize (GtkContainer *container); @@ -132,6 +134,8 @@ void gtk_container_propagate_expose (GtkContainer *container, void gtk_container_set_focus_chain (GtkContainer *container, GList *focusable_widgets); +gboolean gtk_container_get_focus_chain (GtkContainer *container, + GList **focusable_widgets); void gtk_container_unset_focus_chain (GtkContainer *container); /* Widget-level methods */ @@ -142,8 +146,10 @@ void gtk_container_set_focus_child (GtkContainer *container, GtkWidget *child); void gtk_container_set_focus_vadjustment (GtkContainer *container, GtkAdjustment *adjustment); +GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container); void gtk_container_set_focus_hadjustment (GtkContainer *container, GtkAdjustment *adjustment); +GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container); void gtk_container_resize_children (GtkContainer *container); diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c index b2ea905c33..cc1cfeb135 100644 --- a/gtk/gtkeditable.c +++ b/gtk/gtkeditable.c @@ -179,3 +179,24 @@ gtk_editable_set_editable (GtkEditable *editable, "editable", is_editable != FALSE, NULL); } + +/** + * gtk_editable_get_editable: + * @editable: a #GtkEditable + * + * Retrieves whether @editable is editable. See + * gtk_editable_set_editable(). + * + * Return value: %TRUE if @editable is editable. + **/ +gboolean +gtk_editable_get_editable (GtkEditable *editable) +{ + gboolean value; + + g_return_val_if_fail (GTK_IS_EDITABLE (editable), FALSE); + + gtk_object_get (GTK_OBJECT (editable), "editable", &value, NULL); + + return value; +} diff --git a/gtk/gtkeditable.h b/gtk/gtkeditable.h index 9fb5ba06ad..1411cf49c7 100644 --- a/gtk/gtkeditable.h +++ b/gtk/gtkeditable.h @@ -98,6 +98,7 @@ void gtk_editable_set_position (GtkEditable *editable, gint gtk_editable_get_position (GtkEditable *editable); void gtk_editable_set_editable (GtkEditable *editable, gboolean is_editable); +gboolean gtk_editable_get_editable (GtkEditable *editable); #ifdef __cplusplus } diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 60234f85f3..6cdaf71e29 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3075,6 +3075,23 @@ gtk_entry_set_visibility (GtkEntry *entry, } /** + * gtk_entry_get_visibility: + * @entry: a #GtkEntry + * + * Retrieves whether the text in @entry is visible. See + * gtk_entry_set_visibility(). + * + * Return value: %TRUE if the text is currently visible + **/ +gboolean +gtk_entry_get_visibility (GtkEntry *entry) +{ + g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE); + + return entry->visible; +} + +/** * gtk_entry_set_invisible_char: * @entry: a #GtkEntry * @ch: a Unicode character @@ -3102,6 +3119,24 @@ gtk_entry_set_invisible_char (GtkEntry *entry, gtk_entry_recompute (entry); } +/** + * gtk_entry_get_invisible_char: + * @entry: a #GtkEntry + * + * Retrieves the character displayed in place of the real characters + * for entries with visisbility set to false. See gtk_entry_set_invisible_char(). + * + * Return value: the current invisible char, or 0, if the entry does not + * show invisible text at all. + **/ +gunichar +gtk_entry_get_invisible_char (GtkEntry *entry) +{ + g_return_val_if_fail (GTK_IS_ENTRY (entry), 0); + + return entry->invisible_char; +} + void gtk_entry_set_editable(GtkEntry *entry, gboolean editable) @@ -3144,6 +3179,24 @@ gtk_entry_set_max_length (GtkEntry *entry, } /** + * gtk_entry_get_max_length: + * @entry: a #GtkEntry + * + * Retrieves the maximum allowed length of the text in + * @entry. See gtk_entry_set_max_length(). + * + * Return value: the maximum allowed number of characters + * in #GtkEntry, or 0 if there is no maximum. + **/ +gint +gtk_entry_get_max_length (GtkEntry *entry) +{ + g_return_val_if_fail (GTK_IS_ENTRY (entry), 0); + + return entry->text_max_length; +} + +/** * gtk_entry_set_activates_default: * @entry: a #GtkEntry * @setting: %TRUE to activate window's default widget on Enter keypress diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h index b639e13e5d..a3e012cbe1 100644 --- a/gtk/gtkentry.h +++ b/gtk/gtkentry.h @@ -149,8 +149,10 @@ GtkType gtk_entry_get_type (void) G_GNUC_CONST; GtkWidget* gtk_entry_new (void); void gtk_entry_set_visibility (GtkEntry *entry, gboolean visible); +gboolean gtk_entry_get_visibility (GtkEntry *entry); void gtk_entry_set_invisible_char (GtkEntry *entry, gunichar ch); +gunichar gtk_entry_get_invisible_char (GtkEntry *entry); void gtk_entry_set_editable (GtkEntry *entry, gboolean editable); void gtk_entry_set_has_frame (GtkEntry *entry, @@ -159,6 +161,7 @@ gboolean gtk_entry_get_has_frame (GtkEntry *entry); /* text is truncated if needed */ void gtk_entry_set_max_length (GtkEntry *entry, gint max); +gint gtk_entry_get_max_length (GtkEntry *entry); void gtk_entry_set_activates_default (GtkEntry *entry, gboolean setting); gboolean gtk_entry_get_activates_default (GtkEntry *entry); diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index 44acb9ad48..97396e3b80 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -387,6 +387,23 @@ gtk_frame_set_label_widget (GtkFrame *frame, g_object_notify (G_OBJECT (frame), "label_widget"); } +/** + * gtk_frame_get_label_widget: + * @frame: a #GtkFrame + * + * Retrieves the label widget for the frame. See + * gtk_frame_set_label_widget(). + * + * Return value: the label widget, or %NULL if there is none. + **/ +GtkWidget * +gtk_frame_get_label_widget (GtkFrame *frame) +{ + g_return_val_if_fail (GTK_IS_FRAME (frame), NULL); + + return frame->label_widget; +} + void gtk_frame_set_label_align (GtkFrame *frame, gfloat xalign, @@ -413,6 +430,28 @@ gtk_frame_set_label_align (GtkFrame *frame, gtk_widget_queue_resize (GTK_WIDGET (frame)); } +/** + * gtk_frame_get_label_align: + * @frame: a #GtkFrame + * @xalign: location to store X alignment of frame's label, or %NULL + * @yalign: location to store X alignment of frame's label, or %NULL + * + * Retrieves the X and Y alignment of the frame's label. See + * gtk_frame_set_label_align(). + **/ +void +gtk_frame_get_label_align (GtkFrame *frame, + gfloat *xalign, + gfloat *yalign) +{ + g_return_if_fail (GTK_IS_FRAME (frame)); + + if (xalign) + *xalign = frame->label_xalign; + if (yalign) + *yalign = frame->label_yalign; +} + void gtk_frame_set_shadow_type (GtkFrame *frame, GtkShadowType type) @@ -434,6 +473,23 @@ gtk_frame_set_shadow_type (GtkFrame *frame, } } +/** + * gtk_frame_get_shadow_type: + * @frame: a #GtkFrame + * + * Retrieves the shadow type of the frame. See + * gtk_frame_set_shadow_type(). + * + * Return value: the current shadow type of the frame. + **/ +GtkShadowType +gtk_frame_get_shadow_type (GtkFrame *frame) +{ + g_return_val_if_fail (GTK_IS_FRAME (frame), GTK_SHADOW_ETCHED_IN); + + return frame->shadow_type; +} + static void gtk_frame_paint (GtkWidget *widget, GdkRectangle *area) diff --git a/gtk/gtkframe.h b/gtk/gtkframe.h index a29fb72931..70c4902375 100644 --- a/gtk/gtkframe.h +++ b/gtk/gtkframe.h @@ -77,11 +77,16 @@ G_CONST_RETURN gchar *gtk_frame_get_label (GtkFrame *frame); void gtk_frame_set_label_widget (GtkFrame *frame, GtkWidget *label_widget); +GtkWidget *gtk_frame_get_label_widget (GtkFrame *frame); void gtk_frame_set_label_align (GtkFrame *frame, gfloat xalign, gfloat yalign); +void gtk_frame_get_label_align (GtkFrame *frame, + gfloat *xalign, + gfloat *yalign); void gtk_frame_set_shadow_type (GtkFrame *frame, GtkShadowType type); +GtkShadowType gtk_frame_get_shadow_type (GtkFrame *frame); #ifdef __cplusplus } diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index a80841487b..2cb36848c4 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -201,7 +201,7 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) _("Snap edge"), _("Side of the handlebox that's lined up with the docking point to dock the handlebox."), GTK_TYPE_POSITION_TYPE, - GTK_POS_LEFT, + GTK_POS_TOP, G_PARAM_READABLE | G_PARAM_WRITABLE)); object_class->destroy = gtk_handle_box_destroy; @@ -747,6 +747,23 @@ gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box, } } +/** + * gtk_handle_box_get_shadow_type: + * @handle_box: a #GtkHandleBox + * + * Gets the type of shadow drawn around the handle box. See + * gtk_handle_box_set_shadow_type(). + * + * Return value: the type of shadow currently drawn around the handle box. + **/ +GtkShadowType +gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box) +{ + g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), GTK_SHADOW_ETCHED_OUT); + + return handle_box->shadow_type; +} + void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, GtkPositionType position) @@ -759,6 +776,23 @@ gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, } } +/** + * gtk_handle_box_get_handle_position: + * @handle_box: a #GtkHandleBox + * + * Gets the handle position of the handle box. See + * gtk_handle_box_set_handle_position(). + * + * Return value: the current handle position. + **/ +GtkPositionType +gtk_handle_box_get_handle_position (GtkHandleBox *handle_box) +{ + g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), GTK_POS_LEFT); + + return handle_box->handle_position; +} + void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, GtkPositionType edge) @@ -773,6 +807,24 @@ gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, } } +/** + * gtk_handle_box_get_snap_edge: + * @handle_box: a #GtkHandleBox + * + * Gets the edge used for determining reattachment of the handle box. See + * gtk_handle_box_set_snap_edge(). + * + * Return value: the edge used for determining reattachment, or (GtkPositionType)-1 if this + * is determined (as per default) from the handle position. + **/ +GtkPositionType +gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box) +{ + g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), (GtkPositionType)-1); + + return handle_box->snap_edge; +} + static void gtk_handle_box_paint (GtkWidget *widget, GdkEventExpose *event, diff --git a/gtk/gtkhandlebox.h b/gtk/gtkhandlebox.h index 35fe764b11..41a92af7c0 100644 --- a/gtk/gtkhandlebox.h +++ b/gtk/gtkhandlebox.h @@ -88,14 +88,17 @@ struct _GtkHandleBoxClass }; -GtkType gtk_handle_box_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_handle_box_new (void); -void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box, - GtkShadowType type); -void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, - GtkPositionType position); -void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, - GtkPositionType edge); +GtkType gtk_handle_box_get_type (void) G_GNUC_CONST; +GtkWidget* gtk_handle_box_new (void); +void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box, + GtkShadowType type); +GtkShadowType gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box); +void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, + GtkPositionType position); +GtkPositionType gtk_handle_box_get_handle_position(GtkHandleBox *handle_box); +void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, + GtkPositionType edge); +GtkPositionType gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box); diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index c9a5272d9a..b1e85ffff2 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -285,24 +285,16 @@ gtk_label_set_property (GObject *object, switch (prop_id) { case PROP_LABEL: - gtk_label_set_label_internal (label, - g_strdup (g_value_get_string (value))); - gtk_label_recalculate (label); - if (last_keyval != label->mnemonic_keyval) - gtk_label_setup_mnemonic (label, last_keyval); + gtk_label_set_label (label, g_value_get_string (value)); break; case PROP_ATTRIBUTES: gtk_label_set_attributes (label, g_value_get_boxed (value)); break; case PROP_USE_MARKUP: - gtk_label_set_use_markup_internal (label, g_value_get_boolean (value)); - gtk_label_recalculate (label); + gtk_label_set_use_markup (label, g_value_get_boolean (value)); break; case PROP_USE_UNDERLINE: - gtk_label_set_use_underline_internal (label, g_value_get_boolean (value)); - gtk_label_recalculate (label); - if (label->use_underline) - gtk_label_setup_mnemonic (label, last_keyval); + gtk_label_set_use_underline (label, g_value_get_boolean (value)); break; case PROP_JUSTIFY: gtk_label_set_justify (label, g_value_get_enum (value)); @@ -398,9 +390,10 @@ gtk_label_init (GtkLabel *label) /** * gtk_label_new: * @str: The text of the label - * @returns: a new #GtkLabel * * Creates a new #GtkLabel, containing the text in @str. + * + * Return value: the new #GtkLabel **/ GtkWidget* gtk_label_new (const gchar *str) @@ -419,7 +412,6 @@ gtk_label_new (const gchar *str) * gtk_label_new_with_mnemonic: * @str: The text of the label, with an underscore in front of the * mnemonic character - * @returns: a new #GtkLabel * * Creates a new #GtkLabel, containing the text in @str. * @@ -435,6 +427,8 @@ gtk_label_new (const gchar *str) * label is inside a button or menu item, the button or menu item will * automatically become the mnemonic widget and be activated by * the mnemonic. + * + * Return value: the new #GtkLabel **/ GtkWidget* gtk_label_new_with_mnemonic (const gchar *str) @@ -550,6 +544,23 @@ gtk_label_set_mnemonic_widget (GtkLabel *label, gtk_widget_ref (label->mnemonic_widget); } +/** + * gtk_label_get_mnemonic_widget: + * @label: a #GtkLabel + * + * Retrieves the target of the mnemonic (keyboard shortcut) of this + * label. See gtk_label_set_mnemonic_widget (). + * + * Return value: the target of the label's mnemonic, or %NULL if none + * has been set and the default algorithm will be used. + **/ +GtkWidget * +gtk_label_get_mnemonic_widget (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), NULL); + + return label->mnemonic_widget; +} /** * gtk_label_get_mnemonic_keyval: @@ -593,12 +604,14 @@ gtk_label_set_label_internal (GtkLabel *label, static void gtk_label_set_use_markup_internal (GtkLabel *label, - gboolean val) + gboolean val) { val = val != FALSE; if (label->use_markup != val) - g_object_notify (G_OBJECT (label), "use_markup"); - label->use_markup = val; + { + g_object_notify (G_OBJECT (label), "use_markup"); + label->use_markup = val; + } } static void @@ -607,13 +620,15 @@ gtk_label_set_use_underline_internal (GtkLabel *label, { val = val != FALSE; if (label->use_underline != val) - g_object_notify (G_OBJECT (label), "use_underline"); - label->use_underline = val; + { + g_object_notify (G_OBJECT (label), "use_underline"); + label->use_underline = val; + } } static void -gtk_label_set_attributes_internal (GtkLabel *label, - PangoAttrList *attrs) +gtk_label_set_attributes_internal (GtkLabel *label, + PangoAttrList *attrs) { if (attrs) pango_attr_list_ref (attrs); @@ -621,6 +636,14 @@ gtk_label_set_attributes_internal (GtkLabel *label, if (label->attrs) pango_attr_list_unref (label->attrs); + if (!label->use_markup && !label->use_underline) + { + pango_attr_list_ref (attrs); + if (label->effective_attrs) + pango_attr_list_unref (label->effective_attrs); + label->effective_attrs = attrs; + } + label->attrs = attrs; g_object_notify (G_OBJECT (label), "attributes"); } @@ -633,7 +656,7 @@ static void gtk_label_recalculate (GtkLabel *label) { if (label->use_markup) - set_markup (label, label->label, label->use_underline); + set_markup (label, label->label, label->use_underline); else { if (label->use_underline) @@ -641,7 +664,11 @@ gtk_label_recalculate (GtkLabel *label) else { gtk_label_set_text_internal (label, g_strdup (label->label)); - gtk_label_set_attributes_internal (label, NULL); + if (label->attrs) + pango_attr_list_ref (label->attrs); + if (label->effective_attrs) + pango_attr_list_unref (label->effective_attrs); + label->effective_attrs = label->attrs; } } @@ -685,7 +712,8 @@ gtk_label_set_text (GtkLabel *label, * @attrs: a #PangoAttrList * * Sets a #PangoAttrList; the attributes in the list are applied to the - * label text. + * label text. The attributes set with this function will be ignored + * if label->use_underline or label->use_markup is %TRUE. **/ void gtk_label_set_attributes (GtkLabel *label, @@ -699,6 +727,72 @@ gtk_label_set_attributes (GtkLabel *label, gtk_widget_queue_resize (GTK_WIDGET (label)); } +/** + * gtk_label_get_attributes: + * @label: a #GtkLabel + * + * Gets the attribute list that was set on the label using + * gtk_label_set_attributes(), if any. This function does + * not reflect attributes that come from the labels markup + * (see gtk_label_set_markup()). If you want to get the + * effective attributes for the label, use + * pango_layout_get_attribute (gtk_label_get_layout (label)). + * + * Return value: the attribute list, or %NULL if none was set. + **/ +PangoAttrList * +gtk_label_get_attributes (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), NULL); + + return label->attrs; +} + +/** + * gtk_label_set_label: + * @label: a #GtkLabel + * @str: the new text to set for the label + * + * Sets the text of the label. The label is interpreted as + * including embedded underlines and/or Pango markup depending + * on the values of label->use_underline and label->use_markup. + **/ +void +gtk_label_set_label (GtkLabel *label, + const gchar *str) +{ + guint last_keyval; + + g_return_if_fail (GTK_IS_LABEL (label)); + g_return_if_fail (str != NULL); + + last_keyval = label->mnemonic_keyval; + + gtk_label_set_label_internal (label, g_strdup (str)); + gtk_label_recalculate (label); + if (last_keyval != label->mnemonic_keyval) + gtk_label_setup_mnemonic (label, last_keyval); +} + +/** + * gtk_label_get_label: + * @label: a #GtkLabel + * + * Fetches the text from a label widget including any embedded + * underlines indicating mnemonics and Pango markup. (See + * gtk_label_get_text ()). + * + * Return value: the text of the label widget. This string is + * owned by the widget and must not be modified or freed. + **/ +G_CONST_RETURN gchar * +gtk_label_get_label (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), NULL); + + return label->label; +} + static void set_markup (GtkLabel *label, const gchar *str, @@ -728,8 +822,9 @@ set_markup (GtkLabel *label, if (attrs) { - gtk_label_set_attributes_internal (label, attrs); - pango_attr_list_unref (attrs); + if (label->effective_attrs) + pango_attr_list_unref (label->effective_attrs); + label->effective_attrs = attrs; } if (accel_char != 0) @@ -792,10 +887,12 @@ gtk_label_set_markup_with_mnemonic (GtkLabel *label, * gtk_label_get_text: * @label: a #GtkLabel * - * Fetches the text from a label widget + * Fetches the text from a label widget, as displayed on the + * screen. This does not include any embedded underlines + * indicating mnemonics or Pango markup. (See gtk_label_get_label()) * * Return value: the text in the label widget. This is the internal - * string used by the label, and must not be modified. + * string used by the label, and must not be modified. **/ G_CONST_RETURN gchar * gtk_label_get_text (GtkLabel *label) @@ -854,7 +951,6 @@ gtk_label_set_pattern_internal (GtkLabel *label, g_return_if_fail (GTK_IS_LABEL (label)); attrs = gtk_label_pattern_to_attrs (label, pattern); - gtk_label_set_attributes_internal (label, attrs); } @@ -871,6 +967,14 @@ gtk_label_set_pattern (GtkLabel *label, } +/** + * gtk_label_set_justify: + * @label: a #GtkLabel + * @jtype: a #GtkJustification + * + * Sets the alignment of the lines in the text of the label relative to + * each other. + **/ void gtk_label_set_justify (GtkLabel *label, GtkJustification jtype) @@ -890,6 +994,29 @@ gtk_label_set_justify (GtkLabel *label, } } +/** + * gtk_label_get_justify: + * @label: a #GtkLabel + * + * Returns the justification of the label. See gtk_label_set_justification (). + * + * Return value: GtkJustification + **/ +GtkJustification +gtk_label_get_justify (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), 0); + + return label->jtype; +} + +/** + * gtk_label_set_line_wrap: + * @label: a #GtkLabel + * @wrap: the setting + * + * If true, the lines will be wrapped if the text becomes too wide. + */ void gtk_label_set_line_wrap (GtkLabel *label, gboolean wrap) @@ -907,6 +1034,22 @@ gtk_label_set_line_wrap (GtkLabel *label, } } +/** + * gtk_label_get_line_wrap: + * @label: a #GtkLabel + * + * Returns whether lines in the label are automatically wrapped. See gtk_label_set_line_wrap (). + * + * Return value: %TRUE if the lines of the label are automatically wrapped. + */ +gboolean +gtk_label_get_line_wrap (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), FALSE); + + return label->wrap; +} + void gtk_label_get (GtkLabel *label, gchar **str) @@ -946,6 +1089,9 @@ gtk_label_finalize (GObject *object) if (label->attrs) pango_attr_list_unref (label->attrs); + if (label->effective_attrs) + pango_attr_list_unref (label->attrs); + g_free (label->select_info); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -1002,8 +1148,8 @@ gtk_label_ensure_layout (GtkLabel *label, label->layout = gtk_widget_create_pango_layout (widget, label->text); - if (label->attrs) - pango_layout_set_attributes (label->layout, label->attrs); + if (label->effective_attrs) + pango_layout_set_attributes (label->layout, label->effective_attrs); switch (label->jtype) { @@ -2102,3 +2248,75 @@ gtk_label_get_layout_offsets (GtkLabel *label, get_layout_location (label, x, y); } +/** + * gtk_label_set_use_markup: + * @label: a #GtkLabel + * @setting: %TRUE if the label's text should be parsed for markup. + * + * Sets whether the text of the label contains markup in Pango's + * text markup lango. See gtk_label_set_markup(). + **/ +void +gtk_label_set_use_markup (GtkLabel *label, + gboolean setting) +{ + g_return_if_fail (GTK_IS_LABEL (label)); + + gtk_label_set_use_markup_internal (label, setting); + gtk_label_recalculate (label); +} + +/** + * gtk_label_get_use_markup: + * @label: a #GtkLabel + * + * Returns whether the label's text is interpreted as marked up with the + * Pango text markup language. See gtk_label_set_use_markup (). + * + * Return value: %TRUE if the label's text will be parsed for markup. + **/ +gboolean +gtk_label_get_use_markup (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), FALSE); + + return label->use_markup; +} + +/** + * gtk_label_set_use_underline: + * @label: a #GtkLabel + * @setting: %TRUE if underlines in the text indicate mnemonics + * + * If true, an underline in the text indicates the next character should be + * used for the mnemonic accelerator key. + */ +void +gtk_label_set_use_underline (GtkLabel *label, + gboolean setting) +{ + g_return_if_fail (GTK_IS_LABEL (label)); + + gtk_label_set_use_underline_internal (label, setting); + gtk_label_recalculate (label); + if (label->use_underline) + gtk_label_setup_mnemonic (label, label->mnemonic_keyval); +} + +/** + * gtk_label_get_use_underline: + * @label: a #GtkLabel + * + * Returns whether an embedded underline in thef label indicates a + * mnemonic. See gtk_label_set_use_underline (). + * + * Return value: %TRUE whether an embedded underline in the label indicates + * the mnemonic accelerator keys. + **/ +gboolean +gtk_label_get_use_underline (GtkLabel *label) +{ + g_return_val_if_fail (GTK_IS_LABEL (label), FALSE); + + return label->use_underline; +} diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h index 9181a3211c..5ba51e54fe 100644 --- a/gtk/gtklabel.h +++ b/gtk/gtklabel.h @@ -65,6 +65,7 @@ struct _GtkLabel gchar *text; PangoAttrList *attrs; + PangoAttrList *effective_attrs; PangoLayout *layout; @@ -80,28 +81,42 @@ struct _GtkLabelClass }; GtkType gtk_label_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_label_new (const char *str); -GtkWidget* gtk_label_new_with_mnemonic (const char *str); -void gtk_label_set_text (GtkLabel *label, - const char *str); -G_CONST_RETURN gchar* gtk_label_get_text (GtkLabel *label); -void gtk_label_set_attributes (GtkLabel *label, - PangoAttrList *attrs); -void gtk_label_set_markup (GtkLabel *label, - const gchar *str); +GtkWidget* gtk_label_new (const char *str); +GtkWidget* gtk_label_new_with_mnemonic (const char *str); +void gtk_label_set_text (GtkLabel *label, + const char *str); +G_CONST_RETURN gchar* gtk_label_get_text (GtkLabel *label); +void gtk_label_set_attributes (GtkLabel *label, + PangoAttrList *attrs); +PangoAttrList *gtk_label_get_attributes (GtkLabel *label); +void gtk_label_set_label (GtkLabel *label, + const gchar *str); +G_CONST_RETURN gchar *gtk_label_get_label (GtkLabel *label); +void gtk_label_set_markup (GtkLabel *label, + const gchar *str); +void gtk_label_set_use_markup (GtkLabel *label, + gboolean setting); +gboolean gtk_label_get_use_markup (GtkLabel *label); +void gtk_label_set_use_underline (GtkLabel *label, + gboolean setting); +gboolean gtk_label_get_use_underline (GtkLabel *label); + void gtk_label_set_markup_with_mnemonic (GtkLabel *label, const gchar *str); guint gtk_label_get_mnemonic_keyval (GtkLabel *label); void gtk_label_set_mnemonic_widget (GtkLabel *label, GtkWidget *widget); +GtkWidget *gtk_label_get_mnemonic_widget (GtkLabel *label); void gtk_label_set_text_with_mnemonic (GtkLabel *label, const gchar *str); void gtk_label_set_justify (GtkLabel *label, GtkJustification jtype); +GtkJustification gtk_label_get_justify (GtkLabel *label); void gtk_label_set_pattern (GtkLabel *label, const gchar *pattern); void gtk_label_set_line_wrap (GtkLabel *label, gboolean wrap); +gboolean gtk_label_get_line_wrap (GtkLabel *label); void gtk_label_set_selectable (GtkLabel *label, gboolean setting); gboolean gtk_label_get_selectable (GtkLabel *label); @@ -118,7 +133,6 @@ void gtk_label_get_layout_offsets (GtkLabel *label, gint *y); - #ifndef GTK_DISABLE_COMPAT_H # define gtk_label_set gtk_label_set_text #endif /* GTK_DISABLE_COMPAT_H */ diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index 8624487a4b..46772136e3 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -344,6 +344,29 @@ gtk_layout_set_size (GtkLayout *layout, } } +/** + * gtk_layout_get_size: + * @layout: a #GtkLayout + * @width: location to store the width set on @layout, or %NULL + * @height: location to store the height set on @layout, or %NULL + * + * Gets the size that has been set on the layout, and that determines + * the total extents of the layout's scrollbar area. See + * gtk_layout_set_size (). + **/ +void +gtk_layout_get_size (GtkLayout *layout, + guint *width, + guint *height) +{ + g_return_if_fail (GTK_IS_LAYOUT (layout)); + + if (width) + *width = layout->width; + if (height) + *height = layout->height; +} + void gtk_layout_freeze (GtkLayout *layout) { diff --git a/gtk/gtklayout.h b/gtk/gtklayout.h index b0f2004aff..b216761b1e 100644 --- a/gtk/gtklayout.h +++ b/gtk/gtklayout.h @@ -98,6 +98,9 @@ void gtk_layout_move (GtkLayout *layout, void gtk_layout_set_size (GtkLayout *layout, guint width, guint height); +void gtk_layout_get_size (GtkLayout *layout, + guint *width, + guint *height); GtkAdjustment* gtk_layout_get_hadjustment (GtkLayout *layout); GtkAdjustment* gtk_layout_get_vadjustment (GtkLayout *layout); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index c32dd6969c..b1c79fffd7 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -910,6 +910,23 @@ gtk_menu_set_tearoff_state (GtkMenu *menu, } } +/** + * gtk_menu_get_tearoff_state: + * @menu: a #GtkMenu + * + * Returns whether the menu is torn off. See + * gtk_menu_set_tearoff_state (). + * + * Return value: %TRUE if the menu is currently torn off. + **/ +gboolean +gtk_menu_get_tearoff_state (GtkMenu *menu) +{ + g_return_val_if_fail (GTK_IS_MENU (menu), FALSE); + + return menu->torn_off; +} + void gtk_menu_set_title (GtkMenu *menu, const gchar *title) @@ -921,6 +938,23 @@ gtk_menu_set_title (GtkMenu *menu, g_strdup (title), (GtkDestroyNotify) g_free); } +/** + * gtk_menu_get_title: + * @menu: a #GtkMenu + * + * Returns the title of the menu. See gtk_menu_set_title(). + * + * Return value: the title of the menu, or %NULL if the menu has no + * title set on it. + **/ +G_CONST_RETURN gchar * +gtk_menu_get_title (GtkMenu *menu) +{ + g_return_val_if_fail (GTK_IS_MENU (menu), NULL); + + return gtk_object_get_data (GTK_OBJECT (menu), "gtk-menu-title"); +} + void gtk_menu_reorder_child (GtkMenu *menu, GtkWidget *child, diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h index 30c63824b8..75f51c2a8c 100644 --- a/gtk/gtkmenu.h +++ b/gtk/gtkmenu.h @@ -165,12 +165,14 @@ GtkWidget* gtk_menu_get_attach_widget (GtkMenu *menu); void gtk_menu_set_tearoff_state (GtkMenu *menu, gboolean torn_off); +gboolean gtk_menu_get_tearoff_state (GtkMenu *menu); /* This sets the window manager title for the window that * appears when a menu is torn off */ void gtk_menu_set_title (GtkMenu *menu, const gchar *title); +G_CONST_RETURN gchar *gtk_menu_get_title (GtkMenu *menu); void gtk_menu_reorder_child (GtkMenu *menu, GtkWidget *child, diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 0501a8bd64..8418a4f097 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -311,6 +311,23 @@ gtk_menu_item_set_submenu (GtkMenuItem *menu_item, } } +/** + * gtk_menu_item_get_submenu: + * @menu_item: a #GtkMenuItem + * + * Gets the submenu underneath this menu item, if any. See + * gtk_menu_item_set_submenu(). + * + * Return value: submenu for this menu item, or %NULL if none. + **/ +GtkWidget * +gtk_menu_item_get_submenu (GtkMenuItem *menu_item) +{ + g_return_val_if_fail (GTK_IS_MENU_ITEM (menu_item), NULL); + + return menu_item->submenu; +} + void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item) { diff --git a/gtk/gtkmenuitem.h b/gtk/gtkmenuitem.h index 77f6b435ce..fdbaad7793 100644 --- a/gtk/gtkmenuitem.h +++ b/gtk/gtkmenuitem.h @@ -93,6 +93,7 @@ GtkWidget* gtk_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label); void gtk_menu_item_set_submenu (GtkMenuItem *menu_item, GtkWidget *submenu); +GtkWidget* gtk_menu_item_get_submenu (GtkMenuItem *menu_item); void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item); void gtk_menu_item_set_placement (GtkMenuItem *menu_item, GtkSubmenuPlacement placement); diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c index cd8782486f..3e1f6bbf07 100644 --- a/gtk/gtkmisc.c +++ b/gtk/gtkmisc.c @@ -242,6 +242,28 @@ gtk_misc_set_alignment (GtkMisc *misc, } } +/** + * gtk_misc_get_alignment: + * @misc: a #GtkMisc + * @xalign: location to store X alignment of @misc, or %NULL + * @yalign: location to store Y alignment of @misc, or %NULL + * + * Gets the X and Y alignment of the widget within its allocation. See + * gtk_misc_set_alignment(). + **/ +void +gtk_misc_get_alignment (GtkMisc *misc, + gfloat *xalign, + gfloat *yalign) +{ + g_return_if_fail (GTK_IS_MISC (misc)); + + if (xalign) + *xalign = misc->xalign; + if (yalign) + *yalign = misc->yalign; +} + void gtk_misc_set_padding (GtkMisc *misc, gint xpad, @@ -280,6 +302,27 @@ gtk_misc_set_padding (GtkMisc *misc, } } +/** + * gtk_misc_get_padding: + * @misc: a #GtkMisc + * @xpad: location to store padding in the X direction, or %NULL + * @ypad: location to store padding in the Y direction, or %NULL + * + * Gets the padding in the X and Y directions of the widget. See gtk_misc_set_padding(). + **/ +void +gtk_misc_get_padding (GtkMisc *misc, + gint *xpad, + gint *ypad) +{ + g_return_if_fail (GTK_IS_MISC (misc)); + + if (xpad) + *xpad = misc->xpad; + if (ypad) + *ypad = misc->ypad; +} + static void gtk_misc_realize (GtkWidget *widget) { diff --git a/gtk/gtkmisc.h b/gtk/gtkmisc.h index 379b780c68..e527d737f8 100644 --- a/gtk/gtkmisc.h +++ b/gtk/gtkmisc.h @@ -69,9 +69,15 @@ GtkType gtk_misc_get_type (void) G_GNUC_CONST; void gtk_misc_set_alignment (GtkMisc *misc, gfloat xalign, gfloat yalign); +void gtk_misc_get_alignment (GtkMisc *misc, + gfloat *xalign, + gfloat *yalign); void gtk_misc_set_padding (GtkMisc *misc, gint xpad, gint ypad); +void gtk_misc_get_padding (GtkMisc *misc, + gint *xpad, + gint *ypad); #ifdef __cplusplus diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index a901b2662c..a41b4b8c51 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -614,7 +614,7 @@ gtk_notebook_set_property (GObject *object, gtk_notebook_set_homogeneous_tabs (notebook, g_value_get_boolean (value)); break; case PROP_PAGE: - gtk_notebook_set_page (notebook, g_value_get_int (value)); + gtk_notebook_set_current_page (notebook, g_value_get_int (value)); break; case PROP_TAB_POS: gtk_notebook_set_tab_pos (notebook, g_value_get_enum (value)); @@ -3956,7 +3956,7 @@ gtk_notebook_remove_page (GtkNotebook *notebook, /* Public GtkNotebook Page Switch Methods : * gtk_notebook_get_current_page * gtk_notebook_page_num - * gtk_notebook_set_page + * gtk_notebook_set_current_page * gtk_notebook_next_page * gtk_notebook_prev_page */ @@ -4044,7 +4044,7 @@ gtk_notebook_page_num (GtkNotebook *notebook, } /** - * gtk_notebook_set_page: + * gtk_notebook_set_current_page: * @notebook: a #GtkNotebook * @page_num: index of the page to switch to, starting from 0. * If negative, or greater than the number of pages @@ -4053,8 +4053,8 @@ gtk_notebook_page_num (GtkNotebook *notebook, * Switches to the page number @page_num. **/ void -gtk_notebook_set_page (GtkNotebook *notebook, - gint page_num) +gtk_notebook_set_current_page (GtkNotebook *notebook, + gint page_num) { GList *list; @@ -4160,6 +4160,23 @@ gtk_notebook_set_show_border (GtkNotebook *notebook, } /** + * gtk_notebook_get_show_border: + * @notebook: a #GtkNotebook + * + * Returns whether a bevel will be drawn around the notebook pages. See + * gtk_notebook_set_show_border(). + * + * Return value: %TRUE if the bevel is drawn + **/ +gboolean +gtk_notebook_get_show_border (GtkNotebook *notebook) +{ + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE); + + return notebook->show_border; +} + +/** * gtk_notebook_set_show_tabs: * @notebook: a #GtkNotebook * @show_tabs: %TRUE if the tabs should be shown. @@ -4215,6 +4232,23 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook, } /** + * gtk_notebook_get_show_tabs: + * @notebook: a #GtkNotebook + * + * Returns whether the tabs of the notebook are shown. See + * gtk_notebook_set_show_tabs(). + * + * Return value: %TRUE if the tabs are shown + **/ +gboolean +gtk_notebook_get_show_tabs (GtkNotebook *notebook) +{ + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE); + + return notebook->show_tabs; +} + +/** * gtk_notebook_set_tab_pos: * @notebook: * @pos: @@ -4239,6 +4273,23 @@ gtk_notebook_set_tab_pos (GtkNotebook *notebook, } /** + * gtk_notebook_get_tab_pos: + * @notebook: a #GtkNotebook + * + * Gets the edge at which the tabs for switching pages in the + * notebook are drawn. + * + * Return value: the edge at which the tabs are drawn + **/ +GtkPositionType +gtk_notebook_get_tab_pos (GtkNotebook *notebook) +{ + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), GTK_POS_TOP); + + return notebook->tab_pos; +} + +/** * gtk_notebook_set_homogeneous_tabs: * @notebook: a #GtkNotebook * @homogeneous: %TRUE if all tabs should be the same size. @@ -4373,6 +4424,23 @@ gtk_notebook_set_scrollable (GtkNotebook *notebook, } } +/** + * gtk_notebook_get_scrollable: + * @notebook: a #GtkNotebook + * + * Returns whether the tab label area has arrows for scrolling. See + * gtk_notebook_set_scrollable(). + * + * Return value: %TRUE if arrows for scrolling are present + **/ +gboolean +gtk_notebook_get_scrollable (GtkNotebook *notebook) +{ + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE); + + return notebook->scrollable; +} + /* Public GtkNotebook Popup Menu Methods: * * gtk_notebook_popup_enable @@ -4561,15 +4629,45 @@ gtk_notebook_set_tab_label_text (GtkNotebook *notebook, } /** + * gtk_notebook_get_tab_label_text: + * @notebook: a #GtkNotebook + * @child: a widget contained in a page of @notebook + * + * Retrieves the text of the tab label for the page containing + * @child. + * + * Returns value: the text of the tab label, or %NULL if the + * tab label widget is not a #GtkLabel. The + * string is owned by the widget and must not + * be freed. + **/ +G_CONST_RETURN gchar * +gtk_notebook_get_tab_label_text (GtkNotebook *notebook, + GtkWidget *child) +{ + GtkWidget *tab_label; + + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (child), NULL); + + tab_label = gtk_notebook_get_tab_label (notebook, child); + + if (tab_label && GTK_IS_LABEL (tab_label)) + return gtk_label_get_text (GTK_LABEL (tab_label)); + else + return NULL; +} + +/** * gtk_notebook_get_menu_label: * @notebook: a #GtkNotebook - * @child: the page + * @child: a widget contained in a page of @notebook * - * Returns the menu label of the page containing @child. NULL is - * returned if @child is not in @notebook or NULL if it has the - * default menu label. + * Retrieves the menu label widget of the page containing @child. * - * Return value: the menu label + * Return value: the menu label, or %NULL if the + * notebook page does not have a menu label other + * than the default (the tab label). **/ GtkWidget* gtk_notebook_get_menu_label (GtkNotebook *notebook, @@ -4663,6 +4761,37 @@ gtk_notebook_set_menu_label_text (GtkNotebook *notebook, gtk_widget_child_notify (child, "menu_label"); } +/** + * gtk_notebook_get_menu_label_text: + * @notebook: a #GtkNotebook + * @child: the child widget of a page of the notebook. + * + * Retrieves the text of the menu label for the page containing + * @child. + * + * Returns value: the text of the tab label, or %NULL if the + * widget does not have a menu label other than + * the default menu label, or the menu label widget + * is not a #GtkLabel. The string is owned by + * the widget and must not be freed. + **/ +G_CONST_RETURN gchar * +gtk_notebook_get_menu_label_text (GtkNotebook *notebook, + GtkWidget *child) +{ + GtkWidget *menu_label; + + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (child), NULL); + + menu_label = gtk_notebook_get_menu_label (notebook, child); + + if (menu_label && GTK_IS_LABEL (menu_label)) + return gtk_label_get_text (GTK_LABEL (menu_label)); + else + return NULL; +} + /* Helper function called when pages are reordered */ static void diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h index c908ce431a..651db4534b 100644 --- a/gtk/gtknotebook.h +++ b/gtk/gtknotebook.h @@ -143,7 +143,7 @@ GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook, gint page_num); gint gtk_notebook_page_num (GtkNotebook *notebook, GtkWidget *child); -void gtk_notebook_set_page (GtkNotebook *notebook, +void gtk_notebook_set_current_page (GtkNotebook *notebook, gint page_num); void gtk_notebook_next_page (GtkNotebook *notebook); void gtk_notebook_prev_page (GtkNotebook *notebook); @@ -152,22 +152,30 @@ void gtk_notebook_prev_page (GtkNotebook *notebook); * set Notebook, NotebookTab style * ***********************************************************/ -void gtk_notebook_set_show_border (GtkNotebook *notebook, - gboolean show_border); -void gtk_notebook_set_show_tabs (GtkNotebook *notebook, - gboolean show_tabs); -void gtk_notebook_set_tab_pos (GtkNotebook *notebook, - GtkPositionType pos); -void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook, - gboolean homogeneous); -void gtk_notebook_set_tab_border (GtkNotebook *notebook, - guint border_width); -void gtk_notebook_set_tab_hborder (GtkNotebook *notebook, - guint tab_hborder); -void gtk_notebook_set_tab_vborder (GtkNotebook *notebook, - guint tab_vborder); -void gtk_notebook_set_scrollable (GtkNotebook *notebook, - gboolean scrollable); +void gtk_notebook_set_show_border (GtkNotebook *notebook, + gboolean show_border); +gboolean gtk_notebook_get_show_border (GtkNotebook *notebook); +void gtk_notebook_set_show_tabs (GtkNotebook *notebook, + gboolean show_tabs); +gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook); +void gtk_notebook_set_tab_pos (GtkNotebook *notebook, + GtkPositionType pos); +GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook); + +#ifndef GTK_DISABLE_DEPRECATED +void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook, + gboolean homogeneous); +void gtk_notebook_set_tab_border (GtkNotebook *notebook, + guint border_width); +void gtk_notebook_set_tab_hborder (GtkNotebook *notebook, + guint tab_hborder); +void gtk_notebook_set_tab_vborder (GtkNotebook *notebook, + guint tab_vborder); +#endif /* GTK_DISABLE_DEPRECATED */ + +void gtk_notebook_set_scrollable (GtkNotebook *notebook, + gboolean scrollable); +gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook); /*********************************************************** * enable/disable PopupMenu * @@ -188,6 +196,8 @@ void gtk_notebook_set_tab_label (GtkNotebook *notebook, void gtk_notebook_set_tab_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *tab_text); +G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook, + GtkWidget *child); GtkWidget * gtk_notebook_get_menu_label (GtkNotebook *notebook, GtkWidget *child); void gtk_notebook_set_menu_label (GtkNotebook *notebook, @@ -196,6 +206,8 @@ void gtk_notebook_set_menu_label (GtkNotebook *notebook, void gtk_notebook_set_menu_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *menu_text); +G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook, + GtkWidget *child); void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook, GtkWidget *child, gboolean *expand, diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 373623e155..fb9e6297d6 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -129,7 +129,7 @@ gtk_radio_button_set_arg (GtkObject *object, case ARG_GROUP: if (GTK_VALUE_OBJECT (*arg)) - slist = gtk_radio_button_group ((GtkRadioButton*) GTK_VALUE_OBJECT (*arg)); + slist = gtk_radio_button_get_group ((GtkRadioButton*) GTK_VALUE_OBJECT (*arg)); else slist = NULL; gtk_radio_button_set_group (radio_button, slist); @@ -263,7 +263,7 @@ gtk_radio_button_new_from_widget (GtkRadioButton *group) { GSList *l = NULL; if (group) - l = gtk_radio_button_group (group); + l = gtk_radio_button_get_group (group); return gtk_radio_button_new (l); } @@ -274,7 +274,7 @@ gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group, { GSList *l = NULL; if (group) - l = gtk_radio_button_group (group); + l = gtk_radio_button_get_group (group); return gtk_radio_button_new_with_label (l, label); } @@ -295,12 +295,12 @@ gtk_radio_button_new_with_mnemonic_from_widget (GtkRadioButton *group, { GSList *l = NULL; if (group) - l = gtk_radio_button_group (group); + l = gtk_radio_button_get_group (group); return gtk_radio_button_new_with_mnemonic (l, label); } GSList* -gtk_radio_button_group (GtkRadioButton *radio_button) +gtk_radio_button_get_group (GtkRadioButton *radio_button) { g_return_val_if_fail (radio_button != NULL, NULL); g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_button), NULL); diff --git a/gtk/gtkradiobutton.h b/gtk/gtkradiobutton.h index 62b66f7440..81ecb36511 100644 --- a/gtk/gtkradiobutton.h +++ b/gtk/gtkradiobutton.h @@ -73,10 +73,14 @@ 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); -GSList* gtk_radio_button_group (GtkRadioButton *radio_button); +GSList* gtk_radio_button_get_group (GtkRadioButton *radio_button); void gtk_radio_button_set_group (GtkRadioButton *radio_button, GSList *group); +#ifndef GTK_DISABLE_DEPRECATED +#define gtk_radio_button_group gtk_radio_button_get_group +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 38e64b3d6f..1dde609d7e 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -431,6 +431,22 @@ gtk_range_set_update_policy (GtkRange *range, } /** + * gtk_range_get_update_policy: + * @range: a #GtkRange + * + * Gets the update policy of @range. See gtk_range_set_update_policy(). + * + * Return value: the current update policy + **/ +GtkUpdateType +gtk_range_get_update_policy (GtkRange *range) +{ + g_return_val_if_fail (GTK_IS_RANGE (range), GTK_UPDATE_CONTINUOUS); + + return range->update_policy; +} + +/** * gtk_range_set_adjustment: * @range: a #GtkRange * @adjustment: a #GtkAdjustment diff --git a/gtk/gtkrange.h b/gtk/gtkrange.h index e988d56e09..2bddb475a0 100644 --- a/gtk/gtkrange.h +++ b/gtk/gtkrange.h @@ -123,6 +123,7 @@ GtkType gtk_range_get_type (void) G_GNUC_CONST; void gtk_range_set_update_policy (GtkRange *range, GtkUpdateType policy); +GtkUpdateType gtk_range_get_update_policy (GtkRange *range); void gtk_range_set_adjustment (GtkRange *range, GtkAdjustment *adjustment); GtkAdjustment* gtk_range_get_adjustment (GtkRange *range); diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c index 65f7d74305..83b50731f7 100644 --- a/gtk/gtkruler.c +++ b/gtk/gtkruler.c @@ -239,6 +239,30 @@ gtk_ruler_set_metric (GtkRuler *ruler, gtk_widget_queue_draw (GTK_WIDGET (ruler)); } +/** + * gtk_ruler_get_metric: + * @ruler: a #GtkRuler + * + * Gets the units used for a #GtkRule . See gtk_ruler_set_metric(). + * + * Return value: the units currently used for @ruler + **/ +GtkMetricType +gtk_ruler_get_metric (GtkRuler *ruler) +{ + gint i; + + g_return_val_if_fail (GTK_IS_RULER (ruler), 0); + + for (i = 0; i < G_N_ELEMENTS (ruler_metrics); i++) + if (ruler->metric == &ruler_metrics[i]) + return i; + + g_assert_not_reached (); + + return 0; +} + void gtk_ruler_set_range (GtkRuler *ruler, gdouble lower, @@ -274,6 +298,37 @@ gtk_ruler_set_range (GtkRuler *ruler, gtk_widget_queue_draw (GTK_WIDGET (ruler)); } +/** + * gtk_ruler_get_range: + * @ruler: a #GtkRuler + * @lower: location to store lower limit of the ruler, or %NULL + * @upper: location to store upper limit of the ruler, or %NULL + * @position: location to store the current position of the mark on the ruler, or %NULL + * @max_size: location to store the maximum size of the ruler used when calculating + * the space to leave for the text, or %NULL. + * + * Retrieves values indicating the range and current position of a #GtkRuler. + * See gtk_ruler_set_range(). + **/ +void +gtk_ruler_get_range (GtkRuler *ruler, + gdouble *lower, + gdouble *upper, + gdouble *position, + gdouble *max_size) +{ + g_return_if_fail (GTK_IS_RULER (ruler)); + + if (lower) + *lower = ruler->lower; + if (upper) + *upper = ruler->upper; + if (position) + *position = ruler->position; + if (max_size) + *max_size = ruler->max_size; +} + void gtk_ruler_draw_ticks (GtkRuler *ruler) { diff --git a/gtk/gtkruler.h b/gtk/gtkruler.h index 472b1feac9..1b013b8149 100644 --- a/gtk/gtkruler.h +++ b/gtk/gtkruler.h @@ -113,6 +113,12 @@ void gtk_ruler_set_range (GtkRuler *ruler, void gtk_ruler_draw_ticks (GtkRuler *ruler); void gtk_ruler_draw_pos (GtkRuler *ruler); +GtkMetricType gtk_ruler_get_metric (GtkRuler *ruler); +void gtk_ruler_get_range (GtkRuler *ruler, + gdouble *lower, + gdouble *upper, + gdouble *position, + gdouble *max_size); #ifdef __cplusplus } diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index a9cb3e33cd..d71a5526dd 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -455,6 +455,28 @@ gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window, } } +/** + * gtk_scrolled_window_get_policy: + * @scrolled_window: a #GtkScrolledWindow + * @hscrollbar_policy: location to store the policy for the horizontal scrollbar, or %NULL. + * @vscrollbar_policy: location to store the policy for the horizontal scrollbar, or %NULL. + * + * Retrieves the current policy values for the horizontal and vertical + * scrollbars. See gtk_scrolled_window_set_policy(). + **/ +void +gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window, + GtkPolicyType *hscrollbar_policy, + GtkPolicyType *vscrollbar_policy) +{ + g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); + + if (hscrollbar_policy) + *hscrollbar_policy = scrolled_window->hscrollbar_policy; + if (vscrollbar_policy) + *vscrollbar_policy = scrolled_window->vscrollbar_policy; +} + void gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window, GtkCornerType window_placement) @@ -471,6 +493,23 @@ gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window, } /** + * gtk_scrolled_window_get_placement: + * @scrolled_window: a #GtkScrolledWindow + * + * Gets the placement of the scrollbars for the scrolled window. See + * gtk_scrolled_window_set_placement(). + * + * Return value: the current placement value. + **/ +GtkCornerType +gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window) +{ + g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), GTK_CORNER_TOP_LEFT); + + return scrolled_window->window_placement; +} + +/** * gtk_scrolled_window_set_shadow_type: * @scrolled_window: a #GtkScrolledWindow * @type: kind of shadow to draw around scrolled window contents @@ -497,6 +536,23 @@ gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window, } } +/** + * gtk_scrolled_window_get_shadow_type: + * @scrolled_window: a #GtkScrolledWindow + * + * Gets the shadow type of the scrolled window. See + * gtk_scrolled_window_set_shadow_type(). + * + * Return value: the current shadow type + **/ +GtkShadowType +gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window) +{ + g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_NONE); + + return scrolled_window->shadow_type; +} + static void gtk_scrolled_window_destroy (GtkObject *object) { diff --git a/gtk/gtkscrolledwindow.h b/gtk/gtkscrolledwindow.h index 4ba2452a6f..afae4414a5 100644 --- a/gtk/gtkscrolledwindow.h +++ b/gtk/gtkscrolledwindow.h @@ -87,10 +87,15 @@ GtkAdjustment* gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolle void gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy); +void gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window, + GtkPolicyType *hscrollbar_policy, + GtkPolicyType *vscrollvar_policy); void gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window, GtkCornerType window_placement); +GtkCornerType gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window); void gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window, GtkShadowType type); +GtkShadowType gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window); void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window, GtkWidget *child); diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 73816e7771..efbfdfc717 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1653,6 +1653,22 @@ gtk_spin_button_set_digits (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_digits: + * @spin_button: a #GtkSpinButton + * + * Fetches the precision of @spin_button. See gtk_spin_button_set_digits(). + * + * Returns: the current precision + **/ +guint +gtk_spin_button_get_digits (GtkSpinButton *spin_button) +{ + g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0); + + return spin_button->digits; +} + +/** * gtk_spin_button_set_increments: * @spin_button: a #GtkSpinButton * @step: increment applied for a button 1 press. @@ -1673,6 +1689,28 @@ gtk_spin_button_set_increments (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_increments: + * @psin_button: a #GtkSpinButton + * @step: location to store step increment, or %NULL + * @page: location to store page increment, or %NULL + * + * Gets the current step and page the increments used by @spin_button. See + * gtk_spin_button_set_increments(). + **/ +void +gtk_spin_button_get_increments (GtkSpinButton *spin_button, + gdouble *step, + gdouble *page) +{ + g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); + + if (step) + *step = spin_button->adjustment->step_increment; + if (page) + *page = spin_button->adjustment->page_increment; +} + +/** * gtk_spin_button_set_range: * @spin_button: a #GtkSpinButton * @min: minimum allowable value @@ -1703,6 +1741,28 @@ gtk_spin_button_set_range (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_range: + * @spin_button: a #GtkSpinButton + * @min: location to store minimum allowed value, or %NULL + * @max: location to store maximum allowed value, or %NULL + * + * Gets the range allowed for @spin_button. See + * gtk_spin_button_set_range(). + **/ +void +gtk_spin_button_get_range (GtkSpinButton *spin_button, + gdouble *min, + gdouble *max) +{ + g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); + + if (min) + *min = spin_button->adjustment->lower; + if (max) + *max = spin_button->adjustment->upper; +} + +/** * gtk_spin_button_get_value: * @spin_button: a #GtkSpinButton * @@ -1787,6 +1847,23 @@ gtk_spin_button_set_update_policy (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_update_policy: + * @spin_button: a #GtkSpinButton + * + * Gets the update behavior of a spin button. See + * gtk_spin_button_set_update_policy(). + * + * Return value: the current update policy + **/ +GtkSpinButtonUpdatePolicy +gtk_spin_button_get_update_policy (GtkSpinButton *spin_button) +{ + g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), GTK_UPDATE_ALWAYS); + + return spin_button->update_policy; +} + +/** * gtk_spin_button_set_numeric: * @spin_button: a #GtkSpinButton * @numeric: flag indicating if only numeric entry is allowed. @@ -1806,6 +1883,23 @@ gtk_spin_button_set_numeric (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_numeric: + * @spin_button: a #GtkSpinButton + * + * Returns whether non-numeric text can be typed into the spin button. + * See gtk_spin_button_set_numeric(). + * + * Return value: %TRUE if only numeric text can be entered + **/ +gboolean +gtk_spin_button_get_numeric (GtkSpinButton *spin_button) +{ + g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE); + + return spin_button->numeric; +} + +/** * gtk_spin_button_set_wrap: * @spin_button: a #GtkSpinButton * @wrap: a flag indicating if wrapping behavior is performed. @@ -1825,6 +1919,24 @@ gtk_spin_button_set_wrap (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_wrap: + * @spin_button: a #GtkSpinButton + * + * Returns whether the spin button's value wraps around to the + * opposite limit when the upper or lower limit of the range is + * exceeded. See gtk_spin_button_set_wrap(). + * + * Return value: %TRUE if the spin button wraps around + **/ +gboolean +gtk_spin_button_get_wrap (GtkSpinButton *spin_button) +{ + g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE); + + return spin_button->wrap; +} + +/** * spin_button_get_shadow_type: * @spin_button: a #GtkSpinButton * @@ -1872,6 +1984,23 @@ gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button, } /** + * gtk_spin_button_get_snap_to_ticks: + * @spin_button: a #GtkSpinButton + * + * Returns whether the values are corrected to the nearest step. See + * gtk_spin_button_set_snap_to_ticks(). + * + * Return value: %TRUE if values are snapped to the nearest step. + **/ +gboolean +gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button) +{ + g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE); + + return spin_button->snap_to_ticks; +} + +/** * gtk_spin_button_spin: * @spin_button: a #GtkSpinButton * @direction: a #GtkSpinType indicating the direction to spin. diff --git a/gtk/gtkspinbutton.h b/gtk/gtkspinbutton.h index b152ec3c38..d22c9c3bb3 100644 --- a/gtk/gtkspinbutton.h +++ b/gtk/gtkspinbutton.h @@ -132,14 +132,21 @@ GtkAdjustment* gtk_spin_button_get_adjustment (GtkSpinButton *spin_button); void gtk_spin_button_set_digits (GtkSpinButton *spin_button, guint digits); +guint gtk_spin_button_get_digits (GtkSpinButton *spin_button); void gtk_spin_button_set_increments (GtkSpinButton *spin_button, gdouble step, gdouble page); +void gtk_spin_button_get_increments (GtkSpinButton *spin_button, + gdouble *step, + gdouble *page); void gtk_spin_button_set_range (GtkSpinButton *spin_button, gdouble min, gdouble max); +void gtk_spin_button_get_range (GtkSpinButton *spin_button, + gdouble *min, + gdouble *max); gdouble gtk_spin_button_get_value (GtkSpinButton *spin_button); @@ -150,9 +157,11 @@ void gtk_spin_button_set_value (GtkSpinButton *spin_button, void gtk_spin_button_set_update_policy (GtkSpinButton *spin_button, GtkSpinButtonUpdatePolicy policy); +GtkSpinButtonUpdatePolicy gtk_spin_button_get_update_policy (GtkSpinButton *spin_button); void gtk_spin_button_set_numeric (GtkSpinButton *spin_button, gboolean numeric); +gboolean gtk_spin_button_get_numeric (GtkSpinButton *spin_button); void gtk_spin_button_spin (GtkSpinButton *spin_button, GtkSpinType direction, @@ -160,9 +169,11 @@ void gtk_spin_button_spin (GtkSpinButton *spin_button, void gtk_spin_button_set_wrap (GtkSpinButton *spin_button, gboolean wrap); +gboolean gtk_spin_button_get_wrap (GtkSpinButton *spin_button); void gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button, gboolean snap_to_ticks); +gboolean gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button); void gtk_spin_button_update (GtkSpinButton *spin_button); diff --git a/gtk/gtktable.c b/gtk/gtktable.c index aa7206390c..5a3ac537b5 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -661,6 +661,26 @@ gtk_table_set_row_spacing (GtkTable *table, g_object_notify (G_OBJECT (table), "row_spacing"); } +/** + * gtk_table_get_row_spacing: + * @table: a #GtkTable + * @row: a row in the table, 0 indicates the first row + * + * Gets the amount of space between row @row, and + * row @row + 1. See gtk_table_set_row_spacing(). + * + * Return value: the row spacing + **/ +guint +gtk_table_get_row_spacing (GtkTable *table, + guint row) +{ + g_return_val_if_fail (GTK_IS_TABLE (table), 0); + g_return_val_if_fail (row < table->nrows - 1, 0); + + return table->rows[row].spacing; +} + void gtk_table_set_col_spacing (GtkTable *table, guint column, @@ -681,6 +701,26 @@ gtk_table_set_col_spacing (GtkTable *table, g_object_notify (G_OBJECT (table), "column_spacing"); } +/** + * gtk_table_get_col_spacing: + * @table: a #GtkTable + * @col: a column in the table, 0 indicates the first column + * + * Gets the amount of space between column @col, and + * column @col + 1. See gtk_table_set_col_spacing(). + * + * Return value: the column spacing + **/ +guint +gtk_table_get_col_spacing (GtkTable *table, + guint column) +{ + g_return_val_if_fail (GTK_IS_TABLE (table), 0); + g_return_val_if_fail (column < table->ncols, 0); + + return table->cols[column].spacing; +} + void gtk_table_set_row_spacings (GtkTable *table, guint spacing) @@ -698,6 +738,24 @@ gtk_table_set_row_spacings (GtkTable *table, gtk_widget_queue_resize (GTK_WIDGET (table)); } +/** + * gtk_table_get_default_row_spacing: + * @table: a #GtkTable + * + * Gets the default row spacing for the table. This is + * the spacing that will be used for newly added rows. + * (See gtk_table_set_row_spacings()) + * + * Returns value: the default row spacing + **/ +guint +gtk_table_get_default_row_spacing (GtkTable *table) +{ + g_return_val_if_fail (GTK_IS_TABLE (table), 0); + + return table->row_spacing; +} + void gtk_table_set_col_spacings (GtkTable *table, guint spacing) @@ -715,6 +773,24 @@ gtk_table_set_col_spacings (GtkTable *table, gtk_widget_queue_resize (GTK_WIDGET (table)); } +/** + * gtk_table_get_default_col_spacing: + * @table: a #GtkTable + * + * Gets the default column spacing for the table. This is + * the spacing that will be used for newly added columns. + * (See gtk_table_set_col_spacings()) + * + * Returns value: the default column spacing + **/ +guint +gtk_table_get_default_col_spacing (GtkTable *table) +{ + g_return_val_if_fail (GTK_IS_TABLE (table), 0); + + return table->column_spacing; +} + void gtk_table_set_homogeneous (GtkTable *table, gboolean homogeneous) @@ -732,6 +808,23 @@ gtk_table_set_homogeneous (GtkTable *table, } } +/** + * gtk_table_get_homogeneous: + * @table: a #GtkTable + * + * Returns whether the table cells are all constrained to the same + * width and height. (See gtk_table_set_homogenous ()) + * + * Return value: %TRUE if the cells are all constrained to the same size + **/ +gboolean +gtk_table_get_homogeneous (GtkTable *table) +{ + g_return_val_if_fail (GTK_IS_TABLE (table), FALSE); + + return table->homogeneous; +} + static void gtk_table_finalize (GObject *object) { diff --git a/gtk/gtktable.h b/gtk/gtktable.h index 103f6d1929..e87aa356e4 100644 --- a/gtk/gtktable.h +++ b/gtk/gtktable.h @@ -125,15 +125,22 @@ void gtk_table_attach_defaults (GtkTable *table, void gtk_table_set_row_spacing (GtkTable *table, guint row, guint spacing); +guint gtk_table_get_row_spacing (GtkTable *table, + guint row); void gtk_table_set_col_spacing (GtkTable *table, guint column, guint spacing); +guint gtk_table_get_col_spacing (GtkTable *table, + guint column); void gtk_table_set_row_spacings (GtkTable *table, guint spacing); +guint gtk_table_get_default_row_spacing (GtkTable *table); void gtk_table_set_col_spacings (GtkTable *table, guint spacing); +guint gtk_table_get_default_col_spacing (GtkTable *table); void gtk_table_set_homogeneous (GtkTable *table, gboolean homogeneous); +gboolean gtk_table_get_homogeneous (GtkTable *table); #ifdef __cplusplus diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 603c47af92..e3feea10f1 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -363,6 +363,23 @@ gtk_text_layout_set_cursor_direction (GtkTextLayout *layout, } } +/** + * gtk_text_layout_get_buffer: + * @layout: a #GtkTextLayout + * + * Gets the text buffer used by the layout. See + * gtk_text_layout_set_buffer(). + * + * Return value: the text buffer used by the layout. + **/ +GtkTextBuffer * +gtk_text_layout_get_buffer (GtkTextLayout *layout) +{ + g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), NULL); + + return layout->buffer; +} + void gtk_text_layout_set_screen_width (GtkTextLayout *layout, gint width) { diff --git a/gtk/gtktextlayout.h b/gtk/gtktextlayout.h index 56ed1b5b83..1856aec1fa 100644 --- a/gtk/gtktextlayout.h +++ b/gtk/gtktextlayout.h @@ -245,18 +245,20 @@ struct _GtkTextLineDisplay extern PangoAttrType gtk_text_attr_appearance_type; GType gtk_text_layout_get_type (void) G_GNUC_CONST; -GtkTextLayout* gtk_text_layout_new (void); -void gtk_text_layout_set_buffer (GtkTextLayout *layout, - GtkTextBuffer *buffer); -void gtk_text_layout_set_default_style (GtkTextLayout *layout, - GtkTextAttributes *values); -void gtk_text_layout_set_contexts (GtkTextLayout *layout, - PangoContext *ltr_context, - PangoContext *rtl_context); -void gtk_text_layout_set_cursor_direction (GtkTextLayout *layout, - GtkTextDirection direction); -void gtk_text_layout_default_style_changed (GtkTextLayout *layout); - + +GtkTextLayout* gtk_text_layout_new (void); +void gtk_text_layout_set_buffer (GtkTextLayout *layout, + GtkTextBuffer *buffer); +GtkTextBuffer *gtk_text_layout_get_buffer (GtkTextLayout *layout); +void gtk_text_layout_set_default_style (GtkTextLayout *layout, + GtkTextAttributes *values); +void gtk_text_layout_set_contexts (GtkTextLayout *layout, + PangoContext *ltr_context, + PangoContext *rtl_context); +void gtk_text_layout_set_cursor_direction (GtkTextLayout *layout, + GtkTextDirection direction); +void gtk_text_layout_default_style_changed (GtkTextLayout *layout); + void gtk_text_layout_set_screen_width (GtkTextLayout *layout, gint width); void gtk_text_layout_set_preedit_string (GtkTextLayout *layout, diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index c90d2d0b58..2d7a7d1e9f 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -6043,12 +6043,52 @@ gtk_text_view_set_border_window_size (GtkTextView *text_view, break; default: - g_warning ("Can't set size of center or widget or private GtkTextWindowType in %s", G_STRLOC); + g_warning ("Can only set size of left/right/top/bottom border windows with gtk_text_view_set_border_window_size in %s\n", G_STRLOC); break; } } /** + * gtk_text_view_get_border_window_size: + * @text_view: a #GtkTextView + * @type: window to return size from + * + * Gets the width of the specified border window. See + * gtk_text_view_set_border_window_size(). + * + * Return value: width of window + **/ +gint +gtk_text_view_get_border_window_size (GtkTextView *text_view, + GtkTextWindowType type) +{ + g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), 0); + g_return_val_if_fail (type != GTK_TEXT_WINDOW_WIDGET, 0); + g_return_val_if_fail (type != GTK_TEXT_WINDOW_TEXT, 0); + + switch (type) + { + case GTK_TEXT_WINDOW_LEFT: + return text_view->left_window->requisition.width; + + case GTK_TEXT_WINDOW_RIGHT: + return text_view->right_window->requisition.width; + + case GTK_TEXT_WINDOW_TOP: + return text_view->top_window->requisition.height; + + case GTK_TEXT_WINDOW_BOTTOM: + return text_view->bottom_window->requisition.height; + + default: + g_warning ("Can only get size of left/right/top/bottom border windows with gtk_text_view_get_border_window_size in %s\n", G_STRLOC); + break; + } + + return 0; +} + +/** * gtk_text_view_set_text_window_size: * @text_view: a #GtkTextView * @width: a width in pixels diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h index 66165b3dbf..197f6db9a7 100644 --- a/gtk/gtktextview.h +++ b/gtk/gtktextview.h @@ -248,6 +248,8 @@ GtkTextWindowType gtk_text_view_get_window_type (GtkTextView *text_view, void gtk_text_view_set_border_window_size (GtkTextView *text_view, GtkTextWindowType type, gint size); +gint gtk_text_view_get_border_window_size (GtkTextView *text_view, + GtkTextWindowType type); void gtk_text_view_set_text_window_size (GtkTextView *text_view, gint width, gint height); diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index cd61047fae..f9f12a848c 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -333,6 +333,23 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button, } } +/** + * gtk_toggle_button_get_mode: + * @toggle_button: a #GtkToggleButton + * + * Retrieves whether the button is displayed as a separate indicator + * and label. See gtk_toggle_button_set_mode(). + * + * Return value: %TRUE if the togglebutton is drawn as a separate indicator + * and label. + **/ +gboolean +gtk_toggle_button_get_mode (GtkToggleButton *toggle_button) +{ + g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button), FALSE); + + return toggle_button->draw_indicator; +} void gtk_toggle_button_set_active (GtkToggleButton *toggle_button, diff --git a/gtk/gtktogglebutton.h b/gtk/gtktogglebutton.h index 40c8cd7b4b..c9f8226ada 100644 --- a/gtk/gtktogglebutton.h +++ b/gtk/gtktogglebutton.h @@ -74,6 +74,7 @@ GtkWidget* gtk_toggle_button_new_with_label (const gchar *label); GtkWidget* gtk_toggle_button_new_with_mnemonic (const gchar *label); void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button, gboolean draw_indicator); +gboolean gtk_toggle_button_get_mode (GtkToggleButton *toggle_button); void gtk_toggle_button_set_active (GtkToggleButton *toggle_button, gboolean is_active); gboolean gtk_toggle_button_get_active (GtkToggleButton *toggle_button); diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 9b5836410e..a04aee87df 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -1058,6 +1058,22 @@ gtk_toolbar_set_icon_size (GtkToolbar *toolbar, } /** + * gtk_toolbar_get_icon_size: + * @toolbar: a #GtkToolbar + * + * Retrieves the icon size fo the toolbar. See gtk_toolbar_set_icon_size(). + * + * Return value: the current icon size for the icons on the toolbar. + **/ +GtkIconSize +gtk_toolbar_get_icon_size (GtkToolbar *toolbar) +{ + g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_ICON_SIZE_LARGE_TOOLBAR); + + return toolbar->icon_size; +} + +/** * gtk_toolbar_unset_icon_size: * @toolbar: a #GtkToolbar * @@ -1377,7 +1393,7 @@ gtk_toolbar_internal_insert_element (GtkToolbar *toolbar, else { child->widget = gtk_radio_button_new (widget - ? gtk_radio_button_group (GTK_RADIO_BUTTON (widget)) + ? gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)) : NULL); gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE); @@ -1466,6 +1482,23 @@ gtk_toolbar_set_orientation (GtkToolbar *toolbar, gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation); } +/** + * gtk_toolbar_get_orientation: + * @toolbar: a #GtkToolbar + * + * Retrieves the current orientation of the toolbar. See + * gtk_toolbar_set_orientation(). + * + * Return value: the orientation + **/ +GtkOrientation +gtk_toolbar_get_orientation (GtkToolbar *toolbar) +{ + g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL); + + return toolbar->orientation; +} + void gtk_toolbar_set_style (GtkToolbar *toolbar, GtkToolbarStyle style) @@ -1477,6 +1510,23 @@ gtk_toolbar_set_style (GtkToolbar *toolbar, } /** + * gtk_toolbar_get_style: + * @toolbar: a #GtkToolbar + * + * Retrieves whether the toolbar has text, icons, or both . See + * gtk_toolbar_set_style(). + + * Return value: the current style of @toolbar + **/ +GtkToolbarStyle +gtk_toolbar_get_style (GtkToolbar *toolbar) +{ + g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH); + + return toolbar->style; +} + +/** * gtk_toolbar_unset_style: * @toolbar: a #GtkToolbar * @@ -1517,6 +1567,23 @@ gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gtk_tooltips_disable (toolbar->tooltips); } +/** + * gtk_toolbar_get_tooltips: + * @toolbar: a #GtkToolbar + * + * Retrieves whether tooltips are enabled. See + * gtk_toolbar_set_tooltips(). + * + * Return value: %TRUE if tooltips are enabled + **/ +gboolean +gtk_toolbar_get_tooltips (GtkToolbar *toolbar) +{ + g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), FALSE); + + return toolbar->tooltips->enabled; +} + static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar) { diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h index 62934110de..084ff25563 100644 --- a/gtk/gtktoolbar.h +++ b/gtk/gtktoolbar.h @@ -215,6 +215,11 @@ void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, void gtk_toolbar_unset_style (GtkToolbar *toolbar); void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar); +GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar); +GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar); +GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar); +gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 9355271631..8c35a71ec1 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -165,9 +165,9 @@ _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection, /** * gtk_tree_selection_set_mode: * @selection: A #GtkTreeSelection. - * @type: The selection type. + * @type: The selection mode * - * Sets the selection type of the @selection. If the previous type was + * Sets the selection mode of the @selection. If the previous type was * #GTK_TREE_SELECTION_MULTI and @type is #GTK_TREE_SELECTION_SINGLE, then * the anchor is kept selected, if it was previously selected. **/ @@ -219,6 +219,23 @@ gtk_tree_selection_set_mode (GtkTreeSelection *selection, } /** + * gtk_tree_selection_get_mode: + * @selection: a #GtkTreeSelection + * + * Gets the selection mode for @selection. See + * gtk_tree_selection_set_mode(). + * + * Return value: the current selection mode + **/ +GtkTreeSelectionMode +gtk_tree_selection_get_mode (GtkTreeSelection *selection) +{ + g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), GTK_TREE_SELECTION_SINGLE); + + return selection->type; +} + +/** * gtk_tree_selection_set_select_function: * @selection: A #GtkTreeSelection. * @func: The selection function. diff --git a/gtk/gtktreeselection.h b/gtk/gtktreeselection.h index f89f96948d..0d9351677f 100644 --- a/gtk/gtktreeselection.h +++ b/gtk/gtktreeselection.h @@ -73,6 +73,7 @@ GtkType gtk_tree_selection_get_type (void); void gtk_tree_selection_set_mode (GtkTreeSelection *selection, GtkTreeSelectionMode type); +GtkTreeSelectionMode gtk_tree_selection_get_mode (GtkTreeSelection *selection); void gtk_tree_selection_set_select_function (GtkTreeSelection *selection, GtkTreeSelectionFunc func, gpointer data, diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 03fa2003a7..2466b9cc8a 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -7317,6 +7317,24 @@ static GtkTargetEntry row_targets[] = { { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 } }; + +/** + * gtk_tree_view_get_reorderable: + * @tree_view: a #GtkTreeView + * + * Retrieves whether the user can reorder the tree via drag-and-drop. See + * gtk_tree_view_set_reorderable(). + * + * Return value: %TRUE if the tree can be reordered. + **/ +gboolean +gtk_tree_view_get_reorderable (GtkTreeView *tree_view) +{ + g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE); + + return tree_view->priv->reorderable; +} + /** * gtk_tree_view_set_reorderable: * @tree_view: A #GtkTreeView. diff --git a/gtk/gtktreeview.h b/gtk/gtktreeview.h index 68e6311cdf..b459677a91 100644 --- a/gtk/gtktreeview.h +++ b/gtk/gtktreeview.h @@ -207,6 +207,7 @@ gboolean gtk_tree_view_row_expanded (GtkTreeView GtkTreePath *path); void gtk_tree_view_set_reorderable (GtkTreeView *tree_view, gboolean reorderable); +gboolean gtk_tree_view_get_reorderable (GtkTreeView *tree_view); void gtk_tree_view_set_cursor (GtkTreeView *tree_view, GtkTreePath *path); diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index c67850cf09..4e71b33f13 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -1748,8 +1748,9 @@ gtk_tree_view_column_get_reorderable (GtkTreeViewColumn *tree_column) * @tree_column: a #GtkTreeViewColumn * @sort_column_id: The sort_column_id of the model to sort on. * - * Sets the sort_column_id that the column sorts on. Doing so makes headers - * clickable. + * Sets the logical sort_column_id that this column sorts on when this + * column is selected for sorting. Doing so makes + * the column header clickable. **/ void gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column, @@ -1795,6 +1796,24 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column, } /** + * gtk_tree_view_column_get_sort_column_id: + * @tree_column: a #GtkTreeViewColumn + * + * Gets the logical sort_column_id that the model sorts on when this + * coumn is selected for sorting. See gtk_tree_view_column_set_sort_column_id(). + * + * Return value: the current sort_column_id for this column, or -1 if + * this column can't be used for sorting. + **/ +gint +gtk_tree_view_column_get_sort_column_id (GtkTreeViewColumn *tree_column) +{ + g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0); + + return tree_column->sort_column_id; +} + +/** * gtk_tree_view_column_set_sort_indicator: * @tree_column: a #GtkTreeViewColumn * @setting: %TRUE to display an indicator that the column is sorted diff --git a/gtk/gtktreeviewcolumn.h b/gtk/gtktreeviewcolumn.h index db320c6239..8a83488820 100644 --- a/gtk/gtktreeviewcolumn.h +++ b/gtk/gtktreeviewcolumn.h @@ -167,6 +167,7 @@ gboolean gtk_tree_view_column_get_reorderable (GtkTreeViewCol */ void gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column, gint sort_column_id); +gint gtk_tree_view_column_get_sort_column_id (GtkTreeViewColumn *tree_column); void gtk_tree_view_column_set_sort_indicator (GtkTreeViewColumn *tree_column, gboolean setting); gboolean gtk_tree_view_column_get_sort_indicator (GtkTreeViewColumn *tree_column); diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 34dd90c807..eedc6a6114 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -400,6 +400,22 @@ gtk_viewport_set_shadow_type (GtkViewport *viewport, g_object_notify (G_OBJECT (viewport), "shadow_type"); } +/** + * gtk_viewport_get_shadow_type: + * @viewport: a #GtkViewport + * + * Gets the shadow type of the #GtkViewport. See + * gtk_viewport_set_shadow_type(). + + * Return value: the shadow type + **/ +GtkShadowType +gtk_viewport_get_shadow_type (GtkViewport *viewport) +{ + g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), GTK_SHADOW_NONE); + + return viewport->shadow_type; +} static void gtk_viewport_map (GtkWidget *widget) diff --git a/gtk/gtkviewport.h b/gtk/gtkviewport.h index 611369ab61..a0b6ce6587 100644 --- a/gtk/gtkviewport.h +++ b/gtk/gtkviewport.h @@ -81,6 +81,7 @@ void gtk_viewport_set_vadjustment (GtkViewport *viewport, GtkAdjustment *adjustment); void gtk_viewport_set_shadow_type (GtkViewport *viewport, GtkShadowType type); +GtkShadowType gtk_viewport_get_shadow_type (GtkViewport *viewport); #ifdef __cplusplus diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 8dee437829..c0826d7c27 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -3415,6 +3415,22 @@ gtk_widget_set_parent (GtkWidget *widget, g_object_notify (G_OBJECT (widget), "parent"); } +/** + * gtk_widget_get_parent: + * @widget: a #GtkWidget + * + * Returns the parent container of @widget. + * + * Return value: the parent container of @widget, or %NULL + **/ +GtkWidget * +gtk_widget_get_parent (GtkWidget *widget) +{ + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + + return widget->parent; +} + /***************************************** * Widget styles * see docs/styles.txt @@ -4400,6 +4416,36 @@ gtk_widget_set_usize (GtkWidget *widget, } /** + * gtk_widget_get_usize: + * @widget: a #GtkWidget + * @width: location to store the width, or %NULL + * @height: location to store the height, or %NULL + * + * Gets the size that has explicitely set for the widget to request, + * if any. A value of -1 stored in @width or @height indicates that + * that dimension has not been set explicitely and the natural + * requisition of the widget will be used intead. See + * gtk_widget_set_usize(). + **/ +void +gtk_widget_get_usize (GtkWidget *widget, + gint *width, + gint *height) +{ + GtkWidgetAuxInfo *aux_info; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + aux_info = _gtk_widget_get_aux_info (widget, FALSE); + + if (width) + *width = aux_info ? aux_info->width : -1; + + if (height) + *height = aux_info ? aux_info->height : -1; +} + +/** * gtk_widget_set_events: * @widget: a #GtkWidget * @events: event mask diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index e78b1edf5d..597a385df7 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -538,6 +538,7 @@ void gtk_widget_set_parent (GtkWidget *widget, GtkWidget *parent); void gtk_widget_set_parent_window (GtkWidget *widget, GdkWindow *parent_window); +GtkWidget *gtk_widget_get_parent (GtkWidget *widget); GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget); gboolean gtk_widget_child_focus (GtkWidget *widget, GtkDirectionType direction); @@ -547,6 +548,9 @@ void gtk_widget_set_uposition (GtkWidget *widget, void gtk_widget_set_usize (GtkWidget *widget, gint width, gint height); +void gtk_widget_get_usize (GtkWidget *widget, + gint *width, + gint *height); void gtk_widget_set_events (GtkWidget *widget, gint events); void gtk_widget_add_events (GtkWidget *widget, diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index bd41cc5b07..dd6d54ec71 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -741,6 +741,24 @@ gtk_window_set_title (GtkWindow *window, } /** + * gtk_window_get_title: + * @window: a #GtkWindow + * + * Retrieves the title of the window. See gtk_window_set_title(). + * + * Return value: the title of the window, or %NULL if none has + * been set explicitely. The returned string is owned by the widget + * and must not be modified or freed. + **/ +G_CONST_RETURN gchar * +gtk_window_get_title (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), NULL); + + return window->title; +} + +/** * gtk_window_set_wmclass: * @window: a #GtkWindow * @wmclass_name: window name hint @@ -807,6 +825,25 @@ gtk_window_set_role (GtkWindow *window, } /** + * gtk_window_get_role: + * @window: a #GtkWindow + * + * Returns the role of the window. See gtk_window_set_role() for + * further explanation. + * + * Return value: the role of the window if set, or %NULL. The + * returned is owned by the widget and must not be modified + * or freed. + **/ +G_CONST_RETURN gchar * +gtk_window_get_role (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), NULL); + + return window->wm_role; +} + +/** * gtk_window_set_focus: * @window: a #GtkWindow * @focus: widget to be the new focus widget @@ -1044,6 +1081,24 @@ gtk_window_set_mnemonic_modifier (GtkWindow *window, window->mnemonic_modifier = modifier; } +/** + * gtk_window_get_mnemonic_modifier: + * @window: a #GtkWindow + * + * Returns the mnemonic modifier for this window. See + * gtk_window_set_mnemonic_modifier(). + * + * Return value: the modifier mask used to activate + * mnemonics on this window. + **/ +GdkModifierType +gtk_window_get_mnemonic_modifier (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), 0); + + return window->mnemonic_modifier; +} + void gtk_window_set_position (GtkWindow *window, GtkWindowPosition position) @@ -1126,6 +1181,23 @@ gtk_window_set_modal (GtkWindow *window, } /** + * gtk_window_get_modal: + * @window: a #GtkWindow + * + * Returns whether the window is modal. See gtk_window_set_modal(). + * + * Return value: %TRUE if the window is set to be modal and + * establishes a grab when shown + **/ +gboolean +gtk_window_get_modal (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); + + return window->modal; +} + +/** * gtk_window_list_toplevels: * * Returns a list of all existing toplevel windows. The widgets @@ -1369,6 +1441,24 @@ gtk_window_set_transient_for (GtkWindow *window, } /** + * gtk_window_get_transient_for: + * @window: a #GtkWindow + * + * Fetches the transient parent for this window. See + * gtk_window_set_transient_for(). + * + * Return value: the transient parent for this window, or %NULL + * if no transient parent has been set. + **/ +GtkWindow * +gtk_window_get_transient_for (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), NULL); + + return window->transient_parent; +} + +/** * gtk_window_set_type_hint: * @window: a #GtkWindow * @hint: the window type @@ -1393,6 +1483,22 @@ gtk_window_set_type_hint (GtkWindow *window, } /** + * gtk_window_get_type_hint: + * @window: a #GtkWindow + * + * Gets the type hint for this window. See gtk_window_set_type_hint(). + * + * Return value: the type hint for @window. + **/ +GdkWindowTypeHint +gtk_window_get_type_hint (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL); + + return window->type_hint; +} + +/** * gtk_window_set_destroy_with_parent: * @window: a #GtkWindow * @setting: whether to destroy @window with its transient parent @@ -1425,6 +1531,23 @@ gtk_window_set_destroy_with_parent (GtkWindow *window, g_object_notify (G_OBJECT (window), "destroy_with_parent"); } +/** + * gtk_window_get_destroy_with_parent: + * @window: a #GtkWindow + * + * Returns whether the window will be destroyed with its transient parent. See + * gtk_window_set_destroy_with_parent (). + * + * Return value: %TRUE if the window will be destroyed with its transient parent. + **/ +gboolean +gtk_window_get_destroy_with_parent (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); + + return window->destroy_with_parent; +} + static GtkWindowGeometryInfo* gtk_window_get_geometry_info (GtkWindow *window, gboolean create) @@ -1528,6 +1651,23 @@ gtk_window_set_decorated (GtkWindow *window, } /** + * gtk_window_get_decorated: + * @window: a #GtkWindow + * + * Returns whether the window has been set to have decorations + * such as a title bar via gtk_window_set_decorated(). + * + * Return value: %TRUE if the window has been set to have decorations + **/ +gboolean +gtk_window_get_decorated (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), TRUE); + + return window->decorated; +} + +/** * gtk_window_set_default_size: * @window: a #GtkWindow * @width: width in pixels, 0 to unset, or -1 to leave the width unchanged @@ -1580,6 +1720,35 @@ gtk_window_set_default_size (GtkWindow *window, gtk_widget_queue_resize (GTK_WIDGET (window)); } + +/** + * gtk_window_get_default_size: + * @window: a #GtkWindow + * @width: location to store the default width, or %NULL + * @height: location to store the default height, or %NULL + * + * Gets the default size of the window. A value of 0 for the + * width or height indicates that a default size has not + * been explicitely set for that dimension, so the value + * will be computed from the requisition of the window. + **/ +void +gtk_window_get_default_size (GtkWindow *window, + gint *width, + gint *height) +{ + GtkWindowGeometryInfo *info; + + g_return_if_fail (GTK_IS_WINDOW (window)); + + info = gtk_window_get_geometry_info (window, FALSE); + + if (width) + *width = info ? info->width : 0; + + if (height) + *height = info ? info->height : 0; +} static void gtk_window_destroy (GtkObject *object) @@ -3100,7 +3269,7 @@ gtk_window_expose (GtkWidget *widget, * * If this function is called on a window with setting of TRUE, before * it is realized or showed, it will have a "frame" window around - * widget-window, accessible in window->frame. Using the signal + * widget->window, accessible in window->frame. Using the signal * frame_event you can recieve all events targeted at the frame. * * This function is used by the linux-fb port to implement managed @@ -3119,6 +3288,24 @@ gtk_window_set_has_frame (GtkWindow *window, } /** + * gtk_window_get_has_frame: + * @window: a #GtkWindow + * + * Returns whether the window has a frame window exterior to + * widget->window. See gtk_window_set_has_frame (). + * + * Return value: %TRUE if a frame has been added to the window + * via gtk_widow_has_frame + **/ +gboolean +gtk_window_get_has_frame (GtkWindow *window) +{ + g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); + + return window->has_frame; +} + +/** * gtk_window_set_frame_dimensions: * @window: a #GtkWindow that has a frame * @left: The width of the left border @@ -3569,6 +3756,35 @@ gtk_window_begin_resize_drag (GtkWindow *window, timestamp); } +/** + * gtk_window_get_frame_dimensions: + * @window: a #GtkWindow + * @left: location to store the width of the frame at the left, or %NULL + * @top: location to store the height of the frame at the top, or %NULL + * @right: location to store the width of the frame at the returns, or %NULL + * @bottom: location to store the height of the frame at the bottom, or %NULL + * + * Retrieves the dimensions of the frame window for this toplevel. + * See gtk_window_set_has_frame(), gtk_window_set_frame_dimensions(). + **/ +void +gtk_window_get_frame_dimensions (GtkWindow *window, + gint *left, + gint *top, + gint *right, + gint *bottom) +{ + g_return_if_fail (GTK_IS_WINDOW (window)); + + if (left) + *left = window->frame_left; + if (top) + *top = window->frame_top; + if (right) + *top = window->frame_right; + if (bottom) + *top = window->frame_bottom; +} /** * gtk_window_begin_move_drag: diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h index 8c849e549b..8b7b5c3c02 100644 --- a/gtk/gtkwindow.h +++ b/gtk/gtkwindow.h @@ -149,11 +149,13 @@ GtkType gtk_window_get_type (void) G_GNUC_CONST; GtkWidget* gtk_window_new (GtkWindowType type); void gtk_window_set_title (GtkWindow *window, const gchar *title); +G_CONST_RETURN gchar *gtk_window_get_title (GtkWindow *window); void gtk_window_set_wmclass (GtkWindow *window, const gchar *wmclass_name, const gchar *wmclass_class); void gtk_window_set_role (GtkWindow *window, const gchar *role); +G_CONST_RETURN gchar *gtk_window_get_role (GtkWindow *window); void gtk_window_add_accel_group (GtkWindow *window, GtkAccelGroup *accel_group); void gtk_window_remove_accel_group (GtkWindow *window, @@ -165,10 +167,13 @@ gboolean gtk_window_activate_default (GtkWindow *window); void gtk_window_set_transient_for (GtkWindow *window, GtkWindow *parent); +GtkWindow *gtk_window_get_transient_for (GtkWindow *window); void gtk_window_set_type_hint (GtkWindow *window, GdkWindowTypeHint hint); +GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window); void gtk_window_set_destroy_with_parent (GtkWindow *window, gboolean setting); +gboolean gtk_window_get_destroy_with_parent (GtkWindow *window); void gtk_window_set_resizeable (GtkWindow *window, gboolean resizeable); @@ -187,18 +192,25 @@ void gtk_window_set_geometry_hints (GtkWindow *window, /* gtk_window_set_has_frame () must be called before realizing the window_*/ void gtk_window_set_has_frame (GtkWindow *window, gboolean setting); +gboolean gtk_window_get_has_frame (GtkWindow *window); void gtk_window_set_frame_dimensions (GtkWindow *window, gint left, gint top, gint right, gint bottom); - -void gtk_window_set_decorated (GtkWindow *window, - gboolean setting); +void gtk_window_get_frame_dimensions (GtkWindow *window, + gint *left, + gint *top, + gint *right, + gint *bottom); +void gtk_window_set_decorated (GtkWindow *window, + gboolean setting); +gboolean gtk_window_get_decorated (GtkWindow *window); /* If window is set modal, input will be grabbed when show and released when hide */ void gtk_window_set_modal (GtkWindow *window, gboolean modal); +gboolean gtk_window_get_modal (GtkWindow *window); GList* gtk_window_list_toplevels (void); void gtk_window_add_mnemonic (GtkWindow *window, @@ -212,6 +224,7 @@ gboolean gtk_window_mnemonic_activate (GtkWindow *window, GdkModifierType modifier); void gtk_window_set_mnemonic_modifier (GtkWindow *window, GdkModifierType modifier); +GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window); void gtk_window_present (GtkWindow *window); void gtk_window_iconify (GtkWindow *window); @@ -246,6 +259,9 @@ void gtk_window_set_policy (GtkWindow *window, void gtk_window_set_default_size (GtkWindow *window, gint width, gint height); +void gtk_window_get_default_size (GtkWindow *window, + gint *width, + gint *height); /* Window groups */ diff --git a/tests/testgtk.c b/tests/testgtk.c index 4c7d54c9ee..53bc477ccd 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -444,18 +444,18 @@ create_radio_buttons (void) gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); button = gtk_radio_button_new_with_label ( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button2"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); button = gtk_radio_button_new_with_label ( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button3"); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); button = gtk_radio_button_new_with_label ( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "inconsistent"); gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); @@ -1424,17 +1424,17 @@ create_tree_mode_window(void) gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); sTreeSampleSelection.single_button = button; - button = gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + button = gtk_radio_button_new_with_label(gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "BROWSE"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); sTreeSampleSelection.browse_button = button; - button = gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + button = gtk_radio_button_new_with_label(gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "MULTIPLE"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); sTreeSampleSelection.multiple_button = button; - sTreeSampleSelection.selection_mode_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + sTreeSampleSelection.selection_mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); /* create option mode frame */ frame = gtk_frame_new("Options"); |