1997-12-19 21:14:44 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
* GtkToolbar copyright (C) Federico Mena
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-12-19 21:14:44 +00:00
|
|
|
*/
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-12-22 21:32:24 +00:00
|
|
|
#include "gtkbutton.h"
|
1998-02-23 20:48:46 +00:00
|
|
|
#include "gtktogglebutton.h"
|
|
|
|
#include "gtkradiobutton.h"
|
1997-12-22 21:32:24 +00:00
|
|
|
#include "gtklabel.h"
|
|
|
|
#include "gtkvbox.h"
|
1997-12-19 21:14:44 +00:00
|
|
|
#include "gtktoolbar.h"
|
|
|
|
|
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
#define DEFAULT_SPACE_SIZE 5
|
|
|
|
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_EMPTY
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
#define SPACE_LINE_DIVISION 10
|
|
|
|
#define SPACE_LINE_START 3
|
|
|
|
#define SPACE_LINE_END 7
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1997-12-23 06:11:36 +00:00
|
|
|
enum {
|
1998-01-13 07:00:52 +00:00
|
|
|
ORIENTATION_CHANGED,
|
|
|
|
STYLE_CHANGED,
|
|
|
|
LAST_SIGNAL
|
1997-12-23 06:11:36 +00:00
|
|
|
};
|
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
typedef struct _GtkToolbarChildSpace GtkToolbarChildSpace;
|
|
|
|
struct _GtkToolbarChildSpace
|
|
|
|
{
|
|
|
|
GtkToolbarChild child;
|
|
|
|
|
|
|
|
gint alloc_x, alloc_y;
|
|
|
|
};
|
|
|
|
|
1997-12-23 06:11:36 +00:00
|
|
|
static void gtk_toolbar_class_init (GtkToolbarClass *class);
|
|
|
|
static void gtk_toolbar_init (GtkToolbar *toolbar);
|
|
|
|
static void gtk_toolbar_destroy (GtkObject *object);
|
|
|
|
static void gtk_toolbar_map (GtkWidget *widget);
|
|
|
|
static void gtk_toolbar_unmap (GtkWidget *widget);
|
|
|
|
static void gtk_toolbar_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
1998-01-13 06:14:52 +00:00
|
|
|
static gint gtk_toolbar_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
1997-12-23 06:11:36 +00:00
|
|
|
static void gtk_toolbar_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition);
|
|
|
|
static void gtk_toolbar_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
static void gtk_toolbar_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
1998-01-13 06:14:52 +00:00
|
|
|
static void gtk_toolbar_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
static void gtk_toolbar_forall (GtkContainer *container,
|
|
|
|
gboolean include_internals,
|
1997-12-23 06:11:36 +00:00
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data);
|
|
|
|
static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
|
|
|
|
GtkOrientation orientation);
|
|
|
|
static void gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarStyle style);
|
|
|
|
|
1997-12-19 21:14:44 +00:00
|
|
|
|
|
|
|
static GtkContainerClass *parent_class;
|
|
|
|
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint toolbar_signals[LAST_SIGNAL] = { 0 };
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1997-12-19 21:14:44 +00:00
|
|
|
|
|
|
|
guint
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_get_type (void)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
static guint toolbar_type = 0;
|
|
|
|
|
|
|
|
if (!toolbar_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo toolbar_info =
|
1998-01-13 07:00:52 +00:00
|
|
|
{
|
|
|
|
"GtkToolbar",
|
|
|
|
sizeof (GtkToolbar),
|
|
|
|
sizeof (GtkToolbarClass),
|
|
|
|
(GtkClassInitFunc) gtk_toolbar_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_toolbar_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1998-01-13 07:00:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
toolbar_type = gtk_type_unique (gtk_container_get_type (), &toolbar_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return toolbar_type;
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_class_init (GtkToolbarClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass *) class;
|
|
|
|
widget_class = (GtkWidgetClass *) class;
|
|
|
|
container_class = (GtkContainerClass *) class;
|
|
|
|
|
|
|
|
parent_class = gtk_type_class (gtk_container_get_type ());
|
|
|
|
|
|
|
|
toolbar_signals[ORIENTATION_CHANGED] =
|
|
|
|
gtk_signal_new ("orientation_changed",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkToolbarClass, orientation_changed),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-01-13 07:00:52 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
toolbar_signals[STYLE_CHANGED] =
|
|
|
|
gtk_signal_new ("style_changed",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkToolbarClass, style_changed),
|
1998-07-21 04:13:42 +00:00
|
|
|
gtk_marshal_NONE__INT,
|
1998-01-13 07:00:52 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
|
|
|
|
|
|
|
gtk_object_class_add_signals (object_class, toolbar_signals, LAST_SIGNAL);
|
|
|
|
|
|
|
|
object_class->destroy = gtk_toolbar_destroy;
|
|
|
|
|
|
|
|
widget_class->map = gtk_toolbar_map;
|
|
|
|
widget_class->unmap = gtk_toolbar_unmap;
|
|
|
|
widget_class->draw = gtk_toolbar_draw;
|
|
|
|
widget_class->expose_event = gtk_toolbar_expose;
|
|
|
|
widget_class->size_request = gtk_toolbar_size_request;
|
|
|
|
widget_class->size_allocate = gtk_toolbar_size_allocate;
|
|
|
|
|
|
|
|
container_class->add = gtk_toolbar_add;
|
|
|
|
container_class->remove = gtk_toolbar_remove;
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
container_class->forall = gtk_toolbar_forall;
|
1998-01-19 23:45:37 +00:00
|
|
|
container_class->focus = NULL;
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
class->orientation_changed = gtk_real_toolbar_orientation_changed;
|
|
|
|
class->style_changed = gtk_real_toolbar_style_changed;
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_init (GtkToolbar *toolbar)
|
|
|
|
{
|
|
|
|
GTK_WIDGET_SET_FLAGS (toolbar, GTK_NO_WINDOW);
|
1998-01-19 22:38:22 +00:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_CAN_FOCUS);
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
toolbar->num_children = 0;
|
|
|
|
toolbar->children = NULL;
|
|
|
|
toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
|
|
|
|
toolbar->style = GTK_TOOLBAR_ICONS;
|
1998-05-12 21:30:52 +00:00
|
|
|
toolbar->relief = GTK_RELIEF_NORMAL;
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar->space_size = DEFAULT_SPACE_SIZE;
|
1998-12-08 13:25:35 +00:00
|
|
|
toolbar->space_style = DEFAULT_SPACE_STYLE;
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar->tooltips = gtk_tooltips_new ();
|
|
|
|
toolbar->button_maxw = 0;
|
|
|
|
toolbar->button_maxh = 0;
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_new (GtkOrientation orientation,
|
|
|
|
GtkToolbarStyle style)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkToolbar *toolbar;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar = gtk_type_new (gtk_toolbar_get_type ());
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar->orientation = orientation;
|
|
|
|
toolbar->style = style;
|
1997-12-22 21:32:24 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
return GTK_WIDGET (toolbar);
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_destroy (GtkObject *object)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkToolbar *toolbar;
|
1998-03-14 16:09:36 +00:00
|
|
|
GList *children;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (object != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (object));
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar = GTK_TOOLBAR (object);
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_object_unref (GTK_OBJECT (toolbar->tooltips));
|
1998-02-02 20:40:03 +00:00
|
|
|
toolbar->tooltips = NULL;
|
1997-12-23 00:35:48 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkToolbarChild *child;
|
1998-02-02 20:40:03 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
child = children->data;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
if (child->type != GTK_TOOLBAR_CHILD_SPACE)
|
1998-01-13 07:00:52 +00:00
|
|
|
{
|
1998-02-02 20:40:03 +00:00
|
|
|
gtk_widget_ref (child->widget);
|
|
|
|
gtk_widget_unparent (child->widget);
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_widget_destroy (child->widget);
|
1998-02-02 20:40:03 +00:00
|
|
|
gtk_widget_unref (child->widget);
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_free (child);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (toolbar->children);
|
1998-02-02 20:40:03 +00:00
|
|
|
toolbar->children = NULL;
|
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
|
|
|
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_map (GtkWidget *widget)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkToolbar *toolbar;
|
1998-03-14 16:09:36 +00:00
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
|
|
|
GTK_WIDGET_SET_FLAGS (toolbar, GTK_MAPPED);
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
if ((child->type != GTK_TOOLBAR_CHILD_SPACE)
|
1998-01-13 07:00:52 +00:00
|
|
|
&& GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_map (child->widget);
|
|
|
|
}
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_unmap (GtkWidget *widget)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkToolbar *toolbar;
|
1998-03-14 16:09:36 +00:00
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_MAPPED);
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
if ((child->type != GTK_TOOLBAR_CHILD_SPACE)
|
1998-01-13 07:00:52 +00:00
|
|
|
&& GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_unmap (child->widget);
|
|
|
|
}
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
static void
|
|
|
|
gtk_toolbar_paint_space_line (GtkWidget *widget,
|
|
|
|
GdkRectangle *area,
|
|
|
|
GtkToolbarChild *child)
|
|
|
|
{
|
|
|
|
GtkToolbar *toolbar;
|
|
|
|
GtkToolbarChildSpace *child_space;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
|
|
|
g_return_if_fail (child != NULL);
|
|
|
|
g_return_if_fail (child->type == GTK_TOOLBAR_CHILD_SPACE);
|
|
|
|
|
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
|
|
|
|
|
|
|
child_space = (GtkToolbarChildSpace *) child;
|
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
gtk_paint_vline (widget->style, widget->window,
|
|
|
|
GTK_WIDGET_STATE (widget), area, widget,
|
|
|
|
"toolbar",
|
|
|
|
child_space->alloc_y + toolbar->button_maxh *
|
|
|
|
SPACE_LINE_START / SPACE_LINE_DIVISION,
|
|
|
|
child_space->alloc_y + toolbar->button_maxh *
|
|
|
|
SPACE_LINE_END / SPACE_LINE_DIVISION,
|
|
|
|
child_space->alloc_x +
|
|
|
|
(toolbar->space_size -
|
|
|
|
widget->style->klass->xthickness) / 2);
|
|
|
|
else
|
|
|
|
gtk_paint_hline (widget->style, widget->window,
|
|
|
|
GTK_WIDGET_STATE (widget), area, widget,
|
|
|
|
"toolbar",
|
|
|
|
child_space->alloc_x + toolbar->button_maxw *
|
|
|
|
SPACE_LINE_START / SPACE_LINE_DIVISION,
|
|
|
|
child_space->alloc_x + toolbar->button_maxw *
|
|
|
|
SPACE_LINE_END / SPACE_LINE_DIVISION,
|
|
|
|
child_space->alloc_y +
|
|
|
|
(toolbar->space_size -
|
|
|
|
widget->style->klass->ythickness) / 2);
|
|
|
|
}
|
|
|
|
|
1997-12-19 21:14:44 +00:00
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkToolbar *toolbar;
|
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
|
|
|
GdkRectangle child_area;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1997-12-19 21:14:44 +00:00
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
if (child->type == GTK_TOOLBAR_CHILD_SPACE)
|
|
|
|
{
|
|
|
|
if (toolbar->space_style == GTK_TOOLBAR_SPACE_LINE)
|
|
|
|
gtk_toolbar_paint_space_line (widget, area, child);
|
|
|
|
}
|
|
|
|
else if (gtk_widget_intersect (child->widget, area, &child_area))
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_widget_draw (child->widget, &child_area);
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
1998-01-13 06:14:52 +00:00
|
|
|
static gint
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
1997-12-19 21:14:44 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkToolbar *toolbar;
|
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
|
|
|
GdkEventExpose child_event;
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOLBAR (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
child_event = *event;
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
if (child->type == GTK_TOOLBAR_CHILD_SPACE)
|
|
|
|
{
|
|
|
|
if (toolbar->space_style == GTK_TOOLBAR_SPACE_LINE)
|
|
|
|
gtk_toolbar_paint_space_line (widget, &event->area, child);
|
|
|
|
}
|
|
|
|
else if (GTK_WIDGET_NO_WINDOW (child->widget)
|
|
|
|
&& gtk_widget_intersect (child->widget, &event->area, &child_event.area))
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_widget_event (child->widget, (GdkEvent *) &child_event);
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
return FALSE;
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
|
|
|
GtkToolbar *toolbar;
|
1998-03-14 16:09:36 +00:00
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
|
|
|
gint nbuttons;
|
|
|
|
gint button_maxw, button_maxh;
|
|
|
|
gint widget_maxw, widget_maxh;
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
|
|
|
g_return_if_fail (requisition != NULL);
|
|
|
|
|
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
|
|
|
|
|
|
|
requisition->width = GTK_CONTAINER (toolbar)->border_width * 2;
|
|
|
|
requisition->height = GTK_CONTAINER (toolbar)->border_width * 2;
|
|
|
|
nbuttons = 0;
|
|
|
|
button_maxw = 0;
|
|
|
|
button_maxh = 0;
|
|
|
|
widget_maxw = 0;
|
|
|
|
widget_maxh = 0;
|
|
|
|
|
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
|
|
|
|
switch (child->type)
|
|
|
|
{
|
1998-01-30 10:21:37 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_SPACE:
|
1998-01-13 07:00:52 +00:00
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
requisition->width += toolbar->space_size;
|
|
|
|
else
|
|
|
|
requisition->height += toolbar->space_size;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_BUTTON:
|
1998-02-23 20:48:46 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
|
|
|
|
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
|
1998-01-13 07:00:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
|
|
|
{
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_widget_size_request (child->widget, &child_requisition);
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
nbuttons++;
|
1999-02-10 02:35:09 +00:00
|
|
|
button_maxw = MAX (button_maxw, child_requisition.width);
|
|
|
|
button_maxh = MAX (button_maxh, child_requisition.height);
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_WIDGET:
|
1998-01-13 07:00:52 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
|
|
|
{
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_widget_size_request (child->widget, &child_requisition);
|
1998-01-13 07:00:52 +00:00
|
|
|
|
1999-02-10 02:35:09 +00:00
|
|
|
widget_maxw = MAX (widget_maxw, child_requisition.width);
|
|
|
|
widget_maxh = MAX (widget_maxh, child_requisition.height);
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
1999-02-10 02:35:09 +00:00
|
|
|
requisition->width += child_requisition.width;
|
1998-01-13 07:00:52 +00:00
|
|
|
else
|
1999-02-10 02:35:09 +00:00
|
|
|
requisition->height += child_requisition.height;
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
{
|
|
|
|
requisition->width += nbuttons * button_maxw;
|
|
|
|
requisition->height += MAX (button_maxh, widget_maxh);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
requisition->width += MAX (button_maxw, widget_maxw);
|
|
|
|
requisition->height += nbuttons * button_maxh;
|
|
|
|
}
|
|
|
|
|
|
|
|
toolbar->button_maxw = button_maxw;
|
|
|
|
toolbar->button_maxh = button_maxh;
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkToolbar *toolbar;
|
|
|
|
GList *children;
|
1998-03-14 08:15:23 +00:00
|
|
|
GtkToolbarChild *child;
|
1998-12-08 13:25:35 +00:00
|
|
|
GtkToolbarChildSpace *child_space;
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkAllocation alloc;
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
1998-03-14 16:09:36 +00:00
|
|
|
gint border_width;
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (widget));
|
|
|
|
g_return_if_fail (allocation != NULL);
|
|
|
|
|
|
|
|
toolbar = GTK_TOOLBAR (widget);
|
|
|
|
widget->allocation = *allocation;
|
|
|
|
|
|
|
|
border_width = GTK_CONTAINER (toolbar)->border_width;
|
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
alloc.x = allocation->x + border_width;
|
|
|
|
else
|
|
|
|
alloc.y = allocation->y + border_width;
|
|
|
|
|
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
|
|
|
|
switch (child->type)
|
|
|
|
{
|
1998-01-30 10:21:37 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_SPACE:
|
1998-12-08 13:25:35 +00:00
|
|
|
|
|
|
|
child_space = (GtkToolbarChildSpace *) child;
|
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
1998-12-08 13:25:35 +00:00
|
|
|
{
|
|
|
|
child_space->alloc_x = alloc.x;
|
|
|
|
child_space->alloc_y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
|
|
|
|
alloc.x += toolbar->space_size;
|
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
else
|
1998-12-08 13:25:35 +00:00
|
|
|
{
|
|
|
|
child_space->alloc_x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
|
|
|
|
child_space->alloc_y = alloc.y;
|
|
|
|
alloc.y += toolbar->space_size;
|
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_BUTTON:
|
1998-02-23 20:48:46 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
|
|
|
|
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
|
1998-03-14 08:15:23 +00:00
|
|
|
if (!GTK_WIDGET_VISIBLE (child->widget))
|
|
|
|
break;
|
1998-03-14 16:09:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
alloc.width = toolbar->button_maxw;
|
|
|
|
alloc.height = toolbar->button_maxh;
|
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
alloc.y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
|
|
|
|
else
|
|
|
|
alloc.x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
|
|
|
|
|
|
|
|
gtk_widget_size_allocate (child->widget, &alloc);
|
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
alloc.x += toolbar->button_maxw;
|
|
|
|
else
|
|
|
|
alloc.y += toolbar->button_maxh;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
case GTK_TOOLBAR_CHILD_WIDGET:
|
1998-03-14 08:15:23 +00:00
|
|
|
if (!GTK_WIDGET_VISIBLE (child->widget))
|
|
|
|
break;
|
1998-03-14 16:09:36 +00:00
|
|
|
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_widget_get_child_requisition (child->widget, &child_requisition);
|
|
|
|
|
|
|
|
alloc.width = child_requisition.width;
|
|
|
|
alloc.height = child_requisition.height;
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
1999-02-10 02:35:09 +00:00
|
|
|
alloc.y = allocation->y + (allocation->height - child_requisition.height) / 2;
|
1998-01-13 07:00:52 +00:00
|
|
|
else
|
1999-02-10 02:35:09 +00:00
|
|
|
alloc.x = allocation->x + (allocation->width - child_requisition.width) / 2;
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
gtk_widget_size_allocate (child->widget, &alloc);
|
|
|
|
|
|
|
|
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
|
1999-02-10 02:35:09 +00:00
|
|
|
alloc.x += child_requisition.width;
|
1998-01-13 07:00:52 +00:00
|
|
|
else
|
1999-02-10 02:35:09 +00:00
|
|
|
alloc.y += child_requisition.height;
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (container));
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
|
1998-02-21 04:46:21 +00:00
|
|
|
gtk_toolbar_append_widget (GTK_TOOLBAR (container), widget, NULL, NULL);
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
1998-01-13 06:14:52 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkToolbar *toolbar;
|
1998-03-14 16:09:36 +00:00
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (container));
|
|
|
|
g_return_if_fail (widget != NULL);
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar = GTK_TOOLBAR (container);
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
if ((child->type != GTK_TOOLBAR_CHILD_SPACE) && (child->widget == widget))
|
1998-01-13 07:00:52 +00:00
|
|
|
{
|
1998-02-02 20:40:03 +00:00
|
|
|
gboolean was_visible;
|
|
|
|
|
|
|
|
was_visible = GTK_WIDGET_VISIBLE (widget);
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_widget_unparent (widget);
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar->children = g_list_remove_link (toolbar->children, children);
|
|
|
|
g_free (child);
|
|
|
|
g_list_free (children);
|
|
|
|
toolbar->num_children--;
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-02-02 20:40:03 +00:00
|
|
|
if (was_visible && GTK_WIDGET_VISIBLE (container))
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (container));
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
break;
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
1997-12-19 21:14:44 +00:00
|
|
|
}
|
1997-12-22 20:43:55 +00:00
|
|
|
|
1997-12-23 00:35:48 +00:00
|
|
|
static void
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
gtk_toolbar_forall (GtkContainer *container,
|
|
|
|
gboolean include_internals,
|
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data)
|
1997-12-23 00:35:48 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkToolbar *toolbar;
|
1998-03-14 16:09:36 +00:00
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
1997-12-23 00:35:48 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (container));
|
|
|
|
g_return_if_fail (callback != NULL);
|
1997-12-23 00:35:48 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
toolbar = GTK_TOOLBAR (container);
|
1997-12-23 00:35:48 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1997-12-23 00:35:48 +00:00
|
|
|
|
1998-01-30 10:21:37 +00:00
|
|
|
if (child->type != GTK_TOOLBAR_CHILD_SPACE)
|
1998-01-13 07:00:52 +00:00
|
|
|
(*callback) (child->widget, callback_data);
|
|
|
|
}
|
1997-12-22 20:43:55 +00:00
|
|
|
}
|
|
|
|
|
1998-01-13 06:14:52 +00:00
|
|
|
GtkWidget *
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_append_item (GtkToolbar *toolbar,
|
1998-01-13 06:14:52 +00:00
|
|
|
const char *text,
|
|
|
|
const char *tooltip_text,
|
1998-02-21 04:46:21 +00:00
|
|
|
const char *tooltip_private_text,
|
1998-01-18 23:49:56 +00:00
|
|
|
GtkWidget *icon,
|
1998-01-13 06:14:52 +00:00
|
|
|
GtkSignalFunc callback,
|
|
|
|
gpointer user_data)
|
1997-12-22 20:43:55 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL, text,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
icon, callback, user_data,
|
|
|
|
toolbar->num_children);
|
1997-12-22 20:43:55 +00:00
|
|
|
}
|
|
|
|
|
1998-01-13 06:14:52 +00:00
|
|
|
GtkWidget *
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_prepend_item (GtkToolbar *toolbar,
|
|
|
|
const char *text,
|
|
|
|
const char *tooltip_text,
|
1998-02-21 04:46:21 +00:00
|
|
|
const char *tooltip_private_text,
|
1998-01-18 23:49:56 +00:00
|
|
|
GtkWidget *icon,
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkSignalFunc callback,
|
|
|
|
gpointer user_data)
|
1997-12-22 20:43:55 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL, text,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
icon, callback, user_data,
|
|
|
|
0);
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
1997-12-22 20:43:55 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_toolbar_insert_item (GtkToolbar *toolbar,
|
|
|
|
const char *text,
|
|
|
|
const char *tooltip_text,
|
1998-02-21 04:46:21 +00:00
|
|
|
const char *tooltip_private_text,
|
1998-01-18 23:49:56 +00:00
|
|
|
GtkWidget *icon,
|
1998-01-13 07:00:52 +00:00
|
|
|
GtkSignalFunc callback,
|
|
|
|
gpointer user_data,
|
|
|
|
gint position)
|
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
|
|
|
|
NULL, text,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
icon, callback, user_data,
|
|
|
|
position);
|
1997-12-22 20:43:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_append_space (GtkToolbar *toolbar)
|
1997-12-22 20:43:55 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
toolbar->num_children);
|
1997-12-22 20:43:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_prepend_space (GtkToolbar *toolbar)
|
1997-12-22 20:43:55 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
0);
|
1997-12-22 20:43:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_insert_space (GtkToolbar *toolbar,
|
|
|
|
gint position)
|
1997-12-22 20:43:55 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
position);
|
1997-12-22 20:43:55 +00:00
|
|
|
}
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 06:14:52 +00:00
|
|
|
void
|
1998-02-21 04:46:21 +00:00
|
|
|
gtk_toolbar_append_widget (GtkToolbar *toolbar,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *tooltip_text,
|
|
|
|
const gchar *tooltip_private_text)
|
1998-01-13 06:14:52 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
|
|
|
|
widget, NULL,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
toolbar->num_children);
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-02-21 04:46:21 +00:00
|
|
|
gtk_toolbar_prepend_widget (GtkToolbar *toolbar,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *tooltip_text,
|
|
|
|
const gchar *tooltip_private_text)
|
1998-01-13 06:14:52 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
|
|
|
|
widget, NULL,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
toolbar->num_children);
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_insert_widget (GtkToolbar *toolbar,
|
|
|
|
GtkWidget *widget,
|
1998-01-19 22:38:22 +00:00
|
|
|
const char *tooltip_text,
|
1998-02-21 04:46:21 +00:00
|
|
|
const char *tooltip_private_text,
|
1998-01-13 07:00:52 +00:00
|
|
|
gint position)
|
1998-01-13 06:14:52 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
|
|
|
|
widget, NULL,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
position);
|
1998-02-23 20:48:46 +00:00
|
|
|
}
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_toolbar_append_element (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarChildType type,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const char *text,
|
|
|
|
const char *tooltip_text,
|
|
|
|
const char *tooltip_private_text,
|
|
|
|
GtkWidget *icon,
|
|
|
|
GtkSignalFunc callback,
|
|
|
|
gpointer user_data)
|
1998-02-23 20:48:46 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
return gtk_toolbar_insert_element (toolbar, type, widget, text,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
icon, callback, user_data,
|
|
|
|
toolbar->num_children);
|
1998-02-23 20:48:46 +00:00
|
|
|
}
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_toolbar_prepend_element (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarChildType type,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const char *text,
|
|
|
|
const char *tooltip_text,
|
|
|
|
const char *tooltip_private_text,
|
|
|
|
GtkWidget *icon,
|
|
|
|
GtkSignalFunc callback,
|
|
|
|
gpointer user_data)
|
1998-02-23 20:48:46 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
return gtk_toolbar_insert_element (toolbar, type, widget, text,
|
|
|
|
tooltip_text, tooltip_private_text,
|
|
|
|
icon, callback, user_data, 0);
|
1998-02-23 20:48:46 +00:00
|
|
|
}
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_toolbar_insert_element (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarChildType type,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const char *text,
|
|
|
|
const char *tooltip_text,
|
|
|
|
const char *tooltip_private_text,
|
|
|
|
GtkWidget *icon,
|
|
|
|
GtkSignalFunc callback,
|
|
|
|
gpointer user_data,
|
|
|
|
gint position)
|
1998-02-23 20:48:46 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
GtkToolbarChild *child;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
|
|
|
|
g_return_val_if_fail (toolbar != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
if (type == GTK_TOOLBAR_CHILD_WIDGET)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
|
|
|
}
|
1998-09-16 23:33:25 +00:00
|
|
|
else if (type != GTK_TOOLBAR_CHILD_RADIOBUTTON)
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
g_return_val_if_fail (widget == NULL, NULL);
|
1998-03-14 16:09:36 +00:00
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
if (type == GTK_TOOLBAR_CHILD_SPACE)
|
|
|
|
child = (GtkToolbarChild *) g_new (GtkToolbarChildSpace, 1);
|
|
|
|
else
|
|
|
|
child = g_new (GtkToolbarChild, 1);
|
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
child->type = type;
|
|
|
|
child->icon = NULL;
|
|
|
|
child->label = NULL;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case GTK_TOOLBAR_CHILD_SPACE:
|
|
|
|
child->widget = NULL;
|
1998-12-08 13:25:35 +00:00
|
|
|
((GtkToolbarChildSpace *) child)->alloc_x =
|
|
|
|
((GtkToolbarChildSpace *) child)->alloc_y = 0;
|
1998-03-14 16:09:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_TOOLBAR_CHILD_WIDGET:
|
|
|
|
child->widget = widget;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_TOOLBAR_CHILD_BUTTON:
|
|
|
|
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
|
|
|
|
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
|
|
|
|
if (type == GTK_TOOLBAR_CHILD_BUTTON)
|
1998-05-12 21:30:52 +00:00
|
|
|
{
|
|
|
|
child->widget = gtk_button_new ();
|
|
|
|
gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief);
|
|
|
|
}
|
1998-03-14 16:09:36 +00:00
|
|
|
else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
|
|
|
|
{
|
|
|
|
child->widget = gtk_toggle_button_new ();
|
1998-11-23 06:53:07 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief);
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget),
|
|
|
|
FALSE);
|
1998-02-23 20:48:46 +00:00
|
|
|
}
|
1998-03-14 16:09:36 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
child->widget = gtk_radio_button_new (widget
|
|
|
|
? gtk_radio_button_group (GTK_RADIO_BUTTON (widget))
|
|
|
|
: NULL);
|
1998-11-24 06:27:02 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief);
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE);
|
1998-02-23 20:48:46 +00:00
|
|
|
}
|
1998-01-13 06:14:52 +00:00
|
|
|
|
Added gdk_text/string_extents() - too calculate all the metrics at once of
Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() -
too calculate all the metrics at once of a string, including
things which weren't calculated before.
* gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New
MenuItem type, that when put as the first thing in a
menu, makes the menu tearoff. Currently drawn as a
dashed line.
* gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag
"hide_on_activate" to the MenuItem class structure to allow
check and radio buttons to be changed with <Space> without
hiding the menu.
* gtk/gtkaccellabel.[ch]: Added new capabilities to set
a underline_group and underline_mods for the label -
accelerators added in the underline group matching
underline_mods will be displayed as an underline character.
This doesn't work - Save As needs to be underlined
as Save _As.
* gtk/gtkitemfactory.c:
- Create a AccelGroup for each MenuShell we create.
- If an '&' appears before a character 'c' in the path,
then make 'c' an accelerator in the menu's accel group,
and if the menuitem is menubar <alt>C an accelerator
in the itemfactory's accel group.
* gtk/gtklabel.[ch]: Add support for a pattern arg -
which is a string. If an '_' appears in this string,
the corresponding position in the label is underlined.
Add gtk_label_parse_uline() convenience function which
takes a string with embedded underlines, sets the
pattern and label, and returns the accelerator keyval.
* gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget.
Instead, they create a GtkWindow and add themselves
to that. (When torn off, another new feature, they
create another GtkWindow to hold the torn off menu)
New function gtk_menu_set_tearoff_state()
* gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h:
Added action signals for keyboard navigation of menus.
* gtk/gtkmenushell.c: Key press handler which activates
bindings for navigation, and accelerators, for handling
underline accelerators. Exported functions to select
and activate menu items in a menushell.
* gtk/testgtk.c: Added a new "Item Factory" test which
tests GtkItemFactory and the new keyboard navigation
of menus.
1998-08-12 16:49:13 +00:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (child->widget, GTK_CAN_FOCUS);
|
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
if (callback)
|
|
|
|
gtk_signal_connect (GTK_OBJECT (child->widget), "clicked",
|
|
|
|
callback, user_data);
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (child->widget), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
child->label = gtk_label_new (text);
|
1998-03-21 07:46:04 +00:00
|
|
|
gtk_box_pack_end (GTK_BOX (vbox), child->label, FALSE, FALSE, 0);
|
1998-03-14 16:09:36 +00:00
|
|
|
if (toolbar->style != GTK_TOOLBAR_ICONS)
|
|
|
|
gtk_widget_show (child->label);
|
|
|
|
}
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-21 07:46:04 +00:00
|
|
|
if (icon)
|
|
|
|
{
|
|
|
|
child->icon = GTK_WIDGET (icon);
|
|
|
|
gtk_box_pack_end (GTK_BOX (vbox), child->icon, FALSE, FALSE, 0);
|
|
|
|
if (toolbar->style != GTK_TOOLBAR_TEXT)
|
|
|
|
gtk_widget_show (child->icon);
|
|
|
|
}
|
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
gtk_widget_show (child->widget);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
if ((type != GTK_TOOLBAR_CHILD_SPACE) && tooltip_text)
|
|
|
|
gtk_tooltips_set_tip (toolbar->tooltips, child->widget,
|
|
|
|
tooltip_text, tooltip_private_text);
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
toolbar->children = g_list_insert (toolbar->children, child, position);
|
|
|
|
toolbar->num_children++;
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
if (type != GTK_TOOLBAR_CHILD_SPACE)
|
|
|
|
gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar));
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
if ((type != GTK_TOOLBAR_CHILD_SPACE) && GTK_WIDGET_VISIBLE (toolbar))
|
1998-02-23 20:48:46 +00:00
|
|
|
{
|
1998-03-14 16:09:36 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (toolbar)
|
|
|
|
&& !GTK_WIDGET_REALIZED (child->widget))
|
|
|
|
gtk_widget_realize (child->widget);
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
if (GTK_WIDGET_MAPPED (toolbar)
|
|
|
|
&& !GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_map (child->widget);
|
1998-01-13 07:00:52 +00:00
|
|
|
}
|
1998-01-13 06:14:52 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
if (GTK_WIDGET_VISIBLE (toolbar) &&
|
|
|
|
((type == GTK_TOOLBAR_CHILD_SPACE) ||
|
|
|
|
GTK_WIDGET_VISIBLE (child->widget)))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
1998-02-23 20:48:46 +00:00
|
|
|
|
1998-03-14 16:09:36 +00:00
|
|
|
return child->widget;
|
1998-01-13 06:14:52 +00:00
|
|
|
}
|
|
|
|
|
1997-12-23 06:11:36 +00:00
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_set_orientation (GtkToolbar *toolbar,
|
|
|
|
GtkOrientation orientation)
|
1997-12-23 06:11:36 +00:00
|
|
|
{
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_set_style (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarStyle style)
|
1997-12-23 06:11:36 +00:00
|
|
|
{
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_set_space_size (GtkToolbar *toolbar,
|
|
|
|
gint space_size)
|
1997-12-23 06:11:36 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
|
|
|
|
|
|
|
if (toolbar->space_size != space_size)
|
|
|
|
{
|
|
|
|
toolbar->space_size = space_size;
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
|
|
|
}
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|
|
|
|
|
1998-12-08 13:25:35 +00:00
|
|
|
void
|
|
|
|
gtk_toolbar_set_space_style (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarSpaceStyle space_style)
|
|
|
|
{
|
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
|
|
|
|
|
|
|
if (toolbar->space_style != space_style)
|
|
|
|
{
|
|
|
|
toolbar->space_style = space_style;
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-12-23 06:11:36 +00:00
|
|
|
void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
|
|
|
|
gint enable)
|
1997-12-23 06:11:36 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (enable)
|
|
|
|
gtk_tooltips_enable (toolbar->tooltips);
|
|
|
|
else
|
|
|
|
gtk_tooltips_disable (toolbar->tooltips);
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|
|
|
|
|
1998-05-12 21:30:52 +00:00
|
|
|
void
|
|
|
|
gtk_toolbar_set_button_relief (GtkToolbar *toolbar,
|
|
|
|
GtkReliefStyle relief)
|
|
|
|
{
|
|
|
|
GList *children;
|
|
|
|
GtkToolbarChild *child;
|
|
|
|
|
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
|
|
|
|
|
|
|
if (toolbar->relief != relief)
|
|
|
|
{
|
|
|
|
toolbar->relief = relief;
|
|
|
|
|
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1998-11-23 06:53:07 +00:00
|
|
|
if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
|
1998-11-24 06:27:02 +00:00
|
|
|
child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
|
1998-11-23 06:53:07 +00:00
|
|
|
child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
|
1998-05-12 21:30:52 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (child->widget), relief);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkReliefStyle
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
gtk_toolbar_get_button_relief (GtkToolbar *toolbar)
|
1998-05-12 21:30:52 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (toolbar != NULL, GTK_RELIEF_NORMAL);
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NORMAL);
|
|
|
|
|
|
|
|
return toolbar->relief;
|
|
|
|
}
|
|
|
|
|
1997-12-23 06:11:36 +00:00
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
|
|
|
|
GtkOrientation orientation)
|
1997-12-23 06:11:36 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
|
|
|
|
|
|
|
if (toolbar->orientation != orientation)
|
|
|
|
{
|
|
|
|
toolbar->orientation = orientation;
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
|
|
|
}
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-01-13 07:00:52 +00:00
|
|
|
gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
|
|
|
|
GtkToolbarStyle style)
|
1997-12-23 06:11:36 +00:00
|
|
|
{
|
1998-01-13 07:00:52 +00:00
|
|
|
GList *children;
|
1998-01-30 10:21:37 +00:00
|
|
|
GtkToolbarChild *child;
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
g_return_if_fail (toolbar != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (toolbar->style != style)
|
|
|
|
{
|
|
|
|
toolbar->style = style;
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
for (children = toolbar->children; children; children = children->next)
|
|
|
|
{
|
|
|
|
child = children->data;
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-02-23 20:48:46 +00:00
|
|
|
if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
|
|
|
|
child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
|
|
|
|
child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
|
1998-01-13 07:00:52 +00:00
|
|
|
switch (style)
|
|
|
|
{
|
|
|
|
case GTK_TOOLBAR_ICONS:
|
|
|
|
if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
|
|
|
|
gtk_widget_show (child->icon);
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (child->label && GTK_WIDGET_VISIBLE (child->label))
|
|
|
|
gtk_widget_hide (child->label);
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
break;
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
case GTK_TOOLBAR_TEXT:
|
|
|
|
if (child->icon && GTK_WIDGET_VISIBLE (child->icon))
|
|
|
|
gtk_widget_hide (child->icon);
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (child->label && !GTK_WIDGET_VISIBLE (child->label))
|
|
|
|
gtk_widget_show (child->label);
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
break;
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
case GTK_TOOLBAR_BOTH:
|
|
|
|
if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
|
|
|
|
gtk_widget_show (child->icon);
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
if (child->label && !GTK_WIDGET_VISIBLE (child->label))
|
|
|
|
gtk_widget_show (child->label);
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
break;
|
1997-12-23 06:11:36 +00:00
|
|
|
|
1998-01-13 07:00:52 +00:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|
1998-01-13 07:00:52 +00:00
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
|
|
|
}
|
1997-12-23 06:11:36 +00:00
|
|
|
}
|