X11workbench Toolkit  1.0
'Window Dressing' Graphics Drawing Utilities

Data Structures

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

Typedefs

typedef struct tagWB_SCROLL_INFO 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...
 
int WBSetVScrollRange (WB_SCROLLINFO *pSI, int iMin, int iMax)
 Set the scroll range for a vertical scrollbar in the WB_SCROLLINFO structure. More...
 
int 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...
 
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 WBUpdateScrollBarGeometry (WB_SCROLLINFO *pSI, WB_FONTC pFontRef, WB_GEOM *pgeomClient, WB_GEOM *pgeomUsable)
 Update the scroll bar geometry within the WB_SCROLLINFO structure. More...
 
void WBInvalidateVScrollGeom (Window wID, WB_SCROLLINFO *pScrollInfo, int bAll, int bUpdate)
 Utility function to invalidate the geometry for the vertical scroll bar. More...
 
void WBInvalidateHScrollGeom (Window wID, WB_SCROLLINFO *pScrollInfo, int bAll, int bUpdate)
 Utility function to invalidate the geometry for the horizontal scroll bar. More...
 
int WBScrollBarEvent (Window wID, XEvent *pEvent, WB_SCROLLINFO *pScrollInfo)
 Event handler for scroll bars. More...
 
void WBPaintVScrollBar (WB_SCROLLINFO *pScrollInfo, Display *pDisplay, Drawable wID, WBGC 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, WBGC gc, WB_GEOM *pgeomClient)
 Paint the horizontal scroll bar within a window based on WB_SCROLLINFO. More...
 
void WBDrawBorderRect (Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor)
 Draw a 'border' rectangle. More...
 
void WBDraw3DBorderRect (Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor1, unsigned long lBorderColor2)
 Draw a 3D 'border' rectangle. More...
 
void WBDrawBorderElipse (Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor)
 Draw a 'border' elipse within a bounding geometry. More...
 
void WBDraw3DBorderElipse (Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor1, unsigned long lBorderColor2)
 Draw a 3D 'border' elipse within a bounding geometry. More...
 
void WBDrawDashedRect (Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomRect, unsigned long lColor)
 Draw a 'dashed' rectangle. More...
 
void WBDrawLeftArrow (Display *pDisplay, Drawable wID, WBGC 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, WBGC 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, WBGC 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, WBGC 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, WBGC gc, WB_GEOM *pgeomOutline, int fFocus, unsigned long lFGColor, unsigned long lBGColor, unsigned long lBorderColor1, unsigned long lBorderColor2, unsigned long lHighlightColor, WB_FONTC pFont, WB_FONTC pFontBold, Atom aGraphic, const char *szText)
 Draw a 'tab' within a specified 'outline' rectangle. More...
 

Variables

Atom aSCROLL_NOTIFY
 

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

◆ WB_SCROLLINFO

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 tagWB_SCROLL_INFO
{
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

◆ WBScrollState_ENUM

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

◆ WBCalcHScrollBar()

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 693 of file window_dressing.c.

◆ WBCalcHScrollDragPos()

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 801 of file window_dressing.c.

◆ WBCalcVScrollBar()

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 634 of file window_dressing.c.

◆ WBCalcVScrollDragPos()

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 754 of file window_dressing.c.

◆ WBDraw3DBorderElipse()

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

Draw a 3D 'border' elipse within a bounding 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 WBGC (graphics context) to use
pgeomBorderA WB_GEOM that identifies the bounding rectangle for the elipse 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 border elipse in the specified window, using the specified geometry.

Header File: window_dressing.h

Definition at line 1621 of file window_dressing.c.

◆ WBDraw3DBorderRect()

void WBDraw3DBorderRect ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1517 of file window_dressing.c.

◆ WBDraw3DBorderTab()

void WBDraw3DBorderTab ( Display *  pDisplay,
Drawable  wID,
WBGC  gc,
WB_GEOM pgeomOutline,
int  fFocus,
unsigned long  lFGColor,
unsigned long  lBGColor,
unsigned long  lBorderColor1,
unsigned long  lBorderColor2,
unsigned long  lHighlightColor,
WB_FONTC  pFont,
WB_FONTC  pFontBold,
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 WBGC (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
pFontThe 'normal' WB_FONTC to render text in
pFontBoldThe 'bold' WB_FONTC 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 1802 of file window_dressing.c.

◆ WBDrawBorderElipse()

void WBDrawBorderElipse ( Display *  pDisplay,
Drawable  wID,
WBGC  gc,
WB_GEOM pgeomBorder,
unsigned long  lBorderColor 
)

Draw a 'border' elipse within a bounding 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 WBGC (graphics context) to use
pgeomBorderA WB_GEOM that identifies the bounding rectangle for the elipse to draw
lBorderColorA 'Pixel' color value to use when painting the border

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

Header File: window_dressing.h

Definition at line 1605 of file window_dressing.c.

◆ WBDrawBorderRect()

void WBDrawBorderRect ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1482 of file window_dressing.c.

◆ WBDrawDashedRect()

void WBDrawDashedRect ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1660 of file window_dressing.c.

◆ WBDrawDownArrow()

void WBDrawDownArrow ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1773 of file window_dressing.c.

◆ WBDrawLeftArrow()

void WBDrawLeftArrow ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1684 of file window_dressing.c.

◆ WBDrawRightArrow()

void WBDrawRightArrow ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1743 of file window_dressing.c.

◆ WBDrawUpArrow()

void WBDrawUpArrow ( Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1714 of file window_dressing.c.

◆ WBInitScrollInfo()

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.

◆ WBInvalidateHScrollGeom()

void WBInvalidateHScrollGeom ( Window  wID,
WB_SCROLLINFO pScrollInfo,
int  bAll,
int  bUpdate 
)

Utility function to invalidate the geometry for the horizontal scroll bar.

Parameters
wIDThe Window ID for the scroll bar owner
pScrollInfoA pointer to the WB_SCROLLINFO structure for the window's scroll bars
bAllA flag to indicate whether the entire scrollbar should be invalidated; zero only invalidates the 'knob' area
bUpdateThe 'update' flag to be sent to WBInvalidateGeom()

Call this function to (efficiently) invalidate the horizontal scroll bar geometry for re-painting

Definition at line 953 of file window_dressing.c.

◆ WBInvalidateVScrollGeom()

void WBInvalidateVScrollGeom ( Window  wID,
WB_SCROLLINFO pScrollInfo,
int  bAll,
int  bUpdate 
)

Utility function to invalidate the geometry for the vertical scroll bar.

Parameters
wIDThe Window ID for the scroll bar owner
pScrollInfoA pointer to the WB_SCROLLINFO structure for the window's scroll bars
bAllA flag to indicate whether the entire scrollbar should be invalidated; zero only invalidates the 'knob' area
bUpdateThe 'update' flag to be sent to WBInvalidateGeom()

Call this function to (efficiently) invalidate the vertical scroll bar geometry for re-painting

Definition at line 920 of file window_dressing.c.

◆ WBPaintHScrollBar()

void WBPaintHScrollBar ( WB_SCROLLINFO pScrollInfo,
Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1335 of file window_dressing.c.

◆ WBPaintVScrollBar()

void WBPaintVScrollBar ( WB_SCROLLINFO pScrollInfo,
Display *  pDisplay,
Drawable  wID,
WBGC  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 WBGC (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 1403 of file window_dressing.c.

◆ WBScrollBarEvent()

int WBScrollBarEvent ( Window  wID,
XEvent *  pEvent,
WB_SCROLLINFO pScrollInfo 
)

Event handler for scroll bars.

Parameters
wIDThe Window ID for the scroll bar owner
pEventA pointer to the XEvent to (possibly) be handled
pScrollInfoA pointer to the WB_SCROLLINFO structure for the window's scroll bars
Returns
A non-zero value if the event was handled, or zero if no processing was done

This function generically handles pointer and keyboard events associated with scroll bars, generating scroll bar notification (and related) ClientMessage events from mouse clicks, drags, and scrolling related to the scroll bars. The scroll bar geometry must have already been calculated for this to work properly. The function returns a non-zero value if the event was processed.

This function does NOT handle Expose events.

Definition at line 987 of file window_dressing.c.

◆ WBSetHScrollPos()

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

Definition at line 295 of file window_dressing.c.

◆ WBSetHScrollRange()

int 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
Returns
A non-zero value if the 'visibility' of the scrollbar has changed

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

Definition at line 276 of file window_dressing.c.

◆ WBSetVScrollPos()

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

Definition at line 289 of file window_dressing.c.

◆ WBSetVScrollRange()

int 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
Returns
A non-zero value if the 'visibility' of the scrollbar has changed

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

Definition at line 263 of file window_dressing.c.

◆ WBUpdateScrollBarGeometry()

void WBUpdateScrollBarGeometry ( WB_SCROLLINFO pSI,
WB_FONTC  pFontRef,
WB_GEOM pgeomClient,
WB_GEOM pgeomUsable 
)

Update the scroll bar geometry within the WB_SCROLLINFO structure.

Parameters
pSIA pointer to the WB_SCROLLINFO structure
pFontRefThe reference WB_FONTC 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

Definition at line 849 of file window_dressing.c.

Variable Documentation

◆ aSCROLL_NOTIFY

Atom aSCROLL_NOTIFY

Scroll notifications via ClientMessage

SCROLL_NOTIFY message format (relative to XEvent.xclient)

type == ClientMessage
message_type == aSCROLL_NOTIFY
format == 32 (always)
data.l[0] Identifies the bar (WB_SCROLL_VERTICAL, WB_SCROLL_HORIZONTAL, or WB_SCROLL_DEFAULT)
data.l[1] Indicates the notification type, one of the following:

  • WB_SCROLL_KNOB 'knob track' - knob position will be in data.l[2]
  • WB_SCROLL_FORWARD move down, or move right
  • WB_SCROLL_BACKWARD move up, or move left
  • WB_SCROLL_PAGEFWD page down or page right
  • WB_SCROLL_PAGEBACK page up or page left
  • WB_SCROLL_FIRST scroll to first entry, i.e. home or top
  • WB_SCROLL_LAST scroll to last entry, i.e. bottom or end
  • WB_SCROLL_DBLCLICK double-click detection (no selection info in data.l[2])
  • WB_SCROLL_ABSOLUTE absolute scroll, to the absolute position in data.l[2]
  • WB_SCROLL_RELATIVE relative scroll, relative +/- position in data.l[2]
  • WB_SCROLL_NA generic 'NA' or 'UNDEFINED' value

data.l[2] Optional parameter, typically the absolute or relative scroll position

Definition at line 284 of file window_helper.c.