dtinfo subtree dtinfo
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / Managers / MessageMgr.hh
1 /*
2  * $XConsortium: MessageMgr.hh /main/7 1996/11/23 14:04:55 cde-hal $
3  *
4  * Copyright (c) 1991 HaL Computer Systems, Inc.  All rights reserved.
5  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
6  * States.  Use of a copyright notice is precautionary only and does not
7  * imply publication or disclosure.
8  * 
9  * This software contains confidential information and trade secrets of HaL
10  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
11  * without the prior express written permission of HaL Computer Systems, Inc.
12  * 
13  *                         RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the Government is subject to
15  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
16  * Technical Data and Computer Software clause at DFARS 252.227-7013.
17  *                        HaL Computer Systems, Inc.
18  *                  1315 Dell Avenue, Campbell, CA  95008
19  * 
20  */
21
22 # include "UAS.hh"
23 #include <X11/Intrinsic.h>
24
25 class MessageAgent;
26 class PrefAgent;
27 class demoException ;
28
29 struct CancelOperation {
30     int fDummy;
31 };
32
33 class MessageMgr : public Long_Lived, public UAS_Receiver<CancelOperation>
34 {
35 public: // functions
36   // Initializing
37   MessageMgr();
38   ~MessageMgr();
39
40   // Message display
41   // NOTE: need way to get answer back in some cases!!
42   
43   Widget create_dialog(unsigned char dialog_type,
44                        char *message_text, Widget parent = NULL);
45   void quit_dialog    (char *message_text, Widget parent = NULL);
46   void error_dialog   (char *message_text, Widget parent = NULL);
47   void warning_dialog (char *message_text, Widget parent = NULL);
48   void info_dialog    (char *message_text, Widget parent = NULL);
49   void progress_dialog (char *message_text, Widget parent = NULL);
50   void progress_dialog_done ();
51   bool question_dialog (char *message_text, Widget parent = NULL);
52   void assert_failed (char *statement, char *file,
53                       int line, Widget parent = NULL);
54   int get_integer (const char* msg, const char* title,
55                    int default_value, Widget parent = NULL);
56   const char *get_string (const char* msg, const char* title,
57                           const char *default_value, Widget parent = NULL);
58   void receive (CancelOperation &, void *client_data);
59
60   STATIC_SENDER_HH(UAS_CancelRetrievalMsg);
61   
62   void demo_failure(demoException &, Widget parent = NULL);
63
64   void set_max_length(int, Widget parent = NULL);
65
66   void ok_cb();
67   void cancel_cb();
68
69   // Accessing
70
71 private: // functions
72
73   void show_it(Widget dialog);
74   void destroy_it(Widget dialog);
75   
76 private: // variables
77   MessageAgent          &f_booklist_message;
78   MessageAgent          &f_nodeview_message;
79
80   int                   f_booklist_process;
81   int                   f_nodeview_process;
82
83   bool                  f_popped_up;
84   bool                  f_pressed_ok;
85   bool                  f_exit_flag;
86   bool                  f_dialog_active;
87
88 private:
89   LONG_LIVED_HH(MessageMgr,message_mgr);
90 };
91
92 LONG_LIVED_HH2(MessageMgr,message_mgr);
93
94
95
96 #ifdef __STDC__
97 #define Xassert(STMT) \
98 if (!(STMT)) { \
99   message_mgr().assert_failed ((char*)#STMT, (char*)__FILE__, __LINE__); \
100   return; \
101 };
102 #else
103 #define Xassert(STMT) \
104 if (!(STMT)) { \
105   message_mgr().assert_failed ("STMT", __FILE__, __LINE__); \
106   return; \
107 };
108 #endif