64 #include <X11/keysymdef.h> 67 #include <X11/cursorfont.h> 70 #include "pixmap_helper.h" 73 #include "dialog_support.h" 76 #include "file_help.h" 82 #define THIS_SUBSYSTEM DebugSubSystem_DialogCtrl 84 #define KEYSYM_DEBUG_FLAG DebugLevel_Excessive 86 #define DEFAULT_STATIC_TAB_WIDTH 4 87 #define DEFAULT_BUTTON_TAB_WIDTH 4 94 #define DEFINE_CREATE_CONTROL(X) \ 95 static WBDialogControl * do_create_##X(WBDialogControl *pDialogControl, \ 96 int iX, int iY, int iWidth, int iHeight, \ 97 const char *szClassName, const char *szTitle); 99 #define IMPLEMENT_CREATE_CONTROL(X) \ 100 static WBDialogControl * do_create_##X(WBDialogControl *pDialogControl, \ 101 int iX, int iY, int iWidth, int iHeight, \ 102 const char *szClassName, const char *szTitle) 104 #define BEGIN_CREATE_CONTROL(X) Atom aThis WB_UNUSED = a##X; 106 DEFINE_CREATE_CONTROL(FRAME_CONTROL)
107 DEFINE_CREATE_CONTROL(TEXT_CONTROL)
108 DEFINE_CREATE_CONTROL(ICON_CONTROL)
109 DEFINE_CREATE_CONTROL(IMAGE_CONTROL)
110 DEFINE_CREATE_CONTROL(EDIT_CONTROL)
111 DEFINE_CREATE_CONTROL(PUSHBUTTON_CONTROL)
112 DEFINE_CREATE_CONTROL(DEFPUSHBUTTON_CONTROL)
113 DEFINE_CREATE_CONTROL(CANCELBUTTON_CONTROL)
114 DEFINE_CREATE_CONTROL(RADIOBUTTON_CONTROL)
115 DEFINE_CREATE_CONTROL(FIRSTRADIOBUTTON_CONTROL)
116 DEFINE_CREATE_CONTROL(CHECKBUTTON_CONTROL)
117 DEFINE_CREATE_CONTROL(TRISTATEBUTTON_CONTROL)
118 DEFINE_CREATE_CONTROL(HSCROLL_CONTROL)
119 DEFINE_CREATE_CONTROL(VSCROLL_CONTROL)
120 DEFINE_CREATE_CONTROL(SLIDER_CONTROL)
121 DEFINE_CREATE_CONTROL(KNOB_CONTROL)
122 DEFINE_CREATE_CONTROL(LIST_CONTROL)
123 DEFINE_CREATE_CONTROL(COMBO_CONTROL)
124 DEFINE_CREATE_CONTROL(TREE_CONTROL)
125 DEFINE_CREATE_CONTROL(COMBOTREE_CONTROL)
126 DEFINE_CREATE_CONTROL(FILE_LIST_CONTROL)
127 DEFINE_CREATE_CONTROL(FILE_COMBO_CONTROL)
128 DEFINE_CREATE_CONTROL(PATH_TREE_CONTROL)
129 DEFINE_CREATE_CONTROL(TAB_CONTROL)
132 static int GetWBDialogControlStructSize(Atom aClass)
172 int DLGControlDefaultCallback(Window wID, XEvent *pEvent)
182 WB_ERROR_PRINT(
"%s - no dialog control struct for window %d (%08xH)\n",
183 __FUNCTION__, (
int)wID, (
int)wID);
192 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Mouse | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
193 "BUTTON PRESS - dialog control\n");
204 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Mouse | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
205 "BUTTON RELEASE - dialog control\n");
213 WB_DEBUG_PRINT(DebugLevel_Chatty | DebugSubSystem_Mouse | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
214 "MOTION NOTIFY - dialog control\n");
224 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Keyboard | DebugSubSystem_DialogCtrl,
225 "%s KEY PRESS/RELEASE - dialog control - check for hotkeys\n", __FUNCTION__);
245 WB_DEBUG_PRINT(DebugLevel_Excessive | DebugSubSystem_Mouse | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
246 "FocusIn - dialog control\n");
259 WB_DEBUG_PRINT(DebugLevel_Excessive | DebugSubSystem_Mouse | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
260 "FocusOut - dialog control\n");
287 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
288 "%s - DestroyNotify and user callback returned %d\n", __FUNCTION__, iRval);
303 if(pEvent->type == ClientMessage &&
304 pEvent->xclient.window == wID)
306 if(pEvent->xclient.message_type ==
aWM_PROTOCOLS && pEvent->xclient.window == wID)
308 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
309 "CLIENT MESSAGE - dialog control - WM_PROTOCOLS\n");
322 char *p1 =
WBGetAtomName(pDisplay, pEvent->xclient.message_type);
323 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
324 "CLIENT MESSAGE - dialog control (NOT HANDLED) - %s\n", p1);
365 int iX,
int iY,
int iWidth,
int iHeight,
366 const char *szTitle,
const char *szPropertyList)
371 #define DO_CREATE_CONTROL(X) if(aClass == a##X) \ 372 { return do_create_##X(pRval, iX, iY, iWidth, iHeight, #X, szTitle); } 376 WB_ERROR_PRINT(
"%s - 'aClass' is None (invalid type name?)\n", __FUNCTION__);
380 pRval =
WBAlloc(i1 = GetWBDialogControlStructSize(aClass));
386 memset(pRval, 0, i1);
404 WB_ERROR_PRINT(
"%s - Error return from WBDialogSetPropList\n", __FUNCTION__);
409 DO_CREATE_CONTROL(FRAME_CONTROL);
410 DO_CREATE_CONTROL(TEXT_CONTROL);
411 DO_CREATE_CONTROL(ICON_CONTROL);
412 DO_CREATE_CONTROL(IMAGE_CONTROL);
413 DO_CREATE_CONTROL(EDIT_CONTROL);
414 DO_CREATE_CONTROL(PUSHBUTTON_CONTROL);
415 DO_CREATE_CONTROL(DEFPUSHBUTTON_CONTROL);
416 DO_CREATE_CONTROL(CANCELBUTTON_CONTROL);
417 DO_CREATE_CONTROL(RADIOBUTTON_CONTROL);
418 DO_CREATE_CONTROL(FIRSTRADIOBUTTON_CONTROL);
419 DO_CREATE_CONTROL(CHECKBUTTON_CONTROL);
420 DO_CREATE_CONTROL(TRISTATEBUTTON_CONTROL);
421 DO_CREATE_CONTROL(HSCROLL_CONTROL);
422 DO_CREATE_CONTROL(VSCROLL_CONTROL);
423 DO_CREATE_CONTROL(SLIDER_CONTROL);
424 DO_CREATE_CONTROL(KNOB_CONTROL);
425 DO_CREATE_CONTROL(LIST_CONTROL);
426 DO_CREATE_CONTROL(COMBO_CONTROL);
427 DO_CREATE_CONTROL(TREE_CONTROL);
428 DO_CREATE_CONTROL(COMBOTREE_CONTROL);
429 DO_CREATE_CONTROL(FILE_LIST_CONTROL);
430 DO_CREATE_CONTROL(FILE_COMBO_CONTROL);
431 DO_CREATE_CONTROL(PATH_TREE_CONTROL);
432 DO_CREATE_CONTROL(TAB_CONTROL);
445 WB_ERROR_PRINT(
"%s - Unrecognized control '%s' in WBDialogControlCreate\n", __FUNCTION__, pAtomName);
451 WB_ERROR_PRINT(
"%s - Unrecognized control {NULL} in WBDialogControlCreate\n", __FUNCTION__);
468 #define COPY_COLOR_NAME(X,Y,Z) {const char *pX = X(WBGetDefaultDisplay()); if(pX) strncpy(Y,pX,sizeof(Y)); else strncpy(Y,Z,sizeof(Y));} 469 static void alloc_control_colors(
WBDialogControl *pDialogControl,
int bUseStaticColors)
471 char szFG[18], szBG[18], szBD[18], szHFG[18], szHBG[18], szAFG[18], szABG[18];
473 int iY, iU, iV, iR, iG, iB;
516 if((pDialogControl->
clrBG.flags & (DoRed | DoGreen | DoBlue)) != (DoRed | DoGreen | DoBlue))
519 &(pDialogControl->
clrBG));
528 PXM_YUVToRGB((3 * iY + 256) / 4, iU, iV, &iR, &iG, &iB);
532 &(pDialogControl->
clrBD2));
540 &(pDialogControl->
clrBD3));
547 #define LOAD_COLOR0(X,Y) if(CHGetResourceString(WBGetDefaultDisplay(), X, Y, sizeof(Y)) > 0) { } 548 #define LOAD_COLOR(X,Y,Z) if(CHGetResourceString(WBGetDefaultDisplay(), X, Y, sizeof(Y)) <= 0){ WB_WARN_PRINT("%s - WARNING: can't find color %s, using default value %s\n", __FUNCTION__, X, Z); strcpy(Y,Z); } 551 const char *szFGName,
const char *szBGName,
552 const char *szHFGName,
const char *szHBGName,
553 const char *szAFGName,
const char *szABGName,
554 const char *szBDName,
int bUseStaticColors)
557 static const char *szHFGDef=
"#E0E0E0", *szHBGDef=
"#0000A0";
558 static const char *szAFGDef=
"#000000", *szABGDef=
"white";
559 char szFG[18], szBG[18], szBD[18], szHFG[18], szHBG[18], szAFG[18], szABG[18];
561 int iY, iU, iV, iR, iG, iB;
567 LOAD_COLOR0(szFGName,szFG)
else LOAD_COLOR0(
"*Dialog.foreground",szFG)
else LOAD_COLOR0(
"*Form.foreground", szFG)
568 else LOAD_COLOR0(
"*WmDialogShell.foreground",szFG)
else LOAD_COLOR0(
"*WmForm.foreground", szFG)
569 else LOAD_COLOR(
"*foreground", szFG,
"#000000");
572 LOAD_COLOR0(szBGName,szBG)
else LOAD_COLOR0(
"*Dialog.background",szBG)
else LOAD_COLOR0(
"*Form.background", szBG)
573 else LOAD_COLOR0(
"*WmDialogShell.background",szBG)
574 else LOAD_COLOR(
"*WmForm.background", szBG,
"#dcdad5");
578 LOAD_COLOR0(szBGName,szBG)
else LOAD_COLOR0(
"*Window.background",szBG)
579 else LOAD_COLOR(
"*background", szBG,
"white");
581 LOAD_COLOR(szHFGName,szHFG,szHFGDef);
582 LOAD_COLOR(szHBGName,szHBG,szHBGDef);
585 LOAD_COLOR(szAFGName,szAFG,szAFGDef);
586 LOAD_COLOR(szABGName,szABG,szABGDef);
590 LOAD_COLOR(szAFGName,szAFG,szFG);
591 LOAD_COLOR(szABGName,szABG,szBG);
593 LOAD_COLOR0(szBDName,szBD)
else LOAD_COLOR0(
"*Dialog.border",szBD)
else LOAD_COLOR0(
"*Form.border", szBD)
594 else LOAD_COLOR0(
"*WmDialogShell.border",szBD)
else LOAD_COLOR0(
"*WmForm.border", szBD)
595 else LOAD_COLOR0(
"*borderColor", szBD)
596 else LOAD_COLOR(
"*border", szBD,
"black");
630 if((pDialogControl->
clrBG.flags & (DoRed | DoGreen | DoBlue)) != (DoRed | DoGreen | DoBlue))
633 &(pDialogControl->
clrBG));
642 PXM_YUVToRGB((3 * iY + 256) / 4, iU, iV, &iR, &iG, &iB);
646 &(pDialogControl->
clrBD2));
654 &(pDialogControl->
clrBD3));
664 static Display *dialog_control_get_display(
WBDialogControl *pDialogControl)
666 Display *pRval = NULL;
668 if(pDialogControl && pDialogControl->
pOwner)
681 static Window standard_do_create_control(
WBDialogControl *pDialogControl,
682 int iX,
int iY,
int iWidth,
int iHeight,
int iBorderWidth,
683 const char *szClassName,
const char *szTitle,
WBWinEvent pCallback)
685 XSetWindowAttributes xswa;
686 Display *pDisplay = dialog_control_get_display(pDialogControl);
688 bzero(&xswa,
sizeof(xswa));
690 xswa.border_pixel = pDialogControl->
clrBD.pixel;
691 xswa.background_pixel = pDialogControl->
clrBG.pixel;
692 xswa.colormap = DefaultColormap(pDisplay, DefaultScreen(pDisplay));
693 xswa.bit_gravity = CenterGravity;
695 pDialogControl->
wID = XCreateWindow(pDisplay, pDialogControl->
pOwner ? pDialogControl->
pOwner->
wID : 0,
696 iX, iY, iWidth, iHeight,
698 DefaultDepth(pDisplay, DefaultScreen(pDisplay)),
700 DefaultVisual(pDisplay, DefaultScreen(pDisplay)),
701 CWBorderPixel | CWBackPixel | CWColormap | CWBitGravity,
703 if(pDialogControl->
wID <= 0 )
716 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
717 "%s - TEMPORARY: creating %s control with caption \"%s\"\n",
718 __FUNCTION__, szClassName, szTitle);
727 return pDialogControl->
wID;
735 static int static_callback(Window wID, XEvent *pEvent);
737 IMPLEMENT_CREATE_CONTROL(FRAME_CONTROL)
739 BEGIN_CREATE_CONTROL(FRAME_CONTROL);
741 Display *pDisplay = dialog_control_get_display(pDialogControl);
742 int iBorderWidth = 1;
755 alloc_control_colors(pDialogControl,
760 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, iBorderWidth,
761 szClassName, szTitle, static_callback)
789 XMapWindow(pDisplay, pDialogControl->
wID);
792 return pDialogControl;
796 IMPLEMENT_CREATE_CONTROL(TEXT_CONTROL)
798 BEGIN_CREATE_CONTROL(TEXT_CONTROL);
800 Display *pDisplay = dialog_control_get_display(pDialogControl);
801 int iBorderWidth = 1;
817 alloc_control_colors(pDialogControl,
822 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, iBorderWidth,
823 szClassName, szTitle, static_callback)
851 XMapWindow(pDisplay, pDialogControl->
wID);
854 return pDialogControl;
858 IMPLEMENT_CREATE_CONTROL(ICON_CONTROL)
860 BEGIN_CREATE_CONTROL(ICON_CONTROL);
862 Display *pDisplay = dialog_control_get_display(pDialogControl);
863 int iBorderWidth = 1;
877 alloc_control_colors(pDialogControl,
882 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, iBorderWidth,
883 szClassName, szTitle, static_callback)
903 XSelectInput(pDisplay, pDialogControl->
wID,
917 XMapWindow(pDisplay, pDialogControl->
wID);
920 return pDialogControl;
924 IMPLEMENT_CREATE_CONTROL(IMAGE_CONTROL)
926 BEGIN_CREATE_CONTROL(IMAGE_CONTROL);
928 Display *pDisplay = dialog_control_get_display(pDialogControl);
929 int iBorderWidth = 1;
943 alloc_control_colors(pDialogControl,
948 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, iBorderWidth,
949 szClassName, szTitle, static_callback)
968 XSelectInput(pDisplay, pDialogControl->
wID,
979 XMapWindow(pDisplay, pDialogControl->
wID);
982 return pDialogControl;
986 static int edit_callback(Window wID, XEvent *pEvent);
988 IMPLEMENT_CREATE_CONTROL(EDIT_CONTROL)
990 BEGIN_CREATE_CONTROL(EDIT_CONTROL);
993 Display *pDisplay = dialog_control_get_display(pDialogControl);
1015 alloc_control_colors(pDialogControl,
1028 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 1,
1029 szClassName, szTitle, edit_callback)
1054 XSelectInput(pDisplay, pDialogControl->
wID,
1060 XMapWindow(pDisplay, pDialogControl->
wID);
1066 return pDialogControl;
1070 static int button_callback(Window wID, XEvent *pEvent);
1072 IMPLEMENT_CREATE_CONTROL(PUSHBUTTON_CONTROL)
1074 BEGIN_CREATE_CONTROL(PUSHBUTTON_CONTROL);
1079 Display *pDisplay = dialog_control_get_display(pDialogControl);
1091 alloc_control_colors(pDialogControl,
1096 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1097 szClassName, szTitle, button_callback)
1124 XSelectInput(pDisplay, pDialogControl->
wID,
1131 XMapWindow(pDisplay, pDialogControl->
wID);
1134 return pDialogControl;
1138 IMPLEMENT_CREATE_CONTROL(DEFPUSHBUTTON_CONTROL)
1140 BEGIN_CREATE_CONTROL(DEFPUSHBUTTON_CONTROL);
1145 Display *pDisplay = dialog_control_get_display(pDialogControl);
1158 alloc_control_colors(pDialogControl,
1163 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1164 szClassName, szTitle, button_callback)
1191 XSelectInput(pDisplay, pDialogControl->
wID,
1198 XMapWindow(pDisplay, pDialogControl->
wID);
1201 return pDialogControl;
1205 IMPLEMENT_CREATE_CONTROL(CANCELBUTTON_CONTROL)
1207 BEGIN_CREATE_CONTROL(CANCELBUTTON_CONTROL);
1212 Display *pDisplay = dialog_control_get_display(pDialogControl);
1224 alloc_control_colors(pDialogControl,
1229 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1230 szClassName, szTitle, button_callback)
1257 XSelectInput(pDisplay, pDialogControl->
wID,
1264 XMapWindow(pDisplay, pDialogControl->
wID);
1267 return pDialogControl;
1271 IMPLEMENT_CREATE_CONTROL(RADIOBUTTON_CONTROL)
1273 BEGIN_CREATE_CONTROL(RADIOBUTTON_CONTROL);
1275 Display *pDisplay = dialog_control_get_display(pDialogControl);
1286 alloc_control_colors(pDialogControl,
1291 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1292 szClassName, szTitle, button_callback)
1307 XSelectInput(pDisplay, pDialogControl->
wID,
1314 XMapWindow(pDisplay, pDialogControl->
wID);
1317 return pDialogControl;
1321 IMPLEMENT_CREATE_CONTROL(FIRSTRADIOBUTTON_CONTROL)
1323 BEGIN_CREATE_CONTROL(FIRSTRADIOBUTTON_CONTROL);
1325 Display *pDisplay = dialog_control_get_display(pDialogControl);
1336 alloc_control_colors(pDialogControl,
1341 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1342 szClassName, szTitle, button_callback)
1357 XSelectInput(pDisplay, pDialogControl->
wID,
1364 XMapWindow(pDisplay, pDialogControl->
wID);
1367 return pDialogControl;
1371 IMPLEMENT_CREATE_CONTROL(CHECKBUTTON_CONTROL)
1373 BEGIN_CREATE_CONTROL(CHECKBUTTON_CONTROL);
1376 Display *pDisplay = dialog_control_get_display(pDialogControl);
1387 alloc_control_colors(pDialogControl,
1392 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1393 szClassName, szTitle, button_callback)
1408 XSelectInput(pDisplay, pDialogControl->
wID,
1415 XMapWindow(pDisplay, pDialogControl->
wID);
1418 return pDialogControl;
1422 IMPLEMENT_CREATE_CONTROL(TRISTATEBUTTON_CONTROL)
1424 BEGIN_CREATE_CONTROL(TRISTATEBUTTON_CONTROL);
1426 Display *pDisplay = dialog_control_get_display(pDialogControl);
1437 alloc_control_colors(pDialogControl,
1442 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1443 szClassName, szTitle, button_callback)
1458 XSelectInput(pDisplay, pDialogControl->
wID,
1465 XMapWindow(pDisplay, pDialogControl->
wID);
1468 return pDialogControl;
1472 IMPLEMENT_CREATE_CONTROL(HSCROLL_CONTROL)
1474 BEGIN_CREATE_CONTROL(HSCROLL_CONTROL);
1482 IMPLEMENT_CREATE_CONTROL(VSCROLL_CONTROL)
1484 BEGIN_CREATE_CONTROL(VSCROLL_CONTROL);
1492 IMPLEMENT_CREATE_CONTROL(SLIDER_CONTROL)
1494 BEGIN_CREATE_CONTROL(SLIDER_CONTROL);
1502 IMPLEMENT_CREATE_CONTROL(KNOB_CONTROL)
1504 BEGIN_CREATE_CONTROL(KNOB_CONTROL);
1512 static int list_callback(Window wID, XEvent *pEvent);
1514 IMPLEMENT_CREATE_CONTROL(LIST_CONTROL)
1516 BEGIN_CREATE_CONTROL(LIST_CONTROL);
1518 Display *pDisplay = dialog_control_get_display(pDialogControl);
1528 alloc_control_colors(pDialogControl,
1533 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1534 szClassName, szTitle, list_callback)
1552 WB_ERROR_PRINT(
"%s - Unable to initialize list entry for control\n", __FUNCTION__);
1569 XSelectInput(pDisplay, pDialogControl->
wID,
1576 XMapWindow(pDisplay, pDialogControl->
wID);
1579 return pDialogControl;
1583 static int combo_callback(Window wID, XEvent *pEvent)
1590 if(pEvent->type == DestroyNotify &&
1591 pEvent->xdestroywindow.window == wID)
1593 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
1594 "%s - DestroyNotify\n", __FUNCTION__);
1626 IMPLEMENT_CREATE_CONTROL(COMBO_CONTROL)
1628 BEGIN_CREATE_CONTROL(COMBO_CONTROL);
1631 Display *pDisplay = dialog_control_get_display(pDialogControl);
1646 alloc_control_colors(pDialogControl,
1651 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1652 szClassName, szTitle, combo_callback)
1687 XSelectInput(pDisplay, pDialogControl->
wID,
1694 XMapWindow(pDisplay, pDialogControl->
wID);
1697 return pDialogControl;
1701 static int tree_callback(Window wID, XEvent *pEvent);
1703 IMPLEMENT_CREATE_CONTROL(TREE_CONTROL)
1705 BEGIN_CREATE_CONTROL(TREE_CONTROL);
1707 Display *pDisplay = dialog_control_get_display(pDialogControl);
1717 alloc_control_colors(pDialogControl,
1722 if(standard_do_create_control(pDialogControl, iX, iY, iWidth, iHeight, 0,
1723 szClassName, szTitle, tree_callback)
1755 XSelectInput(pDisplay, pDialogControl->
wID,
1762 XMapWindow(pDisplay, pDialogControl->
wID);
1765 return pDialogControl;
1769 static int combo_tree_callback(Window wID, XEvent *pEvent)
1774 IMPLEMENT_CREATE_CONTROL(COMBOTREE_CONTROL)
1776 BEGIN_CREATE_CONTROL(COMBOTREE_CONTROL);
1778 int (*x)(Window wID, XEvent *pEvent)
WB_UNUSED = NULL;
1780 x = combo_tree_callback;
1788 static int file_list_callback(Window wID, XEvent *pEvent);
1790 IMPLEMENT_CREATE_CONTROL(FILE_LIST_CONTROL)
1792 BEGIN_CREATE_CONTROL(FILE_LIST_CONTROL);
1802 pDialogControl = do_create_LIST_CONTROL(pDialogControl, iX, iY, iWidth, iHeight, szClassName, szTitle);
1808 pDialogControl->
aClass = aThis;
1812 1, FileListControlDisplayProc,
1822 return pDialogControl;
1826 static int file_combo_callback(Window wID, XEvent *pEvent)
1833 return combo_callback(wID, pEvent);
1836 IMPLEMENT_CREATE_CONTROL(FILE_COMBO_CONTROL)
1838 BEGIN_CREATE_CONTROL(FILE_COMBO_CONTROL);
1848 pDialogControl = do_create_COMBO_CONTROL(pDialogControl, iX, iY, iWidth, iHeight, szClassName, szTitle);
1854 pDialogControl->
aClass = aThis;
1864 return pDialogControl;
1868 static int path_tree_callback(Window wID, XEvent *pEvent);
1870 IMPLEMENT_CREATE_CONTROL(PATH_TREE_CONTROL)
1872 BEGIN_CREATE_CONTROL(PATH_TREE_CONTROL);
1882 pDialogControl = do_create_TREE_CONTROL(pDialogControl, iX, iY, iWidth, iHeight, szClassName, szTitle);
1888 pDialogControl->
aClass = aThis;
1898 return pDialogControl;
1902 IMPLEMENT_CREATE_CONTROL(TAB_CONTROL)
1904 BEGIN_CREATE_CONTROL(TAB_CONTROL);
1915 static int StaticDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
1918 static int static_callback(Window wID, XEvent *pEvent)
1923 if(pDialogControl && pEvent->type == Expose)
1925 return StaticDoExposeEvent(&(pEvent->xexpose), pDisplay, wID, pDialogControl);
1930 if(pEvent->type == ButtonPress ||
1931 pEvent->type == ButtonRelease ||
1932 pEvent->type == MotionNotify)
1936 else if(pEvent->type == KeyPress || pEvent->type == KeyRelease)
1941 if(pEvent->type == ClientMessage &&
1943 pDialogControl != NULL)
1949 pEvent->xclient.data.l[2] == 0)
1954 pEvent->xclient.data.l[3] - 2,
1955 pEvent->xclient.data.l[4] - 2);
1961 pEvent->xclient.data.l[2] == 0)
1966 pEvent->xclient.data.l[3] - 2,
1967 pEvent->xclient.data.l[4] - 2);
1973 pEvent->xclient.data.l[2] == 0)
1978 pEvent->xclient.data.l[3] - 2,
1979 pEvent->xclient.data.l[4] - 2);
1985 pEvent->xclient.data.l[2] == 0)
1996 if(pEvent->type == DestroyNotify &&
1997 pEvent->xdestroywindow.window == wID)
1999 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
2000 "%s - DestroyNotify\n", __FUNCTION__);
2025 XFreePixmap(pDisplay, pxOld);
2039 XFreePixmap(pDisplay, pxOld2);
2067 static int EditDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
2069 static int EditDoCharEvent(XClientMessageEvent *pEvent, Display *pDisplay,
2071 static int EditDoPointerEvent(XClientMessageEvent *pEvent, Display *pDisplay,
2074 static int edit_callback(Window wID, XEvent *pEvent)
2077 Atom aNotification = None;
2085 if(pDialogControl && pEvent->type == Expose)
2087 return EditDoExposeEvent(&(pEvent->xexpose), pDisplay, wID, pDialogControl);
2091 if(pEvent->type == DestroyNotify &&
2092 pEvent->xdestroywindow.window == wID)
2094 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
2095 "%s - DestroyNotify\n", __FUNCTION__);
2127 if(pEvent->type == ButtonPress ||
2128 pEvent->type == ButtonRelease ||
2129 pEvent->type == MotionNotify)
2133 else if(pEvent->type == KeyPress || pEvent->type == KeyRelease)
2139 else if(pEvent->type == ClientMessage)
2143 if(pEvent->xclient.message_type ==
aWB_CHAR)
2145 iRval = EditDoCharEvent(&(pEvent->xclient), pDisplay, wID, pDialogControl);
2156 else if(pEvent->xclient.message_type ==
aWB_POINTER)
2158 iRval = EditDoPointerEvent(&(pEvent->xclient), pDisplay, wID, pDialogControl);
2188 else if(pEvent->xclient.message_type ==
aWB_TIMER)
2214 if(iRval && aNotification != None &&
2215 pDialogControl->
pOwner &&
2218 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
2219 "%s:%d - Post Event: %08xH %08xH %08xH %pH\n", __FUNCTION__, __LINE__,
2232 static int PushButtonDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
2234 static int ButtonDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
2236 static void ManageRadioButtonGroupSelectState(
WBDialogControl *pDialogControl);
2238 static int ButtonHandleCheckEvent(Display *pDisplay, Window wID,
WBDialogControl *pDialogControl,
int iType,
int iCheck)
2269 ManageRadioButtonGroupSelectState(pDialogControl);
2292 static int button_callback(Window wID, XEvent *pEvent)
2299 if(pDialogControl && pEvent->type == Expose)
2308 return PushButtonDoExposeEvent(&(pEvent->xexpose), pDisplay, wID, pDialogControl);
2312 return ButtonDoExposeEvent(&(pEvent->xexpose), pDisplay, wID, pDialogControl);
2316 if(pEvent->type == DestroyNotify &&
2317 pEvent->xdestroywindow.window == wID)
2319 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
2320 "%s - DestroyNotify\n", __FUNCTION__);
2343 XFreePixmap(pDisplay, pxOld);
2369 if(pDialogControl->
pOwner &&
2372 if(pEvent->type == ButtonPress)
2378 && ((XButtonEvent *)pEvent)->button == 1)
2398 ((XButtonEvent *)pEvent)->button == 1)
2400 if(ButtonHandleCheckEvent(pDisplay, wID, pDialogControl, iType, -1))
2406 else if(pEvent->type == ButtonRelease)
2408 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
2409 "%s - BUTTON RELEASE for BUTTON %d\n",
2410 __FUNCTION__, ((XButtonEvent *)pEvent)->button);
2416 && ((XButtonEvent *)pEvent)->button == 1)
2422 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
2423 "%s:%d - Post Event: %08xH %08xH %08xH %pH\n", __FUNCTION__, __LINE__,
2440 else if(pEvent->type == KeyPress)
2453 WB_ERROR_PRINT(
"TEMPORARY: %s- keydown event, %d iACS=%d\n", __FUNCTION__, iKey, iACS);
2455 if((iKey ==
' ' || iKey ==
'\n' || iKey ==
'\r')
2481 WB_ERROR_PRINT(
"TEMPORARY: %s- keydown event, %d iACS=%d\n", __FUNCTION__, iKey, iACS);
2483 if((iKey ==
' ' || iKey ==
'\n' || iKey ==
'\r')
2486 if(ButtonHandleCheckEvent(pDisplay, wID, pDialogControl, iType, -1))
2493 else if(pEvent->type == KeyRelease)
2500 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
2501 "%s - KEY RELEASE for KEY %d\n",
2502 __FUNCTION__, ((XKeyEvent *)pEvent)->keycode);
2508 (iKey ==
' ' || iKey ==
'\n' || iKey ==
'\r'))
2514 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
2515 "%s:%d - Post Event: %08xH %08xH %08xH %pH\n", __FUNCTION__, __LINE__,
2531 else if(pEvent->type == ClientMessage)
2542 if((
int)(pEvent->xclient.data.l[1]) < 0 ||
2557 ButtonHandleCheckEvent(pDisplay, wID, pDialogControl, iType,
2558 (
int)(pEvent->xclient.data.l[1])))
2595 static void ManageRadioButtonGroupSelectState(
WBDialogControl *pDialogControl)
2599 Window wIDFirst, wIDTemp, wIDTemp2;
2600 Window wIDCurrent = pDialogControl->
wID;
2606 WB_ERROR_PRINT(
"ERROR: %s - pDialogControl is NULL\n", __FUNCTION__);
2618 pDlgC = pDialogControl;
2619 wIDFirst = pDlgC->
wID;
2623 WB_ERROR_PRINT(
"ERROR: %s - pDialogControl is NOT a radio button\n", __FUNCTION__);
2630 wIDTemp2 = pDialogControl->
wID;
2635 while(wIDTemp != None && wIDTemp != pDialogControl->
wID)
2654 if(wIDTemp == wIDFirst)
2665 if(!pDlgC && wIDTemp2 != None)
2667 wIDFirst = wIDTemp2;
2697 if(wIDTemp == None || wIDTemp == wIDFirst)
2713 static int ListDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
2716 static int ListDoCharEvent(XClientMessageEvent *pEvent, Display *pDisplay,
2719 static int ListGetItemIndexFromXY(
LISTINFO *pListInfo,
int iX,
int iY)
2730 if(i1 >= 0 && i1 <= pListInfo->nHeight)
2732 i1 += pListInfo->
nTop;
2734 if(i1 >= pListInfo->
nItems)
2736 i1 = pListInfo->
nItems - 1;
2747 static void ListInvalidateItemRect(Window wID,
LISTINFO *pListInfo,
int iIndex)
2757 if(iIndex >= pListInfo->
nTop && iIndex <= pListInfo->nTop + pListInfo->
nHeight)
2768 static int list_callback(Window wID, XEvent *pEvent)
2771 Atom aNotification = None;
2779 if(pDialogControl && pEvent->type == Expose)
2781 return ListDoExposeEvent(&(pEvent->xexpose), pDisplay, wID, pDialogControl);
2793 if(pEvent->type == DestroyNotify &&
2794 pEvent->xdestroywindow.window == wID)
2796 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
2797 "%s - DestroyNotify\n", __FUNCTION__);
2811 if(pDialogControl->pCaption)
2813 WBFree(pDialogControl->pCaption);
2816 if(pDialogControl->pPropList)
2819 pDialogControl->pPropList = NULL;
2840 if(pEvent->type == ClientMessage &&
2843 char *p1 =
WBGetAtomName(pDisplay,(Atom)pEvent->xclient.data.l[0]);
2844 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
2845 "%s - CONTROL_NOTIFY for window %d (%08xH) - %s %ld\n", __FUNCTION__,
2846 (
int)wID, (
int)wID, p1, pEvent->xclient.data.l[1]);
2852 else if(pEvent->type == ClientMessage &&
2853 pEvent->xclient.message_type ==
aWB_CHAR)
2855 iRval = ListDoCharEvent(&(pEvent->xclient), pDisplay, wID, pDialogControl);
2860 pDialogControl->pDlgControlEntry->iID,
2868 else if(pEvent->type == ClientMessage &&
2876 !pEvent->xclient.data.l[2])
2878 int iX = pEvent->xclient.data.l[3];
2879 int iY = pEvent->xclient.data.l[4];
2888 WB_ERROR_PRINT(
"UNHANDLED SCROLL BAR mouse message inside VBAR %d %d %d %d %d\n",
2889 (
int)pEvent->xclient.data.l[0],
2890 (
int)pEvent->xclient.data.l[1],
2891 (
int)pEvent->xclient.data.l[2],
2892 (
int)pEvent->xclient.data.l[3],
2893 (
int)pEvent->xclient.data.l[4]);
2901 i1 = ListGetItemIndexFromXY(pListInfo, iX, iY);
2910 if(i1 >= 0 && i1 <= pListInfo->nHeight)
2912 i1 += pListInfo->
nTop;
2919 if(i1 >= 0 && i1 < pListInfo->nItems)
2921 if(pListInfo->
nPos != i1)
2924 pListInfo->
nPos = i1;
2926 if(i1 < pListInfo->nTop)
2928 pListInfo->
nTop = i1;
2930 else if(i1 >= pListInfo->
nHeight + pListInfo->
nTop)
2939 pDialogControl->pDlgControlEntry->iID,
2945 if(pListInfo && i1 >= 0 && i1 != pListInfo->
nPos)
2949 pListInfo->
nPos = i1;
2951 if(i1 < pListInfo->nTop)
2953 pListInfo->
nTop = i1;
2955 else if(i1 >= pListInfo->
nHeight + pListInfo->
nTop)
2964 pDialogControl->pDlgControlEntry->iID,
2967 ListInvalidateItemRect(wID, pListInfo, i1);
2968 ListInvalidateItemRect(wID, pListInfo, pListInfo->
nPos);
2983 !pEvent->xclient.data.l[2])
2985 int iX = pEvent->xclient.data.l[3];
2986 int iY = pEvent->xclient.data.l[4];
2995 WB_ERROR_PRINT(
"UNHANDLED SCROLL BAR mouse message %d %d %d %d %d\n",
2996 (
int)pEvent->xclient.data.l[0],
2997 (
int)pEvent->xclient.data.l[1],
2998 (
int)pEvent->xclient.data.l[2],
2999 (
int)pEvent->xclient.data.l[3],
3000 (
int)pEvent->xclient.data.l[4]);
3009 pDialogControl->pDlgControlEntry->iID,
3025 !pEvent->xclient.data.l[2])
3027 WB_ERROR_PRINT(
"UNHANDLED SCROLL BAR mouse message %d %d %d %d %d\n",
3028 (
int)pEvent->xclient.data.l[0],
3029 (
int)pEvent->xclient.data.l[1],
3030 (
int)pEvent->xclient.data.l[2],
3031 (
int)pEvent->xclient.data.l[3],
3032 (
int)pEvent->xclient.data.l[4]);
3043 !pEvent->xclient.data.l[2])
3045 int iX = pEvent->xclient.data.l[3];
3046 int iY = pEvent->xclient.data.l[4];
3053 WB_ERROR_PRINT(
"UNHANDLED SCROLL BAR mouse message %d %d %d %d %d\n",
3054 (
int)pEvent->xclient.data.l[0],
3055 (
int)pEvent->xclient.data.l[1],
3056 (
int)pEvent->xclient.data.l[2],
3057 (
int)pEvent->xclient.data.l[3],
3058 (
int)pEvent->xclient.data.l[4]);
3069 else if(pEvent->type == ClientMessage &&
3072 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
3073 "%s - SCROLL_NOTIFY for window %d (%08xH) - %ld %ld %ld\n", __FUNCTION__,
3074 (
int)wID, (
int)wID, pEvent->xclient.data.l[0],
3075 pEvent->xclient.data.l[1], pEvent->xclient.data.l[2]);
3079 int iOldTop = pListInfo->
nTop;
3080 int iOldPos = pListInfo->
nPos;
3082 switch(pEvent->xclient.data.l[1])
3096 if(pListInfo->
nPos < 0)
3098 pListInfo->
nPos = 0;
3110 if(pListInfo->
nPos < pListInfo->
nTop)
3119 if(pListInfo->
nTop < 0)
3121 pListInfo->
nTop = 0;
3134 pListInfo->
nPos = 0;
3135 pListInfo->
nTop = 0;
3142 pListInfo->
nTop = pEvent->xclient.data.l[2];
3143 pListInfo->
nPos += pListInfo->
nTop - iOldTop;
3148 pListInfo->
nTop += pEvent->xclient.data.l[2];
3149 pListInfo->
nPos += pEvent->xclient.data.l[2];
3153 pListInfo->
nPos = pEvent->xclient.data.l[2];
3154 pListInfo->
nTop = pEvent->xclient.data.l[2];
3160 if(pListInfo->
nTop < 0)
3162 pListInfo->
nTop = 0;
3169 if(pListInfo->
nPos < pListInfo->
nTop)
3184 if(iOldTop != pListInfo->
nTop || iOldPos != pListInfo->
nPos)
3187 if(pListInfo->
nPos < 0)
3189 pListInfo->
nPos = 0;
3191 else if(pListInfo->
nPos >= pListInfo->
nItems)
3195 if(pListInfo->
nTop > pListInfo->
nPos)
3204 if(iOldTop != pListInfo->
nTop || iOldPos != pListInfo->
nPos)
3206 if(iOldTop != pListInfo->
nTop)
3233 ListInvalidateItemRect(wID, pListInfo, iOldPos);
3234 ListInvalidateItemRect(wID, pListInfo, pListInfo->
nPos);
3258 if(iRval && aNotification != None &&
3259 pDialogControl->pOwner &&
3260 pDialogControl->pDlgControlEntry)
3263 pDialogControl->pDlgControlEntry->iID,
3266 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3267 "%s:%d - Post Event: %08xH %08xH %08xH %pH\n", __FUNCTION__, __LINE__,
3269 (
int)pDialogControl->pDlgControlEntry->iID, pDialogControl);
3276 static int file_list_callback(Window wID, XEvent *pEvent)
3284 char tbuf[NAME_MAX + 4];
3289 if(pEvent->type == ClientMessage &&
3292 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
3293 "%s - DLGC_PROP_NOTIFY for window %d (%08xH)\n", __FUNCTION__,
3294 (
int)wID, (
int)wID);
3298 if(pDialogControl->
pOwner)
3307 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
3308 "%s - DLGC_PROP_NOTIFY DLGC_PATH for window %d (%08xH)\n", __FUNCTION__,
3309 (
int)wID, (
int)wID);
3322 goto restore_cursor;
3324 if(p1[strlen(p1) - 1] !=
'/')
3335 WB_ERROR_PRINT(
"%s - Memory allocation failure\n", __FUNCTION__);
3337 goto restore_cursor;
3344 WB_ERROR_PRINT(
"%s - unable to get directory list for \"%s\"\n", __FUNCTION__, p1);
3347 goto restore_cursor;
3354 if(!p2 || p2[0] !=
'/' || p2[1])
3356 strcpy(tbuf,
"@..");
3360 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
3361 "%s - enumerating directory\n", __FUNCTION__);
3369 else if(S_ISLNK(dw1))
3376 else if(S_ISDIR(dw1))
3399 DEBUG_DUMP_LIST(pDialogControl);
3405 if(pDialogControl->
pOwner)
3422 return list_callback(wID, pEvent);
3426 static int tree_callback(Window wID, XEvent *pEvent)
3429 Atom aNotification = None;
3436 if(pDialogControl && pEvent->type == Expose)
3438 return ListDoExposeEvent(&(pEvent->xexpose), pDisplay, wID, pDialogControl);
3442 if(pEvent->type == DestroyNotify &&
3443 pEvent->xdestroywindow.window == wID)
3445 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
3446 "%s - DestroyNotify\n", __FUNCTION__);
3470 if(pEvent->type == FocusIn)
3472 WB_ERROR_PRINT(
"TEMPORARY: %s - FocusIn should not be handled here\n", __FUNCTION__);
3483 if(iRval && aNotification != None &&
3484 pDialogControl->
pOwner &&
3491 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3492 "%s:%d - Post Event: %08xH %08xH %08xH %pH\n", __FUNCTION__, __LINE__,
3500 static int path_tree_callback(Window wID, XEvent *pEvent)
3507 char tbuf[NAME_MAX + 4];
3510 if(pEvent->type == ClientMessage &&
3513 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
3514 "%s - DLGC_PROP_NOTIFY for window %d (%08xH)\n", __FUNCTION__,
3515 (
int)wID, (
int)wID);
3519 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Dialog,
3520 "%s - DLGC_PROP_NOTIFY DLGC_PATH for window %d (%08xH)\n", __FUNCTION__,
3521 (
int)wID, (
int)wID);
3531 if(p1[strlen(p1) - 1] !=
'/')
3542 WB_ERROR_PRINT(
"%s - Memory allocation failure\n", __FUNCTION__);
3552 WB_ERROR_PRINT(
"%s - unable to get directory list\n", __FUNCTION__);
3563 else if(S_ISLNK(dw1))
3567 if(
WBStat(tbuf, &dw1) || !S_ISDIR(dw1))
3585 DEBUG_DUMP_LIST(pDialogControl);
3591 return tree_callback(wID, pEvent);
3604 static int EditDoCharEvent(XClientMessageEvent *pEvent, Display *pDisplay,
3608 int iRval = 0, iACS, iKey, nChar;
3613 iKey = pEvent->data.l[0];
3614 iACS = pEvent->data.l[1];
3615 nChar = pEvent->data.l[2];
3616 pBuf = (
char *)&(pEvent->data.l[3]);
3620 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3621 "%s KEY RELEASE for KEY %d KEYCODE %d MASK=%d (%xH)\n",
3622 __FUNCTION__, iKey, ((XKeyEvent *)pEvent)->keycode,
3623 ((XKeyEvent *)pEvent)->state, ((XKeyEvent *)pEvent)->state);
3627 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3628 "%s - BACKSPACE key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3649 else if(iKey == 13 || iKey == 10
3659 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3660 "%s - CTRL+A key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3664 rctTemp.
left = rctTemp.
top = 0;
3678 WB_DEBUG_PRINT(DebugLevel_ERROR | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3679 "%s - CTRL+C key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3698 XBell(pDisplay, -100);
3699 WB_ERROR_PRINT(
"TEMPORARY: NULL returned from get_sel_text()\n");
3704 XBell(pDisplay, -100);
3705 WB_ERROR_PRINT(
"TEMPORARY - %s - no selection, can't 'COPY'\n", __FUNCTION__);
3713 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3714 "%s - CTRL+V key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3720 unsigned long nData = 0;
3727 WB_ERROR_PRINT(
"TEMPORARY %s - CTRL+V key pressed\n", __FUNCTION__);
3733 if(!pData || !nData)
3744 if(pData && nData > 0)
3757 if(iFormat == 8 *
sizeof(
wchar_t))
3759 char *pNew =
WBAlloc(
sizeof(
wchar_t) * (nData + 2));
3762 memset(pNew, 0,
sizeof(
wchar_t) * (nData + 2));
3763 wcstombs(pNew, (
const wchar_t *)pData,
sizeof(
wchar_t) * (nData + 2));
3771 XBell(pDisplay, -100);
3772 WB_ERROR_PRINT(
"TEMPORARY - %s - clipboard format %d, can't 'PASTE'\n", __FUNCTION__, iFormat);
3795 XBell(pDisplay, -100);
3796 WB_ERROR_PRINT(
"TEMPORARY - %s - NULL pData, can't 'PASTE'\n", __FUNCTION__);
3801 XBell(pDisplay, -100);
3802 WB_ERROR_PRINT(
"TEMPORARY: NULL returned from WBGetClipboardData()\n");
3810 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3811 "%s - CTRL+X key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3817 WB_DEBUG_PRINT(DebugLevel_ERROR | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3818 "%s - CTRL+C key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3840 XBell(pDisplay, -100);
3841 WB_ERROR_PRINT(
"TEMPORARY: NULL returned from get_sel_text()\n");
3846 XBell(pDisplay, -100);
3847 WB_ERROR_PRINT(
"TEMPORARY - %s - no selection, can't 'CUT'\n", __FUNCTION__);
3855 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3856 "%s - CTRL+Z key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3866 XBell(pDisplay, -100);
3877 XBell(pDisplay, -100);
3883 else if(iKey ==
'\x1b')
3885 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3886 "%s - ESC key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
3931 #define KEYSYM_MATCH_CURSOR_NAME(X) (iKey == XK_##X || iKey == XK_KP_##X) 3933 if(KEYSYM_MATCH_CURSOR_NAME(Home))
3935 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3936 "%s - Home key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
3957 else if(KEYSYM_MATCH_CURSOR_NAME(End))
3959 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3960 "%s - End key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
3983 else if(KEYSYM_MATCH_CURSOR_NAME(Left))
3985 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
3986 "%s - Left key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4007 else if(KEYSYM_MATCH_CURSOR_NAME(Right))
4009 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4010 "%s - Right key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4031 else if(KEYSYM_MATCH_CURSOR_NAME(Up))
4033 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4034 "%s - Up key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4044 XBell(pDisplay, -100);
4054 XBell(pDisplay, -100);
4057 else if(KEYSYM_MATCH_CURSOR_NAME(Down))
4059 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4060 "%s - Down key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4070 XBell(pDisplay, -100);
4080 XBell(pDisplay, -100);
4083 else if(KEYSYM_MATCH_CURSOR_NAME(Page_Up))
4085 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4086 "%s - Page Up key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4109 else if(KEYSYM_MATCH_CURSOR_NAME(Page_Down))
4111 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4112 "%s - Page Down key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4135 else if(KEYSYM_MATCH_CURSOR_NAME(Begin))
4137 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4138 "%s - Beginning Of Line key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4157 else if(KEYSYM_MATCH_CURSOR_NAME(Insert))
4159 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4160 "%s - Insert key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4178 unsigned long nData = 0;
4185 WB_ERROR_PRINT(
"TEMPORARY %s - SHIFT+insert key pressed\n", __FUNCTION__);
4191 if(pData && nData > 0)
4204 if(iFormat == 8 *
sizeof(
wchar_t))
4206 char *pNew =
WBAlloc(
sizeof(
wchar_t) * (nData + 2));
4209 memset(pNew, 0,
sizeof(
wchar_t) * (nData + 2));
4210 wcstombs(pNew, (
const wchar_t *)pData,
sizeof(
wchar_t) * (nData + 2));
4218 XBell(pDisplay, -100);
4219 WB_ERROR_PRINT(
"TEMPORARY - %s - clipboard format %d, can't 'PASTE'\n", __FUNCTION__, iFormat);
4242 XBell(pDisplay, -100);
4243 WB_ERROR_PRINT(
"TEMPORARY - %s - NULL pData, can't 'PASTE'\n", __FUNCTION__);
4248 XBell(pDisplay, -100);
4249 WB_ERROR_PRINT(
"TEMPORARY: NULL returned from WBGetClipboardData()\n");
4271 WB_ERROR_PRINT(
"TEMPORARY: NULL returned from get_sel_text()\n");
4275 else if(KEYSYM_MATCH_CURSOR_NAME(Delete))
4277 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4278 "%s - Delete key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
4308 #undef KEYSYM_MATCH_CURSOR_NAME 4312 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4313 "%s - CURSOR KEY? %d (%08xH) %d (%08xH)\n",
4314 __FUNCTION__, iKey, iKey, iACS, iACS);
4324 static int EditDoPointerEvent(XClientMessageEvent *pEvent, Display *pDisplay,
4333 if(pEvent->type != ClientMessage ||
4352 iACS = pEvent->data.l[2];
4354 iX = pEvent->data.l[3];
4355 iY = pEvent->data.l[4];
4357 switch(pEvent->data.l[0])
4360 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4361 "%s.%d - WB_POINTER_CLICK\n", __FUNCTION__, __LINE__);
4367 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4368 "%s.%d - WB_POINTER_DBLCLICK\n", __FUNCTION__, __LINE__);
4379 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4380 "%s.%d - WB_POINTER_DRAG\n", __FUNCTION__, __LINE__);
4385 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4386 "%s.%d - WB_POINTER_DROP\n", __FUNCTION__, __LINE__);
4391 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4392 "%s.%d - WB_POINTER_MOVE\n", __FUNCTION__, __LINE__);
4397 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4398 "%s.%d - WB_POINTER_CANCEL\n", __FUNCTION__, __LINE__);
4401 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4402 "%s.%d - WB_POINTER_SCROLLUP\n", __FUNCTION__, __LINE__);
4405 WB_DEBUG_PRINT(DebugLevel_Verbose | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4406 "%s.%d - WB_POINTER_SCROLLDOWN\n", __FUNCTION__, __LINE__);
4410 WB_DEBUG_PRINT(DebugLevel_WARN | DebugSubSystem_DialogCtrl | DebugSubSystem_Mouse,
4411 "%s.%d - unhandled mousie message\n", __FUNCTION__, __LINE__);
4419 static int ListDoCharEvent(XClientMessageEvent *pEvent, Display *pDisplay,
4422 int iRval = 0, iACS, iKey, nChar;
4426 iKey = pEvent->data.l[0];
4427 iACS = pEvent->data.l[1];
4428 nChar = pEvent->data.l[2];
4433 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4434 "%s KEY RELEASE for KEY %d KEYCODE %d MASK=%d (%xH)\n",
4435 __FUNCTION__, iKey, ((XKeyEvent *)pEvent)->keycode,
4436 ((XKeyEvent *)pEvent)->state, ((XKeyEvent *)pEvent)->state);
4452 WB_DEBUG_PRINT(DebugLevel_Excessive | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4453 "%s - BACKSPACE key pressed\n", __FUNCTION__);
4455 else if(iKey == 13 || iKey == 10
4477 #define KEYSYM_MATCH_CURSOR_NAME(X) (iKey == XK_##X || iKey == XK_KP_##X) 4479 if(KEYSYM_MATCH_CURSOR_NAME(Home))
4481 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4482 "%s - Home key pressed\n", __FUNCTION__);
4484 else if(KEYSYM_MATCH_CURSOR_NAME(End))
4486 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4487 "%s - End key pressed\n", __FUNCTION__);
4489 else if(KEYSYM_MATCH_CURSOR_NAME(Left))
4491 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4492 "%s - Left key pressed\n", __FUNCTION__);
4494 else if(KEYSYM_MATCH_CURSOR_NAME(Right))
4496 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4497 "%s - Right key pressed\n", __FUNCTION__);
4499 else if(KEYSYM_MATCH_CURSOR_NAME(Up))
4501 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4502 "%s - Up key pressed\n", __FUNCTION__);
4504 else if(KEYSYM_MATCH_CURSOR_NAME(Down))
4506 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4507 "%s - Down key pressed\n", __FUNCTION__);
4509 else if(KEYSYM_MATCH_CURSOR_NAME(Page_Up))
4511 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4512 "%s - Page Up key pressed\n", __FUNCTION__);
4514 else if(KEYSYM_MATCH_CURSOR_NAME(Page_Down))
4516 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4517 "%s - Page Down key pressed\n", __FUNCTION__);
4519 else if(KEYSYM_MATCH_CURSOR_NAME(Begin))
4521 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4522 "%s - Beginning Of Line key pressed\n", __FUNCTION__);
4524 else if(KEYSYM_MATCH_CURSOR_NAME(Insert))
4526 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4527 "%s - Insert key pressed\n", __FUNCTION__);
4529 else if(KEYSYM_MATCH_CURSOR_NAME(Delete))
4531 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4532 "%s - Delete key pressed\n", __FUNCTION__);
4539 #undef KEYSYM_MATCH_CURSOR_NAME 4543 WB_DEBUG_PRINT(KEYSYM_DEBUG_FLAG | DebugSubSystem_Event | DebugSubSystem_DialogCtrl | DebugSubSystem_Keyboard,
4544 "%s - CURSOR KEY? %d (%08xH) %d (%08xH)\n",
4545 __FUNCTION__, iKey, iKey, iACS, iACS);
4564 static int StaticDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
4569 XWindowAttributes xwa;
4571 XCharStruct xBounds;
4573 WB_GEOM geomPaint, geomBorder;
4576 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
4577 "%s - Expose %d (%08xH)\n", __FUNCTION__, (
int)wID, (
int)wID);
4579 if (XGetWindowAttributes(pDisplay, wID, &xwa) == 0)
4581 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4593 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4604 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4621 geomBorder.
y = xBounds.ascent + xBounds.descent + 2;
4622 geomBorder.
width = xwa.width - geomBorder.
x;
4623 geomBorder.
height = xwa.height - geomBorder.
y;
4627 iVPos = xwa.border_width;
4628 iVPos += xBounds.ascent;
4634 geomBorder.
width = xwa.width - geomBorder.
x;
4635 geomBorder.
height = xwa.height - geomBorder.
y;
4638 iVPos = xBounds.ascent + xBounds.descent;
4639 iVPos = (xwa.height - iVPos) >> 1;
4640 iVPos += xBounds.ascent;
4651 BlackPixel(pDisplay, DefaultScreen(pDisplay)));
4656 geomBorder.
width -= 2;
4693 XCopyArea(pDisplay, pixmap, wID, gc2->
gc, 0, 0, 36, 36, geomBorder.
x + 2, geomBorder.
y + 2);
4698 WB_WARN_PRINT(
"%s - WARNING: unable to create GC copy to use bitmask to paint icon\n", __FUNCTION__);
4699 XCopyArea(pDisplay, pixmap, wID,
gc->gc, 0, 0, 36, 36, geomBorder.
x + 2, geomBorder.
y + 2);
4704 XCopyArea(pDisplay, pixmap, wID,
gc->gc, 0, 0, 36, 36, geomBorder.
x + 2, geomBorder.
y + 2);
4747 rctText.
left = geomBorder.
x;
4749 rctText.
top = geomBorder.
y;
4768 static int EditDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
4772 XWindowAttributes xwa;
4775 WB_GEOM geomPaint, geomBorder;
4778 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
4779 "%s - Expose %d (%08xH)\n", __FUNCTION__, (
int)wID, (
int)wID);
4781 if (XGetWindowAttributes(pDisplay, wID, &xwa) == 0)
4783 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4795 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4804 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4814 geomBorder.
width = xwa.width - geomBorder.
x;
4815 geomBorder.
height = xwa.height - geomBorder.
y;
4835 pSelf->
clrBG.pixel);
4843 geomBorder.
width -= 8;
4849 gc, &geomPaint, &geomBorder,
pFont);
4860 const char *szText = pSelf->
pCaption;
4874 if(strchr(szText,
'_'))
4877 strcpy(tbuf, szText);
4888 iU1 = XTextWidth(
pFont, tbuf, p1 - tbuf);
4892 iU2 = XTextWidth(
pFont, p1, 1);
4909 WBDrawString(pDisplay, wID,
gc, iHPos, iVPos, szText, strlen(szText));
4933 static int ButtonDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
4937 XWindowAttributes xwa;
4939 XCharStruct xBounds;
4941 WB_GEOM geomPaint, geomBorder, geomBox;
4945 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
4946 "%s - Expose %d (%08xH)\n", __FUNCTION__, (
int)wID, (
int)wID);
4948 if (XGetWindowAttributes(pDisplay, wID, &xwa) == 0)
4950 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4962 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4973 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
4983 geomBorder.
x = xwa.border_width;
4984 geomBorder.
y = xwa.border_width;
4985 geomBorder.
width = xwa.width - xwa.border_width;
4986 geomBorder.
height = xwa.height - xwa.border_width;
4991 BlackPixel(pDisplay, DefaultScreen(pDisplay)));
4996 geomBox.
x = geomBorder.
x + (geomBorder.
height - xBounds.ascent) / 2;
4997 geomBox.
y = geomBorder.
y + (geomBorder.
height - xBounds.ascent - 2) / 2;
4998 geomBox.
width = xBounds.ascent + 2;
4999 geomBox.
height = xBounds.ascent + 2;
5047 xpt[0].x = geomBox.
x + geomBox.
width / 4;
5048 xpt[0].y = geomBox.
y + geomBox.
height / 4;
5049 xpt[1].x = geomBox.
x + 3 * geomBox.
width / 4 - 1;
5050 xpt[1].y = geomBox.
y + 3 * geomBox.
height / 4;
5058 xpt[0].x = geomBox.
x + geomBox.
width / 4;
5059 xpt[1].y = geomBox.
y + geomBox.
height / 4;
5060 xpt[1].x = geomBox.
x + 3 * geomBox.
width / 4 - 1;
5061 xpt[0].y = geomBox.
y + 3 * geomBox.
height / 4;
5083 geomBorder.
x += geomBox.
width + (geomBorder.
height - xBounds.ascent);
5088 geomBorder.
x = xwa.border_width;
5089 geomBorder.
y = xwa.border_width;
5090 geomBorder.
width = xwa.width - xwa.border_width;
5091 geomBorder.
height = xwa.height - xwa.border_width;
5096 BlackPixel(pDisplay, DefaultScreen(pDisplay)));
5101 geomBox.
x = geomBorder.
x + (geomBorder.
height - xBounds.ascent) / 2;
5102 geomBox.
y = geomBorder.
y + (geomBorder.
height - xBounds.ascent - 2) / 2;
5103 geomBox.
width = xBounds.ascent + 2;
5104 geomBox.
height = xBounds.ascent + 2;
5119 geomBox.
x, geomBox.
y,
5145 geomBox.
x + geomBox.
width / 4,
5146 geomBox.
y + geomBox.
height / 4,
5154 geomBorder.
x += geomBox.
width + (geomBorder.
height - xBounds.ascent);
5161 geomBorder.
x = xwa.border_width;
5162 geomBorder.
y = xwa.border_width;
5163 geomBorder.
width = xwa.width - xwa.border_width;
5164 geomBorder.
height = xwa.height - xwa.border_width;
5169 BlackPixel(pDisplay, DefaultScreen(pDisplay)));
5173 geomBorder.
width -= 2;
5196 iVPos = (xwa.height - iVPos) >> 1;
5204 const char *szText = pSelf->
pCaption;
5244 rctText.
left = geomBorder.
x;
5246 rctText.
top = geomBorder.
y;
5265 static int PushButtonDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
5269 XWindowAttributes xwa;
5271 XCharStruct xBounds;
5273 WB_GEOM geomPaint, geomBorder;
5276 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
5277 "%s - Expose %d (%08xH)\n", __FUNCTION__, (
int)wID, (
int)wID);
5279 if(XGetWindowAttributes(pDisplay, wID, &xwa) == 0)
5281 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5293 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5305 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5314 geomBorder.
x = xwa.border_width;
5315 geomBorder.
y = xwa.border_width;
5316 geomBorder.
width = xwa.width - xwa.border_width;
5317 geomBorder.
height = xwa.height - xwa.border_width;
5327 geomBorder.
width -= 2;
5333 BlackPixel(pDisplay, DefaultScreen(pDisplay)));
5338 geomBorder.
width -= 2;
5357 iHPos = xwa.border_width + i2;
5360 iVPos = (xwa.height - iVPos) >> 1;
5371 const char *szText = pSelf->
pCaption;
5376 rctText.
left = geomBorder.
x + iHPos;
5378 rctText.
top = geomBorder.
y + xBounds.ascent / 2
5379 - xBounds.descent / 2;
5398 static int ListDoExposeEvent(XExposeEvent *pEvent, Display *pDisplay,
5401 int i1, iVScrollWidth, iHScrollHeight;
5402 int nHeight, nItemHeight;
5403 XWindowAttributes xwa;
5405 XCharStruct xBounds;
5408 WB_GEOM geomPaint, geomBorder;
5414 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
5415 "%s - Expose %d (%08xH)\n", __FUNCTION__, (
int)wID, (
int)wID);
5417 if(XGetWindowAttributes(pDisplay, wID, &xwa) == 0)
5419 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5431 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5442 WB_WARN_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5449 geomBorder.
width = xwa.width - geomBorder.
x;
5450 geomBorder.
height = xwa.height - geomBorder.
y;
5456 BlackPixel(pDisplay, DefaultScreen(pDisplay)));
5468 geomBorder.
width -= 2;
5473 iHScrollHeight = xBounds.ascent + xBounds.descent + 4;
5497 geomBorder.
width -= 2;
5511 bzero(pScrollInfo,
sizeof(*pScrollInfo));
5517 nItemHeight = xBounds.ascent + xBounds.descent + 6;
5518 nHeight = (geomBorder.
height - 4) / nItemHeight;
5520 if(!pListInfo || pListInfo->
nItems <= nHeight)
5522 WBCalcVScrollBar(pScrollInfo, &geomBorder, iVScrollWidth, iHScrollHeight, 0, -1);
5526 pListInfo->
nTop = 0;
5527 pListInfo->
nPos = -1;
5533 pListInfo->
nItems - nHeight + 1, pListInfo->
nTop);
5534 if(pListInfo->
nPos < 0)
5572 if(rgnTemp2 != None)
5574 XIntersectRegion(rgnTemp2, rgnTemp, rgnTemp);
5575 XDestroyRegion(rgnTemp2);
5580 XDestroyRegion(rgnTemp);
5587 for(i1=pListInfo->
nTop; i1 <= pListInfo->nTop + nHeight; i1++)
5591 geomItem.
x = geomBorder.
x + 1;
5593 geomItem.
y = geomBorder.
y + nItemHeight * (i1 - pListInfo->
nTop);
5594 geomItem.
height = nItemHeight;
5606 if(i1 < pListInfo->nItems)
5650 XCharStruct xBounds;
5651 Window wID = pList->
wID;
5655 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_DialogCtrl,
5656 "%s - Expose %d (%08xH) pData=%p\n", __FUNCTION__, (
int)wID, (
int)wID, pData);
5664 WB_ERROR_PRINT(
"%s - NO FONT, line %d\n", __FUNCTION__, __LINE__);
5669 if(pData && *(
char *)pData ==
'@')
5679 WB_ERROR_PRINT(
"%s - * BUG * line %d\n", __FUNCTION__, __LINE__);
5712 if(((
const char *)pData)[0] ==
'@' &&
5713 ((
const char *)pData)[1] ==
'.' &&
5714 ((
const char *)pData)[2] ==
'.' &&
5715 !((
const char *)pData)[3])
5724 pGeom->
x + iHPos + xBounds.ascent / 2,
5725 pGeom->
y + pGeom->
height / 2 - xBounds.ascent / 4,
5726 iHPos * 2 - xBounds.ascent / 2,
5727 xBounds.ascent / 2);
5731 aPoints[0].x = pGeom->
x + iHPos;
5732 aPoints[0].y = pGeom->
y + pGeom->
height / 2;
5733 aPoints[1].x = aPoints[0].x + xBounds.ascent;
5734 aPoints[1].y = aPoints[0].y + xBounds.ascent * 2 / 3 - 1;
5735 aPoints[2].x = aPoints[1].x;
5736 aPoints[2].y = aPoints[0].y - xBounds.ascent * 2 / 3 + 1;
5737 aPoints[3].x = aPoints[0].x;
5738 aPoints[3].y = aPoints[0].y;
5740 WBFillPolygon(pDisplay, wID,
gc, aPoints, 4, Nonconvex, CoordModeOrigin);
5744 WBDrawLine(pDisplay, wID,
gc, aPoints[0].x, aPoints[0].y, aPoints[1].x - 1, aPoints[1].y);
5745 WBDrawLine(pDisplay, wID,
gc, aPoints[1].x + 1, pGeom->
y + pGeom->
height / 2 - xBounds.ascent / 4,
5746 pGeom->
x + iHPos * 3, pGeom->
y + pGeom->
height / 2 - xBounds.ascent / 4);
5747 WBDrawLine(pDisplay, wID,
gc, pGeom->
x + iHPos * 3, pGeom->
y + pGeom->
height / 2 - xBounds.ascent / 4 + 1,
5748 pGeom->
x + iHPos * 3, pGeom->
y + pGeom->
height / 2 + xBounds.ascent / 4 - 1);
5751 WBDrawLine(pDisplay, wID,
gc, aPoints[0].x, aPoints[0].y, aPoints[2].x - 1, aPoints[2].y);
5752 WBDrawLine(pDisplay, wID,
gc, aPoints[1].x + 1, pGeom->
y + pGeom->
height / 2 + xBounds.ascent / 4,
5753 pGeom->
x + iHPos * 3, pGeom->
y + pGeom->
height / 2 + xBounds.ascent / 4);
5757 const char *szText = (
const char *)pData + 1;
5759 if(*(
const char *)pData ==
'^')
5774 rctBounds.
top = pGeom->
y;
5776 rctBounds.
left = pGeom->
x + iHPos;
5777 rctBounds.
right = pGeom->
x + pGeom->
width - iHPos;
STATIC - display with a 3D-looking border.
WBDialogPropList * pPropList
pointer to the property list (may be NULL)
const char * CHGetHighlightForegroundColor(Display *pDisplay)
returns highlight foreground color
Atom aLOSTFOCUS
CONTROL_NOTIFY ClientMessage for LOSTFOCUS event.
BUTTON - Default Push Button (activate by <ENTER>)
XColor clrBG
background pixel color
static __inline__ XStandardColormap * PXM_StandardColormapFromColormap(Display *pDisplay, Colormap colormap)
create temporary XStandardColormap from a Colormap
Structure identifying one of the controls that appears on a dialog window.
struct s_WB_PUSHBUTTON_CONTROL WBPushButtonControl
Button 'pushbutton' control structure.
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.
Atom aDLGC_SCROLLINFO
dialog control SCROLLINFO property - see WB_SCROLLINFO structure
2nd parameter (direction) - up, left
char *(* get_sel_text)(const TEXT_OBJECT *pThis, const WB_RECT *pRct)
get the current selection rectangle as WB_RECT
void PXM_RGBToYUV(int iR, int iG, int iB, int *piY, int *piU, int *piV)
Convert R, G, B values to Y, U, V with 0-255 range.
void(* begin_mouse_drag)(TEXT_OBJECT *pThis)
Begin a mouse 'drag' operation.
#define WB_POINTER_DBLCLICK
WB_POINTER 'double-click' event, send in lieu of WB_POINTER_CLICK for double-click.
void(* do_expose)(TEXT_OBJECT *pThis, Display *pDisplay, Window wID, WBGC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom, WB_FONTC pFont)
Member function to properly render the text in a window (Expose event)
TEXT_OBJECT xTextObject
A Text Object associated with the editable text.
'window helper' main header file for the X11workbench Toolkit API
#define WB_LIST_SELCHANGE
unsigned long ulFlags
generic flag bits
#define WB_POINTER_CLICK
Mouse 'click' event.
Atom aGOTFOCUS
CONTROL_NOTIFY ClientMessage for GOTFOCUS event.
int WBDrawLine(Display *display, Drawable d, WBGC gc, int x1, int y1, int x2, int y2)
Wrapper for XDrawLines()
void WBFreeFont(Display *pDisplay, WB_FONT pFont)
free a WB_FONT that was created using one of the WBFont APIs
void(* page_up)(TEXT_OBJECT *pThis)
Move the current cursor position up one page.
Horizontal text alignment bits.
set for "default" controls
Atom aDLGC_PROP_NOTIFY
DLGC_PROP_NOTIFY ClientMessage, notify control of property change.
void WBClearWindow(Window wID, WBGC gc)
'Paint' helper, erases background by painting the background color within the clipping region
Atom aDLGC_LISTINFO
dialog control LISTINFO property - see DLGInitControlListInfo() etc.
void(* mouse_click)(TEXT_OBJECT *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS)
Translate mouse cursor position into actual row/column. This function is irrelevant if the expose met...
#define WB_DEBUG_PRINT(L,...)
Preferred method of implementing conditional debug output.
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.
int nTop
scroll position of the top item currently displayed
#define WB_POINTER_DROP
WB_POINTER 'drop' event, only sent if drag/drop supported AND was not 'canceled'; see WB_POINTER_CANC...
int WBFontHeight(WB_FONTC pFont0)
Get the maximum character height from a WB_FONT.
int WBFontAscent(WB_FONTC pFont0)
Get the maximum character ascent from a WB_FONT.
void DLGDelControlListEntry(WBDialogControl *pCtrl, int iIndex)
Delete a list entry from a control's list info at a specified index (or deletes ALL entries)
Utilities for copying and drawing text, determining text extents, and so on.
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.
bold font weight (mutually exclusive0
Atom aPATH_TREE_CONTROL
Standard Dialog Control - path tree - directory hierarchy - see PATH_TREE_CONTROL_STR.
int WBKeyEventProcessKey(const XKeyEvent *pEvent, char *pBuf, int *pcbLen, int *piAltCtrlShift)
Generic keyboard event translation utility.
int(* get_insmode)(const TEXT_OBJECT *pThis)
Get the current insert mode for the object.
OVERWRITE mode, character inserted on top of character to the right of the cursor (if any),...
BUTTON - Tri-state button.
internal flag, indicates that an underscore underlines the next character
BUTTON - Checkbox button.
Static 'Image' control structure.
int WBFontAvgCharWidth(WB_FONTC pFont0)
Get the average character width for a font.
Atom aMOUSE_DBLCLICK
CONTROL_NOTIFY ClientMessage for MOUSE_DBLCLICK event.
void WBCreateWindowDefaultGC(Window wID, unsigned long clrFG, unsigned long clrBG)
creates a default WBGC for a window
#define WB_POINTER_SCROLLDOWN
WB_POINTER 'scroll down' event, caused by mouse button 5.
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.
void PXM_YUVToRGB(int iY, int iU, int iV, int *piR, int *piG, int *piB)
Convert Y, U, V values to R, G, B with 0-255 range.
void(* set_insmode)(TEXT_OBJECT *pThis, int iInsMode)
Set the current insert mode for the object.
'tristate' flag. when 'setting', -1 'toggles', 1 sets it, 0 clears it. when 'getting',...
void * WBAllocDirectoryList(const char *szDirSpec)
Allocate a 'Directory List' object for a specified directory spec.
Atom aLIST_NOTIFY
CONTROL_NOTIFY ClientMessage for LIST_NOTIFY event.
void WBSetWindowClassName(Window wID, const char *szClassName)
Assignes the window's class name pointer.
void WBSetParentWindow(Window wID, Window wIDParent)
Assigns the parent to the specified window within the internal structure.
void(* del_select)(TEXT_OBJECT *pThis)
Delete the current selection assigned via 'set_select'.
void(* redo)(TEXT_OBJECT *pThis)
Perform a single 'redo' operation.
Static 'Image' control structure.
void(* set_text)(TEXT_OBJECT *pThis, const char *szText, unsigned long cbLen)
Call this function to re-assign all text in the control.
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.
for pushbuttons, causes it to be drawn 'pressed'
struct s_WB_LIST_CONTROL WBListControl
List control structure.
top-aligned text (using highest vertical ascent)
Atom aDLGC_CONTROL_GET
CONTROL_GET ClientMessage - use this to get specific supported control properties by sending it to th...
static __inline__ void WBInitializeInPlaceTextObject(TEXT_OBJECT *pTextObject, Window wIDOwner)
initialize an 'in-place' TEXT_OBJECT structure
WBDialogWindow * pOwner
pointer to owner dialog box
void(* set_select)(TEXT_OBJECT *pThis, const WB_RECT *pRct)
Set the current selection rectangle as WB_RECT.
const char * CHGetActiveBackgroundColor(Display *pDisplay)
returns background color for active elements
const char * CHGetStaticBackgroundColor(Display *pDisplay)
returns background color for static elements
int(* can_redo)(TEXT_OBJECT *pThis)
Indicate whether a 'redo' operation is possible (mostly for menu UI)
Window DLGGetNextDialogControl(WBDialogWindow *pDialog, Window idControl)
Return the Window ID of the NEXT dialog control within the 'tab order', based on the specified contro...
int(* get_col)(const TEXT_OBJECT *pThis)
Get the current column cursor for the object.
int DLGAddControlListEntry(WBDialogControl *pCtrl, const char *pData, long cbData, int iIndex)
Add a list entry to a control's list info.
1st parameter (bar) - The vertical scroll bar for the control or window.
WB_FONT WBCopyModifyFont(Display *pDisplay, WB_FONTC pOriginal, int iFontSize, int iFlags)
load and modify a font according to the specified size and flags
2nd parameter (direction) - 'knob track' - pos in data.l[2]
Atom aDLGC_PATH
dialog control PATH property, for file and directory controls
Atom aDEFPUSHBUTTON_CONTROL
Standard Dialog Control - default Pushbutton control (has dark border, accepts <ENTER> as hotkey) - s...
BUTTON - Cancel Push Button (activate by <ESC>)
int iFlags
visibility, focus, etc.
int iID
control unique identifier (number or atom, as appropriate, unique to dialog window)
XColor clrAFG
active state-based foreground color
int WBFillPolygon(Display *display, Drawable d, WBGC gc, XPoint *points, int npoints, int shape, int mode)
Wrapper for XFillPolygon()
int DLGPixelHeight(WBDialogWindow *pDlg, int iHeight)
Height of a single dialog unit (in pixels)
XColor clrABG
active state-based background color
Atom aWM_PROTOCOLS
WM supported protocols.
horizontally centered text. tabs are treated as white space
WB_FONT pFont
cached default font
void WBUpdateWindowImmediately(Window wID)
'Paint' helper, generates an immediate Expose event for non-empty 'invalid' region
void(* end_highlight)(TEXT_OBJECT *pThis)
End a highlight block.
Atom aWB_CHAR
keystroke/character notifications generated by API
static __inline__ Display * WBGetDefaultDisplay(void)
Returns the default Display.
internal wrapper struct for X11 'geometry' definition
'configuration helper' main header file for the X11 Work Bench Toolkit API
void PXM_RGBToPixel(XStandardColormap *pMap, XColor *pColor)
Icon Registration for application 'large' and 'small' icons.
#define RGB255_TO_XCOLOR(R, G, B, X)
Simple RGB assignment to pixel, 0-255 RGB.
void(* undo)(TEXT_OBJECT *pThis)
Perform a single 'undo' operation.
const char * CHGetActiveTextColor(Display *pDisplay)
returns 'active' text color
void PXM_PixelToRGB(XStandardColormap *pMap, XColor *pColor)
Convert the pixel menber of an XColor to RGB.
WB_GEOM geomDisplay
the (cached) geometry that defines the "display area" (not scrollbars, border)
Window DLGGetFirstDialogControl(WBDialogWindow *pDialog)
Return the Window ID of the FIRST dialog control within the 'tab order'.
Horizontally align text center.
Horizontally align text right.
void(* page_right)(TEXT_OBJECT *pThis)
Move the current cursor position right one page.
void DTDrawSingleLineText(WB_FONTC pFont, const char *szText, Display *pDisplay, WBGC gc, Drawable dw, int iTabWidth, int iTabOrigin, const WB_RECT *prcBounds, int iAlignment)
draw single-line text
int WBDrawString(Display *display, Drawable d, WBGC gc, int x, int y, const char *string, int length)
wrapper for XDrawString()
void(* page_down)(TEXT_OBJECT *pThis)
Move the current cursor position down one page.
int WBSetForeground(WBGC hGC, unsigned long foreground)
Assign foreground color, a wrapper for XSetForeground()
STATIC - Image control window.
int nPos
current scroll position
int WBSetClipboardData(Display *pDisplay, Atom aType, int iFormat, const void *pData, unsigned long nData)
Get clipboard data of requested type.
Atom aWB_POINTER
pointer click/double-click/drag notifications generated by API
BUTTON - Radio button (generic)
Atom aClass
basic control class atom
Atom aMOUSE_CLICK
CONTROL_NOTIFY ClientMessage for MOUSE_CLICK event.
#define COPY_COLOR_NAME(X, Y, Z)
macro to get a color name or use default if it does not exist in settings
#define WBGetWindowCopyGC2(wID, gcSrc)
makes a copy of the specified WBGC for the desired window
WB_FONTC WBQueryWindowFont(Window wID)
Returns the WB_FONT assigned to the window (may be NULL), not a copy.
void WBRegisterWindowCallback(Window wID, WBWinEvent pCallback)
register callback function for a window (required)
Atom aLIST_CONTROL
Standard Dialog Control - list - single, multi, extended select (h, v, multicol) - see LIST_CONTROL_S...
Structure identifying a dialog (frame) window.
WBWinEvent pDLGControlCallback
control's callback function
int nItems
current number of valid entries in 'aItems'
const char * WBDialogControlGetProperty(WBDialogControl *pCtrl, Atom aPropName)
Mid-level dialog control property retrieval (character string)
void DeleteTimer(Display *pDisplay, Window wID, long lID)
Deletes an existing timer's resources.
#define RGB255_FROM_XCOLOR(X, R, G, B)
Simple RGB assignment from pixel, 0-255 RGB.
void WBInvalidateGeom(Window wID, const WB_GEOM *pGeom, int bPaintNow)
'Paint' helper, invalidates a geometry for asynchronous Expose event generation
int WBDrawLines(Display *display, Drawable d, WBGC gc, XPoint *points, int npoints, int mode)
Wrapper for XDrawLine()
void(* cursor_home)(TEXT_OBJECT *pThis)
Move the cursor 'home' (left or BOL)
STATIC - Text control window.
XColor clrBG
background color
int WBStat(const char *szLinkName, unsigned long *pdwModeAttrReturn)
Obtain the 'stat' flags for a file name, resolving links as needed.
Region WBGetPaintRegion(Window wID)
'Paint' helper, returns a copy of the current 'paint' region for the window
int WBGetDirectoryListFileStat(const void *pDirectoryList, const char *szFileName, unsigned long *pdwModeAttrReturn)
Obtain the 'stat' flags for a file name, resolving links as needed, with respect to a 'Directory List...
left button in 'drag' state on vertical scroll bar (relies on drag cancel)
unsigned long WBGetWindowFGColor(Window wID)
Returns the currently assigned foreground color.
void * pVal
pointer to data, as needed (may be allocated, some property types auto-free the data)
center using entire text height (ascent + descent for single line)
const char * CHGetTextColor(Display *pDisplay)
returns text color
2nd parameter (direction) - bottom, end
void * WBAlloc(int nSize)
High performance memory sub-allocator 'allocate'.
#define END_XCALL_DEBUG_WRAPPER
wrapper macro for calls into the X11 library. This macro follows the call(s)
#define WB_POINTER_SCROLLUP
WB_POINTER 'scroll up' event, caused by mouse button 4.
XColor clrFG
foreground color
void(* cursor_right)(TEXT_OBJECT *pThis)
Move the current cursor position right one column.
2nd parameter (direction) - relative scroll - rel pos in data.l[2]
void WBValidateGeom(Window wID, const WB_GEOM *pGeom)
'Paint' helper, validates a geometry for asynchronous Expose event generation
int WBSetRegion(WBGC hGC, Region rgnClip)
Assign clipping region, wrapper for XSetRegion()
int WBIsMapped(Display *pDisplay, Window wID)
Returns non-zero if window has been mapped; zero otherwise.
BUTTON - 'First' radio button in a group.
int DLGProcessHotKey(WBDialogWindow *pDLG, XEvent *pEvent)
return non-zero if a hot-key was processed and no further processing should be done....
Atom aCOMBO_CONTROL
Standard Dialog Control - classic 'combo box' control - see COMBO_CONTROL_STR.
TEXT_OBJECT xTextObject
A Text Object associated with the edit text.
const char * CHGetHighlightBackgroundColor(Display *pDisplay)
returns highlight background color
int WBFillArc(Display *display, Drawable d, WBGC gc, int x, int y, unsigned int width, unsigned int height, int angle1, int angle2)
Wrapper for XFillArc()
void(* cursor_up)(TEXT_OBJECT *pThis)
Move the current cursor position up one line.
#define WB_ERROR_PRINT(...)
Preferred method of implementing an 'error level' debug message for all subsystems.
Atom aDLGC_CAPTION
dialog control CAPTION property - see WBDialogControlGetCaption()
unsigned long WBGetWindowBGColor(Window wID)
Returns the currently assigned background color.
char *(* get_text)(TEXT_OBJECT *pThis)
Call this function to get all text, formatted so that it can be saved to a file.
int WBDialogControlSetPropList(WBDialogControl *pCtrl, const char *szPropList)
Mid-level dialog control property list assignment.
int(* has_select)(const TEXT_OBJECT *pThis)
Returns a non-zero value if there is currently a 'selection'.
XColor clrHFG
highlighted state-based foreground color
int(* can_undo)(TEXT_OBJECT *pThis)
Indicate whether an 'undo' operation is possible (mostly for menu UI)
void WBFree(void *pBuf)
High performance memory sub-allocator 'free'.
void(* replace_select)(TEXT_OBJECT *pThis, const char *szText, unsigned long cbLen)
Replace the current selection assigned via 'set_select' with new text.
static __inline__ void WBInvalidateRect(Window wID, const WB_RECT *pRCT, int bPaintFlag)
'Paint' helper, invalidates a WB_RECT for asynchronous Expose event generation
Window wID
Window ID of the dialog control window.
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)
2nd parameter (direction) - pgup, pgleft
#define WB_POINTER_CANCEL
WB_POINTER 'cancel' event, cancels an ongoing operation, such as drag/drop (useful for resource clean...
XCharStruct WBFontMaxBounds(WB_FONTC pFont0)
Get a 'maximized' copy of 'max_bounds' (applicable to all font faces in the WB_FONT)
#define WB_KEYEVENT_SHIFT
'AltCtrlShift' bit flag for Shift modifier for WBKeyEventProcessKey()
void(* set_linefeed)(TEXT_OBJECT *pThis, int iLineFeed)
Set the current linefeed type for the object.
void WBSetWindowFont(Window wID, WB_FONTC pFont)
assigns the default WB_FONT object for a window
Vertically align text center (default)
#define WB_MOUSE_INPUT_MASK
'Mouse' input mask, bit flag for window creation
INSERT mode, character inserted at cursor.
int nItemHeight
height of a single item (in pixels)
void WBUpdateWindow(Window wID)
'Paint' helper, generates an asynchronous Expose event for non-empty 'invalid' region
#define WB_POINTER_MOVE
WB_POINTER 'move' event, for motion notification during drag/drop.
#define WB_POINTER_DRAG
WB_POINTER 'drag' event, window proc MUST return the window ID to auto-support drag/drop.
2nd parameter (direction) - absolute scroll - pos in data.l[2]
Atom aEDIT_CONTROL
Standard Dialog Control - editable text (single or multi-line, scrollable, clipboard) - see EDIT_CONT...
int DLGPixelWidth(WBDialogWindow *pDlg, int iWidth)
Width of a single dialog unit (in pixels)
const TEXT_OBJECT_VTABLE * vtable
method function pointers (similar to C++ virtual member functions)
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
int WBNextDirectoryEntry(void *pDirectoryList, char *szNameReturn, int cbNameReturn, unsigned long *pdwModeAttrReturn)
Obtain information about the next entry in a 'Directory List'.
int WBSetClipMask(WBGC hGC, Pixmap pixmap)
Set clip mask, a wrapper for XSetClipMask()
#define WB_POINTER_BUTTON1
WB_POINTER button bitmask indicating that button 1 is pressed.
set for 'pushbuttons' (which override 'default' for <ENTER>)
A 'C++'-like object for managing text, that can be overridden for custom behavior.
struct s_WB_IMAGE_CONTROL WBImageControl
Static 'Image' control structure.
unsigned int ulTag
The value DIALOG_CONTROL_TAG.
void WBDrawDashedRect(Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomRect, unsigned long lColor)
Draw a 'dashed' rectangle.
struct s_WB_COMBO_CONTROL WBComboControl
List control structure.
#define WB_STANDARD_INPUT_MASK
'Standard' input mask, bit flag for window creation
void DLGCDestroyProperties(WBDialogPropList *pPropList)
Destroy Properties for a dialog control.
#define WB_KEYEVENT_ACSMASK
'AltCtrlShift' bit mask for Alt+Ctrl+Shift bits for WBKeyEventProcessKey()
Dialog property storage structure.
XColor clrHBG
highlighted state-based background color
void * WBDialogControlGetProperty2(WBDialogControl *pCtrl, Atom aPropName)
Mid-level dialog control property list retrieval (generic pointer)
WBGC WBBeginPaint(Window wID, XExposeEvent *pEvent, WB_GEOM *pgBounds)
'Paint' helper, creates a WBGC for use in updating the window in an Expose event handler
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
WBGC WBGetWindowCopyGC(Window wID)
makes a copy of the default WBGC so that it can be modified
XColor clrBD3
3D border color 3 (dark)
void(* del_chars)(TEXT_OBJECT *pThis, int nChar)
Delete 'n' characters from the current cursor. Negative deletes BEFORE the cursor....
STATIC - frame control window.
2nd parameter (direction) - home, top
#define DIALOG_CONTROL_TAG
TAG for the WBDialogControl structure.
struct s_WB_DIALOG_CONTROL WBDialogControl
Structure identifying the properties of a dialog box control.
void(* end_mouse_drag)(TEXT_OBJECT *pThis)
End a mouse 'drag' operation.
Atom aMOUSE_DRAG
CONTROL_NOTIFY ClientMessage for MOUSE_DRAG event.
void WBBeginWaitCursor(Window wID)
increment 'wait cursor' count, set cursor to WB_WAIT_CURSOR
internal wrapper struct for 'rectangle' definition
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.
Atom aIMAGE_CONTROL
Standard Dialog Control - generic image/pixmap holder - see IMAGE_CONTROL_STR.
int WBSetClipOrigin(WBGC hGC, int clip_x_origin, int clip_y_origin)
Set clip origin, a wrapper for XSetClipOrigin()
char * pCaption
allocated pointer to caption, in lieu of using a WM_NAME property (may be NULL)
void WBSetWindowDefaultCursor(Window wID, int idStandardCursor)
Assigns a default cursor (by ID) to a window.
void(* highlight_colors)(TEXT_OBJECT *pThis, XColor clrHFG, XColor clrHBG)
Call this to assign the highlight colors. Default colors are WBGC's BG and FG.
struct s_WB_TREE_CONTROL WBTreeControl
Static 'Image' control structure.
int WBTextWidth(WB_FONTC pFont, const char *szText, int cbText)
Obtain the pixel width of specified text for a specified WB_FONT.
Display * WBGetWindowDisplay(Window wID)
returns the Display associated with a window
Atom aCONTROL_NOTIFY
dialog control and child window notification messages
void WBFreeGC(WBGC hGC)
Free resources for a WBGC, wrapper for XFreeGC()
void(* cursor_end)(TEXT_OBJECT *pThis)
Move the cursor to 'end' (full doc width or EOL)
void(* cursor_bottom)(TEXT_OBJECT *pThis)
Move the cursor to the last line.
void * aItems[1]
The array of item data, integrated into the memory block containing this structure.
set when item gets focus. cleared when no focus
void WBInvalidateVScrollGeom(Window wID, WB_SCROLLINFO *pScrollInfo, int bAll, int bUpdate)
Utility function to invalidate the geometry for the vertical scroll bar.
void WBSetWindowData(Window wID, int iIndex, void *pData)
assign 'data pointer' for a window and specified index value
2nd parameter (direction) - pgdn, pgright
STATIC - Icon control window.
void WBDraw3DBorderRect(Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor1, unsigned long lBorderColor2)
Draw a 3D 'border' rectangle.
'no border' flag (don't display a border - statics, typically)
void(* ins_chars)(TEXT_OBJECT *pThis, const char *pChar, int nChar)
Insert 'n' characters (including new lines) from the current cursor.
Atom aTREE_CONTROL
Standard Dialog Control - class 'tree' control - see TREE_CONTROL_STR.
Structure containing data for list-related dialog controls.
#define BEGIN_XCALL_DEBUG_WRAPPER
wrapper macro for calls into the X11 library. This macro precedes the call(s)
const char * CHGetBackgroundColor(Display *pDisplay)
returns background color for non-static elements
void(* cursor_left)(TEXT_OBJECT *pThis)
Move the current cursor position left one column.
int nHeight
height (in items) of display area, recalculated on resize/expose
Horizontally align text left (default)
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.
Window DLGGetPrevDialogControl(WBDialogWindow *pDialog, Window idControl)
Return the Window ID of the PREVIOUS dialog control within the 'tab order', based on the specified co...
void WBDestroyDirectoryList(void *pDirectoryList)
Destroy a 'Directory List' object allocated by WBAllocDirectoryList()
int WBFillRectangle(Display *display, Drawable d, WBGC gc, int x, int y, unsigned int width, unsigned int height)
Wrapper for XFillRectangle()
Region WBGeomToRegion(const WB_GEOM *pGeom)
'Paint' helper, converts a WB_GEOM structure to a Region.
Window wIDOwner
owner window (cached from paint/expose handling and/or cursor blink)
Atom aBUTTON_PRESS
CONTROL_NOTIFY ClientMessage for BUTTON_PRESS event.
Vertically align text top.
int WBSetBackground(WBGC hGC, unsigned long background)
Assign background color, a wrapper for XSetBackground()
Atom aWB_TIMER
timer notifications generated by API
void DTDrawMultiLineText(WB_FONTC pFont, const char *szText, Display *pDisplay, WBGC gc, Drawable dw, int iTabWidth, int iTabOrigin, const WB_RECT *prcBounds, int iAlignment)
draw multi-line text
#define WB_KEYEVENT_CTRL
'AltCtrlShift' bit flag for Control modifier for WBKeyEventProcessKey()
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
Atom aICON_CONTROL
Standard Dialog Control - icon container (has a nice 3D border) - see ICON_CONTROL_STR.
void(* page_left)(TEXT_OBJECT *pThis)
Move the current cursor position left one page.
void(* cursor_blink)(TEXT_OBJECT *pThis, int bHasFocus)
Periodic callback to 'blink' the cursor.
void WBCalcVScrollBar(WB_SCROLLINFO *pScrollInfo, WB_GEOM *pgeomClient, int iVScrollWidth, int iHScrollHeight, int nListItems, int nPos)
Calculate the parameters for a vertical scroll bar.
void WBEndWaitCursor(Window wID)
decrement 'wait cursor' count, restore to default when zero
int CreateTimer(Display *pDisplay, Window wID, unsigned long lInterval, long lID, int iPeriodic)
Creates a one-shot or periodic timer.
char * WBCopyString(const char *pSrc)
A simple utility that returns a WBAlloc() copy of a 0-byte terminated string.
BUTTON - 'type mask' for buttons.
set when item CAN have focus.
BUTTON - Push button (generic)
#define WB_KEYBOARD_INPUT_MASK
'Keyboard' input mask, bit flag for window creation
Vertical text alignment bits.
void * WBGetClipboardData(Display *pDisplay, Atom *paType, int *piFormat, unsigned long *pnData)
Get clipboard data of requested type.
void WBEndPaint(Window wID, WBGC gc)
'Paint' helper, frees resources and marks the update region 'valid'
internal wrapper struct for GC with local cache
#define WBPointInGeom(X, Y, G)
Returns logical TRUE if the point (X,Y) is within the borders of the geometry 'G'.
Atom aFILE_LIST_CONTROL
Standard Dialog Control - File List - see FILE_LIST_CONTROL_STR.
struct s_WB_EDIT_CONTROL WBEditControl
Edit control structure.
void WBDrawBorderRect(Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomBorder, unsigned long lBorderColor)
Draw a 'border' rectangle.
static __inline__ void WBDestroyInPlaceTextObject(TEXT_OBJECT *pTextObject)
Destroy a previously initialized 'in-place' TEXT_OBJECT structure.
2nd parameter (direction) - down, right
void(* begin_highlight)(TEXT_OBJECT *pThis)
Begin a highlight block.
bottom-aligned text (using lowest vertical descent)
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.
#define DLGInitControlListInfoDefault(X)
wrapper macro for DLGInitControlListInfo() for standard WBAlloc'd text data
const char * CHGetBorderColor(Display *pDisplay)
returns border color
Vertically align text bottom.
Atom aPUSHBUTTON_CONTROL
Standard Dialog Control - Pushbutton control - see PUSHBUTTON_CONTROL_STR.
Window wID
window ID of the dialog (frame) window
always insert at beginning
void(* cursor_top)(TEXT_OBJECT *pThis)
Move the cursor to the top line.
Atom aSTRING
STRING Atom for the clipboard - uses XA_STRING.
#define WB_WARN_PRINT(...)
Preferred method of implementing a 'warning level' debug message for all subsystems.
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.
void(* cursor_down)(TEXT_OBJECT *pThis)
Move the current cursor position down one line.
int cbStructSize
assigned at allocation time, the total size of this structure
void WBDialogControlSetProperty2(WBDialogControl *pCtrl, Atom aPropName, void *pPropVal)
Mid-level dialog control property list assignment (generic pointer)
Atom aUTF8_STRING
UTF8_STRING Atom for the clipboard.
Atom aTEXT_CHANGED
CONTROL_NOTIFY ClientMessage for TEXT_CHANGED event.
'checked' flag. when 'setting', -1 'toggles', 1 sets it, 0 clears it. when 'getting',...
void WBCatString(char **ppDest, const char *pSrc)
A simple utility that concatenates a string onto the end of a 0-byte terminated WBAlloc() string.
'tri-stated' state (overrides 'checked' state)
#define WB_KEYEVENT_KEYSYM
'AltCtrlShift' bit flag for 'VK_' keys for WBKeyEventProcessKey()
WB_FONTC WBGetDefaultFont(void)
Returns a pointer to the default font WB_FONT for the default display. This is a shared resource; do ...