.\" Copyright (c) 2006-2007 Hypertriton, Inc. .\" 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 August 29, 2006 .Dt AG_FIXED 3 .Os .ds vT Agar API Reference .ds oS Agar 1.0 .Sh NAME .Nm AG_Fixed .Nd agar pixel-precision container .Sh SYNOPSIS .Bd -literal #include #include .Ed .Sh DESCRIPTION The .Nm container widgets positions its children at specific locations given in pixels. It is useful for positioning cosmetic components applications such as games, running at fixed resolutions. .Sh INHERITANCE HIERARCHY .Xr AG_Object 3 -> .Xr AG_Widget 3 -> .Nm . .Sh INITIALIZATION .nr nS 1 .Ft "AG_Fixed *" .Fn AG_FixedNew "AG_Widget *parent" "Uint flags" .Pp .nr nS 0 The .Fn AG_FixedNew function allocates, initializes, and attaches a new .Nm widget. The .Fa flags may include: .Pp .Bl -tag -width "AG_FIXED_NO_UPDATE " .It AG_FIXED_FILLBG Fill the widget background with .Dv FIXED_BG_COLOR . .It AG_FIXED_BOX Draw a decorative 3D-style box in the background. .It AG_FIXED_FRAME Draw a decorative frame in the background. .It AG_FIXED_NO_UPDATE Don't automatically call .Xr WINDOW_UPDATE 3 when items are added, resized or moved. .El .Pp Whenever widgets are repositioned, the Agar GUI requires a call to the .Xr AG_WindowUpdate 3 function. Unless the .Dv AG_FIXED_NO_UPDATE flag is given, .Nm automatically invokes this macro. This flag is useful for manual updates after a large number of widgets are positioned. .Pp By default, the .Nm is invisible. The .Dv AG_FIXED_FILLBG flag causes a solid background to be drawn, .Dv AG_FIXED_BOX draws a 3D-style box primitive and .Dv AG_FIXED_FRAME draws a 2D-style frame. .Sh CHILD WIDGETS .nr nS 1 .Ft "void" .Fn AG_FixedPut "AG_Fixed *fixed" "void *child" "int x" "int y" .Pp .Ft "void" .Fn AG_FixedDel "AG_Fixed *fixed" "void *child" .Pp .Ft "void" .Fn AG_FixedSize "AG_Fixed *fixed" "void *child" "int width" "int height" .Pp .Ft "void" .Fn AG_FixedMove "AG_Fixed *fixed" "void *child" "int new_x" "int new_y" .Pp .nr nS 0 The .Fn AG_FixedPut function attaches the widget .Fa child and positions it at the given coordinates. .Fn AG_FixedDel detaches the given widget. .Pp Alternatively, you can avoid .Fn AG_FixedPut and .Fn AG_FixedDel altogether and instead use .Xr AG_ObjectAttach 3 and .Xr AG_ObjectDetach 3 followed by calls to .Fn AG_FixedSize and .Fn AG_FixedMove . .Pp Functions .Fn AG_FixedSize and .Fn AG_FixedMove set the size and location of a given widget in pixels. .Sh EVENTS The .Nm widget neither reacts to nor generates any event. .Sh EXAMPLES See .Pa demos/fixedres in the Agar source distribution. .Sh SEE ALSO .Xr AG_Intro 3 , .Xr AG_Box 3 , .Xr AG_VBox 3 , .Xr AG_HBox 3 , .Xr AG_Pane 3 , .Xr AG_MPane 3 , .Xr AG_Widget 3 , .Xr AG_Window 3 .Pp The .Pa demos/gamemenu demo in the Agar distribution illustrates the use of .Nm in a game interface. .Sh HISTORY The .Nm widget first appeared in Agar 1.0.