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
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
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
|
2008-08-29 12:25:42 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2011-01-04 17:21:41 +00:00
|
|
|
|
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkscrolledwindow.h"
|
2011-01-04 17:21:41 +00:00
|
|
|
|
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkadjustment.h"
|
2014-06-30 22:12:39 +00:00
|
|
|
|
#include "gtkadjustmentprivate.h"
|
2002-02-16 01:34:26 +00:00
|
|
|
|
#include "gtkbindings.h"
|
2015-12-23 17:54:42 +00:00
|
|
|
|
#include "gtkcsscustomgadgetprivate.h"
|
2011-02-11 12:43:56 +00:00
|
|
|
|
#include "gtkdnd.h"
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkintl.h"
|
2011-02-11 12:43:56 +00:00
|
|
|
|
#include "gtkmain.h"
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkscrollable.h"
|
|
|
|
|
#include "gtkscrollbar.h"
|
2014-04-05 06:04:12 +00:00
|
|
|
|
#include "gtkrangeprivate.h"
|
2011-01-04 19:51:19 +00:00
|
|
|
|
#include "gtktypebuiltins.h"
|
2011-11-11 00:43:54 +00:00
|
|
|
|
#include "gtkviewport.h"
|
2011-02-11 12:43:56 +00:00
|
|
|
|
#include "gtkwidgetprivate.h"
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkwindow.h"
|
2014-05-26 16:19:24 +00:00
|
|
|
|
#include "gtkkineticscrolling.h"
|
2011-06-29 03:13:27 +00:00
|
|
|
|
#include "a11y/gtkscrolledwindowaccessible.h"
|
2015-11-04 12:29:33 +00:00
|
|
|
|
#include "gtkstylecontextprivate.h"
|
2016-03-28 21:54:34 +00:00
|
|
|
|
#include "gtkprogresstrackerprivate.h"
|
2016-05-01 04:39:34 +00:00
|
|
|
|
#include "gtksettingsprivate.h"
|
2010-10-11 00:01:14 +00:00
|
|
|
|
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include <math.h>
|
|
|
|
|
|
2010-10-11 00:01:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtkscrolledwindow
|
|
|
|
|
* @Short_description: Adds scrollbars to its child widget
|
|
|
|
|
* @Title: GtkScrolledWindow
|
2010-10-18 04:21:39 +00:00
|
|
|
|
* @See_also: #GtkScrollable, #GtkViewport, #GtkAdjustment
|
2010-10-11 00:01:14 +00:00
|
|
|
|
*
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* GtkScrolledWindow is a #GtkBin subclass: it’s a container
|
|
|
|
|
* the accepts a single child widget. GtkScrolledWindow adds scrollbars
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* to the child widget and optionally draws a beveled frame around the
|
|
|
|
|
* child widget.
|
|
|
|
|
*
|
|
|
|
|
* The scrolled window can work in two ways. Some widgets have native
|
2010-10-18 04:21:39 +00:00
|
|
|
|
* scrolling support; these widgets implement the #GtkScrollable interface.
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* Widgets with native scroll support include #GtkTreeView, #GtkTextView,
|
|
|
|
|
* and #GtkLayout.
|
|
|
|
|
*
|
|
|
|
|
* For widgets that lack native scrolling support, the #GtkViewport
|
|
|
|
|
* widget acts as an adaptor class, implementing scrollability for child
|
|
|
|
|
* widgets that lack their own scrolling capabilities. Use #GtkViewport
|
2011-09-29 11:36:39 +00:00
|
|
|
|
* to scroll child widgets such as #GtkGrid, #GtkBox, and so on.
|
2010-10-11 00:01:14 +00:00
|
|
|
|
*
|
|
|
|
|
* If a widget has native scrolling abilities, it can be added to the
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* GtkScrolledWindow with gtk_container_add(). If a widget does not, you
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* must first add the widget to a #GtkViewport, then add the #GtkViewport
|
2013-02-01 16:03:44 +00:00
|
|
|
|
* to the scrolled window. gtk_container_add() will do this for you for
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* widgets that don’t implement #GtkScrollable natively, so you can
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* ignore the presence of the viewport.
|
|
|
|
|
*
|
2016-06-08 08:30:22 +00:00
|
|
|
|
* If gtk_container_add() has added a #GtkViewport for you, you can remove
|
|
|
|
|
* both your added child widget from the #GtkViewport and the #GtkViewport
|
|
|
|
|
* from the GtkScrolledWindow with either of the calls
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* gtk_container_remove (GTK_CONTAINER (scrolled_window),
|
|
|
|
|
* child_widget);
|
|
|
|
|
* // or
|
|
|
|
|
* gtk_container_remove (GTK_CONTAINER (scrolled_window),
|
|
|
|
|
* gtk_bin_get_child (GTK_BIN (scrolled_window)));
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* The position of the scrollbars is controlled by the scroll adjustments.
|
|
|
|
|
* See #GtkAdjustment for the fields in an adjustment — for
|
|
|
|
|
* #GtkScrollbar, used by GtkScrolledWindow, the “value” field
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* represents the position of the scrollbar, which must be between the
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* “lower” field and “upper - page_size.” The “page_size” field
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* represents the size of the visible scrollable area. The
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* “step_increment” and “page_increment” fields are used when the user
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* asks to step down (using the small stepper arrows) or page down (using
|
|
|
|
|
* for example the PageDown key).
|
|
|
|
|
*
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* If a GtkScrolledWindow doesn’t behave quite as you would like, or
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* doesn’t have exactly the right layout, it’s very possible to set up
|
2011-09-29 11:36:39 +00:00
|
|
|
|
* your own scrolling with #GtkScrollbar and for example a #GtkGrid.
|
2014-10-21 02:13:51 +00:00
|
|
|
|
*
|
|
|
|
|
* # Touch support
|
|
|
|
|
*
|
|
|
|
|
* GtkScrolledWindow has built-in support for touch devices. When a
|
|
|
|
|
* touchscreen is used, swiping will move the scrolled window, and will
|
|
|
|
|
* expose 'kinetic' behavior. This can be turned off with the
|
|
|
|
|
* #GtkScrolledWindow:kinetic-scrolling property if it is undesired.
|
|
|
|
|
*
|
|
|
|
|
* GtkScrolledWindow also displays visual 'overshoot' indication when
|
|
|
|
|
* the content is pulled beyond the end, and this situation can be
|
|
|
|
|
* captured with the #GtkScrolledWindow::edge-overshot signal.
|
|
|
|
|
*
|
|
|
|
|
* If no mouse device is present, the scrollbars will overlayed as
|
|
|
|
|
* narrow, auto-hiding indicators over the content. If traditional
|
|
|
|
|
* scrollbars are desired although no mouse is present, this behaviour
|
|
|
|
|
* can be turned off with the #GtkScrolledWindow:overlay-scrolling
|
|
|
|
|
* property.
|
2015-11-04 12:29:33 +00:00
|
|
|
|
*
|
|
|
|
|
* # CSS nodes
|
|
|
|
|
*
|
|
|
|
|
* GtkScrolledWindow has a main CSS node with name scrolledwindow.
|
2015-11-07 04:28:22 +00:00
|
|
|
|
*
|
|
|
|
|
* It uses subnodes with names overshoot and undershoot to
|
2015-11-04 12:29:33 +00:00
|
|
|
|
* draw the overflow and underflow indications. These nodes get
|
|
|
|
|
* the .left, .right, .top or .bottom style class added depending
|
2015-11-07 04:28:22 +00:00
|
|
|
|
* on where the indication is drawn.
|
|
|
|
|
*
|
|
|
|
|
* GtkScrolledWindow also sets the positional style classes (.left,
|
2015-11-07 04:35:20 +00:00
|
|
|
|
* .right, .top, .bottom) and style classes related to overlay
|
|
|
|
|
* scrolling (.overlay-indicator, .dragging, .hovering) on its scrollbars.
|
2015-11-07 04:28:22 +00:00
|
|
|
|
*
|
|
|
|
|
* If both scrollbars are visible, the area where they meet is drawn
|
|
|
|
|
* with a subnode named junction.
|
2010-10-11 00:01:14 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
1998-12-02 03:40:03 +00:00
|
|
|
|
/* scrolled window policy and size requisition handling:
|
|
|
|
|
*
|
|
|
|
|
* gtk size requisition works as follows:
|
|
|
|
|
* a widget upon size-request reports the width and height that it finds
|
|
|
|
|
* to be best suited to display its contents, including children.
|
|
|
|
|
* the width and/or height reported from a widget upon size requisition
|
|
|
|
|
* may be overidden by the user by specifying a width and/or height
|
2007-08-14 22:44:11 +00:00
|
|
|
|
* other than 0 through gtk_widget_set_size_request().
|
1998-12-02 03:40:03 +00:00
|
|
|
|
*
|
2007-08-14 22:44:11 +00:00
|
|
|
|
* a scrolled window needs (for implementing all three policy types) to
|
1998-12-02 03:40:03 +00:00
|
|
|
|
* request its width and height based on two different rationales.
|
|
|
|
|
* 1) the user wants the scrolled window to just fit into the space
|
|
|
|
|
* that it gets allocated for a specifc dimension.
|
|
|
|
|
* 1.1) this does not apply if the user specified a concrete value
|
|
|
|
|
* value for that specific dimension by either specifying usize for the
|
|
|
|
|
* scrolled window or for its child.
|
|
|
|
|
* 2) the user wants the scrolled window to take as much space up as
|
|
|
|
|
* is desired by the child for a specifc dimension (i.e. POLICY_NEVER).
|
|
|
|
|
*
|
|
|
|
|
* also, kinda obvious:
|
|
|
|
|
* 3) a user would certainly not have choosen a scrolled window as a container
|
|
|
|
|
* for the child, if the resulting allocation takes up more space than the
|
|
|
|
|
* child would have allocated without the scrolled window.
|
|
|
|
|
*
|
|
|
|
|
* conclusions:
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* A) from 1) follows: the scrolled window shouldn’t request more space for a
|
1998-12-02 03:40:03 +00:00
|
|
|
|
* specifc dimension than is required at minimum.
|
|
|
|
|
* B) from 1.1) follows: the requisition may be overidden by usize of the scrolled
|
|
|
|
|
* window (done automatically) or by usize of the child (needs to be checked).
|
|
|
|
|
* C) from 2) follows: for POLICY_NEVER, the scrolled window simply reports the
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* child’s dimension.
|
|
|
|
|
* D) from 3) follows: the scrolled window child’s minimum width and minimum height
|
1998-12-02 03:40:03 +00:00
|
|
|
|
* under A) at least correspond to the space taken up by its scrollbars.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
#define TOUCH_BYPASS_CAPTURED_THRESHOLD 30
|
|
|
|
|
|
|
|
|
|
/* Kinetic scrolling */
|
2014-05-28 17:17:02 +00:00
|
|
|
|
#define MAX_OVERSHOOT_DISTANCE 100
|
2014-05-26 16:19:24 +00:00
|
|
|
|
#define DECELERATION_FRICTION 4
|
|
|
|
|
#define OVERSHOOT_FRICTION 20
|
2015-05-23 13:57:41 +00:00
|
|
|
|
#define SCROLL_CAPTURE_THRESHOLD_MS 150
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2014-06-30 22:12:39 +00:00
|
|
|
|
/* Animated scrolling */
|
|
|
|
|
#define ANIMATION_DURATION 200
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
/* Overlay scrollbars */
|
2014-11-29 15:53:05 +00:00
|
|
|
|
#define INDICATOR_FADE_OUT_DELAY 2000
|
2014-10-09 03:34:32 +00:00
|
|
|
|
#define INDICATOR_FADE_OUT_DURATION 1000
|
|
|
|
|
#define INDICATOR_FADE_OUT_TIME 500
|
2015-01-19 01:01:55 +00:00
|
|
|
|
#define INDICATOR_CLOSE_DISTANCE 5
|
|
|
|
|
#define INDICATOR_FAR_DISTANCE 10
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2014-12-10 15:00:21 +00:00
|
|
|
|
/* Scrolled off indication */
|
2014-12-11 19:49:20 +00:00
|
|
|
|
#define UNDERSHOOT_SIZE 40
|
2014-12-10 15:00:21 +00:00
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *scrollbar;
|
|
|
|
|
GdkWindow *window;
|
2015-03-31 11:13:50 +00:00
|
|
|
|
gboolean over; /* either mouse over, or while dragging */
|
2014-10-09 03:34:32 +00:00
|
|
|
|
gint64 last_scroll_time;
|
|
|
|
|
guint conceil_timer;
|
|
|
|
|
|
|
|
|
|
gdouble current_pos;
|
|
|
|
|
gdouble source_pos;
|
|
|
|
|
gdouble target_pos;
|
2016-03-28 21:54:34 +00:00
|
|
|
|
GtkProgressTracker tracker;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
guint tick_id;
|
2014-12-01 13:25:23 +00:00
|
|
|
|
guint over_timeout_id;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
} Indicator;
|
|
|
|
|
|
2015-05-23 13:57:41 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
gdouble dx;
|
|
|
|
|
gdouble dy;
|
|
|
|
|
guint32 evtime;
|
|
|
|
|
} ScrollHistoryElem;
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
struct _GtkScrolledWindowPrivate
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *hscrollbar;
|
|
|
|
|
GtkWidget *vscrollbar;
|
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
GdkWindow *view_window;
|
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
GtkCssGadget *gadget;
|
2015-11-05 15:32:04 +00:00
|
|
|
|
GtkCssNode *overshoot_node[4];
|
|
|
|
|
GtkCssNode *undershoot_node[4];
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
Indicator hindicator;
|
|
|
|
|
Indicator vindicator;
|
|
|
|
|
|
2013-06-26 17:06:12 +00:00
|
|
|
|
GtkCornerType window_placement;
|
2010-08-30 23:24:30 +00:00
|
|
|
|
guint16 shadow_type;
|
|
|
|
|
|
2016-08-31 04:54:25 +00:00
|
|
|
|
guint hscrollbar_policy : 2;
|
|
|
|
|
guint vscrollbar_policy : 2;
|
|
|
|
|
guint hscrollbar_visible : 1;
|
|
|
|
|
guint vscrollbar_visible : 1;
|
|
|
|
|
guint focus_out : 1; /* used by ::move-focus-out implementation */
|
|
|
|
|
guint overlay_scrolling : 1;
|
|
|
|
|
guint use_indicators : 1;
|
|
|
|
|
guint auto_added_viewport : 1;
|
|
|
|
|
guint propagate_natural_width : 1;
|
|
|
|
|
guint propagate_natural_height : 1;
|
2010-10-22 16:46:33 +00:00
|
|
|
|
|
|
|
|
|
gint min_content_width;
|
|
|
|
|
gint min_content_height;
|
2016-06-02 02:18:37 +00:00
|
|
|
|
gint max_content_width;
|
|
|
|
|
gint max_content_height;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
guint scroll_events_overshoot_id;
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
/* Kinetic scrolling */
|
2014-02-26 14:48:21 +00:00
|
|
|
|
GtkGesture *long_press_gesture;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
GtkGesture *swipe_gesture;
|
|
|
|
|
|
2015-05-23 13:57:41 +00:00
|
|
|
|
GArray *scroll_history;
|
|
|
|
|
GdkDevice *scroll_device;
|
2016-06-01 03:33:54 +00:00
|
|
|
|
GdkWindow *scroll_window;
|
|
|
|
|
GdkCursor *scroll_cursor;
|
2015-05-23 13:57:41 +00:00
|
|
|
|
|
2014-05-16 16:35:45 +00:00
|
|
|
|
/* These two gestures are mutually exclusive */
|
|
|
|
|
GtkGesture *drag_gesture;
|
|
|
|
|
GtkGesture *pan_gesture;
|
|
|
|
|
|
2014-02-26 14:48:21 +00:00
|
|
|
|
gdouble drag_start_x;
|
|
|
|
|
gdouble drag_start_y;
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
GdkDevice *drag_device;
|
|
|
|
|
guint kinetic_scrolling : 1;
|
|
|
|
|
guint capture_button_press : 1;
|
2014-03-03 20:40:19 +00:00
|
|
|
|
guint in_drag : 1;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
guint deceleration_id;
|
|
|
|
|
|
|
|
|
|
gdouble x_velocity;
|
|
|
|
|
gdouble y_velocity;
|
|
|
|
|
|
|
|
|
|
gdouble unclamped_hadj_value;
|
|
|
|
|
gdouble unclamped_vadj_value;
|
2010-08-30 23:24:30 +00:00
|
|
|
|
};
|
2006-03-20 19:17:59 +00:00
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
|
|
|
|
gint64 last_deceleration_time;
|
|
|
|
|
|
2014-05-26 16:19:24 +00:00
|
|
|
|
GtkKineticScrolling *hscrolling;
|
|
|
|
|
GtkKineticScrolling *vscrolling;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
} KineticScrollData;
|
2006-03-20 19:17:59 +00:00
|
|
|
|
|
1998-07-16 02:47:15 +00:00
|
|
|
|
enum {
|
2001-07-19 19:49:01 +00:00
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_HADJUSTMENT,
|
|
|
|
|
PROP_VADJUSTMENT,
|
|
|
|
|
PROP_HSCROLLBAR_POLICY,
|
|
|
|
|
PROP_VSCROLLBAR_POLICY,
|
|
|
|
|
PROP_WINDOW_PLACEMENT,
|
2010-10-22 16:46:33 +00:00
|
|
|
|
PROP_SHADOW_TYPE,
|
|
|
|
|
PROP_MIN_CONTENT_WIDTH,
|
2011-02-11 12:43:56 +00:00
|
|
|
|
PROP_MIN_CONTENT_HEIGHT,
|
2014-10-09 03:34:32 +00:00
|
|
|
|
PROP_KINETIC_SCROLLING,
|
2015-09-07 19:55:58 +00:00
|
|
|
|
PROP_OVERLAY_SCROLLING,
|
2016-06-02 02:18:37 +00:00
|
|
|
|
PROP_MAX_CONTENT_WIDTH,
|
|
|
|
|
PROP_MAX_CONTENT_HEIGHT,
|
2016-08-31 04:54:25 +00:00
|
|
|
|
PROP_PROPAGATE_NATURAL_WIDTH,
|
|
|
|
|
PROP_PROPAGATE_NATURAL_HEIGHT,
|
2015-09-07 19:55:58 +00:00
|
|
|
|
NUM_PROPERTIES
|
1998-07-16 02:47:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-02-16 01:34:26 +00:00
|
|
|
|
/* Signals */
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
SCROLL_CHILD,
|
|
|
|
|
MOVE_FOCUS_OUT,
|
2014-10-12 12:29:24 +00:00
|
|
|
|
EDGE_OVERSHOT,
|
2015-01-25 11:53:49 +00:00
|
|
|
|
EDGE_REACHED,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
2008-08-29 12:25:42 +00:00
|
|
|
|
static void gtk_scrolled_window_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_scrolled_window_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2016-06-05 23:36:09 +00:00
|
|
|
|
static void gtk_scrolled_window_finalize (GObject *object);
|
2008-08-29 12:25:42 +00:00
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
static void gtk_scrolled_window_destroy (GtkWidget *widget);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
|
|
|
|
|
GtkSnapshot *snapshot);
|
2008-08-29 12:25:42 +00:00
|
|
|
|
static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
|
static gboolean gtk_scrolled_window_scroll_event (GtkWidget *widget,
|
|
|
|
|
GdkEventScroll *event);
|
|
|
|
|
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
|
|
|
|
|
GtkDirectionType direction);
|
|
|
|
|
static void gtk_scrolled_window_add (GtkContainer *container,
|
|
|
|
|
GtkWidget *widget);
|
|
|
|
|
static void gtk_scrolled_window_remove (GtkContainer *container,
|
|
|
|
|
GtkWidget *widget);
|
|
|
|
|
static void gtk_scrolled_window_forall (GtkContainer *container,
|
|
|
|
|
gboolean include_internals,
|
|
|
|
|
GtkCallback callback,
|
|
|
|
|
gpointer callback_data);
|
|
|
|
|
static gboolean gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkScrollType scroll,
|
|
|
|
|
gboolean horizontal);
|
|
|
|
|
static void gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkDirectionType direction_type);
|
|
|
|
|
|
|
|
|
|
static void gtk_scrolled_window_relative_allocation(GtkWidget *widget,
|
|
|
|
|
GtkAllocation *allocation);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
static void gtk_scrolled_window_inner_allocation (GtkWidget *widget,
|
|
|
|
|
GtkAllocation *rect);
|
|
|
|
|
static void gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkWidget *scrollbar,
|
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
|
static void gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
|
|
|
|
GtkAllocation *relative_allocation);
|
2008-08-29 12:25:42 +00:00
|
|
|
|
static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
|
|
|
|
|
gpointer data);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
static void gtk_scrolled_window_adjustment_value_changed (GtkAdjustment *adjustment,
|
|
|
|
|
gpointer data);
|
2016-05-01 04:39:34 +00:00
|
|
|
|
static gboolean gtk_widget_should_animate (GtkWidget *widget);
|
2008-08-29 12:25:42 +00:00
|
|
|
|
|
2016-10-22 14:06:14 +00:00
|
|
|
|
static void gtk_scrolled_window_measure_ (GtkWidget *widget,
|
|
|
|
|
GtkOrientation orientation,
|
|
|
|
|
int for_size,
|
|
|
|
|
int *minimum,
|
|
|
|
|
int *natural,
|
|
|
|
|
int *minimum_baseline,
|
|
|
|
|
int *natural_baseline);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
static void gtk_scrolled_window_map (GtkWidget *widget);
|
|
|
|
|
static void gtk_scrolled_window_unmap (GtkWidget *widget);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
static void gtk_scrolled_window_realize (GtkWidget *widget);
|
|
|
|
|
static void gtk_scrolled_window_unrealize (GtkWidget *widget);
|
2012-08-28 15:51:18 +00:00
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
static void gtk_scrolled_window_grab_notify (GtkWidget *widget,
|
|
|
|
|
gboolean was_grabbed);
|
|
|
|
|
|
2014-10-12 12:01:03 +00:00
|
|
|
|
static void _gtk_scrolled_window_set_adjustment_value (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkAdjustment *adjustment,
|
|
|
|
|
gdouble value);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2012-10-02 23:54:15 +00:00
|
|
|
|
static void gtk_scrolled_window_cancel_deceleration (GtkScrolledWindow *scrolled_window);
|
|
|
|
|
|
2014-02-26 14:48:21 +00:00
|
|
|
|
static gboolean _gtk_scrolled_window_get_overshoot (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gint *overshoot_x,
|
|
|
|
|
gint *overshoot_y);
|
|
|
|
|
|
|
|
|
|
static void gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window);
|
|
|
|
|
|
2016-06-07 05:09:28 +00:00
|
|
|
|
static void gtk_scrolled_window_update_use_indicators (GtkScrolledWindow *scrolled_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
static void remove_indicator (GtkScrolledWindow *sw,
|
|
|
|
|
Indicator *indicator);
|
|
|
|
|
static void indicator_stop_fade (Indicator *indicator);
|
|
|
|
|
static gboolean maybe_hide_indicator (gpointer data);
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
static void indicator_start_fade (Indicator *indicator,
|
|
|
|
|
gdouble pos);
|
2014-12-01 12:37:18 +00:00
|
|
|
|
static void indicator_set_over (Indicator *indicator,
|
|
|
|
|
gboolean over);
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2002-02-16 01:34:26 +00:00
|
|
|
|
static guint signals[LAST_SIGNAL] = {0};
|
2015-09-07 19:55:58 +00:00
|
|
|
|
static GParamSpec *properties[NUM_PROPERTIES];
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-02-16 01:34:26 +00:00
|
|
|
|
static void
|
|
|
|
|
add_scroll_binding (GtkBindingSet *binding_set,
|
|
|
|
|
guint keyval,
|
|
|
|
|
GdkModifierType mask,
|
|
|
|
|
GtkScrollType scroll,
|
|
|
|
|
gboolean horizontal)
|
|
|
|
|
{
|
2010-09-08 17:35:51 +00:00
|
|
|
|
guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
|
|
|
|
gtk_binding_entry_add_signal (binding_set, keyval, mask,
|
2008-08-08 14:36:41 +00:00
|
|
|
|
"scroll-child", 2,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GTK_TYPE_SCROLL_TYPE, scroll,
|
|
|
|
|
G_TYPE_BOOLEAN, horizontal);
|
|
|
|
|
gtk_binding_entry_add_signal (binding_set, keypad_keyval, mask,
|
2008-08-08 14:36:41 +00:00
|
|
|
|
"scroll-child", 2,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GTK_TYPE_SCROLL_TYPE, scroll,
|
|
|
|
|
G_TYPE_BOOLEAN, horizontal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
add_tab_bindings (GtkBindingSet *binding_set,
|
|
|
|
|
GdkModifierType modifiers,
|
|
|
|
|
GtkDirectionType direction)
|
|
|
|
|
{
|
2010-09-08 17:35:51 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
|
2008-08-08 14:36:41 +00:00
|
|
|
|
"move-focus-out", 1,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GTK_TYPE_DIRECTION_TYPE, direction);
|
2010-09-08 17:35:51 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
|
2008-08-08 14:36:41 +00:00
|
|
|
|
"move-focus-out", 1,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GTK_TYPE_DIRECTION_TYPE, direction);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 12:37:18 +00:00
|
|
|
|
static gboolean
|
2015-01-10 01:26:07 +00:00
|
|
|
|
gtk_scrolled_window_leave_notify (GtkWidget *widget,
|
2014-12-01 12:37:18 +00:00
|
|
|
|
GdkEventCrossing *event)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = GTK_SCROLLED_WINDOW (widget)->priv;
|
|
|
|
|
|
2015-02-02 11:58:56 +00:00
|
|
|
|
if (priv->use_indicators && event->detail != GDK_NOTIFY_INFERIOR)
|
2015-01-09 11:45:51 +00:00
|
|
|
|
{
|
|
|
|
|
indicator_set_over (&priv->hindicator, FALSE);
|
|
|
|
|
indicator_set_over (&priv->vindicator, FALSE);
|
|
|
|
|
}
|
2014-12-01 12:37:18 +00:00
|
|
|
|
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-07 04:28:22 +00:00
|
|
|
|
static void
|
|
|
|
|
update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
gboolean is_rtl;
|
|
|
|
|
|
|
|
|
|
if (priv->hscrollbar != NULL)
|
|
|
|
|
{
|
|
|
|
|
context = gtk_widget_get_style_context (priv->hscrollbar);
|
|
|
|
|
if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_TOP_RIGHT)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
|
|
|
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->vscrollbar != NULL)
|
|
|
|
|
{
|
|
|
|
|
context = gtk_widget_get_style_context (priv->vscrollbar);
|
2017-01-11 14:27:51 +00:00
|
|
|
|
is_rtl = _gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL;
|
2015-11-07 04:28:22 +00:00
|
|
|
|
if ((is_rtl &&
|
|
|
|
|
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
|
|
|
|
|
(!is_rtl &&
|
|
|
|
|
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
|
|
|
|
|
{
|
2016-03-03 00:08:19 +00:00
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
|
|
|
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
2015-11-07 04:28:22 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-03-03 00:08:19 +00:00
|
|
|
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
2015-11-07 04:28:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_direction_changed (GtkWidget *widget,
|
|
|
|
|
GtkTextDirection previous_dir)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
|
|
|
|
|
update_scrollbar_positions (scrolled_window);
|
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->direction_changed (widget, previous_dir);
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
|
|
|
|
{
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
|
GtkContainerClass *container_class;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GtkBindingSet *binding_set;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
|
|
|
|
container_class = (GtkContainerClass*) class;
|
2002-10-09 00:38:22 +00:00
|
|
|
|
|
2001-07-19 19:49:01 +00:00
|
|
|
|
gobject_class->set_property = gtk_scrolled_window_set_property;
|
|
|
|
|
gobject_class->get_property = gtk_scrolled_window_get_property;
|
2016-06-05 23:36:09 +00:00
|
|
|
|
gobject_class->finalize = gtk_scrolled_window_finalize;
|
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-09-18 23:55:42 +00:00
|
|
|
|
widget_class->destroy = gtk_scrolled_window_destroy;
|
2016-12-13 14:14:49 +00:00
|
|
|
|
widget_class->snapshot = gtk_scrolled_window_snapshot;
|
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
|
|
|
|
widget_class->size_allocate = gtk_scrolled_window_size_allocate;
|
|
|
|
|
widget_class->scroll_event = gtk_scrolled_window_scroll_event;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
widget_class->focus = gtk_scrolled_window_focus;
|
2016-10-22 14:06:14 +00:00
|
|
|
|
widget_class->measure = gtk_scrolled_window_measure_;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
widget_class->map = gtk_scrolled_window_map;
|
|
|
|
|
widget_class->unmap = gtk_scrolled_window_unmap;
|
|
|
|
|
widget_class->grab_notify = gtk_scrolled_window_grab_notify;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
widget_class->realize = gtk_scrolled_window_realize;
|
|
|
|
|
widget_class->unrealize = gtk_scrolled_window_unrealize;
|
2014-12-01 12:37:18 +00:00
|
|
|
|
widget_class->leave_notify_event = gtk_scrolled_window_leave_notify;
|
2015-11-07 04:28:22 +00:00
|
|
|
|
widget_class->direction_changed = gtk_scrolled_window_direction_changed;
|
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_scrolled_window_add;
|
|
|
|
|
container_class->remove = gtk_scrolled_window_remove;
|
|
|
|
|
container_class->forall = gtk_scrolled_window_forall;
|
|
|
|
|
|
2002-02-16 01:34:26 +00:00
|
|
|
|
class->scroll_child = gtk_scrolled_window_scroll_child;
|
|
|
|
|
class->move_focus_out = gtk_scrolled_window_move_focus_out;
|
2015-01-10 02:09:22 +00:00
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
properties[PROP_HADJUSTMENT] =
|
|
|
|
|
g_param_spec_object ("hadjustment",
|
|
|
|
|
P_("Horizontal Adjustment"),
|
|
|
|
|
P_("The GtkAdjustment for the horizontal position"),
|
|
|
|
|
GTK_TYPE_ADJUSTMENT,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT);
|
|
|
|
|
|
|
|
|
|
properties[PROP_VADJUSTMENT] =
|
|
|
|
|
g_param_spec_object ("vadjustment",
|
|
|
|
|
P_("Vertical Adjustment"),
|
|
|
|
|
P_("The GtkAdjustment for the vertical position"),
|
|
|
|
|
GTK_TYPE_ADJUSTMENT,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT);
|
|
|
|
|
|
|
|
|
|
properties[PROP_HSCROLLBAR_POLICY] =
|
|
|
|
|
g_param_spec_enum ("hscrollbar-policy",
|
|
|
|
|
P_("Horizontal Scrollbar Policy"),
|
|
|
|
|
P_("When the horizontal scrollbar is displayed"),
|
|
|
|
|
GTK_TYPE_POLICY_TYPE,
|
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
|
|
properties[PROP_VSCROLLBAR_POLICY] =
|
|
|
|
|
g_param_spec_enum ("vscrollbar-policy",
|
|
|
|
|
P_("Vertical Scrollbar Policy"),
|
|
|
|
|
P_("When the vertical scrollbar is displayed"),
|
|
|
|
|
GTK_TYPE_POLICY_TYPE,
|
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
|
|
properties[PROP_WINDOW_PLACEMENT] =
|
|
|
|
|
g_param_spec_enum ("window-placement",
|
|
|
|
|
P_("Window Placement"),
|
|
|
|
|
P_("Where the contents are located with respect to the scrollbars."),
|
|
|
|
|
GTK_TYPE_CORNER_TYPE,
|
|
|
|
|
GTK_CORNER_TOP_LEFT,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
|
|
properties[PROP_SHADOW_TYPE] =
|
|
|
|
|
g_param_spec_enum ("shadow-type",
|
|
|
|
|
P_("Shadow Type"),
|
|
|
|
|
P_("Style of bevel around the contents"),
|
|
|
|
|
GTK_TYPE_SHADOW_TYPE,
|
|
|
|
|
GTK_SHADOW_NONE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
2011-01-08 09:46:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:min-content-width:
|
|
|
|
|
*
|
|
|
|
|
* The minimum content width of @scrolled_window, or -1 if not set.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
2015-09-07 19:55:58 +00:00
|
|
|
|
properties[PROP_MIN_CONTENT_WIDTH] =
|
|
|
|
|
g_param_spec_int ("min-content-width",
|
|
|
|
|
P_("Minimum Content Width"),
|
|
|
|
|
P_("The minimum width that the scrolled window will allocate to its content"),
|
|
|
|
|
-1, G_MAXINT, -1,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2011-01-08 09:46:46 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:min-content-height:
|
|
|
|
|
*
|
|
|
|
|
* The minimum content height of @scrolled_window, or -1 if not set.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
2015-09-07 19:55:58 +00:00
|
|
|
|
properties[PROP_MIN_CONTENT_HEIGHT] =
|
|
|
|
|
g_param_spec_int ("min-content-height",
|
|
|
|
|
P_("Minimum Content Height"),
|
|
|
|
|
P_("The minimum height that the scrolled window will allocate to its content"),
|
|
|
|
|
-1, G_MAXINT, -1,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:kinetic-scrolling:
|
|
|
|
|
*
|
2014-10-21 02:13:51 +00:00
|
|
|
|
* Whether kinetic scrolling is enabled or not. Kinetic scrolling
|
|
|
|
|
* only applies to devices with source %GDK_SOURCE_TOUCHSCREEN.
|
2011-02-11 12:43:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
*/
|
2015-09-07 19:55:58 +00:00
|
|
|
|
properties[PROP_KINETIC_SCROLLING] =
|
|
|
|
|
g_param_spec_boolean ("kinetic-scrolling",
|
|
|
|
|
P_("Kinetic Scrolling"),
|
|
|
|
|
P_("Kinetic scrolling mode."),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2014-06-09 13:27:07 +00:00
|
|
|
|
|
2014-10-21 02:13:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:overlay-scrolling:
|
|
|
|
|
*
|
|
|
|
|
* Whether overlay scrolling is enabled or not. If it is, the
|
|
|
|
|
* scrollbars are only added as traditional widgets when a mouse
|
|
|
|
|
* is present. Otherwise, they are overlayed on top of the content,
|
|
|
|
|
* as narrow indicators.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.16
|
|
|
|
|
*/
|
2015-09-07 19:55:58 +00:00
|
|
|
|
properties[PROP_OVERLAY_SCROLLING] =
|
|
|
|
|
g_param_spec_boolean ("overlay-scrolling",
|
|
|
|
|
P_("Overlay Scrolling"),
|
|
|
|
|
P_("Overlay scrolling mode"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2016-06-02 02:18:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:max-content-width:
|
|
|
|
|
*
|
|
|
|
|
* The maximum content width of @scrolled_window, or -1 if not set.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
properties[PROP_MAX_CONTENT_WIDTH] =
|
|
|
|
|
g_param_spec_int ("max-content-width",
|
|
|
|
|
P_("Maximum Content Width"),
|
|
|
|
|
P_("The maximum width that the scrolled window will allocate to its content"),
|
|
|
|
|
-1, G_MAXINT, -1,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:max-content-height:
|
|
|
|
|
*
|
|
|
|
|
* The maximum content height of @scrolled_window, or -1 if not set.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
properties[PROP_MAX_CONTENT_HEIGHT] =
|
|
|
|
|
g_param_spec_int ("max-content-height",
|
|
|
|
|
P_("Maximum Content Height"),
|
|
|
|
|
P_("The maximum height that the scrolled window will allocate to its content"),
|
|
|
|
|
-1, G_MAXINT, -1,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2016-08-31 04:54:25 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:propagate-natural-width:
|
|
|
|
|
*
|
|
|
|
|
* Whether the natural width of the child should be calculated and propagated
|
|
|
|
|
* through the scrolled windows requested natural width.
|
|
|
|
|
*
|
|
|
|
|
* This is useful in cases where an attempt should be made to allocate exactly
|
|
|
|
|
* enough space for the natural size of the child.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
properties[PROP_PROPAGATE_NATURAL_WIDTH] =
|
|
|
|
|
g_param_spec_boolean ("propagate-natural-width",
|
|
|
|
|
P_("Propagate Natural Width"),
|
|
|
|
|
P_("Propagate Natural Width"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow:propagate-natural-height:
|
|
|
|
|
*
|
|
|
|
|
* Whether the natural height of the child should be calculated and propagated
|
|
|
|
|
* through the scrolled windows requested natural height.
|
|
|
|
|
*
|
|
|
|
|
* This is useful in cases where an attempt should be made to allocate exactly
|
|
|
|
|
* enough space for the natural size of the child.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
properties[PROP_PROPAGATE_NATURAL_HEIGHT] =
|
|
|
|
|
g_param_spec_boolean ("propagate-natural-height",
|
|
|
|
|
P_("Propagate Natural Height"),
|
|
|
|
|
P_("Propagate Natural Height"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2010-10-11 00:01:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow::scroll-child:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @scroll: a #GtkScrollType describing how much to scroll
|
|
|
|
|
* @horizontal: whether the keybinding scrolls the child
|
|
|
|
|
* horizontally or not
|
|
|
|
|
*
|
|
|
|
|
* The ::scroll-child signal is a
|
2014-02-07 20:37:02 +00:00
|
|
|
|
* [keybinding signal][GtkBindingSignal]
|
2010-10-11 00:01:14 +00:00
|
|
|
|
* which gets emitted when a keybinding that scrolls is pressed.
|
|
|
|
|
* The horizontal or vertical adjustment is updated which triggers a
|
|
|
|
|
* signal that the scrolled windows child may listen to and scroll itself.
|
|
|
|
|
*/
|
2002-02-16 01:34:26 +00:00
|
|
|
|
signals[SCROLL_CHILD] =
|
2008-08-08 14:36:41 +00:00
|
|
|
|
g_signal_new (I_("scroll-child"),
|
2010-09-18 23:55:42 +00:00
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
2002-02-16 01:34:26 +00:00
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
|
G_STRUCT_OFFSET (GtkScrolledWindowClass, scroll_child),
|
|
|
|
|
NULL, NULL,
|
2007-01-02 07:07:09 +00:00
|
|
|
|
_gtk_marshal_BOOLEAN__ENUM_BOOLEAN,
|
|
|
|
|
G_TYPE_BOOLEAN, 2,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
G_TYPE_BOOLEAN);
|
2010-10-11 00:01:14 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow::move-focus-out:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @direction_type: either %GTK_DIR_TAB_FORWARD or
|
|
|
|
|
* %GTK_DIR_TAB_BACKWARD
|
|
|
|
|
*
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* The ::move-focus-out signal is a
|
2014-02-07 20:37:02 +00:00
|
|
|
|
* [keybinding signal][GtkBindingSignal] which gets
|
2014-02-05 00:29:00 +00:00
|
|
|
|
* emitted when focus is moved away from the scrolled window by a
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* keybinding. The #GtkWidget::move-focus signal is emitted with
|
2014-02-05 00:29:00 +00:00
|
|
|
|
* @direction_type on this scrolled windows toplevel parent in the
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* container hierarchy. The default bindings for this signal are
|
2014-02-05 00:29:00 +00:00
|
|
|
|
* `Tab + Ctrl` and `Tab + Ctrl + Shift`.
|
2010-10-11 00:01:14 +00:00
|
|
|
|
*/
|
2002-02-16 01:34:26 +00:00
|
|
|
|
signals[MOVE_FOCUS_OUT] =
|
2008-08-08 14:36:41 +00:00
|
|
|
|
g_signal_new (I_("move-focus-out"),
|
2010-09-18 23:55:42 +00:00
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
2002-02-16 01:34:26 +00:00
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
|
G_STRUCT_OFFSET (GtkScrolledWindowClass, move_focus_out),
|
|
|
|
|
NULL, NULL,
|
2016-08-29 14:00:17 +00:00
|
|
|
|
NULL,
|
2002-02-16 01:34:26 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
GTK_TYPE_DIRECTION_TYPE);
|
2014-10-12 12:29:24 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow::edge-overshot:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @pos: edge side that was hit
|
|
|
|
|
*
|
|
|
|
|
* The ::edge-overshot signal is emitted whenever user initiated scrolling
|
|
|
|
|
* makes the scrolledwindow firmly surpass (ie. with some edge resistance)
|
|
|
|
|
* the lower or upper limits defined by the adjustment in that orientation.
|
|
|
|
|
*
|
2015-01-25 11:53:49 +00:00
|
|
|
|
* A similar behavior without edge resistance is provided by the
|
|
|
|
|
* #GtkScrolledWindow::edge-reached signal.
|
2014-10-12 12:29:24 +00:00
|
|
|
|
*
|
|
|
|
|
* Note: The @pos argument is LTR/RTL aware, so callers should be aware too
|
|
|
|
|
* if intending to provide behavior on horizontal edges.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.16
|
|
|
|
|
*/
|
|
|
|
|
signals[EDGE_OVERSHOT] =
|
|
|
|
|
g_signal_new (I_("edge-overshot"),
|
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST, 0,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_generic,
|
|
|
|
|
G_TYPE_NONE, 1, GTK_TYPE_POSITION_TYPE);
|
|
|
|
|
|
2015-01-25 11:53:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkScrolledWindow::edge-reached:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @pos: edge side that was reached
|
|
|
|
|
*
|
|
|
|
|
* The ::edge-reached signal is emitted whenever user-initiated scrolling
|
|
|
|
|
* makes the scrolledwindow exactly reaches the lower or upper limits
|
|
|
|
|
* defined by the adjustment in that orientation.
|
|
|
|
|
*
|
|
|
|
|
* A similar behavior with edge resistance is provided by the
|
|
|
|
|
* #GtkScrolledWindow::edge-overshot signal.
|
|
|
|
|
*
|
|
|
|
|
* Note: The @pos argument is LTR/RTL aware, so callers should be aware too
|
|
|
|
|
* if intending to provide behavior on horizontal edges.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.16
|
|
|
|
|
*/
|
|
|
|
|
signals[EDGE_REACHED] =
|
|
|
|
|
g_signal_new (I_("edge-reached"),
|
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST, 0,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_generic,
|
|
|
|
|
G_TYPE_NONE, 1, GTK_TYPE_POSITION_TYPE);
|
|
|
|
|
|
2002-02-16 01:34:26 +00:00
|
|
|
|
binding_set = gtk_binding_set_by_class (class);
|
|
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Left, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, TRUE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Right, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD, TRUE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Up, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, FALSE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Down, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD, FALSE);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Page_Up, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_BACKWARD, TRUE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Page_Down, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_FORWARD, TRUE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Page_Up, 0, GTK_SCROLL_PAGE_BACKWARD, FALSE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Page_Down, 0, GTK_SCROLL_PAGE_FORWARD, FALSE);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Home, GDK_CONTROL_MASK, GTK_SCROLL_START, TRUE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_End, GDK_CONTROL_MASK, GTK_SCROLL_END, TRUE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_Home, 0, GTK_SCROLL_START, FALSE);
|
|
|
|
|
add_scroll_binding (binding_set, GDK_KEY_End, 0, GTK_SCROLL_END, FALSE);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
|
|
|
|
add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
|
|
|
|
|
add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
|
2006-03-20 19:17:59 +00:00
|
|
|
|
|
2011-06-29 03:13:27 +00:00
|
|
|
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE);
|
2015-11-04 12:29:33 +00:00
|
|
|
|
gtk_widget_class_set_css_name (widget_class, "scrolledwindow");
|
1998-07-16 02:47:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
may_hscroll (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
return priv->hscrollbar_visible || priv->hscrollbar_policy == GTK_POLICY_EXTERNAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
may_vscroll (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
return priv->vscrollbar_visible || priv->vscrollbar_policy == GTK_POLICY_EXTERNAL;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-08 02:59:07 +00:00
|
|
|
|
static inline gboolean
|
|
|
|
|
policy_may_be_visible (GtkPolicyType policy)
|
|
|
|
|
{
|
|
|
|
|
return policy == GTK_POLICY_ALWAYS || policy == GTK_POLICY_AUTOMATIC;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 14:48:21 +00:00
|
|
|
|
static void
|
|
|
|
|
scrolled_window_drag_begin_cb (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gdouble start_x,
|
|
|
|
|
gdouble start_y,
|
|
|
|
|
GtkGesture *gesture)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2014-03-03 20:40:19 +00:00
|
|
|
|
GtkEventSequenceState state;
|
2014-02-26 14:48:21 +00:00
|
|
|
|
GdkEventSequence *sequence;
|
2014-06-12 13:17:47 +00:00
|
|
|
|
GtkWidget *event_widget;
|
|
|
|
|
const GdkEvent *event;
|
2014-02-26 14:48:21 +00:00
|
|
|
|
|
2014-03-03 20:40:19 +00:00
|
|
|
|
priv->in_drag = FALSE;
|
2014-02-26 14:48:21 +00:00
|
|
|
|
priv->drag_start_x = priv->unclamped_hadj_value;
|
|
|
|
|
priv->drag_start_y = priv->unclamped_vadj_value;
|
|
|
|
|
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
2014-06-12 13:17:47 +00:00
|
|
|
|
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
|
|
|
|
event = gtk_gesture_get_last_event (gesture, sequence);
|
|
|
|
|
event_widget = gtk_get_event_widget ((GdkEvent *) event);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (event_widget == priv->vscrollbar || event_widget == priv->hscrollbar ||
|
|
|
|
|
(!may_hscroll (scrolled_window) && !may_vscroll (scrolled_window)))
|
2014-03-03 20:40:19 +00:00
|
|
|
|
state = GTK_EVENT_SEQUENCE_DENIED;
|
|
|
|
|
else if (priv->capture_button_press)
|
|
|
|
|
state = GTK_EVENT_SEQUENCE_CLAIMED;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
2014-04-08 19:05:00 +00:00
|
|
|
|
gtk_gesture_set_sequence_state (gesture, sequence, state);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-27 11:39:51 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
2015-01-16 12:18:09 +00:00
|
|
|
|
GtkAllocation child_allocation;
|
2014-07-27 11:39:51 +00:00
|
|
|
|
gint overshoot_x, overshoot_y;
|
|
|
|
|
|
|
|
|
|
if (!_gtk_scrolled_window_get_overshoot (scrolled_window, &overshoot_x, &overshoot_y))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_relative_allocation (GTK_WIDGET (scrolled_window),
|
|
|
|
|
&child_allocation);
|
|
|
|
|
if (overshoot_x != 0)
|
|
|
|
|
{
|
2016-10-20 16:46:27 +00:00
|
|
|
|
gtk_widget_queue_draw_area (GTK_WIDGET (scrolled_window),
|
|
|
|
|
overshoot_x < 0 ? child_allocation.x :
|
|
|
|
|
child_allocation.x + child_allocation.width - MAX_OVERSHOOT_DISTANCE,
|
|
|
|
|
child_allocation.y,
|
|
|
|
|
MAX_OVERSHOOT_DISTANCE,
|
|
|
|
|
child_allocation.height);
|
2014-07-27 11:39:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (overshoot_y != 0)
|
|
|
|
|
{
|
2016-10-20 16:46:27 +00:00
|
|
|
|
gtk_widget_queue_draw_area (GTK_WIDGET (scrolled_window),
|
|
|
|
|
child_allocation.x,
|
|
|
|
|
overshoot_y < 0 ? child_allocation.y :
|
|
|
|
|
child_allocation.y + child_allocation.height - MAX_OVERSHOOT_DISTANCE,
|
|
|
|
|
child_allocation.width,
|
|
|
|
|
MAX_OVERSHOOT_DISTANCE);
|
2014-07-27 11:39:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 14:48:21 +00:00
|
|
|
|
static void
|
|
|
|
|
scrolled_window_drag_update_cb (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gdouble offset_x,
|
|
|
|
|
gdouble offset_y,
|
|
|
|
|
GtkGesture *gesture)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkAdjustment *hadjustment;
|
|
|
|
|
GtkAdjustment *vadjustment;
|
|
|
|
|
gdouble dx, dy;
|
|
|
|
|
|
2014-07-27 11:39:51 +00:00
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
|
|
|
|
|
2014-03-03 20:40:19 +00:00
|
|
|
|
if (!priv->capture_button_press)
|
|
|
|
|
{
|
|
|
|
|
GdkEventSequence *sequence;
|
|
|
|
|
|
2014-04-08 19:05:00 +00:00
|
|
|
|
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
|
|
|
|
gtk_gesture_set_sequence_state (gesture, sequence,
|
|
|
|
|
GTK_EVENT_SEQUENCE_CLAIMED);
|
2014-03-03 20:40:19 +00:00
|
|
|
|
}
|
2014-02-26 14:48:21 +00:00
|
|
|
|
|
|
|
|
|
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (hadjustment && may_hscroll (scrolled_window))
|
2014-02-26 14:48:21 +00:00
|
|
|
|
{
|
2014-03-26 09:53:42 +00:00
|
|
|
|
dx = priv->drag_start_x - offset_x;
|
2014-10-12 12:01:03 +00:00
|
|
|
|
_gtk_scrolled_window_set_adjustment_value (scrolled_window,
|
|
|
|
|
hadjustment, dx);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (vadjustment && may_vscroll (scrolled_window))
|
2014-02-26 14:48:21 +00:00
|
|
|
|
{
|
2014-03-26 09:53:42 +00:00
|
|
|
|
dy = priv->drag_start_y - offset_y;
|
2014-10-12 12:01:03 +00:00
|
|
|
|
_gtk_scrolled_window_set_adjustment_value (scrolled_window,
|
|
|
|
|
vadjustment, dy);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-27 11:39:51 +00:00
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-03 20:40:19 +00:00
|
|
|
|
static void
|
|
|
|
|
scrolled_window_drag_end_cb (GtkScrolledWindow *scrolled_window,
|
2014-05-06 13:20:56 +00:00
|
|
|
|
GdkEventSequence *sequence,
|
2014-03-03 20:40:19 +00:00
|
|
|
|
GtkGesture *gesture)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
2014-05-06 13:20:56 +00:00
|
|
|
|
if (!priv->in_drag || !gtk_gesture_handles_sequence (gesture, sequence))
|
|
|
|
|
gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_DENIED);
|
2014-03-03 20:40:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 14:48:21 +00:00
|
|
|
|
static void
|
2015-05-23 13:57:41 +00:00
|
|
|
|
gtk_scrolled_window_decelerate (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gdouble x_velocity,
|
|
|
|
|
gdouble y_velocity)
|
2014-02-26 14:48:21 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
gboolean overshoot;
|
|
|
|
|
|
|
|
|
|
overshoot = _gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL);
|
2015-05-23 13:57:41 +00:00
|
|
|
|
priv->x_velocity = x_velocity;
|
|
|
|
|
priv->y_velocity = y_velocity;
|
2014-02-26 14:48:21 +00:00
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
/* Zero out vector components for which we don't scroll */
|
|
|
|
|
if (!may_hscroll (scrolled_window))
|
2014-02-26 14:48:21 +00:00
|
|
|
|
priv->x_velocity = 0;
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (!may_vscroll (scrolled_window))
|
2014-02-26 14:48:21 +00:00
|
|
|
|
priv->y_velocity = 0;
|
|
|
|
|
|
|
|
|
|
if (priv->x_velocity != 0 || priv->y_velocity != 0 || overshoot)
|
|
|
|
|
{
|
|
|
|
|
gtk_scrolled_window_start_deceleration (scrolled_window);
|
|
|
|
|
priv->x_velocity = priv->y_velocity = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:57:41 +00:00
|
|
|
|
static void
|
|
|
|
|
scrolled_window_swipe_cb (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gdouble x_velocity,
|
|
|
|
|
gdouble y_velocity)
|
|
|
|
|
{
|
|
|
|
|
gtk_scrolled_window_decelerate (scrolled_window, -x_velocity, -y_velocity);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 14:48:21 +00:00
|
|
|
|
static void
|
|
|
|
|
scrolled_window_long_press_cb (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gdouble x,
|
|
|
|
|
gdouble y,
|
|
|
|
|
GtkGesture *gesture)
|
|
|
|
|
{
|
|
|
|
|
GdkEventSequence *sequence;
|
|
|
|
|
|
2014-04-08 19:05:00 +00:00
|
|
|
|
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
|
|
|
|
gtk_gesture_set_sequence_state (gesture, sequence,
|
|
|
|
|
GTK_EVENT_SEQUENCE_DENIED);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-03 20:40:19 +00:00
|
|
|
|
static void
|
|
|
|
|
scrolled_window_long_press_cancelled_cb (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkGesture *gesture)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GdkEventSequence *sequence;
|
|
|
|
|
const GdkEvent *event;
|
|
|
|
|
|
|
|
|
|
sequence = gtk_gesture_get_last_updated_sequence (gesture);
|
|
|
|
|
event = gtk_gesture_get_last_event (gesture, sequence);
|
|
|
|
|
|
2014-04-08 19:05:00 +00:00
|
|
|
|
if (event->type == GDK_TOUCH_BEGIN ||
|
|
|
|
|
event->type == GDK_BUTTON_PRESS)
|
|
|
|
|
gtk_gesture_set_sequence_state (gesture, sequence,
|
|
|
|
|
GTK_EVENT_SEQUENCE_DENIED);
|
2014-03-26 13:06:09 +00:00
|
|
|
|
else if (event->type != GDK_TOUCH_END &&
|
|
|
|
|
event->type != GDK_BUTTON_RELEASE)
|
2014-03-03 20:40:19 +00:00
|
|
|
|
priv->in_drag = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-16 16:35:45 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_check_attach_pan_gesture (GtkScrolledWindow *sw)
|
|
|
|
|
{
|
2014-05-26 12:02:30 +00:00
|
|
|
|
GtkPropagationPhase phase = GTK_PHASE_NONE;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = sw->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->kinetic_scrolling &&
|
2014-10-05 03:15:04 +00:00
|
|
|
|
((may_hscroll (sw) && !may_vscroll (sw)) ||
|
|
|
|
|
(!may_hscroll (sw) && may_vscroll (sw))))
|
2014-05-16 16:35:45 +00:00
|
|
|
|
{
|
2014-05-26 09:58:18 +00:00
|
|
|
|
GtkOrientation orientation;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (may_hscroll (sw))
|
2014-05-26 10:38:06 +00:00
|
|
|
|
orientation = GTK_ORIENTATION_HORIZONTAL;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
else
|
2014-05-26 10:38:06 +00:00
|
|
|
|
orientation = GTK_ORIENTATION_VERTICAL;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
|
|
|
|
|
gtk_gesture_pan_set_orientation (GTK_GESTURE_PAN (priv->pan_gesture),
|
|
|
|
|
orientation);
|
2014-05-26 12:02:30 +00:00
|
|
|
|
phase = GTK_PHASE_CAPTURE;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
}
|
2014-05-26 12:02:30 +00:00
|
|
|
|
|
|
|
|
|
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->pan_gesture), phase);
|
2014-05-16 16:35:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
static void
|
|
|
|
|
indicator_set_over (Indicator *indicator,
|
|
|
|
|
gboolean over)
|
|
|
|
|
{
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
|
2014-12-01 13:25:23 +00:00
|
|
|
|
if (indicator->over_timeout_id)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->over_timeout_id);
|
|
|
|
|
indicator->over_timeout_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
if (indicator->over == over)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (indicator->scrollbar);
|
|
|
|
|
indicator->over = over;
|
|
|
|
|
|
|
|
|
|
if (indicator->over)
|
|
|
|
|
gtk_style_context_add_class (context, "hovering");
|
|
|
|
|
else
|
|
|
|
|
gtk_style_context_remove_class (context, "hovering");
|
|
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (indicator->scrollbar);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-07 01:27:17 +00:00
|
|
|
|
static void
|
|
|
|
|
translate_to_widget (GtkWidget *widget,
|
|
|
|
|
GdkEvent *event,
|
|
|
|
|
gint *x,
|
|
|
|
|
gint *y)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *event_widget;
|
|
|
|
|
GdkWindow *event_widget_window;
|
|
|
|
|
GdkWindow *window;
|
|
|
|
|
gdouble event_x, event_y;
|
|
|
|
|
gint wx, wy;
|
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
|
|
|
|
event_widget = gtk_get_event_widget (event);
|
|
|
|
|
event_widget_window = gtk_widget_get_window (event_widget);
|
|
|
|
|
gdk_event_get_coords (event, &event_x, &event_y);
|
|
|
|
|
window = event->any.window;
|
|
|
|
|
while (window && window != event_widget_window)
|
|
|
|
|
{
|
|
|
|
|
gdk_window_get_position (window, &wx, &wy);
|
|
|
|
|
event_x += wx;
|
|
|
|
|
event_y += wy;
|
2016-10-25 07:54:37 +00:00
|
|
|
|
window = gdk_window_get_parent (window);
|
2015-04-07 01:27:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!gtk_widget_get_has_window (event_widget))
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_get_allocation (event_widget, &allocation);
|
|
|
|
|
event_x -= allocation.x;
|
|
|
|
|
event_y -= allocation.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_widget_translate_coordinates (event_widget, widget,
|
|
|
|
|
(gint)event_x, (gint)event_y,
|
|
|
|
|
x, y);
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
event_close_to_indicator (GtkScrolledWindow *sw,
|
|
|
|
|
Indicator *indicator,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
2014-12-01 12:59:22 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
2015-04-07 01:27:17 +00:00
|
|
|
|
GtkAllocation indicator_alloc;
|
|
|
|
|
gint x, y;
|
2015-01-18 19:28:47 +00:00
|
|
|
|
gint distance;
|
2015-04-07 01:27:17 +00:00
|
|
|
|
gint win_x, win_y;
|
2014-11-29 15:53:05 +00:00
|
|
|
|
|
2014-12-01 12:59:22 +00:00
|
|
|
|
priv = sw->priv;
|
2014-11-29 15:53:05 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (indicator->scrollbar, &indicator_alloc);
|
|
|
|
|
gdk_window_get_position (indicator->window, &win_x, &win_y);
|
2015-04-07 01:27:17 +00:00
|
|
|
|
translate_to_widget (GTK_WIDGET (sw), event, &x, &y);
|
2014-11-29 15:53:05 +00:00
|
|
|
|
|
2015-01-18 19:28:47 +00:00
|
|
|
|
if (indicator->over)
|
|
|
|
|
distance = INDICATOR_FAR_DISTANCE;
|
|
|
|
|
else
|
|
|
|
|
distance = INDICATOR_CLOSE_DISTANCE;
|
|
|
|
|
|
2015-04-07 01:27:17 +00:00
|
|
|
|
if (indicator == &priv->hindicator)
|
|
|
|
|
{
|
|
|
|
|
if (y >= win_y - distance &&
|
|
|
|
|
y < win_y + indicator_alloc.height + distance)
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
else if (indicator == &priv->vindicator)
|
|
|
|
|
{
|
|
|
|
|
if (x >= win_x - distance &&
|
|
|
|
|
x < win_x + indicator_alloc.width + distance)
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2014-11-29 15:53:05 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 13:25:23 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
enable_over_timeout_cb (gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
Indicator *indicator = user_data;
|
|
|
|
|
|
|
|
|
|
indicator_set_over (indicator, TRUE);
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
check_update_scrollbar_proximity (GtkScrolledWindow *sw,
|
|
|
|
|
Indicator *indicator,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
2016-03-14 17:47:37 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = sw->priv;
|
|
|
|
|
gboolean indicator_close, on_scrollbar, on_other_scrollbar;
|
2015-09-15 15:18:20 +00:00
|
|
|
|
GtkWidget *event_widget;
|
|
|
|
|
|
|
|
|
|
event_widget = gtk_get_event_widget (event);
|
2014-12-01 13:25:23 +00:00
|
|
|
|
|
|
|
|
|
indicator_close = event_close_to_indicator (sw, indicator, event);
|
2015-09-15 15:18:20 +00:00
|
|
|
|
on_scrollbar = (event_widget == indicator->scrollbar &&
|
|
|
|
|
event->type != GDK_LEAVE_NOTIFY);
|
2016-03-14 17:47:37 +00:00
|
|
|
|
on_other_scrollbar = (!on_scrollbar &&
|
|
|
|
|
event->type != GDK_LEAVE_NOTIFY &&
|
|
|
|
|
(event_widget == priv->hindicator.scrollbar ||
|
|
|
|
|
event_widget == priv->vindicator.scrollbar));
|
2014-12-01 13:25:23 +00:00
|
|
|
|
|
|
|
|
|
if (indicator->over_timeout_id)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->over_timeout_id);
|
|
|
|
|
indicator->over_timeout_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-15 15:18:20 +00:00
|
|
|
|
if (on_scrollbar)
|
|
|
|
|
indicator_set_over (indicator, TRUE);
|
2016-03-14 17:47:37 +00:00
|
|
|
|
else if (indicator_close && !on_other_scrollbar)
|
2014-12-01 13:25:23 +00:00
|
|
|
|
indicator->over_timeout_id = gdk_threads_add_timeout (30, enable_over_timeout_cb, indicator);
|
|
|
|
|
else
|
|
|
|
|
indicator_set_over (indicator, FALSE);
|
|
|
|
|
|
|
|
|
|
return indicator_close;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:51:11 +00:00
|
|
|
|
static gdouble
|
|
|
|
|
get_scroll_unit (GtkScrolledWindow *sw,
|
|
|
|
|
GtkOrientation orientation)
|
|
|
|
|
{
|
|
|
|
|
gdouble scroll_unit;
|
|
|
|
|
|
|
|
|
|
#ifndef GDK_WINDOWING_QUARTZ
|
|
|
|
|
GtkScrolledWindowPrivate *priv = sw->priv;
|
|
|
|
|
GtkRange *scrollbar;
|
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
|
gdouble page_size;
|
|
|
|
|
|
|
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
|
scrollbar = GTK_RANGE (priv->hscrollbar);
|
|
|
|
|
else
|
|
|
|
|
scrollbar = GTK_RANGE (priv->vscrollbar);
|
|
|
|
|
|
|
|
|
|
if (!scrollbar)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
adj = gtk_range_get_adjustment (scrollbar);
|
|
|
|
|
page_size = gtk_adjustment_get_page_size (adj);
|
|
|
|
|
scroll_unit = pow (page_size, 2.0 / 3.0);
|
|
|
|
|
#else
|
|
|
|
|
scroll_unit = 1;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return scroll_unit;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-23 13:57:41 +00:00
|
|
|
|
static void
|
|
|
|
|
scroll_history_push (GtkScrolledWindow *sw,
|
|
|
|
|
GdkEventScroll *event)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = sw->priv;
|
|
|
|
|
ScrollHistoryElem new_item;
|
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
if (event->direction != GDK_SCROLL_SMOOTH)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < priv->scroll_history->len; i++)
|
|
|
|
|
{
|
|
|
|
|
ScrollHistoryElem *elem;
|
|
|
|
|
|
|
|
|
|
elem = &g_array_index (priv->scroll_history, ScrollHistoryElem, i);
|
|
|
|
|
|
|
|
|
|
if (elem->evtime >= event->time - SCROLL_CAPTURE_THRESHOLD_MS)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i > 0)
|
|
|
|
|
g_array_remove_range (priv->scroll_history, 0, i);
|
|
|
|
|
|
|
|
|
|
new_item.dx = event->delta_x;
|
|
|
|
|
new_item.dy = event->delta_y;
|
|
|
|
|
new_item.evtime = event->time;
|
|
|
|
|
g_array_append_val (priv->scroll_history, new_item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
scroll_history_reset (GtkScrolledWindow *sw)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = sw->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->scroll_history->len == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_array_remove_range (priv->scroll_history, 0,
|
|
|
|
|
priv->scroll_history->len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
scroll_history_finish (GtkScrolledWindow *sw,
|
|
|
|
|
gdouble *velocity_x,
|
|
|
|
|
gdouble *velocity_y)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = sw->priv;
|
|
|
|
|
gdouble accum_dx = 0, accum_dy = 0;
|
|
|
|
|
guint32 first = 0, last = 0;
|
|
|
|
|
gdouble xunit, yunit;
|
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
if (priv->scroll_history->len == 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < priv->scroll_history->len; i++)
|
|
|
|
|
{
|
|
|
|
|
ScrollHistoryElem *elem;
|
|
|
|
|
|
|
|
|
|
elem = &g_array_index (priv->scroll_history, ScrollHistoryElem, i);
|
|
|
|
|
accum_dx += elem->dx;
|
|
|
|
|
accum_dy += elem->dy;
|
|
|
|
|
last = elem->evtime;
|
|
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
|
first = elem->evtime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (last == first)
|
2016-07-27 18:23:35 +00:00
|
|
|
|
{
|
|
|
|
|
scroll_history_reset (sw);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2015-05-23 13:57:41 +00:00
|
|
|
|
|
|
|
|
|
xunit = get_scroll_unit (sw, GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
yunit = get_scroll_unit (sw, GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
*velocity_x = (accum_dx * 1000 * xunit) / (last - first);
|
|
|
|
|
*velocity_y = (accum_dy * 1000 * yunit) / (last - first);
|
|
|
|
|
scroll_history_reset (sw);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
captured_event_cb (GtkWidget *widget,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkScrolledWindow *sw;
|
|
|
|
|
GdkInputSource input_source;
|
|
|
|
|
GdkDevice *source_device;
|
2015-03-31 11:01:34 +00:00
|
|
|
|
GtkWidget *event_widget;
|
|
|
|
|
gboolean on_scrollbar;
|
2014-11-29 15:53:05 +00:00
|
|
|
|
|
2015-01-09 11:45:51 +00:00
|
|
|
|
sw = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
priv = sw->priv;
|
2015-05-23 13:57:41 +00:00
|
|
|
|
source_device = gdk_event_get_source_device (event);
|
2015-01-09 11:45:51 +00:00
|
|
|
|
|
2015-03-02 16:01:21 +00:00
|
|
|
|
if (event->type == GDK_SCROLL)
|
|
|
|
|
{
|
|
|
|
|
gtk_scrolled_window_cancel_deceleration (sw);
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-10 01:33:39 +00:00
|
|
|
|
if (!priv->use_indicators)
|
2015-01-09 11:45:51 +00:00
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
if (event->type != GDK_MOTION_NOTIFY &&
|
|
|
|
|
event->type != GDK_LEAVE_NOTIFY)
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
|
|
|
|
|
input_source = gdk_device_get_source (source_device);
|
|
|
|
|
|
2015-04-13 13:29:57 +00:00
|
|
|
|
if (input_source == GDK_SOURCE_KEYBOARD ||
|
|
|
|
|
input_source == GDK_SOURCE_TOUCHSCREEN)
|
2014-11-29 15:53:05 +00:00
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
|
2015-03-31 11:01:34 +00:00
|
|
|
|
event_widget = gtk_get_event_widget (event);
|
|
|
|
|
on_scrollbar = (event_widget == priv->hindicator.scrollbar ||
|
|
|
|
|
event_widget == priv->vindicator.scrollbar);
|
|
|
|
|
|
2015-04-06 13:16:03 +00:00
|
|
|
|
if (event->type == GDK_MOTION_NOTIFY)
|
2014-11-29 15:53:05 +00:00
|
|
|
|
{
|
2015-02-24 13:52:40 +00:00
|
|
|
|
if (priv->hscrollbar_visible)
|
|
|
|
|
indicator_start_fade (&priv->hindicator, 1.0);
|
|
|
|
|
if (priv->vscrollbar_visible)
|
|
|
|
|
indicator_start_fade (&priv->vindicator, 1.0);
|
2014-11-29 15:53:05 +00:00
|
|
|
|
|
2015-04-06 13:16:03 +00:00
|
|
|
|
if (!on_scrollbar &&
|
|
|
|
|
(event->motion.state &
|
|
|
|
|
(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) != 0)
|
2015-02-05 16:16:21 +00:00
|
|
|
|
{
|
|
|
|
|
indicator_set_over (&priv->hindicator, FALSE);
|
|
|
|
|
indicator_set_over (&priv->vindicator, FALSE);
|
|
|
|
|
}
|
2015-04-13 13:29:57 +00:00
|
|
|
|
else if (input_source == GDK_SOURCE_PEN ||
|
|
|
|
|
input_source == GDK_SOURCE_ERASER ||
|
2016-06-01 11:01:37 +00:00
|
|
|
|
input_source == GDK_SOURCE_TRACKPOINT)
|
2014-12-01 13:25:23 +00:00
|
|
|
|
{
|
2015-01-10 02:09:22 +00:00
|
|
|
|
indicator_set_over (&priv->hindicator, TRUE);
|
|
|
|
|
indicator_set_over (&priv->vindicator, TRUE);
|
2014-12-01 13:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2015-01-10 02:09:22 +00:00
|
|
|
|
{
|
|
|
|
|
if (!check_update_scrollbar_proximity (sw, &priv->vindicator, event))
|
|
|
|
|
check_update_scrollbar_proximity (sw, &priv->hindicator, event);
|
|
|
|
|
else
|
|
|
|
|
indicator_set_over (&priv->hindicator, FALSE);
|
|
|
|
|
}
|
2014-11-29 15:53:05 +00:00
|
|
|
|
}
|
2015-03-31 11:01:34 +00:00
|
|
|
|
else if (event->type == GDK_LEAVE_NOTIFY && on_scrollbar &&
|
2014-11-29 15:53:05 +00:00
|
|
|
|
event->crossing.mode == GDK_CROSSING_UNGRAB)
|
|
|
|
|
{
|
2016-03-14 18:13:05 +00:00
|
|
|
|
check_update_scrollbar_proximity (sw, &priv->vindicator, event);
|
|
|
|
|
check_update_scrollbar_proximity (sw, &priv->hindicator, event);
|
2014-11-29 15:53:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_allocate (GtkCssGadget *gadget,
|
|
|
|
|
const GtkAllocation *allocation,
|
|
|
|
|
int baseline,
|
|
|
|
|
GtkAllocation *out_clip,
|
|
|
|
|
gpointer data)
|
1998-03-18 21:11:04 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
1998-11-28 07:42:37 +00:00
|
|
|
|
GtkBin *bin;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
GtkAllocation relative_allocation;
|
|
|
|
|
GtkAllocation child_allocation;
|
2016-12-13 15:39:38 +00:00
|
|
|
|
GtkAllocation sw_allocation;
|
2010-05-24 20:31:36 +00:00
|
|
|
|
GtkWidget *child;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gint sb_width;
|
|
|
|
|
gint sb_height;
|
1998-07-16 02:47:15 +00:00
|
|
|
|
|
1998-11-28 07:42:37 +00:00
|
|
|
|
bin = GTK_BIN (scrolled_window);
|
2016-12-13 15:39:38 +00:00
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (scrolled_window), &sw_allocation);
|
|
|
|
|
|
1998-03-18 21:11:04 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
/* Get possible scrollbar dimensions */
|
2016-12-01 18:44:02 +00:00
|
|
|
|
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
|
|
|
&sb_width, NULL, NULL, NULL);
|
|
|
|
|
gtk_widget_measure (priv->hscrollbar, GTK_ORIENTATION_VERTICAL, -1,
|
|
|
|
|
&sb_height, NULL, NULL, NULL);
|
2010-10-18 04:21:39 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->hscrollbar_policy == GTK_POLICY_ALWAYS)
|
|
|
|
|
priv->hscrollbar_visible = TRUE;
|
|
|
|
|
else if (priv->hscrollbar_policy == GTK_POLICY_NEVER ||
|
|
|
|
|
priv->hscrollbar_policy == GTK_POLICY_EXTERNAL)
|
|
|
|
|
priv->hscrollbar_visible = FALSE;
|
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
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
|
|
|
|
|
priv->vscrollbar_visible = TRUE;
|
|
|
|
|
else if (priv->vscrollbar_policy == GTK_POLICY_NEVER ||
|
|
|
|
|
priv->vscrollbar_policy == GTK_POLICY_EXTERNAL)
|
|
|
|
|
priv->vscrollbar_visible = FALSE;
|
2010-05-24 20:31:36 +00:00
|
|
|
|
|
|
|
|
|
child = gtk_bin_get_child (bin);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (child && gtk_widget_get_visible (child))
|
|
|
|
|
{
|
|
|
|
|
gint child_scroll_width;
|
|
|
|
|
gint child_scroll_height;
|
|
|
|
|
GtkScrollablePolicy hscroll_policy;
|
|
|
|
|
GtkScrollablePolicy vscroll_policy;
|
|
|
|
|
gboolean previous_hvis;
|
|
|
|
|
gboolean previous_vvis;
|
|
|
|
|
guint count = 0;
|
2001-07-19 19:49:01 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
hscroll_policy = GTK_IS_SCROLLABLE (child)
|
|
|
|
|
? gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (child))
|
|
|
|
|
: GTK_SCROLL_MINIMUM;
|
|
|
|
|
vscroll_policy = GTK_IS_SCROLLABLE (child)
|
|
|
|
|
? gtk_scrollable_get_vscroll_policy (GTK_SCROLLABLE (child))
|
|
|
|
|
: GTK_SCROLL_MINIMUM;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
/* Determine scrollbar visibility first via hfw apis */
|
|
|
|
|
if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
|
|
|
|
{
|
2016-12-01 18:44:02 +00:00
|
|
|
|
if (hscroll_policy == GTK_SCROLL_MINIMUM)
|
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
|
|
|
&child_scroll_width, NULL, NULL, NULL);
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
|
|
|
NULL, &child_scroll_width, NULL, NULL);
|
1998-11-28 07:42:37 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
|
|
|
|
{
|
|
|
|
|
/* First try without a vertical scrollbar if the content will fit the height
|
|
|
|
|
* given the extra width of the scrollbar */
|
|
|
|
|
if (vscroll_policy == GTK_SCROLL_MINIMUM)
|
2016-12-01 18:44:02 +00:00
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
MAX (allocation->width, child_scroll_width),
|
|
|
|
|
&child_scroll_height, NULL, NULL, NULL);
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
MAX (allocation->width, child_scroll_width),
|
|
|
|
|
NULL, &child_scroll_height, NULL, NULL);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
|
|
|
|
{
|
|
|
|
|
/* Does the content height fit the allocation height ? */
|
|
|
|
|
priv->vscrollbar_visible = child_scroll_height > allocation->height;
|
|
|
|
|
|
|
|
|
|
/* Does the content width fit the allocation with minus a possible scrollbar ? */
|
|
|
|
|
priv->hscrollbar_visible =
|
|
|
|
|
child_scroll_width > allocation->width -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
/* Now that we've guessed the hscrollbar, does the content height fit
|
|
|
|
|
* the possible new allocation height ?
|
|
|
|
|
*/
|
|
|
|
|
priv->vscrollbar_visible =
|
|
|
|
|
child_scroll_height > allocation->height -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
/* Now that we've guessed the vscrollbar, does the content width fit
|
|
|
|
|
* the possible new allocation width ?
|
|
|
|
|
*/
|
|
|
|
|
priv->hscrollbar_visible =
|
|
|
|
|
child_scroll_width > allocation->width -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
else /* priv->hscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
|
|
|
|
{
|
|
|
|
|
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
|
|
|
|
priv->vscrollbar_visible = child_scroll_height > allocation->height -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else /* priv->vscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
|
|
|
|
{
|
|
|
|
|
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
|
|
|
|
|
|
|
|
|
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
|
|
|
|
priv->hscrollbar_visible =
|
|
|
|
|
child_scroll_width > allocation->width -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->vscrollbar_visible && !priv->use_indicators ? 0 : sb_width);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
else
|
|
|
|
|
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
|
|
|
|
|
{
|
2016-12-01 18:44:02 +00:00
|
|
|
|
if (vscroll_policy == GTK_SCROLL_MINIMUM)
|
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL, -1,
|
|
|
|
|
&child_scroll_height, NULL, NULL, NULL);
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL, -1,
|
|
|
|
|
NULL, &child_scroll_height, NULL, NULL);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
|
|
|
|
{
|
|
|
|
|
/* First try without a horizontal scrollbar if the content will fit the width
|
|
|
|
|
* given the extra height of the scrollbar */
|
|
|
|
|
if (hscroll_policy == GTK_SCROLL_MINIMUM)
|
2016-12-01 18:44:02 +00:00
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
|
MAX (allocation->height, child_scroll_height),
|
|
|
|
|
&child_scroll_width, NULL, NULL, NULL);
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
|
MAX (allocation->height, child_scroll_height),
|
|
|
|
|
NULL, &child_scroll_width, NULL, NULL);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
|
|
|
|
{
|
|
|
|
|
/* Does the content width fit the allocation width ? */
|
|
|
|
|
priv->hscrollbar_visible = child_scroll_width > allocation->width;
|
|
|
|
|
|
|
|
|
|
/* Does the content height fit the allocation with minus a possible scrollbar ? */
|
|
|
|
|
priv->vscrollbar_visible =
|
|
|
|
|
child_scroll_height > allocation->height -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
/* Now that we've guessed the vscrollbar, does the content width fit
|
|
|
|
|
* the possible new allocation width ?
|
|
|
|
|
*/
|
|
|
|
|
priv->hscrollbar_visible =
|
|
|
|
|
child_scroll_width > allocation->width -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
/* Now that we've guessed the hscrollbar, does the content height fit
|
|
|
|
|
* the possible new allocation height ?
|
|
|
|
|
*/
|
|
|
|
|
priv->vscrollbar_visible =
|
|
|
|
|
child_scroll_height > allocation->height -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
else /* priv->vscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
|
|
|
|
{
|
|
|
|
|
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
|
|
|
|
priv->hscrollbar_visible = child_scroll_width > allocation->width -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->vscrollbar_visible && !priv->use_indicators ? sb_width : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else /* priv->hscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
|
|
|
|
{
|
|
|
|
|
priv->hscrollbar_visible = policy_may_be_visible (priv->hscrollbar_policy);
|
|
|
|
|
|
|
|
|
|
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
|
|
|
|
priv->vscrollbar_visible =
|
|
|
|
|
child_scroll_height > allocation->height -
|
2016-10-04 14:35:24 +00:00
|
|
|
|
(priv->hscrollbar_visible && !priv->use_indicators ? sb_height : 0);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
else
|
|
|
|
|
priv->vscrollbar_visible = policy_may_be_visible (priv->vscrollbar_policy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now after guessing scrollbar visibility; fall back on the allocation loop which
|
|
|
|
|
* observes the adjustments to detect scrollbar visibility and also avoids
|
|
|
|
|
* infinite recursion
|
|
|
|
|
*/
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
previous_hvis = priv->hscrollbar_visible;
|
|
|
|
|
previous_vvis = priv->vscrollbar_visible;
|
|
|
|
|
gtk_scrolled_window_allocate_child (scrolled_window, &relative_allocation);
|
|
|
|
|
|
|
|
|
|
/* Explicitly force scrollbar visibility checks.
|
|
|
|
|
*
|
|
|
|
|
* Since we make a guess above, the child might not decide to update the adjustments
|
|
|
|
|
* if they logically did not change since the last configuration
|
|
|
|
|
*/
|
|
|
|
|
if (priv->hscrollbar)
|
|
|
|
|
gtk_scrolled_window_adjustment_changed
|
|
|
|
|
(gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)), scrolled_window);
|
|
|
|
|
|
|
|
|
|
if (priv->vscrollbar)
|
|
|
|
|
gtk_scrolled_window_adjustment_changed
|
|
|
|
|
(gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)), scrolled_window);
|
|
|
|
|
|
|
|
|
|
/* If, after the first iteration, the hscrollbar and the
|
|
|
|
|
* vscrollbar flip visiblity... or if one of the scrollbars flip
|
|
|
|
|
* on each itteration indefinitly/infinitely, then we just need both
|
|
|
|
|
* at this size.
|
|
|
|
|
*/
|
|
|
|
|
if ((count &&
|
|
|
|
|
previous_hvis != priv->hscrollbar_visible &&
|
|
|
|
|
previous_vvis != priv->vscrollbar_visible) || count > 3)
|
|
|
|
|
{
|
|
|
|
|
priv->hscrollbar_visible = TRUE;
|
|
|
|
|
priv->vscrollbar_visible = TRUE;
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_allocate_child (scrolled_window, &relative_allocation);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
while (previous_hvis != priv->hscrollbar_visible ||
|
|
|
|
|
previous_vvis != priv->vscrollbar_visible);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priv->hscrollbar_visible = priv->hscrollbar_policy == GTK_POLICY_ALWAYS;
|
|
|
|
|
priv->vscrollbar_visible = priv->vscrollbar_policy == GTK_POLICY_ALWAYS;
|
|
|
|
|
gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_child_visible (priv->hscrollbar, priv->hscrollbar_visible);
|
|
|
|
|
if (priv->hscrollbar_visible)
|
|
|
|
|
{
|
|
|
|
|
gtk_scrolled_window_allocate_scrollbar (scrolled_window,
|
|
|
|
|
priv->hscrollbar,
|
|
|
|
|
&child_allocation);
|
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
{
|
2016-06-10 12:16:53 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
|
|
|
|
gdk_window_move_resize (priv->hindicator.window,
|
|
|
|
|
child_allocation.x,
|
|
|
|
|
child_allocation.y,
|
|
|
|
|
child_allocation.width,
|
|
|
|
|
child_allocation.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
child_allocation.x = 0;
|
|
|
|
|
child_allocation.y = 0;
|
|
|
|
|
}
|
|
|
|
|
gtk_widget_size_allocate (priv->hscrollbar, &child_allocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_child_visible (priv->vscrollbar, priv->vscrollbar_visible);
|
|
|
|
|
if (priv->vscrollbar_visible)
|
|
|
|
|
{
|
|
|
|
|
gtk_scrolled_window_allocate_scrollbar (scrolled_window,
|
|
|
|
|
priv->vscrollbar,
|
|
|
|
|
&child_allocation);
|
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
{
|
2016-06-10 12:16:53 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
|
|
|
|
gdk_window_move_resize (priv->vindicator.window,
|
|
|
|
|
child_allocation.x,
|
|
|
|
|
child_allocation.y,
|
|
|
|
|
child_allocation.width,
|
|
|
|
|
child_allocation.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
child_allocation.x = 0;
|
|
|
|
|
child_allocation.y = 0;
|
|
|
|
|
}
|
|
|
|
|
gtk_widget_size_allocate (priv->vscrollbar, &child_allocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_check_attach_pan_gesture (scrolled_window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_measure (GtkCssGadget *gadget,
|
|
|
|
|
GtkOrientation orientation,
|
|
|
|
|
int for_size,
|
|
|
|
|
int *minimum_size,
|
|
|
|
|
int *natural_size,
|
|
|
|
|
int *minimum_baseline,
|
|
|
|
|
int *natural_baseline,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkBin *bin = GTK_BIN (scrolled_window);
|
|
|
|
|
GtkRequisition hscrollbar_requisition;
|
|
|
|
|
GtkRequisition vscrollbar_requisition;
|
|
|
|
|
GtkRequisition minimum_req, natural_req;
|
|
|
|
|
GtkWidget *child;
|
|
|
|
|
gint min_child_size, nat_child_size;
|
2016-06-07 05:04:42 +00:00
|
|
|
|
GtkBorder sborder = { 0 };
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
minimum_req.width = 0;
|
|
|
|
|
minimum_req.height = 0;
|
|
|
|
|
natural_req.width = 0;
|
|
|
|
|
natural_req.height = 0;
|
|
|
|
|
|
|
|
|
|
gtk_widget_get_preferred_size (priv->hscrollbar,
|
|
|
|
|
&hscrollbar_requisition, NULL);
|
|
|
|
|
gtk_widget_get_preferred_size (priv->vscrollbar,
|
|
|
|
|
&vscrollbar_requisition, NULL);
|
|
|
|
|
|
|
|
|
|
child = gtk_bin_get_child (bin);
|
2016-03-12 02:40:02 +00:00
|
|
|
|
|
|
|
|
|
if (GTK_IS_SCROLLABLE (child))
|
2016-06-07 05:04:42 +00:00
|
|
|
|
gtk_scrollable_get_border (GTK_SCROLLABLE (child), &sborder);
|
2016-03-12 02:40:02 +00:00
|
|
|
|
|
2016-06-07 05:04:42 +00:00
|
|
|
|
/*
|
|
|
|
|
* First collect the child requisition
|
|
|
|
|
*/
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (child && gtk_widget_get_visible (child))
|
|
|
|
|
{
|
2016-12-01 18:44:02 +00:00
|
|
|
|
gtk_widget_measure (child, orientation, -1,
|
|
|
|
|
&min_child_size, &nat_child_size,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
|
{
|
2016-08-31 04:54:25 +00:00
|
|
|
|
if (priv->propagate_natural_width)
|
|
|
|
|
natural_req.width += nat_child_size;
|
2016-06-07 05:04:42 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->hscrollbar_policy == GTK_POLICY_NEVER)
|
|
|
|
|
{
|
|
|
|
|
minimum_req.width += min_child_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-06-07 05:04:42 +00:00
|
|
|
|
gint min = priv->min_content_width >= 0 ? priv->min_content_width : 0;
|
|
|
|
|
gint max = priv->max_content_width >= 0 ? priv->max_content_width : G_MAXINT;
|
2016-06-05 23:36:09 +00:00
|
|
|
|
|
2016-06-07 05:04:42 +00:00
|
|
|
|
minimum_req.width = CLAMP (minimum_req.width, min, max);
|
|
|
|
|
natural_req.width = CLAMP (natural_req.width, min, max);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else /* GTK_ORIENTATION_VERTICAL */
|
|
|
|
|
{
|
2016-08-31 04:54:25 +00:00
|
|
|
|
if (priv->propagate_natural_height)
|
|
|
|
|
natural_req.height += nat_child_size;
|
2016-06-07 05:04:42 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->vscrollbar_policy == GTK_POLICY_NEVER)
|
|
|
|
|
{
|
|
|
|
|
minimum_req.height += min_child_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-06-07 05:04:42 +00:00
|
|
|
|
gint min = priv->min_content_height >= 0 ? priv->min_content_height : 0;
|
|
|
|
|
gint max = priv->max_content_height >= 0 ? priv->max_content_height : G_MAXINT;
|
2016-06-05 23:36:09 +00:00
|
|
|
|
|
2016-06-07 05:04:42 +00:00
|
|
|
|
minimum_req.height = CLAMP (minimum_req.height, min, max);
|
|
|
|
|
natural_req.height = CLAMP (natural_req.height, min, max);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-31 04:54:25 +00:00
|
|
|
|
/* Ensure we make requests with natural size >= minimum size */
|
|
|
|
|
natural_req.height = MAX (minimum_req.height, natural_req.height);
|
|
|
|
|
natural_req.width = MAX (minimum_req.width, natural_req.width);
|
|
|
|
|
|
2016-06-07 05:04:42 +00:00
|
|
|
|
/*
|
|
|
|
|
* Now add to the requisition any additional space for surrounding scrollbars
|
|
|
|
|
* and the special scrollable border.
|
|
|
|
|
*/
|
2016-03-12 02:40:02 +00:00
|
|
|
|
if (policy_may_be_visible (priv->hscrollbar_policy))
|
2015-12-23 17:54:42 +00:00
|
|
|
|
{
|
2016-06-07 05:04:42 +00:00
|
|
|
|
minimum_req.width = MAX (minimum_req.width, hscrollbar_requisition.width + sborder.left + sborder.right);
|
|
|
|
|
natural_req.width = MAX (natural_req.width, hscrollbar_requisition.width + sborder.left + sborder.right);
|
|
|
|
|
|
|
|
|
|
if (!priv->use_indicators)
|
|
|
|
|
{
|
2016-10-04 14:35:24 +00:00
|
|
|
|
minimum_req.height += hscrollbar_requisition.height;
|
|
|
|
|
natural_req.height += hscrollbar_requisition.height;
|
2016-06-07 05:04:42 +00:00
|
|
|
|
}
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-12 02:40:02 +00:00
|
|
|
|
if (policy_may_be_visible (priv->vscrollbar_policy))
|
2015-12-23 17:54:42 +00:00
|
|
|
|
{
|
2016-06-07 05:04:42 +00:00
|
|
|
|
minimum_req.height = MAX (minimum_req.height, vscrollbar_requisition.height + sborder.top + sborder.bottom);
|
|
|
|
|
natural_req.height = MAX (natural_req.height, vscrollbar_requisition.height + sborder.top + sborder.bottom);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
2016-06-07 05:04:42 +00:00
|
|
|
|
if (!priv->use_indicators)
|
|
|
|
|
{
|
2016-10-04 14:35:24 +00:00
|
|
|
|
minimum_req.width += vscrollbar_requisition.width;
|
|
|
|
|
natural_req.width += vscrollbar_requisition.width;
|
2016-06-07 05:04:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
|
{
|
|
|
|
|
*minimum_size = minimum_req.width;
|
|
|
|
|
*natural_size = natural_req.width;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*minimum_size = minimum_req.height;
|
|
|
|
|
*natural_size = natural_req.height;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_scrolled_window_snapshot_scrollbars_junction (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkSnapshot *snapshot)
|
2015-12-23 17:54:42 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
2016-12-13 15:39:38 +00:00
|
|
|
|
GtkAllocation hscr_allocation, vscr_allocation;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GdkRectangle junction_rect;
|
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (priv->hscrollbar), &hscr_allocation);
|
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (priv->vscrollbar), &vscr_allocation);
|
|
|
|
|
|
2016-12-13 15:39:38 +00:00
|
|
|
|
junction_rect.x = vscr_allocation.x;
|
|
|
|
|
junction_rect.y = hscr_allocation.y;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
junction_rect.width = vscr_allocation.width;
|
|
|
|
|
junction_rect.height = hscr_allocation.height;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
gtk_style_context_save_named (context, "junction");
|
|
|
|
|
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context,
|
|
|
|
|
junction_rect.x, junction_rect.y,
|
|
|
|
|
junction_rect.width, junction_rect.height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context,
|
|
|
|
|
junction_rect.x, junction_rect.y,
|
|
|
|
|
junction_rect.width, junction_rect.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_scrolled_window_snapshot_overshoot (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkSnapshot *snapshot)
|
2015-12-23 17:54:42 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
|
|
|
|
gint overshoot_x, overshoot_y;
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
|
|
|
|
if (!_gtk_scrolled_window_get_overshoot (scrolled_window, &overshoot_x, &overshoot_y))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
gtk_scrolled_window_inner_allocation (widget, &rect);
|
|
|
|
|
|
|
|
|
|
overshoot_x = CLAMP (overshoot_x, - MAX_OVERSHOOT_DISTANCE, MAX_OVERSHOOT_DISTANCE);
|
|
|
|
|
overshoot_y = CLAMP (overshoot_y, - MAX_OVERSHOOT_DISTANCE, MAX_OVERSHOOT_DISTANCE);
|
|
|
|
|
|
|
|
|
|
if (overshoot_x > 0)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_RIGHT]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x + rect.width - overshoot_x, rect.y, overshoot_x, rect.height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x + rect.width - overshoot_x, rect.y, overshoot_x, rect.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
else if (overshoot_x < 0)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_LEFT]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, -overshoot_x, rect.height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, -overshoot_x, rect.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (overshoot_y > 0)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_BOTTOM]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y + rect.height - overshoot_y, rect.width, overshoot_y);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y + rect.height - overshoot_y, rect.width, overshoot_y);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
else if (overshoot_y < 0)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_TOP]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, rect.width, -overshoot_y);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, rect.width, -overshoot_y);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_scrolled_window_snapshot_undershoot (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkSnapshot *snapshot)
|
2015-12-23 17:54:42 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
gtk_scrolled_window_inner_allocation (widget, &rect);
|
|
|
|
|
|
|
|
|
|
adj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
if (gtk_adjustment_get_value (adj) < gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj))
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_RIGHT]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x + rect.width - UNDERSHOOT_SIZE, rect.y, UNDERSHOOT_SIZE, rect.height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x + rect.width - UNDERSHOOT_SIZE, rect.y, UNDERSHOOT_SIZE, rect.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
if (gtk_adjustment_get_value (adj) > gtk_adjustment_get_lower (adj))
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_LEFT]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, UNDERSHOOT_SIZE, rect.height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, UNDERSHOOT_SIZE, rect.height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
adj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
|
|
|
|
if (gtk_adjustment_get_value (adj) < gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj))
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_BOTTOM]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y + rect.height - UNDERSHOOT_SIZE, rect.width, UNDERSHOOT_SIZE);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y + rect.height - UNDERSHOOT_SIZE, rect.width, UNDERSHOOT_SIZE);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
if (gtk_adjustment_get_value (adj) > gtk_adjustment_get_lower (adj))
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_TOP]);
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, rect.width, UNDERSHOOT_SIZE);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, rect.width, UNDERSHOOT_SIZE);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_scrolled_window_render (GtkCssGadget *gadget,
|
2016-12-13 14:14:49 +00:00
|
|
|
|
GtkSnapshot *snapshot,
|
2015-12-23 17:54:42 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
2016-11-22 18:31:03 +00:00
|
|
|
|
if (priv->hscrollbar_visible &&
|
|
|
|
|
priv->vscrollbar_visible)
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_scrolled_window_snapshot_scrollbars_junction (scrolled_window, snapshot);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
2016-12-13 14:14:49 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->snapshot (widget, snapshot);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_scrolled_window_snapshot_undershoot (scrolled_window, snapshot);
|
|
|
|
|
gtk_scrolled_window_snapshot_overshoot (scrolled_window, snapshot);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkCssNode *widget_node;
|
|
|
|
|
GQuark classes[4] = {
|
|
|
|
|
g_quark_from_static_string (GTK_STYLE_CLASS_LEFT),
|
|
|
|
|
g_quark_from_static_string (GTK_STYLE_CLASS_RIGHT),
|
|
|
|
|
g_quark_from_static_string (GTK_STYLE_CLASS_TOP),
|
|
|
|
|
g_quark_from_static_string (GTK_STYLE_CLASS_BOTTOM),
|
|
|
|
|
};
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
scrolled_window->priv = priv =
|
|
|
|
|
gtk_scrolled_window_get_instance_private (scrolled_window);
|
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
gtk_widget_set_has_window (widget, FALSE);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_widget_set_can_focus (widget, TRUE);
|
|
|
|
|
|
|
|
|
|
/* Instantiated by gtk_scrolled_window_set_[hv]adjustment
|
|
|
|
|
* which are both construct properties
|
|
|
|
|
*/
|
|
|
|
|
priv->hscrollbar = NULL;
|
|
|
|
|
priv->vscrollbar = NULL;
|
|
|
|
|
priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
|
|
|
|
|
priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
|
|
|
|
|
priv->hscrollbar_visible = FALSE;
|
|
|
|
|
priv->vscrollbar_visible = FALSE;
|
|
|
|
|
priv->focus_out = FALSE;
|
2016-06-08 08:30:22 +00:00
|
|
|
|
priv->auto_added_viewport = FALSE;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
priv->window_placement = GTK_CORNER_TOP_LEFT;
|
|
|
|
|
priv->min_content_width = -1;
|
|
|
|
|
priv->min_content_height = -1;
|
2016-06-02 02:18:37 +00:00
|
|
|
|
priv->max_content_width = -1;
|
|
|
|
|
priv->max_content_height = -1;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
priv->overlay_scrolling = TRUE;
|
|
|
|
|
|
|
|
|
|
priv->drag_gesture = gtk_gesture_drag_new (widget);
|
|
|
|
|
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->drag_gesture), TRUE);
|
|
|
|
|
g_signal_connect_swapped (priv->drag_gesture, "drag-begin",
|
|
|
|
|
G_CALLBACK (scrolled_window_drag_begin_cb),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
g_signal_connect_swapped (priv->drag_gesture, "drag-update",
|
|
|
|
|
G_CALLBACK (scrolled_window_drag_update_cb),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
g_signal_connect_swapped (priv->drag_gesture, "end",
|
|
|
|
|
G_CALLBACK (scrolled_window_drag_end_cb),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
|
|
|
|
|
priv->pan_gesture = gtk_gesture_pan_new (widget, GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
gtk_gesture_group (priv->pan_gesture, priv->drag_gesture);
|
|
|
|
|
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->pan_gesture), TRUE);
|
|
|
|
|
|
|
|
|
|
priv->swipe_gesture = gtk_gesture_swipe_new (widget);
|
|
|
|
|
gtk_gesture_group (priv->swipe_gesture, priv->drag_gesture);
|
|
|
|
|
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->swipe_gesture), TRUE);
|
|
|
|
|
g_signal_connect_swapped (priv->swipe_gesture, "swipe",
|
|
|
|
|
G_CALLBACK (scrolled_window_swipe_cb),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
priv->long_press_gesture = gtk_gesture_long_press_new (widget);
|
|
|
|
|
gtk_gesture_group (priv->long_press_gesture, priv->drag_gesture);
|
|
|
|
|
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->long_press_gesture), TRUE);
|
|
|
|
|
g_signal_connect_swapped (priv->long_press_gesture, "pressed",
|
|
|
|
|
G_CALLBACK (scrolled_window_long_press_cb),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
g_signal_connect_swapped (priv->long_press_gesture, "cancelled",
|
|
|
|
|
G_CALLBACK (scrolled_window_long_press_cancelled_cb),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
|
|
|
|
|
priv->scroll_history = g_array_new (FALSE, FALSE, sizeof (ScrollHistoryElem));
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window, TRUE);
|
|
|
|
|
gtk_scrolled_window_set_capture_button_press (scrolled_window, TRUE);
|
|
|
|
|
|
|
|
|
|
_gtk_widget_set_captured_event_handler (widget, captured_event_cb);
|
|
|
|
|
|
|
|
|
|
widget_node = gtk_widget_get_css_node (widget);
|
|
|
|
|
priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node,
|
|
|
|
|
widget,
|
|
|
|
|
gtk_scrolled_window_measure,
|
|
|
|
|
gtk_scrolled_window_allocate,
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_scrolled_window_render,
|
2015-12-23 17:54:42 +00:00
|
|
|
|
NULL, NULL);
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
priv->overshoot_node[i] = gtk_css_node_new ();
|
|
|
|
|
gtk_css_node_set_name (priv->overshoot_node[i], I_("overshoot"));
|
|
|
|
|
gtk_css_node_add_class (priv->overshoot_node[i], classes[i]);
|
|
|
|
|
gtk_css_node_set_parent (priv->overshoot_node[i], widget_node);
|
|
|
|
|
gtk_css_node_set_state (priv->overshoot_node[i], gtk_css_node_get_state (widget_node));
|
|
|
|
|
g_object_unref (priv->overshoot_node[i]);
|
|
|
|
|
|
|
|
|
|
priv->undershoot_node[i] = gtk_css_node_new ();
|
|
|
|
|
gtk_css_node_set_name (priv->undershoot_node[i], I_("undershoot"));
|
|
|
|
|
gtk_css_node_add_class (priv->undershoot_node[i], classes[i]);
|
|
|
|
|
gtk_css_node_set_parent (priv->undershoot_node[i], widget_node);
|
|
|
|
|
gtk_css_node_set_state (priv->undershoot_node[i], gtk_css_node_get_state (widget_node));
|
|
|
|
|
g_object_unref (priv->undershoot_node[i]);
|
|
|
|
|
}
|
2016-06-07 05:09:28 +00:00
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_update_use_indicators (scrolled_window);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_new:
|
|
|
|
|
* @hadjustment: (allow-none): horizontal adjustment
|
|
|
|
|
* @vadjustment: (allow-none): vertical adjustment
|
|
|
|
|
*
|
|
|
|
|
* Creates a new scrolled window.
|
|
|
|
|
*
|
|
|
|
|
* The two arguments are the scrolled window’s adjustments; these will be
|
|
|
|
|
* shared with the scrollbars and the child widget to keep the bars in sync
|
|
|
|
|
* with the child. Usually you want to pass %NULL for the adjustments, which
|
|
|
|
|
* will cause the scrolled window to create them for you.
|
|
|
|
|
*
|
|
|
|
|
* Returns: a new scrolled window
|
|
|
|
|
*/
|
|
|
|
|
GtkWidget*
|
|
|
|
|
gtk_scrolled_window_new (GtkAdjustment *hadjustment,
|
|
|
|
|
GtkAdjustment *vadjustment)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *scrolled_window;
|
|
|
|
|
|
|
|
|
|
if (hadjustment)
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadjustment), NULL);
|
|
|
|
|
|
|
|
|
|
if (vadjustment)
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadjustment), NULL);
|
|
|
|
|
|
|
|
|
|
scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
|
|
|
|
|
"hadjustment", hadjustment,
|
|
|
|
|
"vadjustment", vadjustment,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
return scrolled_window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_hadjustment:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @hadjustment: horizontal scroll adjustment
|
|
|
|
|
*
|
|
|
|
|
* Sets the #GtkAdjustment for the horizontal scrollbar.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkAdjustment *hadjustment)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkBin *bin;
|
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
if (hadjustment)
|
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
|
|
|
|
|
else
|
|
|
|
|
hadjustment = (GtkAdjustment*) g_object_new (GTK_TYPE_ADJUSTMENT, NULL);
|
|
|
|
|
|
|
|
|
|
bin = GTK_BIN (scrolled_window);
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (!priv->hscrollbar)
|
|
|
|
|
{
|
|
|
|
|
priv->hscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_parent (priv->hscrollbar, GTK_WIDGET (scrolled_window));
|
|
|
|
|
g_object_ref (priv->hscrollbar);
|
|
|
|
|
gtk_widget_show (priv->hscrollbar);
|
|
|
|
|
update_scrollbar_positions (scrolled_window);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *old_adjustment;
|
|
|
|
|
|
|
|
|
|
old_adjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
if (old_adjustment == hadjustment)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (old_adjustment,
|
|
|
|
|
gtk_scrolled_window_adjustment_changed,
|
|
|
|
|
scrolled_window);
|
|
|
|
|
gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
|
|
|
|
|
gtk_range_set_adjustment (GTK_RANGE (priv->hscrollbar), hadjustment);
|
|
|
|
|
}
|
|
|
|
|
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
g_signal_connect (hadjustment,
|
|
|
|
|
"changed",
|
|
|
|
|
G_CALLBACK (gtk_scrolled_window_adjustment_changed),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
g_signal_connect (hadjustment,
|
|
|
|
|
"value-changed",
|
|
|
|
|
G_CALLBACK (gtk_scrolled_window_adjustment_value_changed),
|
|
|
|
|
scrolled_window);
|
|
|
|
|
gtk_scrolled_window_adjustment_changed (hadjustment, scrolled_window);
|
|
|
|
|
gtk_scrolled_window_adjustment_value_changed (hadjustment, scrolled_window);
|
|
|
|
|
|
|
|
|
|
child = gtk_bin_get_child (bin);
|
|
|
|
|
if (GTK_IS_SCROLLABLE (child))
|
|
|
|
|
gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (child), hadjustment);
|
|
|
|
|
|
2016-05-01 04:39:34 +00:00
|
|
|
|
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_adjustment_enable_animation (hadjustment, gtk_widget_get_frame_clock (GTK_WIDGET (scrolled_window)), ANIMATION_DURATION);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_HADJUSTMENT]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_vadjustment:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @vadjustment: vertical scroll adjustment
|
|
|
|
|
*
|
|
|
|
|
* Sets the #GtkAdjustment for the vertical scrollbar.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkAdjustment *vadjustment)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkBin *bin;
|
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
if (vadjustment)
|
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (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
|
|
|
|
else
|
2003-02-28 23:48:40 +00:00
|
|
|
|
vadjustment = (GtkAdjustment*) g_object_new (GTK_TYPE_ADJUSTMENT, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
1998-11-28 07:42:37 +00:00
|
|
|
|
bin = GTK_BIN (scrolled_window);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
1998-11-28 07:42:37 +00:00
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
if (!priv->vscrollbar)
|
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
|
|
|
|
{
|
2010-10-30 00:11:05 +00:00
|
|
|
|
priv->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
gtk_widget_set_parent (priv->vscrollbar, GTK_WIDGET (scrolled_window));
|
|
|
|
|
g_object_ref (priv->vscrollbar);
|
|
|
|
|
gtk_widget_show (priv->vscrollbar);
|
2015-11-07 04:28:22 +00:00
|
|
|
|
update_scrollbar_positions (scrolled_window);
|
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
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *old_adjustment;
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
old_adjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
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
|
|
|
|
if (old_adjustment == vadjustment)
|
|
|
|
|
return;
|
|
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (old_adjustment,
|
|
|
|
|
gtk_scrolled_window_adjustment_changed,
|
|
|
|
|
scrolled_window);
|
2014-06-30 22:12:39 +00:00
|
|
|
|
gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
|
|
|
|
|
gtk_range_set_adjustment (GTK_RANGE (priv->vscrollbar), 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
|
|
|
|
}
|
2010-08-30 23:24:30 +00:00
|
|
|
|
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
2002-10-09 00:38:22 +00:00
|
|
|
|
g_signal_connect (vadjustment,
|
2014-06-30 22:12:39 +00:00
|
|
|
|
"changed",
|
2002-10-09 00:38:22 +00:00
|
|
|
|
G_CALLBACK (gtk_scrolled_window_adjustment_changed),
|
|
|
|
|
scrolled_window);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
g_signal_connect (vadjustment,
|
2014-06-30 22:12:39 +00:00
|
|
|
|
"value-changed",
|
2011-02-11 12:43:56 +00:00
|
|
|
|
G_CALLBACK (gtk_scrolled_window_adjustment_value_changed),
|
|
|
|
|
scrolled_window);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
gtk_scrolled_window_adjustment_changed (vadjustment, scrolled_window);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
gtk_scrolled_window_adjustment_value_changed (vadjustment, scrolled_window);
|
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
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
|
child = gtk_bin_get_child (bin);
|
2010-10-18 04:21:39 +00:00
|
|
|
|
if (GTK_IS_SCROLLABLE (child))
|
|
|
|
|
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (child), vadjustment);
|
2001-07-19 19:49:01 +00:00
|
|
|
|
|
2016-05-01 04:39:34 +00:00
|
|
|
|
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
|
2014-06-30 22:12:39 +00:00
|
|
|
|
gtk_adjustment_enable_animation (vadjustment, gtk_widget_get_frame_clock (GTK_WIDGET (scrolled_window)), ANIMATION_DURATION);
|
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_VADJUSTMENT]);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-29 05:16:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_hadjustment:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* Returns the horizontal scrollbar’s adjustment, used to connect the
|
|
|
|
|
* horizontal scrollbar to the child widget’s horizontal scroll
|
2008-12-29 05:16:44 +00:00
|
|
|
|
* functionality.
|
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Returns: (transfer none): the horizontal #GtkAdjustment
|
2008-12-29 05:16:44 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkAdjustment*
|
|
|
|
|
gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2013-03-26 16:45:47 +00:00
|
|
|
|
return gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-29 05:16:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_vadjustment:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* Returns the vertical scrollbar’s adjustment, used to connect the
|
|
|
|
|
* vertical scrollbar to the child widget’s vertical scroll functionality.
|
2008-12-29 05:16:44 +00:00
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Returns: (transfer none): the vertical #GtkAdjustment
|
2008-12-29 05:16:44 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkAdjustment*
|
|
|
|
|
gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2013-03-26 16:45:47 +00:00
|
|
|
|
return gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-03 05:01:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_hscrollbar:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
2010-09-21 04:18:11 +00:00
|
|
|
|
*
|
2005-05-03 05:01:04 +00:00
|
|
|
|
* Returns the horizontal scrollbar of @scrolled_window.
|
|
|
|
|
*
|
2013-03-26 16:45:47 +00:00
|
|
|
|
* Returns: (transfer none): the horizontal scrollbar of the scrolled window.
|
2005-05-03 05:01:04 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.8
|
|
|
|
|
*/
|
2005-05-08 03:37:43 +00:00
|
|
|
|
GtkWidget*
|
2005-05-03 05:01:04 +00:00
|
|
|
|
gtk_scrolled_window_get_hscrollbar (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->hscrollbar;
|
2005-05-03 05:01:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_vscrollbar:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Returns the vertical scrollbar of @scrolled_window.
|
|
|
|
|
*
|
2013-03-26 16:45:47 +00:00
|
|
|
|
* Returns: (transfer none): the vertical scrollbar of the scrolled window.
|
2005-05-03 05:01:04 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.8
|
|
|
|
|
*/
|
2005-05-08 03:37:43 +00:00
|
|
|
|
GtkWidget*
|
2005-05-03 05:01:04 +00:00
|
|
|
|
gtk_scrolled_window_get_vscrollbar (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
return scrolled_window->priv->vscrollbar;
|
2005-05-03 05:01:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-29 05:16:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_policy:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @hscrollbar_policy: policy for horizontal bar
|
|
|
|
|
* @vscrollbar_policy: policy for vertical bar
|
|
|
|
|
*
|
|
|
|
|
* Sets the scrollbar policy for the horizontal and vertical scrollbars.
|
|
|
|
|
*
|
|
|
|
|
* The policy determines when the scrollbar should appear; it is a value
|
|
|
|
|
* from the #GtkPolicyType enumeration. If %GTK_POLICY_ALWAYS, the
|
|
|
|
|
* scrollbar is always present; if %GTK_POLICY_NEVER, the scrollbar is
|
|
|
|
|
* never present; if %GTK_POLICY_AUTOMATIC, the scrollbar is present only
|
|
|
|
|
* if needed (that is, if the slider part of the bar would be smaller
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* than the trough — the display is larger than the page size).
|
2008-12-29 05:16:44 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkPolicyType hscrollbar_policy,
|
|
|
|
|
GtkPolicyType vscrollbar_policy)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
2001-07-19 19:49:01 +00:00
|
|
|
|
GObject *object = G_OBJECT (scrolled_window);
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if ((priv->hscrollbar_policy != hscrollbar_policy) ||
|
|
|
|
|
(priv->vscrollbar_policy != vscrollbar_policy))
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->hscrollbar_policy = hscrollbar_policy;
|
|
|
|
|
priv->vscrollbar_policy = vscrollbar_policy;
|
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
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
2001-07-19 19:49:01 +00:00
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (object, properties[PROP_HSCROLLBAR_POLICY]);
|
|
|
|
|
g_object_notify_by_pspec (object, properties[PROP_VSCROLLBAR_POLICY]);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_policy:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @hscrollbar_policy: (out) (allow-none): location to store the policy
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* for the horizontal scrollbar, or %NULL
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @vscrollbar_policy: (out) (allow-none): location to store the policy
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* for the vertical scrollbar, or %NULL
|
2001-06-24 15:34:48 +00:00
|
|
|
|
*
|
|
|
|
|
* Retrieves the current policy values for the horizontal and vertical
|
|
|
|
|
* scrollbars. See gtk_scrolled_window_set_policy().
|
2008-12-29 03:01:42 +00:00
|
|
|
|
*/
|
2001-06-24 15:34:48 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkPolicyType *hscrollbar_policy,
|
|
|
|
|
GtkPolicyType *vscrollbar_policy)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
if (hscrollbar_policy)
|
2010-08-30 23:24:30 +00:00
|
|
|
|
*hscrollbar_policy = priv->hscrollbar_policy;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
if (vscrollbar_policy)
|
2010-08-30 23:24:30 +00:00
|
|
|
|
*vscrollbar_policy = priv->vscrollbar_policy;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-20 19:17:59 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_set_placement_internal (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkCornerType window_placement)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->window_placement != window_placement)
|
1998-11-09 00:23:37 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->window_placement = window_placement;
|
2015-11-07 04:28:22 +00:00
|
|
|
|
update_scrollbar_positions (scrolled_window);
|
1998-11-09 00:23:37 +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
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_WINDOW_PLACEMENT]);
|
2006-03-20 19:17:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_placement:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
2007-06-10 06:52:51 +00:00
|
|
|
|
* @window_placement: position of the child window
|
2006-03-20 19:17:59 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the placement of the contents with respect to the scrollbars
|
|
|
|
|
* for the scrolled window.
|
2008-12-29 03:01:42 +00:00
|
|
|
|
*
|
2007-06-10 06:52:51 +00:00
|
|
|
|
* The default is %GTK_CORNER_TOP_LEFT, meaning the child is
|
|
|
|
|
* in the top left, with the scrollbars underneath and to the right.
|
|
|
|
|
* Other values in #GtkCornerType are %GTK_CORNER_TOP_RIGHT,
|
|
|
|
|
* %GTK_CORNER_BOTTOM_LEFT, and %GTK_CORNER_BOTTOM_RIGHT.
|
2006-03-20 19:17:59 +00:00
|
|
|
|
*
|
|
|
|
|
* See also gtk_scrolled_window_get_placement() and
|
|
|
|
|
* gtk_scrolled_window_unset_placement().
|
2008-12-29 03:01:42 +00:00
|
|
|
|
*/
|
2006-03-20 19:17:59 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkCornerType window_placement)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_set_placement_internal (scrolled_window, window_placement);
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_placement:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
2006-03-20 19:17:59 +00:00
|
|
|
|
* Gets the placement of the contents with respect to the scrollbars
|
|
|
|
|
* for the scrolled window. See gtk_scrolled_window_set_placement().
|
2001-06-24 15:34:48 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the current placement value.
|
2006-03-20 19:17:59 +00:00
|
|
|
|
*
|
|
|
|
|
* See also gtk_scrolled_window_set_placement() and
|
|
|
|
|
* gtk_scrolled_window_unset_placement().
|
2001-06-24 15:34:48 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkCornerType
|
|
|
|
|
gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), GTK_CORNER_TOP_LEFT);
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
return scrolled_window->priv->window_placement;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-20 19:17:59 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_unset_placement:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Unsets the placement of the contents with respect to the scrollbars
|
|
|
|
|
* for the scrolled window. If no window placement is set for a scrolled
|
2014-10-05 04:13:09 +00:00
|
|
|
|
* window, it defaults to %GTK_CORNER_TOP_LEFT.
|
2006-03-20 19:17:59 +00:00
|
|
|
|
*
|
|
|
|
|
* See also gtk_scrolled_window_set_placement() and
|
|
|
|
|
* gtk_scrolled_window_get_placement().
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.10
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_unset_placement (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
2013-06-26 17:06:12 +00:00
|
|
|
|
gtk_scrolled_window_set_placement_internal (scrolled_window, GTK_CORNER_TOP_LEFT);
|
2006-03-20 19:17:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_shadow_type:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @type: kind of shadow to draw around scrolled window contents
|
|
|
|
|
*
|
|
|
|
|
* Changes the type of shadow drawn around the contents of
|
|
|
|
|
* @scrolled_window.
|
|
|
|
|
**/
|
2000-07-21 19:30:22 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkShadowType type)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
2014-06-26 03:43:35 +00:00
|
|
|
|
GtkStyleContext *context;
|
2010-08-30 23:24:30 +00:00
|
|
|
|
|
2000-07-21 19:30:22 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
g_return_if_fail (type >= GTK_SHADOW_NONE && type <= GTK_SHADOW_ETCHED_OUT);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->shadow_type != type)
|
2000-07-21 19:30:22 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->shadow_type = type;
|
2000-07-21 19:30:22 +00:00
|
|
|
|
|
2014-06-26 03:43:35 +00:00
|
|
|
|
context = gtk_widget_get_style_context (GTK_WIDGET (scrolled_window));
|
|
|
|
|
if (type != GTK_SHADOW_NONE)
|
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
|
|
|
|
|
else
|
|
|
|
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FRAME);
|
|
|
|
|
|
2010-01-07 15:47:35 +00:00
|
|
|
|
if (gtk_widget_is_drawable (GTK_WIDGET (scrolled_window)))
|
2002-10-09 00:38:22 +00:00
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (scrolled_window));
|
2000-07-21 19:30:22 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
2001-07-19 19:49:01 +00:00
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_SHADOW_TYPE]);
|
2000-07-21 19:30:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_shadow_type:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Gets the shadow type of the scrolled window. See
|
|
|
|
|
* gtk_scrolled_window_set_shadow_type().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the current shadow type
|
2001-06-24 15:34:48 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkShadowType
|
|
|
|
|
gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_NONE);
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
return scrolled_window->priv->shadow_type;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_kinetic_scrolling:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @kinetic_scrolling: %TRUE to enable kinetic scrolling
|
|
|
|
|
*
|
|
|
|
|
* Turns kinetic scrolling on or off.
|
|
|
|
|
* Kinetic scrolling only applies to devices with source
|
|
|
|
|
* %GDK_SOURCE_TOUCHSCREEN.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gboolean kinetic_scrolling)
|
|
|
|
|
{
|
2014-05-26 12:02:30 +00:00
|
|
|
|
GtkPropagationPhase phase = GTK_PHASE_NONE;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
if (priv->kinetic_scrolling == kinetic_scrolling)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->kinetic_scrolling = kinetic_scrolling;
|
2014-05-16 16:35:45 +00:00
|
|
|
|
gtk_scrolled_window_check_attach_pan_gesture (scrolled_window);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
if (priv->kinetic_scrolling)
|
2014-05-26 12:02:30 +00:00
|
|
|
|
phase = GTK_PHASE_CAPTURE;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
else
|
2014-05-26 12:02:30 +00:00
|
|
|
|
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
|
|
|
|
|
|
|
|
|
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->drag_gesture), phase);
|
|
|
|
|
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->swipe_gesture), phase);
|
|
|
|
|
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->long_press_gesture), phase);
|
|
|
|
|
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->pan_gesture), phase);
|
2014-02-26 14:48:21 +00:00
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_KINETIC_SCROLLING]);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_kinetic_scrolling:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Returns the specified kinetic scrolling behavior.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the scrolling behavior flags.
|
2011-02-11 12:43:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), FALSE);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->kinetic_scrolling;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_capture_button_press:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @capture_button_press: %TRUE to capture button presses
|
|
|
|
|
*
|
2016-12-31 13:27:15 +00:00
|
|
|
|
* Changes the behaviour of @scrolled_window with regard to the initial
|
2011-02-11 12:43:56 +00:00
|
|
|
|
* event that possibly starts kinetic scrolling. When @capture_button_press
|
|
|
|
|
* is set to %TRUE, the event is captured by the scrolled window, and
|
|
|
|
|
* then later replayed if it is meant to go to the child widget.
|
|
|
|
|
*
|
|
|
|
|
* This should be enabled if any child widgets perform non-reversible
|
|
|
|
|
* actions on #GtkWidget::button-press-event. If they don't, and handle
|
|
|
|
|
* additionally handle #GtkWidget::grab-broken-event, it might be better
|
|
|
|
|
* to set @capture_button_press to %FALSE.
|
|
|
|
|
*
|
|
|
|
|
* This setting only has an effect if kinetic scrolling is enabled.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_capture_button_press (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gboolean capture_button_press)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
scrolled_window->priv->capture_button_press = capture_button_press;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_capture_button_press:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Return whether button presses are captured during kinetic
|
|
|
|
|
* scrolling. See gtk_scrolled_window_set_capture_button_press().
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if button presses are captured during kinetic scrolling
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_scrolled_window_get_capture_button_press (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), FALSE);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->capture_button_press;
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
2010-09-18 23:55:42 +00:00
|
|
|
|
gtk_scrolled_window_destroy (GtkWidget *widget)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-09-18 23:55:42 +00:00
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2016-05-09 22:59:19 +00:00
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
|
|
|
if (child)
|
2016-05-14 15:13:52 +00:00
|
|
|
|
gtk_widget_destroy (child);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
remove_indicator (scrolled_window, &priv->hindicator);
|
|
|
|
|
remove_indicator (scrolled_window, &priv->vindicator);
|
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
if (priv->hscrollbar)
|
2008-09-10 20:21:59 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)),
|
2009-12-19 12:46:18 +00:00
|
|
|
|
gtk_scrolled_window_adjustment_changed,
|
|
|
|
|
scrolled_window);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
gtk_widget_unparent (priv->hscrollbar);
|
|
|
|
|
gtk_widget_destroy (priv->hscrollbar);
|
|
|
|
|
g_object_unref (priv->hscrollbar);
|
|
|
|
|
priv->hscrollbar = NULL;
|
2008-09-10 20:21:59 +00:00
|
|
|
|
}
|
2010-08-30 23:24:30 +00:00
|
|
|
|
if (priv->vscrollbar)
|
2008-09-10 20:21:59 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)),
|
2009-12-19 12:46:18 +00:00
|
|
|
|
gtk_scrolled_window_adjustment_changed,
|
|
|
|
|
scrolled_window);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
gtk_widget_unparent (priv->vscrollbar);
|
|
|
|
|
gtk_widget_destroy (priv->vscrollbar);
|
|
|
|
|
g_object_unref (priv->vscrollbar);
|
|
|
|
|
priv->vscrollbar = NULL;
|
2008-09-10 20:21:59 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
if (priv->deceleration_id)
|
|
|
|
|
{
|
2013-10-22 16:45:00 +00:00
|
|
|
|
gtk_widget_remove_tick_callback (widget, priv->deceleration_id);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
priv->deceleration_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
if (priv->scroll_events_overshoot_id)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (priv->scroll_events_overshoot_id);
|
|
|
|
|
priv->scroll_events_overshoot_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-05 23:36:09 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->destroy (widget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
2014-04-08 19:05:00 +00:00
|
|
|
|
g_clear_object (&priv->drag_gesture);
|
|
|
|
|
g_clear_object (&priv->swipe_gesture);
|
|
|
|
|
g_clear_object (&priv->long_press_gesture);
|
2016-10-13 08:20:57 +00:00
|
|
|
|
g_clear_object (&priv->pan_gesture);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
g_clear_object (&priv->gadget);
|
2015-05-23 13:57:41 +00:00
|
|
|
|
g_clear_pointer (&priv->scroll_history, (GDestroyNotify) g_array_unref);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2016-06-05 23:36:09 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_scrolled_window_parent_class)->finalize (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-19 19:49:01 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
2001-07-19 19:49:01 +00:00
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_HADJUSTMENT:
|
|
|
|
|
gtk_scrolled_window_set_hadjustment (scrolled_window,
|
|
|
|
|
g_value_get_object (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_VADJUSTMENT:
|
|
|
|
|
gtk_scrolled_window_set_vadjustment (scrolled_window,
|
|
|
|
|
g_value_get_object (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_HSCROLLBAR_POLICY:
|
|
|
|
|
gtk_scrolled_window_set_policy (scrolled_window,
|
|
|
|
|
g_value_get_enum (value),
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->vscrollbar_policy);
|
2001-07-19 19:49:01 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_VSCROLLBAR_POLICY:
|
|
|
|
|
gtk_scrolled_window_set_policy (scrolled_window,
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->hscrollbar_policy,
|
2001-07-19 19:49:01 +00:00
|
|
|
|
g_value_get_enum (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WINDOW_PLACEMENT:
|
2006-03-20 19:17:59 +00:00
|
|
|
|
gtk_scrolled_window_set_placement_internal (scrolled_window,
|
|
|
|
|
g_value_get_enum (value));
|
|
|
|
|
break;
|
2001-07-19 19:49:01 +00:00
|
|
|
|
case PROP_SHADOW_TYPE:
|
|
|
|
|
gtk_scrolled_window_set_shadow_type (scrolled_window,
|
|
|
|
|
g_value_get_enum (value));
|
|
|
|
|
break;
|
2010-10-22 16:46:33 +00:00
|
|
|
|
case PROP_MIN_CONTENT_WIDTH:
|
|
|
|
|
gtk_scrolled_window_set_min_content_width (scrolled_window,
|
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MIN_CONTENT_HEIGHT:
|
|
|
|
|
gtk_scrolled_window_set_min_content_height (scrolled_window,
|
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
case PROP_KINETIC_SCROLLING:
|
|
|
|
|
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window,
|
|
|
|
|
g_value_get_boolean (value));
|
|
|
|
|
break;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
case PROP_OVERLAY_SCROLLING:
|
|
|
|
|
gtk_scrolled_window_set_overlay_scrolling (scrolled_window,
|
|
|
|
|
g_value_get_boolean (value));
|
|
|
|
|
break;
|
2016-06-02 02:18:37 +00:00
|
|
|
|
case PROP_MAX_CONTENT_WIDTH:
|
|
|
|
|
gtk_scrolled_window_set_max_content_width (scrolled_window,
|
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MAX_CONTENT_HEIGHT:
|
|
|
|
|
gtk_scrolled_window_set_max_content_height (scrolled_window,
|
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
2016-08-31 04:54:25 +00:00
|
|
|
|
case PROP_PROPAGATE_NATURAL_WIDTH:
|
|
|
|
|
gtk_scrolled_window_set_propagate_natural_width (scrolled_window,
|
|
|
|
|
g_value_get_boolean (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_PROPAGATE_NATURAL_HEIGHT:
|
|
|
|
|
gtk_scrolled_window_set_propagate_natural_height (scrolled_window,
|
|
|
|
|
g_value_get_boolean (value));
|
|
|
|
|
break;
|
2001-07-19 19:49:01 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
2001-07-19 19:49:01 +00:00
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_HADJUSTMENT:
|
|
|
|
|
g_value_set_object (value,
|
|
|
|
|
G_OBJECT (gtk_scrolled_window_get_hadjustment (scrolled_window)));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_VADJUSTMENT:
|
|
|
|
|
g_value_set_object (value,
|
|
|
|
|
G_OBJECT (gtk_scrolled_window_get_vadjustment (scrolled_window)));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WINDOW_PLACEMENT:
|
2010-08-30 23:24:30 +00:00
|
|
|
|
g_value_set_enum (value, priv->window_placement);
|
2001-07-19 19:49:01 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_SHADOW_TYPE:
|
2010-08-30 23:24:30 +00:00
|
|
|
|
g_value_set_enum (value, priv->shadow_type);
|
2001-07-19 19:49:01 +00:00
|
|
|
|
break;
|
2010-10-22 16:46:33 +00:00
|
|
|
|
case PROP_HSCROLLBAR_POLICY:
|
|
|
|
|
g_value_set_enum (value, priv->hscrollbar_policy);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_VSCROLLBAR_POLICY:
|
|
|
|
|
g_value_set_enum (value, priv->vscrollbar_policy);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MIN_CONTENT_WIDTH:
|
|
|
|
|
g_value_set_int (value, priv->min_content_width);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MIN_CONTENT_HEIGHT:
|
|
|
|
|
g_value_set_int (value, priv->min_content_height);
|
|
|
|
|
break;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
case PROP_KINETIC_SCROLLING:
|
|
|
|
|
g_value_set_boolean (value, priv->kinetic_scrolling);
|
|
|
|
|
break;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
case PROP_OVERLAY_SCROLLING:
|
|
|
|
|
g_value_set_boolean (value, priv->overlay_scrolling);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
break;
|
2016-06-02 02:18:37 +00:00
|
|
|
|
case PROP_MAX_CONTENT_WIDTH:
|
|
|
|
|
g_value_set_int (value, priv->max_content_width);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MAX_CONTENT_HEIGHT:
|
|
|
|
|
g_value_set_int (value, priv->max_content_height);
|
|
|
|
|
break;
|
2016-08-31 04:54:25 +00:00
|
|
|
|
case PROP_PROPAGATE_NATURAL_WIDTH:
|
|
|
|
|
g_value_set_boolean (value, priv->propagate_natural_width);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_PROPAGATE_NATURAL_HEIGHT:
|
|
|
|
|
g_value_set_boolean (value, priv->propagate_natural_height);
|
|
|
|
|
break;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
2014-12-10 15:00:21 +00:00
|
|
|
|
}
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
2014-12-10 15:00:21 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_inner_allocation (GtkWidget *widget,
|
|
|
|
|
GtkAllocation *rect)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *child;
|
|
|
|
|
GtkBorder border = { 0 };
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_relative_allocation (widget, rect);
|
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
|
|
|
if (GTK_IS_SCROLLABLE (child) &&
|
|
|
|
|
gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
|
2014-12-10 15:00:21 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
rect->x += border.left;
|
|
|
|
|
rect->y += border.top;
|
|
|
|
|
rect->width -= border.left + border.right;
|
|
|
|
|
rect->height -= border.top + border.bottom;
|
2014-12-10 15:00:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 14:14:49 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_snapshot (GtkWidget *widget,
|
|
|
|
|
GtkSnapshot *snapshot)
|
2000-07-21 19:30:22 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2000-07-21 19:30:22 +00:00
|
|
|
|
|
2016-12-13 14:14:49 +00:00
|
|
|
|
gtk_css_gadget_snapshot (priv->gadget, snapshot);
|
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
|
|
|
|
|
gtk_scrolled_window_forall (GtkContainer *container,
|
|
|
|
|
gboolean include_internals,
|
|
|
|
|
GtkCallback callback,
|
|
|
|
|
gpointer callback_data)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
GTK_CONTAINER_CLASS (gtk_scrolled_window_parent_class)->forall (container,
|
2014-10-05 04:19:51 +00:00
|
|
|
|
include_internals,
|
|
|
|
|
callback,
|
|
|
|
|
callback_data);
|
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
|
|
|
|
if (include_internals)
|
|
|
|
|
{
|
1998-11-28 07:42:37 +00:00
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (container);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2014-05-30 01:52:40 +00:00
|
|
|
|
if (priv->vscrollbar)
|
|
|
|
|
callback (priv->vscrollbar, callback_data);
|
|
|
|
|
if (priv->hscrollbar)
|
|
|
|
|
callback (priv->hscrollbar, callback_data);
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-02 07:07:09 +00:00
|
|
|
|
static gboolean
|
2002-02-16 01:34:26 +00:00
|
|
|
|
gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkScrollType scroll,
|
|
|
|
|
gboolean horizontal)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GtkAdjustment *adjustment = NULL;
|
|
|
|
|
|
|
|
|
|
switch (scroll)
|
|
|
|
|
{
|
|
|
|
|
case GTK_SCROLL_STEP_UP:
|
|
|
|
|
scroll = GTK_SCROLL_STEP_BACKWARD;
|
|
|
|
|
horizontal = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_STEP_DOWN:
|
|
|
|
|
scroll = GTK_SCROLL_STEP_FORWARD;
|
|
|
|
|
horizontal = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_STEP_LEFT:
|
|
|
|
|
scroll = GTK_SCROLL_STEP_BACKWARD;
|
|
|
|
|
horizontal = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_STEP_RIGHT:
|
|
|
|
|
scroll = GTK_SCROLL_STEP_FORWARD;
|
|
|
|
|
horizontal = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_PAGE_UP:
|
|
|
|
|
scroll = GTK_SCROLL_PAGE_BACKWARD;
|
|
|
|
|
horizontal = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_PAGE_DOWN:
|
|
|
|
|
scroll = GTK_SCROLL_PAGE_FORWARD;
|
|
|
|
|
horizontal = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_PAGE_LEFT:
|
|
|
|
|
scroll = GTK_SCROLL_STEP_BACKWARD;
|
|
|
|
|
horizontal = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_PAGE_RIGHT:
|
|
|
|
|
scroll = GTK_SCROLL_STEP_FORWARD;
|
|
|
|
|
horizontal = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_STEP_BACKWARD:
|
|
|
|
|
case GTK_SCROLL_STEP_FORWARD:
|
|
|
|
|
case GTK_SCROLL_PAGE_BACKWARD:
|
|
|
|
|
case GTK_SCROLL_PAGE_FORWARD:
|
|
|
|
|
case GTK_SCROLL_START:
|
|
|
|
|
case GTK_SCROLL_END:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2007-05-10 19:31:33 +00:00
|
|
|
|
g_warning ("Invalid scroll type %u for GtkScrolledWindow::scroll-child", scroll);
|
2007-01-02 07:07:09 +00:00
|
|
|
|
return FALSE;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (horizontal)
|
2015-08-05 09:14:39 +00:00
|
|
|
|
{
|
|
|
|
|
if (may_hscroll (scrolled_window))
|
|
|
|
|
adjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2002-02-16 01:34:26 +00:00
|
|
|
|
else
|
2015-08-05 09:14:39 +00:00
|
|
|
|
{
|
|
|
|
|
if (may_vscroll (scrolled_window))
|
|
|
|
|
adjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
|
|
|
|
if (adjustment)
|
|
|
|
|
{
|
2011-01-05 18:15:06 +00:00
|
|
|
|
gdouble value = gtk_adjustment_get_value (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
|
|
|
|
|
switch (scroll)
|
|
|
|
|
{
|
|
|
|
|
case GTK_SCROLL_STEP_FORWARD:
|
2011-01-05 18:15:06 +00:00
|
|
|
|
value += gtk_adjustment_get_step_increment (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_STEP_BACKWARD:
|
2011-01-05 18:15:06 +00:00
|
|
|
|
value -= gtk_adjustment_get_step_increment (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_PAGE_FORWARD:
|
2011-01-05 18:15:06 +00:00
|
|
|
|
value += gtk_adjustment_get_page_increment (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_PAGE_BACKWARD:
|
2011-01-05 18:15:06 +00:00
|
|
|
|
value -= gtk_adjustment_get_page_increment (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_START:
|
2011-01-05 18:15:06 +00:00
|
|
|
|
value = gtk_adjustment_get_lower (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_END:
|
2011-01-05 18:15:06 +00:00
|
|
|
|
value = gtk_adjustment_get_upper (adjustment);
|
2002-02-16 01:34:26 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-03 00:26:43 +00:00
|
|
|
|
gtk_adjustment_animate_to_value (adjustment, value);
|
2007-01-02 07:07:09 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
}
|
2007-01-02 07:07:09 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkDirectionType direction_type)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
|
|
|
|
|
/* Focus out of the scrolled window entirely. We do this by setting
|
|
|
|
|
* a flag, then propagating the focus motion to the notebook.
|
|
|
|
|
*/
|
|
|
|
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (scrolled_window));
|
2010-01-04 06:49:26 +00:00
|
|
|
|
if (!gtk_widget_is_toplevel (toplevel))
|
2002-02-16 01:34:26 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_object_ref (scrolled_window);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
|
|
|
|
|
priv->focus_out = TRUE;
|
2008-08-11 13:36:15 +00:00
|
|
|
|
g_signal_emit_by_name (toplevel, "move-focus", direction_type);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->focus_out = FALSE;
|
|
|
|
|
|
2002-02-16 01:34:26 +00:00
|
|
|
|
g_object_unref (scrolled_window);
|
|
|
|
|
}
|
|
|
|
|
|
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_scrolled_window_relative_allocation (GtkWidget *widget,
|
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
|
{
|
2016-12-13 15:39:38 +00:00
|
|
|
|
GtkAllocation content_allocation, widget_allocation;
|
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
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
2006-03-20 19:17:59 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
2010-10-12 08:10:55 +00:00
|
|
|
|
gint sb_width;
|
|
|
|
|
gint sb_height;
|
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
|
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
|
g_return_if_fail (allocation != NULL);
|
|
|
|
|
|
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
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
|
|
|
|
|
2010-10-12 08:10:55 +00:00
|
|
|
|
/* Get possible scrollbar dimensions */
|
2016-12-01 18:44:02 +00:00
|
|
|
|
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
|
|
|
&sb_width, NULL, NULL, NULL);
|
|
|
|
|
gtk_widget_measure (priv->hscrollbar, GTK_ORIENTATION_VERTICAL, -1,
|
|
|
|
|
&sb_height, NULL, NULL, NULL);
|
2014-10-05 03:15:04 +00:00
|
|
|
|
|
2016-03-12 02:40:02 +00:00
|
|
|
|
gtk_css_gadget_get_content_allocation (priv->gadget, &content_allocation, NULL);
|
2016-12-13 15:39:38 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
1998-05-02 19:01:33 +00:00
|
|
|
|
|
2016-12-13 15:39:38 +00:00
|
|
|
|
allocation->x = content_allocation.x - widget_allocation.x;
|
|
|
|
|
allocation->y = content_allocation.y - widget_allocation.y;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
allocation->width = content_allocation.width;
|
|
|
|
|
allocation->height = content_allocation.height;
|
|
|
|
|
|
|
|
|
|
/* Subtract some things from our available allocation size */
|
|
|
|
|
if (priv->vscrollbar_visible && !priv->use_indicators)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gboolean is_rtl;
|
2010-10-12 08:10:55 +00:00
|
|
|
|
|
2017-01-11 14:27:51 +00:00
|
|
|
|
is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
2013-02-01 16:01:10 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if ((!is_rtl &&
|
|
|
|
|
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
|
|
|
|
|
(is_rtl &&
|
|
|
|
|
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
|
2016-10-04 14:35:24 +00:00
|
|
|
|
allocation->x += sb_width;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2016-10-04 14:35:24 +00:00
|
|
|
|
allocation->width = MAX (1, allocation->width - sb_width);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->hscrollbar_visible && !priv->use_indicators)
|
|
|
|
|
{
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->window_placement == GTK_CORNER_BOTTOM_LEFT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)
|
2016-10-04 14:35:24 +00:00
|
|
|
|
allocation->y += (sb_height);
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2016-10-04 14:35:24 +00:00
|
|
|
|
allocation->height = MAX (1, allocation->height - sb_height);
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
_gtk_scrolled_window_get_overshoot (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gint *overshoot_x,
|
|
|
|
|
gint *overshoot_y)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkAdjustment *vadjustment, *hadjustment;
|
|
|
|
|
gdouble lower, upper, x, y;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
/* Vertical overshoot */
|
|
|
|
|
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
|
|
|
|
lower = gtk_adjustment_get_lower (vadjustment);
|
|
|
|
|
upper = gtk_adjustment_get_upper (vadjustment) -
|
|
|
|
|
gtk_adjustment_get_page_size (vadjustment);
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->unclamped_vadj_value < lower)
|
|
|
|
|
y = priv->unclamped_vadj_value - lower;
|
|
|
|
|
else if (priv->unclamped_vadj_value > upper)
|
|
|
|
|
y = priv->unclamped_vadj_value - upper;
|
|
|
|
|
else
|
|
|
|
|
y = 0;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
/* Horizontal overshoot */
|
|
|
|
|
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
lower = gtk_adjustment_get_lower (hadjustment);
|
|
|
|
|
upper = gtk_adjustment_get_upper (hadjustment) -
|
|
|
|
|
gtk_adjustment_get_page_size (hadjustment);
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->unclamped_hadj_value < lower)
|
|
|
|
|
x = priv->unclamped_hadj_value - lower;
|
|
|
|
|
else if (priv->unclamped_hadj_value > upper)
|
|
|
|
|
x = priv->unclamped_hadj_value - upper;
|
|
|
|
|
else
|
|
|
|
|
x = 0;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (overshoot_x)
|
|
|
|
|
*overshoot_x = x;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (overshoot_y)
|
|
|
|
|
*overshoot_y = y;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
return (x != 0 || y != 0);
|
|
|
|
|
}
|
2010-10-12 08:16:32 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
|
|
|
|
|
GtkAllocation *relative_allocation)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (swindow), *child;
|
|
|
|
|
GtkAllocation child_allocation;
|
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
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
2010-11-18 15:53:19 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_scrolled_window_relative_allocation (widget, relative_allocation);
|
2010-11-18 15:53:19 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
child_allocation.x = relative_allocation->x;
|
|
|
|
|
child_allocation.y = relative_allocation->y;
|
|
|
|
|
child_allocation.width = relative_allocation->width;
|
|
|
|
|
child_allocation.height = relative_allocation->height;
|
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
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_widget_size_allocate (child, &child_allocation);
|
|
|
|
|
}
|
2010-10-30 14:10:43 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkWidget *scrollbar,
|
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
|
{
|
|
|
|
|
GtkAllocation child_allocation, content_allocation;
|
|
|
|
|
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
2016-10-04 14:35:24 +00:00
|
|
|
|
gint sb_height, sb_width;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_inner_allocation (widget, &content_allocation);
|
2016-12-01 18:44:02 +00:00
|
|
|
|
gtk_widget_measure (priv->vscrollbar, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
|
|
|
&sb_width, NULL, NULL, NULL);
|
|
|
|
|
gtk_widget_measure (priv->hscrollbar, GTK_ORIENTATION_VERTICAL, -1,
|
|
|
|
|
&sb_height, NULL, NULL, NULL);
|
2015-01-10 01:26:07 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (scrollbar == priv->hscrollbar)
|
2006-09-20 15:02:01 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
child_allocation.x = content_allocation.x;
|
2010-08-30 23:24:30 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_TOP_RIGHT)
|
2014-10-09 03:34:32 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
child_allocation.y = content_allocation.y + content_allocation.height - sb_height;
|
|
|
|
|
else
|
2016-10-04 14:35:24 +00:00
|
|
|
|
child_allocation.y = content_allocation.y + content_allocation.height;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
child_allocation.y = content_allocation.y;
|
|
|
|
|
else
|
2016-10-04 14:35:24 +00:00
|
|
|
|
child_allocation.y = content_allocation.y - sb_height;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
child_allocation.width = content_allocation.width;
|
|
|
|
|
child_allocation.height = sb_height;
|
|
|
|
|
}
|
|
|
|
|
else if (scrollbar == priv->vscrollbar)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2017-01-11 14:27:51 +00:00
|
|
|
|
if ((_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
|
2015-12-23 17:54:42 +00:00
|
|
|
|
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
|
2017-01-11 14:27:51 +00:00
|
|
|
|
(_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR &&
|
2015-12-23 17:54:42 +00:00
|
|
|
|
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
|
|
|
|
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
|
2014-10-09 03:34:32 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
child_allocation.x = content_allocation.x + content_allocation.width - sb_width;
|
|
|
|
|
else
|
2016-10-04 14:35:24 +00:00
|
|
|
|
child_allocation.x = content_allocation.x + content_allocation.width;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
2015-12-23 17:54:42 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
child_allocation.x = content_allocation.x;
|
|
|
|
|
else
|
2016-10-04 14:35:24 +00:00
|
|
|
|
child_allocation.x = content_allocation.x - sb_width;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
child_allocation.y = content_allocation.y;
|
|
|
|
|
child_allocation.width = sb_width;
|
|
|
|
|
child_allocation.height = content_allocation.height;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2015-12-23 17:54:42 +00:00
|
|
|
|
*allocation = child_allocation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
2016-12-13 15:39:38 +00:00
|
|
|
|
GtkAllocation clip;
|
2015-12-23 17:54:42 +00:00
|
|
|
|
|
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_allocation (widget, allocation);
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_realized (widget))
|
2016-11-06 14:50:26 +00:00
|
|
|
|
gdk_window_move_resize (priv->view_window,
|
2015-12-23 17:54:42 +00:00
|
|
|
|
allocation->x, allocation->y,
|
|
|
|
|
allocation->width, allocation->height);
|
|
|
|
|
|
|
|
|
|
gtk_css_gadget_allocate (priv->gadget,
|
2016-12-13 15:39:38 +00:00
|
|
|
|
allocation,
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_widget_get_allocated_baseline (widget),
|
|
|
|
|
&clip);
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_clip (widget, &clip);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-01 03:33:54 +00:00
|
|
|
|
static void
|
|
|
|
|
install_scroll_cursor (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GdkWindow *window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkCursor *cursor;
|
|
|
|
|
|
|
|
|
|
if (priv->scroll_window)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->scroll_window = window;
|
|
|
|
|
priv->scroll_cursor = gdk_window_get_cursor (priv->scroll_window);
|
|
|
|
|
if (priv->scroll_cursor)
|
|
|
|
|
g_object_ref (priv->scroll_cursor);
|
|
|
|
|
|
|
|
|
|
display = gdk_window_get_display (priv->scroll_window);
|
|
|
|
|
cursor = gdk_cursor_new_from_name (display, "all-scroll");
|
|
|
|
|
gdk_window_set_cursor (priv->scroll_window, cursor);
|
2016-09-28 19:37:41 +00:00
|
|
|
|
g_clear_object (&cursor);
|
2016-06-01 03:33:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
uninstall_scroll_cursor (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->scroll_window)
|
|
|
|
|
{
|
|
|
|
|
gdk_window_set_cursor (priv->scroll_window, priv->scroll_cursor);
|
|
|
|
|
priv->scroll_window = NULL;
|
|
|
|
|
g_clear_object (&priv->scroll_cursor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
start_scroll_deceleration_cb (gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = user_data;
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
priv->scroll_events_overshoot_id = 0;
|
2015-05-23 13:57:41 +00:00
|
|
|
|
|
|
|
|
|
if (!priv->deceleration_id)
|
2016-06-01 03:33:54 +00:00
|
|
|
|
{
|
|
|
|
|
uninstall_scroll_cursor (scrolled_window);
|
|
|
|
|
gtk_scrolled_window_start_deceleration (scrolled_window);
|
|
|
|
|
}
|
2015-05-23 13:57:41 +00:00
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-08-29 12:25:42 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_scrolled_window_scroll_event (GtkWidget *widget,
|
2000-02-18 20:02:24 +00:00
|
|
|
|
GdkEventScroll *event)
|
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
2012-01-24 11:12:34 +00:00
|
|
|
|
gboolean handled = FALSE;
|
|
|
|
|
gdouble delta_x;
|
|
|
|
|
gdouble delta_y;
|
2015-03-17 12:54:45 +00:00
|
|
|
|
GdkScrollDirection direction;
|
2015-08-19 16:45:50 +00:00
|
|
|
|
gboolean shifted, start_deceleration = FALSE;
|
|
|
|
|
GdkDevice *source_device;
|
2016-06-01 03:33:54 +00:00
|
|
|
|
GdkInputSource input_source;
|
2015-03-17 12:54:45 +00:00
|
|
|
|
|
|
|
|
|
shifted = (event->state & GDK_SHIFT_MASK) != 0;
|
2000-02-18 20:02:24 +00:00
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
2015-08-19 16:45:50 +00:00
|
|
|
|
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
2016-06-01 03:33:54 +00:00
|
|
|
|
input_source = gdk_device_get_source (source_device);
|
2014-10-12 11:22:43 +00:00
|
|
|
|
|
2012-01-24 11:12:34 +00:00
|
|
|
|
if (gdk_event_get_scroll_deltas ((GdkEvent *) event, &delta_x, &delta_y))
|
|
|
|
|
{
|
2015-08-19 16:45:50 +00:00
|
|
|
|
if (priv->scroll_device != source_device)
|
|
|
|
|
{
|
|
|
|
|
priv->scroll_device = source_device;
|
|
|
|
|
scroll_history_reset (scrolled_window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scroll_history_push (scrolled_window, event);
|
|
|
|
|
|
2016-06-01 03:33:54 +00:00
|
|
|
|
if (input_source == GDK_SOURCE_TRACKPOINT ||
|
|
|
|
|
input_source == GDK_SOURCE_TOUCHPAD)
|
|
|
|
|
install_scroll_cursor (scrolled_window, gdk_event_get_window ((GdkEvent *)event));
|
|
|
|
|
|
2015-03-17 12:54:45 +00:00
|
|
|
|
if (shifted)
|
|
|
|
|
{
|
|
|
|
|
gdouble delta;
|
|
|
|
|
|
|
|
|
|
delta = delta_x;
|
|
|
|
|
delta_x = delta_y;
|
|
|
|
|
delta_y = delta;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-29 02:29:57 +00:00
|
|
|
|
if (delta_x != 0.0 &&
|
2014-10-05 03:15:04 +00:00
|
|
|
|
may_hscroll (scrolled_window))
|
2012-01-24 11:12:34 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
|
gdouble new_value;
|
2012-03-05 00:20:10 +00:00
|
|
|
|
gdouble scroll_unit;
|
2012-01-24 11:12:34 +00:00
|
|
|
|
|
|
|
|
|
adj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
2015-05-23 13:51:11 +00:00
|
|
|
|
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL);
|
2012-01-24 11:12:34 +00:00
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
new_value = priv->unclamped_hadj_value + delta_x * scroll_unit;
|
|
|
|
|
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
|
|
|
|
|
new_value);
|
2012-01-24 11:12:34 +00:00
|
|
|
|
handled = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-29 02:29:57 +00:00
|
|
|
|
if (delta_y != 0.0 &&
|
2014-10-05 03:15:04 +00:00
|
|
|
|
may_vscroll (scrolled_window))
|
2012-01-24 11:12:34 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
|
gdouble new_value;
|
2012-03-05 00:20:10 +00:00
|
|
|
|
gdouble scroll_unit;
|
2012-01-24 11:12:34 +00:00
|
|
|
|
|
|
|
|
|
adj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
2015-05-24 19:06:42 +00:00
|
|
|
|
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL);
|
2012-01-24 11:12:34 +00:00
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
new_value = priv->unclamped_vadj_value + delta_y * scroll_unit;
|
|
|
|
|
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
|
|
|
|
|
new_value);
|
2012-01-24 11:12:34 +00:00
|
|
|
|
handled = TRUE;
|
|
|
|
|
}
|
2015-08-19 16:45:50 +00:00
|
|
|
|
|
|
|
|
|
/* The libinput driver may generate a final event with dx=dy=0
|
|
|
|
|
* after scrolling finished, start kinetic scrolling when this
|
|
|
|
|
* happens.
|
|
|
|
|
*/
|
2015-10-21 00:14:40 +00:00
|
|
|
|
if (gdk_event_is_scroll_stop_event ((GdkEvent *) event))
|
2015-08-19 16:45:50 +00:00
|
|
|
|
{
|
|
|
|
|
handled = TRUE;
|
|
|
|
|
start_deceleration = TRUE;
|
|
|
|
|
}
|
2012-01-24 11:12:34 +00:00
|
|
|
|
}
|
2015-03-17 12:54:45 +00:00
|
|
|
|
else if (gdk_event_get_scroll_direction ((GdkEvent *)event, &direction))
|
2000-02-18 20:02:24 +00:00
|
|
|
|
{
|
2012-01-24 11:12:34 +00:00
|
|
|
|
GtkWidget *range;
|
2014-10-05 03:15:04 +00:00
|
|
|
|
gboolean may_scroll;
|
2000-02-18 20:02:24 +00:00
|
|
|
|
|
2015-03-17 12:54:45 +00:00
|
|
|
|
if ((!shifted && (direction == GDK_SCROLL_UP || direction == GDK_SCROLL_DOWN)) ||
|
|
|
|
|
(shifted && (direction == GDK_SCROLL_LEFT || direction == GDK_SCROLL_RIGHT)))
|
2014-10-05 03:15:04 +00:00
|
|
|
|
{
|
|
|
|
|
range = priv->vscrollbar;
|
|
|
|
|
may_scroll = may_vscroll (scrolled_window);
|
|
|
|
|
}
|
2012-01-24 11:12:34 +00:00
|
|
|
|
else
|
2014-10-05 03:15:04 +00:00
|
|
|
|
{
|
|
|
|
|
range = priv->hscrollbar;
|
|
|
|
|
may_scroll = may_hscroll (scrolled_window);
|
|
|
|
|
}
|
2000-02-18 20:02:24 +00:00
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (range && may_scroll)
|
2012-01-24 11:12:34 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (range));
|
2012-03-05 00:20:10 +00:00
|
|
|
|
gdouble new_value;
|
2015-03-17 12:54:45 +00:00
|
|
|
|
gdouble delta;
|
2012-01-24 11:12:34 +00:00
|
|
|
|
|
|
|
|
|
delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event);
|
|
|
|
|
|
|
|
|
|
new_value = CLAMP (gtk_adjustment_get_value (adj) + delta,
|
|
|
|
|
gtk_adjustment_get_lower (adj),
|
|
|
|
|
gtk_adjustment_get_upper (adj) -
|
|
|
|
|
gtk_adjustment_get_page_size (adj));
|
|
|
|
|
|
|
|
|
|
gtk_adjustment_set_value (adj, new_value);
|
|
|
|
|
|
|
|
|
|
handled = TRUE;
|
|
|
|
|
}
|
2000-02-18 20:02:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
if (handled)
|
|
|
|
|
{
|
2015-08-19 16:45:50 +00:00
|
|
|
|
gdouble vel_x, vel_y;
|
|
|
|
|
|
2014-10-12 11:22:43 +00:00
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
|
|
|
|
|
|
|
|
|
if (priv->scroll_events_overshoot_id)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (priv->scroll_events_overshoot_id);
|
|
|
|
|
priv->scroll_events_overshoot_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-27 18:19:30 +00:00
|
|
|
|
if (start_deceleration)
|
|
|
|
|
uninstall_scroll_cursor (scrolled_window);
|
|
|
|
|
|
2015-08-19 16:45:50 +00:00
|
|
|
|
if (start_deceleration &&
|
|
|
|
|
scroll_history_finish (scrolled_window, &vel_x, &vel_y))
|
2016-07-27 18:19:30 +00:00
|
|
|
|
gtk_scrolled_window_decelerate (scrolled_window, vel_x, vel_y);
|
2015-08-19 16:45:50 +00:00
|
|
|
|
else if (_gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL))
|
2014-10-12 11:22:43 +00:00
|
|
|
|
{
|
|
|
|
|
priv->scroll_events_overshoot_id =
|
|
|
|
|
gdk_threads_add_timeout (50, start_scroll_deceleration_cb, scrolled_window);
|
|
|
|
|
g_source_set_name_by_id (priv->scroll_events_overshoot_id,
|
|
|
|
|
"[gtk+] start_scroll_deceleration_cb");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-24 11:12:34 +00:00
|
|
|
|
return handled;
|
2000-02-18 20:02:24 +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
|
|
|
|
|
2014-10-12 12:01:03 +00:00
|
|
|
|
static void
|
2011-02-11 12:43:56 +00:00
|
|
|
|
_gtk_scrolled_window_set_adjustment_value (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkAdjustment *adjustment,
|
2014-10-12 12:01:03 +00:00
|
|
|
|
gdouble value)
|
2011-02-11 12:43:56 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
gdouble lower, upper, *prev_value;
|
2014-10-12 12:29:24 +00:00
|
|
|
|
GtkPositionType edge_pos;
|
|
|
|
|
gboolean vertical;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2014-10-12 12:01:03 +00:00
|
|
|
|
lower = gtk_adjustment_get_lower (adjustment) - MAX_OVERSHOOT_DISTANCE;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
upper = gtk_adjustment_get_upper (adjustment) -
|
2014-10-12 12:01:03 +00:00
|
|
|
|
gtk_adjustment_get_page_size (adjustment) + MAX_OVERSHOOT_DISTANCE;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)))
|
2014-10-12 12:29:24 +00:00
|
|
|
|
vertical = FALSE;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)))
|
2014-10-12 12:29:24 +00:00
|
|
|
|
vertical = TRUE;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (vertical)
|
2011-02-11 12:43:56 +00:00
|
|
|
|
prev_value = &priv->unclamped_vadj_value;
|
|
|
|
|
else
|
2014-10-12 12:29:24 +00:00
|
|
|
|
prev_value = &priv->unclamped_hadj_value;
|
|
|
|
|
|
|
|
|
|
value = CLAMP (value, lower, upper);
|
|
|
|
|
|
|
|
|
|
if (*prev_value == value)
|
2014-10-12 12:01:03 +00:00
|
|
|
|
return;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2014-10-12 12:29:24 +00:00
|
|
|
|
*prev_value = value;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
gtk_adjustment_set_value (adjustment, value);
|
2014-10-12 12:29:24 +00:00
|
|
|
|
|
|
|
|
|
if (value == lower)
|
|
|
|
|
edge_pos = vertical ? GTK_POS_TOP : GTK_POS_LEFT;
|
|
|
|
|
else if (value == upper)
|
|
|
|
|
edge_pos = vertical ? GTK_POS_BOTTOM : GTK_POS_RIGHT;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Invert horizontal edge position on RTL */
|
|
|
|
|
if (!vertical &&
|
2017-01-11 14:27:51 +00:00
|
|
|
|
_gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL)
|
2014-10-12 12:29:24 +00:00
|
|
|
|
edge_pos = (edge_pos == GTK_POS_LEFT) ? GTK_POS_RIGHT : GTK_POS_LEFT;
|
|
|
|
|
|
|
|
|
|
g_signal_emit (scrolled_window, signals[EDGE_OVERSHOT], 0, edge_pos);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-02-16 02:58:34 +00:00
|
|
|
|
static gboolean
|
2014-05-26 16:19:24 +00:00
|
|
|
|
scrolled_window_deceleration_cb (GtkWidget *widget,
|
2013-02-16 02:58:34 +00:00
|
|
|
|
GdkFrameClock *frame_clock,
|
|
|
|
|
gpointer user_data)
|
2011-02-11 12:43:56 +00:00
|
|
|
|
{
|
2013-02-16 02:58:34 +00:00
|
|
|
|
KineticScrollData *data = user_data;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
GtkScrolledWindow *scrolled_window = data->scrolled_window;
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
GtkAdjustment *hadjustment, *vadjustment;
|
|
|
|
|
gint64 current_time;
|
2014-05-26 16:19:24 +00:00
|
|
|
|
gdouble position, elapsed;
|
|
|
|
|
|
|
|
|
|
current_time = gdk_frame_clock_get_frame_time (frame_clock);
|
|
|
|
|
elapsed = (current_time - data->last_deceleration_time) / 1000000.0;
|
|
|
|
|
data->last_deceleration_time = current_time;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
|
|
|
|
|
2014-07-27 11:39:51 +00:00
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
|
|
|
|
|
2014-05-26 16:19:24 +00:00
|
|
|
|
if (data->hscrolling &&
|
|
|
|
|
gtk_kinetic_scrolling_tick (data->hscrolling, elapsed, &position))
|
2011-02-11 12:43:56 +00:00
|
|
|
|
{
|
2014-05-26 16:19:24 +00:00
|
|
|
|
priv->unclamped_hadj_value = position;
|
|
|
|
|
gtk_adjustment_set_value (hadjustment, position);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
2014-05-26 16:19:24 +00:00
|
|
|
|
else if (data->hscrolling)
|
|
|
|
|
g_clear_pointer (&data->hscrolling, (GDestroyNotify) gtk_kinetic_scrolling_free);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2014-05-26 16:19:24 +00:00
|
|
|
|
if (data->vscrolling &&
|
|
|
|
|
gtk_kinetic_scrolling_tick (data->vscrolling, elapsed, &position))
|
2011-02-11 12:43:56 +00:00
|
|
|
|
{
|
2014-05-26 16:19:24 +00:00
|
|
|
|
priv->unclamped_vadj_value = position;
|
|
|
|
|
gtk_adjustment_set_value (vadjustment, position);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
2014-05-26 16:19:24 +00:00
|
|
|
|
else if (data->vscrolling)
|
|
|
|
|
g_clear_pointer (&data->vscrolling, (GDestroyNotify) gtk_kinetic_scrolling_free);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2014-05-26 16:19:24 +00:00
|
|
|
|
if (!data->hscrolling && !data->vscrolling)
|
|
|
|
|
{
|
|
|
|
|
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
2013-02-16 02:58:34 +00:00
|
|
|
|
|
2014-07-27 11:39:51 +00:00
|
|
|
|
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
2014-05-28 17:17:02 +00:00
|
|
|
|
|
2013-02-16 02:58:34 +00:00
|
|
|
|
return G_SOURCE_CONTINUE;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_cancel_deceleration (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->deceleration_id)
|
|
|
|
|
{
|
2013-02-16 02:58:34 +00:00
|
|
|
|
gtk_widget_remove_tick_callback (GTK_WIDGET (scrolled_window),
|
|
|
|
|
priv->deceleration_id);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
priv->deceleration_id = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-26 16:19:24 +00:00
|
|
|
|
static void
|
|
|
|
|
kinetic_scroll_data_free (KineticScrollData *data)
|
|
|
|
|
{
|
|
|
|
|
if (data->hscrolling)
|
|
|
|
|
gtk_kinetic_scrolling_free (data->hscrolling);
|
|
|
|
|
if (data->vscrolling)
|
|
|
|
|
gtk_kinetic_scrolling_free (data->vscrolling);
|
|
|
|
|
|
|
|
|
|
g_free (data);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2012-10-02 23:54:15 +00:00
|
|
|
|
GdkFrameClock *frame_clock;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
KineticScrollData *data;
|
2014-05-26 16:19:24 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (priv->deceleration_id == 0);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2012-10-02 23:54:15 +00:00
|
|
|
|
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (scrolled_window));
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
data = g_new0 (KineticScrollData, 1);
|
|
|
|
|
data->scrolled_window = scrolled_window;
|
2012-10-02 23:54:15 +00:00
|
|
|
|
data->last_deceleration_time = gdk_frame_clock_get_frame_time (frame_clock);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (may_hscroll (scrolled_window))
|
2014-05-26 16:19:24 +00:00
|
|
|
|
{
|
|
|
|
|
gdouble lower,upper;
|
|
|
|
|
GtkAdjustment *hadjustment;
|
|
|
|
|
|
|
|
|
|
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
lower = gtk_adjustment_get_lower (hadjustment);
|
|
|
|
|
upper = gtk_adjustment_get_upper (hadjustment);
|
|
|
|
|
upper -= gtk_adjustment_get_page_size (hadjustment);
|
|
|
|
|
data->hscrolling =
|
|
|
|
|
gtk_kinetic_scrolling_new (lower,
|
|
|
|
|
upper,
|
|
|
|
|
MAX_OVERSHOOT_DISTANCE,
|
|
|
|
|
DECELERATION_FRICTION,
|
|
|
|
|
OVERSHOOT_FRICTION,
|
|
|
|
|
priv->unclamped_hadj_value,
|
|
|
|
|
priv->x_velocity);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-05 03:15:04 +00:00
|
|
|
|
if (may_vscroll (scrolled_window))
|
2014-05-26 16:19:24 +00:00
|
|
|
|
{
|
|
|
|
|
gdouble lower,upper;
|
|
|
|
|
GtkAdjustment *vadjustment;
|
|
|
|
|
|
|
|
|
|
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
|
|
|
|
lower = gtk_adjustment_get_lower(vadjustment);
|
|
|
|
|
upper = gtk_adjustment_get_upper(vadjustment);
|
|
|
|
|
upper -= gtk_adjustment_get_page_size(vadjustment);
|
|
|
|
|
data->vscrolling =
|
|
|
|
|
gtk_kinetic_scrolling_new (lower,
|
|
|
|
|
upper,
|
|
|
|
|
MAX_OVERSHOOT_DISTANCE,
|
|
|
|
|
DECELERATION_FRICTION,
|
|
|
|
|
OVERSHOOT_FRICTION,
|
|
|
|
|
priv->unclamped_vadj_value,
|
|
|
|
|
priv->y_velocity);
|
|
|
|
|
}
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
scrolled_window->priv->deceleration_id =
|
2013-02-16 02:58:34 +00:00
|
|
|
|
gtk_widget_add_tick_callback (GTK_WIDGET (scrolled_window),
|
2014-05-26 16:19:24 +00:00
|
|
|
|
scrolled_window_deceleration_cb, data,
|
|
|
|
|
(GDestroyNotify) kinetic_scroll_data_free);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-29 12:25:42 +00:00
|
|
|
|
static gboolean
|
2002-02-16 01:34:26 +00:00
|
|
|
|
gtk_scrolled_window_focus (GtkWidget *widget,
|
|
|
|
|
GtkDirectionType direction)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2010-05-24 20:31:36 +00:00
|
|
|
|
GtkWidget *child;
|
2010-06-02 04:28:22 +00:00
|
|
|
|
gboolean had_focus_child;
|
|
|
|
|
|
|
|
|
|
had_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget)) != NULL;
|
2010-05-24 20:31:36 +00:00
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
if (priv->focus_out)
|
2002-02-16 01:34:26 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv->focus_out = FALSE; /* Clear this to catch the wrap-around case */
|
2002-02-16 01:34:26 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_is_focus (widget))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* We only put the scrolled window itself in the focus chain if it
|
|
|
|
|
* isn't possible to focus any children.
|
|
|
|
|
*/
|
2010-05-24 20:31:36 +00:00
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
|
|
|
if (child)
|
2002-02-16 01:34:26 +00:00
|
|
|
|
{
|
2010-05-24 20:31:36 +00:00
|
|
|
|
if (gtk_widget_child_focus (child, direction))
|
2002-02-16 01:34:26 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-04 03:56:11 +00:00
|
|
|
|
if (!had_focus_child && gtk_widget_get_can_focus (widget))
|
2002-02-18 23:43:25 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_widget_grab_focus (widget);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
2002-02-16 01:34:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
|
|
|
|
|
gpointer data)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-11-10 02:08:14 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (data);
|
|
|
|
|
priv = scrolled_window->priv;
|
1998-11-05 15:44:22 +00:00
|
|
|
|
|
2013-03-26 16:45:47 +00:00
|
|
|
|
if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)))
|
1998-11-05 15:44:22 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
1998-11-05 15:44:22 +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
|
|
|
|
gboolean visible;
|
2010-08-30 23:24:30 +00:00
|
|
|
|
|
|
|
|
|
visible = priv->hscrollbar_visible;
|
2011-01-05 18:15:06 +00:00
|
|
|
|
priv->hscrollbar_visible = (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment) >
|
|
|
|
|
gtk_adjustment_get_page_size (adjustment));
|
2010-11-18 15:53:19 +00:00
|
|
|
|
|
|
|
|
|
if (priv->hscrollbar_visible != visible)
|
2010-11-10 02:08:14 +00:00
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
1998-11-05 15:44:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-26 16:45:47 +00:00
|
|
|
|
else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)))
|
1998-11-05 15:44:22 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
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
|
|
|
|
{
|
|
|
|
|
gboolean visible;
|
1998-11-05 15:44:22 +00:00
|
|
|
|
|
2010-08-30 23:24:30 +00:00
|
|
|
|
visible = priv->vscrollbar_visible;
|
2011-01-05 18:15:06 +00:00
|
|
|
|
priv->vscrollbar_visible = (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment) >
|
|
|
|
|
gtk_adjustment_get_page_size (adjustment));
|
2010-11-18 15:53:19 +00:00
|
|
|
|
|
|
|
|
|
if (priv->vscrollbar_visible != visible)
|
2010-11-10 02:08:14 +00:00
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
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
|
|
|
|
}
|
1998-11-05 15:44:22 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-25 11:53:49 +00:00
|
|
|
|
static void
|
|
|
|
|
maybe_emit_edge_reached (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkAdjustment *adjustment)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
gdouble value, lower, upper, page_size;
|
|
|
|
|
GtkPositionType edge_pos;
|
|
|
|
|
gboolean vertical;
|
|
|
|
|
|
|
|
|
|
if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)))
|
|
|
|
|
vertical = FALSE;
|
|
|
|
|
else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)))
|
|
|
|
|
vertical = TRUE;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
value = gtk_adjustment_get_value (adjustment);
|
|
|
|
|
lower = gtk_adjustment_get_lower (adjustment);
|
|
|
|
|
upper = gtk_adjustment_get_upper (adjustment);
|
|
|
|
|
page_size = gtk_adjustment_get_page_size (adjustment);
|
|
|
|
|
|
|
|
|
|
if (value == lower)
|
|
|
|
|
edge_pos = vertical ? GTK_POS_TOP: GTK_POS_LEFT;
|
|
|
|
|
else if (value == upper - page_size)
|
|
|
|
|
edge_pos = vertical ? GTK_POS_BOTTOM : GTK_POS_RIGHT;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!vertical &&
|
2017-01-11 14:27:51 +00:00
|
|
|
|
_gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL)
|
2015-01-25 11:53:49 +00:00
|
|
|
|
edge_pos = (edge_pos == GTK_POS_LEFT) ? GTK_POS_RIGHT : GTK_POS_LEFT;
|
|
|
|
|
|
|
|
|
|
g_signal_emit (scrolled_window, signals[EDGE_REACHED], 0, edge_pos);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_adjustment_value_changed (GtkAdjustment *adjustment,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = user_data;
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
2015-01-25 11:53:49 +00:00
|
|
|
|
maybe_emit_edge_reached (scrolled_window, adjustment);
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
/* Allow overshooting for kinetic scrolling operations */
|
|
|
|
|
if (priv->drag_device || priv->deceleration_id)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Ensure GtkAdjustment and unclamped values are in sync */
|
2014-05-22 10:00:09 +00:00
|
|
|
|
if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)))
|
2011-02-11 12:43:56 +00:00
|
|
|
|
priv->unclamped_hadj_value = gtk_adjustment_get_value (adjustment);
|
2014-05-22 10:00:09 +00:00
|
|
|
|
else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)))
|
|
|
|
|
priv->unclamped_vadj_value = gtk_adjustment_get_value (adjustment);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
gtk_scrolled_window_add (GtkContainer *container,
|
2011-01-24 02:50:39 +00:00
|
|
|
|
GtkWidget *child)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-08-30 23:24:30 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
2014-06-16 21:31:56 +00:00
|
|
|
|
GtkBin *bin;
|
|
|
|
|
GtkWidget *child_widget, *scrollable_child;
|
2010-10-18 04:21:39 +00:00
|
|
|
|
GtkAdjustment *hadj, *vadj;
|
1998-11-28 07:42:37 +00:00
|
|
|
|
|
2014-06-16 21:31:56 +00:00
|
|
|
|
bin = GTK_BIN (container);
|
|
|
|
|
child_widget = gtk_bin_get_child (bin);
|
|
|
|
|
g_return_if_fail (child_widget == NULL);
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (container);
|
2010-08-30 23:24:30 +00:00
|
|
|
|
priv = scrolled_window->priv;
|
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
|
|
|
|
|
2014-01-04 02:55:41 +00:00
|
|
|
|
/* gtk_scrolled_window_set_[hv]adjustment have the side-effect
|
|
|
|
|
* of creating the scrollbars
|
|
|
|
|
*/
|
|
|
|
|
if (!priv->hscrollbar)
|
|
|
|
|
gtk_scrolled_window_set_hadjustment (scrolled_window, NULL);
|
|
|
|
|
|
|
|
|
|
if (!priv->vscrollbar)
|
|
|
|
|
gtk_scrolled_window_set_vadjustment (scrolled_window, NULL);
|
|
|
|
|
|
2013-06-10 12:55:54 +00:00
|
|
|
|
hadj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
|
|
|
|
vadj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
|
|
|
|
|
2013-02-01 16:03:44 +00:00
|
|
|
|
if (GTK_IS_SCROLLABLE (child))
|
|
|
|
|
{
|
|
|
|
|
scrollable_child = child;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-06-10 12:55:54 +00:00
|
|
|
|
scrollable_child = gtk_viewport_new (hadj, vadj);
|
2013-02-01 16:03:44 +00:00
|
|
|
|
gtk_widget_show (scrollable_child);
|
2013-06-10 12:55:54 +00:00
|
|
|
|
gtk_container_set_focus_hadjustment (GTK_CONTAINER (scrollable_child),
|
|
|
|
|
gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
|
|
|
|
|
gtk_container_set_focus_vadjustment (GTK_CONTAINER (scrollable_child),
|
|
|
|
|
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
|
2013-02-01 16:03:44 +00:00
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrollable_child), child);
|
2016-06-08 08:30:22 +00:00
|
|
|
|
priv->auto_added_viewport = TRUE;
|
2013-02-01 16:03:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-16 21:31:56 +00:00
|
|
|
|
_gtk_bin_set_child (bin, scrollable_child);
|
|
|
|
|
gtk_widget_set_parent (scrollable_child, GTK_WIDGET (bin));
|
1998-11-05 15:44:22 +00:00
|
|
|
|
|
2013-02-01 16:03:44 +00:00
|
|
|
|
g_object_set (scrollable_child, "hadjustment", hadj, "vadjustment", vadj, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
gtk_scrolled_window_remove (GtkContainer *container,
|
|
|
|
|
GtkWidget *child)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2016-06-08 08:30:22 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
GtkScrolledWindow *scrolled_window;
|
|
|
|
|
GtkWidget *scrollable_child;
|
|
|
|
|
|
|
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (container);
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (!priv->auto_added_viewport)
|
|
|
|
|
{
|
|
|
|
|
scrollable_child = child;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
scrollable_child = gtk_bin_get_child (GTK_BIN (container));
|
|
|
|
|
if (scrollable_child == child)
|
|
|
|
|
{
|
|
|
|
|
/* @child is the automatically added viewport. */
|
|
|
|
|
GtkWidget *grandchild = gtk_bin_get_child (GTK_BIN (child));
|
|
|
|
|
|
|
|
|
|
/* Remove the viewport's child, if any. */
|
|
|
|
|
if (grandchild)
|
|
|
|
|
gtk_container_remove (GTK_CONTAINER (child), grandchild);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* @child is (assumed to be) the viewport's child. */
|
|
|
|
|
gtk_container_remove (GTK_CONTAINER (scrollable_child), child);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_set (scrollable_child, "hadjustment", NULL, "vadjustment", NULL, NULL);
|
|
|
|
|
|
|
|
|
|
GTK_CONTAINER_CLASS (gtk_scrolled_window_parent_class)->remove (container, scrollable_child);
|
1998-11-28 07:42:37 +00:00
|
|
|
|
|
2016-06-08 08:30:22 +00:00
|
|
|
|
priv->auto_added_viewport = FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-07 19:18:13 +00:00
|
|
|
|
static void
|
2016-10-22 14:06:14 +00:00
|
|
|
|
gtk_scrolled_window_measure_ (GtkWidget *widget,
|
|
|
|
|
GtkOrientation orientation,
|
|
|
|
|
int for_size,
|
|
|
|
|
int *minimum,
|
|
|
|
|
int *natural,
|
|
|
|
|
int *minimum_baseline,
|
|
|
|
|
int *natural_baseline)
|
2010-04-04 00:09:18 +00:00
|
|
|
|
{
|
2015-12-23 17:54:42 +00:00
|
|
|
|
gtk_css_gadget_get_preferred_size (GTK_SCROLLED_WINDOW (widget)->priv->gadget,
|
2016-10-22 14:06:14 +00:00
|
|
|
|
orientation,
|
|
|
|
|
for_size,
|
|
|
|
|
minimum, natural,
|
|
|
|
|
minimum_baseline, natural_baseline);
|
2009-12-19 05:57:49 +00:00
|
|
|
|
}
|
2010-10-22 16:46:33 +00:00
|
|
|
|
|
2014-06-30 22:12:39 +00:00
|
|
|
|
static gboolean
|
2016-05-01 04:39:34 +00:00
|
|
|
|
gtk_widget_should_animate (GtkWidget *widget)
|
2014-06-30 22:12:39 +00:00
|
|
|
|
{
|
2016-05-01 04:39:34 +00:00
|
|
|
|
if (!gtk_widget_get_mapped (widget))
|
2014-06-30 22:12:39 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2016-05-01 04:39:34 +00:00
|
|
|
|
return gtk_settings_get_enable_animations (gtk_widget_get_settings (widget));
|
2014-06-30 22:12:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_update_animating (GtkScrolledWindow *sw)
|
|
|
|
|
{
|
|
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
|
GdkFrameClock *clock = NULL;
|
|
|
|
|
guint duration = 0;
|
|
|
|
|
|
2016-05-01 04:39:34 +00:00
|
|
|
|
if (gtk_widget_should_animate (GTK_WIDGET (sw)))
|
2014-06-30 22:12:39 +00:00
|
|
|
|
{
|
|
|
|
|
clock = gtk_widget_get_frame_clock (GTK_WIDGET (sw)),
|
|
|
|
|
duration = ANIMATION_DURATION;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
adjustment = gtk_range_get_adjustment (GTK_RANGE (sw->priv->hscrollbar));
|
|
|
|
|
gtk_adjustment_enable_animation (adjustment, clock, duration);
|
|
|
|
|
|
|
|
|
|
adjustment = gtk_range_get_adjustment (GTK_RANGE (sw->priv->vscrollbar));
|
|
|
|
|
gtk_adjustment_enable_animation (adjustment, clock, duration);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 12:43:56 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_map (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
2016-11-06 14:50:26 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
gdk_window_show (priv->view_window);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->map (widget);
|
2014-06-30 22:12:39 +00:00
|
|
|
|
|
|
|
|
|
gtk_scrolled_window_update_animating (scrolled_window);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_unmap (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
2016-11-06 14:50:26 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2011-02-11 12:43:56 +00:00
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->unmap (widget);
|
2014-06-30 22:12:39 +00:00
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
gdk_window_hide (priv->view_window);
|
|
|
|
|
|
2014-06-30 22:12:39 +00:00
|
|
|
|
gtk_scrolled_window_update_animating (scrolled_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
|
|
|
|
indicator_stop_fade (&scrolled_window->priv->hindicator);
|
|
|
|
|
indicator_stop_fade (&scrolled_window->priv->vindicator);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkWindow *
|
|
|
|
|
create_indicator_window (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
GtkWidget *child)
|
|
|
|
|
{
|
2016-11-06 14:50:26 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
GdkWindow *window;
|
|
|
|
|
|
scrolledwindow: Ensure indicator windows are created at the right place
At the time of creating the indicator window, the scrollbar allocation is
poked and reused as the initial window dimensions. This usually happens
on two circumstances, either initially (so a ::size-allocate is emitted,
relocating the windows in the right places), or post-initialization when
calling set_overlay_scrolling() (so the scrollbars already have a valid
size allocation)
However, if the scrolledwindow is unrealized, and later re-realized again,
the scrollbars will already have a valid allocation, although 0,0 based
due to being contained in the previous indicator window. This comes out
wrong then, and the indicator window is given 0,0 based coordinates too.
Fix this by refactoring the scrollbar allocation code out of size_allocate,
and also use that given size at the time of creating the indicator windows,
this will provide the right widget-relative allocation anytime.
2015-02-17 15:21:42 +00:00
|
|
|
|
gtk_scrolled_window_allocate_scrollbar (scrolled_window, child, &allocation);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
window = gdk_window_new_child (priv->view_window,
|
2016-10-17 18:20:32 +00:00
|
|
|
|
gtk_widget_get_events (widget),
|
|
|
|
|
&allocation);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
gtk_widget_register_window (widget, window);
|
2014-11-13 20:21:39 +00:00
|
|
|
|
|
2015-01-10 01:26:07 +00:00
|
|
|
|
if (scrolled_window->priv->use_indicators)
|
2014-10-09 03:34:32 +00:00
|
|
|
|
gtk_widget_set_parent_window (child, window);
|
2016-11-06 14:50:26 +00:00
|
|
|
|
else
|
|
|
|
|
gtk_widget_set_parent_window (child, priv->view_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
indicator_set_fade (Indicator *indicator,
|
|
|
|
|
gdouble pos)
|
|
|
|
|
{
|
2014-11-17 15:55:08 +00:00
|
|
|
|
gboolean visible, changed;
|
|
|
|
|
|
|
|
|
|
changed = indicator->current_pos != pos;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
indicator->current_pos = pos;
|
|
|
|
|
|
|
|
|
|
visible = indicator->current_pos != 0.0 || indicator->target_pos != 0.0;
|
|
|
|
|
|
|
|
|
|
if (visible && !gdk_window_is_visible (indicator->window))
|
|
|
|
|
{
|
|
|
|
|
gdk_window_show (indicator->window);
|
|
|
|
|
indicator->conceil_timer = g_timeout_add (INDICATOR_FADE_OUT_TIME, maybe_hide_indicator, indicator);
|
|
|
|
|
}
|
|
|
|
|
if (!visible && gdk_window_is_visible (indicator->window))
|
|
|
|
|
{
|
|
|
|
|
gdk_window_hide (indicator->window);
|
|
|
|
|
g_source_remove (indicator->conceil_timer);
|
|
|
|
|
indicator->conceil_timer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-17 15:55:08 +00:00
|
|
|
|
if (changed)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_set_opacity (indicator->scrollbar, indicator->current_pos);
|
|
|
|
|
gtk_widget_queue_draw (indicator->scrollbar);
|
|
|
|
|
}
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
indicator_fade_cb (GtkWidget *widget,
|
|
|
|
|
GdkFrameClock *frame_clock,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
Indicator *indicator = user_data;
|
2016-03-28 21:54:34 +00:00
|
|
|
|
gdouble t;
|
|
|
|
|
|
|
|
|
|
gtk_progress_tracker_advance_frame (&indicator->tracker,
|
|
|
|
|
gdk_frame_clock_get_frame_time (frame_clock));
|
|
|
|
|
t = gtk_progress_tracker_get_ease_out_cubic (&indicator->tracker, FALSE);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2016-03-28 21:54:34 +00:00
|
|
|
|
indicator_set_fade (indicator,
|
|
|
|
|
indicator->source_pos + (t * (indicator->target_pos - indicator->source_pos)));
|
|
|
|
|
|
|
|
|
|
if (gtk_progress_tracker_get_state (&indicator->tracker) == GTK_PROGRESS_STATE_AFTER)
|
2014-10-09 03:34:32 +00:00
|
|
|
|
{
|
|
|
|
|
indicator->tick_id = 0;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
indicator_start_fade (Indicator *indicator,
|
|
|
|
|
gdouble target)
|
|
|
|
|
{
|
|
|
|
|
if (indicator->target_pos == target)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
indicator->target_pos = target;
|
|
|
|
|
|
2014-11-29 15:53:05 +00:00
|
|
|
|
if (target != 0.0)
|
|
|
|
|
indicator->last_scroll_time = g_get_monotonic_time ();
|
|
|
|
|
|
2016-05-01 04:39:34 +00:00
|
|
|
|
if (gtk_widget_should_animate (indicator->scrollbar))
|
2014-10-09 03:34:32 +00:00
|
|
|
|
{
|
|
|
|
|
indicator->source_pos = indicator->current_pos;
|
2016-03-28 21:54:34 +00:00
|
|
|
|
gtk_progress_tracker_start (&indicator->tracker, INDICATOR_FADE_OUT_DURATION * 1000, 0, 1.0);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
if (indicator->tick_id == 0)
|
|
|
|
|
indicator->tick_id = gtk_widget_add_tick_callback (indicator->scrollbar, indicator_fade_cb, indicator, NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
indicator_set_fade (indicator, target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
indicator_stop_fade (Indicator *indicator)
|
|
|
|
|
{
|
|
|
|
|
if (indicator->tick_id != 0)
|
|
|
|
|
{
|
|
|
|
|
indicator_set_fade (indicator, indicator->target_pos);
|
|
|
|
|
gtk_widget_remove_tick_callback (indicator->scrollbar, indicator->tick_id);
|
|
|
|
|
indicator->tick_id = 0;
|
|
|
|
|
}
|
2015-05-22 18:52:17 +00:00
|
|
|
|
|
|
|
|
|
if (indicator->conceil_timer)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->conceil_timer);
|
|
|
|
|
indicator->conceil_timer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gdk_window_hide (indicator->window);
|
2016-03-28 21:54:34 +00:00
|
|
|
|
gtk_progress_tracker_finish (&indicator->tracker);
|
2015-05-22 18:52:17 +00:00
|
|
|
|
indicator->current_pos = indicator->source_pos = indicator->target_pos = 0;
|
2016-03-28 21:54:34 +00:00
|
|
|
|
indicator->last_scroll_time = 0;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
maybe_hide_indicator (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
Indicator *indicator = data;
|
|
|
|
|
|
|
|
|
|
if (g_get_monotonic_time () - indicator->last_scroll_time >= INDICATOR_FADE_OUT_DELAY * 1000 &&
|
2015-03-31 11:13:50 +00:00
|
|
|
|
!indicator->over)
|
2014-10-09 03:34:32 +00:00
|
|
|
|
indicator_start_fade (indicator, 0.0);
|
|
|
|
|
|
|
|
|
|
return G_SOURCE_CONTINUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
indicator_value_changed (GtkAdjustment *adjustment,
|
|
|
|
|
Indicator *indicator)
|
|
|
|
|
{
|
|
|
|
|
indicator->last_scroll_time = g_get_monotonic_time ();
|
2015-01-10 01:33:39 +00:00
|
|
|
|
indicator_start_fade (indicator, 1.0);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
setup_indicator (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
Indicator *indicator,
|
|
|
|
|
GtkWidget *scrollbar)
|
|
|
|
|
{
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
|
|
|
|
|
|
if (scrollbar == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (scrollbar);
|
|
|
|
|
adjustment = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
|
|
|
|
|
|
|
|
|
|
indicator->scrollbar = scrollbar;
|
|
|
|
|
|
|
|
|
|
g_object_ref (scrollbar);
|
|
|
|
|
gtk_widget_unparent (scrollbar);
|
|
|
|
|
gtk_widget_set_parent_window (scrollbar, indicator->window);
|
|
|
|
|
gtk_widget_set_parent (scrollbar, GTK_WIDGET (scrolled_window));
|
|
|
|
|
g_object_unref (scrollbar);
|
|
|
|
|
|
|
|
|
|
gtk_style_context_add_class (context, "overlay-indicator");
|
|
|
|
|
g_signal_connect (adjustment, "value-changed",
|
|
|
|
|
G_CALLBACK (indicator_value_changed), indicator);
|
|
|
|
|
|
|
|
|
|
gdk_window_hide (indicator->window);
|
|
|
|
|
gtk_widget_set_opacity (scrollbar, 0.0);
|
|
|
|
|
indicator->current_pos = 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
remove_indicator (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
Indicator *indicator)
|
|
|
|
|
{
|
2016-11-06 14:50:26 +00:00
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
GtkWidget *scrollbar;
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
|
|
|
|
|
|
if (indicator->scrollbar == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
scrollbar = indicator->scrollbar;
|
|
|
|
|
indicator->scrollbar = NULL;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (scrollbar);
|
|
|
|
|
adjustment = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
|
|
|
|
|
|
|
|
|
|
gtk_style_context_remove_class (context, "overlay-indicator");
|
|
|
|
|
g_signal_handlers_disconnect_by_func (adjustment, indicator_value_changed, indicator);
|
|
|
|
|
if (indicator->conceil_timer)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->conceil_timer);
|
|
|
|
|
indicator->conceil_timer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 13:25:23 +00:00
|
|
|
|
if (indicator->over_timeout_id)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->over_timeout_id);
|
|
|
|
|
indicator->over_timeout_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
if (indicator->tick_id)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_remove_tick_callback (scrollbar, indicator->tick_id);
|
|
|
|
|
indicator->tick_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_ref (scrollbar);
|
|
|
|
|
gtk_widget_unparent (scrollbar);
|
2016-11-06 14:50:26 +00:00
|
|
|
|
gtk_widget_set_parent_window (scrollbar, priv->view_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
gtk_widget_set_parent (scrollbar, GTK_WIDGET (scrolled_window));
|
|
|
|
|
g_object_unref (scrollbar);
|
|
|
|
|
|
|
|
|
|
if (indicator->window)
|
|
|
|
|
gdk_window_hide (indicator->window);
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_opacity (scrollbar, 1.0);
|
|
|
|
|
indicator->current_pos = 1.0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-07 05:09:28 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_sync_use_indicators (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->use_indicators)
|
|
|
|
|
{
|
|
|
|
|
setup_indicator (scrolled_window, &priv->hindicator, priv->hscrollbar);
|
|
|
|
|
setup_indicator (scrolled_window, &priv->vindicator, priv->vscrollbar);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
remove_indicator (scrolled_window, &priv->hindicator);
|
|
|
|
|
remove_indicator (scrolled_window, &priv->vindicator);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
static void
|
2015-01-10 01:26:07 +00:00
|
|
|
|
gtk_scrolled_window_update_use_indicators (GtkScrolledWindow *scrolled_window)
|
2014-10-09 03:34:32 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2015-01-10 01:26:07 +00:00
|
|
|
|
gboolean use_indicators;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2015-01-10 01:52:03 +00:00
|
|
|
|
use_indicators = priv->overlay_scrolling;
|
|
|
|
|
|
|
|
|
|
if (g_strcmp0 (g_getenv ("GTK_OVERLAY_SCROLLING"), "0") == 0)
|
2015-01-10 01:26:07 +00:00
|
|
|
|
use_indicators = FALSE;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2015-01-10 01:26:07 +00:00
|
|
|
|
if (priv->use_indicators != use_indicators)
|
2014-10-09 03:34:32 +00:00
|
|
|
|
{
|
2015-01-10 01:26:07 +00:00
|
|
|
|
priv->use_indicators = use_indicators;
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2016-06-07 05:09:28 +00:00
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (scrolled_window)))
|
|
|
|
|
gtk_scrolled_window_sync_use_indicators (scrolled_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_realize (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
2014-12-01 12:23:57 +00:00
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
priv->view_window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
|
|
|
|
|
gtk_widget_get_events (widget)
|
|
|
|
|
| GDK_ENTER_NOTIFY_MASK
|
|
|
|
|
| GDK_LEAVE_NOTIFY_MASK
|
|
|
|
|
| GDK_POINTER_MOTION_MASK,
|
|
|
|
|
&allocation);
|
2014-12-01 12:23:57 +00:00
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
gtk_widget_register_window (widget, priv->view_window);
|
|
|
|
|
|
|
|
|
|
if (gtk_bin_get_child (GTK_BIN (widget)))
|
|
|
|
|
gtk_widget_set_parent_window (gtk_bin_get_child (GTK_BIN (widget)), priv->view_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
|
|
|
|
priv->hindicator.window = create_indicator_window (scrolled_window, priv->hscrollbar);
|
|
|
|
|
priv->vindicator.window = create_indicator_window (scrolled_window, priv->vscrollbar);
|
|
|
|
|
|
2014-12-26 22:19:55 +00:00
|
|
|
|
priv->hindicator.scrollbar = priv->hscrollbar;
|
|
|
|
|
priv->vindicator.scrollbar = priv->vscrollbar;
|
|
|
|
|
|
2016-06-07 05:09:28 +00:00
|
|
|
|
gtk_scrolled_window_sync_use_indicators (scrolled_window);
|
2016-11-06 14:50:26 +00:00
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->realize (widget);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-17 15:15:26 +00:00
|
|
|
|
static void
|
|
|
|
|
indicator_reset (Indicator *indicator)
|
|
|
|
|
{
|
|
|
|
|
if (indicator->conceil_timer)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->conceil_timer);
|
|
|
|
|
indicator->conceil_timer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (indicator->over_timeout_id)
|
|
|
|
|
{
|
|
|
|
|
g_source_remove (indicator->over_timeout_id);
|
|
|
|
|
indicator->over_timeout_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (indicator->scrollbar && indicator->tick_id)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_remove_tick_callback (indicator->scrollbar,
|
|
|
|
|
indicator->tick_id);
|
|
|
|
|
indicator->tick_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (indicator->window)
|
|
|
|
|
{
|
|
|
|
|
gdk_window_destroy (indicator->window);
|
|
|
|
|
indicator->window = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
indicator->scrollbar = NULL;
|
|
|
|
|
indicator->over = FALSE;
|
2016-03-28 21:54:34 +00:00
|
|
|
|
gtk_progress_tracker_finish (&indicator->tracker);
|
2015-02-17 15:15:26 +00:00
|
|
|
|
indicator->current_pos = indicator->source_pos = indicator->target_pos = 0;
|
2016-03-28 21:54:34 +00:00
|
|
|
|
indicator->last_scroll_time = 0;
|
2015-02-17 15:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_unrealize (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_parent_window (priv->hscrollbar, NULL);
|
|
|
|
|
gtk_widget_unregister_window (widget, priv->hindicator.window);
|
2015-02-17 15:15:26 +00:00
|
|
|
|
indicator_reset (&priv->hindicator);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_set_parent_window (priv->vscrollbar, NULL);
|
|
|
|
|
gtk_widget_unregister_window (widget, priv->vindicator.window);
|
2016-11-10 20:07:08 +00:00
|
|
|
|
indicator_reset (&priv->vindicator);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2016-11-06 14:50:26 +00:00
|
|
|
|
gtk_widget_unregister_window (widget, priv->view_window);
|
|
|
|
|
gdk_window_destroy (priv->view_window);
|
|
|
|
|
priv->view_window = NULL;
|
|
|
|
|
|
2014-10-09 03:34:32 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->unrealize (widget);
|
2011-02-11 12:43:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_scrolled_window_grab_notify (GtkWidget *widget,
|
|
|
|
|
gboolean was_grabbed)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
|
|
|
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->drag_device &&
|
|
|
|
|
gtk_widget_device_is_shadowed (widget,
|
|
|
|
|
priv->drag_device))
|
|
|
|
|
{
|
|
|
|
|
if (_gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL))
|
|
|
|
|
gtk_scrolled_window_start_deceleration (scrolled_window);
|
|
|
|
|
else
|
|
|
|
|
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-23 21:02:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_min_content_width:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Gets the minimum content width of @scrolled_window, or -1 if not set.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the minimum content width
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
2010-10-22 16:46:33 +00:00
|
|
|
|
gint
|
|
|
|
|
gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->min_content_width;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-23 21:02:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_min_content_width:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @width: the minimal content width
|
|
|
|
|
*
|
|
|
|
|
* Sets the minimum width that @scrolled_window should keep visible.
|
|
|
|
|
* Note that this can and (usually will) be smaller than the minimum
|
|
|
|
|
* size of the content.
|
|
|
|
|
*
|
2016-06-02 02:18:37 +00:00
|
|
|
|
* It is a programming error to set the minimum content width to a
|
2016-10-26 13:20:25 +00:00
|
|
|
|
* value greater than #GtkScrolledWindow:max-content-width.
|
2016-06-02 02:18:37 +00:00
|
|
|
|
*
|
2010-10-23 21:02:40 +00:00
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
2010-10-22 16:46:33 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window,
|
2010-10-23 21:02:40 +00:00
|
|
|
|
gint width)
|
2010-10-22 16:46:33 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2016-06-07 20:35:06 +00:00
|
|
|
|
g_return_if_fail (width == -1 || priv->max_content_width == -1 || width <= priv->max_content_width);
|
2016-06-02 02:18:37 +00:00
|
|
|
|
|
2010-10-23 21:02:40 +00:00
|
|
|
|
if (priv->min_content_width != width)
|
2010-10-22 16:46:33 +00:00
|
|
|
|
{
|
2010-10-23 21:02:40 +00:00
|
|
|
|
priv->min_content_width = width;
|
2010-10-22 16:46:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_MIN_CONTENT_WIDTH]);
|
2010-10-22 16:46:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-23 21:02:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_min_content_height:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Gets the minimal content height of @scrolled_window, or -1 if not set.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the minimal content height
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
2010-10-22 16:46:33 +00:00
|
|
|
|
gint
|
|
|
|
|
gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->min_content_height;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-23 21:02:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_min_content_height:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @height: the minimal content height
|
|
|
|
|
*
|
|
|
|
|
* Sets the minimum height that @scrolled_window should keep visible.
|
|
|
|
|
* Note that this can and (usually will) be smaller than the minimum
|
|
|
|
|
* size of the content.
|
|
|
|
|
*
|
2016-06-02 02:18:37 +00:00
|
|
|
|
* It is a programming error to set the minimum content height to a
|
2016-10-26 13:20:25 +00:00
|
|
|
|
* value greater than #GtkScrolledWindow:max-content-height.
|
2016-06-02 02:18:37 +00:00
|
|
|
|
*
|
2010-10-23 21:02:40 +00:00
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
2010-10-22 16:46:33 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
|
2010-10-23 21:02:40 +00:00
|
|
|
|
gint height)
|
2010-10-22 16:46:33 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2016-06-07 20:35:06 +00:00
|
|
|
|
g_return_if_fail (height == -1 || priv->max_content_height == -1 || height <= priv->max_content_height);
|
2016-06-02 02:18:37 +00:00
|
|
|
|
|
2010-10-23 21:02:40 +00:00
|
|
|
|
if (priv->min_content_height != height)
|
2010-10-22 16:46:33 +00:00
|
|
|
|
{
|
2010-10-23 21:02:40 +00:00
|
|
|
|
priv->min_content_height = height;
|
2010-10-22 16:46:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_MIN_CONTENT_HEIGHT]);
|
2010-10-22 16:46:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2014-10-21 02:13:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_overlay_scrolling:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @overlay_scrolling: whether to enable overlay scrolling
|
|
|
|
|
*
|
|
|
|
|
* Enables or disables overlay scrolling for this scrolled window.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.16
|
|
|
|
|
*/
|
2014-10-09 03:34:32 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_overlay_scrolling (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gboolean overlay_scrolling)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->overlay_scrolling != overlay_scrolling)
|
|
|
|
|
{
|
|
|
|
|
priv->overlay_scrolling = overlay_scrolling;
|
|
|
|
|
|
2016-06-07 05:09:28 +00:00
|
|
|
|
gtk_scrolled_window_update_use_indicators (scrolled_window);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
|
2015-09-07 19:55:58 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_OVERLAY_SCROLLING]);
|
2014-10-09 03:34:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 02:13:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_overlay_scrolling:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Returns whether overlay scrolling is enabled for this scrolled window.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if overlay scrolling is enabled
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.16
|
|
|
|
|
*/
|
2014-10-09 03:34:32 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_scrolled_window_get_overlay_scrolling (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), TRUE);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->overlay_scrolling;
|
|
|
|
|
}
|
2016-06-02 02:18:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_max_content_width:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @width: the maximum content width
|
|
|
|
|
*
|
|
|
|
|
* Sets the maximum width that @scrolled_window should keep visible. The
|
|
|
|
|
* @scrolled_window will grow up to this width before it starts scrolling
|
|
|
|
|
* the content.
|
|
|
|
|
*
|
|
|
|
|
* It is a programming error to set the maximum content width to a value
|
|
|
|
|
* smaller than #GtkScrolledWindow:min-content-width.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_max_content_width (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gint width)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2016-06-07 20:35:06 +00:00
|
|
|
|
g_return_if_fail (width == -1 || priv->min_content_width == -1 || width >= priv->min_content_width);
|
2016-06-02 02:18:37 +00:00
|
|
|
|
|
|
|
|
|
if (width != priv->max_content_width)
|
|
|
|
|
{
|
|
|
|
|
priv->max_content_width = width;
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties [PROP_MAX_CONTENT_WIDTH]);
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_max_content_width:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Returns the maximum content width set.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the maximum content width, or -1
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
gint
|
|
|
|
|
gtk_scrolled_window_get_max_content_width (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), -1);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->max_content_width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_max_content_height:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @height: the maximum content height
|
|
|
|
|
*
|
|
|
|
|
* Sets the maximum height that @scrolled_window should keep visible. The
|
2016-10-26 13:20:25 +00:00
|
|
|
|
* @scrolled_window will grow up to this height before it starts scrolling
|
2016-06-02 02:18:37 +00:00
|
|
|
|
* the content.
|
|
|
|
|
*
|
|
|
|
|
* It is a programming error to set the maximum content height to a value
|
|
|
|
|
* smaller than #GtkScrolledWindow:min-content-height.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_max_content_height (GtkScrolledWindow *scrolled_window,
|
|
|
|
|
gint height)
|
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
2016-06-07 20:35:06 +00:00
|
|
|
|
g_return_if_fail (height == -1 || priv->min_content_height == -1 || height >= priv->min_content_height);
|
2016-06-02 02:18:37 +00:00
|
|
|
|
|
|
|
|
|
if (height != priv->max_content_height)
|
|
|
|
|
{
|
|
|
|
|
priv->max_content_height = height;
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties [PROP_MAX_CONTENT_HEIGHT]);
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_max_content_height:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Returns the maximum content height set.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the maximum content height, or -1
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
gint
|
|
|
|
|
gtk_scrolled_window_get_max_content_height (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), -1);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->max_content_height;
|
|
|
|
|
}
|
2016-08-31 04:54:25 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_propagate_natural_width:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @propagate: whether to propagate natural width
|
|
|
|
|
*
|
|
|
|
|
* Sets whether the natural width of the child should be calculated and propagated
|
|
|
|
|
* through the scrolled windows requested natural width.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_propagate_natural_width (GtkScrolledWindow *scrolled_window,
|
2016-09-05 07:08:27 +00:00
|
|
|
|
gboolean propagate)
|
2016-08-31 04:54:25 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
propagate = !!propagate;
|
|
|
|
|
|
|
|
|
|
if (priv->propagate_natural_width != propagate)
|
|
|
|
|
{
|
|
|
|
|
priv->propagate_natural_width = propagate;
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties [PROP_PROPAGATE_NATURAL_WIDTH]);
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_propagate_natural_width:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Reports whether the natural width of the child will be calculated and propagated
|
|
|
|
|
* through the scrolled windows requested natural width.
|
|
|
|
|
*
|
|
|
|
|
* Returns: whether natural width propagation is enabled.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
2016-09-05 07:08:27 +00:00
|
|
|
|
gboolean
|
2016-08-31 04:54:25 +00:00
|
|
|
|
gtk_scrolled_window_get_propagate_natural_width (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), -1);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->propagate_natural_width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_set_propagate_natural_height:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
* @propagate: whether to propagate natural height
|
|
|
|
|
*
|
|
|
|
|
* Sets whether the natural height of the child should be calculated and propagated
|
|
|
|
|
* through the scrolled windows requested natural height.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_scrolled_window_set_propagate_natural_height (GtkScrolledWindow *scrolled_window,
|
2016-09-05 07:08:27 +00:00
|
|
|
|
gboolean propagate)
|
2016-08-31 04:54:25 +00:00
|
|
|
|
{
|
|
|
|
|
GtkScrolledWindowPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
|
|
|
|
|
|
|
|
|
priv = scrolled_window->priv;
|
|
|
|
|
|
|
|
|
|
propagate = !!propagate;
|
|
|
|
|
|
|
|
|
|
if (priv->propagate_natural_height != propagate)
|
|
|
|
|
{
|
|
|
|
|
priv->propagate_natural_height = propagate;
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties [PROP_PROPAGATE_NATURAL_HEIGHT]);
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_scrolled_window_get_propagate_natural_height:
|
|
|
|
|
* @scrolled_window: a #GtkScrolledWindow
|
|
|
|
|
*
|
|
|
|
|
* Reports whether the natural height of the child will be calculated and propagated
|
|
|
|
|
* through the scrolled windows requested natural height.
|
|
|
|
|
*
|
|
|
|
|
* Returns: whether natural height propagation is enabled.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
2016-09-05 07:08:27 +00:00
|
|
|
|
gboolean
|
2016-08-31 04:54:25 +00:00
|
|
|
|
gtk_scrolled_window_get_propagate_natural_height (GtkScrolledWindow *scrolled_window)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), -1);
|
|
|
|
|
|
|
|
|
|
return scrolled_window->priv->propagate_natural_height;
|
|
|
|
|
}
|