.\" Copyright (c) 2008-2022 Julien Nadeau Carriere .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES .\" (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd December 21, 2022 .Dt AG_GRAPH 3 .Os Agar 1.7 .Sh NAME .Nm AG_Scrollview .Nd agar scrollable view widget .Sh SYNOPSIS .Bd -literal #include #include .Ed .Sh DESCRIPTION .\" IMAGE(/widgets/AG_Scrollview.png, "An AG_Scrollview containing a bunch of labels") The .Nm widget is a simple container which allows its child widgets to exceed its own size. It provides the user with .Xr AG_Scrollbar 3 controls to pan the view. .Sh INHERITANCE HIERARCHY .Xr AG_Object 3 -> .Xr AG_Widget 3 -> .Nm . .Sh INITIALIZATION .nr nS 1 .Ft "AG_Scrollview *" .Fn AG_ScrollviewNew "AG_Widget *parent" "Uint flags" .Pp .Ft "void" .Fn AG_ScrollviewSizeHint "AG_Scrollview *sv" "Uint width" "Uint height" .Pp .Ft "void" .Fn AG_ScrollviewSetIncrement "AG_Scrollview *sv" "int increment" .Pp .nr nS 0 The .Fn AG_ScrollviewNew function allocates, initializes, and attaches a new .Nm widget. Acceptable .Fa flags include: .Bl -tag -width "AG_SCROLLVIEW_BY_MOUSE " .It AG_SCROLLVIEW_PAN_LEFT Pannable with left mouse button. .It AG_SCROLLVIEW_PAN_RIGHT Pannable with right mouse button. .It AG_SCROLLVIEW_NOPAN_X Disable horizontal pan. .It AG_SCROLLVIEW_NOPAN_Y Disable vertical pan. .It AG_SCROLLVIEW_NOPAN_XY Same as .Dv AG_SCROLLVIEW_NOPAN_X and .Dv AG_SCROLLVIEW_NOPAN_Y . .It AG_SCROLLVIEW_BY_MOUSE Panning with cursor is permitted (may interfere with child widgets). .It AG_SCROLLVIEW_FRAME Decorative background and frame. .It AG_SCROLLVIEW_HFILL Expand horizontally in parent container. .It AG_SCROLLVIEW_VFILL Expand vertically in parent container. .It AG_SCROLLVIEW_EXPAND Shorthand for .Dv AG_SCROLLVIEW_HFILL | AG_SCROLLVIEW_VFILL . .El .Pp The .Fn AG_ScrollviewSizeHint function requests an initial widget size for the .Nm in pixels. .Pp .Fn AG_ScrollviewSetIncrement sets the increment for scrolling the view, in pixels. .Sh EVENTS The .Nm widget does not generate any event. .Sh STRUCTURE DATA For the .Ft AG_Scrollview object: .Pp .Bl -tag -compact -width "AG_Scrollbar *vbar " .It Ft int xOffs, yOffs Display offset in pixels (controlled by scrollbars). .It Ft int xMin, yMin Upper left display boundary (read-only). .It Ft int xMax, yMax Lower right display boundary (read-only). .It Ft AG_Scrollbar *hbar Pointer to horizontal scrollbar (or NULL). .It Ft AG_Scrollbar *vbar Pointer to vertical scrollbar (or NULL). .El .Sh SEE ALSO .Xr AG_Intro 3 , .Xr AG_Scrollbar 3 , .Xr AG_Widget 3 , .Xr AG_Window 3 .Sh HISTORY The .Nm widget first appeared in Agar 1.3.3.