UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
InfoLine.H
1 /* InfoLine.H */
2 /* $Revision: 1.6 $ InfoLine.H $Date: 2000/05/12 12:55:32 $ */
3 #ifndef __InfoLine_H
4 #define __InfoLine_H
5 
6 #include <X11/Intrinsic.h>
7 
8 
9 /* Colors used to attract user's attention */
10 #define DEBUG_FG "grey74"
11 #define HINT_FG "SeaGreen4"
12 #define INFO_FG "black"
13 #define WARNING_FG "red"
14 #define ERROR_FG "white"
15 #define ERROR_BG "red"
16 #define FATAL_FG "yellow"
17 #define FATAL_BG "red"
18 
19 
20 #define STORED_HISTORY_MSGS 200
21 
22 
23 /*************************************************************
24  * One history item.
25  *************************************************************/
26 struct HistItem
27 {
28  int msg_level; /* usual EL_* from <mix/wenv.h> */
29  void* msg; /* XmString message */
30 };
31 
32 
33 #define AnyType HistItem
34 #define AnyAr HistItemAr
35 #include <mix/AnyAr.H>
36 
37 
38 /*************************************************************
39  * Structure of GUI for multilined object with history.
40  *************************************************************/
42 {
43  int lines_n; /* count of widgets in wLines */
44  Widget *wLines; /* lines of history */
45 };
46 
47 
48 /*************************************************************
49  * Class for information/status line.
50  *************************************************************/
51 class InfoLine
52 {
53 protected:
54 
55  /* Widgets used as information pane -- XmLabel or XmTextField */
56  Widget *wInfoLines;
57 
58  /* What widgets are used? */
59  enum {
60  xmLabels,
61  xmTextFields
62  } w_class;
63 
64  /* Count of widgets in wInfoLines */
65  int lines_n;
66 
67  /* Saved history lines */
68  HistItemAr hiar;
69 
70  /* History index of the wInfoLines[0] line */
71  int hist_index;
72 
73  /* Max number of stored history messages */
74  int hist_limit;
75 
76  /* Get colors of fg,bg by e_level */
77  void GetColors (int e_level, Pixel& fg, Pixel& bg);
78 
79  /* Show history lines from hist_index */
80  void ShowLines ();
81 
82 public:
83 
84  InfoLine (Widget w, int stored_msgs = STORED_HISTORY_MSGS); /* lines_n=1 */
85  InfoLine (InfoMultiLine& iml, int stored_msgs = STORED_HISTORY_MSGS);
86  virtual ~InfoLine ();
87 
88  /*************************************************************
89  * Info line utilities.
90  *************************************************************/
91  void Clear ();
92  void Message (char* szMessageString);
93  void Warning (char* szWarningString);
94  void Error (char* szErrorString);
95 
96  void CommonMsg (int elevel, const char* szString);
97 
98  /* Returns widget of info line */
99  operator Widget ()
100  {return wInfoLines[0];}
101 
102  /* Scroll history to oldest messages */
103  void PrevMsg ();
104 
105  /* Scroll history to newest messages */
106  void NextMsg ();
107 
108 };
109 
110 
111 #endif /* InfoLine.H */
Definition: InfoLine.H:41
Definition: InfoLine.H:51
Definition: InfoLine.H:26