X11workbench Toolkit  1.0
child_frame.h
Go to the documentation of this file.
1 // //
3 // _ _ _ _ __ _ //
4 // ___| |__ (_) | __| | / _|_ __ __ _ _ __ ___ ___ | |__ //
5 // / __| '_ \| | |/ _` | | |_| '__/ _` | '_ ` _ \ / _ \ | '_ \ //
6 // | (__| | | | | | (_| | | _| | | (_| | | | | | | __/_| | | | //
7 // \___|_| |_|_|_|\__,_|___|_| |_| \__,_|_| |_| |_|\___(_)_| |_| //
8 // |_____| //
9 // //
10 // a window that exists as a tab in a frame window //
11 // //
12 // (part of the 'frame window' support API) //
13 // //
15 
16 /*****************************************************************************
17 
18  X11workbench - X11 programmer's 'work bench' application and toolkit
19  Copyright (c) 2010-2019 by Bob Frazier (aka 'Big Bad Bombastic Bob')
20 
21 
22  DISCLAIMER: The X11workbench application and toolkit software are supplied
23  'as-is', with no warranties, either implied or explicit.
24  Any claims to alleged functionality or features should be
25  considered 'preliminary', and might not function as advertised.
26 
27  MIT-like license:
28 
29  There is no restriction as to what you can do with this software, so long
30  as you include the above copyright notice and DISCLAIMER for any distributed
31  work that is equal to or derived from this one, along with this paragraph
32  that explains the terms of the license if the source is also being made
33  available. A "derived work" describes a work that uses a significant portion
34  of the source files or algorithms that are included with this one.
35  Specifically excluded from this are files that were generated by the software,
36  or anything that is included with the software that is part of another package
37  (such as files that were created or added during the 'configure' process).
38  Specifically included is the use of part or all of any of the X11 workbench
39  toolkit source or header files in your distributed application. If you do not
40  ship the source, the above copyright statement is still required to be placed
41  in a reasonably prominent place, such as documentation, splash screens, and/or
42  'about the application' dialog boxes.
43 
44  Use and distribution are in accordance with GPL, LGPL, and/or the above
45  MIT-like license. See COPYING and README files for more information.
46 
47 
48  Additional information at http://sourceforge.net/projects/X11workbench
49 
50 ******************************************************************************/
51 
52 
53 #ifndef _CHILD_FRAME_H_INCLUDED_
54 #define _CHILD_FRAME_H_INCLUDED_
55 
56 #include "text_object.h"
57 #include "frame_window.h"
58 
59 
84 #ifdef __cplusplus
85 extern "C" {
86 #endif // __cplusplus
87 
88 
89 // SEE frame_window.h for WBChildFrame definition
90 
94 #define CHILD_FRAME_TAG (*((const unsigned int * const)"FWCF"))
95 
99 #define CHILD_FRAME_UI_TAG ((WB_UINT32)'F' | ((WB_UINT32)'W' << 8) | ((WB_UINT32)'C' << 16) | ((WB_UINT32)'U' << 24)) /* FWCU */
100 
105 #define FW_FILE_NEW_MENU "IDM_FILE_NEW"
106 #define FW_FILE_CLOSE_MENU "IDM_FILE_CLOSE"
107 #define FW_FILE_OPEN_MENU "IDM_FILE_OPEN"
108 #define FW_FILE_SAVE_MENU "IDM_FILE_SAVE"
109 #define FW_FILE_SAVE_AS_MENU "IDM_FILE_SAVE_AS"
110 #define FW_FILE_SAVE_ALL_MENU "IDM_FILE_SAVE_ALL"
112 #define FW_EDIT_CUT_MENU "IDM_EDIT_CUT"
113 #define FW_EDIT_COPY_MENU "IDM_EDIT_COPY"
114 #define FW_EDIT_PASTE_MENU "IDM_EDIT_PASTE"
115 #define FW_EDIT_DELETE_MENU "IDM_EDIT_DELETE"
116 #define FW_EDIT_SELECT_ALL_MENU "IDM_EDIT_SELECT_ALL"
117 #define FW_EDIT_SELECT_NONE_MENU "IDM_EDIT_SELECT_NONE"
118 #define FW_EDIT_UNDO_MENU "IDM_EDIT_UNDO"
119 #define FW_EDIT_REDO_MENU "IDM_EDIT_REDO"
120 #define FW_EDIT_PROPERTIES_MENU "IDM_EDIT_PROPERTIES"
122 #define FW_FILE_NEW_ACCEL "Ctrl+N"
123 #define FW_FILE_CLOSE_ACCEL "Ctrl+F4"
124 #define FW_FILE_OPEN_ACCEL "Ctrl+O"
125 #define FW_FILE_SAVE_ACCEL "Ctrl+S"
126 #define FW_FILE_SAVE_AS_ACCEL "Ctrl+Shift+S"
127 #define FW_FILE_SAVE_ALL_ACCEL "Ctrl+Shift+L"
129 #define FW_EDIT_CUT_ACCEL "Ctrl+X"
130 #define FW_EDIT_COPY_ACCEL "Ctrl+C"
131 #define FW_EDIT_PASTE_ACCEL "Ctrl+V"
132 #define FW_EDIT_SELECT_ALL_ACCEL "Ctrl+A"
133 #define FW_EDIT_SELECT_NONE_ACCEL "Ctrl+Shift+A"
134 #define FW_EDIT_UNDO_ACCEL "Ctrl+Z"
135 #define FW_EDIT_REDO_ACCEL "Ctrl+Shift+Z"
136 #define FW_EDIT_PROPERTIES_ACCEL "Alt+Enter"
175 int FWInitChildFrame(WBChildFrame *pChildFrame, WBFrameWindow *pOwner, WB_FONTC pFont,
176  const char *szFocusMenu, const WBFWMenuHandler *pHandlerArray,
177  WBWinEvent pUserCallback, int fFlags);
178 
189 void FWDestroyChildFrame(WBChildFrame *pChildFrame);
190 
202 void FWSetChildFrameMenu(WBChildFrame *pChildFrame, const char *szFocusMenu);
203 
218 void FWSetChildFrameContextMenuID(WBChildFrame *pChildFrame, int nID);
219 
231 void FWSetChildFrameMenuHandlers(WBChildFrame *pChildFrame, const WBFWMenuHandler *pHandlerArray);
232 
244 void FWSetChildFrameDisplayName(WBChildFrame *pChildFrame, const char *szDisplayName);
245 
259 void FWSetChildFrameImageAtom(WBChildFrame *pChildFrame, Atom aImage);
260 
277 void FWSetChildFrameExtent(WBChildFrame *pChildFrame, int iXExtent, int iYExtent);
278 
279 
297 void FWSetChildFrameScrollInfo(WBChildFrame *pChildFrame, int iRow, int iMaxRow, int iCol, int iMaxCol,
298  int iRowHeight, int iColWidth);
299 
300 
316 void FWChildFrameRecalcLayout(WBChildFrame *pChildFrame);
317 
318 
332 void FWChildFrameStatusChanged(WBChildFrame *pChildFrame);
333 
349 int FWChildFrameQueryClose(WBChildFrame *pChildFrame);
350 
351 
363 int FWChildFrameEvent(Window wID, XEvent *pEvent);
364 
365 
376 static __inline__ WBChildFrame *FWGetChildFrameStruct(Window wID)
377 {
378  WBChildFrame *pRval = (WBChildFrame *)WBGetWindowData(wID, 0); // offset 0 for window-specific structs
379  if(pRval && pRval->ulTag == CHILD_FRAME_TAG)
380  {
381  return(pRval);
382  }
383 
384  return(NULL);
385 }
386 
387 
388 
389 #ifdef __cplusplus
390 };
391 #endif // __cplusplus
392 
393 #endif // _CHILD_FRAME_H_INCLUDED_
394 
void * WBGetWindowData(Window wID, int iIndex)
Gets the data associated with this window and the specified index.
void FWSetChildFrameContextMenuID(WBChildFrame *pChildFrame, int nID)
Function to assign the context menu ID (from the menu resource) to a Child Frame.
Definition: child_frame.c:503
structure for managing menu callbacks
Definition: frame_window.h:217
void FWChildFrameStatusChanged(WBChildFrame *pChildFrame)
Notify Child Frame to update status text in Frame Window.
Definition: child_frame.c:897
void FWSetChildFrameMenu(WBChildFrame *pChildFrame, const char *szFocusMenu)
Function to assign the menu resource to a Child Frame.
Definition: child_frame.c:478
void FWChildFrameRecalcLayout(WBChildFrame *pChildFrame)
Child frame notification callback (called by frame window)
Definition: child_frame.c:845
static __inline__ WBChildFrame * FWGetChildFrameStruct(Window wID)
Obtain the associated WBChildFrame structure pointer for a Window ID.
Definition: child_frame.h:376
void FWSetChildFrameMenuHandlers(WBChildFrame *pChildFrame, const WBFWMenuHandler *pHandlerArray)
Function to assign menu handlers to a Child Frame.
Definition: child_frame.c:515
void FWSetChildFrameDisplayName(WBChildFrame *pChildFrame, const char *szDisplayName)
Assign the display name.
Definition: child_frame.c:571
#define CHILD_FRAME_TAG
TAG for the WBChildFrame structure.
Definition: child_frame.h:94
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)
Definition: child_frame.c:804
void FWDestroyChildFrame(WBChildFrame *pChildFrame)
Destroy an Child Frame.
Definition: child_frame.c:329
A 'C++'-like object for managing text, that can be overridden for custom behavior.
unsigned int ulTag
tag indicating I'm a 'Child Frame' window
Definition: frame_window.h:428
int(* WBWinEvent)(Window wID, XEvent *pEvent)
event callback function type for window events
int FWChildFrameEvent(Window wID, XEvent *pEvent)
Default event handler for Child Frame window.
Definition: child_frame.c:947
int FWChildFrameQueryClose(WBChildFrame *pChildFrame)
Returns if it's safe to close the child frame; prompts user as needed.
Definition: child_frame.c:913
void FWSetChildFrameExtent(WBChildFrame *pChildFrame, int iXExtent, int iYExtent)
Set the X,Y extent for the child frame (notifies everything)
Definition: child_frame.c:645
Structure that defines a Child Frame within a Frame Window.
Definition: frame_window.h:426
Frame Window API functions and definitions.
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...
Definition: child_frame.c:593