SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

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

Section: Free Widget Foundation (3)
Updated:
Index 

NAME

XfwfToggle 

DESCRIPTION

The XfwfToggle is a button that switches states with every activation(which is by default with every mouse click). The states are named `on' and`off'. The states can be indicated with a $urd$ before the label Twocallbacks report the changed state to the application: onCallback is calledwhen the button switches to `on', offCallback is called when the buttonswitches back to `off'.

 

Public variables

XfwfToggle
NameClassTypeDefault
XtNonCallbackXtCOnCallbackCallbackNULL
XtNoffCallbackXtCOffCallbackCallbackNULL
XtNonXtCOnBoolean False
XtNonIconXtCOnIconIcon *"filledsquare"
XtNoffIconXtCOffIconIcon *"emptysquare"

XtNonCallback
The onCallback is called by the toggle action or by the switch_onaction, if the previous state was `off'. The call_data argument will containthe XEvent pointer that trigerred the action function.

        

<Callback> XtCallbackList onCallback = NULL

XtNoffCallback
The offCallback is called from the toggle or switch_off action, if theprevious state was `on'. The call_data argument will be a pointer to theXEvent that caused the action.

        

<Callback> XtCallbackList offCallback = NULL

XtNon
The variable on records the state of the widget: True means `on' andFalse means `off'.

        

Boolean on = False

XtNonIcon
By default, the button displays a $urd$ when on and nothing whenoff. The two resources onIcon and offPIcon can replace thesetwo graphics with arbitrary pixmaps. Suggested size for these pixmapsis about $16 imes18$.

        

Icon * onIcon = <String>"filledsquare"

XtNoffIcon
The offIcon is displayed when the button is in `off' state. Bydefault, nothing is displayed in this state.

        

Icon * offIcon = <String>"emptysquare"

XfwfButton
NameClassTypeDefault
XtNactivateXtCActivateCallbackNULL
XtNenterXtCEnterCallbackNULL
XtNleaveXtCLeaveCallbackNULL

XfwfLabel
NameClassTypeDefault
XtNlabelXtCLabelString NULL
XtNtablistXtCTablistString NULL
XtNfontXtCFontFontStructXtDefaultFont
XtNforegroundXtCForegroundPixel XtDefaultForeground
XtNhlForegroundXtCHlForegroundPixel XtDefaultForeground
XtNalignmentXtCAlignmentAlignment 0
XtNtopMarginXtCTopMarginDimension 2
XtNbottomMarginXtCBottomMarginDimension 2
XtNleftMarginXtCLeftMarginDimension 2
XtNrightMarginXtCRightMarginDimension 2
XtNshrinkToFitXtCShrinkToFitBoolean False
XtNrvStartXtCRvStartInt 0
XtNrvLengthXtCRvLengthInt 0
XtNhlStartXtCHlStartInt 0
XtNhlLengthXtCHlLengthInt 0

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

 

Translations

The toggle action toggles the widget between `on' and `off'. Bydefault it is bound to a click of the left mouse button as well as tothe Return key.

        

<Btn1Down>: set_shadow(sunken) 

<Btn1Up>: toggle() set_shadow() 

<Key>Return: toggle() 

 

Actions

toggle

The toggle action switches the state. Depending on the resourcesit might change the tickmark. The onCallback or offCallbackfunctions are called, with the event as call_data argument.

void toggle($, XEvent* event, String* params, Cardinal* num_params){    XtVaSetValues($, "on", !$on, NULL);    XtCallCallbackList($, $on ? $onCallback : $offCallback, event);}

switch_on

The switch_on action switches the button to `on' if it is `off',otherwise it does nothing. By default it isn't bound to any event. Ifthe widget is changed, the onCallback is called with the event ascall_data.

void switch_on($, XEvent* event, String* params, Cardinal* num_params){    if (! $on) {        XtVaSetValues($, "on", True, NULL);        XtCallCallbackList($, $onCallback, event);    }}

switch_off

The switch_off action switches the widget to `off' if the state is`on', otherwise it does nothing. When the widget changes states, theoffCallback is called, with a pointer to the XEvent structure ascall_data argument.

void switch_off($, XEvent* event, String* params, Cardinal* num_params){    if ($on) {        XtVaSetValues($, "on", False, NULL);        XtCallCallbackList($, $offCallback, event);    }}

 

Importss

The Converters file is needed for the Icon type.

incl <Xfwf/Converters.h>

 

Private variables

The on_gc GC holds the picture of the tick mark for the `on'state.

        

GC  on_gc

The off_gc holds the picture for the `off' state.

        

GC  off_gc

The previous value of leftMargin is stored in a private variable.This value is added to the width of the widest pixmap to give the newvalue of leftMargin.

        

Dimension  saveLeftMargin

 

Methods

The GC's are created for the first time and the left margin isincreased to make room for the on and off icons.

initialize(Widget  request, $, ArgList  args, Cardinal * num_args){    int status;    Dimension w1, w2, w;    $on_gc = NULL;    $off_gc = NULL;    create_on_gc($);    create_off_gc($);    w1 = $onIcon ? $onIcon->attributes.width : 0;    w2 = $offIcon ? $offIcon->attributes.width : 0;    w = max(w1, w2);    if (w != 0) XtVaSetValues($, XtNleftMargin, $leftMargin + w, NULL);}

Question: Does the computation of leftMargin have the desiredeffect? Since set_values is downward chained, the Label widget hasalready processed it; changing leftMargin doesn't cause Label torecompute the preferred sizeots

Boolean  set_values(Widget  old, Widget  request, $, ArgList  args, Cardinal * num_args){    Boolean redraw = False, compute_margin = False;    Dimension w1, w2, w;    if ($onIcon != $old$onIcon) {        create_on_gc($);        compute_margin = True;    }    if ($offIcon != $old$offIcon) {        create_off_gc($);        compute_margin = True;    }    if ($on != $old$on) {        redraw = True;    }    if (compute_margin) {        /* Compute w = old margin between icons and text */        w1 = $old$onIcon ? $old$onIcon->attributes.width : 0;        w2 = $old$offIcon ? $old$offIcon->attributes.width : 0;        w = $old$leftMargin - max(w1, w2);        /* Compute new left margin w = w + width of icons */        w1 = $onIcon ? $onIcon->attributes.width : 0;        w2 = $offIcon ? $offIcon->attributes.width : 0;        w = w + max(w1, w2);        if ($old$leftMargin != w) {            XtVaSetValues($, XtNleftMargin, w, NULL);            redraw = False;        } else            redraw = True;    }    return redraw;}

The expose method uses the expose method of the superclass to draw thebutton and then possibly adds a tick mark.

expose($, XEvent * event, Region  region){    Position x, y;    Dimension w, h;    if (! XtIsRealized($)) return;    #expose($, event, region);    $compute_inside($, x, y, w, h);    if ($on  $onIcon) {        y = y + (h - $onIcon->attributes.height)/2;        XSetTSOrigin(XtDisplay($), $on_gc, x, y);        XSetClipOrigin(XtDisplay($), $on_gc, x, y);        XFillRectangle(XtDisplay($), XtWindow($), $on_gc, x, y,                       $onIcon->attributes.width,                       $onIcon->attributes.height);    } else if ($offIcon) {        y = y + (h - $offIcon->attributes.height)/2;        XSetTSOrigin(XtDisplay($), $off_gc, x, y);        XSetClipOrigin(XtDisplay($), $off_gc, x, y);        XFillRectangle(XtDisplay($), XtWindow($), $off_gc, x, y,                       $offIcon->attributes.width,                       $offIcon->attributes.height);    }}

 

Utilities

The create_on_gc function creates a GC with the onIcon as tile.

create_on_gc($){    XtGCMask mask = GCFillStyle;    XGCValues values;    if ($on_gc != NULL) XtReleaseGC($, $on_gc);    if ($onIcon  $onIcon->pixmap != None) {        values.tile = $onIcon->pixmap;        mask |= GCTile;    }    if ($onIcon  $onIcon->mask != None) {        values.clip_mask = $onIcon->mask;        mask |= GCClipMask;    }    values.fill_style = FillTiled;    $on_gc = XtGetGC($, mask, values);}

The create_off_gc function creates a GC with the offIcon as tile.

create_off_gc($){    XtGCMask mask = GCFillStyle;    XGCValues values;    if ($off_gc != NULL) XtReleaseGC($, $off_gc);    if ($offIcon  $offIcon->pixmap != None) {        values.tile = $offIcon->pixmap;        mask |= GCTile;    }    if ($offIcon  $offIcon->mask != None) {        values.clip_mask = $offIcon->mask;        mask |= GCClipMask;    }    values.fill_style = FillTiled;    $off_gc = XtGetGC($, mask, values);}


 

Index

NAME
DESCRIPTION
Public variables
Translations
Actions
Importss
Private variables
Methods
Utilities

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