UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QfCastle.H
1 /* QfCastle.H */
2 /* $Id: QfCastle.H,v 1.7 2004/01/23 11:54:33 vlad Exp $ */
3 #ifndef __QfCastle_H
4 #define __QfCastle_H
5 
6 #include <zm/QfTower.H>
7 
8 
9 /***********************************************************************
10  * Container of vertically constrained objects with rich decoration
11  * features.
12  */
13 class QfCastle: public QfTower
14 {
15 public:
16 
17  /* Create general container that is main master. Phases 1-3 take
18  place here. */
19  QfCastle (Widget wParent,
20  QfDecoration eDecor = QfDECOR_NONE,
21  char* szResName = QfDIALOG_NAME);
22 
23  virtual ~QfCastle ();
24 
25  /*
26  * Decoration.
27  */
28 
29  /* Window title. */
30  void set_title (const char* szTitle);
31 
32  /* Set help section reference. */
33  void set_help_section (const char* szSectionRef);
34 
35  /* Set help document pointer. */
36  void set_help_doc (const char* szURL);
37 
38  /*
39  * Actions functionality.
40  */
41 
42  /* Add action buttons. */
43  virtual void add_actions (QfActionsMask amask,
44  QfDecoration eDecor = QfDECOR_NONE);
45 
46  /* Get flag of running. */
47  Logic is_running () const;
48 
49  /* Get reverted flag of running. */
50  Logic is_stopped () const;
51 
52 
53  /*
54  * Open/close/check dialog window.
55  */
56 
57  /* Reliable check for dialog existance. */
58  Logic is_dialog_alive ();
59 
60  /* Display modeless dialog. */
61  virtual void manage (QfWindowPlacement wpl = QfWINPLACE_DEFAULT);
62 
63  /* Display modal dialog. */
64  virtual void manage_modal (QfWindowPlacement wpl = QfWINPLACE_DEFAULT);
65 
66  /* Operation of closing dialog (not to destruct, but only to hide). */
67  virtual void close_dialog ();
68 
69  /*
70  * Event processing control.
71  */
72 
73  /* Full time Xt event processing until user window_close action.
74  See close_reason_button(). */
75  virtual void loop_events ();
76 
77  /* Partial time Xt event processing (up to N events for one call).
78  See close_reason_button(). */
79  virtual void process_events (int n = QfEVENTS_QUANT);
80 
81  /* Returns id of the standard button that cause exit of the dialog. */
82  virtual QfActionButtonId close_reason_button () const;
83 
84 
85  /*
86  * These methods are called on corresponding button press.
87  * Make expected things by default.
88  */
89 
90  /* "OK" button pressed. Store GUI values and close dialog. */
91  virtual void ok_button ();
92 
93  /* "Apply" button pressed. Store GUI values. */
94  virtual void apply_button ();
95 
96  /* "Close" button pressed. Synonymous to "Cancel" button. */
97  virtual void close_button ();
98 
99  /* "Cancel" button pressed. Close dialog. */
100  virtual void cancel_button ();
101 
102  /* "Undo" button pressed. Load values in GUI items. */
103  virtual void undo_button ();
104 
105  /* "Help" button pressed. Call for document by vsStartViewer(). */
106  virtual void help_button ();
107 
108  /* "Run" button pressed. Store GUI values, make all elements
109  unsensitive except "Stop", "Help", "Cancel" and run pRunProc. */
110  virtual void run_button ();
111 
112  /* "Stop" button pressed. Restore GUI values, make sensitive all
113  elements and call pStopProc. */
114  virtual void stop_button ();
115 
116 protected:
117 
118  Widget wTower; /* QfTower main widget. */
119  Widget wTempForm; /* Intermediate container XmForm reference. */
120  Widget wShell; /* =wSelf, XmDialogShell widget reference. */
121 
122  /* Section reference for context help */
123  char *szHelpRef;
124 
125  /* TRUE if dialog is popped up and FALSE otherwise. */
126  Logic bActivity;
127 
128  /* TRUE if user pressed "Run" and not pressed "Stop" or "Cancel". */
129  Logic bRunning;
130 
131  /* Array of pointers at buttons objects */
132  QfBrick *pButtons[QfA_ButtonsNumber];
133 
134  /* Id of the button that cause exit from loop_event() */
135  QfActionButtonId eButton;
136 
137  /* Empty due to QfCastle is always main master. */
138  virtual void create_self (Widget wParent);
139 
140  /* Callback on destroy. */
141  static void wm_delete_cb (Widget w, XtPointer pUserData,
142  XtPointer pCallData);
143 
144  /* Button action procs. */
145  static void ok_action_proc (void* pUserData);
146  static void apply_action_proc (void* pUserData);
147  static void close_action_proc (void* pUserData);
148  static void cancel_action_proc (void* pUserData);
149  static void help_action_proc (void* pUserData);
150  static void undo_action_proc (void* pUserData);
151  static void run_action_proc (void* pUserData);
152  static void stop_action_proc (void* pUserData);
153 
154  /* Common manage procedure */
155  void manage_with_style (int dialog_style);
156 
157  /* Window placement procedure relative to parent window */
158  void place_window (QfWindowPlacement wpl);
159 
160 };
161 
162 
163 #endif /* QfCastle.H */
virtual void manage()
Definition: QfBrick.H:54
virtual void create_self(Widget wParent)
Definition: QfCastle.H:13
Definition: QfTower.H:13