SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from RedHat Other XITE-3.3-3.i386.rpm

Section: Free Widget Foundation (3)
Updated:
Index 

NAME

XfwfRowCol 

DESCRIPTION

The RowCol widget forces all its children into rows and columns. Thechildren keep their preferred size, but the preferred position isignored. Resources determine how many rows or columns their should be(or as many as will fit) and if the children should be layed out inrows or in columns. In both methods, the children are placed on agrid, the size of which is determined by the width (height) of thewidest (tallest) child.

The children can be aligned in several ways: they can be placed in thecenter of their grid cell or against the edges. This is controlled bya resource of type Alignment.

 

Public variables

XfwfRowCol
NameClassTypeDefault
XtNstoreByRowXtCStoreByRowBoolean True
XtNrowsXtCRowsint 0
XtNcolumnsXtCColumnsint 0
XtNalignmentXtCAlignmentAlignment XfwfTopLeft
XtNshrinkToFitXtCShrinkToFitBoolean False

XtNstoreByRow
The child widgets can be layed out in rows (left to right) or incolumns (top to bottom). The resource storeByRow can be True orFalse. True means children are added to the right of the previousone until the row is full, like words are added to a text. Falsemeans children are added below the previous one, until the column isfull.

Boolean storeByRow = True

XtNrows
The number of rows can be set with rows, or the number of columnscan be set with columns. If both are non-zero, rows will beignored. If rows is zero, there will be as many rows as needed. Ifcolumns is zero, there will be as many columns as needed. However,if both are zero, there will be as many columns as will fit in thecurrent width of the RowCol widget. By default, both rows andcolumns are zero.

int rows = 0

XtNcolumns

int columns = 0

XtNalignment
The area of the RowCol widget is partitioned into rectangular cells(a grid). The cells are just large enough to contain the widest andthe tallest of the children. Within the cell, the children can be putin the top left corner (the default) or against one of the edges or inthe center. This is set with the alignment resource. The typeAlignment is defined in the ancestor class `Common'.

Alignment alignment = XfwfTopLeft

XtNshrinkToFit
The resource shrinkToFit determines how the size of the RowColwidget itself is computed. When it is False (default), thelocation resource is used to compute the widget's preferred size.When the value is True, the preferred size is computed fromthe totalwidth and height of the children. For example, when the widest childhas a width of w and columns > 0, the preferred width will becolumns * w + frame width. A similar computation is used for theheight. If columns > 0, only the height is computed this way. Ifcolumns = 0, rows > 0, only the width is computed.

Boolean shrinkToFit = False

XtNframeType
The inherited resource frameType is given a default value ofXfwfSunken, instead of the inherited default XfwfRaised. The framewidth is set to a default of 2 pixels, instead of 0.


 frameType = XfwfSunken 

XtNframeWidth


 frameWidth = 2 

XfwfBoard
NameClassTypeDefault
XtNabs_xXtCAbs_xPosition 0
XtNrel_xXtCRel_xFloat "0.0"
XtNabs_yXtCAbs_yPosition 0
XtNrel_yXtCRel_yFloat "0.0"
XtNabs_widthXtCAbs_widthPosition 0
XtNrel_widthXtCRel_widthFloat "1.0"
XtNabs_heightXtCAbs_heightPosition 0
XtNrel_heightXtCRel_heightFloat "1.0"
XtNhunitXtCHunitFloat "1.0"
XtNvunitXtCVunitFloat "1.0"
XtNlocationXtCLocationString NULL

XfwfFrame
NameClassTypeDefault
XtNcursorXtCCursorCursor None
XtNframeTypeXtCFrameTypeFrameType XfwfRaised
XtNframeWidthXtCFrameWidthDimension 0
XtNouterOffsetXtCOuterOffsetDimension 0
XtNinnerOffsetXtCInnerOffsetDimension 0
XtNshadowSchemeXtCShadowSchemeShadowScheme XfwfAuto
XtNtopShadowColorXtCTopShadowColorPixel compute_topcolor
XtNbottomShadowColorXtCBottomShadowColorPixel compute_bottomcolor
XtNtopShadowStippleXtCTopShadowStippleBitmap NULL
XtNbottomShadowStippleXtCBottomShadowStippleBitmap NULL

XfwfCommon
NameClassTypeDefault
XtNtraversalOnXtCTraversalOnBoolean True
XtNhighlightThicknessXtCHighlightThicknessDimension 2
XtNhighlightColorXtCHighlightColorPixel XtDefaultForeground
XtNhighlightPixmapXtCHighlightPixmapPixmap None
XtNnextTopXtCNextTopCallbackNULL
XtNuserDataXtCUserDataPointerNULL

Composite
NameClassTypeDefault
XtNchildrenXtCChildrenWidgetList NULL
insertPositionXtCInsertPositionXTOrderProc NULL
numChildrenXtCNumChildrenCardinal 0

Core
NameClassTypeDefault
XtNxXtCXPosition 0
XtNyXtCYPosition 0
XtNwidthXtCWidthDimension 0
XtNheightXtCHeightDimension 0
borderWidthXtCBorderWidthDimension 0
XtNcolormapXtCColormapColormap NULL
XtNdepthXtCDepthInt 0
destroyCallbackXtCDestroyCallbackXTCallbackList NULL
XtNsensitiveXtCSensitiveBoolean True
XtNtmXtCTmXTTMRec NULL
ancestorSensitiveXtCAncestorSensitiveBoolean False
acceleratorsXtCAcceleratorsXTTranslations NULL
borderColorXtCBorderColorPixel 0
borderPixmapXtCBorderPixmapPixmap NULL
backgroundXtCBackgroundPixel 0
backgroundPixmapXtCBackgroundPixmapPixmap NULL
mappedWhenManagedXtCMappedWhenManagedBoolean True
XtNscreenXtCScreenScreen *NULL

 

Private variables

The width of the widest and the height of the tallest child are keptin private variables, for quicker access.

Dimension  max_width

Dimension  max_height

 

Methods

If a child becomes managed or unmanaged, the RowCol widgetrecomputes the positions of all managed children. That is done by amethod layout. In the process, the widget may ask its parent for adifferent size if shrinkToFit = True.

change_managed($){    $layout($, $shrinkToFit);}

The layout function is responsible for moving the children to theirpositions in the grid. It is called from change_managed,geometry_manager and resize.

The function first computes the maximum width and height of all thechildren, including their borders. Then it computes the number of rowsand columns. All children are moved to their proper positions with thehelp of a utility function align_child, which aligns a child widgetto the grid.

If shrink = True, the RowCol widget also asks its parent for a newwidth and/or height, depending on the resulting layout.

layout($, int  shrink){    int nrows, ncols, i, nchild, n;    Position left, top, x, y;    Dimension width, height, w, h;    Widget child;    nchild = 0;    $max_width = 0;    $max_height = 0;    for (i = 0; i < $num_children; i++) {        child = $children[i];        if (! XtIsManaged(child)) continue;        nchild++;        $max_width = max($max_width, $child$width + 2*$child$border_width);        $max_height = max($max_height, $child$height + 2*$child$border_width);    }    $compute_inside($, left, top, width, height);    if ($columns != 0) {        ncols = $columns;        nrows = (nchild + ncols - 1)/ncols;    } else if ($rows != 0) {        nrows = $rows;        ncols = (nchild + nrows - 1)/nrows;    } else {        ncols = $max_width != 0 ? width/$max_width : 1;        if (ncols == 0) ncols = 1;        nrows = (nchild + ncols - 1)/ncols;    }    x = left;    y = top;    n = 0;    if ($storeByRow) {        for (i = 0; i < $num_children; i++) {            child = $children[i];            if (! XtIsManaged(child)) continue;            align_child(child, x, y, $max_width, $max_height, $alignment);            n++;            if (n == ncols) {                n = 0;                x = left;                y += $max_height;            } else                x += $max_width;        }    } else {        for (i = 0; i < $num_children; i++) {            child = $children[i];            if (! XtIsManaged(child)) continue;            align_child(child, x, y, $max_width, $max_height, $alignment);            n++;            if (n == nrows) {                n = 0;                y = top;                x += $max_width;            } else                y += $max_height;        }    }    if (shrink) {        w = 2*left + ncols * $max_width;        h = 2*top + nrows * $max_height;        if ($columns != 0)            XtVaSetValues($, XtNwidth, w, XtNheight, h, NULL);        else            XtVaSetValues($, XtNheight, h, NULL);    }}

When a child wants to change its size or border width, it calls itsparent's geometry_manager method (through a call toXtMakeGeometryRequest or XtMakeResizeRequest.) The RowCol widgetalways grants size changes to its children. The size change is carriedout immediately and a new layout is computed. If a child requests achange of position, the request is denied. A request for a change instacking order is ignored.

XtGeometryResult  geometry_manager(Widget  child, XtWidgetGeometry * request, XtWidgetGeometry * reply){    Dimension newwd, newht, newbd;    if (request->request_mode  (CWX | CWY)) return XtGeometryNo;    if (request->request_mode  XtCWQueryOnly) return XtGeometryYes;    newwd = request->request_mode  CWWidth ? request->width : $child$width;    newht = request->request_mode  CWHeight ? request->height : $child$height;    newbd = request->request_mode  CWBorderWidth        ? request->border_width : $child$border_width;    if (newwd == $child$width  newht == $child$height         newbd == $child$border_width) return XtGeometryNo;    XtResizeWidget(child, newwd, newht, newbd);    $layout($, $shrinkToFit);    return XtGeometryDone;}

The resize method is called when the widget is resized. If therows and columns resources are both zero, the children will haveto be be re-aligned. In this case, there is no sense in asking theparent for a new size, so layout is passed a value of False.

resize($){    if ($rows == 0  $columns == 0) $layout($, False);}

The initialize method sets the private variables, in this case onlymax_width and max_height. There is no need to check if the resourceshave sensible values.

initialize(Widget  request, $, ArgList  args, Cardinal * num_args){    $max_width = $max_height = 0;}

The RowCol widget needs to recompute the positions of the childrenwhen one of the resources changes. When the layout changes, the widgetalso needs to be redrawn, of course. The private variables are notdependent on the resources, so they don't need recomputing.

Boolean  set_values(Widget  old, Widget  request, $, ArgList  args, Cardinal * num_args){    Boolean need_layout = False;    Boolean need_redisplay = False;    if ($old$storeByRow != $storeByRow) need_layout = True;    if ($old$rows != $rows) need_layout = True;    if ($old$columns != $columns) need_layout = True;    if ($old$alignment != $alignment) need_layout = True;    if ($old$shrinkToFit != $shrinkToFit) need_layout = True;    if (need_layout) {        $layout($, $shrinkToFit);        need_redisplay = True;    }    return need_redisplay;}

 

Utilities

char  rcsid[] = "$Header: /local/blab/a/xite.Cvsroot/src/fwf/RowCol/XfwfRowCol.3,v 1.1 1997/03/23 14:46:42 svein Exp $"

align_child puts a widget in the proper position in the cell given bycx, cy, width and height.

align_child($, int  cx, int  cy, int  width, int  height, Alignment  alignment){    Position x, y;    if (alignment  XfwfLeft) x = cx;    else if (alignment  XfwfRight) x = cx + width - $width;    else x = cx + (width - $width) / 2;    if (alignment  XfwfTop) y = cy;    else if (alignment  XfwfBottom) y = cy + height - $height;    else y = cy + (height - $height) / 2;    XtMoveWidget($, x, y);}


 

Index

NAME
DESCRIPTION
Public variables
Private variables
Methods
Utilities

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector