gtk2/gtk/gtktable.c

1731 lines
46 KiB
C
Raw Normal View History

/* GTK - The GIMP Toolkit
1997-11-24 22:37:52 +00:00
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
1997-11-24 22:37:52 +00:00
* 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
* Lesser General Public License for more details.
1997-11-24 22:37:52 +00:00
*
* You should have received a copy of the GNU Lesser 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.
1997-11-24 22:37:52 +00:00
*/
/*
* Modified by the GTK+ Team and others 1997-2000. 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/.
*/
#include "config.h"
1997-11-24 22:37:52 +00:00
#include "gtktable.h"
#include "gtkprivate.h"
#include "gtkintl.h"
1997-11-24 22:37:52 +00:00
2010-08-26 17:15:37 +00:00
struct _GtkTablePrivate
{
GtkTableRowCol *cols;
GtkTableRowCol *rows;
GList *children;
guint16 column_spacing;
guint16 ncols;
guint16 nrows;
guint16 row_spacing;
guint homogeneous : 1;
};
enum
{
PROP_0,
PROP_N_ROWS,
PROP_N_COLUMNS,
PROP_COLUMN_SPACING,
PROP_ROW_SPACING,
PROP_HOMOGENEOUS
};
enum
{
CHILD_PROP_0,
CHILD_PROP_LEFT_ATTACH,
CHILD_PROP_RIGHT_ATTACH,
CHILD_PROP_TOP_ATTACH,
CHILD_PROP_BOTTOM_ATTACH,
CHILD_PROP_X_OPTIONS,
CHILD_PROP_Y_OPTIONS,
CHILD_PROP_X_PADDING,
CHILD_PROP_Y_PADDING
};
1997-11-24 22:37:52 +00:00
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
static void gtk_table_finalize (GObject *object);
static void gtk_table_size_request (GtkWidget *widget,
1997-11-24 22:37:52 +00:00
GtkRequisition *requisition);
static void gtk_table_size_allocate (GtkWidget *widget,
1997-11-24 22:37:52 +00:00
GtkAllocation *allocation);
static void gtk_table_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_table_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_table_forall (GtkContainer *container,
gboolean include_internals,
1997-11-24 22:37:52 +00:00
GtkCallback callback,
gpointer callback_data);
static void gtk_table_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_table_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_table_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_table_get_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GType gtk_table_child_type (GtkContainer *container);
static void gtk_table_size_request_init (GtkTable *table);
1997-11-24 22:37:52 +00:00
static void gtk_table_size_request_pass1 (GtkTable *table);
static void gtk_table_size_request_pass2 (GtkTable *table);
static void gtk_table_size_request_pass3 (GtkTable *table);
static void gtk_table_size_allocate_init (GtkTable *table);
static void gtk_table_size_allocate_pass1 (GtkTable *table);
static void gtk_table_size_allocate_pass2 (GtkTable *table);
2006-05-14 04:25:34 +00:00
G_DEFINE_TYPE (GtkTable, gtk_table, GTK_TYPE_CONTAINER)
1997-11-24 22:37:52 +00:00
static void
gtk_table_class_init (GtkTableClass *class)
{
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
gobject_class->finalize = gtk_table_finalize;
1997-11-24 22:37:52 +00:00
gobject_class->get_property = gtk_table_get_property;
gobject_class->set_property = gtk_table_set_property;
1997-11-24 22:37:52 +00:00
widget_class->size_request = gtk_table_size_request;
widget_class->size_allocate = gtk_table_size_allocate;
1997-11-24 22:37:52 +00:00
container_class->add = gtk_table_add;
container_class->remove = gtk_table_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_table_forall;
container_class->child_type = gtk_table_child_type;
container_class->set_child_property = gtk_table_set_child_property;
container_class->get_child_property = gtk_table_get_child_property;
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
g_object_class_install_property (gobject_class,
PROP_N_ROWS,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("n-rows",
P_("Rows"),
P_("The number of rows in the table"),
1,
65535,
1,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_N_COLUMNS,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("n-columns",
P_("Columns"),
P_("The number of columns in the table"),
1,
65535,
1,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_ROW_SPACING,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("row-spacing",
P_("Row spacing"),
P_("The amount of space between two consecutive rows"),
0,
65535,
0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_COLUMN_SPACING,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("column-spacing",
P_("Column spacing"),
P_("The amount of space between two consecutive columns"),
0,
65535,
0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_HOMOGENEOUS,
g_param_spec_boolean ("homogeneous",
P_("Homogeneous"),
P_("If TRUE, the table cells are all the same width/height"),
FALSE,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_LEFT_ATTACH,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("left-attach",
P_("Left attachment"),
P_("The column number to attach the left side of the child to"),
0, 65535, 0,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_RIGHT_ATTACH,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("right-attach",
P_("Right attachment"),
P_("The column number to attach the right side of a child widget to"),
1, 65535, 1,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_TOP_ATTACH,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("top-attach",
P_("Top attachment"),
P_("The row number to attach the top of a child widget to"),
0, 65535, 0,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_BOTTOM_ATTACH,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("bottom-attach",
P_("Bottom attachment"),
P_("The row number to attach the bottom of the child to"),
1, 65535, 1,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_X_OPTIONS,
2005-03-09 06:15:13 +00:00
g_param_spec_flags ("x-options",
P_("Horizontal options"),
P_("Options specifying the horizontal behaviour of the child"),
GTK_TYPE_ATTACH_OPTIONS, GTK_EXPAND | GTK_FILL,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_Y_OPTIONS,
2005-03-09 06:15:13 +00:00
g_param_spec_flags ("y-options",
P_("Vertical options"),
P_("Options specifying the vertical behaviour of the child"),
GTK_TYPE_ATTACH_OPTIONS, GTK_EXPAND | GTK_FILL,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_X_PADDING,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("x-padding",
P_("Horizontal padding"),
P_("Extra space to put between the child and its left and right neighbors, in pixels"),
0, 65535, 0,
GTK_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class,
CHILD_PROP_Y_PADDING,
2005-03-09 06:15:13 +00:00
g_param_spec_uint ("y-padding",
P_("Vertical padding"),
P_("Extra space to put between the child and its upper and lower neighbors, in pixels"),
0, 65535, 0,
GTK_PARAM_READWRITE));
2010-08-26 17:15:37 +00:00
g_type_class_add_private (class, sizeof (GtkTablePrivate));
}
static GType
gtk_table_child_type (GtkContainer *container)
{
return GTK_TYPE_WIDGET;
1997-11-24 22:37:52 +00:00
}
static void
gtk_table_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
1997-11-24 22:37:52 +00:00
{
GtkTable *table = GTK_TABLE (object);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
switch (prop_id)
{
case PROP_N_ROWS:
g_value_set_uint (value, priv->nrows);
break;
case PROP_N_COLUMNS:
g_value_set_uint (value, priv->ncols);
break;
case PROP_ROW_SPACING:
g_value_set_uint (value, priv->row_spacing);
break;
case PROP_COLUMN_SPACING:
g_value_set_uint (value, priv->column_spacing);
break;
case PROP_HOMOGENEOUS:
g_value_set_boolean (value, priv->homogeneous);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
1997-11-24 22:37:52 +00:00
}
1998-01-27 23:40:51 +00:00
static void
gtk_table_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
1997-11-24 22:37:52 +00:00
{
GtkTable *table = GTK_TABLE (object);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
switch (prop_id)
1997-11-24 22:37:52 +00:00
{
case PROP_N_ROWS:
gtk_table_resize (table, g_value_get_uint (value), priv->ncols);
break;
case PROP_N_COLUMNS:
gtk_table_resize (table, priv->nrows, g_value_get_uint (value));
break;
case PROP_ROW_SPACING:
gtk_table_set_row_spacings (table, g_value_get_uint (value));
break;
case PROP_COLUMN_SPACING:
gtk_table_set_col_spacings (table, g_value_get_uint (value));
break;
case PROP_HOMOGENEOUS:
gtk_table_set_homogeneous (table, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
1997-11-24 22:37:52 +00:00
}
1998-01-27 23:40:51 +00:00
}
1997-11-24 22:37:52 +00:00
1998-01-27 23:40:51 +00:00
static void
gtk_table_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
const GValue *value,
GParamSpec *pspec)
1998-01-27 23:40:51 +00:00
{
GtkTable *table = GTK_TABLE (container);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
GtkTableChild *table_child;
GList *list;
table_child = NULL;
for (list = priv->children; list; list = list->next)
{
table_child = list->data;
if (table_child->widget == child)
break;
}
if (!list)
{
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
return;
}
switch (property_id)
1997-11-24 22:37:52 +00:00
{
case CHILD_PROP_LEFT_ATTACH:
table_child->left_attach = g_value_get_uint (value);
if (table_child->right_attach <= table_child->left_attach)
table_child->right_attach = table_child->left_attach + 1;
if (table_child->right_attach >= priv->ncols)
gtk_table_resize (table, priv->nrows, table_child->right_attach);
break;
case CHILD_PROP_RIGHT_ATTACH:
table_child->right_attach = g_value_get_uint (value);
if (table_child->right_attach <= table_child->left_attach)
table_child->left_attach = table_child->right_attach - 1;
if (table_child->right_attach >= priv->ncols)
gtk_table_resize (table, priv->nrows, table_child->right_attach);
break;
case CHILD_PROP_TOP_ATTACH:
table_child->top_attach = g_value_get_uint (value);
if (table_child->bottom_attach <= table_child->top_attach)
table_child->bottom_attach = table_child->top_attach + 1;
if (table_child->bottom_attach >= priv->nrows)
gtk_table_resize (table, table_child->bottom_attach, priv->ncols);
break;
case CHILD_PROP_BOTTOM_ATTACH:
table_child->bottom_attach = g_value_get_uint (value);
if (table_child->bottom_attach <= table_child->top_attach)
table_child->top_attach = table_child->bottom_attach - 1;
if (table_child->bottom_attach >= priv->nrows)
gtk_table_resize (table, table_child->bottom_attach, priv->ncols);
break;
case CHILD_PROP_X_OPTIONS:
table_child->xexpand = (g_value_get_flags (value) & GTK_EXPAND) != 0;
table_child->xshrink = (g_value_get_flags (value) & GTK_SHRINK) != 0;
table_child->xfill = (g_value_get_flags (value) & GTK_FILL) != 0;
break;
case CHILD_PROP_Y_OPTIONS:
table_child->yexpand = (g_value_get_flags (value) & GTK_EXPAND) != 0;
table_child->yshrink = (g_value_get_flags (value) & GTK_SHRINK) != 0;
table_child->yfill = (g_value_get_flags (value) & GTK_FILL) != 0;
break;
case CHILD_PROP_X_PADDING:
table_child->xpadding = g_value_get_uint (value);
break;
case CHILD_PROP_Y_PADDING:
table_child->ypadding = g_value_get_uint (value);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
1997-11-24 22:37:52 +00:00
}
if (gtk_widget_get_visible (child) &&
gtk_widget_get_visible (GTK_WIDGET (table)))
added a frame with radio buttons to select the resize_mode for the Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org> * gtk/testgtk.c (create_idle_test): added a frame with radio buttons to select the resize_mode for the idle-labels container. * gtk/gtkframe.h: * gtk/gtkframe.c: GtkType and macro corrections. * gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to support radio grouping. Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize unconditionally if resize_mode has changed. * gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set GTK_RESIZE_QUEUE on the scrolled window. (gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport. Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.h: * gtk/gtkcontainer.c: (GTK_IS_RESIZE_CONTAINER): new macro to find out if a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT. (gtk_container_queue_resize): new function to queue a container for a *size* reallocation (doesn't affect its position, and thus its parent is left untouched usually). (gtk_container_get_resize_container): new function to retrive the next most resize container which is not itself queued for a resize. (gtk_container_idle_sizer): new function to carefully process the container_resize_queue since it can change during invokation of gtk_container_check_resize(). (gtk_container_resize_children): total rework of this function to properly handle resize containers. makes a lot of assumptions whitch are stated in the comments. * gtk/gtkcontainer.c: (gtk_container_real_check_resize): only requeue ourselves if we are not a resize container. (gtk_container_clear_resize_widgets): care for automatic deletion of our resize_widgets list on size_allocate through a handler connection. * gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the focus and default widget of a window, so to take the burden from gtk_widget_unparent. * gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried to be clever, but actually messed up the resize_children logic and caused unneccessary allocations on its whole branch. besides this, it messed up the display by not invoking a redraw after the allocation. * gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so that it is the child again that is queued for a resize. (gtk_table_attach): likewise. (gtk_table_remove): likewise.
1998-06-24 06:25:14 +00:00
gtk_widget_queue_resize (child);
1998-01-27 23:40:51 +00:00
}
static void
gtk_table_get_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
GValue *value,
GParamSpec *pspec)
1998-01-27 23:40:51 +00:00
{
GtkTable *table = GTK_TABLE (container);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
GtkTableChild *table_child;
GList *list;
1998-01-27 23:40:51 +00:00
table_child = NULL;
for (list = priv->children; list; list = list->next)
{
table_child = list->data;
1998-01-27 23:40:51 +00:00
if (table_child->widget == child)
break;
}
if (!list)
{
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
return;
}
switch (property_id)
{
case CHILD_PROP_LEFT_ATTACH:
g_value_set_uint (value, table_child->left_attach);
break;
case CHILD_PROP_RIGHT_ATTACH:
g_value_set_uint (value, table_child->right_attach);
break;
case CHILD_PROP_TOP_ATTACH:
g_value_set_uint (value, table_child->top_attach);
break;
case CHILD_PROP_BOTTOM_ATTACH:
g_value_set_uint (value, table_child->bottom_attach);
break;
case CHILD_PROP_X_OPTIONS:
g_value_set_flags (value, (table_child->xexpand * GTK_EXPAND |
table_child->xshrink * GTK_SHRINK |
table_child->xfill * GTK_FILL));
break;
case CHILD_PROP_Y_OPTIONS:
g_value_set_flags (value, (table_child->yexpand * GTK_EXPAND |
table_child->yshrink * GTK_SHRINK |
table_child->yfill * GTK_FILL));
break;
case CHILD_PROP_X_PADDING:
g_value_set_uint (value, table_child->xpadding);
break;
case CHILD_PROP_Y_PADDING:
g_value_set_uint (value, table_child->ypadding);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static void
gtk_table_init (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
table->priv = G_TYPE_INSTANCE_GET_PRIVATE (table,
GTK_TYPE_TABLE,
2010-08-26 17:15:37 +00:00
GtkTablePrivate);
priv = table->priv;
gtk_widget_set_has_window (GTK_WIDGET (table), FALSE);
Add a function gdk_window_invalidate_maybe_recurse() for use in "shallow Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse() for use in "shallow invalidation" of a widget. (Windows belonging to the widget, but not to the widget's children) * gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set up on ancestors up to the resize container on queue_resize. Size requests only actually take place if GTK_REQUEST_NEEDED, size allocations only take place if GTK_ALLOC_NEEDED or the size changed. * gtk/gtkcontainer.c gtk/gtkwidget.c: Remove container->resize_widgets and the RESIZE_NEEDED flag since the above flags are sufficient to figure out what needs to be resized/reallocated. Remove code manipulating container->resize_widget. * gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this allows widgets to turn off being automatically invalidated is when they are resized. * gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when a widget is resized or moved is "shallow" as described above - only the windows that need to be invalidated are invalidated. * gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt: Make these widget's init functions call gtk_widget_set_redraw_on_allocate(widget,FALSE). * gtk/gtkwindow.c (gtk_window_configure_event): Call _gtk_container_queue_resize(), since we don't want redrawing. (Probably could be done for other calls to gtk_widget_queue_resize() in gtkwindow.c, but this is the most important one.) * gtk/gtkwindow.c (gtk_window_move_resize): Don't call gtk_widget_queue_draw() - size_allocate() handles that as appropriate. * gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead of queue_clear() to avoid invalidating children.
2001-11-04 22:57:03 +00:00
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (table), FALSE);
priv->children = NULL;
priv->rows = NULL;
priv->cols = NULL;
priv->nrows = 0;
priv->ncols = 0;
priv->column_spacing = 0;
priv->row_spacing = 0;
priv->homogeneous = FALSE;
gtk_table_resize (table, 1, 1);
}
GtkWidget*
gtk_table_new (guint rows,
guint columns,
gboolean homogeneous)
{
GtkTable *table;
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
1998-01-27 23:40:51 +00:00
if (rows == 0)
rows = 1;
if (columns == 0)
columns = 1;
table = g_object_new (GTK_TYPE_TABLE, NULL);
priv = table->priv;
priv->homogeneous = (homogeneous ? TRUE : FALSE);
1997-11-24 22:37:52 +00:00
gtk_table_resize (table, rows, columns);
1997-11-24 22:37:52 +00:00
return GTK_WIDGET (table);
}
void
gtk_table_resize (GtkTable *table,
guint n_rows,
guint n_cols)
1998-01-27 23:40:51 +00:00
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
g_return_if_fail (GTK_IS_TABLE (table));
g_return_if_fail (n_rows > 0 && n_rows <= 65535);
g_return_if_fail (n_cols > 0 && n_cols <= 65535);
1998-01-27 23:40:51 +00:00
priv = table->priv;
n_rows = MAX (n_rows, 1);
n_cols = MAX (n_cols, 1);
if (n_rows != priv->nrows ||
n_cols != priv->ncols)
{
GList *list;
for (list = priv->children; list; list = list->next)
{
GtkTableChild *child;
child = list->data;
n_rows = MAX (n_rows, child->bottom_attach);
n_cols = MAX (n_cols, child->right_attach);
}
if (n_rows != priv->nrows)
{
guint i;
i = priv->nrows;
priv->nrows = n_rows;
priv->rows = g_realloc (priv->rows, priv->nrows * sizeof (GtkTableRowCol));
for (; i < priv->nrows; i++)
{
priv->rows[i].requisition = 0;
priv->rows[i].allocation = 0;
priv->rows[i].spacing = priv->row_spacing;
priv->rows[i].need_expand = 0;
priv->rows[i].need_shrink = 0;
priv->rows[i].expand = 0;
priv->rows[i].shrink = 0;
}
g_object_notify (G_OBJECT (table), "n-rows");
}
if (n_cols != priv->ncols)
{
guint i;
i = priv->ncols;
priv->ncols = n_cols;
priv->cols = g_realloc (priv->cols, priv->ncols * sizeof (GtkTableRowCol));
for (; i < priv->ncols; i++)
{
priv->cols[i].requisition = 0;
priv->cols[i].allocation = 0;
priv->cols[i].spacing = priv->column_spacing;
priv->cols[i].need_expand = 0;
priv->cols[i].need_shrink = 0;
priv->cols[i].expand = 0;
priv->cols[i].shrink = 0;
}
g_object_notify (G_OBJECT (table), "n-columns");
}
}
1998-01-27 23:40:51 +00:00
}
1997-11-24 22:37:52 +00:00
void
gtk_table_attach (GtkTable *table,
GtkWidget *child,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach,
GtkAttachOptions xoptions,
GtkAttachOptions yoptions,
guint xpadding,
guint ypadding)
1997-11-24 22:37:52 +00:00
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *table_child;
1998-01-27 23:40:51 +00:00
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_TABLE (table));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (gtk_widget_get_parent (child) == NULL);
/* g_return_if_fail (left_attach >= 0); */
1998-01-27 23:40:51 +00:00
g_return_if_fail (left_attach < right_attach);
/* g_return_if_fail (top_attach >= 0); */
1998-01-27 23:40:51 +00:00
g_return_if_fail (top_attach < bottom_attach);
priv = table->priv;
if (right_attach >= priv->ncols)
gtk_table_resize (table, priv->nrows, right_attach);
if (bottom_attach >= priv->nrows)
gtk_table_resize (table, bottom_attach, priv->ncols);
1997-11-24 22:37:52 +00:00
table_child = g_new (GtkTableChild, 1);
table_child->widget = child;
table_child->left_attach = left_attach;
table_child->right_attach = right_attach;
table_child->top_attach = top_attach;
table_child->bottom_attach = bottom_attach;
table_child->xexpand = (xoptions & GTK_EXPAND) != 0;
table_child->xshrink = (xoptions & GTK_SHRINK) != 0;
table_child->xfill = (xoptions & GTK_FILL) != 0;
table_child->xpadding = xpadding;
table_child->yexpand = (yoptions & GTK_EXPAND) != 0;
table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
table_child->yfill = (yoptions & GTK_FILL) != 0;
table_child->ypadding = ypadding;
priv->children = g_list_prepend (priv->children, table_child);
1997-11-24 22:37:52 +00:00
gtk_widget_set_parent (child, GTK_WIDGET (table));
}
void
gtk_table_attach_defaults (GtkTable *table,
GtkWidget *widget,
guint left_attach,
guint right_attach,
guint top_attach,
guint bottom_attach)
1997-11-24 22:37:52 +00:00
{
gtk_table_attach (table, widget,
left_attach, right_attach,
top_attach, bottom_attach,
GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
0, 0);
}
void
gtk_table_set_row_spacing (GtkTable *table,
guint row,
guint spacing)
1997-11-24 22:37:52 +00:00
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_TABLE (table));
priv = table->priv;
g_return_if_fail (row < priv->nrows);
if (priv->rows[row].spacing != spacing)
1997-11-24 22:37:52 +00:00
{
priv->rows[row].spacing = spacing;
if (gtk_widget_get_visible (GTK_WIDGET (table)))
1997-11-24 22:37:52 +00:00
gtk_widget_queue_resize (GTK_WIDGET (table));
}
}
/**
* gtk_table_get_row_spacing:
* @table: a #GtkTable
* @row: a row in the table, 0 indicates the first row
*
* Gets the amount of space between row @row, and
* row @row + 1. See gtk_table_set_row_spacing().
*
* Return value: the row spacing
**/
guint
gtk_table_get_row_spacing (GtkTable *table,
guint row)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
g_return_val_if_fail (GTK_IS_TABLE (table), 0);
priv = table->priv;
g_return_val_if_fail (row < priv->nrows - 1, 0);
return priv->rows[row].spacing;
}
1997-11-24 22:37:52 +00:00
void
gtk_table_set_col_spacing (GtkTable *table,
guint column,
guint spacing)
1997-11-24 22:37:52 +00:00
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_TABLE (table));
priv = table->priv;
g_return_if_fail (column < priv->ncols);
if (priv->cols[column].spacing != spacing)
1997-11-24 22:37:52 +00:00
{
priv->cols[column].spacing = spacing;
if (gtk_widget_get_visible (GTK_WIDGET (table)))
1997-11-24 22:37:52 +00:00
gtk_widget_queue_resize (GTK_WIDGET (table));
}
}
/**
* gtk_table_get_col_spacing:
* @table: a #GtkTable
* @column: a column in the table, 0 indicates the first column
*
* Gets the amount of space between column @col, and
* column @col + 1. See gtk_table_set_col_spacing().
*
* Return value: the column spacing
**/
guint
gtk_table_get_col_spacing (GtkTable *table,
guint column)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
g_return_val_if_fail (GTK_IS_TABLE (table), 0);
priv = table->priv;
g_return_val_if_fail (column < priv->ncols, 0);
return priv->cols[column].spacing;
}
1997-11-24 22:37:52 +00:00
void
gtk_table_set_row_spacings (GtkTable *table,
guint spacing)
1997-11-24 22:37:52 +00:00
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
guint row;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_TABLE (table));
priv = table->priv;
priv->row_spacing = spacing;
for (row = 0; row < priv->nrows; row++)
priv->rows[row].spacing = spacing;
if (gtk_widget_get_visible (GTK_WIDGET (table)))
1997-11-24 22:37:52 +00:00
gtk_widget_queue_resize (GTK_WIDGET (table));
2002-01-28 18:52:49 +00:00
g_object_notify (G_OBJECT (table), "row-spacing");
1997-11-24 22:37:52 +00:00
}
/**
* gtk_table_get_default_row_spacing:
* @table: a #GtkTable
*
* Gets the default row spacing for the table. This is
* the spacing that will be used for newly added rows.
* (See gtk_table_set_row_spacings())
*
* Return value: the default row spacing
**/
guint
gtk_table_get_default_row_spacing (GtkTable *table)
{
g_return_val_if_fail (GTK_IS_TABLE (table), 0);
return table->priv->row_spacing;
}
1997-11-24 22:37:52 +00:00
void
gtk_table_set_col_spacings (GtkTable *table,
guint spacing)
1997-11-24 22:37:52 +00:00
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
guint col;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_TABLE (table));
priv = table->priv;
priv->column_spacing = spacing;
for (col = 0; col < priv->ncols; col++)
priv->cols[col].spacing = spacing;
if (gtk_widget_get_visible (GTK_WIDGET (table)))
1997-11-24 22:37:52 +00:00
gtk_widget_queue_resize (GTK_WIDGET (table));
2002-01-28 18:52:49 +00:00
g_object_notify (G_OBJECT (table), "column-spacing");
1997-11-24 22:37:52 +00:00
}
/**
* gtk_table_get_default_col_spacing:
* @table: a #GtkTable
*
* Gets the default column spacing for the table. This is
* the spacing that will be used for newly added columns.
* (See gtk_table_set_col_spacings())
*
* Return value: the default column spacing
**/
guint
gtk_table_get_default_col_spacing (GtkTable *table)
{
g_return_val_if_fail (GTK_IS_TABLE (table), 0);
return table->priv->column_spacing;
}
void
gtk_table_set_homogeneous (GtkTable *table,
gboolean homogeneous)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
g_return_if_fail (GTK_IS_TABLE (table));
priv = table->priv;
homogeneous = (homogeneous != 0);
if (homogeneous != priv->homogeneous)
{
priv->homogeneous = homogeneous;
if (gtk_widget_get_visible (GTK_WIDGET (table)))
gtk_widget_queue_resize (GTK_WIDGET (table));
2002-01-28 18:52:49 +00:00
g_object_notify (G_OBJECT (table), "homogeneous");
}
}
/**
* gtk_table_get_homogeneous:
* @table: a #GtkTable
*
* Returns whether the table cells are all constrained to the same
* width and height. (See gtk_table_set_homogenous ())
*
* Return value: %TRUE if the cells are all constrained to the same size
**/
gboolean
gtk_table_get_homogeneous (GtkTable *table)
{
g_return_val_if_fail (GTK_IS_TABLE (table), FALSE);
return table->priv->homogeneous;
}
/**
* gtk_table_get_size:
* @table: a #GtkTable
* @rows: (out) (allow-none): return location for the number of
* rows, or %NULL
* @columns: (out) (allow-none): return location for the number
* of columns, or %NULL
*
* Returns the number of rows and columns in the table.
*
* Since: 2.22
**/
void
gtk_table_get_size (GtkTable *table,
guint *rows,
guint *columns)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv;
g_return_if_fail (GTK_IS_TABLE (table));
priv = table->priv;
if (rows)
*rows = priv->nrows;
if (columns)
*columns = priv->ncols;
}
1997-11-24 22:37:52 +00:00
static void
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
gtk_table_finalize (GObject *object)
1997-11-24 22:37:52 +00:00
{
GtkTable *table = GTK_TABLE (object);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
g_free (priv->rows);
g_free (priv->cols);
2006-05-02 23:56:43 +00:00
G_OBJECT_CLASS (gtk_table_parent_class)->finalize (object);
1997-11-24 22:37:52 +00:00
}
static void
gtk_table_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkTable *table = GTK_TABLE (widget);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
gint row, col;
guint border_width;
1997-11-24 22:37:52 +00:00
requisition->width = 0;
requisition->height = 0;
1997-11-24 22:37:52 +00:00
gtk_table_size_request_init (table);
gtk_table_size_request_pass1 (table);
gtk_table_size_request_pass2 (table);
gtk_table_size_request_pass3 (table);
gtk_table_size_request_pass2 (table);
for (col = 0; col < priv->ncols; col++)
requisition->width += priv->cols[col].requisition;
for (col = 0; col + 1 < priv->ncols; col++)
requisition->width += priv->cols[col].spacing;
for (row = 0; row < priv->nrows; row++)
requisition->height += priv->rows[row].requisition;
for (row = 0; row + 1 < priv->nrows; row++)
requisition->height += priv->rows[row].spacing;
border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
requisition->width += border_width * 2;
requisition->height += border_width * 2;
1997-11-24 22:37:52 +00:00
}
static void
gtk_table_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkTable *table = GTK_TABLE (widget);
gtk_widget_set_allocation (widget, allocation);
1997-11-24 22:37:52 +00:00
gtk_table_size_allocate_init (table);
gtk_table_size_allocate_pass1 (table);
gtk_table_size_allocate_pass2 (table);
}
static void
gtk_table_add (GtkContainer *container,
GtkWidget *widget)
{
gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
}
static void
gtk_table_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkTable *table = GTK_TABLE (container);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GtkWidget *widget_container = GTK_WIDGET (container);
1997-11-24 22:37:52 +00:00
GList *children;
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
1997-11-24 22:37:52 +00:00
if (child->widget == widget)
{
gboolean was_visible = gtk_widget_get_visible (widget);
1997-11-24 22:37:52 +00:00
gtk_widget_unparent (widget);
priv->children = g_list_remove (priv->children, child);
g_free (child);
if (was_visible && gtk_widget_get_visible (widget_container))
gtk_widget_queue_resize (widget_container);
break;
}
1997-11-24 22:37:52 +00:00
}
}
static void
GTK_MENU_DIR_CHILD: check for the existance of Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org> * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): GTK_MENU_DIR_CHILD: check for the existance of menu_shell->active_menu_item before accessing its child. GTK_MENU_DIR_PREV: GTK_MENU_DIR_NEXT: if we haven't had an active item and still don't, make a default selection. Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org> * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate the children with _forall for sensitivity changes and with _foreach on pure state changes. this fixes a lot of the old inclusions of internal widgets into _foreach calls. * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall do the work. don't walk the subtrees of first level children. * gtk/gtktreeitem.c: provide a _forall implementation, which walks the subtrees as well for include_internals. * gtk/gtkmenuitem.c: provide a _forall implementation, which walks the submenus as well for include_internals. * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and implemented gtk_scrolled_window_forall, which will iterate over the viewport and the scrollbars for gtk_container_forall or iterate over the viewports children for gtk_container_foreach. * gtk/gtktoolbar.c: * gtk/gtktable.c: * gtk/gtkpaned.c: * gtk/gtkpacker.c: * gtk/gtkmenushell.c: * gtk/gtklist.c: * gtk/gtkfixed.c: * gtk/gtkclist.c: * gtk/gtkbox.c: * gtk/gtkbin.c: * gtk/gtknotebook.c: removed the old gtk_*_foreach functions and provided gtk_*_forall. * gtk/gtknotebook.c: (gtk_notebook_real_switch_page): expose tabs. (gtk_notebook_page_num): new function to return the page number of a distinct child. (gtk_notebook_focus): minor fixups. foxus handling is still screwed under some circumstances. * gtk/gtktreeitem.c: (gtk_real_tree_item_select): (gtk_real_tree_item_deselect): major fixes. some general fixups wrt queue_redraw, and tree items not being NO_WINDOW widgets. * gtk/gtklistitem.c: (gtk_real_list_item_select): (gtk_real_list_item_deselect): (gtk_real_list_item_toggle): removed unneccessary queue_redraw calls. Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org> * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and automatically popup the menu on space bar. Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.h: * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class method), which acts similar to gtk_container_foreach(), but iterates over internal children. the GtkContainer::foreach signal vanished in favour of a new class method ->forall() that optionally includes internal widgets. * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation but a _forall implementation, since all child widgets we have are internal ones. (column_button_create): set the parent window prior to gtk_widget_set_parent(). * gtk/gtkwidget.c: exchanged all calls to gtk_container_foreach() with gtk_container_forall(). * gtk/gtkwidget.h: * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through the GtkWidget::composite_child argument. to have a widget created with the flag initially, two new functions got added to wrap a widgets creation: gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag(). Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org> * gtk/gtktooltips.h: * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as gtk_tooltips_force_window(), so tooltips->tip_window can be accessed prior to the first tip being set. don't put an extra reference on the window, since it is a toplevel, it wont get destroyed from anywhere else. * overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
gtk_table_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
1997-11-24 22:37:52 +00:00
{
GtkTable *table = GTK_TABLE (container);
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GList *children;
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
1997-11-24 22:37:52 +00:00
(* callback) (child->widget, callback_data);
}
}
static void
gtk_table_size_request_init (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GList *children;
gint row, col;
for (row = 0; row < priv->nrows; row++)
{
priv->rows[row].requisition = 0;
priv->rows[row].expand = FALSE;
}
for (col = 0; col < priv->ncols; col++)
{
priv->cols[col].requisition = 0;
priv->cols[col].expand = FALSE;
}
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_get_visible (child->widget))
gtk_widget_size_request (child->widget, NULL);
if (child->left_attach == (child->right_attach - 1) && child->xexpand)
priv->cols[child->left_attach].expand = TRUE;
if (child->top_attach == (child->bottom_attach - 1) && child->yexpand)
priv->rows[child->top_attach].expand = TRUE;
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_table_size_request_pass1 (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GList *children;
gint width;
gint height;
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_get_visible (child->widget))
{
GtkRequisition child_requisition;
gtk_widget_get_child_requisition (child->widget, &child_requisition);
/* Child spans a single column.
*/
if (child->left_attach == (child->right_attach - 1))
{
width = child_requisition.width + child->xpadding * 2;
priv->cols[child->left_attach].requisition = MAX (priv->cols[child->left_attach].requisition, width);
}
/* Child spans a single row.
*/
if (child->top_attach == (child->bottom_attach - 1))
{
height = child_requisition.height + child->ypadding * 2;
priv->rows[child->top_attach].requisition = MAX (priv->rows[child->top_attach].requisition, height);
}
}
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_table_size_request_pass2 (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
gint max_width;
gint max_height;
gint row, col;
if (priv->homogeneous)
1997-11-24 22:37:52 +00:00
{
max_width = 0;
max_height = 0;
for (col = 0; col < priv->ncols; col++)
max_width = MAX (max_width, priv->cols[col].requisition);
for (row = 0; row < priv->nrows; row++)
max_height = MAX (max_height, priv->rows[row].requisition);
for (col = 0; col < priv->ncols; col++)
priv->cols[col].requisition = max_width;
for (row = 0; row < priv->nrows; row++)
priv->rows[row].requisition = max_height;
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_table_size_request_pass3 (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GList *children;
gint width, height;
gint row, col;
gint extra;
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_get_visible (child->widget))
{
/* Child spans multiple columns.
*/
if (child->left_attach != (child->right_attach - 1))
{
GtkRequisition child_requisition;
gtk_widget_get_child_requisition (child->widget, &child_requisition);
/* Check and see if there is already enough space
* for the child.
*/
width = 0;
for (col = child->left_attach; col < child->right_attach; col++)
{
width += priv->cols[col].requisition;
if ((col + 1) < child->right_attach)
width += priv->cols[col].spacing;
}
/* If we need to request more space for this child to fill
* its requisition, then divide up the needed space amongst the
* columns it spans, favoring expandable columns if any.
*/
if (width < child_requisition.width + child->xpadding * 2)
{
gint n_expand = 0;
gboolean force_expand = FALSE;
width = child_requisition.width + child->xpadding * 2 - width;
for (col = child->left_attach; col < child->right_attach; col++)
if (priv->cols[col].expand)
n_expand++;
if (n_expand == 0)
{
n_expand = (child->right_attach - child->left_attach);
force_expand = TRUE;
}
for (col = child->left_attach; col < child->right_attach; col++)
if (force_expand || priv->cols[col].expand)
{
extra = width / n_expand;
priv->cols[col].requisition += extra;
width -= extra;
n_expand--;
}
}
}
/* Child spans multiple rows.
*/
if (child->top_attach != (child->bottom_attach - 1))
{
GtkRequisition child_requisition;
gtk_widget_get_child_requisition (child->widget, &child_requisition);
/* Check and see if there is already enough space
* for the child.
*/
height = 0;
for (row = child->top_attach; row < child->bottom_attach; row++)
{
height += priv->rows[row].requisition;
if ((row + 1) < child->bottom_attach)
height += priv->rows[row].spacing;
}
/* If we need to request more space for this child to fill
* its requisition, then divide up the needed space amongst the
* rows it spans, favoring expandable rows if any.
*/
if (height < child_requisition.height + child->ypadding * 2)
{
gint n_expand = 0;
gboolean force_expand = FALSE;
height = child_requisition.height + child->ypadding * 2 - height;
for (row = child->top_attach; row < child->bottom_attach; row++)
{
if (priv->rows[row].expand)
n_expand++;
}
if (n_expand == 0)
{
n_expand = (child->bottom_attach - child->top_attach);
force_expand = TRUE;
}
for (row = child->top_attach; row < child->bottom_attach; row++)
if (force_expand || priv->rows[row].expand)
{
extra = height / n_expand;
priv->rows[row].requisition += extra;
height -= extra;
n_expand--;
}
}
}
}
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_table_size_allocate_init (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GList *children;
gint row, col;
gint has_expand;
gint has_shrink;
1997-11-24 22:37:52 +00:00
/* Initialize the rows and cols.
* By default, rows and cols do not expand and do shrink.
* Those values are modified by the children that occupy
* the rows and cols.
*/
for (col = 0; col < priv->ncols; col++)
1997-11-24 22:37:52 +00:00
{
priv->cols[col].allocation = priv->cols[col].requisition;
priv->cols[col].need_expand = FALSE;
priv->cols[col].need_shrink = TRUE;
priv->cols[col].expand = FALSE;
priv->cols[col].shrink = TRUE;
priv->cols[col].empty = TRUE;
1997-11-24 22:37:52 +00:00
}
for (row = 0; row < priv->nrows; row++)
1997-11-24 22:37:52 +00:00
{
priv->rows[row].allocation = priv->rows[row].requisition;
priv->rows[row].need_expand = FALSE;
priv->rows[row].need_shrink = TRUE;
priv->rows[row].expand = FALSE;
priv->rows[row].shrink = TRUE;
priv->rows[row].empty = TRUE;
1997-11-24 22:37:52 +00:00
}
1997-11-24 22:37:52 +00:00
/* Loop over all the children and adjust the row and col values
* based on whether the children want to be allowed to expand
* or shrink. This loop handles children that occupy a single
* row or column.
*/
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_get_visible (child->widget))
{
if (child->left_attach == (child->right_attach - 1))
{
if (child->xexpand)
priv->cols[child->left_attach].expand = TRUE;
if (!child->xshrink)
priv->cols[child->left_attach].shrink = FALSE;
priv->cols[child->left_attach].empty = FALSE;
}
if (child->top_attach == (child->bottom_attach - 1))
{
if (child->yexpand)
priv->rows[child->top_attach].expand = TRUE;
if (!child->yshrink)
priv->rows[child->top_attach].shrink = FALSE;
priv->rows[child->top_attach].empty = FALSE;
}
}
1997-11-24 22:37:52 +00:00
}
1997-11-24 22:37:52 +00:00
/* Loop over all the children again and this time handle children
* which span multiple rows or columns.
*/
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_get_visible (child->widget))
{
if (child->left_attach != (child->right_attach - 1))
{
for (col = child->left_attach; col < child->right_attach; col++)
priv->cols[col].empty = FALSE;
if (child->xexpand)
{
has_expand = FALSE;
for (col = child->left_attach; col < child->right_attach; col++)
if (priv->cols[col].expand)
{
has_expand = TRUE;
break;
}
if (!has_expand)
for (col = child->left_attach; col < child->right_attach; col++)
priv->cols[col].need_expand = TRUE;
}
if (!child->xshrink)
{
has_shrink = TRUE;
for (col = child->left_attach; col < child->right_attach; col++)
if (!priv->cols[col].shrink)
{
has_shrink = FALSE;
break;
}
if (has_shrink)
for (col = child->left_attach; col < child->right_attach; col++)
priv->cols[col].need_shrink = FALSE;
}
}
if (child->top_attach != (child->bottom_attach - 1))
{
for (row = child->top_attach; row < child->bottom_attach; row++)
priv->rows[row].empty = FALSE;
if (child->yexpand)
{
has_expand = FALSE;
for (row = child->top_attach; row < child->bottom_attach; row++)
if (priv->rows[row].expand)
{
has_expand = TRUE;
break;
}
if (!has_expand)
for (row = child->top_attach; row < child->bottom_attach; row++)
priv->rows[row].need_expand = TRUE;
}
if (!child->yshrink)
{
has_shrink = TRUE;
for (row = child->top_attach; row < child->bottom_attach; row++)
if (!priv->rows[row].shrink)
{
has_shrink = FALSE;
break;
}
if (has_shrink)
for (row = child->top_attach; row < child->bottom_attach; row++)
priv->rows[row].need_shrink = FALSE;
}
}
}
1997-11-24 22:37:52 +00:00
}
1997-11-24 22:37:52 +00:00
/* Loop over the columns and set the expand and shrink values
* if the column can be expanded or shrunk.
*/
for (col = 0; col < priv->ncols; col++)
1997-11-24 22:37:52 +00:00
{
if (priv->cols[col].empty)
{
priv->cols[col].expand = FALSE;
priv->cols[col].shrink = FALSE;
}
else
{
if (priv->cols[col].need_expand)
priv->cols[col].expand = TRUE;
if (!priv->cols[col].need_shrink)
priv->cols[col].shrink = FALSE;
}
1997-11-24 22:37:52 +00:00
}
1997-11-24 22:37:52 +00:00
/* Loop over the rows and set the expand and shrink values
* if the row can be expanded or shrunk.
*/
for (row = 0; row < priv->nrows; row++)
1997-11-24 22:37:52 +00:00
{
if (priv->rows[row].empty)
{
priv->rows[row].expand = FALSE;
priv->rows[row].shrink = FALSE;
}
1998-08-04 15:07:55 +00:00
else
{
if (priv->rows[row].need_expand)
priv->rows[row].expand = TRUE;
if (!priv->rows[row].need_shrink)
priv->rows[row].shrink = FALSE;
1998-08-04 15:07:55 +00:00
}
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_table_size_allocate_pass1 (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
GtkAllocation allocation;
1997-11-24 22:37:52 +00:00
gint real_width;
gint real_height;
gint width, height;
gint row, col;
gint nexpand;
gint nshrink;
gint extra;
guint border_width;
1997-11-24 22:37:52 +00:00
/* If we were allocated more space than we requested
* then we have to expand any expandable rows and columns
* to fill in the extra space.
*/
gtk_widget_get_allocation (GTK_WIDGET (table), &allocation);
border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
real_width = allocation.width - border_width * 2;
real_height = allocation.height - border_width * 2;
if (priv->homogeneous)
1997-11-24 22:37:52 +00:00
{
if (!priv->children)
nexpand = 1;
else
{
nexpand = 0;
for (col = 0; col < priv->ncols; col++)
if (priv->cols[col].expand)
{
nexpand += 1;
break;
}
}
if (nexpand)
{
width = real_width;
for (col = 0; col + 1 < priv->ncols; col++)
width -= priv->cols[col].spacing;
for (col = 0; col < priv->ncols; col++)
{
extra = width / (priv->ncols - col);
priv->cols[col].allocation = MAX (1, extra);
width -= extra;
}
}
1997-11-24 22:37:52 +00:00
}
else
{
width = 0;
nexpand = 0;
nshrink = 0;
for (col = 0; col < priv->ncols; col++)
{
width += priv->cols[col].requisition;
if (priv->cols[col].expand)
nexpand += 1;
if (priv->cols[col].shrink)
nshrink += 1;
}
for (col = 0; col + 1 < priv->ncols; col++)
width += priv->cols[col].spacing;
1997-11-24 22:37:52 +00:00
/* Check to see if we were allocated more width than we requested.
*/
if ((width < real_width) && (nexpand >= 1))
{
width = real_width - width;
for (col = 0; col < priv->ncols; col++)
if (priv->cols[col].expand)
{
extra = width / nexpand;
priv->cols[col].allocation += extra;
width -= extra;
nexpand -= 1;
}
}
2000-03-14 19:57:25 +00:00
/* Check to see if we were allocated less width than we requested,
* then shrink until we fit the size give.
1997-11-24 22:37:52 +00:00
*/
2000-03-14 19:57:25 +00:00
if (width > real_width)
{
2000-03-14 19:57:25 +00:00
gint total_nshrink = nshrink;
extra = width - real_width;
while (total_nshrink > 0 && extra > 0)
{
nshrink = total_nshrink;
for (col = 0; col < priv->ncols; col++)
if (priv->cols[col].shrink)
2000-03-14 19:57:25 +00:00
{
gint allocation = priv->cols[col].allocation;
2000-03-14 19:57:25 +00:00
priv->cols[col].allocation = MAX (1, (gint) priv->cols[col].allocation - extra / nshrink);
extra -= allocation - priv->cols[col].allocation;
2000-03-14 19:57:25 +00:00
nshrink -= 1;
if (priv->cols[col].allocation < 2)
2000-03-14 19:57:25 +00:00
{
total_nshrink -= 1;
priv->cols[col].shrink = FALSE;
2000-03-14 19:57:25 +00:00
}
}
}
}
1997-11-24 22:37:52 +00:00
}
if (priv->homogeneous)
1997-11-24 22:37:52 +00:00
{
if (!priv->children)
nexpand = 1;
else
{
nexpand = 0;
for (row = 0; row < priv->nrows; row++)
if (priv->rows[row].expand)
{
nexpand += 1;
break;
}
}
if (nexpand)
{
height = real_height;
for (row = 0; row + 1 < priv->nrows; row++)
height -= priv->rows[row].spacing;
for (row = 0; row < priv->nrows; row++)
{
extra = height / (priv->nrows - row);
priv->rows[row].allocation = MAX (1, extra);
height -= extra;
}
}
1997-11-24 22:37:52 +00:00
}
else
{
height = 0;
nexpand = 0;
nshrink = 0;
for (row = 0; row < priv->nrows; row++)
{
height += priv->rows[row].requisition;
if (priv->rows[row].expand)
nexpand += 1;
if (priv->rows[row].shrink)
nshrink += 1;
}
for (row = 0; row + 1 < priv->nrows; row++)
height += priv->rows[row].spacing;
1997-11-24 22:37:52 +00:00
/* Check to see if we were allocated more height than we requested.
*/
if ((height < real_height) && (nexpand >= 1))
{
height = real_height - height;
for (row = 0; row < priv->nrows; row++)
if (priv->rows[row].expand)
{
extra = height / nexpand;
priv->rows[row].allocation += extra;
height -= extra;
nexpand -= 1;
}
}
1997-11-24 22:37:52 +00:00
/* Check to see if we were allocated less height than we requested.
2000-03-14 19:57:25 +00:00
* then shrink until we fit the size give.
1997-11-24 22:37:52 +00:00
*/
2000-03-14 19:57:25 +00:00
if (height > real_height)
{
2000-03-14 19:57:25 +00:00
gint total_nshrink = nshrink;
2000-03-14 19:57:25 +00:00
extra = height - real_height;
while (total_nshrink > 0 && extra > 0)
{
nshrink = total_nshrink;
for (row = 0; row < priv->nrows; row++)
if (priv->rows[row].shrink)
2000-03-14 19:57:25 +00:00
{
gint allocation = priv->rows[row].allocation;
priv->rows[row].allocation = MAX (1, (gint) priv->rows[row].allocation - extra / nshrink);
extra -= allocation - priv->rows[row].allocation;
2000-03-14 19:57:25 +00:00
nshrink -= 1;
if (priv->rows[row].allocation < 2)
2000-03-14 19:57:25 +00:00
{
total_nshrink -= 1;
priv->rows[row].shrink = FALSE;
2000-03-14 19:57:25 +00:00
}
}
}
}
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_table_size_allocate_pass2 (GtkTable *table)
{
2010-08-26 17:15:37 +00:00
GtkTablePrivate *priv = table->priv;
1997-11-24 22:37:52 +00:00
GtkTableChild *child;
GList *children;
gint max_width;
gint max_height;
gint x, y;
gint row, col;
GtkAllocation allocation;
GtkAllocation table_allocation, widget_allocation;
Remove all references to offscreen flag which was no longer used. Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Remove all references to offscreen flag which was no longer used. * gtk/gtkprivate.h (enum): Remove unused flags and compress. * gtk/gtkframe.c (gtk_frame_set_label_widget): Check for non-null label_widget->parent. * gtk/gtkentry.c: Get rid of code to deal with PangoAttribute which no longer was used. * gdk/gdkpango.c (gdk_pango_context_get_info): make static. * gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks for null arguments. * gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add check for destroyed windows. Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmulticontext.c: Add a finalize method and unref the slave context there. * gtk/gtkinvisible.[ch]: Make reference counting behavior identical to GtkWindow. Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com> * Makefile.am gdk/gdkpango.c: Copy the layout render function from pangox to here, so we can write them independent of rendering system, using GDK primitives. * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable, since we have a rendering-system independent implementation in terms of draw_glyphs(). * gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New function to render a single line. * gdk/x11/gdkpango.c: Move the guts of this file mostly into ../gdkpango.c, which simplifies things, since we don't have to deal with raw X gc's. Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add get_log_attrs() function to get the logical attributes for a given GtkTextLine. Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track g_locale_get_codeset() to g_get_codeset() change. Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com> * gtk/testcalendar.c (calendar_font_selection_ok): Use font descriptions. * gtk/gtkentry.c (gtk_entry_draw_text): Center text within the entry. * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of redoing (vastly simplifying) for Pango. Still needs quite a bit of work. (Size selection is currently poor. List of predefined sizes is not a good idea, since all of these sizes won't necessarily be distinct.) Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle CODESET results for LANG=C. Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC which takes a stringized pango font description; ignore the older 'font' and 'fontset' declarations. * gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font field with a GdkFont derived via gdk_font_from_description(), for compatibility. (Should we just remove it entirely? Probably too much compatibility breakage, but people should be migrating to the new Pango stuff as quickly as possible.) Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/. Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcalender.c: Roughly pango-ized. Really needs redoing; there are some bugs in size allocation right now, the semi-existant distinction between header / day fonts was removed, but, with Pango, could actually be made functional in a nice way. * gtk/testcalender: Move calender from examples into this directory as a test program. (We really need to restrcture testgtk into a whole directory full of tests for every widget or functionality group, separated into multiple .c files.) Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c (file_exists): Fix stupid typo that was keeping RC file from being loaded. * gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized RC file font code. Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description): Add function to load a GdkFont from a PangoFontDescription. Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able to have any widget for the label, use a GtkLabel widget to display the text. (Based partially on a patch from Anders Carlson.) (Quite a bit of code reorganization - strip 90% of the guts out of gtkaspectframe and add a single virtual func to GtkFrameClass - compute_child_allocation.) Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized. (Removed clist->row_center_offset field because caching it wasn't saving time or code, added private function _gtk_clist_create_cell_layout()). Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkaccellabel.c: Pangoized. * gtk/[hv]ruler.c: Pangoized Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c (gtk_file_selection_init): Use gtk_clist_set_column_auto_resize() to remove need need for manual column width computations. Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel, ensuring Pango correctness, and considerably simplifying the code. * gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE. * gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect getting of numbers of lines. * gtk/gtklabel.c (gtk_label_size_request): Set the requisition to the actual requested width of the lable, not to the wrap width we set. * gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h. * gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes. * gtk/gtktextview.c: Fix structure inheritance. * gtk/gtkprogressbar.c: Pangoize. Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate in a function. * gtk/gtktextlayout.c (find_display_line_above): Fixed bug with computing line tops. * gtk/gtktextview.c (changed_handler): Fix < , <= confusion. Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset and y_offset coordinates to do what we need now. (The offset between buffer and layout coordinates has been reintroduced, but is a bit different than before.) * gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead handle the adjustments ourselves, and scroll as necessary using the new gdk_window_scroll(). The advantage of this is that when we are incrementally revalidating, we are essentially rearranging things around the visible portion of the screen. With the old setup, the visible portion of the screen was moved around in the layout, so scrolling and redrawing to track that caused jumping of the display. Since we now control the scrolling ourselves, we can suppress this and only redraw when things actually change. Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (redisplay_mark): We need to invalidate the region not just redisplay it after-all, since we store the cursors in the LineDisplay. (Ugly interactions here between GtkLayout and GtkTextBTree here.) * gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison. Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): Added function to scroll contents of a window while keeping the window constant. Works by XCopyArea or guffaw-scrolling depending on the details of how the window is set up. (guffaw-scrolling still needs to be filled in.) Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget, move the debugging that was tied to a global variable to that. * gtk/gtkmarshal.list: Add NONE:INT,INT,INT * gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate validated flag, in line data instead of setting height/width to -1. This allows us to perform operations with partially invalid buffer (using the old size for invalid lines) and thus to do incremental vaidation. Keep height/width aggregates up to date when deleting text and rebalancing the tree. * gtk/gtktextbtree.[ch]: Add functions validate a line (gtk_text_btree_validate_line), and to validate up to a number of pixels (gtk_text_btree_validate). * gtk/gtktextlayout.[ch]: Add an ::invalidated signal that indicates that something is changed and a revalidation pass is needed. Change ::need_repaint to ::changed, and make it take old and new yranges instead of a rectangle. * gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move the line_data_destroy() function from gtk_text_btree_add_view() to a virtual function in GtkTextLayout * gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(), since we are handling partial repaints in a different fashion now. * gtk/gtktextbtree.[ch]: Only repaint the changed portion of the selection instead of queueing a repaint on the entire widget. * gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move get_selection_bounds() down to btree, make the function in buffer a wrapper around the btree function. * gtk/gtktextlayout.[ch]: Add functions to check if the layout is valid and to recompute either a range of pixels aroudn a line or a certain total number of pixels. * gtk/gtktextlayout.[ch]: Cache a single line display; now that we only redraw the needed portions, the hit rate for this cache is quite high. * gtk/gtktextview.[ch]: Keep track of the first paragraph on the screen so that when re-laying-out the buffer, we can keep the same place. This requires connecting to ::value_changed on the adjustments * gtk/gtktextview.[ch]: Add idle functions to revalidate the buffer after we receive an ::invalidated signal. Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_size_allocate): Set upper to max of allocation and layout size, not just to the layout size. * gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size): Invalidate window so it gets redrawn properly. * gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL to mean the entire window. * gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW into public header. Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextmark.c (gtk_text_mark_get_name): Add function to get the name of a mark. * gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function to find the paragraph from a y position. Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid nodes have width/height >= 0, not > 0. Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display): Add a size_only flag, so when we only need the size, we don't create useless appearance attributes. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove duplicate setting of font description. * gtk/gtkscale.c: Use PANGO_SCALE instead of 1000 Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into EXTRA_DIST. It does not work well when the file that everything depends on is not in the tarball. Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c: Some hacks and fixes so that it basically works when not sitting in the GTK+ build tree. 2000-05-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag): Properly determine the ordering of the tag root and the current line within the tree. Previous algorithm only worked if the tag root's immediate parent was the common root of both the current line and the tag root. Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (set_para_values): Fix some bugs in alignment. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Track the widget text directional dynamically. * gtk/gtktextview.[ch]: Added functions to get and set default wrap mode. Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug in cursor location computation. Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/ vadjusment values properly when layout gets smaller. * gtk/gtktextview.c (need_repaint_handler): Areas being passed in are far completely inaccurate, and sometimes too small, so, for now, just queue a redraw on the whole visible region. 2000-04-25 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (summary_destroy): new function to destroy tag summary nodes (gtk_text_line_next_could_contain_tag): this function was totally broken if the line passed in wasn't below the tag root. Fix it. (gtk_text_btree_first_could_contain_tag): In the tag == NULL "wildcard" case, we have to do a linear scan. Blah. (gtk_text_btree_last_could_contain_tag): In tag == NULL case, we have to do the linear scan (tag_removed_cb): When a tag is removed from the tag table, remove the GtkTextTagInfo node from the btree. (gtk_text_btree_spew): Implement the spew function, for our debugging pleasure. Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix a problem with referring to the wrong buffer. * gtk/gtkentry.c: Fix focus-in/focus-out confusion. * gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default font description to gtk_style_new() - otherwise things don't work without a .gtkrc file. * gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the tags table if we create it ourself, too. * gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since it was conflicting with XKB modifiers. * gtk/gtktextview.[ch]: Add simple support for GtkIMContext. Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem with deletion from last commit. Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language in the context from the current locale. * gtk/gtkentry.c (gtk_entry_size_request): Use language from the context, not hardcoded value. * gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual, not logical. Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as attributes - that doesn't handle partial-glyph selection properly. Instead use new pango_layout_line_get_x_ranges() functionality to draw the selection. * gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x() now properly handles out-of-range coordinates. * gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved. * gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte() public. * gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext for paragraphs opposite to the base direction of the widget. * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment. * gtk/gtktextlayout.c: Don't split segments on marks, since that causes Arabic words to reshape as you cursor through. * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual cursor position when moving vertically with the arrow keys and scrolling with page-up/page-down. (Arrow keys save only the X, scrolling saves both X and Y.) This means you can line-up / line-down or page-up / page-down without losing your place, and also that moving vertically with the cursor keys keeps the same X position, not the same character count: * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical arrow keys move by display lines, not paragraphs. Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c: Make sure that the bin window is at least as big as the allocation. (Should we also make sure that the bin window is big enough to completely cover widget->window?) * gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add function to get the onscreen rectangle. * gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account for offsets in window coordinates. Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset confusion. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction from the widget direction. * gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg): Add a "direction" attribute. * gtk/gtktextview.c: global s/tkxt/text_view/. * gtk/testtext.c: Added long block of text in Arabic, to test out the direction attributes. (Some problems with the shaping system for arabic become obvious - like the fact the cursor splits words into unjoined pieces.) Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (render_layout): Add overstrike handling. * gtk/gtktextlayout.c: Fix up alignment. * gtk/testtext.c: Add some tests for centering, wrapping. Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs(). If we wrote GTK+-specific layout-render function this could just replace the draw_layout() operation in the vtable. * gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to pango_layout_get_cursor_pos() and use that function. * gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it is a non-static symbol. * gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y() with gtk_text_btree_find_line_by_y() * gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout renderer that handles GtkTextAppearance attributes. * gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h: - Move the values in the style that don't affect geometry into a GtkTextAppearance structure. - Change underline to take a PangoUnderline and "font" a string representation of a font description - Add a "font_desc" attribute which takes a FontDescription structure. * gtk/gtktextlayout.[ch]: - Get rid of the display-line list per each line. Instead, we generate, on demand, a GtkTextLineDisplay structure which] contains a PangoLayout * and other necesary information (offsets, cursor locations) for displaying a paragraph. - Get rid of the code to wrap lines, create display chunks, etc. Instead, we just go through a paragraph and convert it into the necessary inputs to a PangoLayout. - Implement a new attribute type, GtkTextAttrAppearance. This holds a GtkTextAppearance, and is used to pass colors, stipple, etc, through from the layout to the display without having to use lots and lots of individual attributes. - Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos() in terms of PangoLayout functions. * gtk/gtktextview.c: - Handle passing the necessary PangoContext to the layout - Some fixups in painting to deal with the automatic backing store and offsetting of GTK+-1.4 - Add a style_set handler so that the default style reacts properly to theme changes. * gtk/gtktext?*.[ch]: Random code-style fixes. * gtk/testtext.c: Substitute in languages that Pango handles now for Thai Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget, in original form preparatory to Pango-ization and gdkimcontext-ization. Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.c: Move default implementations to real_* vfuncs, so that we can derive from gtkimcontext in language bindings properly. Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval. Add a compose table including (almost) all the compose combinations from X. This is 6k of static, shared data as opposed to 50k or so of dynamic data in the XIM implementation. * gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval): Moved functions to convert keyvalues from and to unicode here from the win32 port and made them public. Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1. Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.[ch]: Base class for new input context system * gtk/gtkimmulticontext.[ch]: Proxy input context that allows the real input context implementation to be loaded from modules and switched on the fly. * gtk/gtkcontextsimple.[ch]: Simple implementation of an input context that just does direct keysymbol => unicode translation. * gtk/gtkentry.[ch]: Start switching editing over to using GtkInputContext. (No handling of preedit yet.) Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too many substitutions. (klass should not be subsituted.) Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com> * configure.in: Add checks for Pango * configure.in docs/Makefile.am: Add test for sgml2html and allow 'make dist' without building html, but print out warnings in that case. (For making snapshots) * gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am: Add Pango libraries and C flags * gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add function (gdk_draw_layout) to draw a pango layout. * gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions for getting Pango contexts for GDK. * gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set() * gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional editing. * gtk/gtkentry.c: Hack in simple Hebrew input with direct keysym => unicode translations. More languages can be added here, but real input-method support is needed. * docs/Changes-1.4.txt: Added note about entry behavior. * gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions to set the reading direction for a widget and the global direction. Add test which allows toggling the global direction. Two private flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR) * gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c * gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango * gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking, underlining now handled by Pango. * gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription to RCStyle and Style. (Having both this and the old font name and GdkFont is temporary.) * gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added convenience functions for creating contexts and layouts for widgets. * gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
GtkWidget *widget = GTK_WIDGET (table);
children = priv->children;
1997-11-24 22:37:52 +00:00
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_get_visible (child->widget))
{
GtkRequisition child_requisition;
guint border_width;
gtk_widget_get_child_requisition (child->widget, &child_requisition);
gtk_widget_get_allocation (GTK_WIDGET (table), &table_allocation);
border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
x = table_allocation.x + border_width;
y = table_allocation.y + border_width;
max_width = 0;
max_height = 0;
for (col = 0; col < child->left_attach; col++)
{
x += priv->cols[col].allocation;
x += priv->cols[col].spacing;
}
for (col = child->left_attach; col < child->right_attach; col++)
{
max_width += priv->cols[col].allocation;
if ((col + 1) < child->right_attach)
max_width += priv->cols[col].spacing;
}
for (row = 0; row < child->top_attach; row++)
{
y += priv->rows[row].allocation;
y += priv->rows[row].spacing;
}
for (row = child->top_attach; row < child->bottom_attach; row++)
{
max_height += priv->rows[row].allocation;
if ((row + 1) < child->bottom_attach)
max_height += priv->rows[row].spacing;
}
if (child->xfill)
{
allocation.width = MAX (1, max_width - (gint)child->xpadding * 2);
allocation.x = x + (max_width - allocation.width) / 2;
}
else
{
allocation.width = child_requisition.width;
allocation.x = x + (max_width - allocation.width) / 2;
}
if (child->yfill)
{
allocation.height = MAX (1, max_height - (gint)child->ypadding * 2);
allocation.y = y + (max_height - allocation.height) / 2;
}
else
{
allocation.height = child_requisition.height;
allocation.y = y + (max_height - allocation.height) / 2;
}
Remove all references to offscreen flag which was no longer used. Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Remove all references to offscreen flag which was no longer used. * gtk/gtkprivate.h (enum): Remove unused flags and compress. * gtk/gtkframe.c (gtk_frame_set_label_widget): Check for non-null label_widget->parent. * gtk/gtkentry.c: Get rid of code to deal with PangoAttribute which no longer was used. * gdk/gdkpango.c (gdk_pango_context_get_info): make static. * gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks for null arguments. * gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add check for destroyed windows. Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmulticontext.c: Add a finalize method and unref the slave context there. * gtk/gtkinvisible.[ch]: Make reference counting behavior identical to GtkWindow. Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com> * Makefile.am gdk/gdkpango.c: Copy the layout render function from pangox to here, so we can write them independent of rendering system, using GDK primitives. * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable, since we have a rendering-system independent implementation in terms of draw_glyphs(). * gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New function to render a single line. * gdk/x11/gdkpango.c: Move the guts of this file mostly into ../gdkpango.c, which simplifies things, since we don't have to deal with raw X gc's. Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add get_log_attrs() function to get the logical attributes for a given GtkTextLine. Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track g_locale_get_codeset() to g_get_codeset() change. Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com> * gtk/testcalendar.c (calendar_font_selection_ok): Use font descriptions. * gtk/gtkentry.c (gtk_entry_draw_text): Center text within the entry. * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of redoing (vastly simplifying) for Pango. Still needs quite a bit of work. (Size selection is currently poor. List of predefined sizes is not a good idea, since all of these sizes won't necessarily be distinct.) Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle CODESET results for LANG=C. Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC which takes a stringized pango font description; ignore the older 'font' and 'fontset' declarations. * gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font field with a GdkFont derived via gdk_font_from_description(), for compatibility. (Should we just remove it entirely? Probably too much compatibility breakage, but people should be migrating to the new Pango stuff as quickly as possible.) Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/. Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcalender.c: Roughly pango-ized. Really needs redoing; there are some bugs in size allocation right now, the semi-existant distinction between header / day fonts was removed, but, with Pango, could actually be made functional in a nice way. * gtk/testcalender: Move calender from examples into this directory as a test program. (We really need to restrcture testgtk into a whole directory full of tests for every widget or functionality group, separated into multiple .c files.) Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c (file_exists): Fix stupid typo that was keeping RC file from being loaded. * gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized RC file font code. Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description): Add function to load a GdkFont from a PangoFontDescription. Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able to have any widget for the label, use a GtkLabel widget to display the text. (Based partially on a patch from Anders Carlson.) (Quite a bit of code reorganization - strip 90% of the guts out of gtkaspectframe and add a single virtual func to GtkFrameClass - compute_child_allocation.) Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized. (Removed clist->row_center_offset field because caching it wasn't saving time or code, added private function _gtk_clist_create_cell_layout()). Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkaccellabel.c: Pangoized. * gtk/[hv]ruler.c: Pangoized Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c (gtk_file_selection_init): Use gtk_clist_set_column_auto_resize() to remove need need for manual column width computations. Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel, ensuring Pango correctness, and considerably simplifying the code. * gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE. * gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect getting of numbers of lines. * gtk/gtklabel.c (gtk_label_size_request): Set the requisition to the actual requested width of the lable, not to the wrap width we set. * gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h. * gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes. * gtk/gtktextview.c: Fix structure inheritance. * gtk/gtkprogressbar.c: Pangoize. Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate in a function. * gtk/gtktextlayout.c (find_display_line_above): Fixed bug with computing line tops. * gtk/gtktextview.c (changed_handler): Fix < , <= confusion. Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset and y_offset coordinates to do what we need now. (The offset between buffer and layout coordinates has been reintroduced, but is a bit different than before.) * gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead handle the adjustments ourselves, and scroll as necessary using the new gdk_window_scroll(). The advantage of this is that when we are incrementally revalidating, we are essentially rearranging things around the visible portion of the screen. With the old setup, the visible portion of the screen was moved around in the layout, so scrolling and redrawing to track that caused jumping of the display. Since we now control the scrolling ourselves, we can suppress this and only redraw when things actually change. Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (redisplay_mark): We need to invalidate the region not just redisplay it after-all, since we store the cursors in the LineDisplay. (Ugly interactions here between GtkLayout and GtkTextBTree here.) * gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison. Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): Added function to scroll contents of a window while keeping the window constant. Works by XCopyArea or guffaw-scrolling depending on the details of how the window is set up. (guffaw-scrolling still needs to be filled in.) Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget, move the debugging that was tied to a global variable to that. * gtk/gtkmarshal.list: Add NONE:INT,INT,INT * gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate validated flag, in line data instead of setting height/width to -1. This allows us to perform operations with partially invalid buffer (using the old size for invalid lines) and thus to do incremental vaidation. Keep height/width aggregates up to date when deleting text and rebalancing the tree. * gtk/gtktextbtree.[ch]: Add functions validate a line (gtk_text_btree_validate_line), and to validate up to a number of pixels (gtk_text_btree_validate). * gtk/gtktextlayout.[ch]: Add an ::invalidated signal that indicates that something is changed and a revalidation pass is needed. Change ::need_repaint to ::changed, and make it take old and new yranges instead of a rectangle. * gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move the line_data_destroy() function from gtk_text_btree_add_view() to a virtual function in GtkTextLayout * gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(), since we are handling partial repaints in a different fashion now. * gtk/gtktextbtree.[ch]: Only repaint the changed portion of the selection instead of queueing a repaint on the entire widget. * gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move get_selection_bounds() down to btree, make the function in buffer a wrapper around the btree function. * gtk/gtktextlayout.[ch]: Add functions to check if the layout is valid and to recompute either a range of pixels aroudn a line or a certain total number of pixels. * gtk/gtktextlayout.[ch]: Cache a single line display; now that we only redraw the needed portions, the hit rate for this cache is quite high. * gtk/gtktextview.[ch]: Keep track of the first paragraph on the screen so that when re-laying-out the buffer, we can keep the same place. This requires connecting to ::value_changed on the adjustments * gtk/gtktextview.[ch]: Add idle functions to revalidate the buffer after we receive an ::invalidated signal. Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_size_allocate): Set upper to max of allocation and layout size, not just to the layout size. * gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size): Invalidate window so it gets redrawn properly. * gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL to mean the entire window. * gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW into public header. Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextmark.c (gtk_text_mark_get_name): Add function to get the name of a mark. * gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function to find the paragraph from a y position. Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid nodes have width/height >= 0, not > 0. Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display): Add a size_only flag, so when we only need the size, we don't create useless appearance attributes. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove duplicate setting of font description. * gtk/gtkscale.c: Use PANGO_SCALE instead of 1000 Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into EXTRA_DIST. It does not work well when the file that everything depends on is not in the tarball. Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c: Some hacks and fixes so that it basically works when not sitting in the GTK+ build tree. 2000-05-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag): Properly determine the ordering of the tag root and the current line within the tree. Previous algorithm only worked if the tag root's immediate parent was the common root of both the current line and the tag root. Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (set_para_values): Fix some bugs in alignment. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Track the widget text directional dynamically. * gtk/gtktextview.[ch]: Added functions to get and set default wrap mode. Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug in cursor location computation. Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/ vadjusment values properly when layout gets smaller. * gtk/gtktextview.c (need_repaint_handler): Areas being passed in are far completely inaccurate, and sometimes too small, so, for now, just queue a redraw on the whole visible region. 2000-04-25 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (summary_destroy): new function to destroy tag summary nodes (gtk_text_line_next_could_contain_tag): this function was totally broken if the line passed in wasn't below the tag root. Fix it. (gtk_text_btree_first_could_contain_tag): In the tag == NULL "wildcard" case, we have to do a linear scan. Blah. (gtk_text_btree_last_could_contain_tag): In tag == NULL case, we have to do the linear scan (tag_removed_cb): When a tag is removed from the tag table, remove the GtkTextTagInfo node from the btree. (gtk_text_btree_spew): Implement the spew function, for our debugging pleasure. Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix a problem with referring to the wrong buffer. * gtk/gtkentry.c: Fix focus-in/focus-out confusion. * gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default font description to gtk_style_new() - otherwise things don't work without a .gtkrc file. * gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the tags table if we create it ourself, too. * gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since it was conflicting with XKB modifiers. * gtk/gtktextview.[ch]: Add simple support for GtkIMContext. Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem with deletion from last commit. Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language in the context from the current locale. * gtk/gtkentry.c (gtk_entry_size_request): Use language from the context, not hardcoded value. * gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual, not logical. Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as attributes - that doesn't handle partial-glyph selection properly. Instead use new pango_layout_line_get_x_ranges() functionality to draw the selection. * gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x() now properly handles out-of-range coordinates. * gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved. * gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte() public. * gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext for paragraphs opposite to the base direction of the widget. * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment. * gtk/gtktextlayout.c: Don't split segments on marks, since that causes Arabic words to reshape as you cursor through. * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual cursor position when moving vertically with the arrow keys and scrolling with page-up/page-down. (Arrow keys save only the X, scrolling saves both X and Y.) This means you can line-up / line-down or page-up / page-down without losing your place, and also that moving vertically with the cursor keys keeps the same X position, not the same character count: * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical arrow keys move by display lines, not paragraphs. Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c: Make sure that the bin window is at least as big as the allocation. (Should we also make sure that the bin window is big enough to completely cover widget->window?) * gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add function to get the onscreen rectangle. * gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account for offsets in window coordinates. Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset confusion. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction from the widget direction. * gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg): Add a "direction" attribute. * gtk/gtktextview.c: global s/tkxt/text_view/. * gtk/testtext.c: Added long block of text in Arabic, to test out the direction attributes. (Some problems with the shaping system for arabic become obvious - like the fact the cursor splits words into unjoined pieces.) Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (render_layout): Add overstrike handling. * gtk/gtktextlayout.c: Fix up alignment. * gtk/testtext.c: Add some tests for centering, wrapping. Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs(). If we wrote GTK+-specific layout-render function this could just replace the draw_layout() operation in the vtable. * gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to pango_layout_get_cursor_pos() and use that function. * gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it is a non-static symbol. * gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y() with gtk_text_btree_find_line_by_y() * gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout renderer that handles GtkTextAppearance attributes. * gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h: - Move the values in the style that don't affect geometry into a GtkTextAppearance structure. - Change underline to take a PangoUnderline and "font" a string representation of a font description - Add a "font_desc" attribute which takes a FontDescription structure. * gtk/gtktextlayout.[ch]: - Get rid of the display-line list per each line. Instead, we generate, on demand, a GtkTextLineDisplay structure which] contains a PangoLayout * and other necesary information (offsets, cursor locations) for displaying a paragraph. - Get rid of the code to wrap lines, create display chunks, etc. Instead, we just go through a paragraph and convert it into the necessary inputs to a PangoLayout. - Implement a new attribute type, GtkTextAttrAppearance. This holds a GtkTextAppearance, and is used to pass colors, stipple, etc, through from the layout to the display without having to use lots and lots of individual attributes. - Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos() in terms of PangoLayout functions. * gtk/gtktextview.c: - Handle passing the necessary PangoContext to the layout - Some fixups in painting to deal with the automatic backing store and offsetting of GTK+-1.4 - Add a style_set handler so that the default style reacts properly to theme changes. * gtk/gtktext?*.[ch]: Random code-style fixes. * gtk/testtext.c: Substitute in languages that Pango handles now for Thai Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget, in original form preparatory to Pango-ization and gdkimcontext-ization. Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.c: Move default implementations to real_* vfuncs, so that we can derive from gtkimcontext in language bindings properly. Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval. Add a compose table including (almost) all the compose combinations from X. This is 6k of static, shared data as opposed to 50k or so of dynamic data in the XIM implementation. * gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval): Moved functions to convert keyvalues from and to unicode here from the win32 port and made them public. Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1. Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.[ch]: Base class for new input context system * gtk/gtkimmulticontext.[ch]: Proxy input context that allows the real input context implementation to be loaded from modules and switched on the fly. * gtk/gtkcontextsimple.[ch]: Simple implementation of an input context that just does direct keysymbol => unicode translation. * gtk/gtkentry.[ch]: Start switching editing over to using GtkInputContext. (No handling of preedit yet.) Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too many substitutions. (klass should not be subsituted.) Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com> * configure.in: Add checks for Pango * configure.in docs/Makefile.am: Add test for sgml2html and allow 'make dist' without building html, but print out warnings in that case. (For making snapshots) * gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am: Add Pango libraries and C flags * gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add function (gdk_draw_layout) to draw a pango layout. * gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions for getting Pango contexts for GDK. * gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set() * gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional editing. * gtk/gtkentry.c: Hack in simple Hebrew input with direct keysym => unicode translations. More languages can be added here, but real input-method support is needed. * docs/Changes-1.4.txt: Added note about entry behavior. * gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions to set the reading direction for a widget and the global direction. Add test which allows toggling the global direction. Two private flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR) * gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c * gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango * gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking, underlining now handled by Pango. * gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription to RCStyle and Style. (Having both this and the old font name and GdkFont is temporary.) * gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added convenience functions for creating contexts and layouts for widgets. * gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
gtk_widget_get_allocation (widget, &widget_allocation);
Remove all references to offscreen flag which was no longer used. Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Remove all references to offscreen flag which was no longer used. * gtk/gtkprivate.h (enum): Remove unused flags and compress. * gtk/gtkframe.c (gtk_frame_set_label_widget): Check for non-null label_widget->parent. * gtk/gtkentry.c: Get rid of code to deal with PangoAttribute which no longer was used. * gdk/gdkpango.c (gdk_pango_context_get_info): make static. * gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks for null arguments. * gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add check for destroyed windows. Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmulticontext.c: Add a finalize method and unref the slave context there. * gtk/gtkinvisible.[ch]: Make reference counting behavior identical to GtkWindow. Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com> * Makefile.am gdk/gdkpango.c: Copy the layout render function from pangox to here, so we can write them independent of rendering system, using GDK primitives. * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable, since we have a rendering-system independent implementation in terms of draw_glyphs(). * gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New function to render a single line. * gdk/x11/gdkpango.c: Move the guts of this file mostly into ../gdkpango.c, which simplifies things, since we don't have to deal with raw X gc's. Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add get_log_attrs() function to get the logical attributes for a given GtkTextLine. Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track g_locale_get_codeset() to g_get_codeset() change. Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com> * gtk/testcalendar.c (calendar_font_selection_ok): Use font descriptions. * gtk/gtkentry.c (gtk_entry_draw_text): Center text within the entry. * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of redoing (vastly simplifying) for Pango. Still needs quite a bit of work. (Size selection is currently poor. List of predefined sizes is not a good idea, since all of these sizes won't necessarily be distinct.) Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle CODESET results for LANG=C. Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC which takes a stringized pango font description; ignore the older 'font' and 'fontset' declarations. * gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font field with a GdkFont derived via gdk_font_from_description(), for compatibility. (Should we just remove it entirely? Probably too much compatibility breakage, but people should be migrating to the new Pango stuff as quickly as possible.) Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/. Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcalender.c: Roughly pango-ized. Really needs redoing; there are some bugs in size allocation right now, the semi-existant distinction between header / day fonts was removed, but, with Pango, could actually be made functional in a nice way. * gtk/testcalender: Move calender from examples into this directory as a test program. (We really need to restrcture testgtk into a whole directory full of tests for every widget or functionality group, separated into multiple .c files.) Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c (file_exists): Fix stupid typo that was keeping RC file from being loaded. * gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized RC file font code. Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description): Add function to load a GdkFont from a PangoFontDescription. Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able to have any widget for the label, use a GtkLabel widget to display the text. (Based partially on a patch from Anders Carlson.) (Quite a bit of code reorganization - strip 90% of the guts out of gtkaspectframe and add a single virtual func to GtkFrameClass - compute_child_allocation.) Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized. (Removed clist->row_center_offset field because caching it wasn't saving time or code, added private function _gtk_clist_create_cell_layout()). Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkaccellabel.c: Pangoized. * gtk/[hv]ruler.c: Pangoized Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c (gtk_file_selection_init): Use gtk_clist_set_column_auto_resize() to remove need need for manual column width computations. Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel, ensuring Pango correctness, and considerably simplifying the code. * gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE. * gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect getting of numbers of lines. * gtk/gtklabel.c (gtk_label_size_request): Set the requisition to the actual requested width of the lable, not to the wrap width we set. * gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h. * gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes. * gtk/gtktextview.c: Fix structure inheritance. * gtk/gtkprogressbar.c: Pangoize. Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate in a function. * gtk/gtktextlayout.c (find_display_line_above): Fixed bug with computing line tops. * gtk/gtktextview.c (changed_handler): Fix < , <= confusion. Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset and y_offset coordinates to do what we need now. (The offset between buffer and layout coordinates has been reintroduced, but is a bit different than before.) * gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead handle the adjustments ourselves, and scroll as necessary using the new gdk_window_scroll(). The advantage of this is that when we are incrementally revalidating, we are essentially rearranging things around the visible portion of the screen. With the old setup, the visible portion of the screen was moved around in the layout, so scrolling and redrawing to track that caused jumping of the display. Since we now control the scrolling ourselves, we can suppress this and only redraw when things actually change. Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (redisplay_mark): We need to invalidate the region not just redisplay it after-all, since we store the cursors in the LineDisplay. (Ugly interactions here between GtkLayout and GtkTextBTree here.) * gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison. Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): Added function to scroll contents of a window while keeping the window constant. Works by XCopyArea or guffaw-scrolling depending on the details of how the window is set up. (guffaw-scrolling still needs to be filled in.) Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget, move the debugging that was tied to a global variable to that. * gtk/gtkmarshal.list: Add NONE:INT,INT,INT * gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate validated flag, in line data instead of setting height/width to -1. This allows us to perform operations with partially invalid buffer (using the old size for invalid lines) and thus to do incremental vaidation. Keep height/width aggregates up to date when deleting text and rebalancing the tree. * gtk/gtktextbtree.[ch]: Add functions validate a line (gtk_text_btree_validate_line), and to validate up to a number of pixels (gtk_text_btree_validate). * gtk/gtktextlayout.[ch]: Add an ::invalidated signal that indicates that something is changed and a revalidation pass is needed. Change ::need_repaint to ::changed, and make it take old and new yranges instead of a rectangle. * gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move the line_data_destroy() function from gtk_text_btree_add_view() to a virtual function in GtkTextLayout * gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(), since we are handling partial repaints in a different fashion now. * gtk/gtktextbtree.[ch]: Only repaint the changed portion of the selection instead of queueing a repaint on the entire widget. * gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move get_selection_bounds() down to btree, make the function in buffer a wrapper around the btree function. * gtk/gtktextlayout.[ch]: Add functions to check if the layout is valid and to recompute either a range of pixels aroudn a line or a certain total number of pixels. * gtk/gtktextlayout.[ch]: Cache a single line display; now that we only redraw the needed portions, the hit rate for this cache is quite high. * gtk/gtktextview.[ch]: Keep track of the first paragraph on the screen so that when re-laying-out the buffer, we can keep the same place. This requires connecting to ::value_changed on the adjustments * gtk/gtktextview.[ch]: Add idle functions to revalidate the buffer after we receive an ::invalidated signal. Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_size_allocate): Set upper to max of allocation and layout size, not just to the layout size. * gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size): Invalidate window so it gets redrawn properly. * gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL to mean the entire window. * gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW into public header. Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextmark.c (gtk_text_mark_get_name): Add function to get the name of a mark. * gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function to find the paragraph from a y position. Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid nodes have width/height >= 0, not > 0. Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display): Add a size_only flag, so when we only need the size, we don't create useless appearance attributes. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove duplicate setting of font description. * gtk/gtkscale.c: Use PANGO_SCALE instead of 1000 Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into EXTRA_DIST. It does not work well when the file that everything depends on is not in the tarball. Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c: Some hacks and fixes so that it basically works when not sitting in the GTK+ build tree. 2000-05-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag): Properly determine the ordering of the tag root and the current line within the tree. Previous algorithm only worked if the tag root's immediate parent was the common root of both the current line and the tag root. Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (set_para_values): Fix some bugs in alignment. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Track the widget text directional dynamically. * gtk/gtktextview.[ch]: Added functions to get and set default wrap mode. Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug in cursor location computation. Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/ vadjusment values properly when layout gets smaller. * gtk/gtktextview.c (need_repaint_handler): Areas being passed in are far completely inaccurate, and sometimes too small, so, for now, just queue a redraw on the whole visible region. 2000-04-25 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (summary_destroy): new function to destroy tag summary nodes (gtk_text_line_next_could_contain_tag): this function was totally broken if the line passed in wasn't below the tag root. Fix it. (gtk_text_btree_first_could_contain_tag): In the tag == NULL "wildcard" case, we have to do a linear scan. Blah. (gtk_text_btree_last_could_contain_tag): In tag == NULL case, we have to do the linear scan (tag_removed_cb): When a tag is removed from the tag table, remove the GtkTextTagInfo node from the btree. (gtk_text_btree_spew): Implement the spew function, for our debugging pleasure. Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix a problem with referring to the wrong buffer. * gtk/gtkentry.c: Fix focus-in/focus-out confusion. * gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default font description to gtk_style_new() - otherwise things don't work without a .gtkrc file. * gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the tags table if we create it ourself, too. * gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since it was conflicting with XKB modifiers. * gtk/gtktextview.[ch]: Add simple support for GtkIMContext. Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem with deletion from last commit. Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language in the context from the current locale. * gtk/gtkentry.c (gtk_entry_size_request): Use language from the context, not hardcoded value. * gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual, not logical. Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as attributes - that doesn't handle partial-glyph selection properly. Instead use new pango_layout_line_get_x_ranges() functionality to draw the selection. * gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x() now properly handles out-of-range coordinates. * gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved. * gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte() public. * gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext for paragraphs opposite to the base direction of the widget. * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment. * gtk/gtktextlayout.c: Don't split segments on marks, since that causes Arabic words to reshape as you cursor through. * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual cursor position when moving vertically with the arrow keys and scrolling with page-up/page-down. (Arrow keys save only the X, scrolling saves both X and Y.) This means you can line-up / line-down or page-up / page-down without losing your place, and also that moving vertically with the cursor keys keeps the same X position, not the same character count: * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical arrow keys move by display lines, not paragraphs. Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c: Make sure that the bin window is at least as big as the allocation. (Should we also make sure that the bin window is big enough to completely cover widget->window?) * gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add function to get the onscreen rectangle. * gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account for offsets in window coordinates. Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset confusion. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction from the widget direction. * gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg): Add a "direction" attribute. * gtk/gtktextview.c: global s/tkxt/text_view/. * gtk/testtext.c: Added long block of text in Arabic, to test out the direction attributes. (Some problems with the shaping system for arabic become obvious - like the fact the cursor splits words into unjoined pieces.) Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (render_layout): Add overstrike handling. * gtk/gtktextlayout.c: Fix up alignment. * gtk/testtext.c: Add some tests for centering, wrapping. Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs(). If we wrote GTK+-specific layout-render function this could just replace the draw_layout() operation in the vtable. * gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to pango_layout_get_cursor_pos() and use that function. * gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it is a non-static symbol. * gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y() with gtk_text_btree_find_line_by_y() * gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout renderer that handles GtkTextAppearance attributes. * gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h: - Move the values in the style that don't affect geometry into a GtkTextAppearance structure. - Change underline to take a PangoUnderline and "font" a string representation of a font description - Add a "font_desc" attribute which takes a FontDescription structure. * gtk/gtktextlayout.[ch]: - Get rid of the display-line list per each line. Instead, we generate, on demand, a GtkTextLineDisplay structure which] contains a PangoLayout * and other necesary information (offsets, cursor locations) for displaying a paragraph. - Get rid of the code to wrap lines, create display chunks, etc. Instead, we just go through a paragraph and convert it into the necessary inputs to a PangoLayout. - Implement a new attribute type, GtkTextAttrAppearance. This holds a GtkTextAppearance, and is used to pass colors, stipple, etc, through from the layout to the display without having to use lots and lots of individual attributes. - Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos() in terms of PangoLayout functions. * gtk/gtktextview.c: - Handle passing the necessary PangoContext to the layout - Some fixups in painting to deal with the automatic backing store and offsetting of GTK+-1.4 - Add a style_set handler so that the default style reacts properly to theme changes. * gtk/gtktext?*.[ch]: Random code-style fixes. * gtk/testtext.c: Substitute in languages that Pango handles now for Thai Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget, in original form preparatory to Pango-ization and gdkimcontext-ization. Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.c: Move default implementations to real_* vfuncs, so that we can derive from gtkimcontext in language bindings properly. Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval. Add a compose table including (almost) all the compose combinations from X. This is 6k of static, shared data as opposed to 50k or so of dynamic data in the XIM implementation. * gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval): Moved functions to convert keyvalues from and to unicode here from the win32 port and made them public. Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1. Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.[ch]: Base class for new input context system * gtk/gtkimmulticontext.[ch]: Proxy input context that allows the real input context implementation to be loaded from modules and switched on the fly. * gtk/gtkcontextsimple.[ch]: Simple implementation of an input context that just does direct keysymbol => unicode translation. * gtk/gtkentry.[ch]: Start switching editing over to using GtkInputContext. (No handling of preedit yet.) Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too many substitutions. (klass should not be subsituted.) Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com> * configure.in: Add checks for Pango * configure.in docs/Makefile.am: Add test for sgml2html and allow 'make dist' without building html, but print out warnings in that case. (For making snapshots) * gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am: Add Pango libraries and C flags * gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add function (gdk_draw_layout) to draw a pango layout. * gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions for getting Pango contexts for GDK. * gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set() * gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional editing. * gtk/gtkentry.c: Hack in simple Hebrew input with direct keysym => unicode translations. More languages can be added here, but real input-method support is needed. * docs/Changes-1.4.txt: Added note about entry behavior. * gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions to set the reading direction for a widget and the global direction. Add test which allows toggling the global direction. Two private flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR) * gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c * gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango * gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking, underlining now handled by Pango. * gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription to RCStyle and Style. (Having both this and the old font name and GdkFont is temporary.) * gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added convenience functions for creating contexts and layouts for widgets. * gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
allocation.x = widget_allocation.x + widget_allocation.width
- (allocation.x - widget_allocation.x) - allocation.width;
1997-11-24 22:37:52 +00:00
gtk_widget_size_allocate (child->widget, &allocation);
}
1997-11-24 22:37:52 +00:00
}
}