Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
xwFrame.c File Reference
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <string.h>
#include <stdio.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/CharSet.h>
#include "xwGray.h"
#include <./xwFrameP.h>

Go to the source code of this file.

Defines

#define done(type, value)

Functions

static void set_shadow ()
static void _resolve_inheritance ()
static void class_initialize ()
static void initialize ()
static void realize ()
static void destroy ()
static Boolean set_values ()
static void _expose ()
static void compute_inside ()
static Dimension total_frame_width ()
static XtGeometryResult query_geometry ()
static XtGeometryResult geometry_manager ()
static void resize ()
static void change_managed ()
static void create_darkgc ()
static void create_lightgc ()
static void create_fggc ()
static void compute_topcolor ()
static void compute_bottomcolor ()
static void create_darkgc (Widget self)
static void create_lightgc (Widget self)
static void create_fggc (Widget self)
static void compute_topcolor (Widget self, int offset, XrmValue *value)
static void compute_bottomcolor (Widget self, int offset, XrmValue *value)
static void set_shadow (Widget self, XEvent *event, String *params, Cardinal *num_params)
static void _resolve_inheritance (WidgetClass class)
static void initialize (Widget request, Widget self, ArgList args, Cardinal *num_args)
static void realize (Widget self, XtValueMask *mask, XSetWindowAttributes *attributes)
static void destroy (Widget self)
static Boolean set_values (Widget old, Widget request, Widget self, ArgList args, Cardinal *num_args)
static void _expose (Widget self, XEvent *event, Region region)
static void compute_inside (Widget self, Position *x, Position *y, int *w, int *h)
static Dimension total_frame_width (Widget self)
static XtGeometryResult query_geometry (Widget self, XtWidgetGeometry *request, XtWidgetGeometry *reply)
static XtGeometryResult geometry_manager (Widget child, XtWidgetGeometry *request, XtWidgetGeometry *reply)
static void resize (Widget self)
static void change_managed (Widget self)
void XfwfDrawFrame (Widget self, int x, int y, int w, int h, FrameType tp, int t, GC lightgc, GC darkgc, GC fggc)
Boolean cvtStringToFrameType (Display *display, XrmValuePtr args, Cardinal *num_args, XrmValuePtr from, XrmValuePtr to, XtPointer *converter_data)
Boolean cvtFrameTypeToString (Display *display, XrmValuePtr args, Cardinal *num_args, XrmValuePtr from, XrmValuePtr to, XtPointer *converter_data)
Boolean cvtStringToShadowScheme (Display *display, XrmValuePtr args, Cardinal *num_args, XrmValuePtr from, XrmValuePtr to, XtPointer *converter_data)
Boolean cvtShadowSchemeToString (Display *display, XrmValuePtr args, Cardinal *num_args, XrmValuePtr from, XrmValuePtr to, XtPointer *converter_data)
Pixmap GetGray (Widget self)
Pixmap GetLightGray (Widget self)
Pixmap GetDarkGray (Widget self)

Variables

static XtActionsRec actionsList []
static XtResource resources []
XfwfFrameClassRec xfwfFrameClassRec
WidgetClass xfwfFrameWidgetClass = (WidgetClass) &xfwfFrameClassRec

Define Documentation

#define done (   type,
  value 
)
Value:
do {\
      if (to->addr != NULL) {\
          if (to->size < sizeof(type)) {\
              to->size = sizeof(type);\
              return False;\
          }\
          *(type*)(to->addr) = (value);\
      } else {\
          static type static_val;\
          static_val = (value);\
          to->addr = (XtPointer)&static_val;\
      }\
      to->size = sizeof(type);\
      return True;\
  }while (0 )

Definition at line 86 of file xwFrame.c.


Function Documentation

static void _expose ( ) [static]
static void _expose ( Widget  self,
XEvent *  event,
Region  region 
) [static]

Definition at line 519 of file xwFrame.c.

{
    Position x, y;
    int w, h;

    if (! XtIsRealized(self)) return;
    if (region != NULL) {
        XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.lightgc, region);
        XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.darkgc, region);
        XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.fggc, region);
    }
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
    w += 2*((XfwfFrameWidget)self)->xfwfFrame.innerOffset + 2*((XfwfFrameWidget)self)->xfwfFrame.frameWidth;
    h += 2*((XfwfFrameWidget)self)->xfwfFrame.innerOffset + 2*((XfwfFrameWidget)self)->xfwfFrame.frameWidth;
    XfwfDrawFrame(self, 
                x - ((XfwfFrameWidget)self)->xfwfFrame.frameWidth - ((XfwfFrameWidget)self)->xfwfFrame.innerOffset,
                y - ((XfwfFrameWidget)self)->xfwfFrame.frameWidth - ((XfwfFrameWidget)self)->xfwfFrame.innerOffset,
                max(w, 0),
                max(h, 0),
                ((XfwfFrameWidget)self)->xfwfFrame.frameType, ((XfwfFrameWidget)self)->xfwfFrame.frameWidth, ((XfwfFrameWidget)self)->xfwfFrame.lightgc, ((XfwfFrameWidget)self)->xfwfFrame.darkgc, ((XfwfFrameWidget)self)->xfwfFrame.fggc);
    if (region != NULL) {
        XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.lightgc, None);
        XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.darkgc, None);
        XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.fggc, None);
    }
    xfwfCommonClassRec.xfwfCommon_class._expose(self, event, region);
}

Here is the call graph for this function:

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

Definition at line 369 of file xwFrame.c.

{
  XfwfFrameWidgetClass c = (XfwfFrameWidgetClass) class;
  XfwfFrameWidgetClass 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 == xfwfFrameWidgetClass) return;
  super = (XfwfFrameWidgetClass)class->core_class.superclass;
}

Here is the call graph for this function:

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

Definition at line 666 of file xwFrame.c.

{
    XtWidgetGeometry request2, reply2;
    XtGeometryResult result;
    Widget child;
    Position x, y;
    int w, h;

    if (((XfwfFrameWidget)self)->composite.num_children == 0) return;
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
    child = ((XfwfFrameWidget)self)->composite.children[0];
    request2.request_mode = CWWidth | CWHeight;
    request2.width = ((XfwfFrameWidget)child)->core.width + ((XfwfFrameWidget)self)->core.width - w;
    request2.height = ((XfwfFrameWidget)child)->core.height + ((XfwfFrameWidget)self)->core.height - h;
    result = XtMakeGeometryRequest(self, &request2, &reply2);
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
    w -= 2 * ((XfwfFrameWidget)child)->core.border_width;
    h -= 2 * ((XfwfFrameWidget)child)->core.border_width;
    XtConfigureWidget(child, x, y, max(1, w), max(1, h), ((XfwfFrameWidget)child)->core.border_width);
}
static void class_initialize ( ) [static]

Definition at line 389 of file xwFrame.c.

{
    static XtConvertArgRec screenArg[] = {
    {XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen*)}};

    XtSetTypeConverter(XtRString, XtRFrameType, cvtStringToFrameType,
                       NULL, 0, XtCacheNone, NULL);
    XtSetTypeConverter(XtRFrameType, XtRString, cvtFrameTypeToString,
                       NULL, 0, XtCacheNone, NULL);

    XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
                       screenArg, XtNumber(screenArg));

    XtSetTypeConverter(XtRString, XtRShadowScheme, cvtStringToShadowScheme,
                       NULL, 0, XtCacheNone, NULL);
    XtSetTypeConverter(XtRShadowScheme, XtRString, cvtShadowSchemeToString,
                       NULL, 0, XtCacheNone, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void compute_bottomcolor ( ) [static]
static void compute_bottomcolor ( Widget  self,
int  offset,
XrmValue *  value 
) [static]

Definition at line 255 of file xwFrame.c.

{
    static Pixel color;
#if 1
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &color);
#else
    (void) choose_color(self, 0.6, ((XfwfFrameWidget)self)->core.background_pixel, &color);
#endif
    value->addr = (XtPointer) &color;
}

Here is the call graph for this function:

static void compute_inside ( ) [static]
static void compute_inside ( Widget  self,
Position *  x,
Position *  y,
int w,
int h 
) [static]

Definition at line 551 of file xwFrame.c.

{
    xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, x, y, w, h);
    *x += ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset;
    *y += ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset;
    *w -= 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset);
    *h -= 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset);
}
static void compute_topcolor ( ) [static]
static void compute_topcolor ( Widget  self,
int  offset,
XrmValue *  value 
) [static]

Definition at line 240 of file xwFrame.c.

{
    static Pixel color;
#if 1
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &color);
#else
    (void) choose_color(self, 1.35, ((XfwfFrameWidget)self)->core.background_pixel, &color);
#endif
    value->addr = (XtPointer) &color;
}

Here is the call graph for this function:

static void create_darkgc ( ) [static]

Here is the caller graph for this function:

static void create_darkgc ( Widget  self) [static]

Definition at line 132 of file xwFrame.c.

{
    XtGCMask mask=0;
    XGCValues values;

    if (((XfwfFrameWidget)self)->xfwfFrame.darkgc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.darkgc);
    switch (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme) {
    case XfwfColor:
        mask = GCForeground;
        values.foreground = ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowColor;
        break;
    case XfwfStipple:
        mask = GCFillStyle | GCStipple | GCForeground | GCBackground;
        values.fill_style = FillOpaqueStippled;
        values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple ? ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple : GetGray(self);
        values.foreground = BlackPixelOfScreen(XtScreen(self));
        values.background = ((XfwfFrameWidget)self)->core.background_pixel;
        break;
    case XfwfBlack:
       mask = GCForeground;
       values.foreground = BlackPixelOfScreen(XtScreen(self));
       break;
    case XfwfAuto:
        if (DefaultDepthOfScreen(XtScreen(self)) > 4
            && ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground)) {
            mask = GCForeground;
        } else {
            mask = GCFillStyle | GCBackground | GCForeground | GCStipple;
            values.fill_style = FillOpaqueStippled;
            /* values.background = $background_pixel; */
            values.background = WhitePixelOfScreen(XtScreen(self));
            values.foreground = BlackPixelOfScreen(XtScreen(self));
            values.stipple = GetDarkGray(self);
        }
        break;
    }
    ((XfwfFrameWidget)self)->xfwfFrame.darkgc = XtGetGC(self, mask, &values);
}

Here is the call graph for this function:

static void create_fggc ( ) [static]

Here is the caller graph for this function:

static void create_fggc ( Widget  self) [static]

Definition at line 225 of file xwFrame.c.

{
    XtGCMask mask=0;
    XGCValues values;

    if (((XfwfFrameWidget)self)->xfwfFrame.fggc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.fggc);
    mask = GCForeground;
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.set_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground);
    ((XfwfFrameWidget)self)->xfwfFrame.fggc = XtGetGC(self, mask, &values);
}
static void create_lightgc ( ) [static]

Here is the caller graph for this function:

static void create_lightgc ( Widget  self) [static]

Definition at line 175 of file xwFrame.c.

{
    XtGCMask mask=0;
    XGCValues values;

    if (((XfwfFrameWidget)self)->xfwfFrame.lightgc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.lightgc);
    switch (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme) {
    case XfwfColor:
        mask = GCForeground;
        values.foreground = ((XfwfFrameWidget)self)->xfwfFrame.topShadowColor;
        break;
    case XfwfStipple:
        mask = GCFillStyle | GCStipple | GCForeground | GCBackground;
        values.fill_style = FillOpaqueStippled;
        values.background = ((XfwfFrameWidget)self)->core.background_pixel;
        values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple ? ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple : GetGray(self);
        values.foreground = WhitePixelOfScreen(XtScreen(self));
        break;
    case XfwfBlack:
       mask = GCForeground;
       values.foreground = BlackPixelOfScreen(XtScreen(self));
       break;
    case XfwfAuto:
       {
         int ok;
         if (DefaultDepthOfScreen(XtScreen(self)) > 4) {
           ok = ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground);
         } else
           ok = 0;
           
         if (ok) {
            mask = GCForeground;
         } else {
            mask = GCFillStyle | GCBackground | GCForeground | GCStipple;
            values.fill_style = FillOpaqueStippled;
            /* values.background = $background_pixel; */
            values.background = WhitePixelOfScreen(XtScreen(self));
            values.foreground = BlackPixelOfScreen(XtScreen(self));
            values.stipple = GetLightGray(self);
         }
        }
        break;
    }
    ((XfwfFrameWidget)self)->xfwfFrame.lightgc = XtGetGC(self, mask, &values);
}

Here is the call graph for this function:

Boolean cvtFrameTypeToString ( Display *  display,
XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  from,
XrmValuePtr  to,
XtPointer *  converter_data 
)

Definition at line 773 of file xwFrame.c.

{
    if (*num_args != 0)
        XtAppErrorMsg(XtDisplayToApplicationContext(display),
                      "cvtFrameTypeToString", "wrongParameters",
                      "XtToolkitError",
                      "Fframe type to String conversion needs no arguments",
                      (String*) NULL, (Cardinal*) NULL);
    switch (*(FrameType*)from->addr) {
    case XfwfRaised: done(String, "raised");
    case XfwfSunken: done(String, "sunken");
    case XfwfChiseled: done(String, "chiseled");
    case XfwfLedged: done(String, "ledged");
    default: XtError("Illegal FrameType");
    }
    return FALSE;
}

Here is the caller graph for this function:

Boolean cvtShadowSchemeToString ( Display *  display,
XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  from,
XrmValuePtr  to,
XtPointer *  converter_data 
)

Definition at line 817 of file xwFrame.c.

{
    if (*num_args != 0)
        XtAppErrorMsg(XtDisplayToApplicationContext(display),
                      "cvtShadowSchemeToString", "wrongParameters",
                      "XtToolkitError",
                      "Shadow scheme to String conversion needs no arguments",
                      (String*) NULL, (Cardinal*) NULL);

    switch (*(ShadowScheme*)from->addr) {
    case XfwfAuto: done(String, "auto");
    case XfwfColor: done(String, "color");
    case XfwfStipple: done(String, "stipple");
    case XfwfPlain: done(String, "plain");
    default: XtError("Illegal ShadowScheme");
    }
    return FALSE;
}

Here is the caller graph for this function:

Boolean cvtStringToFrameType ( Display *  display,
XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  from,
XrmValuePtr  to,
XtPointer *  converter_data 
)

Definition at line 750 of file xwFrame.c.

{
    String s = (String) from->addr;

    if (*num_args != 0)
        XtAppErrorMsg(XtDisplayToApplicationContext(display),
                      "cvtStringToFrameType", "wrongParameters",
                      "XtToolkitError",
                      "String to frame type conversion needs no arguments",
                      (String*) NULL, (Cardinal*) NULL);

    if (XmuCompareISOLatin1(s, "raised") == 0) done(FrameType, XfwfRaised);
    if (XmuCompareISOLatin1(s, "sunken") == 0) done(FrameType, XfwfSunken);
    if (XmuCompareISOLatin1(s, "chiseled") == 0) done(FrameType, XfwfChiseled);
    if (XmuCompareISOLatin1(s, "ledged") == 0) done(FrameType, XfwfLedged);
    XtDisplayStringConversionWarning(display, s, XtRFrameType);
    done(FrameType, XfwfRaised);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Boolean cvtStringToShadowScheme ( Display *  display,
XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  from,
XrmValuePtr  to,
XtPointer *  converter_data 
)

Definition at line 795 of file xwFrame.c.

{
    String s = (String) from->addr;

    if (*num_args != 0)
        XtAppErrorMsg(XtDisplayToApplicationContext(display),
                      "cvtStringToShadowScheme", "wrongParameters",
                      "XtToolkitError",
                      "String to shadow scheme conversion needs no arguments",
                      (String*) NULL, (Cardinal*) NULL);

    if (XmuCompareISOLatin1(s, "auto")==0) done(ShadowScheme, XfwfAuto);
    if (XmuCompareISOLatin1(s, "color")==0) done(ShadowScheme, XfwfColor);
    if (XmuCompareISOLatin1(s, "stipple")==0) done(ShadowScheme, XfwfStipple);
    XtDisplayStringConversionWarning(display, s, XtRShadowScheme);
    done(ShadowScheme, XfwfAuto);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 449 of file xwFrame.c.

{
  if (((XfwfFrameWidget)self)->xfwfFrame.darkgc) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.darkgc); ((XfwfFrameWidget)self)->xfwfFrame.darkgc = NULL;
  if (((XfwfFrameWidget)self)->xfwfFrame.lightgc) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.lightgc); ((XfwfFrameWidget)self)->xfwfFrame.lightgc = NULL;
  if (((XfwfFrameWidget)self)->xfwfFrame.fggc) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.fggc); ((XfwfFrameWidget)self)->xfwfFrame.fggc = NULL;
}
static XtGeometryResult geometry_manager ( ) [static]
static XtGeometryResult geometry_manager ( Widget  child,
XtWidgetGeometry *  request,
XtWidgetGeometry *  reply 
) [static]

Definition at line 620 of file xwFrame.c.

{ Widget self = XtParent(child); {
    XtWidgetGeometry request2, reply2;
    XtGeometryResult result;
    Position x, y;
    int w, h, extraw, extrah;

    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
    if (! (request->request_mode & (CWWidth|CWHeight))) return XtGeometryYes;
    extraw = ((XfwfFrameWidget)self)->core.width - w;
    extrah = ((XfwfFrameWidget)self)->core.height - h;
    request2.request_mode = request->request_mode & (CWWidth|CWHeight);
    request2.width = request->width + extraw;
    request2.height = request->height + extrah;
    result = XtMakeGeometryRequest(self, &request2, &reply2);
    if (result == XtGeometryNo) return XtGeometryNo;
    if (result == XtGeometryYes) return XtGeometryYes;
    reply->request_mode = reply2.request_mode & (CWWidth|CWHeight);
    reply->width = reply2.width - extraw;
    reply->height = reply2.height - extrah;
    return XtGeometryAlmost;
}
}
Pixmap GetDarkGray ( Widget  self)

Definition at line 868 of file xwFrame.c.

{
  if (!((XfwfFrameWidget)self)->xfwfFrame.darkGray) {
    static char dark_bits[] = { 0x05, 0x03, 0x06};

    ((XfwfFrameWidget)self)->xfwfFrame.darkGray = XCreateBitmapFromData(XtDisplay(self), XtWindow(self),
        dark_bits, 3, 3);
  }
  return ((XfwfFrameWidget)self)->xfwfFrame.darkGray;
}

Here is the caller graph for this function:

Pixmap GetGray ( Widget  self)

Definition at line 840 of file xwFrame.c.

{
  if (!((XfwfFrameWidget)self)->xfwfFrame.gray) {
    ((XfwfFrameWidget)self)->xfwfFrame.gray = XCreateBitmapFromData(XtDisplay(self), XtWindow(self),
        wx_gray_bits, wx_gray_width, wx_gray_height);
  }
  return ((XfwfFrameWidget)self)->xfwfFrame.gray;
}

Here is the caller graph for this function:

Pixmap GetLightGray ( Widget  self)

Definition at line 853 of file xwFrame.c.

{
  if (!((XfwfFrameWidget)self)->xfwfFrame.lightGray) {
    static char light_bits[] = { 0x02, 0x04, 0x01};

    ((XfwfFrameWidget)self)->xfwfFrame.lightGray = XCreateBitmapFromData(XtDisplay(self), XtWindow(self),
        light_bits, 3, 3);
  }
  return ((XfwfFrameWidget)self)->xfwfFrame.lightGray;
}

Here is the caller graph for this function:

static void initialize ( ) [static]
static void initialize ( Widget  request,
Widget  self,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 412 of file xwFrame.c.

{
    Dimension frame;

    ((XfwfFrameWidget)self)->xfwfFrame.lightgc = NULL;
    ((XfwfFrameWidget)self)->xfwfFrame.darkgc = NULL;
    ((XfwfFrameWidget)self)->xfwfFrame.fggc = NULL;
    ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type = ((XfwfFrameWidget)self)->xfwfFrame.frameType;
    /* Make sure the width and height are at least as large as the frame */
    frame = ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
    if (((XfwfFrameWidget)self)->core.width < 2 * frame) ((XfwfFrameWidget)self)->core.width = 2 * frame;
    if (((XfwfFrameWidget)self)->core.height < 2 * frame) ((XfwfFrameWidget)self)->core.height = 2 * frame;
}
static XtGeometryResult query_geometry ( ) [static]
static XtGeometryResult query_geometry ( Widget  self,
XtWidgetGeometry *  request,
XtWidgetGeometry *  reply 
) [static]

Definition at line 573 of file xwFrame.c.

{
    XtWidgetGeometry request2, reply2;
    XtGeometryResult result;
    Dimension h;

    if (((XfwfFrameWidget)self)->composite.num_children == 0) return XtGeometryYes;

    /* We're only interested in size and stacking order */
    reply->request_mode =
        (CWWidth | CWHeight | CWStackMode) & request->request_mode;

    /* If nothing of interest is left, we can return immediately */
    if (reply->request_mode == 0)
        return XtGeometryYes;

    /* Prepare a request to the child */
    h = 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset);
    request2.request_mode = reply->request_mode;
    request2.width = request->width - h;
    request2.height = request->height - h;
    request2.sibling = request->sibling;
    request2.stack_mode = request->stack_mode;

    result = XtQueryGeometry(((XfwfFrameWidget)self)->composite.children[0], &request2, &reply2);

    /* If the child accepted its proposal, we accept ours */
    if (result == XtGeometryYes) return XtGeometryYes;

    /* If the child doesn't want any change, we don't want any, either */
    if (result == XtGeometryNo) return XtGeometryNo;

    /* Otherwise, ignore everything but size and stacking order */
    reply->request_mode &= reply2.request_mode;
    if (reply->request_mode == 0) return XtGeometryYes;

    reply->width = reply2.width + h;
    reply->height = reply2.height + h;
    reply->sibling = reply2.sibling;
    reply->stack_mode = reply2.stack_mode;
    return XtGeometryAlmost;
}

Here is the call graph for this function:

static void realize ( ) [static]
static void realize ( Widget  self,
XtValueMask *  mask,
XSetWindowAttributes *  attributes 
) [static]

Definition at line 430 of file xwFrame.c.

{
    *mask |= CWCursor;
    attributes->cursor = ((XfwfFrameWidget)self)->xfwfFrame.cursor;
    xfwfCommonClassRec.core_class.realize(self, mask, attributes);

    ((XfwfFrameWidget)self)->xfwfFrame.gray = (Pixmap)NULL;
    ((XfwfFrameWidget)self)->xfwfFrame.lightGray = (Pixmap)NULL;
    ((XfwfFrameWidget)self)->xfwfFrame.darkGray = (Pixmap)NULL;

    create_lightgc(self);
    create_darkgc(self);
    create_fggc(self);
}

Here is the call graph for this function:

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

Definition at line 648 of file xwFrame.c.

{
    Position x, y;
    int w, h;
    Widget child;

    if (((XfwfFrameWidget)self)->composite.num_children == 0) return;
    ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
    child = ((XfwfFrameWidget)self)->composite.children[0];
    w -= 2 * ((XfwfFrameWidget)child)->core.border_width;
    h -= 2 * ((XfwfFrameWidget)child)->core.border_width;
    XtConfigureWidget(child, x, y, max(1, w), max(1, h), ((XfwfFrameWidget)child)->core.border_width);
}
static void set_shadow ( ) [static]
static void set_shadow ( Widget  self,
XEvent*  event,
String*  params,
Cardinal*  num_params 
) [static]

Definition at line 345 of file xwFrame.c.

{
    Position x, y;
    int w, h;
    FrameType f = XfwfSunken;

    if (*num_params == 0) f = ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type;  /* Reset to old style */
    else if (strcmp("raised", params[0]) == 0) f = XfwfRaised;
    else if (strcmp("sunken", params[0]) == 0) f = XfwfSunken;
    else if (strcmp("chiseled", params[0]) == 0) f = XfwfChiseled;
    else if (strcmp("ledged", params[0]) == 0) f = XfwfLedged;
    else XtWarning("Unknown frame type in set_shadow action");

    if (((XfwfFrameWidget)self)->xfwfFrame.frameType != f) {
        ((XfwfFrameWidget)self)->xfwfFrame.frameType = f;
        xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
       w -= 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset;
       h -= 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset;
        XfwfDrawFrame(self, x + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, y + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset,
                      max(w, 0), max(h, 0),
                      ((XfwfFrameWidget)self)->xfwfFrame.frameType, ((XfwfFrameWidget)self)->xfwfFrame.frameWidth, ((XfwfFrameWidget)self)->xfwfFrame.lightgc, ((XfwfFrameWidget)self)->xfwfFrame.darkgc, ((XfwfFrameWidget)self)->xfwfFrame.fggc);
    }
}

Here is the call graph for this function:

static Boolean set_values ( ) [static]
static Boolean set_values ( Widget  old,
Widget  request,
Widget  self,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 460 of file xwFrame.c.

{
    Boolean need_redisplay = False;

    if (((XfwfFrameWidget)self)->xfwfFrame.cursor != ((XfwfFrameWidget)old)->xfwfFrame.cursor && XtIsRealized(self))
        XDefineCursor(XtDisplay(self), XtWindow(self), ((XfwfFrameWidget)self)->xfwfFrame.cursor);

    if (((XfwfFrameWidget)self)->xfwfFrame.frameType == XfwfChiseled || ((XfwfFrameWidget)self)->xfwfFrame.frameType == XfwfLedged)
        ((XfwfFrameWidget)self)->xfwfFrame.frameWidth = 2 * ((int) (((XfwfFrameWidget)self)->xfwfFrame.frameWidth / 2));

    if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme     != ((XfwfFrameWidget)old)->xfwfFrame.shadowScheme
    ||  ((XfwfFrameWidget)self)->core.background_pixel != ((XfwfFrameWidget)old)->core.background_pixel) {
        create_darkgc(self);
        create_lightgc(self);
        create_fggc(self);
        need_redisplay = True;
    } else if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme == XfwfColor) {
        if (((XfwfFrameWidget)self)->xfwfFrame.topShadowColor != ((XfwfFrameWidget)old)->xfwfFrame.topShadowColor) {
            create_lightgc(self);
            need_redisplay = True;
        }
        if (((XfwfFrameWidget)self)->xfwfFrame.bottomShadowColor != ((XfwfFrameWidget)old)->xfwfFrame.bottomShadowColor) {
            create_darkgc(self);
            need_redisplay = True;
        }
    } else if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme == XfwfStipple) {
        if (((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple != ((XfwfFrameWidget)old)->xfwfFrame.topShadowStipple) {
            create_lightgc(self);
            need_redisplay = True;
        }
        if (((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple != ((XfwfFrameWidget)old)->xfwfFrame.bottomShadowStipple) {
            create_darkgc(self);
            need_redisplay = True;
        }
    }

    if (((XfwfFrameWidget)self)->xfwfFrame.outerOffset != ((XfwfFrameWidget)old)->xfwfFrame.outerOffset)
        need_redisplay = True;

    if (((XfwfFrameWidget)self)->xfwfFrame.innerOffset != ((XfwfFrameWidget)old)->xfwfFrame.innerOffset)
        need_redisplay = True;

    if (((XfwfFrameWidget)self)->xfwfFrame.frameType != ((XfwfFrameWidget)old)->xfwfFrame.frameType) {
        ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type = ((XfwfFrameWidget)self)->xfwfFrame.frameType;
        need_redisplay = True;
    }

    if (((XfwfFrameWidget)self)->xfwfFrame.frameWidth != ((XfwfFrameWidget)old)->xfwfFrame.frameWidth)
        need_redisplay = True;
    else if (((XfwfFrameWidget)self)->xfwfFrame.frameWidth == 0)
        need_redisplay = False;

    return need_redisplay;
}

Here is the call graph for this function:

static Dimension total_frame_width ( ) [static]
static Dimension total_frame_width ( Widget  self) [static]

Definition at line 564 of file xwFrame.c.

{
    return xfwfCommonClassRec.xfwfCommon_class.total_frame_width(self) + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset ;
}
void XfwfDrawFrame ( Widget  self,
int  x,
int  y,
int  w,
int  h,
FrameType  tp,
int  t,
GC  lightgc,
GC  darkgc,
GC  fggc 
)

Definition at line 691 of file xwFrame.c.

{
    XPoint tlPoints[7], brPoints[7];

    if (t == 0) return;
    switch (tp) {
    case XfwfPlain:
       XDrawRectangle(XtDisplay(self), XtWindow(self), darkgc, x+1, y+1, w-1, h-1);
       break;
    case XfwfRaised:
    case XfwfSunken:
        tlPoints[0].x = x;              tlPoints[0].y = y;
        tlPoints[1].x = x + w;          tlPoints[1].y = y;
        tlPoints[2].x = x + w - t;      tlPoints[2].y = y + t;
        tlPoints[3].x = x + t;          tlPoints[3].y = y + t;
        tlPoints[4].x = x + t;          tlPoints[4].y = y + h - t;
        tlPoints[5].x = x;              tlPoints[5].y = y + h;
        tlPoints[6].x = x;              tlPoints[6].y = y;
        brPoints[0].x = x + w;          brPoints[0].y = y + h;
        brPoints[1].x = x;              brPoints[1].y = y + h;
        brPoints[2].x = x + t;          brPoints[2].y = y + h - t;
        brPoints[3].x = x + w - t;      brPoints[3].y = y + h - t;
        brPoints[4].x = x + w - t;      brPoints[4].y = y + t;
        brPoints[5].x = x + w;          brPoints[5].y = y;
        brPoints[6].x = x + w;          brPoints[6].y = y + h;
        if (tp == XfwfSunken) {
            XFillPolygon(XtDisplay(self), XtWindow(self),
                         darkgc, tlPoints, 7, Nonconvex, CoordModeOrigin);
            XFillPolygon(XtDisplay(self), XtWindow(self),
                         lightgc, brPoints, 7, Nonconvex, CoordModeOrigin);
        } else {
            XFillPolygon(XtDisplay(self), XtWindow(self),
                         lightgc, tlPoints, 7, Nonconvex, CoordModeOrigin);
            XFillPolygon(XtDisplay(self), XtWindow(self),
                         darkgc, brPoints, 7, Nonconvex, CoordModeOrigin);
        }
       if (fggc)
         XDrawRectangle(XtDisplay(self), XtWindow(self), fggc, x, y, w-1, h-1);
        break;
    case XfwfLedged:
        XfwfDrawFrame(self, x, y, w, h, XfwfRaised, t/2, lightgc, darkgc, NULL);
        XfwfDrawFrame(self, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2),
                  XfwfSunken, t/2, lightgc, darkgc, NULL);
        break;
    case XfwfChiseled:
        XfwfDrawFrame(self, x, y, w, h, XfwfSunken, t/2, lightgc, darkgc, NULL);
        XfwfDrawFrame(self, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2),
                  XfwfRaised, t/2, lightgc, darkgc, NULL);
        break;
    case XfwfNothing:
        break;
    }

}

Here is the caller graph for this function:


Variable Documentation

XtActionsRec actionsList[] [static]
Initial value:
 {
{"set_shadow", set_shadow},
}

Definition at line 18 of file xwFrame.c.

XtResource resources[] [static]
Initial value:
 {
{XtNcursor,XtCCursor,XtRCursor,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.cursor),XtOffsetOf(XfwfFrameRec,xfwfFrame.cursor),XtRImmediate,(XtPointer)None },
{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfFrameRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfRaised },
{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfFrameRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)0 },
{XtNouterOffset,XtCOuterOffset,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.outerOffset),XtOffsetOf(XfwfFrameRec,xfwfFrame.outerOffset),XtRImmediate,(XtPointer)0 },
{XtNinnerOffset,XtCInnerOffset,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.innerOffset),XtOffsetOf(XfwfFrameRec,xfwfFrame.innerOffset),XtRImmediate,(XtPointer)0 },
{XtNshadowScheme,XtCShadowScheme,XtRShadowScheme,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.shadowScheme),XtOffsetOf(XfwfFrameRec,xfwfFrame.shadowScheme),XtRImmediate,(XtPointer)XfwfAuto },
{XtNtopShadowColor,XtCTopShadowColor,XtRPixel,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.topShadowColor),XtOffsetOf(XfwfFrameRec,xfwfFrame.topShadowColor),XtRCallProc,(XtPointer)compute_topcolor },
{XtNbottomShadowColor,XtCBottomShadowColor,XtRPixel,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.bottomShadowColor),XtOffsetOf(XfwfFrameRec,xfwfFrame.bottomShadowColor),XtRCallProc,(XtPointer)compute_bottomcolor },
{XtNtopShadowStipple,XtCTopShadowStipple,XtRBitmap,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.topShadowStipple),XtOffsetOf(XfwfFrameRec,xfwfFrame.topShadowStipple),XtRImmediate,(XtPointer)NULL },
{XtNbottomShadowStipple,XtCBottomShadowStipple,XtRBitmap,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.bottomShadowStipple),XtOffsetOf(XfwfFrameRec,xfwfFrame.bottomShadowStipple),XtRImmediate,(XtPointer)NULL },
{XtNborderWidth,XtCBorderWidth,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->core.border_width),XtOffsetOf(XfwfFrameRec,core.border_width),XtRImmediate,(XtPointer)0 },
}

Definition at line 267 of file xwFrame.c.

Definition at line 281 of file xwFrame.c.

WidgetClass xfwfFrameWidgetClass = (WidgetClass) &xfwfFrameClassRec

Definition at line 343 of file xwFrame.c.