62 #include "menu_popup.h" 68 static int ChildFrameEditCutHandler(XClientMessageEvent *);
69 static int ChildFrameEditCopyHandler(XClientMessageEvent *);
70 static int ChildFrameEditPasteHandler(XClientMessageEvent *);
71 static int ChildFrameEditDeleteHandler(XClientMessageEvent *);
72 static int ChildFrameEditSelectAllHandler(XClientMessageEvent *);
73 static int ChildFrameEditSelectNoneHandler(XClientMessageEvent *);
74 static int ChildFrameEditPropertiesHandler(XClientMessageEvent *);
76 static int ChildFrameEditCopyUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem);
77 static int ChildFrameEditPasteUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem);
78 static int ChildFrameEditDeleteUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem);
79 static int ChildFrameEditSelectAllUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem);
80 static int ChildFrameEditSelectNoneUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem);
81 static int ChildFrameEditPropertiesUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem);
106 static int ChildFrameDoPointerEvent(XClientMessageEvent *pEvent, Display *pDisplay,
109 static int ChildFrameDoScrollEvent(XClientMessageEvent *pEvent, Display *pDisplay,
112 static int ChildFrameDoCharEvent(XClientMessageEvent *pEvent, Display *pDisplay,
123 XSetWindowAttributes xswa;
128 if(!pChildFrame || !pOwner || pOwner->
wID == None)
132 WB_ERROR_PRINT(
"%s - invalid pointers or owner window does not exist\n", __FUNCTION__);
138 bzero(pChildFrame,
sizeof(*pChildFrame));
147 pChildFrames = pChildFrame;
148 pChildFrame->
pNext = NULL;
156 if(pC == pChildFrame)
158 WB_ERROR_PRINT(
"%s - unexpected error condition, did you call this function before?\n", __FUNCTION__);
169 bzero(pChildFrame,
sizeof(*pChildFrame));
171 pC->
pNext = pChildFrame;
172 pChildFrame->
pNext = NULL;
177 WB_ERROR_PRINT(
"%s - unexpected condition, returning error\n", __FUNCTION__);
215 if(!pChildFrame->
pFont)
254 +
sizeof(aChildFrameMenuHandler)
255 /
sizeof(aChildFrameMenuHandler[0])
268 aChildFrameMenuHandler,
269 sizeof(aChildFrameMenuHandler));
280 bzero(&xswa,
sizeof(xswa));
284 xswa.colormap = DefaultColormap(pDisplay, DefaultScreen(pDisplay));
285 xswa.bit_gravity = CenterGravity;
291 CWBorderPixel | CWBackPixel | CWColormap | CWBitGravity,
294 if(pChildFrame->
wID == None)
302 pChildFrame->pUserCallback = pUserCallback;
310 XSelectInput(pDisplay, pChildFrame->wID,
316 pChildFrame->pOwner = pOwner;
337 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
342 wID = pChildFrame->
wID;
350 if(pChildFrame->
pOwner != NULL)
352 WB_ERROR_PRINT(
"ERROR: %s - owner pointer was nut 'NULL'd out\n", __FUNCTION__);
355 pChildFrame->
pOwner = NULL;
366 if(pChildFrame->
pFont)
369 pChildFrame->
pFont = NULL;
395 if(pChildFrame->
wID != None)
398 pChildFrame->
wID = None;
411 if(pC == pChildFrame)
419 pChildFrames = pC->
pNext;
432 pChildFrame->
pNext = NULL;
482 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
507 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
519 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
544 +
sizeof(aChildFrameMenuHandler)
545 /
sizeof(aChildFrameMenuHandler[0])
561 aChildFrameMenuHandler,
562 sizeof(aChildFrameMenuHandler));
575 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
597 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
606 #if 0 // this function probably won't be used nor implemented; left anyway (reserved) 607 static void InternalSetChildFrameScrollInfo(
WBChildFrame *pChildFrame,
int iRow,
int iMaxRow,
int iCol,
int iMaxCol,
608 int iRowHeight,
int iColWidth)
649 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
664 static void InternalChildFrameRecalcGeom(
WBChildFrame *pChildFrame,
int bResize)
669 int nL, nL2, nC, nC2;
673 pOwner = pChildFrame->
pOwner;
677 WB_ERROR_PRINT(
"ERROR: %s - pOwner is NULL for Child Frame\n", __FUNCTION__);
690 XMoveWindow(pDisplay, pChildFrame->
wID, iL, iT);
691 XResizeWindow(pDisplay, pChildFrame->
wID, iW - 2, iH - 2);
696 pChildFrame->
geom.
x = 2;
697 pChildFrame->
geom.
y = 2;
736 if((nL > 0 && nL <= pChildFrame->extent.height) ||
737 (nC > 0 && nC <= pChildFrame->extent.width))
741 if(nC > 0 && nC <= pChildFrame->extent.width)
760 if(nC > 0 && nC <= pChildFrame->extent.width)
774 goto reset_hscroll_range;
801 &(pChildFrame->
geom), &(pChildFrame->
geom));
805 int iRowHeight,
int iColWidth)
809 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
826 InternalChildFrameRecalcGeom(pChildFrame, 0);
838 WB_WARN_PRINT(
"TODO: %s - implement. %p %u (%08xH) %d, %d, %d, %d, %d, %d\n", __FUNCTION__,
839 pChildFrame, (
int)pChildFrame->
wID, (
int)pChildFrame->
wID,
840 iRow, iMaxRow, iCol, iMaxCol, iRowHeight, iColWidth);
849 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
856 InternalChildFrameRecalcGeom(pChildFrame, 1);
871 XClientMessageEvent evt;
875 bzero(&evt,
sizeof(evt));
876 evt.type = ClientMessage;
878 evt.display = pDisplay;
879 evt.window = pChildFrame->
wID;
882 evt.data.l[0] = pChildFrame->
geom.
x;
883 evt.data.l[1] = pChildFrame->
geom.
y;
901 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
916 XClientMessageEvent evt;
921 WB_ERROR_PRINT(
"ERROR: %s - pChildFrame not valid\n", __FUNCTION__);
933 bzero(&evt,
sizeof(evt));
934 evt.type = ClientMessage;
936 evt.display = pDisplay;
937 evt.window = pChildFrame->
wID;
941 return pChildFrame->
pUserCallback(evt.window, (XEvent *)&evt);
955 int nChar =
sizeof(tbuf);
976 if(pEvent->type == Expose)
1041 else if(pEvent->type == ClientMessage)
1062 if(pEvent->type == ClientMessage &&
1084 if(!iRval && !pFW &&
1085 pEvent->type == ClientMessage &&
1086 pEvent->xclient.message_type ==
aWB_CHAR &&
1087 pEvent->xclient.data.l[0] == XK_F10 &&
1108 XClientMessageEvent evt;
1112 bzero(&evt,
sizeof(evt));
1113 evt.type = ClientMessage;
1115 evt.window = wIDMenu;
1123 WB_DEBUG_PRINT(DebugLevel_Chatty | DebugSubSystem_Menu | DebugSubSystem_Frame,
1124 "%s - posting client event message to display menu\n", __FUNCTION__);
1138 switch(pEvent->type)
1146 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Frame | DebugSubSystem_Keyboard,
1147 "%s KEY PRESS for KEY %d KEYCODE %d MASK=%d (%xH)\n",
1148 __FUNCTION__, iKey, ((XKeyEvent *)pEvent)->keycode,
1149 ((XKeyEvent *)pEvent)->state, ((XKeyEvent *)pEvent)->state);
1160 WB_DEBUG_PRINT(DebugLevel_Excessive | DebugSubSystem_Menu | DebugSubSystem_Frame | DebugSubSystem_Keyboard,
1161 "%s call to MBMenuProcessHotKey for menu window %d (%08xH)\n",
1162 __FUNCTION__, (
int)pMenuBar->
wSelf, (
int)pMenuBar->
wSelf);
1178 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Frame | DebugSubSystem_Keyboard,
1179 "%s KEY RELEASE for KEY %d KEYCODE %d MASK=%d (%xH)\n",
1180 __FUNCTION__, iKey, ((XKeyEvent *)pEvent)->keycode,
1181 ((XKeyEvent *)pEvent)->state, ((XKeyEvent *)pEvent)->state);
1191 if(pEvent->xclient.message_type ==
aWB_CHAR)
1203 else if(pEvent->xclient.message_type ==
aWB_POINTER)
1233 if(pEvent->type == DestroyNotify &&
1234 pEvent->xdestroywindow.window == wID)
1236 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Frame,
1237 "%s - DestroyNotify\n", __FUNCTION__);
1242 "%s - DestroyNotify *NOT* handled by superclass\n", __FUNCTION__);
1247 if(pC && pC->
wID != None)
1260 "%s - DestroyNotify handled by Child Window base class\n", __FUNCTION__);
1266 "%s - child frame window destroyed\n", __FUNCTION__);
1275 static int ChildFrameDoPointerEvent(XClientMessageEvent *pEvent, Display *pDisplay,
1283 if(wID == None || !pC || !pUI ||
1284 pEvent->type != ClientMessage ||
1307 iButtonMask = pEvent->data.l[1];
1309 iACS = pEvent->data.l[2];
1311 iX = pEvent->data.l[3];
1312 iY = pEvent->data.l[4];
1314 WB_DEBUG_PRINT(DebugLevel_Medium | DebugSubSystem_Mouse | DebugSubSystem_Frame | DebugSubSystem_Event,
1315 "INFO: %s EVENT=%lu (%08lxH) iButtonMask=%x iACS=%x iX=%d iY=%d\n",
1316 __FUNCTION__, (
unsigned long)pEvent->data.l[0], (
unsigned long)pEvent->data.l[0],
1317 iButtonMask, iACS, iX, iY);
1319 switch(pEvent->data.l[0])
1342 pUI->
mouse_drag(pC, iX, iY, iButtonMask, iACS);
1354 pUI->
mouse_drop(pC, iX, iY, iButtonMask, iACS);
1381 WB_WARN_PRINT(
"WARNING: %s %d - WB_POINTER_SCROLLUP\n", __FUNCTION__, __LINE__);
1386 WB_WARN_PRINT(
"WARNING: %s %d - WB_POINTER_SCROLLUP (not handled)\n", __FUNCTION__, __LINE__);
1393 WB_WARN_PRINT(
"WARNING: %s %d - WB_POINTER_SCROLLDOWN\n", __FUNCTION__, __LINE__);
1398 WB_WARN_PRINT(
"WARNING: %s %d - WB_POINTER_SCROLLDOWN (not handled)\n", __FUNCTION__, __LINE__);
1407 WB_ERROR_PRINT(
"%s.%d - unhandled mousie message\n", __FUNCTION__, __LINE__);
1418 static int ChildFrameDoScrollEvent(XClientMessageEvent *pEvent, Display *pDisplay,
1424 "%s %d - SCROLL_NOTIFY - SCROLL_VERTICAL, %lx, %lx, %lx, %lx\n",
1425 __FUNCTION__, __LINE__,
1431 switch(pEvent->data.l[1])
1498 (
int)pEvent->data.l[2]);
1504 WB_DEBUG_PRINT(DebugLevel_WARN | DebugSubSystem_Event | DebugSubSystem_Frame | DebugSubSystem_ScrollBar,
1505 "WARNING: %s %d - SCROLL_NOTIFY - SCROLL_VERTICAL - WB_SCROLL_NA\n", __FUNCTION__, __LINE__);
1513 "%s %d - SCROLL_NOTIFY - SCROLL_HORIZONTAL, %lx, %lx, %lx, %lx\n",
1514 __FUNCTION__, __LINE__,
1520 switch(pEvent->data.l[1])
1591 (
int)pEvent->data.l[2]);
1597 WB_DEBUG_PRINT(DebugLevel_WARN | DebugSubSystem_Event | DebugSubSystem_Frame | DebugSubSystem_ScrollBar,
1598 "WARNING: %s %d - SCROLL_NOTIFY - SCROLL_HORIZONTAL - WB_SCROLL_NA\n", __FUNCTION__, __LINE__);
1604 WB_ERROR_PRINT(
"WARNING: %s %d - SCROLL_NOTIFY not handled - %lx, %lx, %lx, %lx, %lx\n",
1605 __FUNCTION__, __LINE__,
1616 static int ChildFrameDoCharEvent(XClientMessageEvent *pEvent, Display *pDisplay,
1619 int iKey, iACS, nChar;
1624 if(wID == None || !pC || !pUI ||
1625 pEvent->type != ClientMessage ||
1637 iKey = pEvent->data.l[0];
1638 iACS = pEvent->data.l[1];
1639 nChar = pEvent->data.l[2];
1640 pBuf = (
char *)&(pEvent->data.l[3]);
1645 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1646 "%s KEY RELEASE for KEY %d KEYCODE %d MASK=%d (%xH)\n",
1647 __FUNCTION__, iKey, ((XKeyEvent *)pEvent)->keycode,
1648 ((XKeyEvent *)pEvent)->state, ((XKeyEvent *)pEvent)->state);
1652 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1653 "%s - BACKSPACE key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1661 XBell(pDisplay, -100);
1675 pUI->
enter(pC, iACS);
1683 XBell(pDisplay, -100);
1696 pUI->
enter(pC, iACS);
1700 XBell(pDisplay, -100);
1717 XBell(pDisplay, -100);
1724 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1725 "%s - CTRL+A key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1735 XBell(pDisplay, -100);
1756 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Clipboard | DebugSubSystem_Keyboard,
1757 "%s - CTRL+C key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1763 XBell(pDisplay, -100);
1764 WB_DEBUG_PRINT(DebugLevel_Light | DebugSubSystem_Event | DebugSubSystem_Clipboard | DebugSubSystem_Keyboard,
1765 "%s.%d - no selection, can't 'COPY'\n", __FUNCTION__, __LINE__);
1782 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Clipboard | DebugSubSystem_Keyboard,
1783 "%s - CTRL+V key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1808 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1809 "%s - CTRL+X key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1819 XBell(pDisplay, -100);
1836 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1837 "%s - CTRL+Z key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1847 XBell(pDisplay, -100);
1860 XBell(pDisplay, -100);
1879 else if(iKey ==
'\x1b')
1881 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1882 "%s - ESC key pressed, iACS=%d (%xH)\n", __FUNCTION__, iACS, iACS);
1898 XBell(pDisplay, -100);
1920 #define KEYSYM_MATCH_CURSOR_NAME(X) (iKey == XK_##X || iKey == XK_KP_##X) 1922 if(KEYSYM_MATCH_CURSOR_NAME(Home))
1924 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1925 "%s - Home key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
1929 pUI->
home(pC, iACS);
1934 else if(KEYSYM_MATCH_CURSOR_NAME(End))
1936 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1937 "%s - End key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
1946 else if(KEYSYM_MATCH_CURSOR_NAME(Left))
1948 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1949 "%s - Left key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
1958 else if(KEYSYM_MATCH_CURSOR_NAME(Right))
1960 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1961 "%s - Right key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
1970 else if(KEYSYM_MATCH_CURSOR_NAME(Up))
1972 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1973 "%s - Up key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
1982 else if(KEYSYM_MATCH_CURSOR_NAME(Down))
1984 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
1985 "%s - Down key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
1993 XBell(pDisplay, -100);
1998 else if(KEYSYM_MATCH_CURSOR_NAME(Page_Up))
2000 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
2001 "%s - Page Up key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
2011 XBell(pDisplay, -100);
2020 pUI->
pgup(pC, iACS);
2024 XBell(pDisplay, -100);
2030 else if(KEYSYM_MATCH_CURSOR_NAME(Page_Down))
2032 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
2033 "%s - Page Down key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
2043 XBell(pDisplay, -100);
2056 XBell(pDisplay, -100);
2062 else if(KEYSYM_MATCH_CURSOR_NAME(Begin))
2064 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
2065 "%s - Beginning Of Line key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
2077 XBell(pDisplay, -100);
2086 pUI->
home(pC, iACS);
2090 XBell(pDisplay, -100);
2096 else if(KEYSYM_MATCH_CURSOR_NAME(Insert))
2098 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
2099 "%s - Insert key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
2111 XBell(pDisplay, -100);
2124 XBell(pDisplay, -100);
2137 XBell(pDisplay, -100);
2143 else if(KEYSYM_MATCH_CURSOR_NAME(Delete))
2145 WB_DEBUG_PRINT(DebugLevel_Heavy | DebugSubSystem_Event | DebugSubSystem_Keyboard,
2146 "%s - Delete key pressed iACS=%d (%08xH)\n", __FUNCTION__, iACS, iACS);
2156 XBell(pDisplay, -100);
2169 XBell(pDisplay, -100);
2182 XBell(pDisplay, -100);
2188 #undef KEYSYM_MATCH_CURSOR_NAME 2200 WB_DEBUG_PRINT(DebugLevel_WARN | DebugSubSystem_Event | DebugSubSystem_Keyboard,
2201 "%s - CURSOR KEY? %d (%08xH) %d (%08xH)\n",
2202 __FUNCTION__, iKey, iKey, iACS, iACS);
2215 static int ChildFrameEditCutHandler(XClientMessageEvent *pEvent)
2221 if(!pEvent || pEvent->window == None)
2231 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2239 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2256 static int ChildFrameEditCopyHandler(XClientMessageEvent *pEvent)
2262 if(!pEvent || pEvent->window == None)
2272 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2280 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2297 static int ChildFrameEditPasteHandler(XClientMessageEvent *pEvent)
2303 if(!pEvent || pEvent->window == None)
2313 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2321 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2337 static int ChildFrameEditDeleteHandler(XClientMessageEvent *pEvent)
2343 if(!pEvent || pEvent->window == None)
2353 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2361 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2378 static int ChildFrameEditSelectAllHandler(XClientMessageEvent *pEvent)
2384 if(!pEvent || pEvent->window == None)
2394 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2402 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2413 WB_ERROR_PRINT(
"NOT HANDLED: %s - pChildFrame->pUI = %p, select_all = %p\n",
2414 __FUNCTION__, pChildFrame->
pUI,
2420 static int ChildFrameEditSelectNoneHandler(XClientMessageEvent *pEvent)
2426 if(!pEvent || pEvent->window == None)
2436 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2444 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2455 WB_ERROR_PRINT(
"NOT HANDLED: %s - pChildFrame->pUI = %p, select_none = %p\n",
2456 __FUNCTION__, pChildFrame->
pUI,
2462 static int ChildFrameEditCutUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2482 wID = pPopup->wOwner;
2506 static int ChildFrameEditCopyUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2526 wID = pPopup->wOwner;
2550 static int ChildFrameEditPasteUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2571 wID = pPopup->wOwner;
2582 if(pChildFrame && pChildFrame->
pUI)
2584 if(XGetSelectionOwner(pDisplay,
aCLIPBOARD) != None ||
2585 XGetSelectionOwner(pDisplay,
aPRIMARY) != None)
2598 static int ChildFrameEditDeleteUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2618 wID = pPopup->wOwner;
2642 static int ChildFrameEditSelectAllUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2662 WB_ERROR_PRINT(
"ERROR: %s no popup for menu %p\n", __FUNCTION__, pMenu);
2666 wID = pPopup->wOwner;
2670 WB_ERROR_PRINT(
"ERROR: %s no owner for popup menu %p\n", __FUNCTION__, pPopup);
2678 WB_ERROR_PRINT(
"ERROR: %s no frame for window %u (%08xH)\n", __FUNCTION__, (
unsigned int)wID, (
unsigned int)wID);
2684 if(!pChildFrame || !pChildFrame->
pUI)
2686 WB_ERROR_PRINT(
"ERROR: %s no child frame %p or UI %p\n", __FUNCTION__,
2687 pChildFrame, pChildFrame ? pChildFrame->
pUI : NULL);
2699 "%s - no selection or is empty\n", __FUNCTION__);
2711 static int ChildFrameEditSelectNoneUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2731 wID = pPopup->wOwner;
2750 "%s - no selection\n", __FUNCTION__);
2765 static int ChildFrameEditPropertiesHandler(XClientMessageEvent *pEvent)
2771 if(!pEvent || pEvent->window == None)
2781 WB_ERROR_PRINT(
"ERROR: %s bad window (not frame window)\n", __FUNCTION__);
2789 WB_ERROR_PRINT(
"ERROR: %s - no child frame has focus\n", __FUNCTION__);
2800 WB_ERROR_PRINT(
"NOT HANDLED: %s - pChildFrame->pUI = %p, properties = %p\n",
2801 __FUNCTION__, pChildFrame->
pUI,
2807 static int ChildFrameEditPropertiesUIHandler(
WBMenu *pMenu,
WBMenuItem *pMenuItem)
2827 wID = pPopup->wOwner;
void(* pgleft)(WBChildFrame *, int iACS)
'page left' navigation.
int iFlags
bitmask of attribute flags (see WBFrameWindow_FLAGS enumeration)
Window wID
Window id for the frame window.
Atom aPRIMARY
PRIMARY Atom for the clipboard - uses XA_PRIMARY.
2nd parameter (direction) - up, left
WBWinEvent pUserCallback
message callback function pointer (can be NULL)
void(* home)(WBChildFrame *, int iACS)
'home' arrow navigation.
set this to disable tabs (single child frame only)
void(* scancode)(WBChildFrame *, XClientMessageEvent *)
handler for 'other scan code' WB_CHAR Client Messages.
int iClientY
The current Y position of the frame window's client area (relative to the window)
void(* leftarrow)(WBChildFrame *, int iACS)
'left' arrow navigation.
#define WB_POINTER_DBLCLICK
WB_POINTER 'double-click' event, send in lieu of WB_POINTER_CLICK for double-click.
'window helper' main header file for the X11workbench Toolkit API
#define WB_POINTER_CLICK
Mouse 'click' event.
void WBFreeFont(Display *pDisplay, WB_FONT pFont)
free a WB_FONT that was created using one of the WBFont APIs
void FWRemoveContainedWindow(WBFrameWindow *pFW, WBChildFrame *pCont)
Removes a 'contained' window from a frame window. Does not destroy the 'contained' window.
struct tagWBChildFrame * pNext
'Next Object' pointer in an internally stored linked list (do not alter or use this)
int FWInitChildFrame(WBChildFrame *pChildFrame, WBFrameWindow *pOwner, WB_FONTC pFont, const char *szFocusMenu, const WBFWMenuHandler *pHandlerArray, WBWinEvent pUserCallback, int fFlags)
Initialize a child frame (assumed to be a base 'class' for the window)
void(* undo)(WBChildFrame *)
perform an undo operation
#define WB_DEBUG_PRINT(L,...)
Preferred method of implementing conditional debug output.
void * WBGetWindowData(Window wID, int iIndex)
Gets the data associated with this window and the specified index.
void(* pgright)(WBChildFrame *, int iACS)
'page right' navigation.
unsigned int width
the 'width' value of the extent.
#define WB_POINTER_DROP
WB_POINTER 'drop' event, only sent if drag/drop supported AND was not 'canceled'; see WB_POINTER_CANC...
int WBFontAscent(WB_FONTC pFont0)
Get the maximum character ascent from a WB_FONT.
Utilities for copying and drawing text, determining text extents, and so on.
void FWSetChildFrameContextMenuID(WBChildFrame *pChildFrame, int nID)
Function to assign the context menu ID (from the menu resource) to a Child Frame.
void WBPaintHScrollBar(WB_SCROLLINFO *pScrollInfo, Display *pDisplay, Drawable wID, WBGC gc, WB_GEOM *pgeomClient)
Paint the horizontal scroll bar within a window based on WB_SCROLLINFO.
int x
the 'x' value of the point. can be negative.
static __inline__ int WBCheckDebugLevel(WB_UINT64 dwLevel)
Check specified debug level against the value returned by WBGetDebugLevel() and return non-zero for a...
int WBKeyEventProcessKey(const XKeyEvent *pEvent, char *pBuf, int *pcbLen, int *piAltCtrlShift)
Generic keyboard event translation utility.
void(* do_char)(WBChildFrame *, XClientMessageEvent *)
handler for regular WB_CHAR Client Messages (typed-in characters).
int WBFontAvgCharWidth(WB_FONTC pFont0)
Get the average character width for a font.
generic 'NA' or 'UNDEFINED' value
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.
WBFWMenuHandler * pMenuHandler
menu handler for this child frame's menu (NULL = 'use default')
structure for managing menu callbacks
int WBScrollBarEvent(Window wID, XEvent *pEvent, WB_SCROLLINFO *pScrollInfo)
Event handler for scroll bars.
#define WB_KEYEVENT_ALT
'AltCtrlShift' bit flag for ALT modifier for WBKeyEventProcessKey()
#define FW_EDIT_DELETE_MENU
WB_FONT WBCopyFont(Display *pDisplay, WB_FONTC pOldFont)
make a copy of an existing font (best when assigning to a window)
void(* mouse_cancel)(WBChildFrame *)
'mouse cancel' notification (cancel 'drag', etc.).
Window wID
window identifier for the 'Child Frame' window. may contain 'None' while being destroyed
Definition file for font helper functions and structures.
static __inline__ WBFrameWindow * FWGetFrameWindowStruct(Window wID)
Obtain the associated WBFrameWindow structure pointer for a frame window's Window ID.
#define FW_EDIT_SELECT_NONE_MENU
1st parameter (bar) - The vertical scroll bar for the control or window.
2nd parameter (direction) - 'knob track' - pos in data.l[2]
WB_FONTC FWGetFont(WBFrameWindow *pFW)
Get the frame window WB_FONTC.
int WBPostPriorityEvent(Window wID, XEvent *pEvent)
Places a copy of the specified event at the end of the priority (internal) event queue.
void(* toggle_ins_mode)(WBChildFrame *)
toggles insert mode on or off
int WBTextObjectCalculateLineHeight(int iAscent, int iDescent)
Calculate the correct per-line height (in pixels) for a specified font ascent and descent.
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
void FWChildFrameStatusChanged(WBChildFrame *pChildFrame)
Notify Child Frame to update status text in Frame Window.
void(* tab)(WBChildFrame *, int iACS)
'tab' char, or tab navigation.
void(* delete_sel)(WBChildFrame *)
delete selection only
void FWSetChildFrameMenu(WBChildFrame *pChildFrame, const char *szFocusMenu)
Function to assign the menu resource to a Child Frame.
uintptr_t lMenuID
menu ID (< 0x10000L) or const pointer to string
void(* bkspace)(WBChildFrame *, int iACS)
'backspace' delete character (backspace equivalent), or perform related 'backspace' operation via ctr...
WB_GEOM geomEntire
client-area geometry (excludes scroll bars)
int WBSetForeground(WBGC hGC, unsigned long foreground)
Assign foreground color, a wrapper for XSetForeground()
Atom aWB_POINTER
pointer click/double-click/drag notifications generated by API
XColor FWGetDefaultFG(void)
Get the default foreground color.
void(* pgup)(WBChildFrame *, int iACS)
'page up' navigation.
void FWChildFrameRecalcLayout(WBChildFrame *pChildFrame)
Child frame notification callback (called by frame window)
void(* properties)(WBChildFrame *)
display the property sheet for the displayed document (optional)
1st parameter (bar) - The horizontal scroll bar for the control or window
XColor FWGetDefaultBD(void)
Get the default border color.
WB_SCROLLINFO scroll
'scroll info' (horizontal and vertical min/max/pos and other details)
Child Frame API functions.
void(* del)(WBChildFrame *, int iACS)
'delete' char under cursor (delete equivalent), or perform related 'delete' operation via ctrl/alt/sh...
static __inline__ WBChildFrame * FWGetChildFrameStruct(Window wID)
Obtain the associated WBChildFrame structure pointer for a Window ID.
void(* copy_to_cb)(WBChildFrame *)
copy selection to clipboard
WB_POINT origin
viewport 'origin' in 'client units' (such as chars and lines) - determines scroll behavior
WB_EXTENT extent
viewport 'extent' in 'client units' (such as chars and lines) - determines scroll behavior
2nd parameter (direction) - bottom, end
void(* select_none)(WBChildFrame *)
select none
void * WBAlloc(int nSize)
High performance memory sub-allocator 'allocate'.
int FWAddContainedWindow(WBFrameWindow *pFW, WBChildFrame *pNew)
Adds a 'contained' window and returns the tab order index.
#define WB_POINTER_SCROLLUP
WB_POINTER 'scroll up' event, caused by mouse button 4.
int FWGetNumContWindows(const WBFrameWindow *pFW)
Returns the total number of 'contained' windows.
int iClientX
The current X position of the frame window's client area (relative to the window)
2nd parameter (direction) - relative scroll - rel pos in data.l[2]
void(* downarrow)(WBChildFrame *, int iACS)
'down' arrow navigation.
int(* can_undo)(WBChildFrame *)
returns non-zero value if 'can undo'
char * szStatusText
Status text ('WBAlloc'd) to display when this child frame window has the input focus....
Window WBGetMenuWindow(Window wID)
Returns the Window ID of the (first) menu window assigned to a (frame) window.
#define WB_ERROR_PRINT(...)
Preferred method of implementing an 'error level' debug message for all subsystems.
void FWSetChildFrameMenuHandlers(WBChildFrame *pChildFrame, const WBFWMenuHandler *pHandlerArray)
Function to assign menu handlers to a Child Frame.
int iRowHeight
cached 'row height' (height of line including interline spacing)
void(* scroll_vert)(WBChildFrame *, int iMode, int iValue)
'scroll vertical' notification.
void(* mouse_drop)(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
'mouse drop' (drag end) notification.
void WBFree(void *pBuf)
High performance memory sub-allocator 'free'.
static __inline__ void WBInvalidateRect(Window wID, const WB_RECT *pRCT, int bPaintFlag)
'Paint' helper, invalidates a WB_RECT for asynchronous Expose event generation
void WBDestroyWindow(Window wID)
Destroy a window.
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...
#define WB_KEYEVENT_SHIFT
'AltCtrlShift' bit flag for Shift modifier for WBKeyEventProcessKey()
int(* UIcallback)(WBMenu *, WBMenuItem *)
menu 'UI' callback to handle displaying menu states.
int y
the 'y' value of the point. can be negative.
void FWSetChildFrameDisplayName(WBChildFrame *pChildFrame, const char *szDisplayName)
Assign the display name.
WB_GEOM geom
total client-area geometry (excludes scroll bars) in 'pixels'
#define CHILD_FRAME_TAG
TAG for the WBChildFrame structure.
#define FW_EDIT_PROPERTIES_MENU
#define WB_MOUSE_INPUT_MASK
'Mouse' input mask, bit flag for window creation
void FWSetChildFrameScrollInfo(WBChildFrame *pChildFrame, int iRow, int iMaxRow, int iCol, int iMaxCol, int iRowHeight, int iColWidth)
Set the X,Y extent for the child frame (notifies everything)
#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.
void FWDestroyChildFrame(WBChildFrame *pChildFrame)
Destroy an Child Frame.
2nd parameter (direction) - absolute scroll - pos in data.l[2]
Window WBCreateWindow(Display *pDisplay, Window wIDParent, WBWinEvent pProc, const char *szClass, int iX, int iY, int iWidth, int iHeight, int iBorder, int iIO, WB_UINT64 iFlags, XSetWindowAttributes *pXSWA)
Create a window.
Atom aCLIPBOARD
CLIPBOARD Atom for the clipboard.
int iClientHeight
The current height of the frame window's client area.
void(* destructor)(struct tagWBChildFrame *)
pointer to a 'superclass' destructor. If not NULL, will be called by FWDestroyChildFrame()
void(* select_all)(WBChildFrame *)
select all
int WBSetHScrollRange(WB_SCROLLINFO *pSI, int iMin, int iMax)
Set the scroll range for a horizontal scrollbar in the WB_SCROLLINFO structure.
2nd parameter (direction) - double-clicked item (no selection change info) (sent to list control's ow...
#define WB_STANDARD_INPUT_MASK
'Standard' input mask, bit flag for window creation
void WBDebugDumpEvent(XEvent *pEvent)
dumps the contents of an XEvent
void WBUnregisterWindowCallback(Window wID)
un-register the window's callback function (implies resource destruction)
#define WB_KEYEVENT_ACSMASK
'AltCtrlShift' bit mask for Alt+Ctrl+Shift bits for WBKeyEventProcessKey()
unsigned int ulTag
tag indicating I'm a 'Child Frame' window
int(* has_selection)(WBChildFrame *)
returns non-zero value if there is a selection
int iClientWidth
The current width of the frame window's client area.
int(* WBWinEvent)(Window wID, XEvent *pEvent)
event callback function type for window events
2nd parameter (direction) - home, top
int iContextMenuID
menu ID (from pszMenuResource or owning frame's menu) for context popup, -1 if none
XColor FWGetDefaultBG(void)
Get the default background color.
void(* redo)(WBChildFrame *)
perform a re-do
main controlling structure for frame windows
void(* paste_from_cb)(WBChildFrame *)
paste from clipboard
int WBFontDescent(WB_FONTC pFont0)
Get the maximum character descent from a WB_FONT.
void(* mouse_dblclick)(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
'mouse double click' notification.
int(* is_empty)(WBChildFrame *)
returns non-zero value if contents are 'empty'
Atom aQUERY_CLOSE
query if it's ok to close (and optionally destroy yourself if ok) a window
int(* callback)(XClientMessageEvent *)
menu callback (gets pointer to the 'XClientMessageEvent').
WBFrameWindow * pOwner
a pointer to the WBFrameWindow owner
WBChildFrame * FWGetContainedWindowByIndex(const WBFrameWindow *pFW, int iIndex)
Returns the Window ID for the specified 'contained' window. The index follows the tab order.
Display * WBGetWindowDisplay(Window wID)
returns the Display associated with a window
void WBSetWindowData(Window wID, int iIndex, void *pData)
assign 'data pointer' for a window and specified index value
void(* scroll_horiz)(WBChildFrame *, int iMode, int iValue)
'scroll vertical' notification.
2nd parameter (direction) - pgdn, pgright
int iColWidth
cached 'column width' (width of 1 character)
int FWChildFrameEvent(Window wID, XEvent *pEvent)
Default event handler for Child Frame window.
void(* pgdown)(WBChildFrame *, int iACS)
'page down' navigation.
void(* enter)(WBChildFrame *, int iACS)
'enter' char, or 'enter' for navigation.
#define FW_EDIT_SELECT_ALL_MENU
int FWChildFrameQueryClose(WBChildFrame *pChildFrame)
Returns if it's safe to close the child frame; prompts user as needed.
int WBFillRectangle(Display *display, Drawable d, WBGC gc, int x, int y, unsigned int width, unsigned int height)
Wrapper for XFillRectangle()
int WBSetBackground(WBGC hGC, unsigned long background)
Assign background color, a wrapper for XSetBackground()
void(* rightarrow)(WBChildFrame *, int iACS)
'right' arrow navigation.
void(* mouse_drag)(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
'mouse drag' (begin) notification.
#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...
int WBSetVScrollRange(WB_SCROLLINFO *pSI, int iMin, int iMax)
Set the scroll range for a vertical scrollbar in the WB_SCROLLINFO structure.
static __inline__ void WBInitScrollInfo(WB_SCROLLINFO *pSI)
Initialization function for a 'WB_SCROLLINFO' structure.
char * WBCopyString(const char *pSrc)
A simple utility that returns a WBAlloc() copy of a 0-byte terminated string.
void(* end)(WBChildFrame *, int iACS)
'end' arrow navigation.
#define WB_KEYBOARD_INPUT_MASK
'Keyboard' input mask, bit flag for window creation
int(* can_redo)(WBChildFrame *)
returns non-zero value if 'can redo'
void FWSetChildFrameExtent(WBChildFrame *pChildFrame, int iXExtent, int iYExtent)
Set the X,Y extent for the child frame (notifies everything)
unsigned int height
the 'height' value of the extent.
void WBEndPaint(Window wID, WBGC gc)
'Paint' helper, frees resources and marks the update region 'valid'
internal wrapper struct for GC with local cache
Structure that defines a Child Frame within a Frame Window.
Atom aRESIZE_NOTIFY
notification of window re-size via ClientMessage
Structure that defines a Child Frame's UI, mainly for a 'superclass'.
void FWSetStatusText(WBFrameWindow *pFW, const char *szText)
Sets the 'status' text for a Frame Window with a status bar, forcing a re-paint.
2nd parameter (direction) - down, right
#define FW_EDIT_PASTE_MENU
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.
void(* uparrow)(WBChildFrame *, int iACS)
'up' arrow navigation.
Atom aImageAtom
'image' atom for display in tabs. default is 'None'. You should not alter this member directly.
char * szDisplayName
display name shown in tab and title bar. You should not alter this member directly.
#define WB_WARN_PRINT(...)
Preferred method of implementing a 'warning level' debug message for all subsystems.
struct tagWBChildFrameUI * pUI
pointer to 'WBChildFrameUI' function pointer table (assigned by 'superclass')
void(* cut_to_cb)(WBChildFrame *)
delete selection, copying to clipboard first
char * pszMenuResource
resource string for this child frame's menu (NULL = 'use default')
void WBUpdateScrollBarGeometry(WB_SCROLLINFO *pSI, WB_FONTC pFont, WB_GEOM *pgeomClient, WB_GEOM *pgeomUsable)
Update the scroll bar geometry within the WB_SCROLLINFO structure.
void(* mouse_click)(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
'mouse click' notification.
WB_FONT pFont
default font for the window
void(* mouse_move)(WBChildFrame *, int iX, int iY)
'mouse motion' notification.
#define FW_EDIT_COPY_MENU
WBGC WBBeginPaintGeom(Window wID, WB_GEOM *pgBounds)
'Paint' helper, creates a WBGC for use in updating the window for a specified rectangular area
#define WB_KEYEVENT_KEYSYM
'AltCtrlShift' bit flag for 'VK_' keys for WBKeyEventProcessKey()
void FWSetChildFrameImageAtom(WBChildFrame *pChildFrame, Atom aImage)
Assign the image atom for the child frame. the image appears in the tab associated with the child fra...
WB_FONTC WBGetDefaultFont(void)
Returns a pointer to the default font WB_FONT for the default display. This is a shared resource; do ...