You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_LayoutWindow object:
Cvo_LayoutWindow
Cvo_Object
The Cvo_LayoutWindow object is the base object on which all objects that have automatic geometry layout are built. A Cvo_LayoutWindow is never created directly, but always through a derived object, such as a Cvo_Window or Cvo_InputOnly object.
This object defines the following member functions in addition to those defined by its parent and ancestor objects.
Create (
)
This routine creates the window for the object. Up until this point,
there is no X window associated with the object. This function is
automatically called by the Map()
function so it typically is never
called directly.
SetMinSize (
int width,
int height )
SetMinPixelSize (
int width,
int height )
SetDefSize (
int width,
int height )
SetDefPixelSize (
int width,
int height )
SetMaxSize (
int width,
int height )
SetMaxPixelSize (
int width,
int height )
These functions set the minimum, default, and maximum sizes of an object. The *PixelSize functions specifiy the size in pixels, while the other functions specify the size in terms of some object dependent unit, typically average character widths/heights.
The system may choose to ignore values which are out of range for the object, or which make no sense (such as a maximum less than a minimum).
If no minimum is specified, the object will determine the minimum amount of space required for itself and its children and set the minimum accordingly. If the minimum specified is smaller than the actual minimum required, it will be increased to the actual amount of space needed.
If the default is not specified, or is smaller than the minimum, it will use the minimum size. Otherwise, the object will try and allocate as much space as was requested.
If the maximum size is specified, object is restricted from growing past that size, as long as it is as least as large as the minimum size. A maximum of zero indicates an unlimited maximum size.
To set only the width or height, you can simply pass a zero in for
the value not being set. (But a second call to one of these functions
will erase the value of the previous call.) Also, the *PixelSize and
non-*PixelSize versions are additive, not exclusive of each other.
e.g. calling SetMinSize(30, 30)
and SetMinPixelSize(100, 100)
will cause the minimum size of the object to be 30 characters plus
100 pixels in each direction.
When an object is laid out, and it has not specified expansion capabilities (see below), it will either take on the default or the minimum size, but nothing in between.
ExpandFrame (
[ CARD32 scale ] )
This function informs the layout manager that this object can expand
to use up any extra space in its parent's window. When an object is
resized, its children will be laid out again, taking into account
the new space available. If the object becomes large enough to
accommodate all of the default sizes of its children, it will start
with those. Otherwise, it will start with its children's minimum
sizes. Any space left over will be divided amoung those children
which have called ExpandFrame()
.
The optional argument scale is used to allow different children to expand at different rates. It should be considered a weight, with the default weight being 1000. So, to have a window expand twice as much as usual, use a weight of 2000. To expand half as much, use a weight of 500, and so on.
Note that this actually only expands the area allocated for the
object. It does not mean the object will actually be that large. If
there is more space allocated than the object can use (either because
FillFrame(False)
was used or its maximum size was exceeded) then it
will position itself within the area based on its gravity (see below).
Note that expansion is always done in the opposite direction of layout. That is, if the children of an object are laid out vertically, then those children will automatically expand in the horizontal direction.
If scale is zero, expansion is turned off.
FillFrame (
[ BOOL value ] )
FillFrameVertically (
[ BOOL value ] )
FillFrameHorizontally (
[ BOOL value ] )
These functions determine how much space an object will attempt to use from that which has been allocated to it. The default behavior is to fill vertically and horizontally, taking up all available space, up to the maximum size set for the object.
The FillFrame()
function controls filling in both the vertical and
horizontal directions. Filling can be individually controlled in the
vertical direction with the FillFrameVertically()
function, and in
the horizontal direction with the FillFrameHorizontally()
function.
If the optional argument value is passed and it is set to False
,
no filling will be done.
VerticalChildren (
)
HorizontalChildren (
)
These functions determine in which direction children will be laid out. The default layout mechanism always lays children in a vertical or horizontal fashion, depending on the object. In order to have a mixed layout, Cvo_Frame objects may be used to contain the objects which are in the opposing direction.
SetGravity (
unsigned direction )
This function determines where within the allocated space an object will be positioned if it does not fill the entire space. Possible values for the direction argument are:
Cvo_CENTER
Cvo_NORTH
Cvo_NORTHWEST
Cvo_EAST
Cvo_NORTHEAST
Cvo_SOUTH
Cvo_SOUTHEAST
Cvo_WEST
Cvo_SOUTHWEST
The default value is Cvo_CENTER
.
LayOpposite (
[ BOOL value ] )
This function causes the object to be laid out from the opposite direction. That is, when an object's parent has vertical child orientation, the object will be placed from the bottom of its parent. Likewise, when an object's parent has horizontal child orientation, the object will be placed from the right side of its parent.
If value is specified and is False
, this feature is disabled.
This is the default.
DontMap (
[ BOOL value ] )
This function indicates that this object should not be mapped automatically when its parent is mapped.
If value is specified and is False
, this feature is disabled. This
is the default.
SetCursor (
{ unsigned cursor | char *cursor | Cvo_Cursor cursor } )
These functions set the cursor for the object. Although this is typically done via an X resource, at times it might be important to change the cursor of a window within the source code. The cursor value is either one of the values found in <X11/cursorfont.h>, e.g. XC_X_cursor, or an ascii name representing the cursor, e.g. "X cursor", or a Cvo_Cursor object.
Cvo_Cursor GetCursor (
)
Return the current cursor being used for this window.
short HorizontalPad (
)
short VerticalPad (
)
short Raise (
)
Return the horizontal pad (number of pixels between the border and the start of the drawing area), vertical pad or how much the window apears to be raised (when shadows are drawn) in pixels.
int InternalPad (
)
Return the number of pixels placed between children of this object.
int XWidth (
)
int XHeight (
)
Return X's idea of the width or height of this object. Cvo normally does not include padding in the width or height.
int FullWidth (
)
int FullHeight (
)
Return the total number of pixels used by this object within the parent object. This includes not only pads, but also borders.
DontPosition (
[ BOOL value ] )
DontResize (
[ BOOL value ] )
Prevent an object from being repositioned and/or resized.
If value is specified and is False
, this feature is disabled. This
is the default.
MatchWidth (
Cvo_LayoutWindow *win )
MatchHeight (
Cvo_LayoutWindow *win )
MatchX (
Cvo_LayoutWindow *win )
MatchY (
Cvo_LayoutWindow *win )
Cause this object to match the width, height, X position, and or Y position of the object win. Note that the object win must have already been processed (that is, it occurs prior to this object in the object tree) for these functions to work properly. Moreover, the win object must have the Cvo_LayoutWindow object as an ancestor. These functions should normally not be used as they can break the layout mechanism used by Cvo.
MakePopup (
[ BOOL value ] )
Cause the Override Redirect flag to be set for this object. This is only useful for objects whose parent is the root window.
If value is specified and is False
, this feature is disabled. This
is the default.
MakeTransient (
Cvo_Object *owner )
This function is supposed to make this object a transient of object owner (or not be a transient if owner is zero). Normally this means the object will be iconified with its parent and it will not have so much border decoration. Unfortunately, the different window managers have very different opinions on what should happen here.
MakeOverlay (
unsigned olay )
This function causes the object to become an overlay window in relation to its parent. This means that it will position itself over the parent object as if it were the only child of the parent. The olay argument specifies the level of the overlay.
This object defines the following Cvo Events in addition to those defined by its parent and ancestor objects.
CvoCreatedEvent
struct
Cvo_CreatedEvent
This event is generated when this object is actually created. Note
that this is X's idea of creation and not due to a new
Cvo_LayoutWindow. The initial map request will cause the window to
be created as will a call to Create()
itself.
CvoCreatedChildEvent
struct
Cvo_CreatedChildEvent
Cvo_Object *child
This event is generated each time a new child window is created for this object. Note that this is X's idea of creation and not due to a new Cvo_LayoutWindow.
This object uses the following X resources in addition to those used by its parent and ancestor objects.
*CvoLayoutWindow.expandLayout
(class:
ExpandLayout
)
*CvoLayoutWindow.fillHorizontally
(class:
FillFrame
)
*CvoLayoutWindow.fillVertically
(class:
FillFrame
)
*CvoLayoutWindow.geometry
(class:
Geometry
)
*CvoLayoutWindow.horizontalLayoutPad
(class:
LayoutPad
)
*CvoLayoutWindow.horizontalPad
(class:
Pad
)
*CvoLayoutWindow.ignoreShadow
(class:
IgnoreShadow
)
*CvoLayoutWindow.internalPad
(class:
InternalPad
)
*CvoLayoutWindow.verticalLayout
(class:
VerticalLayout
)
*CvoLayoutWindow.verticalLayoutPad
(class:
LayoutPad
)
*CvoLayoutWindow.verticalPad
(class:
Pad
)See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.