1998-06-12 00:49:11 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* GtkPacker Widget
|
|
|
|
* Copyright (C) 1998 Shawn T. Amundson, James S. Mitchell, Michael L. Staiger
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file contains modified code derived from Tk 8.0. Below is the header of
|
|
|
|
* the relevant file. The file 'license.terms' is included inline below.
|
|
|
|
*
|
|
|
|
* tkPack.c --
|
|
|
|
*
|
|
|
|
* This file contains code to implement the "packer"
|
|
|
|
* geometry manager for Tk.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1990-1994 The Regents of the University of California.
|
|
|
|
* Copyright (c) 1994-1995 Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* See the file "license.terms" for information on usage and redistribution
|
|
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
*
|
|
|
|
* SCCS: @(#) tkPack.c 1.64 96/05/03 10:51:52
|
|
|
|
*
|
|
|
|
* The file license.terms is below. NOTE: THE FOLLOWING APPLIES ONLY TO
|
|
|
|
* PORTIONS DERIVED FROM TK 8.0. THE LICENSE FOR THIS FILE IS LGPL, AS
|
|
|
|
* STATED ABOVE AND ALLOWED BELOW.
|
|
|
|
-- BEGIN license.terms --
|
|
|
|
This software is copyrighted by the Regents of the University of
|
|
|
|
California, Sun Microsystems, Inc., and other parties. The following
|
|
|
|
terms apply to all files associated with the software unless explicitly
|
|
|
|
disclaimed in individual files.
|
|
|
|
|
|
|
|
The authors hereby grant permission to use, copy, modify, distribute,
|
|
|
|
and license this software and its documentation for any purpose, provided
|
|
|
|
that existing copyright notices are retained in all copies and that this
|
|
|
|
notice is included verbatim in any distributions. No written agreement,
|
|
|
|
license, or royalty fee is required for any of the authorized uses.
|
|
|
|
Modifications to this software may be copyrighted by their authors
|
|
|
|
and need not follow the licensing terms described here, provided that
|
|
|
|
the new terms are clearly indicated on the first page of each file where
|
|
|
|
they apply.
|
|
|
|
|
|
|
|
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
|
|
|
|
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
|
|
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
|
|
|
|
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
|
|
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
|
|
|
|
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
|
|
|
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
|
|
|
MODIFICATIONS.
|
|
|
|
|
|
|
|
GOVERNMENT USE: If you are acquiring this software on behalf of the
|
|
|
|
U.S. government, the Government shall have only "Restricted Rights"
|
|
|
|
in the software and related documentation as defined in the Federal
|
|
|
|
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
|
|
|
|
are acquiring the software on behalf of the Department of Defense, the
|
|
|
|
software shall be classified as "Commercial Computer Software" and the
|
|
|
|
Government shall have only "Restricted Rights" as defined in Clause
|
|
|
|
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
|
|
|
|
authors grant the U.S. Government and others acting in its behalf
|
|
|
|
permission to use and distribute the software in accordance with the
|
|
|
|
terms specified in this license.
|
|
|
|
-- END license.terms --
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
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/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
#include "gtkpacker.h"
|
|
|
|
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
enum {
|
|
|
|
ARG_0,
|
|
|
|
ARG_SPACING,
|
|
|
|
ARG_D_BORDER_WIDTH,
|
|
|
|
ARG_D_PAD_X,
|
|
|
|
ARG_D_PAD_Y,
|
|
|
|
ARG_D_IPAD_X,
|
|
|
|
ARG_D_IPAD_Y
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
CHILD_ARG_0,
|
|
|
|
CHILD_ARG_SIDE,
|
|
|
|
CHILD_ARG_ANCHOR,
|
|
|
|
CHILD_ARG_EXPAND,
|
|
|
|
CHILD_ARG_FILL_X,
|
|
|
|
CHILD_ARG_FILL_Y,
|
|
|
|
CHILD_ARG_USE_DEFAULT,
|
|
|
|
CHILD_ARG_BORDER_WIDTH,
|
|
|
|
CHILD_ARG_PAD_X,
|
|
|
|
CHILD_ARG_PAD_Y,
|
|
|
|
CHILD_ARG_I_PAD_X,
|
|
|
|
CHILD_ARG_I_PAD_Y,
|
|
|
|
CHILD_ARG_POSITION
|
|
|
|
};
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
static void gtk_packer_class_init (GtkPackerClass *klass);
|
|
|
|
static void gtk_packer_init (GtkPacker *packer);
|
|
|
|
static void gtk_packer_map (GtkWidget *widget);
|
|
|
|
static void gtk_packer_unmap (GtkWidget *widget);
|
|
|
|
static void gtk_packer_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
|
|
|
static gint gtk_packer_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
|
|
|
static void gtk_packer_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition);
|
|
|
|
static void gtk_packer_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
static void gtk_packer_container_add (GtkContainer *container,
|
|
|
|
GtkWidget *child);
|
|
|
|
static void gtk_packer_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_packer_forall (GtkContainer *container,
|
|
|
|
gboolean include_internals,
|
1998-06-12 00:49:11 +00:00
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data);
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
static void gtk_packer_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_packer_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_packer_get_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_packer_set_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
1998-06-16 05:20:05 +00:00
|
|
|
static GtkType gtk_packer_child_type (GtkContainer *container);
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
static GtkPackerClass *parent_class;
|
|
|
|
|
|
|
|
GtkType
|
|
|
|
gtk_packer_get_type (void)
|
|
|
|
{
|
|
|
|
static GtkType packer_type = 0;
|
|
|
|
|
|
|
|
if (!packer_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo packer_info =
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
"GtkPacker",
|
|
|
|
sizeof (GtkPacker),
|
|
|
|
sizeof (GtkPackerClass),
|
|
|
|
(GtkClassInitFunc) gtk_packer_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_packer_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-06-12 00:49:11 +00:00
|
|
|
};
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
packer_type = gtk_type_unique (GTK_TYPE_CONTAINER, &packer_info);
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return packer_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_class_init (GtkPackerClass *klass)
|
|
|
|
{
|
1998-06-28 07:46:10 +00:00
|
|
|
GtkObjectClass *object_class;
|
1998-06-12 00:49:11 +00:00
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
object_class = (GtkObjectClass*) klass;
|
1998-06-12 00:49:11 +00:00
|
|
|
widget_class = (GtkWidgetClass*) klass;
|
|
|
|
container_class = (GtkContainerClass*) klass;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
|
1998-06-12 00:49:11 +00:00
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_object_add_arg_type ("GtkPacker::spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_SPACING);
|
|
|
|
gtk_object_add_arg_type ("GtkPacker::default_border_width", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_BORDER_WIDTH);
|
|
|
|
gtk_object_add_arg_type ("GtkPacker::default_pad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_PAD_X);
|
|
|
|
gtk_object_add_arg_type ("GtkPacker::default_pad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_PAD_Y);
|
|
|
|
gtk_object_add_arg_type ("GtkPacker::default_ipad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_IPAD_X);
|
|
|
|
gtk_object_add_arg_type ("GtkPacker::default_ipad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_IPAD_Y);
|
|
|
|
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::side", GTK_TYPE_SIDE_TYPE, GTK_ARG_READWRITE, CHILD_ARG_SIDE);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, CHILD_ARG_ANCHOR);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::expand", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_EXPAND);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::fill_x", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_FILL_X);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::fill_y", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_FILL_Y);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::use_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_USE_DEFAULT);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::border_width", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_BORDER_WIDTH);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::pad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_PAD_X);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::pad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_PAD_Y);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::ipad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_I_PAD_X);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::ipad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_I_PAD_Y);
|
|
|
|
gtk_container_add_child_arg_type ("GtkPacker::position", GTK_TYPE_LONG, GTK_ARG_READWRITE, CHILD_ARG_POSITION);
|
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
object_class->set_arg = gtk_packer_set_arg;
|
|
|
|
object_class->get_arg = gtk_packer_get_arg;
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
widget_class->map = gtk_packer_map;
|
|
|
|
widget_class->unmap = gtk_packer_unmap;
|
|
|
|
widget_class->draw = gtk_packer_draw;
|
|
|
|
widget_class->expose_event = gtk_packer_expose;
|
|
|
|
|
|
|
|
widget_class->size_request = gtk_packer_size_request;
|
|
|
|
widget_class->size_allocate = gtk_packer_size_allocate;
|
|
|
|
|
|
|
|
container_class->add = gtk_packer_container_add;
|
|
|
|
container_class->remove = gtk_packer_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_packer_forall;
|
1998-06-16 05:20:05 +00:00
|
|
|
container_class->child_type = gtk_packer_child_type;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
container_class->get_child_arg = gtk_packer_get_child_arg;
|
|
|
|
container_class->set_child_arg = gtk_packer_set_child_arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
|
|
|
|
packer = GTK_PACKER (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_SPACING:
|
|
|
|
gtk_packer_set_spacing (packer, GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_D_BORDER_WIDTH:
|
|
|
|
gtk_packer_set_default_border_width (packer, GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_D_PAD_X:
|
|
|
|
gtk_packer_set_default_pad (packer,
|
|
|
|
GTK_VALUE_UINT (*arg),
|
|
|
|
packer->default_pad_y);
|
|
|
|
break;
|
|
|
|
case ARG_D_PAD_Y:
|
|
|
|
gtk_packer_set_default_pad (packer,
|
|
|
|
packer->default_pad_x,
|
|
|
|
GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_D_IPAD_X:
|
|
|
|
gtk_packer_set_default_ipad (packer,
|
|
|
|
GTK_VALUE_UINT (*arg),
|
|
|
|
packer->default_i_pad_y);
|
|
|
|
break;
|
|
|
|
case ARG_D_IPAD_Y:
|
|
|
|
gtk_packer_set_default_ipad (packer,
|
|
|
|
packer->default_i_pad_x,
|
|
|
|
GTK_VALUE_UINT (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
|
|
|
|
packer = GTK_PACKER (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_SPACING:
|
|
|
|
GTK_VALUE_UINT (*arg) = packer->spacing;
|
|
|
|
break;
|
|
|
|
case ARG_D_BORDER_WIDTH:
|
|
|
|
GTK_VALUE_UINT (*arg) = packer->default_border_width;
|
|
|
|
break;
|
|
|
|
case ARG_D_PAD_X:
|
|
|
|
GTK_VALUE_UINT (*arg) = packer->default_pad_x;
|
|
|
|
break;
|
|
|
|
case ARG_D_PAD_Y:
|
|
|
|
GTK_VALUE_UINT (*arg) = packer->default_pad_y;
|
|
|
|
break;
|
|
|
|
case ARG_D_IPAD_X:
|
|
|
|
GTK_VALUE_UINT (*arg) = packer->default_i_pad_x;
|
|
|
|
break;
|
|
|
|
case ARG_D_IPAD_Y:
|
|
|
|
GTK_VALUE_UINT (*arg) = packer->default_i_pad_y;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
static GtkType
|
|
|
|
gtk_packer_child_type (GtkContainer *container)
|
|
|
|
{
|
|
|
|
return GTK_TYPE_WIDGET;
|
|
|
|
}
|
1998-06-12 00:49:11 +00:00
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
static void
|
|
|
|
gtk_packer_set_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child_info = NULL;
|
|
|
|
|
|
|
|
packer = GTK_PACKER (container);
|
|
|
|
|
|
|
|
if (arg_id != CHILD_ARG_POSITION)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
list = packer->children;
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
child_info = list->data;
|
|
|
|
if (child_info->widget == child)
|
|
|
|
break;
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case CHILD_ARG_SIDE:
|
|
|
|
child_info->side = GTK_VALUE_ENUM (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_ANCHOR:
|
|
|
|
child_info->anchor = GTK_VALUE_ENUM (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_EXPAND:
|
|
|
|
if (GTK_VALUE_BOOL (*arg))
|
|
|
|
child_info->options |= GTK_PACK_EXPAND;
|
|
|
|
else
|
|
|
|
child_info->options &= ~GTK_PACK_EXPAND;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_FILL_X:
|
|
|
|
if (GTK_VALUE_BOOL (*arg))
|
|
|
|
child_info->options |= GTK_FILL_X;
|
|
|
|
else
|
|
|
|
child_info->options &= ~GTK_FILL_X;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_FILL_Y:
|
|
|
|
if (GTK_VALUE_BOOL (*arg))
|
|
|
|
child_info->options |= GTK_FILL_Y;
|
|
|
|
else
|
|
|
|
child_info->options &= ~GTK_FILL_Y;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_USE_DEFAULT:
|
|
|
|
child_info->use_default = (GTK_VALUE_BOOL (*arg) != 0);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_BORDER_WIDTH:
|
|
|
|
if (!child_info->use_default)
|
|
|
|
child_info->border_width = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_PAD_X:
|
|
|
|
if (!child_info->use_default)
|
|
|
|
child_info->pad_x = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_PAD_Y:
|
|
|
|
if (!child_info->use_default)
|
|
|
|
child_info->pad_y = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_I_PAD_X:
|
|
|
|
if (!child_info->use_default)
|
|
|
|
child_info->i_pad_x = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_I_PAD_Y:
|
|
|
|
if (!child_info->use_default)
|
|
|
|
child_info->i_pad_y = GTK_VALUE_UINT (*arg);
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_POSITION:
|
|
|
|
gtk_packer_reorder_child (packer,
|
|
|
|
child,
|
|
|
|
GTK_VALUE_LONG (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg_id != CHILD_ARG_POSITION &&
|
|
|
|
GTK_WIDGET_VISIBLE (packer) &&
|
|
|
|
GTK_WIDGET_VISIBLE (child))
|
|
|
|
gtk_widget_queue_resize (child);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_get_child_arg (GtkContainer *container,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child_info = NULL;
|
|
|
|
GList * list;
|
|
|
|
|
|
|
|
packer = GTK_PACKER (container);
|
|
|
|
|
|
|
|
if (arg_id != CHILD_ARG_POSITION)
|
|
|
|
{
|
|
|
|
list = packer->children;
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
child_info = list->data;
|
|
|
|
if (child_info->widget == child)
|
|
|
|
break;
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
if (!list)
|
|
|
|
{
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case CHILD_ARG_SIDE:
|
|
|
|
GTK_VALUE_ENUM (*arg) = child_info->side;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_ANCHOR:
|
|
|
|
GTK_VALUE_ENUM (*arg) = child_info->anchor;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_EXPAND:
|
|
|
|
GTK_VALUE_BOOL (*arg) = (child_info->options & GTK_PACK_EXPAND) != 0;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_FILL_X:
|
|
|
|
GTK_VALUE_BOOL (*arg) = (child_info->options & GTK_FILL_X) != 0;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_FILL_Y:
|
|
|
|
GTK_VALUE_BOOL (*arg) = (child_info->options & GTK_FILL_Y) != 0;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_USE_DEFAULT:
|
|
|
|
GTK_VALUE_BOOL (*arg) = child_info->use_default;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_BORDER_WIDTH:
|
|
|
|
GTK_VALUE_UINT (*arg) = child_info->border_width;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_PAD_X:
|
|
|
|
GTK_VALUE_UINT (*arg) = child_info->pad_x;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_PAD_Y:
|
|
|
|
GTK_VALUE_UINT (*arg) = child_info->pad_y;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_I_PAD_X:
|
|
|
|
GTK_VALUE_UINT (*arg) = child_info->i_pad_x;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_I_PAD_Y:
|
|
|
|
GTK_VALUE_UINT (*arg) = child_info->i_pad_y;
|
|
|
|
break;
|
|
|
|
case CHILD_ARG_POSITION:
|
|
|
|
GTK_VALUE_LONG (*arg) = 0;
|
|
|
|
for (list = packer->children; list; list = list->next)
|
|
|
|
{
|
|
|
|
child_info = list->data;
|
|
|
|
if (child_info->widget == child)
|
|
|
|
break;
|
|
|
|
GTK_VALUE_LONG (*arg)++;
|
|
|
|
}
|
|
|
|
if (!list)
|
|
|
|
GTK_VALUE_LONG (*arg) = -1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
static void
|
|
|
|
gtk_packer_init (GtkPacker *packer)
|
|
|
|
{
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (packer, GTK_NO_WINDOW);
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
packer->children = NULL;
|
|
|
|
packer->spacing = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-06-12 08:10:29 +00:00
|
|
|
gtk_packer_set_spacing (GtkPacker *packer,
|
|
|
|
guint spacing)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
|
|
|
|
if (spacing != packer->spacing)
|
|
|
|
{
|
|
|
|
packer->spacing = spacing;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (packer));
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
1998-08-17 14:48:51 +00:00
|
|
|
}
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
gtk_packer_new (void)
|
|
|
|
{
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
return GTK_WIDGET (gtk_type_new (GTK_TYPE_PACKER));
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-12 08:10:29 +00:00
|
|
|
redo_defaults_children (GtkPacker *packer)
|
|
|
|
{
|
1998-06-12 00:49:11 +00:00
|
|
|
GList *list;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
|
|
|
|
list = g_list_first(packer->children);
|
|
|
|
while (list != NULL)
|
|
|
|
{
|
|
|
|
child = list->data;
|
|
|
|
|
|
|
|
if (child->use_default)
|
|
|
|
{
|
|
|
|
child->border_width = packer->default_border_width;
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_x = packer->default_pad_x;
|
|
|
|
child->pad_y = packer->default_pad_y;
|
|
|
|
child->i_pad_x = packer->default_i_pad_x;
|
|
|
|
child->i_pad_y = packer->default_i_pad_y;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (child->widget));
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
list = g_list_next(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-06-12 08:10:29 +00:00
|
|
|
gtk_packer_set_default_border_width (GtkPacker *packer,
|
|
|
|
guint border)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
|
|
|
|
if (packer->default_border_width != border)
|
|
|
|
{
|
|
|
|
packer->default_border_width = border;;
|
1998-06-12 08:10:29 +00:00
|
|
|
redo_defaults_children (packer);
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_packer_set_default_pad (GtkPacker *packer,
|
|
|
|
guint pad_x,
|
|
|
|
guint pad_y)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
if (packer->default_pad_x != pad_x ||
|
|
|
|
packer->default_pad_y != pad_y)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
1998-06-16 05:20:05 +00:00
|
|
|
packer->default_pad_x = pad_x;
|
|
|
|
packer->default_pad_y = pad_y;
|
|
|
|
redo_defaults_children (packer);
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_packer_set_default_ipad (GtkPacker *packer,
|
|
|
|
guint i_pad_x,
|
|
|
|
guint i_pad_y)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
if (packer->default_i_pad_x != i_pad_x ||
|
|
|
|
packer->default_i_pad_y != i_pad_y) {
|
1998-06-12 00:49:11 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
packer->default_i_pad_x = i_pad_x;
|
|
|
|
packer->default_i_pad_y = i_pad_y;
|
|
|
|
redo_defaults_children (packer);
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_container_add (GtkContainer *packer, GtkWidget *child)
|
|
|
|
{
|
|
|
|
gtk_packer_add_defaults(GTK_PACKER(packer), child,
|
|
|
|
GTK_SIDE_TOP, GTK_ANCHOR_CENTER, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-06-12 08:10:29 +00:00
|
|
|
gtk_packer_add_defaults (GtkPacker *packer,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkSideType side,
|
|
|
|
GtkAnchorType anchor,
|
1998-06-12 00:49:11 +00:00
|
|
|
GtkPackerOptions options)
|
|
|
|
{
|
|
|
|
GtkPackerChild *pchild;
|
|
|
|
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
g_return_if_fail (child != NULL);
|
1998-06-16 05:20:05 +00:00
|
|
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
pchild = (GtkPackerChild*) g_malloc(sizeof(GtkPackerChild));
|
|
|
|
|
|
|
|
pchild->widget = child;
|
|
|
|
pchild->side = side;
|
|
|
|
pchild->options = options;
|
|
|
|
pchild->anchor = anchor;
|
|
|
|
|
|
|
|
pchild->use_default = 1;
|
|
|
|
|
|
|
|
pchild->border_width = packer->default_border_width;
|
1998-06-16 05:20:05 +00:00
|
|
|
pchild->pad_x = packer->default_pad_x;
|
|
|
|
pchild->pad_y = packer->default_pad_y;
|
|
|
|
pchild->i_pad_x = packer->default_i_pad_x;
|
|
|
|
pchild->i_pad_y = packer->default_i_pad_y;
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
packer->children = g_list_append(packer->children, (gpointer) pchild);
|
|
|
|
|
|
|
|
gtk_widget_set_parent (child, GTK_WIDGET (packer));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (packer)))
|
|
|
|
{
|
|
|
|
if (GTK_WIDGET_REALIZED (GTK_WIDGET (packer)) &&
|
|
|
|
!GTK_WIDGET_REALIZED (child))
|
|
|
|
gtk_widget_realize (child);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_MAPPED (GTK_WIDGET (packer)) &&
|
|
|
|
!GTK_WIDGET_MAPPED (child))
|
|
|
|
gtk_widget_map (child);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (packer))
|
|
|
|
gtk_widget_queue_resize (child);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-06-12 08:10:29 +00:00
|
|
|
gtk_packer_add (GtkPacker *packer,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkSideType side,
|
|
|
|
GtkAnchorType anchor,
|
1998-06-12 00:49:11 +00:00
|
|
|
GtkPackerOptions options,
|
1998-06-12 08:10:29 +00:00
|
|
|
guint border_width,
|
1998-06-16 05:20:05 +00:00
|
|
|
guint pad_x,
|
|
|
|
guint pad_y,
|
|
|
|
guint i_pad_x,
|
|
|
|
guint i_pad_y)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPackerChild *pchild;
|
|
|
|
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
g_return_if_fail (child != NULL);
|
1998-06-12 08:10:29 +00:00
|
|
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
pchild = (GtkPackerChild*) g_malloc(sizeof(GtkPackerChild));
|
|
|
|
|
|
|
|
pchild->widget = child;
|
|
|
|
pchild->side = side;
|
|
|
|
pchild->options = options;
|
|
|
|
pchild->anchor = anchor;
|
|
|
|
|
|
|
|
pchild->use_default = 0;
|
|
|
|
|
|
|
|
pchild->border_width = border_width;
|
1998-06-16 05:20:05 +00:00
|
|
|
pchild->pad_x = pad_x;
|
|
|
|
pchild->pad_y = pad_y;
|
|
|
|
pchild->i_pad_x = i_pad_x;
|
|
|
|
pchild->i_pad_y = i_pad_y;
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
packer->children = g_list_append(packer->children, (gpointer) pchild);
|
|
|
|
|
|
|
|
gtk_widget_set_parent (child, GTK_WIDGET (packer));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (packer)))
|
|
|
|
{
|
|
|
|
if (GTK_WIDGET_REALIZED (GTK_WIDGET (packer)) &&
|
|
|
|
!GTK_WIDGET_REALIZED (child))
|
|
|
|
gtk_widget_realize (child);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_MAPPED (GTK_WIDGET (packer)) &&
|
|
|
|
!GTK_WIDGET_MAPPED (child))
|
|
|
|
gtk_widget_map (child);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (packer))
|
|
|
|
gtk_widget_queue_resize (child);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_packer_set_child_packing (GtkPacker *packer,
|
|
|
|
GtkWidget *child,
|
|
|
|
GtkSideType side,
|
|
|
|
GtkAnchorType anchor,
|
|
|
|
GtkPackerOptions options,
|
|
|
|
guint border_width,
|
|
|
|
guint pad_x,
|
|
|
|
guint pad_y,
|
|
|
|
guint i_pad_x,
|
|
|
|
guint i_pad_y)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
GtkPackerChild *pchild;
|
|
|
|
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
g_return_if_fail (child != NULL);
|
|
|
|
|
|
|
|
list = g_list_first(packer->children);
|
|
|
|
while (list != NULL)
|
|
|
|
{
|
|
|
|
pchild = (GtkPackerChild*) list->data;
|
|
|
|
if (pchild->widget == child)
|
|
|
|
{
|
|
|
|
pchild->side = side;
|
|
|
|
pchild->anchor = anchor;
|
|
|
|
pchild->options = options;
|
|
|
|
|
|
|
|
pchild->use_default = 0;
|
|
|
|
|
|
|
|
pchild->border_width = border_width;
|
1998-06-16 05:20:05 +00:00
|
|
|
pchild->pad_x = pad_x;
|
|
|
|
pchild->pad_y = pad_y;
|
|
|
|
pchild->i_pad_x = i_pad_x;
|
|
|
|
pchild->i_pad_y = i_pad_y;
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (packer))
|
|
|
|
gtk_widget_queue_resize (child);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
list = g_list_next(list);
|
|
|
|
}
|
|
|
|
|
1998-11-28 07:42:37 +00:00
|
|
|
g_warning ("couldn't find child `%s' amongst the packer's children", gtk_type_name (GTK_OBJECT_TYPE (child)));
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
void
|
|
|
|
gtk_packer_reorder_child (GtkPacker *packer,
|
|
|
|
GtkWidget *child,
|
|
|
|
gint position)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_return_if_fail (packer != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (packer));
|
|
|
|
g_return_if_fail (child != NULL);
|
|
|
|
|
|
|
|
list = packer->children;
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
GtkPackerChild *child_info;
|
|
|
|
|
|
|
|
child_info = list->data;
|
|
|
|
if (child_info->widget == child)
|
|
|
|
break;
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list && packer->children->next)
|
|
|
|
{
|
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
if (list->next)
|
|
|
|
list->next->prev = list->prev;
|
|
|
|
if (list->prev)
|
|
|
|
list->prev->next = list->next;
|
|
|
|
else
|
|
|
|
packer->children = list->next;
|
|
|
|
|
|
|
|
tmp_list = packer->children;
|
|
|
|
while (position && tmp_list->next)
|
|
|
|
{
|
|
|
|
position--;
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position)
|
|
|
|
{
|
|
|
|
tmp_list->next = list;
|
|
|
|
list->prev = tmp_list;
|
|
|
|
list->next = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (tmp_list->prev)
|
|
|
|
tmp_list->prev->next = list;
|
|
|
|
else
|
|
|
|
packer->children = list;
|
|
|
|
list->prev = tmp_list->prev;
|
|
|
|
tmp_list->prev = list;
|
|
|
|
list->next = tmp_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (packer))
|
|
|
|
gtk_widget_queue_resize (child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
static void
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
gtk_packer_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint visible;
|
|
|
|
|
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
|
|
|
|
packer = GTK_PACKER (container);
|
|
|
|
|
|
|
|
children = g_list_first(packer->children);
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
|
|
|
|
if (child->widget == widget)
|
|
|
|
{
|
|
|
|
visible = GTK_WIDGET_VISIBLE (widget);
|
|
|
|
gtk_widget_unparent (widget);
|
|
|
|
|
|
|
|
packer->children = g_list_remove_link (packer->children, children);
|
|
|
|
g_list_free (children);
|
|
|
|
g_free (child);
|
|
|
|
|
|
|
|
if (visible && GTK_WIDGET_VISIBLE (container))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (container));
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
children = g_list_next(children);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (widget));
|
|
|
|
|
|
|
|
packer = GTK_PACKER (widget);
|
|
|
|
GTK_WIDGET_SET_FLAGS (packer, GTK_MAPPED);
|
|
|
|
|
|
|
|
children = g_list_first(packer->children);
|
|
|
|
while (children != NULL)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = g_list_next(children);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget) &&
|
|
|
|
!GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_map (child->widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_packer_unmap (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (widget));
|
|
|
|
|
|
|
|
packer = GTK_PACKER (widget);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (packer, GTK_MAPPED);
|
|
|
|
|
|
|
|
children = g_list_first(packer->children);
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = g_list_next(children);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget) &&
|
|
|
|
GTK_WIDGET_MAPPED (child->widget))
|
|
|
|
gtk_widget_unmap (child->widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_packer_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GdkRectangle child_area;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (widget));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
packer = GTK_PACKER (widget);
|
|
|
|
|
|
|
|
children = g_list_first(packer->children);
|
|
|
|
while (children != NULL)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = g_list_next(children);
|
|
|
|
|
|
|
|
if (gtk_widget_intersect (child->widget, area, &child_area))
|
|
|
|
gtk_widget_draw (child->widget, &child_area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_packer_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GdkEventExpose child_event;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_PACKER (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
packer = GTK_PACKER (widget);
|
|
|
|
|
|
|
|
child_event = *event;
|
|
|
|
|
|
|
|
children = g_list_first(packer->children);
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = g_list_next(children);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
|
|
|
|
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
|
|
|
|
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_packer_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
GtkContainer *container;
|
1998-06-12 00:49:11 +00:00
|
|
|
GtkPackerChild *child;
|
|
|
|
GList *children;
|
|
|
|
gint nvis_vert_children;
|
|
|
|
gint nvis_horz_children;
|
|
|
|
gint width, height;
|
|
|
|
gint maxWidth, maxHeight;
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (widget));
|
|
|
|
g_return_if_fail (requisition != NULL);
|
|
|
|
|
|
|
|
packer = GTK_PACKER (widget);
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
container = GTK_CONTAINER (widget);
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
requisition->width = 0;
|
|
|
|
requisition->height = 0;
|
|
|
|
nvis_vert_children = 0;
|
|
|
|
nvis_horz_children = 0;
|
|
|
|
|
|
|
|
width = height = maxWidth = maxHeight = 0;
|
|
|
|
|
|
|
|
children = g_list_first(packer->children);
|
|
|
|
while (children != NULL)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
|
|
|
{
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
|
|
|
|
|
|
|
gtk_widget_size_request (child->widget, &child_requisition);
|
1998-06-12 00:49:11 +00:00
|
|
|
|
1999-02-10 02:35:09 +00:00
|
|
|
if ((child->side == GTK_SIDE_TOP) || (child->side == GTK_SIDE_BOTTOM))
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
1998-06-12 08:10:29 +00:00
|
|
|
maxWidth = MAX (maxWidth,
|
1999-02-10 02:35:09 +00:00
|
|
|
(child_requisition.width +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_x + child->i_pad_x +
|
1998-06-12 08:10:29 +00:00
|
|
|
width));
|
1999-02-10 02:35:09 +00:00
|
|
|
height += (child_requisition.height +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_y + child->i_pad_y);
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-06-12 08:10:29 +00:00
|
|
|
maxHeight = MAX (maxHeight,
|
1999-02-10 02:35:09 +00:00
|
|
|
(child_requisition.height +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_y + child->i_pad_y +
|
1998-06-12 08:10:29 +00:00
|
|
|
height));
|
1999-02-10 02:35:09 +00:00
|
|
|
width += (child_requisition.width +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_x + child->i_pad_x);
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
children = g_list_next(children);
|
|
|
|
}
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
|
|
|
|
requisition->width = MAX (maxWidth, width) + 2 * container->border_width;
|
|
|
|
requisition->height = MAX (maxHeight, height) + 2 * container->border_width;
|
1998-06-12 00:49:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
1999-02-10 02:35:09 +00:00
|
|
|
YExpansion (GList *children,
|
|
|
|
gint cavityHeight)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GtkWidget *widget;
|
|
|
|
gint numExpand, minExpand, curExpand;
|
|
|
|
gint childHeight;
|
|
|
|
|
|
|
|
minExpand = cavityHeight;
|
|
|
|
numExpand = 0;
|
|
|
|
|
|
|
|
list = children;
|
|
|
|
while (list != NULL)
|
|
|
|
{
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
child = list->data;
|
|
|
|
widget = child->widget;
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_widget_get_child_requisition (widget, &child_requisition);
|
|
|
|
|
|
|
|
childHeight = (child_requisition.height +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->i_pad_y +
|
|
|
|
child->pad_y);
|
1998-06-12 00:49:11 +00:00
|
|
|
if ((child->side == GTK_SIDE_LEFT) || (child->side == GTK_SIDE_RIGHT))
|
|
|
|
{
|
|
|
|
curExpand = (cavityHeight - childHeight)/numExpand;
|
|
|
|
minExpand = MIN(minExpand, curExpand);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cavityHeight -= childHeight;
|
|
|
|
if (child->options & GTK_PACK_EXPAND)
|
|
|
|
numExpand++;
|
|
|
|
}
|
|
|
|
list = g_list_next(list);
|
|
|
|
}
|
|
|
|
curExpand = cavityHeight/numExpand;
|
|
|
|
if (curExpand < minExpand)
|
|
|
|
minExpand = curExpand;
|
|
|
|
return (minExpand < 0) ? 0 : minExpand;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
1999-02-10 02:35:09 +00:00
|
|
|
XExpansion (GList *children,
|
|
|
|
gint cavityWidth)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GtkWidget *widget;
|
|
|
|
gint numExpand, minExpand, curExpand;
|
|
|
|
gint childWidth;
|
|
|
|
|
|
|
|
minExpand = cavityWidth;
|
|
|
|
numExpand = 0;
|
|
|
|
|
|
|
|
list = children;
|
|
|
|
while (list != NULL)
|
|
|
|
{
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
child = list->data;
|
|
|
|
widget = child->widget;
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_widget_get_child_requisition (widget, &child_requisition);
|
|
|
|
|
|
|
|
childWidth = (child_requisition.width +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->i_pad_x +
|
|
|
|
child->pad_x);
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
if ((child->side == GTK_SIDE_TOP) || (child->side == GTK_SIDE_BOTTOM))
|
|
|
|
{
|
|
|
|
curExpand = (cavityWidth - childWidth)/numExpand;
|
|
|
|
minExpand = MIN(minExpand, curExpand);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cavityWidth -= childWidth;
|
|
|
|
if (child->options & GTK_PACK_EXPAND)
|
|
|
|
numExpand++;
|
|
|
|
}
|
|
|
|
list = g_list_next(list);
|
|
|
|
}
|
|
|
|
curExpand = cavityWidth/numExpand;
|
|
|
|
if (curExpand < minExpand)
|
|
|
|
minExpand = curExpand;
|
|
|
|
return (minExpand < 0) ? 0 : minExpand;
|
1998-08-17 14:48:51 +00:00
|
|
|
}
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
static void
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_packer_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
GtkContainer *container;
|
1998-06-12 00:49:11 +00:00
|
|
|
GtkAllocation child_allocation;
|
|
|
|
GList *list;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
gint cavityX, cavityY;
|
|
|
|
gint cavityWidth, cavityHeight;
|
|
|
|
gint width, height, x, y;
|
|
|
|
gint frameHeight, frameWidth, frameX, frameY;
|
|
|
|
gint borderX, borderY;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (widget));
|
|
|
|
g_return_if_fail (allocation != NULL);
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
packer = GTK_PACKER (widget);
|
|
|
|
container = GTK_CONTAINER (widget);
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
x = y = 0;
|
|
|
|
|
|
|
|
widget->allocation = *allocation;
|
|
|
|
|
new function gtk_container_child_arg_set, similar to
Wed Jun 24 14:14:32 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: new function gtk_container_child_arg_set, similar
to gtk_container_child_arg_setv, but takes a variable argument list.
new function gtk_container_get_child_arg_type, which is needed by
gtk_object_collect_args.
* gtk/gtkobject.c: changed prototype for gtk_object_collect_args, to
take a function pointer to figure the argument type.
adapted callers to pass gtk_object_get_arg_type.
* gtk/gtkwidget.c: adapted gtk_object_collect_args callers to pass
gtk_object_get_arg_type..
* gtk/gtkpacker.h:
* gtk/gtkpacker.c:
(gtk_packer_reorder_child): new function to change the packing order
of a child.
(gtk_packer_size_request):
(gtk_packer_size_allocate): take container->border_width into acount.
* gtk/gtkpacker.c: implemented widget arguments:
"GtkPacker::spacing", "GtkPacker::border_width", "GtkPacker::pad_x",
"GtkPacker::pad_y", "GtkPacker::ipad_x", "GtkPacker::ipad_y".
implemented child arguments:
"GtkPacker::side", "GtkPacker::anchor", "GtkPacker::expand",
"GtkPacker::fill_x", "GtkPacker::fill_y", "GtkPacker::use_default",
"GtkPacker::border_width", "GtkPacker::pad_x", "GtkPacker::pad_y",
"GtkPacker::ipad_x", "GtkPacker::ipad_y", "GtkPacker::position".
* gtk/gtkmisc.c (gtk_misc_set_arg): for padding args, set the padding,
not the alignment.
* gtk/gtkeventbox.h:
* gtk/gtkeventbox.c: GtkType and macro fixups.
* gtk/testgtk.c (entry_toggle_sensitive): new function to toggle
sensitivity of an entry.
* gtk/gtkstyle.c (gtk_style_new): support normal grey as default color
for insensitive base.
* gtk/gtkentry.c (gtk_entry_realize): set the window backgrounds
widget state dependent.
(gtk_entry_style_set): likewise.
(gtk_entry_state_changed): set background color on state changes.
(gtk_entry_draw_text): for non selected text, use state dependent
colors.
* gtk/gtktogglebutton.c: support for widget arguments
"GtkToggleButton::active" and "GtkToggleButton::draw_indicator".
1998-06-24 12:22:23 +00:00
|
|
|
cavityX = widget->allocation.x + container->border_width;
|
|
|
|
cavityY = widget->allocation.y + container->border_width;
|
|
|
|
cavityWidth = widget->allocation.width - 2 * container->border_width;
|
|
|
|
cavityHeight = widget->allocation.height - 2 * container->border_width;
|
|
|
|
|
|
|
|
list = g_list_first (packer->children);
|
1998-06-12 00:49:11 +00:00
|
|
|
while (list != NULL)
|
|
|
|
{
|
1999-02-10 02:35:09 +00:00
|
|
|
GtkRequisition child_requisition;
|
|
|
|
|
1998-06-12 00:49:11 +00:00
|
|
|
child = list->data;
|
1999-02-10 02:35:09 +00:00
|
|
|
gtk_widget_get_child_requisition (child->widget, &child_requisition);
|
1998-06-12 00:49:11 +00:00
|
|
|
|
|
|
|
if ((child->side == GTK_SIDE_TOP) || (child->side == GTK_SIDE_BOTTOM))
|
|
|
|
{
|
|
|
|
frameWidth = cavityWidth;
|
1999-02-10 02:35:09 +00:00
|
|
|
frameHeight = (child_requisition.height +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_y +
|
|
|
|
child->i_pad_y);
|
1998-06-12 00:49:11 +00:00
|
|
|
if (child->options & GTK_PACK_EXPAND)
|
|
|
|
frameHeight += YExpansion(list, cavityHeight);
|
|
|
|
cavityHeight -= frameHeight;
|
|
|
|
if (cavityHeight < 0)
|
|
|
|
{
|
|
|
|
frameHeight += cavityHeight;
|
|
|
|
cavityHeight = 0;
|
|
|
|
}
|
|
|
|
frameX = cavityX;
|
|
|
|
if (child->side == GTK_SIDE_TOP)
|
|
|
|
{
|
|
|
|
frameY = cavityY;
|
|
|
|
cavityY += frameHeight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frameY = cavityY + cavityHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frameHeight = cavityHeight;
|
1999-02-10 02:35:09 +00:00
|
|
|
frameWidth = (child_requisition.width +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->pad_x +
|
|
|
|
child->i_pad_x);
|
1998-06-12 00:49:11 +00:00
|
|
|
if (child->options & GTK_PACK_EXPAND)
|
|
|
|
frameWidth += XExpansion(list, cavityWidth);
|
|
|
|
cavityWidth -= frameWidth;
|
|
|
|
if (cavityWidth < 0) {
|
|
|
|
frameWidth += cavityWidth;
|
|
|
|
cavityWidth = 0;
|
|
|
|
}
|
|
|
|
frameY = cavityY;
|
|
|
|
if (child->side == GTK_SIDE_LEFT)
|
|
|
|
{
|
|
|
|
frameX = cavityX;
|
|
|
|
cavityX += frameWidth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frameX = cavityX + cavityWidth;
|
|
|
|
}
|
|
|
|
}
|
1998-06-12 08:10:29 +00:00
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
borderX = child->pad_x + 2 * child->border_width;
|
|
|
|
borderY = child->pad_y + 2 * child->border_width;
|
1998-06-12 08:10:29 +00:00
|
|
|
|
1999-02-10 02:35:09 +00:00
|
|
|
width = (child_requisition.width +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->i_pad_x);
|
1998-06-12 00:49:11 +00:00
|
|
|
if ((child->options & GTK_FILL_X) || (width > (frameWidth - borderX)))
|
|
|
|
width = frameWidth - borderX;
|
1998-06-12 08:10:29 +00:00
|
|
|
|
1999-02-10 02:35:09 +00:00
|
|
|
height = (child_requisition.height +
|
1998-06-12 08:10:29 +00:00
|
|
|
2 * child->border_width +
|
1998-06-16 05:20:05 +00:00
|
|
|
child->i_pad_y);
|
1998-06-12 00:49:11 +00:00
|
|
|
if ((child->options & GTK_FILL_Y) || (height > (frameHeight - borderY)))
|
|
|
|
height = frameHeight - borderY;
|
|
|
|
|
|
|
|
borderX /= 2;
|
|
|
|
borderY /= 2;
|
|
|
|
switch (child->anchor)
|
|
|
|
{
|
|
|
|
case GTK_ANCHOR_N:
|
|
|
|
x = frameX + (frameWidth - width)/2;
|
|
|
|
y = frameY + borderY;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_NE:
|
|
|
|
x = frameX + frameWidth - width - borderX;
|
|
|
|
y = frameY + borderY;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_E:
|
|
|
|
x = frameX + frameWidth - width - borderX;
|
|
|
|
y = frameY + (frameHeight - height)/2;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_SE:
|
|
|
|
x = frameX + frameWidth - width - borderX;
|
|
|
|
y = frameY + frameHeight - height - borderY;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_S:
|
|
|
|
x = frameX + (frameWidth - width)/2;
|
|
|
|
y = frameY + frameHeight - height - borderY;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_SW:
|
|
|
|
x = frameX + borderX;
|
|
|
|
y = frameY + frameHeight - height - borderY;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_W:
|
|
|
|
x = frameX + borderX;
|
|
|
|
y = frameY + (frameHeight - height)/2;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_NW:
|
|
|
|
x = frameX + borderX;
|
|
|
|
y = frameY + borderY;
|
|
|
|
break;
|
|
|
|
case GTK_ANCHOR_CENTER:
|
|
|
|
x = frameX + (frameWidth - width)/2;
|
|
|
|
y = frameY + (frameHeight - height)/2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_warning ("gtk_packer_size_allocate(): bad anchor type: %d", child->anchor);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
{
|
|
|
|
gtk_widget_unmap(child->widget);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
child_allocation.x = x;
|
|
|
|
child_allocation.y = y;
|
|
|
|
child_allocation.width = width;
|
|
|
|
child_allocation.height = height;
|
|
|
|
gtk_widget_size_allocate (child->widget, &child_allocation);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_MAPPED (widget) &&
|
|
|
|
!(GTK_WIDGET_MAPPED (child->widget)))
|
|
|
|
gtk_widget_map(child->widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
list = g_list_next(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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_packer_forall (GtkContainer *container,
|
|
|
|
gboolean include_internals,
|
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data)
|
1998-06-12 00:49:11 +00:00
|
|
|
{
|
|
|
|
GtkPacker *packer;
|
|
|
|
GtkPackerChild *child;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_PACKER (container));
|
|
|
|
g_return_if_fail (callback != NULL);
|
|
|
|
|
|
|
|
packer = GTK_PACKER (container);
|
|
|
|
|
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
|
|
|
children = g_list_first (packer->children);
|
1998-06-12 00:49:11 +00:00
|
|
|
while (children != NULL)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = g_list_next(children);
|
|
|
|
|
|
|
|
(* callback) (child->widget, callback_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|