* do this by setting a flag, then propagating the focus motion to the notebook.
*/
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (notebook));
- if (!GTK_WIDGET_TOPLEVEL (toplevel))
+ if (!gtk_widget_is_toplevel (toplevel))
return;
g_object_ref (notebook);
notebook = GTK_NOTEBOOK (widget);
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
- if (notebook->cur_page &&
+ if (notebook->cur_page &&
GTK_WIDGET_VISIBLE (notebook->cur_page->child) &&
!GTK_WIDGET_MAPPED (notebook->cur_page->child))
gtk_widget_map (notebook->cur_page->child);
- if (notebook->show_tabs)
- {
- for (i = 0; i < 2; i++)
+ for (i = 0; i < N_ACTION_WIDGETS; i++)
{
if (priv->action_widget[i] &&
GTK_WIDGET_VISIBLE (priv->action_widget[i]) &&
+ GTK_WIDGET_CHILD_VISIBLE (priv->action_widget[i]) &&
!GTK_WIDGET_MAPPED (priv->action_widget[i]))
gtk_widget_map (priv->action_widget[i]);
}
- }
-
+
if (notebook->scrollable)
gtk_notebook_pages_allocate (notebook);
else
gint tab_max = 0;
gint padding;
gint i;
+ gint action_width = 0;
+ gint action_height = 0;
for (children = notebook->children; children;
children = children->next)
widget->requisition.width < tab_width)
tab_width = tab_max + 2 * (scroll_arrow_hlength + arrow_spacing);
+ action_width += action_widget_requisition[ACTION_WIDGET_START].width;
+ action_width += action_widget_requisition[ACTION_WIDGET_END].width;
if (notebook->homogeneous && !notebook->scrollable)
widget->requisition.width = MAX (widget->requisition.width,
vis_pages * tab_max +
- tab_overlap);
+ tab_overlap + action_width);
else
widget->requisition.width = MAX (widget->requisition.width,
- tab_width + tab_overlap);
+ tab_width + tab_overlap + action_width);
- widget->requisition.width += action_widget_requisition[ACTION_WIDGET_START].width;
- widget->requisition.width += action_widget_requisition[ACTION_WIDGET_END].width;
widget->requisition.height += tab_height;
break;
case GTK_POS_LEFT:
if (notebook->scrollable && vis_pages > 1 &&
widget->requisition.height < tab_height)
tab_height = tab_max + (2 * scroll_arrow_vlength + arrow_spacing);
+ action_height += action_widget_requisition[ACTION_WIDGET_START].height;
+ action_height += action_widget_requisition[ACTION_WIDGET_END].height;
if (notebook->homogeneous && !notebook->scrollable)
widget->requisition.height =
MAX (widget->requisition.height,
- vis_pages * tab_max + tab_overlap);
+ vis_pages * tab_max + tab_overlap + action_height);
else
widget->requisition.height =
MAX (widget->requisition.height,
- tab_height + tab_overlap);
+ tab_height + tab_overlap + action_height);
if (!notebook->homogeneous || notebook->scrollable)
vis_pages = 1;
vis_pages * tab_max +
tab_overlap);
- widget->requisition.height += action_widget_requisition[ACTION_WIDGET_START].height;
- widget->requisition.height += action_widget_requisition[ACTION_WIDGET_END].height;
widget->requisition.width += tab_width;
break;
}
*/
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
- if (toplevel && GTK_WIDGET_TOPLEVEL (toplevel))
+ if (toplevel && gtk_widget_is_toplevel (toplevel))
{
page_child = GTK_WINDOW (toplevel)->focus_widget;
while (page_child)
}
}
- for (i = 0; i < N_ACTION_WIDGETS; i++)
- {
- if (priv->action_widget[i])
- (* callback) (priv->action_widget[i], callback_data);
- }
+ if (include_internals) {
+ for (i = 0; i < N_ACTION_WIDGETS; i++)
+ {
+ if (priv->action_widget[i])
+ (* callback) (priv->action_widget[i], callback_data);
+ }
+ }
}
static GType
remaining_space, STEP_NEXT);
}
- if (tab_space <= 0 || *remaining_space < 0)
+ if (tab_space <= 0 || *remaining_space <= 0)
{
/* show 1 tab */
notebook->first_tab = notebook->focus_tab;
* gtk_notebook_append_page:
* @notebook: a #GtkNotebook
* @child: the #GtkWidget to use as the contents of the page.
- * @tab_label: the #GtkWidget to be used as the label for the page,
+ * @tab_label: (allow-none): the #GtkWidget to be used as the label for the page,
* or %NULL to use the default label, 'page N'.
- *
+ *
* Appends a page to @notebook.
*
* Return value: the index (starting from 0) of the appended
* gtk_notebook_append_page_menu:
* @notebook: a #GtkNotebook
* @child: the #GtkWidget to use as the contents of the page.
- * @tab_label: the #GtkWidget to be used as the label for the page,
+ * @tab_label: (allow-none): the #GtkWidget to be used as the label for the page,
* or %NULL to use the default label, 'page N'.
- * @menu_label: the widget to use as a label for the page-switch
+ * @menu_label: (allow-none): the widget to use as a label for the page-switch
* menu, if that is enabled. If %NULL, and @tab_label
* is a #GtkLabel or %NULL, then the menu label will be
* a newly created label with the same text as @tab_label;
* gtk_notebook_prepend_page:
* @notebook: a #GtkNotebook
* @child: the #GtkWidget to use as the contents of the page.
- * @tab_label: the #GtkWidget to be used as the label for the page,
+ * @tab_label: (allow-none): the #GtkWidget to be used as the label for the page,
* or %NULL to use the default label, 'page N'.
*
* Prepends a page to @notebook.
* gtk_notebook_prepend_page_menu:
* @notebook: a #GtkNotebook
* @child: the #GtkWidget to use as the contents of the page.
- * @tab_label: the #GtkWidget to be used as the label for the page,
+ * @tab_label: (allow-none): the #GtkWidget to be used as the label for the page,
* or %NULL to use the default label, 'page N'.
- * @menu_label: the widget to use as a label for the page-switch
+ * @menu_label: (allow-none): the widget to use as a label for the page-switch
* menu, if that is enabled. If %NULL, and @tab_label
* is a #GtkLabel or %NULL, then the menu label will be
* a newly created label with the same text as @tab_label;
* gtk_notebook_insert_page:
* @notebook: a #GtkNotebook
* @child: the #GtkWidget to use as the contents of the page.
- * @tab_label: the #GtkWidget to be used as the label for the page,
+ * @tab_label: (allow-none): the #GtkWidget to be used as the label for the page,
* or %NULL to use the default label, 'page N'.
* @position: the index (starting at 0) at which to insert the page,
* or -1 to append the page after all other pages.
- *
+ *
* Insert a page into @notebook at the given position.
*
* Return value: the index (starting from 0) of the inserted
* gtk_notebook_insert_page_menu:
* @notebook: a #GtkNotebook
* @child: the #GtkWidget to use as the contents of the page.
- * @tab_label: the #GtkWidget to be used as the label for the page,
+ * @tab_label: (allow-none): the #GtkWidget to be used as the label for the page,
* or %NULL to use the default label, 'page N'.
- * @menu_label: the widget to use as a label for the page-switch
+ * @menu_label: (allow-none): the widget to use as a label for the page-switch
* menu, if that is enabled. If %NULL, and @tab_label
* is a #GtkLabel or %NULL, then the menu label will be
* a newly created label with the same text as @tab_label;
* to get the last page.
*
* Returns the child widget contained in page number @page_num.
- *
- * Return value: the child widget, or %NULL if @page_num is
+ *
+ * Return value: (transfer none): the child widget, or %NULL if @page_num is
* out of bounds.
**/
GtkWidget*
gtk_notebook_set_show_tabs (GtkNotebook *notebook,
gboolean show_tabs)
{
+ GtkNotebookPrivate *priv;
GtkNotebookPage *page;
GList *children;
+ gint i;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
+ priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
+
show_tabs = show_tabs != FALSE;
if (notebook->show_tabs == show_tabs)
if (!show_tabs)
{
GTK_WIDGET_UNSET_FLAGS (notebook, GTK_CAN_FOCUS);
-
+
while (children)
{
page = children->data;
GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
gtk_notebook_update_labels (notebook);
}
+
+ for (i = 0; i < N_ACTION_WIDGETS; i++)
+ {
+ if (priv->action_widget[i])
+ gtk_widget_set_child_visible (priv->action_widget[i], show_tabs);
+ }
+
gtk_widget_queue_resize (GTK_WIDGET (notebook));
g_object_notify (G_OBJECT (notebook), "show-tabs");
* Returns the tab label widget for the page @child. %NULL is returned
* if @child is not in @notebook or if no tab label has specifically
* been set for @child.
- *
- * Return value: the tab label
+ *
+ * Return value: (transfer none): the tab label
**/
GtkWidget *
gtk_notebook_get_tab_label (GtkNotebook *notebook,
* gtk_notebook_set_tab_label:
* @notebook: a #GtkNotebook
* @child: the page
- * @tab_label: the tab label widget to use, or %NULL for default tab
+ * @tab_label: (allow-none): the tab label widget to use, or %NULL for default tab
* label.
- *
+ *
* Changes the tab label for @child. If %NULL is specified
* for @tab_label, then the page will have the label 'page N'.
**/
* gtk_notebook_set_menu_label:
* @notebook: a #GtkNotebook
* @child: the child widget
- * @menu_label: the menu label, or NULL for default
- *
- * Changes the menu label for the page containing @child.
+ * @menu_label: (allow-none): the menu label, or NULL for default
+ *
+ * Changes the menu label for the page containing @child.
**/
void
gtk_notebook_set_menu_label (GtkNotebook *notebook,
* containing @child. See gtk_box_pack_start() for the exact meaning
* of the parameters.
*
- * Deprecated: 2.20: Modify the expand and fill child properties instead.
+ * Deprecated: 2.20: Modify the #GtkNotebook:tab-expand and
+ * #GtkNotebook:tab-fill child properties instead.
**/
void
gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
* Query the packing attributes for the tab label of the page
* containing @child.
*
- * Deprecated: 2.20: Modify the expand and fill child properties instead.
+ * Deprecated: 2.20: Modify the #GtkNotebook:tab-expand and
+ * #GtkNotebook:tab-fill child properties instead.
**/
void
gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
/**
* gtk_notebook_set_window_creation_hook:
- * @func: the #GtkNotebookWindowCreationFunc, or %NULL
+ * @func: (allow-none): the #GtkNotebookWindowCreationFunc, or %NULL
* @data: user data for @func
- * @destroy: Destroy notifier for @data, or %NULL
+ * @destroy: (allow-none): Destroy notifier for @data, or %NULL
*
* Installs a global function used to create a window
* when a detached tab is dropped in an empty area.
/**
* gtk_notebook_set_group:
* @notebook: a #GtkNotebook
- * @group: a pointer to identify the notebook group, or %NULL to unset it
+ * @group: (allow-none): a pointer to identify the notebook group, or %NULL to unset it
*
* Sets a group identificator pointer for @notebook, notebooks sharing
* the same group identificator pointer will be able to exchange tabs
* the widget will be placed before or after the tabs. You can use
* a #GtkBox if you need to pack more than one widget on the same side.
*
+ * Note that action widgets are "internal" children of the notebook and thus
+ * not included in the list returned from gtk_container_foreach().
+ *
* Since: 2.20
*/
void
if (widget)
{
+ gtk_widget_set_child_visible (widget, notebook->show_tabs);
gtk_widget_set_parent (widget, GTK_WIDGET (notebook));
-
- if (GTK_WIDGET_REALIZED (GTK_WIDGET (notebook)))
- gtk_widget_realize (widget);
}
gtk_widget_queue_resize (GTK_WIDGET (notebook));