X11workbench Toolkit  1.0
dialog_support.h
1 // _ _ _ _ _ //
3 // __| |(_) __ _ | | ___ __ _ ___ _ _ _ __ _ __ ___ _ __ | |_ | |__ //
4 // / _` || | / _` || | / _ \ / _` | / __|| | | || '_ \ | '_ \ / _ \ | '__|| __| | '_ \ //
5 // | (_| || || (_| || || (_) || (_| | \__ \| |_| || |_) || |_) || (_) || | | |_ _ | | | | //
6 // \__,_||_| \__,_||_| \___/ \__, |_____|___/ \__,_|| .__/ | .__/ \___/ |_| \__|(_)|_| |_| //
7 // |___/|_____| |_| |_| //
8 // //
9 // //
10 // additional dialog control support //
11 // This file contains semi-private definitions that are needed to generically support dialog controls //
12 // //
14 
15 /*****************************************************************************
16 
17  X11workbench - X11 programmer's 'work bench' application and toolkit
18  Copyright (c) 2010-2018 by Bob Frazier (aka 'Big Bad Bombastic Bob')
19  all rights reserved
20 
21  DISCLAIMER: The X11workbench application and toolkit software are supplied
22  'as-is', with no warranties, either implied or explicit.
23  Any claims to alleged functionality or features should be
24  considered 'preliminary', and might not function as advertised.
25 
26  BSD-like license:
27 
28  There is no restriction as to what you can do with this software, so long
29  as you include the above copyright notice and DISCLAIMER for any distributed
30  work that is equal to or derived from this one, along with this paragraph
31  that explains the terms of the license if the source is also being made
32  available. A "derived work" describes a work that uses a significant portion
33  of the source files or algorithms that are included with this one.
34  Specifically excluded from this are files that were generated by the software,
35  or anything that is included with the software that is part of another package
36  (such as files that were created or added during the 'configure' process).
37  Specifically included is the use of part or all of any of the X11 workbench
38  toolkit source or header files in your distributed application. If you do not
39  ship the source, the above copyright statement is still required to be placed
40  in a reasonably prominent place, such as documentation, splash screens, and/or
41  'about the application' dialog boxes.
42 
43  Use and distribution are in accordance with GPL, LGPL, and/or the above
44  BSD-like license. See COPYING and README files for more information.
45 
46 
47  Additional information at http://sourceforge.net/projects/X11workbench
48 
49 ******************************************************************************/
50 
51 
52 
53 // INTERNAL USE ONLY for dialog controls, etc.
54 
55 #ifndef _DIALOG_SUPPORT_H_INCLUDED_
56 #define _DIALOG_SUPPORT_H_INCLUDED_
57 
58 #include "dialog_controls.h" // make sure this is included first
59 #include "text_object.h" // needed for _WB_EDIT_CONTROL_
60 
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif // __cplusplus
65 
66 
109 typedef struct __LISTINFO__
110 {
111  int nItems,
112  nMaxItems;
113  int nPos,
114  nTop;
115  int nHeight,
116  nItemHeight;
117  int nFlags;
118  Window wOwner;
119 
124  void *(*pfnAllocator)(const void *, int);
129  void (*pfnDestructor)(void *);
137  void (*pfnDisplay)(WBDialogControl *pControl, void *pData, int iSelected, GC gcPaint, WB_GEOM *pGeom, XFontSet fontSet);
138 
140  int (*pfnSort)(const void *, const void *); // sort proc (NULL implies strcmp)
141 
143  void *aItems[1]; // array of item data (remainder of struct)
144 } LISTINFO;
145 
146 
147 
148 // specialized structures 'derived' from WBDialogControl (internal only)
170 typedef struct _WB_IMAGE_CONTROL_
171 {
173  Pixmap pixmap;
174  Pixmap pixmap2;
176 
199 {
201  Pixmap pixmap;
202  Pixmap pixmap2;
204 
225 typedef struct _WB_EDIT_CONTROL_
226 {
229 } WBEditControl;
230 
231 
257 typedef struct _WB_LIST_CURSEL_
258 {
259  int iCurSel;
260  int iTopIndex;
261  int iHeight;
263 } WBListCurSel;
264 
265 
289 typedef struct _WB_LIST_CONTROL_
290 {
293  int *pSelBitmap;
294  int cbBitmap;
295  XFontSet fsBold;
296 } WBListControl;
297 
298 
320 typedef struct _WB_COMBO_CONTROL_
321 {
326 
327 
349 typedef struct _WB_TREE_CONTROL_
350 {
353  XFontSet fsBold;
354 } WBTreeControl;
355 
356 
357 
368 void DLGCDestroyProperties(WBDialogPropList *pPropList);
369 
388 LISTINFO *DLGCListInfoConstructor(Window wOwner, int nMax, int nFlags,
389  void *(*pfnAllocator)(const void *,int), void (*pfnDestructor)(void *),
390  void (*pfnDisplay)(WBDialogControl *, void *, int, GC, WB_GEOM *, XFontSet),
391  int (*pfnSort)(const void *, const void *));
392 
403 void DLGCListInfoDestructor(LISTINFO *pListInfo);
404 
405 
422 void DLGCDefaultListControlDisplayProc(WBDialogControl *pList, void *pData, int iSelected, GC gc, WB_GEOM *pGeom, XFontSet fontSet);
423 
424 
425 
426 #ifndef DIALOG_SUPPORT_C
427 
428 extern const Atom aDLGC_TEXT;
429 extern const Atom aDLGC_CAPTION;
430 extern const Atom aDLGC_FONT;
431 extern const Atom aDLGC_SCROLLINFO;
432 extern const Atom aDLGC_LISTINFO;
433 
434 #endif // DIALOG_SUPPORT_C
435 
436 
437 #ifdef NO_DEBUG
438 #define DEBUG_DUMP_LIST(X)
439 #else // !NO_DEBUG
440 void DEBUG_DUMP_LIST(WBDialogControl *pCtrl);
441 #endif // NO_DEBUG
442 
443 
444 #ifdef __cplusplus
445 };
446 #endif // __cplusplus
447 
448 #endif // _DIALOG_SUPPORT_H_INCLUDED_
449 
450 
struct _WB_PUSHBUTTON_CONTROL_ WBPushButtonControl
Button 'pushbutton' control structure.
const Atom aDLGC_SCROLLINFO
dialog control SCROLLINFO property - see WB_SCROLLINFO structure
void DLGCListInfoDestructor(LISTINFO *pListInfo)
Destroy a LISTINFO structure.
WBDialogControl wbDLGCtrl
Standard dialog control members.
List control structure.
TEXT_OBJECT xTextObject
A Text Object associated with the editable text.
const Atom aDLGC_LISTINFO
dialog control LISTINFO property - see DLGInitControlListInfo() etc.
Pixmap pixmap
foreground pixmap
Pixmap pixmap2
background (transparency) pixmap
int * pSelBitmap
bitmap of selections (when applicable) (use 'WBAlloc/WBFree')
int nTop
scroll position of the top item currently displayed
WBListCurSel sel
selection state, must follow wbDLGCtrl
int iCurSel
current selection
WBDialogControl wbDLGCtrl
Standard dialog control members.
struct _WB_LIST_CONTROL_ WBListControl
List control structure.
Static 'Image' control structure.
int cbBitmap
size of bitmap (in bytes, granular at sizeof(int))
WBDialogControl wbDLGCtrl
Standard dialog control members.
TEXT_OBJECT xTextObject
A Text Object associated with the edit text.
Pixmap pixmap2
background (transparency) pixmap
Edit control structure.
int iTopIndex
index of item at top of window
int nMaxItems
max size of aItems (must re-alloc to increase nMaxItems)
int nItemHeight
height of a single item (in pixels)
WBListCurSel sel
must follow wbDLGCtrl
int nHeight
height (in items) of display area, recalculated on resize/expose
struct __LISTINFO__ LISTINFO
Structure containing data for list-related dialog controls.
struct _WB_LIST_CURSEL_ WBListCurSel
Structure containing information about the current selection in a list.
void(* pfnDisplay)(WBDialogControl *pControl, void *pData, int iSelected, GC gcPaint, WB_GEOM *pGeom, XFontSet fontSet)
display callback function to paint the entry on the display surface
WBDialogControl wbDLGCtrl
Standard dialog control members.
Window wOwner
owning window [to be notified on change]
void(* pfnDestructor)(void *)
destructor to call for each item that's removed
LISTINFO * DLGCListInfoConstructor(Window wOwner, int nMax, 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 *))
Create LISTINFO structure for a list type control.
const Atom aDLGC_FONT
dialog control FONT property - reserved
int iHeight
calculated height of window in "entries" (see next member)
Button 'pushbutton' control structure.
List control structure.
const Atom aDLGC_CAPTION
dialog control CAPTION property - see WBDialogControlGetCaption()
const Atom aDLGC_TEXT
dialog control TEXT property - see WBDialogControlGetText()
int nItems
current number of valid entries in 'aItems'
WBDialogControl wbDLGCtrl
Standard dialog control members.
XFontSet fsBold
bold font set - assigned on the fly, struct creator must free if not 'None'
int nPos
current scroll position
Dialog Property List, container for WB_DIALOG_PROP.
int nFlags
flags (sorted, etc.)
A 'C++'-like object for managing text, can be overridden.
struct _WB_IMAGE_CONTROL_ WBImageControl
Static 'Image' control structure.
void DLGCDefaultListControlDisplayProc(WBDialogControl *pList, void *pData, int iSelected, GC gc, WB_GEOM *pGeom, XFontSet fontSet)
The default 'display proc' for displaying a list item from a LISTINFO structure.
struct _WB_COMBO_CONTROL_ WBComboControl
List control structure.
void DLGCDestroyProperties(WBDialogPropList *pPropList)
Destroy Properties for a dialog control.
'base class' structure for TEXT_OBJECT
Definition: text_object.h:949
WBListCurSel sel
selection state, must follow wbDLGCtrl
WBDialogControl wbDLGCtrl
Standard dialog control members.
Structure identifying the properties of a dialog box control.
Static 'Image' control structure.
struct _WB_TREE_CONTROL_ WBTreeControl
Static 'Image' control structure.
int iEntryHeight
cached display height of each entry (calculated by Expose handler)
int(* pfnSort)(const void *, const void *)
Optional sort comparison function. NULL implies 'strcmp'.
Structure containing data for list-related dialog controls.
Structure containing information about the current selection in a list.
XFontSet fsBold
bold font set - assigned on the fly, struct creator must free if not 'None'
void *(* pfnAllocator)(const void *, int)
pointer to the copy constructor to call for each item that's added
struct _WB_EDIT_CONTROL_ WBEditControl
Edit control structure.
internal wrapper struct for X11 'geometry' definition
void * aItems[1]
The array of item data, integrated into the memory block containing this structure.
Pixmap pixmap
foreground pixmap