X11workbench Toolkit  1.0
dialog_controls.h
Go to the documentation of this file.
1 // //
3 // _ _ _ _ _ _ //
4 // __| |(_) __ _ | | ___ __ _ ___ ___ _ __ | |_ _ __ ___ | | ___ | |__ //
5 // / _` || | / _` || | / _ \ / _` | / __|/ _ \ | '_ \ | __|| '__|/ _ \ | |/ __| | '_ \ //
6 // | (_| || || (_| || || (_) || (_| | | (__| (_) || | | || |_ | | | (_) || |\__ \ _| | | | //
7 // \__,_||_| \__,_||_| \___/ \__, |_____\___|\___/ |_| |_| \__||_| \___/ |_||___/(_)_| |_| //
8 // |___/|_____| //
9 // //
10 // dialog control support //
11 // //
13 
14 /*****************************************************************************
15 
16  X11workbench - X11 programmer's 'work bench' application and toolkit
17  Copyright (c) 2010-2019 by Bob Frazier (aka 'Big Bad Bombastic Bob')
18 
19 
20  DISCLAIMER: The X11workbench application and toolkit software are supplied
21  'as-is', with no warranties, either implied or explicit.
22  Any claims to alleged functionality or features should be
23  considered 'preliminary', and might not function as advertised.
24 
25  MIT-like license:
26 
27  There is no restriction as to what you can do with this software, so long
28  as you include the above copyright notice and DISCLAIMER for any distributed
29  work that is equal to or derived from this one, along with this paragraph
30  that explains the terms of the license if the source is also being made
31  available. A "derived work" describes a work that uses a significant portion
32  of the source files or algorithms that are included with this one.
33  Specifically excluded from this are files that were generated by the software,
34  or anything that is included with the software that is part of another package
35  (such as files that were created or added during the 'configure' process).
36  Specifically included is the use of part or all of any of the X11 workbench
37  toolkit source or header files in your distributed application. If you do not
38  ship the source, the above copyright statement is still required to be placed
39  in a reasonably prominent place, such as documentation, splash screens, and/or
40  'about the application' dialog boxes.
41 
42  Use and distribution are in accordance with GPL, LGPL, and/or the above
43  MIT-like license. See COPYING and README files for more information.
44 
45 
46  Additional information at http://sourceforge.net/projects/X11workbench
47 
48 ******************************************************************************/
49 
50 
51 #ifndef DIALOG_CONTROLS_H_INCLUDED
52 #define DIALOG_CONTROLS_H_INCLUDED
53 
54 #include <stdlib.h> // for the inline stuff
55 #include "window_helper.h"
56 #include "dialog_window.h"
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif // __cplusplus
61 
62 
107 #define DIALOG_CONTROL_TAG (*((const unsigned int *)"DLGC"))
108 
138 typedef struct s_WB_DIALOG_PROP
139 {
140  Atom aProp;
141  unsigned long lVal;
142  void *pVal;
144 
145 
180 typedef struct s_WB_DIALOG_PROPLIST
181 {
183  int nProps,
185  nMaxProps;
196 
197 
248 typedef struct s_WB_DIALOG_CONTROL
249 {
250  unsigned int ulTag;
251  Window wID;
252  Atom aClass;
256  unsigned long ulFlags;
257  XColor clrFG,
258  clrBG,
259  clrBD;
260  XColor clrBD2,
261  clrBD3;
262  XColor clrHFG,
263  clrHBG;
264  XColor clrAFG,
265  clrABG;
266  char *pCaption;
269 
270  // unique per-control data members follow (see cbStructSize for validation)
271 
273 
274 
275 
276 
286 void WBDialogControlsInit(void); // call once before using (dialog_window.c does this for you)
287 
309  WBDialogEntry *pDialogEntry, // pointer to the dialog entry I'll be using
310  int iX, int iY, int iWidth, int iHeight,
311  const char *szTitle, const char *szPropertyList);
312 
326 void DLGRegisterControlCallback(WBDialogControl *pDialogControl, const char *szClassName, WBWinEvent pCallback);
327 
328 
340 static __inline__ void WBDialogControlInvalidateGeom(WBDialogControl *pDialogControl, const WB_GEOM *pGeom, int bPaintFlag)
341 {
342  if(pDialogControl) // TODO: a 'validate' function?
343  {
344  WBInvalidateGeom(pDialogControl->wID, pGeom, bPaintFlag);
345  }
346 }
347 
359 static __inline__ void WBDialogControlInvalidateRegion(WBDialogControl *pDialogControl, Region rgn, int bPaintFlag)
360 {
361  if(pDialogControl) // TODO: a 'validate' function?
362  {
363  WBInvalidateRegion(pDialogControl->wID, rgn, bPaintFlag);
364  }
365 }
366 
367 // generic property list helpers (low level)
373 int WBDialogControlSetDialogProp(WBDialogControl *pCtrl, WB_DIALOG_PROP *pPropVal); // returns 0 on success
379 void WBDialogControlDelDialogProp(WBDialogControl *pCtrl, Atom aProp);
392 {
393  if(pCtrl)
394  {
395  return pCtrl->pPropList;
396  }
397  return NULL;
398 }
399 
400 // generic property list helpers (mid-level)
401 
407 int WBDialogControlSetPropList(WBDialogControl *pCtrl, const char *szPropList); // prop:value prop:"value" etc. separated by white space
421 int WBDialogControlSetProperty(WBDialogControl *pCtrl, Atom aPropName, const char *szPropVal);
441 void WBDialogControlSetProperty2(WBDialogControl *pCtrl, Atom aPropName, void *szPropVal); // szPropVal must be WBAlloc'd pointer or NULL
442 
456 const char *WBDialogControlGetProperty(WBDialogControl *pCtrl, Atom aPropName);
475 void *WBDialogControlGetProperty2(WBDialogControl *pCtrl, Atom aPropName); // returns actual WBAlloc'd pointer or NULL
476 
477 
478 
489 static __inline__ WBDialogControl *DLGGetDialogControlStruct(Window wID) // for dialog controls, returns the dialog control struct
490 {
491  if(wID != None)
492  {
493  WBDialogControl *pRval = (WBDialogControl *)WBGetWindowData(wID, 0); // offset 0 for window-specific structs
494 
495  if(pRval && pRval->ulTag == DIALOG_CONTROL_TAG)
496  return(pRval);
497  }
498 
499  return(NULL);
500 }
501 
513 static __inline__ WBDialogControl * WBGetDialogEntryControlStruct(WBDialogWindow *pDialog, int iControlID)
514 {
515  return DLGGetDialogControlStruct(DLGGetDialogControl(pDialog, iControlID));
516 }
517 
518 
519 
520 
521 
522 // dialog control property management (high level)
523 // these have additional implications, which is why they use their own API functions
524 
537 const char *WBDialogControlGetCaption(WBDialogControl *pCtrl);
538 
551 void WBDialogControlSetCaption(WBDialogControl *pCtrl, const char *szCaption); // caption (all, equiv to 'title')
552 
553 
568 static __inline__ int WBDialogControlGetCaptionInt(WBDialogControl *pCtrl)
569 {
570 const char *pCaption;
571 
572  pCaption = WBDialogControlGetCaption(pCtrl);
573 
574  if(!pCaption || !*pCaption)
575  {
576  return 0;
577  }
578 
579  return(atoi(pCaption));
580 }
581 
597 static __inline__ void WBDialogControlSetCaptionInt(WBDialogControl *pCtrl, int iValue, const char *szFormat)
598 {
599 char tbuf[64], tbuf2[4];
600 const char *pF = szFormat;
601 
602  if(!pF || !*pF)
603  {
604  tbuf2[0] = '%';
605  tbuf2[1] = 'd';
606  tbuf2[2] = 0;
607  tbuf2[3] = 0; // this is to tickle the code optimizer into doing a single 32-bit assignment
608 
609  pF = &(tbuf2[0]);
610  }
611 
612  snprintf(tbuf, sizeof(tbuf), pF, iValue);
613  WBDialogControlSetCaption(pCtrl, tbuf);
614 }
615 
630 static __inline__ long WBDialogControlGetCaptionLong(WBDialogControl *pCtrl)
631 {
632 const char *pCaption;
633 
634  pCaption = WBDialogControlGetCaption(pCtrl);
635 
636  if(!pCaption || !*pCaption)
637  {
638  return 0;
639  }
640 
641  return(atol(pCaption));
642 }
643 
659 static __inline__ void WBDialogControlSetCaptionLong(WBDialogControl *pCtrl, long lValue, const char *szFormat)
660 {
661 char tbuf[64], tbuf2[4];
662 const char *pF = szFormat;
663 
664  if(!pF || !*pF)
665  {
666  tbuf2[0] = '%';
667  tbuf2[1] = 'l';
668  tbuf2[2] = 'd';
669  tbuf2[3] = 0;
670 
671  pF = &(tbuf2[0]);
672  }
673 
674  snprintf(tbuf, sizeof(tbuf), pF, lValue);
675  WBDialogControlSetCaption(pCtrl, tbuf);
676 }
677 
678 #ifdef WB_INT64
679 
694 {
695 const char *pCaption;
696 
697  pCaption = WBDialogControlGetCaption(pCtrl);
698 
699  if(!pCaption || !*pCaption)
700  {
701  return 0;
702  }
703 
704  return(atoll(pCaption));
705 }
706 
722 static __inline__ void WBDialogControlSetCaptionLongLong(WBDialogControl *pCtrl, WB_INT64 llValue, const char *szFormat)
723 {
724 char tbuf[128], tbuf2[8];
725 const char *pF = szFormat;
726 
727  if(!pF || !*pF)
728  {
729  tbuf2[0] = '%';
730  tbuf2[1] = 'l';
731  tbuf2[2] = 'l';
732  tbuf2[3] = 'd';
733  tbuf2[4] = 0;
734  tbuf2[5] = 0;
735  tbuf2[6] = 0;
736  tbuf2[7] = 0; // encourages the optimizer to use a 64-bit or two 32-bit assignments
737 
738  pF = &(tbuf2[0]);
739  }
740 
741  snprintf(tbuf, sizeof(tbuf), pF, llValue);
742  WBDialogControlSetCaption(pCtrl, tbuf);
743 }
744 #endif // WB_INT64
745 
746 
763 void WBDialogControlSetPixmap(WBDialogControl *pCtrl, Pixmap pixmap); // pixmaps (image, icon, button?)
780 
798 void WBDialogControlSetIconPixmap(WBDialogControl *pCtrl, Pixmap pixmap, Pixmap pixmap2); // icons only
815 Pixmap WBDialogControlGetIconPixmap(WBDialogControl *pCtrl, Pixmap *pPixmap2);
816 
829 void WBDialogControlSetCheck(WBDialogControl *pCtrl, int iCheck);
830 
843 
844 
845 
857 static __inline__ void WBDialogControlSetText(WBDialogControl *pCtrl, const char *szText)
858 {
859 #ifdef DIALOG_SUPPORT_C
860 extern Atom aDLGC_TEXT;
861 #else // !DIALOG_SUPPORT_C
862 extern const Atom aDLGC_TEXT;
863 #endif // DIALOG_SUPPORT_C
864 
865  // multi-line edit, listboxes, and combo boxes use this
866 
867  WBDialogControlSetProperty(pCtrl, aDLGC_TEXT, szText);
868 }
869 
881 static __inline__ const char *WBDialogControlGetText(WBDialogControl *pCtrl)
882 {
883 #ifdef DIALOG_SUPPORT_C
884 extern Atom aDLGC_TEXT;
885 #else // !DIALOG_SUPPORT_C
886 extern const Atom aDLGC_TEXT;
887 #endif // DIALOG_SUPPORT_C
888 
889  return WBDialogControlGetProperty(pCtrl, aDLGC_TEXT);
890 }
891 
892 
893 
894 // combined functionality with dialog window
895 
908 static __inline__ WBDialogControl *DLGGetDialogControlStructFromID(WBDialogWindow *pDialog, int iControlID)
909 {
910  if(pDialog)
911  {
912  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
913  if(idCtrl > 0)
914  {
915  WBDialogControl *pRval = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
916 
917  if(pRval && pRval->ulTag == DIALOG_CONTROL_TAG)
918  return(pRval);
919  }
920  }
921  return NULL;
922 }
923 
939 static __inline__ void DLGSetControlCaption(WBDialogWindow *pDialog, int iControlID, const char *szCaption)
940 {
941  if(pDialog)
942  {
943  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
944  if(idCtrl > 0)
945  {
946  WBDialogControl *pCtrl = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
947 
948  if(pCtrl && pCtrl->ulTag == DIALOG_CONTROL_TAG)
949  {
950  WBDialogControlSetCaption(pCtrl, szCaption);
951  }
952  }
953  }
954 }
955 
970 static __inline__ const char * DLGGetControlCaption(WBDialogWindow *pDialog, int iControlID)
971 {
972  if(pDialog)
973  {
974  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
975  if(idCtrl > 0)
976  {
977  WBDialogControl *pCtrl = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
978 
979  if(pCtrl && pCtrl->ulTag == DIALOG_CONTROL_TAG)
980  {
981  return WBDialogControlGetCaption(pCtrl);
982  }
983  }
984  }
985 
986  return NULL;
987 }
988 
1004 static __inline__ void DLGSetControlText(WBDialogWindow *pDialog, int iControlID, const char *szText)
1005 {
1006  if(pDialog)
1007  {
1008  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
1009  if(idCtrl > 0)
1010  {
1011  WBDialogControl *pCtrl = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
1012 
1013  if(pCtrl && pCtrl->ulTag == DIALOG_CONTROL_TAG)
1014  {
1015  WBDialogControlSetText(pCtrl, szText);
1016  }
1017  }
1018  }
1019 }
1020 
1035 static __inline__ const char * DLGGetControlText(WBDialogWindow *pDialog, int iControlID)
1036 {
1037  if(pDialog)
1038  {
1039  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
1040  if(idCtrl > 0)
1041  {
1042  WBDialogControl *pCtrl = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
1043 
1044  if(pCtrl && pCtrl->ulTag == DIALOG_CONTROL_TAG)
1045  {
1046  return WBDialogControlGetText(pCtrl);
1047  }
1048  }
1049  }
1050 
1051  return NULL;
1052 }
1053 
1054 // simplified string property handlers
1055 
1074 static __inline__ int DLGSetControlProperty(WBDialogWindow *pDialog, int iControlID, Atom aPropName, const char *szPropVal)
1075 {
1076  if(pDialog)
1077  {
1078  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
1079  if(idCtrl > 0)
1080  {
1081  WBDialogControl *pCtrl = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
1082 
1083  if(pCtrl && pCtrl->ulTag == DIALOG_CONTROL_TAG)
1084  {
1085  return WBDialogControlSetProperty(pCtrl, aPropName, szPropVal);
1086  }
1087  }
1088  }
1089 
1090  return -1; // error
1091 }
1092 
1111 static __inline__ const char * DLGGetControlProperty(WBDialogWindow *pDialog, int iControlID, Atom aPropName)
1112 {
1113  if(pDialog)
1114  {
1115  Window idCtrl = DLGGetDialogControl(pDialog, iControlID);
1116  if(idCtrl > 0)
1117  {
1118  WBDialogControl *pCtrl = (WBDialogControl *)WBGetWindowData(idCtrl, 0); // offset 0 for window-specific structs
1119 
1120  if(pCtrl && pCtrl->ulTag == DIALOG_CONTROL_TAG)
1121  {
1122  return WBDialogControlGetProperty(pCtrl, aPropName);
1123  }
1124  }
1125  }
1126 
1127  return NULL;
1128 }
1129 
1130 
1134 // standard control IDs
1135 #define WB_MIN_STD_CTRL_ID 0x7ffffff0
1136 #define IDOK 0x7ffffff0
1137 #define IDNO 0x7ffffff1
1138 #define IDYES 0x7ffffff2
1139 #define IDABORT 0x7ffffff3
1140 #define IDRETRY 0x7ffffff4
1141 #define IDIGNORE 0x7ffffff5
1142 #define IDCANCEL 0x7fffffff
1143 #define IDSTATIC -1
1144 #define IDNONE 0
1149 // standard atoms for control types - string definitions
1150 
1154 #define FRAME_CONTROL_STR "Frame"
1155 #define TEXT_CONTROL_STR "Text"
1156 #define ICON_CONTROL_STR "Icon"
1157 #define IMAGE_CONTROL_STR "Image"
1158 #define EDIT_CONTROL_STR "Edit"
1159 #define PUSHBUTTON_CONTROL_STR "PushButton"
1160 #define DEFPUSHBUTTON_CONTROL_STR "DefPushButton"
1161 #define CANCELBUTTON_CONTROL_STR "CancelButton"
1162 #define RADIOBUTTON_CONTROL_STR "RadioButton"
1163 #define FIRSTRADIOBUTTON_CONTROL_STR "FirstRadioButton"
1164 #define CHECKBUTTON_CONTROL_STR "CheckButton"
1165 #define TRISTATEBUTTON_CONTROL_STR "TriStateButton"
1166 #define HSCROLL_CONTROL_STR "HScroll"
1167 #define VSCROLL_CONTROL_STR "VScroll"
1168 #define SLIDER_CONTROL_STR "Slider"
1169 #define KNOB_CONTROL_STR "Knob"
1170 #define LIST_CONTROL_STR "List"
1171 #define COMBO_CONTROL_STR "Combo"
1172 #define TREE_CONTROL_STR "Tree"
1173 #define COMBOTREE_CONTROL_STR "ComboTree"
1174 #define FILE_LIST_CONTROL_STR "FileList"
1175 #define FILE_COMBO_CONTROL_STR "FileCombo"
1176 #define PATH_TREE_CONTROL_STR "PathTree"
1177 #define TAB_CONTROL_STR "Tab"
1183 // atoms and strings for standard control types (doxygen - these are documented in dialog_controls.c)
1184 #ifndef DIALOG_SUPPORT_C
1185 
1186 
1187 // static controls
1188 
1189 extern const Atom aFRAME_CONTROL; // transparent frame with optional text - \ref FRAME_CONTROL_STR
1190 extern const Atom aTEXT_CONTROL; // static text (single or multi-line) - \ref TEXT_CONTROL_STR
1191 extern const Atom aICON_CONTROL; // icon container (has a nice 3D border) - \ref ICON_CONTROL_STR
1192 extern const Atom aIMAGE_CONTROL; // generic image/pixmap holder - \ref IMAGE_CONTROL_STR
1193 
1194 
1195 // text entry
1196 
1197 extern const Atom aEDIT_CONTROL; // editable text (single or multi-line, scrollable, clipboard) - \ref EDIT_CONTROL_STR
1198 
1199 
1200 // buttons, knobs, and sliders
1201 
1202 extern const Atom aPUSHBUTTON_CONTROL; // Pushbutton control - \ref PUSHBUTTON_CONTROL_STR
1203 extern const Atom aDEFPUSHBUTTON_CONTROL; // default Pushbutton control (has dark border, accepts &lt;ENTER&gt; as hotkey) - \ref DEFPUSHBUTTON_CONTROL_STR
1204 extern const Atom aCANCELBUTTON_CONTROL; // cancel pushbutton control (accepts &lt;ESC&gt; as hotkey) - \ref CANCELBUTTON_CONTROL_STR
1205 extern const Atom aRADIOBUTTON_CONTROL; // radio button - \ref RADIOBUTTON_CONTROL_STR
1206 extern const Atom aFIRSTRADIOBUTTON_CONTROL; // 'first' radio button - defines start of radio button 'group' - \ref FIRSTRADIOBUTTON_CONTROL_STR
1207 extern const Atom aCHECKBUTTON_CONTROL; // check[box] button - push-on/push-off with 'check mark' (or whatever) - \ref CHECKBUTTON_CONTROL_STR
1208 extern const Atom aTRISTATEBUTTON_CONTROL; // tristate - like check, but with a third state - \ref TRISTATEBUTTON_CONTROL_STR
1209 extern const Atom aHSCROLL_CONTROL; // horizontal scroll - \ref HSCROLL_CONTROL_STR
1210 extern const Atom aVSCROLL_CONTROL; // vertical scroll - \ref VSCROLL_CONTROL_STR
1211 extern const Atom aSLIDER_CONTROL; // volume control (slider bar) (h or v depending on geometry) - \ref SLIDER_CONTROL_STR
1212 extern const Atom aKNOB_CONTROL; // "volume knob" (270 degrees of rotation, left to right) - \ref KNOB_CONTROL_STR
1213 
1214 
1215 // lists
1216 
1217 extern const Atom aLIST_CONTROL; // list - single, multi, extended select (h, v, multicol) - \ref LIST_CONTROL_STR
1218 extern const Atom aCOMBO_CONTROL; // classic 'combo box' control - \ref COMBO_CONTROL_STR
1219 extern const Atom aTREE_CONTROL; // class 'tree' control - \ref TREE_CONTROL_STR
1220 extern const Atom aCOMBOTREE_CONTROL; // 'combo tree' (tree with interlocked edit/text box like combo box) - \ref COMBOTREE_CONTROL_STR
1221 
1222 
1223 // file lists
1224 
1225 extern const Atom aFILE_LIST_CONTROL; // File List - \ref FILE_LIST_CONTROL_STR
1226 extern const Atom aFILE_COMBO_CONTROL; // file combo control - \ref FILE_COMBO_CONTROL_STR
1227 extern const Atom aPATH_TREE_CONTROL; // path tree - directory hierarchy - \ref PATH_TREE_CONTROL_STR
1228 
1229 
1230 // containers
1231 
1232 extern const Atom aTAB_CONTROL; // 'tab' container (auto enable/disable contents) - \ref TAB_CONTROL_STR
1233 
1234 
1235 
1236 // control owner notification messages
1237 
1238 // generic control notification - use aCONTROL_NOTIFY (doxygen docs in dialog_controls.c)
1239 
1240 // CONTROL_NOTIFY "NOTIFICATION" CODES (code will be in data.l[0])
1241 // button-specific notifications
1242 extern const Atom aBUTTON_PRESS;
1243 
1244 // list-specific
1245 extern const Atom aLIST_NOTIFY; // applies to lisbox. also applies to tab controls, combos, etc.
1246  // on receipt default dialog proc will end dialog with 'IDOK'
1247 
1248 // edit-specific, combo-specific
1249 extern const Atom aTEXT_CHANGED;
1250 extern const Atom aTEXTSELECT_CHANGE;
1251 
1252 // mouse click/drag notifications (for certain controls, where appropriate)
1253 extern const Atom aMOUSE_CLICK;
1254 extern const Atom aMOUSE_DBLCLICK;
1255 extern const Atom aMOUSE_DRAG;
1256 
1257 // ---------------------------
1258 // other notification messages
1259 // ---------------------------
1260 
1261 // common to all
1262 extern const Atom aGOTFOCUS; // sent as its own message type - data.l[0] = wID, data.l[1] = pDlgControlEntry
1263 extern const Atom aLOSTFOCUS; // sent as its own message type - data.l[0] = wID, data.l[1] = pDlgControlEntry
1264 
1265 // low level common (not all return these)
1266 extern const Atom aKEY_DOWN;
1267 extern const Atom aKEY_UP;
1268 extern const Atom aKEYSTROKE; // valid key down/up sequence, including repeat
1269 
1270 // other dialog-related message atoms
1271 extern const Atom aDIALOG_INIT;
1272 
1273 
1274 // dialog control notification messages (sent to the controls by 'whomever')
1275 extern const Atom aDLGC_PROP_NOTIFY; // l[0] is the property Atom
1276 extern const Atom aDLGC_TEXT; // set the text
1277 extern const Atom aDLGC_CONTROL_GET; // get a property (specific properties only)
1278 extern const Atom aDLGC_CONTROL_SET; // set a property (specific properties only)
1279 
1280 
1281 
1282 // control-specific 'globally known' atoms
1283 
1284 extern Atom aDLGC_PATH; // PATH information for file-related controls
1285 
1286 #endif // DIALOG_SUPPORT_C
1287 
1288 
1289 // NOTIFICATION PARAMETERS
1290 
1291 // data.l[2] parameter definitions for aCONTROL_NOTIFY + aLIST_NOTIFY ClientMessage
1292 
1297 #define WB_LIST_NONE 0
1298 #define WB_LIST_SELCHANGE 1
1299 #define WB_LIST_DBLCLICK 2
1307 // control-specific definitions
1309 
1311 // LISTBOX-related (applies to anything with a LIST property)
1312 
1320 {
1322  ControlListIndex_LAST = 0x7fffffff,
1327 };
1328 
1334 {
1343 
1344  // others are reserved
1345 };
1346 
1347 
1353 {
1356 
1358 
1359  // others are reserved
1360 };
1361 
1362 
1363 // 'ulFlags' bits 0000ffff is "common", 00ff0000 is control-specific, ff000000 is 'reserved for custom'
1373 {
1374  // COMMON bits (APPLIES TO ALL) - MASK 0000FFFFH
1375 
1376  CONTROL_Reserved00 = 0x00000001,
1377  CONTROL_Reserved01 = 0x00000002,
1378  CONTROL_Reserved02 = 0x00000004,
1379  CONTROL_Reserved03 = 0x00000008,
1380  CONTROL_Reserved04 = 0x00000010,
1381  CONTROL_Reserved05 = 0x00000020,
1382  CONTROL_Reserved06 = 0x00000040,
1383  CONTROL_Reserved07 = 0x00000080,
1384  CONTROL_Reserved08 = 0x00000100,
1385  CONTROL_Reserved09 = 0x00000200,
1386  CONTROL_Reserved10 = 0x00000400,
1387  CONTROL_Reserved11 = 0x00000800,
1388  CONTROL_Reserved12 = 0x00001000,
1389  CONTROL_Reserved13 = 0x00002000,
1390  CONTROL_Reserved14 = 0x00004000,
1391 
1393  // NOTE: A \ref WBListCurSel struct must immediately follow the \ref WBDialogControl members
1394 
1395 
1396  // CONTROL TYPE-SPECIFIC bits (they use the same bits as one another, mask 000F0000H
1397 
1398  // STATIC bits
1399 
1400  STATIC_Default = 0x00000000,
1401  STATIC_Frame = 0x00010000,
1402  STATIC_Text = 0x00020000,
1403  STATIC_Icon = 0x00030000,
1404  STATIC_Image = 0x00040000,
1405 
1406  STATIC_TYPEMASK = 0x00070000,
1407 
1408  STATIC_3DBorder = 0x00080000,
1409 
1410 
1411  // BUTTON bits
1412 
1413  BUTTON_PushButton = 0x00010000,
1414  BUTTON_DefPushButton = 0x00020000,
1415  BUTTON_CancelButton = 0x00030000,
1416  BUTTON_RadioButton = 0x00040000,
1418  BUTTON_CheckButton = 0x00060000,
1419  BUTTON_TriStateButton = 0x00070000,
1420 
1421  BUTTON_TYPEMASK = 0x000f0000,
1422 
1423 
1424  // others here
1425 
1426  // auto-alignment flags (for resizable dialog boxes) mask 00F00000H - see WBDialogEntry_xxx flags in dialog_window.h
1427 
1433 
1439 
1441 
1442  // reserved for custom controls
1443 
1444  CUSTOM_Reserved24 = 0x01000000,
1445  CUSTOM_Reserved25 = 0x02000000,
1446  CUSTOM_Reserved26 = 0x04000000,
1447  CUSTOM_Reserved27 = 0x08000000,
1448  CUSTOM_Reserved28 = 0x10000000,
1449  CUSTOM_Reserved29 = 0x20000000,
1450  CUSTOM_Reserved30 = 0x40000000,
1451  CUSTOM_Reserved31 = 0x80000000
1452 };
1453 
1454 
1456 // control-specific utility functions
1458 
1464 void * DLGCDefaultListInfoAllocator(const void *pData, int cbData);
1465 
1471 const char * DLGGetControlListText(WBDialogControl *pCtrl, int iIndex); // retrieve data pointer for single list entry
1477 const void * DLGGetControlListData(WBDialogControl *pCtrl, int iIndex); // retrieve data pointer for single list entry
1478 
1495 int DLGInitControlListInfo(WBDialogControl *pCtrl, int nFlags,
1496  void *(*pfnAllocator)(const void *,int), void (*pfnDestructor)(void *),
1497  void (*pfnDisplay)(WBDialogControl *, void *, int, WBGC, WB_GEOM *, WB_FONTC),
1498  int (*pfnSort)(const void *, const void *));
1499 
1508 #define DLGInitControlListInfoDefault(X) \
1509  DLGInitControlListInfo(X, ListInfoFlags_SORTED, DLGCDefaultListInfoAllocator, WBFree, NULL, NULL)
1510 
1511 
1512 
1535 int DLGModifyControlListInfo(WBDialogControl *pCtrl, int bFlags, int nFlags,
1536  int bAllocator, void *(*pfnAllocator)(const void *,int),
1537  int bDestructor, void (*pfnDestructor)(void *),
1538  int bDisplay, void (*pfnDisplay)(WBDialogControl *, void *, int, WBGC, WB_GEOM *, WB_FONTC),
1539  int bSort, int (*pfnSort)(const void *, const void *));
1540 
1558 int DLGAddControlListEntry(WBDialogControl *pCtrl, const char *pData, long cbData, int iIndex);
1559 
1570 void DLGDelControlListEntry(WBDialogControl *pCtrl, int iIndex); // delete item at index 'iIndex' (iIndex < 0 to delete all)
1571 
1583 int DLGGetControlListSelection(WBDialogControl *pCtrl); // get selection for single-selection list
1584 
1596 void DLGSetControlListSelection(WBDialogControl *pCtrl, int iIndex); // set single selection for list
1597 
1610 void DLGSetControlListSelectionValue(WBDialogControl *pCtrl, int iIndex, int iSelState); // set sel state for specific index
1611 
1634 int DLGGetControlListSelectionBits(WBDialogControl *pCtrl, unsigned int *piBits, int nSize);
1635  // piBits and nSize must be large enough to accomodate bits. 'nSize' is number of integers (not bytes)
1636  // return value is 0 for no sel, >0 for number of selections, < 0 on error. assume 32 bits per entry ( LSbit is entry '0' )
1637  // a '1' in a bit position indicates the entry has been selected.
1638 
1649 char * DLGGetControlListSelectionText(WBDialogControl *pCtrl); // caller must 'WBFree()' non-NULL returned pointer
1650  // this returns TEXT elements (separated by line feeds) for corresponding selected LB entries
1651  // use this for multi-selection listboxes with unique text entries for which the list text is desired
1652 
1653 
1654 // SCROLL NOTIFICATION GENERATOR - generic pre-filter / handler for embedded scroll bars
1655 
1672 int DLGScrollBarHandler(Window wID, WBDialogControl *pCtrl, XEvent *pEvent);
1673  // NOTE: if this function returns a non-zero value, that same value should be returned
1674  // unmodified from the control's message callback in order for this to work properly.
1675 
1676 
1677 // notification methods (inline functions) - messages "sent" (not placed in queue)
1678 
1689 static __inline__ void DLGNotifyOwner(WBDialogControl *pDialogControl, Atom aNotify,
1690  long lData0, long lData1, long lData2, long lData3, long lData4)
1691 {
1692 Display *pDisplay = WBGetWindowDisplay(pDialogControl->wID);
1693 
1694  if(pDialogControl->pOwner)
1695  {
1696 // C99 constructs are cool, but maybe not portable...
1697 // XClientMessageEvent evt = {
1698 // .type=ClientMessage,
1699 // .serial=0,
1700 // .send_event=0,
1701 // .display=pDisplay,
1702 // .window=pDialogControl->pOwner->wID,
1703 // .message_type=aNotify, // typically aCONTROL_NOTIFY
1704 // .format=32
1705 // };
1706  XClientMessageEvent evt;
1707 
1708  evt.type=ClientMessage;
1709  evt.serial=0;
1710  evt.send_event=0;
1711  evt.display=pDisplay;
1712  evt.window=pDialogControl->pOwner->wID;
1713  evt.message_type=aNotify; // typically aCONTROL_NOTIFY
1714  evt.format=32;
1715 
1716  evt.data.l[0] = lData0; // nearly always an Atom
1717  evt.data.l[1] = lData1; // typically the window ID
1718  evt.data.l[2] = lData2;
1719  evt.data.l[3] = lData3;
1720  evt.data.l[4] = lData4;
1721 
1722  WBWindowDispatch(pDialogControl->pOwner->wID, (XEvent *)&evt);
1723  }
1724 }
1725 
1743 static __inline__ void DLGNotifySelf(WBDialogControl *pDialogControl, Atom aNotify,
1744  long lData0, long lData1, long lData2, long lData3, long lData4)
1745 {
1746 Display *pDisplay = WBGetWindowDisplay(pDialogControl->wID);
1747 
1748  XClientMessageEvent evt = {
1749  .type=ClientMessage,
1750  .serial=0,
1751  .send_event=0,
1752  .display=pDisplay,
1753  .window=pDialogControl->wID,
1754  .message_type=aNotify,
1755  .format=32
1756  };
1757  evt.data.l[0] = lData0;
1758  evt.data.l[1] = lData1;
1759  evt.data.l[2] = lData2;
1760  evt.data.l[3] = lData3;
1761  evt.data.l[4] = lData4;
1762 
1763  WBWindowDispatch(pDialogControl->wID, (XEvent *)&evt);
1764 }
1765 
1766 // asynchronous versions (posts priority event on message queue)
1767 
1779 static __inline__ void DLGNotifyOwnerAsync(WBDialogControl *pDialogControl, Atom aNotify,
1780  long lData0, long lData1, long lData2, long lData3, long lData4)
1781 {
1782 Display *pDisplay = WBGetWindowDisplay(pDialogControl->wID);
1783 
1784  if(pDialogControl->pOwner)
1785  {
1786  XClientMessageEvent evt = {
1787  .type=ClientMessage,
1788  .serial=0,
1789  .send_event=0,
1790  .display=pDisplay,
1791  .window=pDialogControl->pOwner->wID,
1792  .message_type=aNotify,
1793  .format=32
1794  };
1795  evt.data.l[0] = lData0;
1796  evt.data.l[1] = lData1;
1797  evt.data.l[2] = lData2;
1798  evt.data.l[3] = lData3;
1799  evt.data.l[4] = lData4;
1800 
1801  WBPostPriorityEvent(pDialogControl->pOwner->wID, (XEvent *)&evt);
1802  }
1803 }
1804 
1823 static __inline__ void DLGNotifySelfAsync(WBDialogControl *pDialogControl, Atom aNotify,
1824  long lData0, long lData1, long lData2, long lData3, long lData4)
1825 {
1826 Display *pDisplay = WBGetWindowDisplay(pDialogControl->wID);
1827 
1828  XClientMessageEvent evt = {
1829  .type=ClientMessage,
1830  .serial=0,
1831  .send_event=0,
1832  .display=pDisplay,
1833  .window=pDialogControl->wID,
1834  .message_type=aNotify,
1835  .format=32
1836  };
1837  evt.data.l[0] = lData0;
1838  evt.data.l[1] = lData1;
1839  evt.data.l[2] = lData2;
1840  evt.data.l[3] = lData3;
1841  evt.data.l[4] = lData4;
1842 
1843  WBPostPriorityEvent(pDialogControl->wID, (XEvent *)&evt);
1844 }
1845 
1846 #ifdef __cplusplus
1847 };
1848 #endif // __cplusplus
1849 
1850 
1851 #endif // DIALOG_CONTROLS_H_INCLUDED
1852 
1853 
STATIC - display with a 3D-looking border.
WBDialogPropList * pPropList
pointer to the property list (may be NULL)
const Atom aLOSTFOCUS
CONTROL_NOTIFY ClientMessage for LOSTFOCUS event.
BUTTON - Default Push Button (activate by <ENTER>)
Structure identifying one of the controls that appears on a dialog window.
re-alignment with respect to center (as a percentage, stretching allowed)
'window helper' main header file for the X11workbench Toolkit API
unsigned long ulFlags
generic flag bits
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.
const Atom aGOTFOCUS
CONTROL_NOTIFY ClientMessage for GOTFOCUS event.
CONTROL bits, reserved 12.
ControlGetSetProperties
Control 'Get/Set' properties used by aDLGC_CONTROL_SET and aDLGC_CONTROL_GET.
const Atom aDLGC_PROP_NOTIFY
DLGC_PROP_NOTIFY ClientMessage, notify control of property change.
STATIC - 'type mask' for static controls.
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.
void * WBGetWindowData(Window wID, int iIndex)
Gets the data associated with this window and the specified index.
CUSTOM - reserved bit 25.
CONTROL bits, reserved 06.
void DLGDelControlListEntry(WBDialogControl *pCtrl, int iIndex)
Delete a list entry from a control's list info at a specified index (or deletes ALL entries)
const Atom aDLGC_CONTROL_SET
CONTROL_SET ClientMessage - use this to set specific supported control properties by sending it to th...
this control supports a LISTINFO property.
CONTROL bits, reserved 00.
const Atom aPATH_TREE_CONTROL
Standard Dialog Control - path tree - directory hierarchy - see PATH_TREE_CONTROL_STR.
BUTTON - Tri-state button.
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.
BUTTON - Checkbox button.
CUSTOM - reserved bit 27.
const Atom aMOUSE_DBLCLICK
CONTROL_NOTIFY ClientMessage for MOUSE_DBLCLICK event.
static __inline__ WBDialogControl * DLGGetDialogControlStructFromID(WBDialogWindow *pDialog, int iControlID)
Returns a pointer to the WBDialogControl structure for a dialog control with validation....
CUSTOM - reserved bit 31.
CONTROL bits, reserved 01.
WBDialogControl * WBDialogControlCreate(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.
'tristate' flag. when 'setting', -1 'toggles', 1 sets it, 0 clears it. when 'getting',...
const Atom aLIST_NOTIFY
CONTROL_NOTIFY ClientMessage for LIST_NOTIFY event.
XColor clrBD
border color
const Atom aDLGC_CONTROL_GET
CONTROL_GET ClientMessage - use this to get specific supported control properties by sending it to th...
void DLGSetControlListSelection(WBDialogControl *pCtrl, int iIndex)
Assign the current selection index for a single-selection list.
WBDialogWindow * pOwner
pointer to owner dialog box
const Atom aKEY_DOWN
CONTROL_NOTIFY ClientMessage for KEY_DOWN event.
int WBWindowDispatch(Window wID, XEvent *pEvent)
Dispatches a window XEvent. May be called directly.
int DLGAddControlListEntry(WBDialogControl *pCtrl, const char *pData, long cbData, int iIndex)
Add a list entry to a control's list info.
int DLGInitControlListInfo(WBDialogControl *pCtrl, 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 *))
Initialize the 'List Entry' for a control, specifying various callbacks and flags.
default position re-alignment with respect to center (as a percentage, no stretching)
CUSTOM - reserved bit 26.
Atom aDLGC_PATH
dialog control PATH property, for file and directory controls
const Atom aDEFPUSHBUTTON_CONTROL
Standard Dialog Control - default Pushbutton control (has dark border, accepts <ENTER> as hotkey) - s...
BUTTON - Cancel Push Button (activate by <ESC>)
XColor clrAFG
active state-based foreground color
XColor clrABG
active state-based background color
int WBPostPriorityEvent(Window wID, XEvent *pEvent)
Places a copy of the specified event at the end of the priority (internal) event queue.
const void * DLGGetControlListData(WBDialogControl *pCtrl, int iIndex)
Retrieve the data pointer for a single list entry (listbox, combo, and tree controls only)
internal wrapper struct for X11 'geometry' definition
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.
const Atom aDIALOG_INIT
DIALOG_INIT ClientMessage, sent to dialog window callback on frame create.
void WBInvalidateRegion(Window wID, Region rgn, int bPaintFlag)
'Paint' helper, invalidates a region for asynchronous Expose event generation
STATIC - Image control window.
static __inline__ void WBDialogControlInvalidateRegion(WBDialogControl *pDialogControl, Region rgn, int bPaintFlag)
Convenience function, invalidates a region for a dialog box control.
BUTTON - Radio button (generic)
STATIC - default (reserved)
Atom aClass
basic control class atom
const Atom aMOUSE_CLICK
CONTROL_NOTIFY ClientMessage for MOUSE_CLICK event.
default position re-alignment with respect to center (as a percentage, no stretching)
const Atom aLIST_CONTROL
Standard Dialog Control - list - single, multi, extended select (h, v, multicol) - see LIST_CONTROL_S...
Structure identifying a dialog (frame) window.
void WBDialogControlDelDialogProp(WBDialogControl *pCtrl, Atom aProp)
Low-level dialog control property removal.
WBWinEvent pDLGControlCallback
control's callback function
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.
const Atom aRADIOBUTTON_CONTROL
Standard Dialog Control - radio button - see RADIOBUTTON_CONTROL_STR.
const char * WBDialogControlGetProperty(WBDialogControl *pCtrl, Atom aPropName)
Mid-level dialog control property retrieval (character string)
const Atom aSLIDER_CONTROL
Standard Dialog Control - volume control (slider bar) (h or v depending on geometry) - see SLIDER_CON...
void WBInvalidateGeom(Window wID, const WB_GEOM *pGeom, int bPaintNow)
'Paint' helper, invalidates a geometry for asynchronous Expose event generation
resize maintains position/size with respect to left
resize maintains position/size with respect to right
int nMaxProps
maximum number of available WB_DIALOG_PROP structures in aDlgProp
resize maintains position/size with respect to top
CONTROL bits, reserved 04.
STATIC - Text control window.
XColor clrBG
background color
void WBDialogControlSetIconPixmap(WBDialogControl *pCtrl, Pixmap pixmap, Pixmap pixmap2)
Assign the ICON (image) property for a control, which consists of 2 pixmaps.
static __inline__ void WBDialogControlInvalidateGeom(WBDialogControl *pDialogControl, const WB_GEOM *pGeom, int bPaintFlag)
Convenience function, invalidates a Geom for a dialog box control.
void * pVal
pointer to data, as needed (may be allocated, some property types auto-free the data)
vertical alignment mask
const Atom aTAB_CONTROL
Standard Dialog Control -'tab' container (auto enable/disable contents) - see TAB_CONTROL_STR.
vertical alignment mask
const Atom aTEXT_CONTROL
Standard Dialog Control - static text (single or multi-line) - see TEXT_CONTROL_STR.
re-alignment with respect to center (as a percentage, stretching allowed)
Window DLGGetDialogControl(WBDialogWindow *pDialog, int iControlID)
returns the Window ID of a member control of the dialog window using the 'control ID'
Pixmap WBDialogControlGetPixmap(WBDialogControl *pCtrl)
Obtain the assigned PIXMAP (image) property for a control.
int WBDialogControlSetDialogProp(WBDialogControl *pCtrl, WB_DIALOG_PROP *pPropVal)
Low-level dialog control property assignment.
XColor clrFG
foreground color
BUTTON - 'First' radio button in a group.
const Atom aCOMBO_CONTROL
Standard Dialog Control - classic 'combo box' control - see COMBO_CONTROL_STR.
int DLGGetControlListSelectionBits(WBDialogControl *pCtrl, unsigned int *piBits, int nSize)
Query the selection state for multiple items within a control's list info.
char * DLGGetControlListSelectionText(WBDialogControl *pCtrl)
Query the selection text as multiple strings in an allocated buffer.
resize maintains position/size with respect to bottom
const Atom aFILE_COMBO_CONTROL
Standard Dialog Control - file combo control - see FILE_COMBO_CONTROL_STR.
const Atom aVSCROLL_CONTROL
Standard Dialog Control - vertical scroll - see VSCROLL_CONTROL_STR.
int WBDialogControlSetPropList(WBDialogControl *pCtrl, const char *szPropList)
Mid-level dialog control property list assignment.
XColor clrHFG
highlighted state-based foreground color
const Atom aDLGC_TEXT
dialog control TEXT property - see WBDialogControlGetText()
CONTROL bits, reserved 07.
struct s_WB_DIALOG_PROPLIST WBDialogPropList
Dialog Property List, container for WB_DIALOG_PROP.
Window wID
Window ID of the dialog control window.
default position re-alignment with respect to center (as a percentage, no stretching)
ListInfoFlags
Create flags specified in the call to DLGInitControlListInfo()
re-alignment with respect to center (as a percentage, stretching allowed)
void DLGRegisterControlCallback(WBDialogControl *pDialogControl, const char *szClassName, WBWinEvent pCallback)
Register the dialog control's callback function and class name.
XColor clrBD2
3D border color 2 (light)
const Atom aCOMBOTREE_CONTROL
Standard Dialog Control - 'combo tree' (tree with interlocked edit/text box like combo box) - see COM...
CONTROL bits, reserved 03.
static __inline__ int WBDialogControlGetCaptionInt(WBDialogControl *pCtrl)
Returns an integer from the text of the 'CAPTION' property of a dialog control.
CONTROL bits, reserved 11.
const Atom aEDIT_CONTROL
Standard Dialog Control - editable text (single or multi-line, scrollable, clipboard) - see EDIT_CONT...
static __inline__ const char * WBDialogControlGetText(WBDialogControl *pCtrl)
Obtain the assigned TEXT property for a control, which is different from the CAPTION or Title.
CONTROL bits, reserved 08.
int WBDialogControlGetCheck(WBDialogControl *pCtrl)
Retrieve the 'CHECKED' property from a dialog control. Returns '0' (un-checked) if not applicable.
unsigned long lVal
'long' data value, assigned as needed
const Atom aKEYSTROKE
CONTROL_NOTIFY ClientMessage for KEYSTROKE event.
unsigned int ulTag
The value DIALOG_CONTROL_TAG.
CUSTOM - reserved bit 24.
Dialog property storage structure.
CONTROL bits, reserved 02.
XColor clrHBG
highlighted state-based background color
void * WBDialogControlGetProperty2(WBDialogControl *pCtrl, Atom aPropName)
Mid-level dialog control property list retrieval (generic pointer)
CONTROL bits, reserved 14.
const Atom aCANCELBUTTON_CONTROL
Standard Dialog Control - cancel pushbutton control (accepts <ESC> as hotkey) - see CANCELBUTTON_CONT...
int(* WBWinEvent)(Window wID, XEvent *pEvent)
event callback function type for window events
WBDialogEntry * pDlgControlEntry
pointer to dialog box's WBDialogEntry
static __inline__ const WBDialogPropList * WBDialogControlGetPropList(WBDialogControl *pCtrl)
Low-level dialog control property list retrieval.
int nProps
current number of (contiguous) properties in 'aDlgProp'
XColor clrBD3
3D border color 3 (dark)
STATIC - frame control window.
const Atom aHSCROLL_CONTROL
Standard Dialog Control - horizontal scroll - see HSCROLL_CONTROL_STR.
#define DIALOG_CONTROL_TAG
TAG for the WBDialogControl structure.
CUSTOM - reserved bit 30.
struct s_WB_DIALOG_CONTROL WBDialogControl
Structure identifying the properties of a dialog box control.
const Atom aCHECKBUTTON_CONTROL
Standard Dialog Control - check[box] button - push-on/push-off with 'check mark' (or whatever) - see ...
const Atom aKEY_UP
CONTROL_NOTIFY ClientMessage for KEY_UP event.
CUSTOM - reserved bit 29.
static __inline__ const char * DLGGetControlCaption(WBDialogWindow *pDialog, int iControlID)
Convenience function to query a dialog control's caption based on its control ID.
struct s_WB_DIALOG_PROP WB_DIALOG_PROP
Dialog property storage structure.
const Atom aMOUSE_DRAG
CONTROL_NOTIFY ClientMessage for MOUSE_DRAG event.
const char * WBDialogControlGetCaption(WBDialogControl *pCtrl)
Obtain a pointer to the assigned text for the 'CAPTION' property of a dialog control.
resize maintains position/size with respect to top
last one, update as needed when more flags are added
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, WBGC, WB_GEOM *, WB_FONTC), int bSort, int(*pfnSort)(const void *, const void *))
Modify the 'List Entry' for a control, specifying various callbacks and flags.
const WB_DIALOG_PROP * WBDialogControlGetDialogProp(WBDialogControl *pCtrl, Atom aProp)
Low-level dialog control property retrieval.
const Atom aIMAGE_CONTROL
Standard Dialog Control - generic image/pixmap holder - see IMAGE_CONTROL_STR.
const Atom aTEXTSELECT_CHANGE
CONTROL_NOTIFY ClientMessage for TEXTSELECT_CHANGE event.
char * pCaption
allocated pointer to caption, in lieu of using a WM_NAME property (may be NULL)
static __inline__ void WBDialogControlSetText(WBDialogControl *pCtrl, const char *szText)
Assign the TEXT property for a control, which is different from the CAPTION or Title.
CONTROL bits, reserved 09.
WB_DIALOG_PROP aDlgProp[1]
Pre-allocated array of (contiguous) structures for property storage.
Display * WBGetWindowDisplay(Window wID)
returns the Display associated with a window
CONTROL_FLAGS
Various bit flags used for controls, defined here for convenience.
int DLGGetControlListSelection(WBDialogControl *pCtrl)
Obtain the current selection index for a single-selection list.
long long WB_INT64
Platform abstract 64-bit integer.
void DLGSetControlListSelectionValue(WBDialogControl *pCtrl, int iIndex, int iSelState)
Assign the selection state for a specific index within a control's list info.
const Atom aKNOB_CONTROL
Standard Dialog Control - "volume knob" (270 degrees of rotation, left to right) - see KNOB_CONTROL_S...
resize maintains position/size with respect to right
static __inline__ void WBDialogControlSetCaptionLong(WBDialogControl *pCtrl, long lValue, const char *szFormat)
Assign a long integer as text to the 'CAPTION' property of a dialog control.
const Atom aFIRSTRADIOBUTTON_CONTROL
Standard Dialog Control - 'first' radio button - defines start of radio button 'group' - see FIRSTRAD...
STATIC - Icon control window.
const Atom aTREE_CONTROL
Standard Dialog Control - class 'tree' control - see TREE_CONTROL_STR.
re-alignment with respect to center (as a percentage, stretching allowed)
static __inline__ long WBDialogControlGetCaptionLong(WBDialogControl *pCtrl)
Returns a long integer from the text of the 'CAPTION' property of a dialog control.
vertical alignment mask
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 func...
int DLGScrollBarHandler(Window wID, WBDialogControl *pCtrl, XEvent *pEvent)
Scroll bar event filter for dialog control callback function. Generates scroll events.
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.
const Atom aBUTTON_PRESS
CONTROL_NOTIFY ClientMessage for BUTTON_PRESS event.
resize maintains position/size with respect to left
default position re-alignment with respect to center (as a percentage, no stretching)
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
Definition: font_helper.h:152
const Atom aICON_CONTROL
Standard Dialog Control - icon container (has a nice 3D border) - see ICON_CONTROL_STR.
ControlListIndex
LIST-related constants for the index of an item within a list.
const Atom aTRISTATEBUTTON_CONTROL
Standard Dialog Control - tristate - like check, but with a third state - see TRISTATEBUTTON_CONTROL_...
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.
Atom aProp
Atom identifying the property.
Dialog Property List, container for WB_DIALOG_PROP.
BUTTON - 'type mask' for buttons.
const Atom aFRAME_CONTROL
Standard Dialog Control - transparent frame with optional text - see FRAME_CONTROL_STR.
BUTTON - Push button (generic)
resize maintains position/size with respect to bottom
horizontal alignment mask
alignment mask (both horizontal and vertical)
internal wrapper struct for GC with local cache
alignment mask (both horizontal and vertical)
int WBDialogControlSetProperty(WBDialogControl *pCtrl, Atom aPropName, const char *szPropVal)
Mid-level dialog control property assignment (character string)
const Atom aFILE_LIST_CONTROL
Standard Dialog Control - File List - see FILE_LIST_CONTROL_STR.
CUSTOM - reserved bit 28.
Pixmap WBDialogControlGetIconPixmap(WBDialogControl *pCtrl, Pixmap *pPixmap2)
Obtain the assigned ICON (image) property for a control, which consists of 2 pixmaps.
void * DLGCDefaultListInfoAllocator(const void *pData, int cbData)
The default 'List Info' data allocator for a control's list info.
void WBDialogControlSetCheck(WBDialogControl *pCtrl, int iCheck)
Assign the TEXT property for a control, which is different from the CAPTION or Title.
CONTROL bits, reserved 13.
const Atom aPUSHBUTTON_CONTROL
Standard Dialog Control - Pushbutton control - see PUSHBUTTON_CONTROL_STR.
void WBDialogControlsInit(void)
Initialization function for dialog controls.
Window wID
window ID of the dialog (frame) window
void WBDialogControlSetPixmap(WBDialogControl *pCtrl, Pixmap pixmap)
Assign the PIXMAP (image) property for a control.
static __inline__ WBDialogControl * WBGetDialogEntryControlStruct(WBDialogWindow *pDialog, int iControlID)
Returns a pointer to the WBDialogControl structure for a dialog control based on its ID and containin...
always insert at beginning
const char * DLGGetControlListText(WBDialogControl *pCtrl, int iIndex)
Retrieve the text poiner for a single list entry (listbox, combo, and tree controls only)
void WBDialogControlSetCaption(WBDialogControl *pCtrl, const char *szCaption)
Assign text to the 'CAPTION' property of a dialog control.
CONTROL bits, reserved 05.
static __inline__ void WBDialogControlSetCaptionInt(WBDialogControl *pCtrl, int iValue, const char *szFormat)
Assign an integer as text to the 'CAPTION' property of a dialog control.
static __inline__ WBDialogControl * DLGGetDialogControlStruct(Window wID)
Returns a pointer to the WBDialogControl structure for a dialog control with validation....
Structure identifying the properties of a dialog box control.
int cbStructSize
assigned at allocation time, the total size of this structure
void WBDialogControlSetProperty2(WBDialogControl *pCtrl, Atom aPropName, void *szPropVal)
Mid-level dialog control property list assignment (generic pointer)
const Atom aTEXT_CHANGED
CONTROL_NOTIFY ClientMessage for TEXT_CHANGED event.
'checked' flag. when 'setting', -1 'toggles', 1 sets it, 0 clears it. when 'getting',...
static __inline__ const char * DLGGetControlText(WBDialogWindow *pDialog, int iControlID)
Convenience function to query a dialog control's TEXT based on its control ID.
CONTROL bits, reserved 10.