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-2019 by Bob Frazier (aka 'Big Bad Bombastic Bob')
19 
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  MIT-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 thi __WBLineBuffers 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  MIT-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 s_WB_EDIT_CONTROL
60 
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif // __cplusplus
65 
66 
110 typedef struct s_LISTINFO
111 {
112  int nItems,
113  nMaxItems;
114  int nPos,
115  nTop;
116  int nHeight,
117  nItemHeight;
118  int nFlags;
120  Window wOwner;
121 
126  void *(*pfnAllocator)(const void *, int);
131  void (*pfnDestructor)(void *);
139  void (*pfnDisplay)(WBDialogControl *pControl, void *pData, int iSelected, WBGC gcPaint, WB_GEOM *pGeom, WB_FONTC pFont);
140 
142  int (*pfnSort)(const void *, const void *); // sort proc (NULL implies strcmp)
143 
145  void *aItems[1]; // array of item data (remainder of struct)
146 } LISTINFO;
147 
148 
149 
150 // specialized structures 'derived' from WBDialogC __WBLineBufferontrol (internal only)
172 typedef struct s_WB_IMAGE_CONTROL
173 {
175  Pixmap pixmap;
176  Pixmap pixmap2;
178 
201 {
203  Pixmap pixmap;
204  Pixmap pixmap2;
206 
227 typedef struct s_WB_EDIT_CONTROL
228 {
231 } WBEditControl;
232 
233 
259 typedef struct s_WBListCurSel
260 {
261  int iCurSel;
262  int iTopIndex;
263  int iHeight;
265 } WBListCurSel;
266 
267 
291 typedef struct s_WB_LIST_CONTROL
292 {
295  int *pSelBitmap;
296  int cbBitmap;
298 } WBListControl;
299 
300 
322 typedef struct s_WB_COMBO_CONTROL
323 {
328 
329 
351 typedef struct s_WB_TREE_CONTROL
352 {
356 } WBTreeControl;
357 
358 
359 
370 void DLGCDestroyProperties(WBDialogPropList *pPropList);
371 
390 LISTINFO *DLGCListInfoConstructor(Window wOwner, int nMax, int nFlags,
391  void *(*pfnAllocator)(const void *,int), void (*pfnDestructor)(void *),
392  void (*pfnDisplay)(WBDialogControl *, void *, int, WBGC, WB_GEOM *, WB_FONTC),
393  int (*pfnSort)(const void *, const void *));
394 
405 void DLGCListInfoDestructor(LISTINFO *pListInfo);
406 
407 
424 void DLGCDefaultListControlDisplayProc(WBDialogControl *pList, void *pData, int iSelected, WBGC gc, WB_GEOM *pGeom, WB_FONTC pFont);
425 
426 
427 
428 #ifndef DIALOG_SUPPORT_C
429 
430 extern const Atom aDLGC_TEXT;
431 extern const Atom aDLGC_CAPTION;
432 extern const Atom aDLGC_FONT;
433 extern const Atom aDLGC_SCROLLINFO;
434 extern const Atom aDLGC_LISTINFO;
435 
436 #endif // DIALOG_SUPPORT_C
437 
438 
439 #ifdef NO_DEBUG
440 #define DEBUG_DUMP_LIST(X)
441 #else // !NO_DEBUG
442 void DEBUG_DUMP_LIST(WBDialogControl *pCtrl);
443 #endif // NO_DEBUG
444 
445 
446 #ifdef __cplusplus
447 };
448 #endif // __cplusplus
449 
450 #endif // _DIALOG_SUPPORT_H_INCLUDED_
451 
452 
int iCurSel
current selection
struct s_WB_PUSHBUTTON_CONTROL WBPushButtonControl
Button 'pushbutton' control structure.
const Atom aDLGC_SCROLLINFO
dialog control SCROLLINFO property - see WB_SCROLLINFO structure
WBDialogControl wbDLGCtrl
Standard dialog control members.
Pixmap pixmap2
background (transparency) pixmap
TEXT_OBJECT xTextObject
A Text Object associated with the editable text.
void DLGCListInfoDestructor(LISTINFO *pListInfo)
Destroy a LISTINFO structure.
Structure containing information about the current selection in a list.
const Atom aDLGC_LISTINFO
dialog control LISTINFO property - see DLGInitControlListInfo() etc.
int nTop
scroll position of the top item currently displayed
WBDialogControl wbDLGCtrl
Standard dialog control members.
Static 'Image' control structure.
int nMaxItems
max size of aItems (must re-alloc to increase nMaxItems)
void(* pfnDestructor)(void *)
destructor to call for each item that's removed
Static 'Image' control structure.
void DLGCDefaultListControlDisplayProc(WBDialogControl *pList, void *pData, int iSelected, WBGC gc, WB_GEOM *pGeom, WB_FONTC pFont)
The default 'display proc' for displaying a list item from a LISTINFO structure.
struct s_WB_LIST_CONTROL WBListControl
List control structure.
WBListCurSel sel
selection state, must follow wbDLGCtrl
Pixmap pixmap
foreground pixmap
WBDialogControl wbDLGCtrl
Standard dialog control members.
int iHeight
calculated height of window in "entries" (see next member)
internal wrapper struct for X11 'geometry' definition
WB_GEOM geomDisplay
the (cached) geometry that defines the "display area" (not scrollbars, border)
int(* pfnSort)(const void *, const void *)
Optional sort comparison function. NULL implies 'strcmp'.
WBDialogControl wbDLGCtrl
Standard dialog control members.
int nPos
current scroll position
int cbBitmap
size of bitmap (in bytes, granular at sizeof(int))
int nFlags
flags (sorted, etc.)
'base class' structure for TEXT_OBJECT
Definition: text_object.h:893
Edit control structure.
int nItems
current number of valid entries in 'aItems'
struct s_LISTINFO LISTINFO
Structure containing data for list-related dialog controls.
struct s_WBListCurSel WBListCurSel
Structure containing information about the current selection in a list.
WBDialogControl wbDLGCtrl
Standard dialog control members.
const Atom aDLGC_FONT
dialog control FONT property - reserved
WB_FONT pBold
bold font set - assigned on the fly, struct creator must free if not 'None'
TEXT_OBJECT xTextObject
A Text Object associated with the edit text.
const Atom aDLGC_CAPTION
dialog control CAPTION property - see WBDialogControlGetCaption()
const Atom aDLGC_TEXT
dialog control TEXT property - see WBDialogControlGetText()
WB_FONT pBold
bold font set - assigned on the fly, struct creator must free if not 'None'
int nItemHeight
height of a single item (in pixels)
void(* pfnDisplay)(WBDialogControl *pControl, void *pData, int iSelected, WBGC gcPaint, WB_GEOM *pGeom, WB_FONTC pFont)
display callback function to paint the entry on the display surface
A 'C++'-like object for managing text, that can be overridden for custom behavior.
int iTopIndex
index of item at top of window
struct s_WB_IMAGE_CONTROL WBImageControl
Static 'Image' control structure.
struct s_WB_COMBO_CONTROL WBComboControl
List control structure.
void DLGCDestroyProperties(WBDialogPropList *pPropList)
Destroy Properties for a dialog control.
Pixmap pixmap2
background (transparency) pixmap
List control structure.
WBListCurSel sel
must follow wbDLGCtrl
struct s_WB_TREE_CONTROL WBTreeControl
Static 'Image' control structure.
WBListCurSel sel
selection state, must follow wbDLGCtrl
Pixmap pixmap
foreground pixmap
void * aItems[1]
The array of item data, integrated into the memory block containing this structure.
Structure containing data for list-related dialog controls.
int nHeight
height (in items) of display area, recalculated on resize/expose
int * pSelBitmap
bitmap of selections (when applicable) (use 'WBAlloc/WBFree')
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
Definition: font_helper.h:152
Dialog Property List, container for WB_DIALOG_PROP.
int iEntryHeight
cached display height of each entry (calculated by Expose handler)
internal wrapper struct for GC with local cache
struct s_WB_EDIT_CONTROL WBEditControl
Edit control structure.
WBDialogControl wbDLGCtrl
Standard dialog control members.
List control structure.
Window wOwner
owning window [to be notified on change]
Button 'pushbutton' control structure.
Structure identifying the properties of a dialog box control.
LISTINFO * DLGCListInfoConstructor(Window wOwner, int nMax, int nFlags, void *(*pfnAllocator)(const void *, int), void(*pfnDestructor)(void *), void(*pfnDisplay)(WBDialogControl *, void *, int, WBGC, WB_GEOM *, WB_FONTC), int(*pfnSort)(const void *, const void *))
Create LISTINFO structure for a list type control.