Back to index

plt-scheme  4.2.1
Functions | Variables
xwRowCol.c File Reference
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <./xwRowColP.h>

Go to the source code of this file.

Functions

static void _resolve_inheritance ()
static void change_managed ()
static void insert_child ()
static void layout ()
static XtGeometryResult geometry_manager ()
static void resize ()
static void initialize ()
static Boolean set_values ()
static void align_child ()
static void align_child (Widget self, int cx, int cy, int width, int height, Alignment alignment)
static void _resolve_inheritance (WidgetClass class)
static void change_managed (Widget self)
static void insert_child (Widget child)
static void layout (Widget self, int shrink, Boolean align)
static XtGeometryResult geometry_manager (Widget child, XtWidgetGeometry *request, XtWidgetGeometry *reply)
static void resize (Widget self)
static void initialize (Widget request, Widget self, ArgList args, Cardinal *num_args)
static Boolean set_values (Widget old, Widget request, Widget self, ArgList args, Cardinal *num_args)

Variables

static XtResource resources []
XfwfRowColClassRec xfwfRowColClassRec
WidgetClass xfwfRowColWidgetClass = (WidgetClass) &xfwfRowColClassRec

Function Documentation

static void _resolve_inheritance ( ) [static]
static void _resolve_inheritance ( WidgetClass  class) [static]

Definition at line 168 of file xwRowCol.c.

{
  XfwfRowColWidgetClass c = (XfwfRowColWidgetClass) class;
  XfwfRowColWidgetClass super;
  static CompositeClassExtensionRec extension_rec = {
    NULL, NULLQUARK, XtCompositeExtensionVersion,
    sizeof(CompositeClassExtensionRec), True};
  CompositeClassExtensionRec *ext;
  ext = (XtPointer)XtMalloc(sizeof(*ext));
  *ext = extension_rec;
  ext->next_extension = c->composite_class.extension;
  c->composite_class.extension = ext;
  if (class == xfwfRowColWidgetClass) return;
  super = (XfwfRowColWidgetClass)class->core_class.superclass;
  if (c->xfwfRowCol_class.layout == XtInherit_layout)
    c->xfwfRowCol_class.layout = super->xfwfRowCol_class.layout;
}

Here is the call graph for this function:

static void align_child ( ) [static]

Here is the caller graph for this function:

static void align_child ( Widget  self,
int  cx,
int  cy,
int  width,
int  height,
Alignment  alignment 
) [static]

Definition at line 67 of file xwRowCol.c.

{
    Position x, y;

    if (alignment & XfwfLeft) x = cx;
    else if (alignment & XfwfRight) x = cx + width - ((XfwfRowColWidget)self)->core.width;
    else x = cx + (width - ((XfwfRowColWidget)self)->core.width) / 2;
    if (alignment & XfwfTop) y = cy;
    else if (alignment & XfwfBottom) y = cy + height - ((XfwfRowColWidget)self)->core.height;
    else y = cy + (height - ((XfwfRowColWidget)self)->core.height) / 2;
    XtMoveWidget(self, x, y);
}
static void change_managed ( ) [static]
static void change_managed ( Widget  self) [static]

Definition at line 193 of file xwRowCol.c.

{
    ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit, True);
}
static XtGeometryResult geometry_manager ( ) [static]
static XtGeometryResult geometry_manager ( Widget  child,
XtWidgetGeometry *  request,
XtWidgetGeometry *  reply 
) [static]

Definition at line 302 of file xwRowCol.c.

{ Widget self = XtParent(child); {
    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 : ((XfwfRowColWidget)child)->core.width;
    newht = request->request_mode & CWHeight ? request->height : ((XfwfRowColWidget)child)->core.height;
    newbd = request->request_mode & CWBorderWidth
        ? request->border_width : ((XfwfRowColWidget)child)->core.border_width;

    if (newwd == ((XfwfRowColWidget)child)->core.width && newht == ((XfwfRowColWidget)child)->core.height
        && newbd == ((XfwfRowColWidget)child)->core.border_width) return XtGeometryNo;

    XtResizeWidget(child, newwd, newht, newbd);
    ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit, True);
    return XtGeometryDone;
}
}
static void initialize ( ) [static]
static void initialize ( Widget  request,
Widget  self,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 343 of file xwRowCol.c.

{
    ((XfwfRowColWidget)self)->xfwfRowCol.max_width = ((XfwfRowColWidget)self)->xfwfRowCol.max_height = 0;
}
static void insert_child ( ) [static]
static void insert_child ( Widget  child) [static]

Definition at line 206 of file xwRowCol.c.

{ Widget self = XtParent(child); {
    xfwfBoardClassRec.composite_class.insert_child(child);
    if (((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit)
       ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit, False);
}
}
static void layout ( ) [static]
static void layout ( Widget  self,
int  shrink,
Boolean  align 
) [static]

Definition at line 221 of file xwRowCol.c.

{
    int nrows, ncols, i, nchild, n;
    Position left, top, x, y;
    int width, height, w, h;
    Widget child;

    nchild = 0;
    ((XfwfRowColWidget)self)->xfwfRowCol.max_width = 0;
    ((XfwfRowColWidget)self)->xfwfRowCol.max_height = 0;
    for (i = 0; i < ((XfwfRowColWidget)self)->composite.num_children; i++) {
        child = ((XfwfRowColWidget)self)->composite.children[i];
        if (align && ! XtIsManaged(child)) continue;
        nchild++;
        ((XfwfRowColWidget)self)->xfwfRowCol.max_width = max(((XfwfRowColWidget)self)->xfwfRowCol.max_width, ((XfwfRowColWidget)child)->core.width + 2*((XfwfRowColWidget)child)->core.border_width);
        ((XfwfRowColWidget)self)->xfwfRowCol.max_height = max(((XfwfRowColWidget)self)->xfwfRowCol.max_height, ((XfwfRowColWidget)child)->core.height + 2*((XfwfRowColWidget)child)->core.border_width);
    }

    ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &left, &top, &width, &height);
    width = max(0, width);

    if (((XfwfRowColWidget)self)->xfwfRowCol.columns != 0) {
        ncols = ((XfwfRowColWidget)self)->xfwfRowCol.columns;
        nrows = (nchild + ncols - 1)/ncols;
    } else if (((XfwfRowColWidget)self)->xfwfRowCol.rows != 0) {
        nrows = ((XfwfRowColWidget)self)->xfwfRowCol.rows;
        ncols = (nchild + nrows - 1)/nrows;
    } else {
        ncols = ((XfwfRowColWidget)self)->xfwfRowCol.max_width != 0 ? width/((XfwfRowColWidget)self)->xfwfRowCol.max_width : 1;
        if (ncols == 0) ncols = 1;
        nrows = (nchild + ncols - 1)/ncols;
    }

    x = left;
    y = top;
    n = 0;
    if (((XfwfRowColWidget)self)->xfwfRowCol.storeByRow) {
        for (i = 0; i < ((XfwfRowColWidget)self)->composite.num_children; i++) {
            child = ((XfwfRowColWidget)self)->composite.children[i];
            if (align && ! XtIsManaged(child)) continue;
           if (align)
              align_child(child, x, y, ((XfwfRowColWidget)self)->xfwfRowCol.max_width, ((XfwfRowColWidget)self)->xfwfRowCol.max_height, ((XfwfRowColWidget)self)->xfwfRowCol.alignment);
            n++;
            if (n == ncols) {
                n = 0;
                x = left;
                y += ((XfwfRowColWidget)self)->xfwfRowCol.max_height;
            } else
                x += ((XfwfRowColWidget)self)->xfwfRowCol.max_width;
        }
    } else {
        for (i = 0; i < ((XfwfRowColWidget)self)->composite.num_children; i++) {
            child = ((XfwfRowColWidget)self)->composite.children[i];
            if (align && ! XtIsManaged(child)) continue;
           if (align)
              align_child(child, x, y, ((XfwfRowColWidget)self)->xfwfRowCol.max_width, ((XfwfRowColWidget)self)->xfwfRowCol.max_height, ((XfwfRowColWidget)self)->xfwfRowCol.alignment);
            n++;
            if (n == nrows) {
                n = 0;
                y = top;
                x += ((XfwfRowColWidget)self)->xfwfRowCol.max_width;
            } else
                y += ((XfwfRowColWidget)self)->xfwfRowCol.max_height;
        }
    }

    if (shrink) {
      w = 2*left + ncols * ((XfwfRowColWidget)self)->xfwfRowCol.max_width;
      h = 2*top + nrows * ((XfwfRowColWidget)self)->xfwfRowCol.max_height;
      XtVaSetValues(self, XtNwidth, max(1, w), XtNheight, max(1, h), NULL);
    }
}

Here is the call graph for this function:

static void resize ( ) [static]
static void resize ( Widget  self) [static]

Definition at line 330 of file xwRowCol.c.

{
    if (((XfwfRowColWidget)self)->xfwfRowCol.rows == 0 && ((XfwfRowColWidget)self)->xfwfRowCol.columns == 0) ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, False, True);
}
static Boolean set_values ( ) [static]
static Boolean set_values ( Widget  old,
Widget  request,
Widget  self,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 356 of file xwRowCol.c.

{
    Boolean need_layout = False;
    Boolean need_redisplay = False;

    if (((XfwfRowColWidget)old)->xfwfRowCol.storeByRow != ((XfwfRowColWidget)self)->xfwfRowCol.storeByRow) need_layout = True;
    if (((XfwfRowColWidget)old)->xfwfRowCol.rows != ((XfwfRowColWidget)self)->xfwfRowCol.rows) need_layout = True;
    if (((XfwfRowColWidget)old)->xfwfRowCol.columns != ((XfwfRowColWidget)self)->xfwfRowCol.columns) need_layout = True;
    if (((XfwfRowColWidget)old)->xfwfRowCol.alignment != ((XfwfRowColWidget)self)->xfwfRowCol.alignment) need_layout = True;
    if (((XfwfRowColWidget)old)->xfwfRowCol.shrinkToFit != ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit) need_layout = True;
    if (need_layout) {
        ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit, True);
        need_redisplay = True;
    }
    return need_redisplay;
}

Variable Documentation

XtResource resources[] [static]
Initial value:
 {

{XtNstoreByRow,XtCStoreByRow,XtRBoolean,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.storeByRow),XtOffsetOf(XfwfRowColRec,xfwfRowCol.storeByRow),XtRImmediate,(XtPointer)True },

{XtNrows,XtCRows,XtRInt,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.rows),XtOffsetOf(XfwfRowColRec,xfwfRowCol.rows),XtRImmediate,(XtPointer)0 },

{XtNcolumns,XtCColumns,XtRInt,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.columns),XtOffsetOf(XfwfRowColRec,xfwfRowCol.columns),XtRImmediate,(XtPointer)0 },

{XtNalignment,XtCAlignment,XtRAlignment,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.alignment),XtOffsetOf(XfwfRowColRec,xfwfRowCol.alignment),XtRImmediate,(XtPointer)XfwfTopLeft },

{XtNshrinkToFit,XtCShrinkToFit,XtRBoolean,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.shrinkToFit),XtOffsetOf(XfwfRowColRec,xfwfRowCol.shrinkToFit),XtRImmediate,(XtPointer)False },

{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfRowColRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfRowColRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfSunken },

{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfRowColRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfRowColRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 },
}

Definition at line 82 of file xwRowCol.c.

Definition at line 99 of file xwRowCol.c.

WidgetClass xfwfRowColWidgetClass = (WidgetClass) &xfwfRowColClassRec

Definition at line 167 of file xwRowCol.c.