X11 Work Bench Toolkit  1.0
'Window Dressing' Graphics Drawing Utilities

Data Structures

struct  __WB_SCROLLINFO__
 Structure that defines scroll bar info for both horizontal and vertical scroll bars. More...
 

Typedefs

typedef struct __WB_SCROLLINFO__ WB_SCROLLINFO
 Structure that defines scroll bar info for both horizontal and vertical scroll bars. More...
 

Enumerations

enum  WBScrollState_ENUM {
  WBScrollState_LDRAG = 1, WBScrollState_RDRAG = 2, WBScrollState_MDRAG = 4, WBScrollState_HLDRAG = 8,
  WBScrollState_HRDRAG = 16, WBScrollState_HMDRAG = 32
}
 

Functions

static __inline__ void WBInitScrollInfo (WB_SCROLLINFO *pSI)
 Initialization function for a 'WB_SCROLLINFO' structure. More...
 
void WBSetVScrollRange (WB_SCROLLINFO *pSI, int iMin, int iMax)
 Set the scroll range for a vertical scrollbar in the WB_SCROLLINFO structure. More...
 
void WBSetHScrollRange (WB_SCROLLINFO *pSI, int iMin, int iMax)
 Set the scroll range for a horizontal scrollbar in the WB_SCROLLINFO structure. More...
 
void WBSetVScrollPos (WB_SCROLLINFO *pSI, int iPos)
 Set the scroll range for a vertical scrollbar in the WB_SCROLLINFO structure. More...
 
void WBSetHScrollPos (WB_SCROLLINFO *pSI, int iPos)
 Set the scroll range for a horizontal scrollbar in the WB_SCROLLINFO structure. More...
 
void WBUpdateScrollBarGeometry (WB_SCROLLINFO *pSI, XFontSet fontSetRef, WB_GEOM *pgeomClient, WB_GEOM *pgeomUsable)
 Update the scroll bar geometry within the WB_SCROLLINFO structure. More...
 
int WBCalcVScrollDragPos (WB_SCROLLINFO *pScrollInfo, int iY)
 Calculate and assign the correct vertical scroll bar position from mouse coordinates. More...
 
int WBCalcHScrollDragPos (WB_SCROLLINFO *pScrollInfo, int iX)
 Calculate and assign the correct horizontal scroll bar position from mouse coordinates. More...
 
void WBCalcVScrollBar (WB_SCROLLINFO *pScrollInfo, WB_GEOM *pgeomClient, int iVScrollWidth, int iHScrollHeight, int nListItems, int nPos)
 Calculate the parameters for a vertical scroll bar. More...
 
void WBCalcHScrollBar (WB_SCROLLINFO *pScrollInfo, WB_GEOM *pgeomClient, int iVScrollWidth, int iHScrollHeight, int nListItems, int nPos)
 Calculate the parameters for a horizontal scroll bar. More...
 
void WBPaintVScrollBar (WB_SCROLLINFO *pScrollInfo, Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomClient)
 Paint the vertical scroll bar within a window based on WB_SCROLLINFO. More...
 
void WBPaintHScrollBar (WB_SCROLLINFO *pScrollInfo, Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomClient)
 Paint the horizontal scroll bar within a window based on WB_SCROLLINFO. More...
 
void WBDrawBorderRect (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor)
 Draw a 'border' rectangle. More...
 
void WBDraw3DBorderRect (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor1, unsigned long lBorderColor2)
 Draw a 3D 'border' rectangle. More...
 
void WBDrawDashedRect (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor)
 Draw a 'dashed' rectangle. More...
 
void WBDrawLeftArrow (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor)
 Draw a left arrow in a window within a specified geometry. More...
 
void WBDrawRightArrow (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor)
 Draw a right arrow in a window within a specified geometry. More...
 
void WBDrawUpArrow (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor)
 Draw an up arrow in a window within a specified geometry. More...
 
void WBDrawDownArrow (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor)
 Draw a down arrow in a window within a specified geometry. More...
 
void WBDraw3DBorderTab (Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomOutline, int fFocus, unsigned long lFGColor, unsigned long lBGColor, unsigned long lBorderColor1, unsigned long lBorderColor2, unsigned long lHighlightColor, XFontSet fontSet, XFontSet fontSetBold, Atom aGraphic, const char *szText)
 Draw a 'tab' within a specified 'outline' rectangle. More...
 

Detailed Description

GC Utility functions for drawing 'Window Dressing', i.e. various standard windows components

GC Utility functions for drawing various standard window components, collectively known here as 'Window Dressing'. This includes scroll bars, 3D effects, rectangles, tabs, buttons, and other 'standard' components of modern GUI interfaces.

Typedef Documentation

Structure that defines scroll bar info for both horizontal and vertical scroll bars.

This structure defines the scroll bar information for both vertical and horizontal scroll bars. You can have both a horizontal AND a vertical scroll bar at the same time. This structure is maintained by various API functions, particularly WBUpdateScrollBarGeometry().

typedef struct __WB_SCROLLINFO__
{
int iScrollState; // scroll state flags - see enumeration \ref WBScrollState_ENUM
// fixed dimension sizes - 0 if not known, else based on owner client width/height
int iVScrollWidth; // calculated width of vertical scroll bar (in pixels); 0 if not known
int iHScrollHeight; // calculated height of horizontal scroll bar (in pixels); 0 if not known
int iVBarHeight; // calculated height of vertical scroll bar (re-calculate on window size change)
int iHBarWidth; // calculated width of horizontal scroll bar (re-calculate on window size change)
int iHKnob; // calculated relative X pixel position of horizontal scroll 'knob'
int iVKnob; // calculated relative Y pixel position of vertical scroll 'knob'
int iHKnobSize; // calculated pixel width of horizontal scroll 'knob'
int iVKnobSize; // calculated pixel height of vertical scroll 'knob'
int iHMin; // minimum horizontal range (0 if no bar)
int iHMax; // maximum horizontal range (0 if no bar)
int iVMin; // minimum vertical range (0 if no bar)
int iVMax; // maximum vertical range (0 if no bar)
int iHPos; // current horozontal scroll position (N/A if outside of min/max range)
int iVPos; // current vertical scroll position (N/A if outside of min/max range)
WB_GEOM geomHBar; // geometry for the horizontal scroll bar excluding border (empty if not visible)
WB_GEOM geomHLeft; // geometry for the horizontal scroll bar 'left' button (empty if not visible)
WB_GEOM geomHRight; // geometry for the horizontal scroll bar 'right' button (empty if not visible)
WB_GEOM geomHKnob; // geometry for the horizontal scroll bar 'knob' (empty if not visible)
WB_GEOM geomVBar; // geometry for the vertical scroll bar excluding border (empty if not visible)
WB_GEOM geomVUp; // geometry for the vertical scroll bar 'up' button (empty if not visible)
WB_GEOM geomVDown; // geometry for the vertical scroll bar 'down' button (empty if not visible)
WB_GEOM geomVKnob; // geometry for the vertical scroll bar 'knob' (empty if not visible)
See Also
WBInitScrollInfo(), WBUpdateScrollBarGeometry()

Enumeration Type Documentation

Enumeration of scroll state flags.

See Also
WB_SCROLLINFO
Enumerator
WBScrollState_LDRAG 

left button in 'drag' state on vertical scroll bar (relies on drag cancel)

WBScrollState_RDRAG 

right button in 'drag' state on vertical scroll bar

WBScrollState_MDRAG 

middle button in 'drag' state on vertical scroll bar

WBScrollState_HLDRAG 

left button in 'drag' state on horizontal scroll bar (relies on drag cancel)

WBScrollState_HRDRAG 

right button in 'drag' state on horizontal scroll bar

WBScrollState_HMDRAG 

middle button in 'drag' state on horizontal scroll bar

Definition at line 159 of file window_dressing.h.

Function Documentation

void WBCalcHScrollBar ( WB_SCROLLINFO pScrollInfo,
WB_GEOM pgeomClient,
int  iVScrollWidth,
int  iHScrollHeight,
int  nListItems,
int  nPos 
)

Calculate the parameters for a horizontal scroll bar.

Parameters
pScrollInfoA pointer to the WB_SCROLLINFO structure to be initialized
pgeomClientA pointer to the WB_GEOM for the client area
iVScrollWidthThe width of the vertical scroll bar in pixels
iHScrollHeightThe height of the horizontal scroll bar in pixels
nListItemsThe number of items in a list of scrollable items
nPosThe current position within the list of scrollable items

Use this function to re-calculate the parameters associated with a horizontal scroll bar

Header File: window_dressing.h

Definition at line 281 of file window_dressing.c.

int WBCalcHScrollDragPos ( WB_SCROLLINFO pScrollInfo,
int  iX 
)

Calculate and assign the correct horizontal scroll bar position from mouse coordinates.

Parameters
pScrollInfoA pointer to the WB_SCROLLINFO structure
iXThe mouse X coordinate from the most recent Motion event

Use this function to calculate and assign the correct 'scroll position' for a horizontal scroll bar that is managed by a WB_SCROLLINFO structure

Header File: window_dressing.h

Definition at line 384 of file window_dressing.c.

void WBCalcVScrollBar ( WB_SCROLLINFO pScrollInfo,
WB_GEOM pgeomClient,
int  iVScrollWidth,
int  iHScrollHeight,
int  nListItems,
int  nPos 
)

Calculate the parameters for a vertical scroll bar.

Parameters
pScrollInfoA pointer to the WB_SCROLLINFO structure to be initialized
pgeomClientA pointer to the WB_GEOM for the client area
iVScrollWidthThe width of the vertical scroll bar in pixels
iHScrollHeightThe height of the horizontal scroll bar in pixels
nListItemsThe number of items in a list of scrollable items
nPosThe current position within the list of scrollable items

Use this function to re-calculate the parameters associated with a vertical scroll bar

Header File: window_dressing.h

Definition at line 389 of file window_dressing.c.

int WBCalcVScrollDragPos ( WB_SCROLLINFO pScrollInfo,
int  iY 
)

Calculate and assign the correct vertical scroll bar position from mouse coordinates.

Parameters
pScrollInfoA pointer to the WB_SCROLLINFO structure
iYThe mouse Y coordinate from the most recent Motion event

Use this function to calculate and assign the correct 'scroll position' for a vertical scroll bar that is managed by a WB_SCROLLINFO structure

Header File: window_dressing.h

Definition at line 339 of file window_dressing.c.

void WBDraw3DBorderRect ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomBorder,
unsigned long  lBorderColor1,
unsigned long  lBorderColor2 
)

Draw a 3D 'border' rectangle.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomBorderA WB_GEOM that identifies the border rectangle to draw
lBorderColor1A 'Pixel' color value to use when painting the border (upper, left)
lBorderColor2A 'Pixel' color value to use when painting the border (lower, right)

Use this function to draw a 3D border rectangle in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 580 of file window_dressing.c.

void WBDraw3DBorderTab ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomOutline,
int  fFocus,
unsigned long  lFGColor,
unsigned long  lBGColor,
unsigned long  lBorderColor1,
unsigned long  lBorderColor2,
unsigned long  lHighlightColor,
XFontSet  fontSet,
XFontSet  fontSetBold,
Atom  aGraphic,
const char *  szText 
)

Draw a 'tab' within a specified 'outline' rectangle.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomOutlineA WB_GEOM that identifies the rectangular border of the tab to draw
fFocusA flag value that indicates whether or not this tab has the 'focus', and whether or not the 'x' is being 'pressed'.

A value of 0 indicates 'no focus'. A positive value is 'focus'.

A negative value generally indicates 'pressing the "x" button'. Specifically, a -1 indicates 'focus', and any other negative value indicates 'no focus' while pressing the 'x'. This is necessary to properly implement UI feedback for the tab. Clicking 'x' does not imply getting the focus.
lFGColorThe current 'foreground' 'Pixel' color for text and borders
lBGColorThe current 'background' 'Pixel' color for areas outside of the tab
lBorderColor1The upper, left 'Pixel' color to use when drawing the tab
lBorderColor2The lower, right 'Pixel' color to use when drawing the tab
lHighlightColorThe 'highlight' 'Pixel' color to use for a tab that has the focus
fontSetThe 'normal' font to render text in
fontSetBoldThe 'bold' font to render text in (this includes the 'x' close button on the tab)
aGraphicAn atom for the current (registered) pixmap graphic, or 'None' for no graphic
szTextA const pointer to a character string containing the descriptive text for the tab

Use this function to draw a tab within the specified 'Outline' geometry, in the specified Window, with the specified colors, graphic, and text.
Tabs are drawn differently when they have focus, so 'bFocus' determines whether or not the tab currently has focus. Non-focus tabs are greyish in appearance, whereas focus tabs have the 'Highlight Color' applied to them. A Highlight Color of 'WHITE' should be used whenever you do not want special colorization based on focus. Additional 'focus' tab characteristics include painting the background color across the bottom line, so that any 3D rectangle that was previously drawn will be overwritten underneath the tab.

For proper appearance, the 'focus' tab should be drawn last, and tabs should be drawn from right to left.

Header File: window_dressing.h

Definition at line 885 of file window_dressing.c.

void WBDrawBorderRect ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomBorder,
unsigned long  lBorderColor 
)

Draw a 'border' rectangle.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomBorderA WB_GEOM that identifies the border rectangle to draw
lBorderColorA 'Pixel' color value to use when painting the border

Use this function to draw a border rectangle in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 550 of file window_dressing.c.

void WBDrawDashedRect ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomRect,
unsigned long  lColor 
)

Draw a 'dashed' rectangle.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomRectA WB_GEOM that identifies the rectangle to draw
lColorA 'Pixel' color value to use when painting the dashed rectangle

Use this function to draw a border rectangle in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 663 of file window_dressing.c.

void WBDrawDownArrow ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomRect,
unsigned long  lColor 
)

Draw a down arrow in a window within a specified geometry.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomRectA WB_GEOM that identifies the rectangle within which to draw the arrow
lColorA 'Pixel' color value to use when painting the arrow as a polygon

Use this function to draw a down arrow in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 855 of file window_dressing.c.

void WBDrawLeftArrow ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomRect,
unsigned long  lColor 
)

Draw a left arrow in a window within a specified geometry.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomRectA WB_GEOM that identifies the rectangle within which to draw the arrow
lColorA 'Pixel' color value to use when painting the arrow as a polygon

Use this function to draw a left arrow in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 766 of file window_dressing.c.

void WBDrawRightArrow ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomRect,
unsigned long  lColor 
)

Draw a right arrow in a window within a specified geometry.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomRectA WB_GEOM that identifies the rectangle within which to draw the arrow
lColorA 'Pixel' color value to use when painting the arrow as a polygon

Use this function to draw a right arrow in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 825 of file window_dressing.c.

void WBDrawUpArrow ( Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomRect,
unsigned long  lColor 
)

Draw an up arrow in a window within a specified geometry.

Parameters
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomRectA WB_GEOM that identifies the rectangle within which to draw the arrow
lColorA 'Pixel' color value to use when painting the arrow as a polygon

Use this function to draw an up arrow in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 796 of file window_dressing.c.

static __inline__ void WBInitScrollInfo ( WB_SCROLLINFO pSI)
static

Initialization function for a 'WB_SCROLLINFO' structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure to be initialized

Use this function to initialize a WB_SCROLLINFO structure in a standardized way

Header File: window_dressing.h

Definition at line 179 of file window_dressing.h.

void WBPaintHScrollBar ( WB_SCROLLINFO pScrollInfo,
Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomClient 
)

Paint the horizontal scroll bar within a window based on WB_SCROLLINFO.

Parameters
pScrollInfoA pointer to the WB_SCROLLINFO structure to be initialized
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomClientA pointer to the WB_GEOM for the client area

Use this function to paint the horizontal scroll bar within the specified window, based on WB_SCROLLINFO

Header File: window_dressing.h

Definition at line 727 of file window_dressing.c.

void WBPaintVScrollBar ( WB_SCROLLINFO pScrollInfo,
Display *  pDisplay,
Drawable  wID,
GC  gc,
WB_GEOM pgeomClient 
)

Paint the vertical scroll bar within a window based on WB_SCROLLINFO.

Parameters
pScrollInfoA pointer to the WB_SCROLLINFO structure to be initialized
pDisplayA pointer to the current display (or NULL to use the default Display)
wIDthe Drawable, typically the Window ID for the target window
gcThe GC (graphics context) to use
pgeomClientA pointer to the WB_GEOM for the client area

Use this function to paint the vertical scroll bar within the specified window, based on WB_SCROLLINFO

Header File: window_dressing.h

Definition at line 688 of file window_dressing.c.

void WBSetHScrollPos ( WB_SCROLLINFO pSI,
int  iPos 
)

Set the scroll range for a horizontal scrollbar in the WB_SCROLLINFO structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure
iPosThe new scroll position

Use this function to assign the correct 'scroll position' for a horizontal scroll bar that is managed by a WB_SCROLLINFO structure

Header File: window_dressing.h

void WBSetHScrollRange ( WB_SCROLLINFO pSI,
int  iMin,
int  iMax 
)

Set the scroll range for a horizontal scrollbar in the WB_SCROLLINFO structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure
iMinThe minimum scroll value
iMaxThe maximum scroll value

Use this function to assign the correct 'scroll range' for a horizontal scroll bar that is managed by a WB_SCROLLINFO structure.

Header File: window_dressing.h

void WBSetVScrollPos ( WB_SCROLLINFO pSI,
int  iPos 
)

Set the scroll range for a vertical scrollbar in the WB_SCROLLINFO structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure
iPosThe new scroll position

Use this function to assign the correct 'scroll position' for a vertical scroll bar that is managed by a WB_SCROLLINFO structure

Header File: window_dressing.h

void WBSetVScrollRange ( WB_SCROLLINFO pSI,
int  iMin,
int  iMax 
)

Set the scroll range for a vertical scrollbar in the WB_SCROLLINFO structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure
iMinThe minimum scroll value
iMaxThe maximum scroll value

Use this function to assign the correct 'scroll range' for a vertical scroll bar that is managed by a WB_SCROLLINFO structure

Header File: window_dressing.h

void WBUpdateScrollBarGeometry ( WB_SCROLLINFO pSI,
XFontSet  fontSetRef,
WB_GEOM pgeomClient,
WB_GEOM pgeomUsable 
)

Update the scroll bar geometry within the WB_SCROLLINFO structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure
fontSetRefThe reference font set for scroll bar size. Pass None to use the 'Default' font set.
pgeomClientThe geometry of the client area where the scroll bars will be displayed.
pgeomUsableReturns the resulting 'usable' client area after scroll bar geometry calculations are done.

Use this function to assign the correct 'scroll position' for a vertical scroll bar that is managed by a WB_SCROLLINFO structure

Header File: window_dressing.h