X11 Work Bench Toolkit  1.0
dialog_controls.h File Reference
#include "window_helper.h"
#include "dialog_window.h"

Go to the source code of this file.

Data Structures

struct  __WB_DIALOG_PROP__
 Dialog property storage structure. More...
 
struct  __WB_DIALOG_PROPLIST__
 Dialog Property List, container for WB_DIALOG_PROP. More...
 
struct  __WB_DIALOG_CONTROL__
 Structure identifying the properties of a dialog box control. More...
 

Macros

#define DIALOG_CONTROL_TAG   (*((const unsigned int *)"DLGC"))
 TAG for the WBDialogControl structure.
 

Typedefs

typedef struct __WB_DIALOG_PROP__ WB_DIALOG_PROP
 Dialog property storage structure. More...
 
typedef struct
__WB_DIALOG_PROPLIST__ 
WBDialogPropList
 Dialog Property List, container for WB_DIALOG_PROP. More...
 
typedef struct
__WB_DIALOG_CONTROL__ 
WBDialogControl
 Structure identifying the properties of a dialog box control. More...
 

Functions

void WBDialogControlsInit (void)
 Initialization function for dialog controls. More...
 
WBDialogControlWBDialogControlCreate (Atom aClass, WBDialogWindow *pOwner, WBDialogEntry *pDialogEntry, int iX, int iY, int iWidth, int iHeight, const char *szTitle, const char *szPropertyList)
 Create a dialog control window. More...
 
void DLGRegisterControlCallback (WBDialogControl *pDialogControl, const char *szClassName, WBWinEvent pCallback)
 Register the dialog control's callback function and class name. More...
 
int WBDialogControlSetDialogProp (WBDialogControl *pCtrl, WB_DIALOG_PROP *pPropVal)
 Low-level dialog control property assignment. More...
 
void WBDialogControlDelDialogProp (WBDialogControl *pCtrl, Atom aProp)
 Low-level dialog control property removal. More...
 
const WB_DIALOG_PROPWBDialogControlGetDialogProp (WBDialogControl *pCtrl, Atom aProp)
 Low-level dialog control property retrieval. More...
 
static __inline__ const
WBDialogPropList
WBDialogControlGetPropList (WBDialogControl *pCtrl)
 Low-level dialog control property list retrieval. More...
 
int WBDialogControlSetPropList (WBDialogControl *pCtrl, const char *szPropList)
 Mid-level dialog control property list assignment. More...
 
int WBDialogControlSetProperty (WBDialogControl *pCtrl, Atom aPropName, const char *szPropVal)
 Mid-level dialog control property assignment (character string) More...
 
void WBDialogControlSetProperty2 (WBDialogControl *pCtrl, Atom aPropName, void *szPropVal)
 Mid-level dialog control property list assignment (generic pointer) More...
 
const char * WBDialogControlGetProperty (WBDialogControl *pCtrl, Atom aPropName)
 Mid-level dialog control property retrieval (character string) More...
 
void * WBDialogControlGetProperty2 (WBDialogControl *pCtrl, Atom aPropName)
 Mid-level dialog control property list retrieval (generic pointer) More...
 
static __inline__ WBDialogControlDLGGetDialogControlStruct (Window wID)
 Returns a pointer to the WBDialogControl structure for a dialog control with validation. May return NULL. More...
 
void WBDialogControlSetCaption (WBDialogControl *pCtrl, const char *szCaption)
 Assign text to the 'CAPTION' property of a dialog control. More...
 
const char * WBDialogControlGetCaption (WBDialogControl *pCtrl)
 Obtain a pointer to the assigned text for the 'CAPTION' property of a dialog control. More...
 
void WBDialogControlSetPixmap (WBDialogControl *pCtrl, Pixmap pixmap)
 Assign the PIXMAP (image) property for a control. More...
 
Pixmap WBDialogControlGetPixmap (WBDialogControl *pCtrl)
 Obtain the assigned PIXMAP (image) property for a control. More...
 
void WBDialogControlSetIconPixmap (WBDialogControl *pCtrl, Pixmap pixmap, Pixmap pixmap2)
 Assign the ICON (image) property for a control, which consists of 2 pixmaps. More...
 
Pixmap WBDialogControlGetIconPixmap (WBDialogControl *pCtrl, Pixmap *pPixmap2)
 Obtain the assigned ICON (image) property for a control, which consists of 2 pixmaps. More...
 
static __inline__ void WBDialogControlSetText (WBDialogControl *pCtrl, const char *szText)
 Assign the TEXT property for a control, which is different from the CAPTION or Title. More...
 
static __inline__ const char * WBDialogControlGetText (WBDialogControl *pCtrl)
 Obtain the assigned TEXT property for a control, which is different from the CAPTION or Title. More...
 
static __inline__ WBDialogControlDLGGetDialogControlStructFromID (WBDialogWindow *pDialog, int iControlID)
 Returns a pointer to the WBDialogControl structure for a dialog control with validation. May return NULL. More...
 
static __inline__ void DLGSetControlCaption (WBDialogWindow *pDialog, int iControlID, const char *szCaption)
 Convenience function to assign a dialog control's caption based on its control ID. More...
 
static __inline__ const char * DLGGetControlCaption (WBDialogWindow *pDialog, int iControlID)
 Convenience function to query a dialog control's caption based on its control ID. More...
 
static __inline__ void DLGSetControlText (WBDialogWindow *pDialog, int iControlID, const char *szText)
 Convenience function to assign a dialog control's TEXT based on its control ID. More...
 
static __inline__ const char * DLGGetControlText (WBDialogWindow *pDialog, int iControlID)
 Convenience function to query a dialog control's TEXT based on its control ID. More...
 
static __inline__ int DLGSetControlProperty (WBDialogWindow *pDialog, int iControlID, Atom aPropName, const char *szPropVal)
 Convenience function to assign a text property for a dialog control based on its control ID. More...
 
static __inline__ const char * DLGGetControlProperty (WBDialogWindow *pDialog, int iControlID, Atom aPropName)
 Convenience function to query a text property for a dialog control based on its control ID. More...
 
#define WB_MIN_STD_CTRL_ID   0x7ffffff0
 
#define IDOK   0x7ffffff0
 
#define IDNO   0x7ffffff1
 
#define IDYES   0x7ffffff2
 
#define IDABORT   0x7ffffff3
 
#define IDRETRY   0x7ffffff4
 
#define IDIGNORE   0x7ffffff5
 
#define IDCANCEL   0x7fffffff
 
#define IDSTATIC   -1
 
#define IDNONE   0
 
#define FRAME_CONTROL_STR   "Frame"
 
#define TEXT_CONTROL_STR   "Text"
 
#define ICON_CONTROL_STR   "Icon"
 
#define IMAGE_CONTROL_STR   "Image"
 
#define EDIT_CONTROL_STR   "Edit"
 
#define PUSHBUTTON_CONTROL_STR   "PushButton"
 
#define DEFPUSHBUTTON_CONTROL_STR   "DefPushButton"
 
#define CANCELBUTTON_CONTROL_STR   "CancelButton"
 
#define RADIOBUTTON_CONTROL_STR   "RadioButton"
 
#define FIRSTRADIOBUTTON_CONTROL_STR   "FirstRadioButton"
 
#define CHECKBUTTON_CONTROL_STR   "CheckButton"
 
#define TRISTATEBUTTON_CONTROL_STR   "TriStateButton"
 
#define HSCROLL_CONTROL_STR   "HScroll"
 
#define VSCROLL_CONTROL_STR   "VScroll"
 
#define SLIDER_CONTROL_STR   "Slider"
 
#define KNOB_CONTROL_STR   "Knob"
 
#define LIST_CONTROL_STR   "List"
 
#define COMBO_CONTROL_STR   "Combo"
 
#define TREE_CONTROL_STR   "Tree"
 
#define COMBOTREE_CONTROL_STR   "ComboTree"
 
#define FILE_LIST_CONTROL_STR   "FileList"
 
#define FILE_COMBO_CONTROL_STR   "FileCombo"
 
#define PATH_TREE_CONTROL_STR   "PathTree"
 
#define TAB_CONTROL_STR   "Tab"
 
#define WB_LIST_NONE   0
 
#define WB_LIST_SELCHANGE   1
 
#define WB_LIST_DBLCLICK   2
 
#define DLGInitControlListInfoDefault(X)   DLGInitControlListInfo(X, ListInfoFlags_SORTED, DLGCDefaultListInfoAllocator, WBFree, NULL, NULL)
 wrapper macro for DLGInitControlListInfo() for standard WBAlloc'd text data More...
 
enum  {
  WB_SCROLL_DEFAULT = 0, WB_SCROLL_HORIZONTAL = 1, WB_SCROLL_VERTICAL = 2, WB_SCROLL_KNOB = 0,
  WB_SCROLL_FORWARD = 1, WB_SCROLL_BACKWARD = -1, WB_SCROLL_PAGEFWD = 2, WB_SCROLL_PAGEBACK = -2,
  WB_SCROLL_FIRST = -3, WB_SCROLL_LAST = 3, WB_SCROLL_DBLCLICK = 4, WB_SCROLL_ABSOLUTE = 99,
  WB_SCROLL_RELATIVE = -99, WB_SCROLL_NA = 0x80000000
}
 Enumeration for aSCROLL_NOTIFY CLientMessage. More...
 
enum  ControlListIndex {
  ControlListIndex_FIRST = 0, ControlListIndex_LAST = 0x7fffffff, ControlListIndex_INSERT_FIRST = -1, ControlListIndex_INSERT_LAST = 0x7fffffff,
  ControlListIndex_DELETE_ALL = -1, ControlListIndex_NONE = -1
}
 LIST-related constants for the index of an item within a list. More...
 
enum  ListInfoFlags {
  ListInfoFlags_SORTED = 1, ListInfoFlags_RESERVED1 = 2, ListInfoFlags_RESERVED2 = 4, ListInfoFlags_RESERVED3 = 8,
  ListInfoFlags_RESERVED4 = 0x10, ListInfoFlags_RESERVED5 = 0x20, ListInfoFlags_RESERVED6 = 0x40, ListInfoFlags_RESERVED7 = 0x80
}
 Create flags specified in the call to DLGInitControlListInfo() More...
 
enum  CONTROL_FLAGS {
  CONTROL_Reserved00 = 0x00000001, CONTROL_Reserved01 = 0x00000002, CONTROL_Reserved02 = 0x00000004, CONTROL_Reserved03 = 0x00000008,
  CONTROL_Reserved04 = 0x00000010, CONTROL_Reserved05 = 0x00000020, CONTROL_Reserved06 = 0x00000040, CONTROL_Reserved07 = 0x00000080,
  CONTROL_Reserved08 = 0x00000100, CONTROL_Reserved09 = 0x00000200, CONTROL_Reserved10 = 0x00000400, CONTROL_Reserved11 = 0x00000800,
  CONTROL_Reserved12 = 0x00001000, CONTROL_Reserved13 = 0x00002000, CONTROL_Reserved14 = 0x00004000, CONTROL_SupportListInfo = 0x00008000,
  STATIC_Frame = 0x00010000, STATIC_Text = 0x00020000, STATIC_Icon = 0x00030000, STATIC_Image = 0x00040000,
  STATIC_TYPEMASK = 0x000f0000, STATIC_3DBorder = 0x00100000, BUTTON_PushButton = 0x00010000, BUTTON_DefPushButton = 0x00020000,
  BUTTON_CancelButton = 0x00030000, BUTTON_RadioButton = 0x00040000, BUTTON_FirstRadioButton = 0x00050000, BUTTON_CheckButton = 0x00060000,
  BUTTON_TriStateButton = 0x00070000, BUTTON_TYPEMASK = 0x000f0000, CONTROL_VAlignFixed = WBDialogEntry_VAlignFixed, CONTROL_VAlignTop = WBDialogEntry_VAlignTop,
  CONTROL_VAlignBottom = WBDialogEntry_VAlignBottom, CONTROL_VAlignCenter = WBDialogEntry_VAlignCenter, CONTROL_VAlignMask = WBDialogEntry_VAlignMask, CONTROL_HAlignFixed = WBDialogEntry_HAlignFixed,
  CONTROL_HAlignLeft = WBDialogEntry_HAlignLeft, CONTROL_HAlignRight = WBDialogEntry_HAlignRight, CONTROL_HAlignCenter = WBDialogEntry_HAlignCenter, CONTROL_HAlignMask = WBDialogEntry_HAlignMask,
  CONTROL_AlignMask = WBDialogEntry_AlignMask, CUSTOM_Reserved24 = 0x01000000, CUSTOM_Reserved25 = 0x02000000, CUSTOM_Reserved26 = 0x04000000,
  CUSTOM_Reserved27 = 0x08000000, CUSTOM_Reserved28 = 0x10000000, CUSTOM_Reserved29 = 0x20000000, CUSTOM_Reserved30 = 0x40000000,
  CUSTOM_Reserved31 = 0x80000000
}
 Various bit flags used for controls, defined here for convenience. More...
 
const Atom aFRAME_CONTROL
 Standard Dialog Control - transparent frame with optional text - see FRAME_CONTROL_STR.
 
const Atom aTEXT_CONTROL
 Standard Dialog Control - static text (single or multi-line) - see TEXT_CONTROL_STR.
 
const Atom aICON_CONTROL
 Standard Dialog Control - icon container (has a nice 3D border) - see ICON_CONTROL_STR.
 
const Atom aIMAGE_CONTROL
 Standard Dialog Control - generic image/pixmap holder - see IMAGE_CONTROL_STR.
 
const Atom aEDIT_CONTROL
 Standard Dialog Control - editable text (single or multi-line, scrollable, clipboard) - see EDIT_CONTROL_STR.
 
const Atom aPUSHBUTTON_CONTROL
 Standard Dialog Control - Pushbutton control - see PUSHBUTTON_CONTROL_STR.
 
const Atom aDEFPUSHBUTTON_CONTROL
 Standard Dialog Control - default Pushbutton control (has dark border, accepts <ENTER> as hotkey) - see DEFPUSHBUTTON_CONTROL_STR.
 
const Atom aCANCELBUTTON_CONTROL
 Standard Dialog Control - cancel pushbutton control (accepts <ESC> as hotkey) - see CANCELBUTTON_CONTROL_STR.
 
const Atom aRADIOBUTTON_CONTROL
 Standard Dialog Control - radio button - see RADIOBUTTON_CONTROL_STR.
 
const Atom aFIRSTRADIOBUTTON_CONTROL
 Standard Dialog Control - 'first' radio button - defines start of radio button 'group' - see FIRSTRADIOBUTTON_CONTROL_STR.
 
const Atom aCHECKBUTTON_CONTROL
 Standard Dialog Control - check[box] button - push-on/push-off with 'check mark' (or whatever) - see CHECKBUTTON_CONTROL_STR.
 
const Atom aTRISTATEBUTTON_CONTROL
 Standard Dialog Control - tristate - like check, but with a third state - see TRISTATEBUTTON_CONTROL_STR.
 
const Atom aHSCROLL_CONTROL
 Standard Dialog Control - horizontal scroll - see HSCROLL_CONTROL_STR.
 
const Atom aVSCROLL_CONTROL
 Standard Dialog Control - vertical scroll - see VSCROLL_CONTROL_STR.
 
const Atom aSLIDER_CONTROL
 Standard Dialog Control - volume control (slider bar) (h or v depending on geometry) - see SLIDER_CONTROL_STR.
 
const Atom aKNOB_CONTROL
 Standard Dialog Control - "volume knob" (270 degrees of rotation, left to right) - see KNOB_CONTROL_STR.
 
const Atom aLIST_CONTROL
 Standard Dialog Control - list - single, multi, extended select (h, v, multicol) - see LIST_CONTROL_STR.
 
const Atom aCOMBO_CONTROL
 Standard Dialog Control - classic 'combo box' control - see COMBO_CONTROL_STR.
 
const Atom aTREE_CONTROL
 Standard Dialog Control - class 'tree' control - see TREE_CONTROL_STR.
 
const Atom aCOMBOTREE_CONTROL
 Standard Dialog Control - 'combo tree' (tree with interlocked edit/text box like combo box) - see COMBOTREE_CONTROL_STR.
 
const Atom aFILE_LIST_CONTROL
 Standard Dialog Control - File List - see FILE_LIST_CONTROL_STR.
 
const Atom aFILE_COMBO_CONTROL
 Standard Dialog Control - file combo control - see FILE_COMBO_CONTROL_STR.
 
const Atom aPATH_TREE_CONTROL
 Standard Dialog Control - path tree - directory hierarchy - see PATH_TREE_CONTROL_STR.
 
const Atom aTAB_CONTROL
 Standard Dialog Control -'tab' container (auto enable/disable contents) - see TAB_CONTROL_STR.
 
const Atom aBUTTON_PRESS
 CONTROL_NOTIFY ClientMessage for BUTTON_PRESS event. More...
 
const Atom aLIST_NOTIFY
 CONTROL_NOTIFY ClientMessage for LIST_NOTIFY event. More...
 
const Atom aTEXT_CHANGED
 CONTROL_NOTIFY ClientMessage for TEXT_CHANGED event. More...
 
const Atom aTEXTSELECT_CHANGE
 CONTROL_NOTIFY ClientMessage for TEXTSELECT_CHANGE event. More...
 
const Atom aSCROLL_NOTIFY
 
const Atom aGOTFOCUS
 CONTROL_NOTIFY ClientMessage for GOTFOCUS event. More...
 
const Atom aLOSTFOCUS
 CONTROL_NOTIFY ClientMessage for LOSTFOCUS event. More...
 
const Atom aMOUSE_DOWN
 CONTROL_NOTIFY ClientMessage for MOUSE_DOWN event. More...
 
const Atom aMOUSE_UP
 CONTROL_NOTIFY ClientMessage for MOUSE_UP event. More...
 
const Atom aMOUSE_DRAG
 CONTROL_NOTIFY ClientMessage for MOUSE_DRAG event. More...
 
const Atom aKEY_DOWN
 CONTROL_NOTIFY ClientMessage for KEY_DOWN event. More...
 
const Atom aKEY_UP
 CONTROL_NOTIFY ClientMessage for KEY_UP event. More...
 
const Atom aKEYSTROKE
 CONTROL_NOTIFY ClientMessage for KEYSTROKE event. More...
 
const Atom aDIALOG_INIT
 DIALOG_INIT ClientMessage, sent to dialog window callback on frame create. More...
 
Atom aDLGC_PROP_NOTIFY
 DLGC_PROP_NOTIFY ClientMessage, notify control of property change. More...
 
Atom aDLGC_PATH
 dialog control PATH property, for file and directory controls More...
 
void * DLGCDefaultListInfoAllocator (const void *pData, int cbData)
 The default 'List Info' data allocator for a control's list info. More...
 
const char * DLGGetControlListText (WBDialogControl *pCtrl, int iIndex)
 Retrieve the text poiner for a single list entry (listbox, combo, and tree controls only) More...
 
const void * DLGGetControlListData (WBDialogControl *pCtrl, int iIndex)
 Retrieve the data pointer for a single list entry (listbox, combo, and tree controls only) More...
 
int DLGInitControlListInfo (WBDialogControl *pCtrl, int nFlags, void *(*pfnAllocator)(const void *, int), void(*pfnDestructor)(void *), void(*pfnDisplay)(WBDialogControl *, void *, int, GC, WB_GEOM *, XFontSet), int(*pfnSort)(const void *, const void *))
 Initialize the 'List Entry' for a control, specifying various callbacks and flags. More...
 
int DLGModifyControlListInfo (WBDialogControl *pCtrl, int bFlags, int nFlags, int bAllocator, void *(*pfnAllocator)(const void *, int), int bDestructor, void(*pfnDestructor)(void *), int bDisplay, void(*pfnDisplay)(WBDialogControl *, void *, int, GC, WB_GEOM *, XFontSet), int bSort, int(*pfnSort)(const void *, const void *))
 Modify the 'List Entry' for a control, specifying various callbacks and flags. More...
 
int DLGAddControlListEntry (WBDialogControl *pCtrl, const char *pData, long cbData, int iIndex)
 Add a list entry to a control's list info. More...
 
void DLGDelControlListEntry (WBDialogControl *pCtrl, int iIndex)
 Delete a list entry from a control's list info at a specified index (or deletes ALL entries) More...
 
int DLGGetControlListSelection (WBDialogControl *pCtrl)
 Obtain the current selection index for a single-selection list. More...
 
void DLGSetControlListSelection (WBDialogControl *pCtrl, int iIndex)
 Assign the current selection index for a single-selection list. More...
 
void DLGSetControlListSelectionValue (WBDialogControl *pCtrl, int iIndex, int iSelState)
 Assign the selection state for a specific index within a control's list info. More...
 
int DLGGetControlListSelectionBits (WBDialogControl *pCtrl, unsigned int *piBits, int nSize)
 Query the selection state for multiple items within a control's list info. More...
 
char * DLGGetControlListSelectionText (WBDialogControl *pCtrl)
 Query the selection text as multiple strings in an allocated buffer. More...
 
int DLGScrollBarHandler (Window wID, WBDialogControl *pCtrl, XEvent *pEvent)
 Scroll bar event filter for dialog control callback function. Generates scroll events. More...
 
static __inline__ void DLGNotifyOwner (WBDialogControl *pDialogControl, Atom aNotify, long lData0, long lData1, long lData2, long lData3, long lData4)
 Notify Owner by calling the owner window's callback function directly with an event. More...
 
static __inline__ void DLGNotifySelf (WBDialogControl *pDialogControl, Atom aNotify, long lData0, long lData1, long lData2, long lData3, long lData4)
 Notify 'self' by calling the window's own callback function directly with an event. More...
 
static __inline__ void DLGNotifyOwnerAsync (WBDialogControl *pDialogControl, Atom aNotify, long lData0, long lData1, long lData2, long lData3, long lData4)
 Notify Owner by posting an event that will ASYNCHRONOUSLY be sent to the owner window's callback function. More...
 
static __inline__ void DLGNotifySelfAsync (WBDialogControl *pDialogControl, Atom aNotify, long lData0, long lData1, long lData2, long lData3, long lData4)
 Notify 'self' by posting an event that will ASYNCHRONOUSLY be sent to the window's callback function. More...
 

Detailed Description

definitions for dialog control structures and APIs

Definition in file dialog_controls.h.