2008-07-01 22:57:50 +00:00
|
|
|
/* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* 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/.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkviewport.h"
|
2010-06-18 04:11:26 +00:00
|
|
|
#include "gtksizerequest.h"
|
2001-03-30 15:46:17 +00:00
|
|
|
#include "gtkintl.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
#include "gtkprivate.h"
|
2010-07-09 17:22:23 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-03-04 18:13:45 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gtkviewport
|
|
|
|
* @Short_description: An adapter which makes widgets scrollable
|
|
|
|
* @Title: GtkViewport
|
|
|
|
* @See_also:#GtkScrolledWindow, #GtkAdjustment
|
|
|
|
*
|
|
|
|
* The #GtkViewport widget acts as an adaptor class, implementing
|
|
|
|
* scrollability for child widgets that lack their own scrolling
|
|
|
|
* capabilities. Use #GtkViewport to scroll child widgets such as
|
|
|
|
* #GtkTable, #GtkBox, and so on.
|
|
|
|
*
|
|
|
|
* If a widget has native scrolling abilities, such as #GtkTextView,
|
|
|
|
* #GtkTreeView or #GtkIconview, it can be added to a #GtkScrolledWindow
|
|
|
|
* with gtk_container_add(). If a widget does not, you must first add the
|
|
|
|
* widget to a #GtkViewport, then add the viewport to the scrolled window.
|
|
|
|
* The convenience function gtk_scrolled_window_add_with_viewport() does
|
|
|
|
* exactly this, so you can ignore the presence of the viewport.
|
|
|
|
*/
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
struct _GtkViewportPriv
|
|
|
|
{
|
|
|
|
GtkAdjustment *hadjustment;
|
|
|
|
GtkAdjustment *vadjustment;
|
|
|
|
GtkShadowType shadow_type;
|
|
|
|
|
|
|
|
GdkWindow *bin_window;
|
|
|
|
GdkWindow *view_window;
|
|
|
|
};
|
|
|
|
|
1998-07-16 02:47:15 +00:00
|
|
|
enum {
|
2001-03-30 15:46:17 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_HADJUSTMENT,
|
|
|
|
PROP_VADJUSTMENT,
|
|
|
|
PROP_SHADOW_TYPE
|
1998-07-16 02:47:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
static void gtk_viewport_finalize (GObject *object);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
static void gtk_viewport_destroy (GtkObject *object);
|
2001-03-30 15:46:17 +00:00
|
|
|
static void gtk_viewport_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_viewport_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
1998-12-02 03:40:03 +00:00
|
|
|
static void gtk_viewport_set_scroll_adjustments (GtkViewport *viewport,
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
GtkAdjustment *hadjustment,
|
|
|
|
GtkAdjustment *vadjustment);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_viewport_realize (GtkWidget *widget);
|
|
|
|
static void gtk_viewport_unrealize (GtkWidget *widget);
|
|
|
|
static void gtk_viewport_paint (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
|
|
|
static gint gtk_viewport_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
1998-01-18 15:09:10 +00:00
|
|
|
static void gtk_viewport_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_viewport_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
|
|
|
gpointer data);
|
1998-11-06 22:05:02 +00:00
|
|
|
static void gtk_viewport_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-06-18 04:11:26 +00:00
|
|
|
static void gtk_viewport_size_request_init (GtkSizeRequestIface *iface);
|
|
|
|
static void gtk_viewport_get_width (GtkSizeRequest *widget,
|
|
|
|
gint *minimum_size,
|
|
|
|
gint *natural_size);
|
|
|
|
static void gtk_viewport_get_height (GtkSizeRequest *widget,
|
|
|
|
gint *minimum_size,
|
|
|
|
gint *natural_size);
|
2010-04-13 02:21:46 +00:00
|
|
|
|
2010-04-06 21:15:50 +00:00
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkViewport, gtk_viewport, GTK_TYPE_BIN,
|
2010-06-18 04:11:26 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
|
|
|
|
gtk_viewport_size_request_init))
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_class_init (GtkViewportClass *class)
|
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
GtkObjectClass *object_class;
|
2001-03-30 15:46:17 +00:00
|
|
|
GObjectClass *gobject_class;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
object_class = (GtkObjectClass*) class;
|
2001-03-30 15:46:17 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (class);
|
1997-11-24 22:37:52 +00:00
|
|
|
widget_class = (GtkWidgetClass*) class;
|
|
|
|
container_class = (GtkContainerClass*) class;
|
2002-10-09 00:38:22 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
gobject_class->finalize = gtk_viewport_finalize;
|
2001-03-30 15:46:17 +00:00
|
|
|
gobject_class->set_property = gtk_viewport_set_property;
|
|
|
|
gobject_class->get_property = gtk_viewport_get_property;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
object_class->destroy = gtk_viewport_destroy;
|
1998-01-30 23:47:09 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
widget_class->realize = gtk_viewport_realize;
|
|
|
|
widget_class->unrealize = gtk_viewport_unrealize;
|
|
|
|
widget_class->expose_event = gtk_viewport_expose;
|
|
|
|
widget_class->size_allocate = gtk_viewport_size_allocate;
|
1998-11-06 22:05:02 +00:00
|
|
|
widget_class->style_set = gtk_viewport_style_set;
|
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
|
|
|
|
|
|
|
container_class->add = gtk_viewport_add;
|
|
|
|
|
|
|
|
class->set_scroll_adjustments = gtk_viewport_set_scroll_adjustments;
|
|
|
|
|
2001-03-30 15:46:17 +00:00
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_HADJUSTMENT,
|
|
|
|
g_param_spec_object ("hadjustment",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Horizontal adjustment"),
|
|
|
|
P_("The GtkAdjustment that determines the values of the horizontal position for this viewport"),
|
2001-03-30 15:46:17 +00:00
|
|
|
GTK_TYPE_ADJUSTMENT,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
2001-03-30 15:46:17 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_VADJUSTMENT,
|
|
|
|
g_param_spec_object ("vadjustment",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Vertical adjustment"),
|
|
|
|
P_("The GtkAdjustment that determines the values of the vertical position for this viewport"),
|
2001-03-30 15:46:17 +00:00
|
|
|
GTK_TYPE_ADJUSTMENT,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
2001-03-30 15:46:17 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_SHADOW_TYPE,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_enum ("shadow-type",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Shadow type"),
|
|
|
|
P_("Determines how the shadowed box around the viewport is drawn"),
|
2001-03-30 15:46:17 +00:00
|
|
|
GTK_TYPE_SHADOW_TYPE,
|
|
|
|
GTK_SHADOW_IN,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
2008-12-11 13:09:27 +00:00
|
|
|
/**
|
|
|
|
* GtkViewport::set-scroll-adjustments
|
|
|
|
* @horizontal: the horizontal #GtkAdjustment
|
|
|
|
* @vertical: the vertical #GtkAdjustment
|
|
|
|
*
|
|
|
|
* Set the scroll adjustments for the viewport. Usually scrolled containers
|
|
|
|
* like #GtkScrolledWindow will emit this signal to connect two instances
|
|
|
|
* of #GtkScrollbar to the scroll directions of the #GtkViewport.
|
|
|
|
*/
|
1998-12-02 03:40:03 +00:00
|
|
|
widget_class->set_scroll_adjustments_signal =
|
2008-08-08 13:53:05 +00:00
|
|
|
g_signal_new (I_("set-scroll-adjustments"),
|
2002-10-09 00:38:22 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
G_STRUCT_OFFSET (GtkViewportClass, set_scroll_adjustments),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__OBJECT_OBJECT,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
GTK_TYPE_ADJUSTMENT,
|
|
|
|
GTK_TYPE_ADJUSTMENT);
|
2010-07-13 21:20:38 +00:00
|
|
|
|
|
|
|
g_type_class_add_private (class, sizeof (GtkViewportPriv));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-07-16 02:47:15 +00:00
|
|
|
static void
|
2001-03-30 15:46:17 +00:00
|
|
|
gtk_viewport_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
1998-07-16 02:47:15 +00:00
|
|
|
{
|
|
|
|
GtkViewport *viewport;
|
|
|
|
|
|
|
|
viewport = GTK_VIEWPORT (object);
|
|
|
|
|
2001-03-30 15:46:17 +00:00
|
|
|
switch (prop_id)
|
1998-07-16 02:47:15 +00:00
|
|
|
{
|
2001-03-30 15:46:17 +00:00
|
|
|
case PROP_HADJUSTMENT:
|
|
|
|
gtk_viewport_set_hadjustment (viewport, g_value_get_object (value));
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
2001-03-30 15:46:17 +00:00
|
|
|
case PROP_VADJUSTMENT:
|
|
|
|
gtk_viewport_set_vadjustment (viewport, g_value_get_object (value));
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
2001-03-30 15:46:17 +00:00
|
|
|
case PROP_SHADOW_TYPE:
|
|
|
|
gtk_viewport_set_shadow_type (viewport, g_value_get_enum (value));
|
1998-09-26 03:12:03 +00:00
|
|
|
break;
|
1998-07-16 02:47:15 +00:00
|
|
|
default:
|
2001-03-30 15:46:17 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-30 15:46:17 +00:00
|
|
|
gtk_viewport_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
1998-07-16 02:47:15 +00:00
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (object);
|
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
1998-07-16 02:47:15 +00:00
|
|
|
|
2001-03-30 15:46:17 +00:00
|
|
|
switch (prop_id)
|
1998-07-16 02:47:15 +00:00
|
|
|
{
|
2001-03-30 15:46:17 +00:00
|
|
|
case PROP_HADJUSTMENT:
|
2010-07-13 21:20:38 +00:00
|
|
|
g_value_set_object (value, priv->hadjustment);
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
2001-03-30 15:46:17 +00:00
|
|
|
case PROP_VADJUSTMENT:
|
2010-07-13 21:20:38 +00:00
|
|
|
g_value_set_object (value, priv->vadjustment);
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
2001-03-30 15:46:17 +00:00
|
|
|
case PROP_SHADOW_TYPE:
|
2010-07-13 21:20:38 +00:00
|
|
|
g_value_set_enum (value, priv->shadow_type);
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2001-03-30 15:46:17 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
1998-07-16 02:47:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_viewport_init (GtkViewport *viewport)
|
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv;
|
|
|
|
|
|
|
|
viewport->priv = G_TYPE_INSTANCE_GET_PRIVATE (viewport,
|
|
|
|
GTK_TYPE_VIEWPORT,
|
|
|
|
GtkViewportPriv);
|
|
|
|
priv = viewport->priv;
|
|
|
|
|
2010-03-06 10:29:31 +00:00
|
|
|
gtk_widget_set_has_window (GTK_WIDGET (viewport), TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2001-11-15 21:04:51 +00:00
|
|
|
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (viewport), FALSE);
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_container_set_resize_mode (GTK_CONTAINER (viewport), GTK_RESIZE_QUEUE);
|
2010-07-13 21:20:38 +00:00
|
|
|
|
|
|
|
priv->shadow_type = GTK_SHADOW_IN;
|
|
|
|
priv->view_window = NULL;
|
|
|
|
priv->bin_window = NULL;
|
|
|
|
priv->hadjustment = NULL;
|
|
|
|
priv->vadjustment = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 21:50:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_new:
|
|
|
|
* @hadjustment: horizontal adjustment.
|
|
|
|
* @vadjustment: vertical adjustment.
|
|
|
|
* @returns: a new #GtkViewport.
|
|
|
|
*
|
|
|
|
* Creates a new #GtkViewport with the given adjustments.
|
|
|
|
*
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget*
|
|
|
|
gtk_viewport_new (GtkAdjustment *hadjustment,
|
|
|
|
GtkAdjustment *vadjustment)
|
|
|
|
{
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
GtkWidget *viewport;
|
|
|
|
|
Use g_object_new instead of gtk_widget_new
2008-06-19 Johan Dahlin <jdahlin@async.com.br>
* demos/testpixbuf.c (new_testrgb_window):
* gtk/gtkctree.c (gtk_ctree_new_with_titles):
* gtk/gtkitemfactory.c (gtk_item_factory_construct),
(gtk_item_factory_create_item):
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state):
* gtk/gtkprogressbar.c (gtk_progress_bar_new),
(gtk_progress_bar_new_with_adjustment):
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_new):
* gtk/gtktext.c (gtk_text_new):
* gtk/gtkviewport.c (gtk_viewport_new):
* tests/simple.c (main):
* tests/testgtk.c (create_statusbar), (create_get_image),
(create_saved_position), (create_tooltips), (create_cursors),
(create_display_screen), (create_progress_bar), (create_idle_test):
* tests/testmultidisplay.c (make_selection_dialog), (main):
* tests/testmultiscreen.c (main):
* tests/testrgb.c (new_testrgb_window):
Use g_object_new instead of gtk_widget_new
svn path=/trunk/; revision=20462
2008-06-19 12:25:19 +00:00
|
|
|
viewport = g_object_new (GTK_TYPE_VIEWPORT,
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
"hadjustment", hadjustment,
|
|
|
|
"vadjustment", vadjustment,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return viewport;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
#define ADJUSTMENT_POINTER(viewport, orientation) \
|
|
|
|
(((orientation) == GTK_ORIENTATION_HORIZONTAL) ? \
|
2010-07-13 21:20:38 +00:00
|
|
|
&(viewport)->priv->hadjustment : &(viewport)->priv->vadjustment)
|
2003-06-06 23:08:14 +00:00
|
|
|
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
static void
|
2003-06-06 23:08:14 +00:00
|
|
|
viewport_disconnect_adjustment (GtkViewport *viewport,
|
|
|
|
GtkOrientation orientation)
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
{
|
2003-06-06 23:08:14 +00:00
|
|
|
GtkAdjustment **adjustmentp = ADJUSTMENT_POINTER (viewport, orientation);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
if (*adjustmentp)
|
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
|
|
|
{
|
2003-06-06 23:08:14 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (*adjustmentp,
|
2002-10-09 00:38:22 +00:00
|
|
|
gtk_viewport_adjustment_value_changed,
|
|
|
|
viewport);
|
2003-06-06 23:08:14 +00:00
|
|
|
g_object_unref (*adjustmentp);
|
|
|
|
*adjustmentp = NULL;
|
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
|
|
|
}
|
2003-06-06 23:08:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (object);
|
|
|
|
|
|
|
|
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
G_OBJECT_CLASS (gtk_viewport_parent_class)->finalize (object);
|
2003-06-06 23:08:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_destroy (GtkObject *object)
|
|
|
|
{
|
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (object);
|
|
|
|
|
|
|
|
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL);
|
1998-01-30 23:47:09 +00:00
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
GTK_OBJECT_CLASS (gtk_viewport_parent_class)->destroy (object);
|
1998-01-30 23:47:09 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 21:50:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_get_hadjustment:
|
|
|
|
* @viewport: a #GtkViewport.
|
|
|
|
*
|
|
|
|
* Returns the horizontal adjustment of the viewport.
|
|
|
|
*
|
|
|
|
* Return value: the horizontal adjustment of @viewport.
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkAdjustment*
|
|
|
|
gtk_viewport_get_hadjustment (GtkViewport *viewport)
|
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
priv = viewport->priv;
|
|
|
|
|
|
|
|
if (!priv->hadjustment)
|
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_viewport_set_hadjustment (viewport, NULL);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
return priv->hadjustment;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 21:50:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_get_vadjustment:
|
|
|
|
* @viewport: a #GtkViewport.
|
|
|
|
*
|
|
|
|
* Returns the vertical adjustment of the viewport.
|
|
|
|
*
|
|
|
|
* Return value: the vertical adjustment of @viewport.
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkAdjustment*
|
|
|
|
gtk_viewport_get_vadjustment (GtkViewport *viewport)
|
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
priv = viewport->priv;
|
|
|
|
|
|
|
|
if (!priv->vadjustment)
|
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_viewport_set_vadjustment (viewport, NULL);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
return priv->vadjustment;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
static void
|
|
|
|
viewport_get_view_allocation (GtkViewport *viewport,
|
|
|
|
GtkAllocation *view_allocation)
|
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
2003-06-06 23:08:14 +00:00
|
|
|
GtkWidget *widget = GTK_WIDGET (viewport);
|
|
|
|
GtkAllocation *allocation = &widget->allocation;
|
2010-06-02 04:28:22 +00:00
|
|
|
guint border_width;
|
|
|
|
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (viewport));
|
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
view_allocation->x = 0;
|
|
|
|
view_allocation->y = 0;
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
if (priv->shadow_type != GTK_SHADOW_NONE)
|
2003-06-06 23:08:14 +00:00
|
|
|
{
|
|
|
|
view_allocation->x = widget->style->xthickness;
|
|
|
|
view_allocation->y = widget->style->ythickness;
|
|
|
|
}
|
|
|
|
|
|
|
|
view_allocation->width = MAX (1, allocation->width - view_allocation->x * 2 - border_width * 2);
|
|
|
|
view_allocation->height = MAX (1, allocation->height - view_allocation->y * 2 - border_width * 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
viewport_reclamp_adjustment (GtkAdjustment *adjustment,
|
|
|
|
gboolean *value_changed)
|
|
|
|
{
|
|
|
|
gdouble value = adjustment->value;
|
|
|
|
|
|
|
|
value = CLAMP (value, 0, adjustment->upper - adjustment->page_size);
|
|
|
|
if (value != adjustment->value)
|
|
|
|
{
|
|
|
|
adjustment->value = value;
|
|
|
|
if (value_changed)
|
|
|
|
*value_changed = TRUE;
|
|
|
|
}
|
|
|
|
else if (value_changed)
|
|
|
|
*value_changed = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
viewport_set_hadjustment_values (GtkViewport *viewport,
|
|
|
|
gboolean *value_changed)
|
|
|
|
{
|
|
|
|
GtkBin *bin = GTK_BIN (viewport);
|
|
|
|
GtkAllocation view_allocation;
|
|
|
|
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
2003-12-05 23:31:51 +00:00
|
|
|
gdouble old_page_size;
|
2003-12-12 23:40:58 +00:00
|
|
|
gdouble old_upper;
|
|
|
|
gdouble old_value;
|
2003-12-05 23:31:51 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
viewport_get_view_allocation (viewport, &view_allocation);
|
|
|
|
|
2003-12-05 23:31:51 +00:00
|
|
|
old_page_size = hadjustment->page_size;
|
2003-12-12 23:40:58 +00:00
|
|
|
old_upper = hadjustment->upper;
|
|
|
|
old_value = hadjustment->value;
|
2003-06-06 23:08:14 +00:00
|
|
|
hadjustment->page_size = view_allocation.width;
|
|
|
|
hadjustment->step_increment = view_allocation.width * 0.1;
|
|
|
|
hadjustment->page_increment = view_allocation.width * 0.9;
|
|
|
|
|
|
|
|
hadjustment->lower = 0;
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (bin);
|
|
|
|
if (child && gtk_widget_get_visible (child))
|
2003-06-06 23:08:14 +00:00
|
|
|
{
|
|
|
|
GtkRequisition child_requisition;
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
gtk_widget_get_child_requisition (child, &child_requisition);
|
2003-06-06 23:08:14 +00:00
|
|
|
hadjustment->upper = MAX (child_requisition.width, view_allocation.width);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hadjustment->upper = view_allocation.width;
|
|
|
|
|
2003-12-05 23:31:51 +00:00
|
|
|
if (gtk_widget_get_direction (GTK_WIDGET (viewport)) == GTK_TEXT_DIR_RTL)
|
|
|
|
{
|
2003-12-12 23:40:58 +00:00
|
|
|
gdouble dist = old_upper - (old_value + old_page_size);
|
|
|
|
hadjustment->value = hadjustment->upper - dist - hadjustment->page_size;
|
2003-12-05 23:31:51 +00:00
|
|
|
viewport_reclamp_adjustment (hadjustment, value_changed);
|
|
|
|
*value_changed = (old_value != hadjustment->value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
viewport_reclamp_adjustment (hadjustment, value_changed);
|
2003-06-06 23:08:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
viewport_set_vadjustment_values (GtkViewport *viewport,
|
|
|
|
gboolean *value_changed)
|
|
|
|
{
|
|
|
|
GtkBin *bin = GTK_BIN (viewport);
|
|
|
|
GtkAllocation view_allocation;
|
|
|
|
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
2003-06-06 23:08:14 +00:00
|
|
|
|
|
|
|
viewport_get_view_allocation (viewport, &view_allocation);
|
|
|
|
|
|
|
|
vadjustment->page_size = view_allocation.height;
|
|
|
|
vadjustment->step_increment = view_allocation.height * 0.1;
|
|
|
|
vadjustment->page_increment = view_allocation.height * 0.9;
|
|
|
|
|
|
|
|
vadjustment->lower = 0;
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (bin);
|
|
|
|
if (child && gtk_widget_get_visible (child))
|
2003-06-06 23:08:14 +00:00
|
|
|
{
|
2010-04-04 00:36:13 +00:00
|
|
|
gint natural_height;
|
2010-05-24 20:31:36 +00:00
|
|
|
|
|
|
|
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
|
|
|
|
view_allocation.width,
|
|
|
|
NULL,
|
|
|
|
&natural_height);
|
2010-04-04 00:36:13 +00:00
|
|
|
vadjustment->upper = MAX (natural_height, view_allocation.height);
|
2003-06-06 23:08:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
vadjustment->upper = view_allocation.height;
|
|
|
|
|
|
|
|
viewport_reclamp_adjustment (vadjustment, value_changed);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
viewport_set_adjustment (GtkViewport *viewport,
|
|
|
|
GtkOrientation orientation,
|
|
|
|
GtkAdjustment *adjustment)
|
|
|
|
{
|
|
|
|
GtkAdjustment **adjustmentp = ADJUSTMENT_POINTER (viewport, orientation);
|
|
|
|
gboolean value_changed;
|
|
|
|
|
2003-06-08 15:34:30 +00:00
|
|
|
if (adjustment && adjustment == *adjustmentp)
|
2003-06-06 23:08:14 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (!adjustment)
|
|
|
|
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0,
|
|
|
|
0.0, 0.0, 0.0));
|
2006-01-06 14:07:24 +00:00
|
|
|
viewport_disconnect_adjustment (viewport, orientation);
|
2003-06-06 23:08:14 +00:00
|
|
|
*adjustmentp = adjustment;
|
2005-11-23 18:06:58 +00:00
|
|
|
g_object_ref_sink (adjustment);
|
2003-06-06 23:08:14 +00:00
|
|
|
|
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
viewport_set_hadjustment_values (viewport, &value_changed);
|
|
|
|
else
|
|
|
|
viewport_set_vadjustment_values (viewport, &value_changed);
|
|
|
|
|
2008-08-08 13:25:18 +00:00
|
|
|
g_signal_connect (adjustment, "value-changed",
|
2003-06-06 23:08:14 +00:00
|
|
|
G_CALLBACK (gtk_viewport_adjustment_value_changed),
|
|
|
|
viewport);
|
|
|
|
|
|
|
|
gtk_adjustment_changed (adjustment);
|
|
|
|
|
|
|
|
if (value_changed)
|
|
|
|
gtk_adjustment_value_changed (adjustment);
|
|
|
|
else
|
|
|
|
gtk_viewport_adjustment_value_changed (adjustment, viewport);
|
|
|
|
}
|
|
|
|
|
2001-12-10 21:50:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_set_hadjustment:
|
|
|
|
* @viewport: a #GtkViewport.
|
2009-12-10 10:23:40 +00:00
|
|
|
* @adjustment: (allow-none): a #GtkAdjustment.
|
|
|
|
*
|
2001-12-10 21:50:36 +00:00
|
|
|
* Sets the horizontal adjustment of the viewport.
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_viewport_set_hadjustment (GtkViewport *viewport,
|
|
|
|
GtkAdjustment *adjustment)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
1998-11-05 15:44:22 +00:00
|
|
|
if (adjustment)
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
viewport_set_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2001-03-30 15:46:17 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (viewport), "hadjustment");
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 21:50:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_set_vadjustment:
|
|
|
|
* @viewport: a #GtkViewport.
|
2009-12-10 10:23:40 +00:00
|
|
|
* @adjustment: (allow-none): a #GtkAdjustment.
|
|
|
|
*
|
2001-12-10 21:50:36 +00:00
|
|
|
* Sets the vertical adjustment of the viewport.
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_viewport_set_vadjustment (GtkViewport *viewport,
|
|
|
|
GtkAdjustment *adjustment)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
1998-11-05 15:44:22 +00:00
|
|
|
if (adjustment)
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
viewport_set_adjustment (viewport, GTK_ORIENTATION_VERTICAL, adjustment);
|
2001-03-30 15:46:17 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
g_object_notify (G_OBJECT (viewport), "vadjustment");
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
static void
|
1998-12-02 03:40:03 +00:00
|
|
|
gtk_viewport_set_scroll_adjustments (GtkViewport *viewport,
|
|
|
|
GtkAdjustment *hadjustment,
|
|
|
|
GtkAdjustment *vadjustment)
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
{
|
2003-06-06 23:08:14 +00:00
|
|
|
gtk_viewport_set_hadjustment (viewport, hadjustment);
|
|
|
|
gtk_viewport_set_vadjustment (viewport, vadjustment);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 21:50:36 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_set_shadow_type:
|
|
|
|
* @viewport: a #GtkViewport.
|
|
|
|
* @type: the new shadow type.
|
|
|
|
*
|
|
|
|
* Sets the shadow type of the viewport.
|
|
|
|
**/
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_viewport_set_shadow_type (GtkViewport *viewport,
|
|
|
|
GtkShadowType type)
|
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
priv = viewport->priv;
|
|
|
|
|
|
|
|
if ((GtkShadowType) priv->shadow_type != type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
priv->shadow_type = type;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-03-01 06:47:38 +00:00
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (viewport)))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gtk_widget_size_allocate (GTK_WIDGET (viewport), &(GTK_WIDGET (viewport)->allocation));
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (viewport));
|
|
|
|
}
|
2001-03-30 15:46:17 +00:00
|
|
|
|
2005-03-26 05:49:15 +00:00
|
|
|
g_object_notify (G_OBJECT (viewport), "shadow-type");
|
2002-01-28 18:52:49 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_get_shadow_type:
|
|
|
|
* @viewport: a #GtkViewport
|
|
|
|
*
|
|
|
|
* Gets the shadow type of the #GtkViewport. See
|
|
|
|
* gtk_viewport_set_shadow_type().
|
2010-07-13 21:20:38 +00:00
|
|
|
*
|
2001-06-24 15:34:48 +00:00
|
|
|
* Return value: the shadow type
|
|
|
|
**/
|
|
|
|
GtkShadowType
|
|
|
|
gtk_viewport_get_shadow_type (GtkViewport *viewport)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), GTK_SHADOW_NONE);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
return viewport->priv->shadow_type;
|
2001-06-24 15:34:48 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2009-10-21 16:12:01 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_get_bin_window:
|
|
|
|
* @viewport: a #GtkViewport
|
|
|
|
*
|
|
|
|
* Gets the bin window of the #GtkViewport.
|
|
|
|
*
|
|
|
|
* Return value: a #GdkWindow
|
|
|
|
*
|
|
|
|
* Since: 2.20
|
|
|
|
**/
|
|
|
|
GdkWindow*
|
|
|
|
gtk_viewport_get_bin_window (GtkViewport *viewport)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
return viewport->priv->bin_window;
|
2009-10-21 16:12:01 +00:00
|
|
|
}
|
|
|
|
|
2010-06-09 11:02:46 +00:00
|
|
|
/**
|
|
|
|
* gtk_viewport_get_view_window:
|
|
|
|
* @viewport: a #GtkViewport
|
|
|
|
*
|
|
|
|
* Gets the view window of the #GtkViewport.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): a #GdkWindow
|
|
|
|
*
|
|
|
|
* Since: 2.22
|
|
|
|
**/
|
|
|
|
GdkWindow*
|
|
|
|
gtk_viewport_get_view_window (GtkViewport *viewport)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
return viewport->priv->view_window;
|
2010-06-09 11:02:46 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_viewport_realize (GtkWidget *widget)
|
|
|
|
{
|
2003-06-06 23:08:14 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
2003-06-06 23:08:14 +00:00
|
|
|
GtkBin *bin = GTK_BIN (widget);
|
|
|
|
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
|
|
|
|
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
|
|
|
|
GtkAllocation view_allocation;
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkWindowAttr attributes;
|
|
|
|
gint attributes_mask;
|
1998-02-17 04:48:50 +00:00
|
|
|
gint event_mask;
|
2010-05-24 20:31:36 +00:00
|
|
|
guint border_width;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-06-02 04:28:22 +00:00
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
|
|
|
|
2010-03-06 10:51:33 +00:00
|
|
|
gtk_widget_set_realized (widget, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-04-08 05:41:40 +00:00
|
|
|
attributes.x = widget->allocation.x + border_width;
|
|
|
|
attributes.y = widget->allocation.y + border_width;
|
|
|
|
attributes.width = widget->allocation.width - border_width * 2;
|
|
|
|
attributes.height = widget->allocation.height - border_width * 2;
|
1997-11-24 22:37:52 +00:00
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
|
|
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
attributes.visual = gtk_widget_get_visual (widget);
|
|
|
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
1998-02-17 04:48:50 +00:00
|
|
|
|
|
|
|
event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
|
1999-01-28 00:57:18 +00:00
|
|
|
/* We select on button_press_mask so that button 4-5 scrolls are trapped.
|
|
|
|
*/
|
|
|
|
attributes.event_mask = event_mask | GDK_BUTTON_PRESS_MASK;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
|
|
|
|
1998-01-18 15:09:10 +00:00
|
|
|
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
|
|
|
&attributes, attributes_mask);
|
|
|
|
gdk_window_set_user_data (widget->window, viewport);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
viewport_get_view_allocation (viewport, &view_allocation);
|
|
|
|
|
|
|
|
attributes.x = view_allocation.x;
|
|
|
|
attributes.y = view_allocation.y;
|
|
|
|
attributes.width = view_allocation.width;
|
|
|
|
attributes.height = view_allocation.height;
|
2005-01-05 16:46:34 +00:00
|
|
|
attributes.event_mask = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
priv->view_window = gdk_window_new (widget->window, &attributes, attributes_mask);
|
|
|
|
gdk_window_set_user_data (priv->view_window, viewport);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_set_back_pixmap (priv->view_window, NULL, FALSE);
|
2005-01-05 16:46:34 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
attributes.x = - hadjustment->value;
|
|
|
|
attributes.y = - vadjustment->value;
|
|
|
|
attributes.width = hadjustment->upper;
|
|
|
|
attributes.height = vadjustment->upper;
|
1998-04-08 05:41:40 +00:00
|
|
|
|
1998-02-17 04:48:50 +00:00
|
|
|
attributes.event_mask = event_mask;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
priv->bin_window = gdk_window_new (priv->view_window, &attributes, attributes_mask);
|
|
|
|
gdk_window_set_user_data (priv->bin_window, viewport);
|
1998-01-18 15:09:10 +00:00
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (bin);
|
|
|
|
if (child)
|
2010-07-13 21:20:38 +00:00
|
|
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-18 15:09:10 +00:00
|
|
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
2010-07-13 21:20:38 +00:00
|
|
|
gtk_style_set_background (widget->style, priv->bin_window, GTK_STATE_NORMAL);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
/* Call paint here to allow a theme to set the background without flashing
|
|
|
|
*/
|
2010-07-13 21:20:38 +00:00
|
|
|
gtk_paint_flat_box(widget->style, priv->bin_window, GTK_STATE_NORMAL,
|
2003-06-06 23:08:14 +00:00
|
|
|
GTK_SHADOW_NONE,
|
|
|
|
NULL, widget, "viewportbin",
|
|
|
|
0, 0, -1, -1);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_show (priv->bin_window);
|
|
|
|
gdk_window_show (priv->view_window);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_unrealize (GtkWidget *widget)
|
|
|
|
{
|
2002-01-30 22:29:03 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_set_user_data (priv->view_window, NULL);
|
|
|
|
gdk_window_destroy (priv->view_window);
|
|
|
|
priv->view_window = NULL;
|
1998-02-12 03:02:14 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_set_user_data (priv->bin_window, NULL);
|
|
|
|
gdk_window_destroy (priv->bin_window);
|
|
|
|
priv->bin_window = NULL;
|
1998-02-12 03:02:14 +00:00
|
|
|
|
2008-08-12 09:44:32 +00:00
|
|
|
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->unrealize (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_paint (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
|
|
|
{
|
2010-01-07 15:47:35 +00:00
|
|
|
if (gtk_widget_is_drawable (widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2008-02-27 11:30:10 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
gtk_paint_shadow (widget->style, widget->window,
|
2010-07-13 21:20:38 +00:00
|
|
|
GTK_STATE_NORMAL, priv->shadow_type,
|
2007-01-18 17:30:10 +00:00
|
|
|
area, widget, "viewport",
|
2002-10-09 00:38:22 +00:00
|
|
|
0, 0, -1, -1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_viewport_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
GtkViewport *viewport;
|
|
|
|
|
2010-01-07 15:47:35 +00:00
|
|
|
if (gtk_widget_is_drawable (widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
viewport = GTK_VIEWPORT (widget);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-01-18 15:09:10 +00:00
|
|
|
if (event->window == widget->window)
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_viewport_paint (widget, &event->area);
|
2010-07-13 21:20:38 +00:00
|
|
|
else if (event->window == priv->bin_window)
|
1999-01-08 00:12:43 +00:00
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
gtk_paint_flat_box(widget->style, priv->bin_window,
|
1999-01-08 00:12:43 +00:00
|
|
|
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
|
|
|
&event->area, widget, "viewportbin",
|
|
|
|
0, 0, -1, -1);
|
2008-08-12 09:06:34 +00:00
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->expose_event (widget, event);
|
1999-01-08 00:12:43 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-01-18 15:09:10 +00:00
|
|
|
static void
|
|
|
|
gtk_viewport_add (GtkContainer *container,
|
1998-07-16 02:47:15 +00:00
|
|
|
GtkWidget *child)
|
1998-01-18 15:09:10 +00:00
|
|
|
{
|
2008-02-27 11:30:10 +00:00
|
|
|
GtkBin *bin = GTK_BIN (container);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (bin);
|
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
1998-01-18 15:09:10 +00:00
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
g_return_if_fail (gtk_bin_get_child (bin) == NULL);
|
1998-01-18 15:09:10 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
1998-01-18 15:09:10 +00:00
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
GTK_CONTAINER_CLASS (gtk_viewport_parent_class)->add (container, child);
|
1998-01-18 15:09:10 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_viewport_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
2001-11-15 21:04:51 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
2001-11-15 21:04:51 +00:00
|
|
|
GtkBin *bin = GTK_BIN (widget);
|
2010-06-02 04:28:22 +00:00
|
|
|
guint border_width;
|
2003-06-06 23:08:14 +00:00
|
|
|
gboolean hadjustment_value_changed, vadjustment_value_changed;
|
|
|
|
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
|
|
|
|
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
|
2006-09-20 15:02:01 +00:00
|
|
|
GtkAllocation child_allocation;
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
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
|
|
|
|
2010-06-02 04:28:22 +00:00
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
|
|
|
|
2001-11-15 21:04:51 +00:00
|
|
|
/* If our size changed, and we have a shadow, queue a redraw on widget->window to
|
|
|
|
* redraw the shadow correctly.
|
|
|
|
*/
|
2010-03-02 04:19:28 +00:00
|
|
|
if (gtk_widget_get_mapped (widget) &&
|
2010-07-13 21:20:38 +00:00
|
|
|
priv->shadow_type != GTK_SHADOW_NONE &&
|
2001-11-15 21:04:51 +00:00
|
|
|
(widget->allocation.width != allocation->width ||
|
|
|
|
widget->allocation.height != allocation->height))
|
|
|
|
gdk_window_invalidate_rect (widget->window, NULL, FALSE);
|
|
|
|
|
|
|
|
widget->allocation = *allocation;
|
2006-09-20 15:02:01 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
viewport_set_hadjustment_values (viewport, &hadjustment_value_changed);
|
|
|
|
viewport_set_vadjustment_values (viewport, &vadjustment_value_changed);
|
2006-09-20 15:02:01 +00:00
|
|
|
|
|
|
|
child_allocation.x = 0;
|
|
|
|
child_allocation.y = 0;
|
|
|
|
child_allocation.width = hadjustment->upper;
|
|
|
|
child_allocation.height = vadjustment->upper;
|
2010-03-02 06:16:02 +00:00
|
|
|
if (gtk_widget_get_realized (widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2003-06-06 23:08:14 +00:00
|
|
|
GtkAllocation view_allocation;
|
1998-01-18 15:09:10 +00:00
|
|
|
gdk_window_move_resize (widget->window,
|
1998-03-24 01:43:21 +00:00
|
|
|
allocation->x + border_width,
|
|
|
|
allocation->y + border_width,
|
|
|
|
allocation->width - border_width * 2,
|
|
|
|
allocation->height - border_width * 2);
|
2006-09-20 15:02:01 +00:00
|
|
|
|
|
|
|
viewport_get_view_allocation (viewport, &view_allocation);
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_move_resize (priv->view_window,
|
2003-06-06 23:08:14 +00:00
|
|
|
view_allocation.x,
|
|
|
|
view_allocation.y,
|
|
|
|
view_allocation.width,
|
|
|
|
view_allocation.height);
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_move_resize (priv->bin_window,
|
2006-09-20 15:02:01 +00:00
|
|
|
- hadjustment->value,
|
|
|
|
- vadjustment->value,
|
|
|
|
child_allocation.width,
|
|
|
|
child_allocation.height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
2010-05-24 20:31:36 +00:00
|
|
|
|
|
|
|
child = gtk_bin_get_child (bin);
|
|
|
|
if (child && gtk_widget_get_visible (child))
|
|
|
|
gtk_widget_size_allocate (child, &child_allocation);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
gtk_adjustment_changed (hadjustment);
|
|
|
|
gtk_adjustment_changed (vadjustment);
|
|
|
|
if (hadjustment_value_changed)
|
|
|
|
gtk_adjustment_value_changed (hadjustment);
|
|
|
|
if (vadjustment_value_changed)
|
|
|
|
gtk_adjustment_value_changed (vadjustment);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2008-02-27 11:30:10 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (data);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
2008-02-27 11:30:10 +00:00
|
|
|
GtkBin *bin = GTK_BIN (data);
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (bin);
|
|
|
|
if (child && gtk_widget_get_visible (child) &&
|
2010-03-02 06:16:02 +00:00
|
|
|
gtk_widget_get_realized (GTK_WIDGET (viewport)))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2003-06-06 23:08:14 +00:00
|
|
|
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
|
|
|
|
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
|
|
|
|
gint old_x, old_y;
|
|
|
|
gint new_x, new_y;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_get_position (priv->bin_window, &old_x, &old_y);
|
2003-06-06 23:08:14 +00:00
|
|
|
new_x = - hadjustment->value;
|
|
|
|
new_y = - vadjustment->value;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2003-06-06 23:08:14 +00:00
|
|
|
if (new_x != old_x || new_y != old_y)
|
2000-03-28 01:24:44 +00:00
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
gdk_window_move (priv->bin_window, new_x, new_y);
|
|
|
|
gdk_window_process_updates (priv->bin_window, TRUE);
|
2000-03-28 01:24:44 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_viewport_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style)
|
|
|
|
{
|
2010-03-02 06:16:02 +00:00
|
|
|
if (gtk_widget_get_realized (widget) &&
|
2010-01-04 06:49:26 +00:00
|
|
|
gtk_widget_get_has_window (widget))
|
1998-11-06 22:05:02 +00:00
|
|
|
{
|
2008-02-27 11:30:10 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
2008-02-27 11:30:10 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
gtk_style_set_background (widget->style, priv->bin_window, GTK_STATE_NORMAL);
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_style_set_background (widget->style, widget->window, widget->state);
|
|
|
|
}
|
|
|
|
}
|
2005-03-20 07:01:23 +00:00
|
|
|
|
2010-04-13 02:21:46 +00:00
|
|
|
|
|
|
|
static void
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_viewport_size_request_init (GtkSizeRequestIface *iface)
|
2010-04-13 02:21:46 +00:00
|
|
|
{
|
2010-06-18 04:11:26 +00:00
|
|
|
iface->get_width = gtk_viewport_get_width;
|
|
|
|
iface->get_height = gtk_viewport_get_height;
|
2010-04-13 02:21:46 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 21:15:50 +00:00
|
|
|
static void
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_viewport_get_size (GtkSizeRequest *widget,
|
|
|
|
GtkOrientation orientation,
|
|
|
|
gint *minimum_size,
|
|
|
|
gint *natural_size)
|
2010-04-06 21:15:50 +00:00
|
|
|
{
|
2010-07-13 21:20:38 +00:00
|
|
|
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
|
|
|
GtkViewportPriv *priv = viewport->priv;
|
2010-04-13 02:21:46 +00:00
|
|
|
GtkWidget *child;
|
|
|
|
gint child_min, child_nat;
|
|
|
|
gint minimum, natural;
|
2010-04-06 21:15:50 +00:00
|
|
|
|
2010-06-18 04:11:26 +00:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
2010-04-06 21:15:50 +00:00
|
|
|
|
2010-04-13 02:21:46 +00:00
|
|
|
/* XXX This should probably be (border_width * 2); but GTK+ has
|
|
|
|
* been doing this with a single border for a while now...
|
|
|
|
*/
|
2010-06-02 04:28:22 +00:00
|
|
|
minimum = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
2010-04-06 21:15:50 +00:00
|
|
|
|
2010-07-13 21:20:38 +00:00
|
|
|
if (priv->shadow_type != GTK_SHADOW_NONE)
|
2010-04-06 21:15:50 +00:00
|
|
|
{
|
2010-04-13 02:21:46 +00:00
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
2010-06-18 04:11:26 +00:00
|
|
|
minimum += 2 * GTK_WIDGET (widget)->style->xthickness;
|
2010-04-13 02:21:46 +00:00
|
|
|
else
|
2010-06-18 04:11:26 +00:00
|
|
|
minimum += 2 * GTK_WIDGET (widget)->style->ythickness;
|
2010-04-06 21:15:50 +00:00
|
|
|
}
|
|
|
|
|
2010-04-13 02:21:46 +00:00
|
|
|
natural = minimum;
|
|
|
|
|
2010-04-06 21:15:50 +00:00
|
|
|
if (child && gtk_widget_get_visible (child))
|
|
|
|
{
|
2010-04-13 02:21:46 +00:00
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
|
2010-04-13 02:21:46 +00:00
|
|
|
else
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_size_request_get_height (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
|
2010-04-06 21:15:50 +00:00
|
|
|
|
2010-04-13 02:21:46 +00:00
|
|
|
minimum += child_min;
|
|
|
|
natural += child_nat;
|
2010-04-06 21:15:50 +00:00
|
|
|
}
|
2010-04-20 05:27:32 +00:00
|
|
|
|
|
|
|
if (minimum_size)
|
|
|
|
*minimum_size = minimum;
|
|
|
|
|
|
|
|
if (natural_size)
|
|
|
|
*natural_size = natural;
|
2010-04-06 21:15:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_viewport_get_width (GtkSizeRequest *widget,
|
|
|
|
gint *minimum_size,
|
|
|
|
gint *natural_size)
|
2010-04-13 02:21:46 +00:00
|
|
|
{
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_viewport_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
|
2010-04-13 02:21:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_viewport_get_height (GtkSizeRequest *widget,
|
|
|
|
gint *minimum_size,
|
|
|
|
gint *natural_size)
|
2010-04-06 21:15:50 +00:00
|
|
|
{
|
2010-06-18 04:11:26 +00:00
|
|
|
gtk_viewport_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
|
2010-04-06 21:15:50 +00:00
|
|
|
}
|