#include <GUIMessageWindow.h>

This class displays messages incoming to the gui from either the load or the run thread.
The text is colored in dependence to its type (messages: green, warnings: yellow, errors: red)
Each time a new message is passed, the window is reopened.
Definition at line 52 of file GUIMessageWindow.h.
Public Member Functions | |
| void | addSeparator () throw () |
| Adds a a separator to this log window. | |
| void | appendText (GUIEventType eType, const std::string &msg) throw () |
| Adds new text to the window. | |
| void | clear () throw () |
| Clears the window. | |
| GUIMessageWindow (FXComposite *parent) throw () | |
| Constructor. | |
| ~GUIMessageWindow () throw () | |
| Destructor. | |
Private Attributes | |
| FXHiliteStyle * | myStyles |
| The text colors used. | |
| GUIMessageWindow::GUIMessageWindow | ( | FXComposite * | parent | ) | throw () |
Constructor.
| [in] | parent | The parent window |
Definition at line 41 of file GUIMessageWindow.cpp.
00042 : FXText(parent, 0, 0, 0, 0, 0, 0, 50), 00043 myStyles(0) { 00044 setStyled(true); 00045 setEditable(false); 00046 myStyles = new FXHiliteStyle[4]; 00047 // set separator style 00048 myStyles[0].normalForeColor = FXRGB(0x00, 0x00, 0x88); 00049 myStyles[0].normalBackColor = FXRGB(0xff, 0xff, 0xff); 00050 myStyles[0].selectForeColor = FXRGB(0xff, 0xff, 0xff); 00051 myStyles[0].selectBackColor = FXRGB(0x00, 0x00, 0x88); 00052 myStyles[0].hiliteForeColor = FXRGB(0x00, 0x00, 0x88); 00053 myStyles[0].hiliteBackColor = FXRGB(0xff, 0xff, 0xff); 00054 myStyles[0].activeBackColor = FXRGB(0xff, 0xff, 0xff); 00055 myStyles[0].style = 0; 00056 // set message text style 00057 myStyles[1].normalForeColor = FXRGB(0x00, 0x88, 0x00); 00058 myStyles[1].normalBackColor = FXRGB(0xff, 0xff, 0xff); 00059 myStyles[1].selectForeColor = FXRGB(0xff, 0xff, 0xff); 00060 myStyles[1].selectBackColor = FXRGB(0x00, 0x88, 0x00); 00061 myStyles[1].hiliteForeColor = FXRGB(0x00, 0x88, 0x00); 00062 myStyles[1].hiliteBackColor = FXRGB(0xff, 0xff, 0xff); 00063 myStyles[1].activeBackColor = FXRGB(0xff, 0xff, 0xff); 00064 myStyles[1].style = 0; 00065 // set error text style 00066 myStyles[2].normalForeColor = FXRGB(0x88, 0x00, 0x00); 00067 myStyles[2].normalBackColor = FXRGB(0xff, 0xff, 0xff); 00068 myStyles[2].selectForeColor = FXRGB(0xff, 0xff, 0xff); 00069 myStyles[2].selectBackColor = FXRGB(0x88, 0x00, 0x00); 00070 myStyles[2].hiliteForeColor = FXRGB(0x88, 0x00, 0x00); 00071 myStyles[2].hiliteBackColor = FXRGB(0xff, 0xff, 0xff); 00072 myStyles[2].activeBackColor = FXRGB(0xff, 0xff, 0xff); 00073 myStyles[2].style = 0; 00074 // set warning text style 00075 myStyles[3].normalForeColor = FXRGB(0xe6, 0x98, 0x00); 00076 myStyles[3].normalBackColor = FXRGB(0xff, 0xff, 0xff); 00077 myStyles[3].selectForeColor = FXRGB(0xff, 0xff, 0xff); 00078 myStyles[3].selectBackColor = FXRGB(0xe6, 0x98, 0x00); 00079 myStyles[3].hiliteForeColor = FXRGB(0xe6, 0x98, 0x00); 00080 myStyles[3].hiliteBackColor = FXRGB(0xff, 0xff, 0xff); 00081 myStyles[3].activeBackColor = FXRGB(0xff, 0xff, 0xff); 00082 myStyles[3].style = 0; 00083 // 00084 setHiliteStyles(myStyles); 00085 }
| GUIMessageWindow::~GUIMessageWindow | ( | ) | throw () |
Destructor.
Definition at line 88 of file GUIMessageWindow.cpp.
References myStyles.
00088 { 00089 delete[] myStyles; 00090 }
| void GUIMessageWindow::addSeparator | ( | ) | throw () |
Adds a a separator to this log window.
Definition at line 128 of file GUIMessageWindow.cpp.
Referenced by GUIApplicationWindow::closeAllWindows().
00128 { 00129 std::string msg = "----------------------------------------------------------------------------------------\n"; 00130 FXText::appendStyledText(msg.c_str(), (FXint) msg.length(), 1, true); 00131 FXText::setCursorPos(getLength()-1); 00132 FXText::setBottomLine(getLength()-1); 00133 if (isEnabled()) { 00134 layout(); 00135 update(); 00136 } 00137 }
| void GUIMessageWindow::appendText | ( | GUIEventType | eType, | |
| const std::string & | msg | |||
| ) | throw () |
Adds new text to the window.
The type of the text is determined by the first parameter
| [in] | eType | The type of the event the message was generated by |
| [in] | msg | The message |
Definition at line 94 of file GUIMessageWindow.cpp.
References EVENT_ERROR_OCCURED, EVENT_MESSAGE_OCCURED, and EVENT_WARNING_OCCURED.
Referenced by GUIApplicationWindow::handleEvent_Message().
00094 { 00095 if (!isEnabled()) { 00096 show(); 00097 } 00098 // build the styled message 00099 FXint style = 1; 00100 switch (eType) { 00101 case EVENT_ERROR_OCCURED: 00102 // color: red 00103 style = 2; 00104 break; 00105 case EVENT_WARNING_OCCURED: 00106 // color: yellow 00107 style = 3; 00108 break; 00109 case EVENT_MESSAGE_OCCURED: 00110 // color: green 00111 style = 1; 00112 break; 00113 default: 00114 assert(false); 00115 } 00116 // insert message to buffer 00117 FXText::appendStyledText(msg.c_str(), (FXint) msg.length(), style+1, true); 00118 FXText::setCursorPos(getLength()-1); 00119 FXText::setBottomLine(getLength()-1); 00120 if (isEnabled()) { 00121 layout(); 00122 update(); 00123 } 00124 }
| void GUIMessageWindow::clear | ( | ) | throw () |
Clears the window.
Definition at line 141 of file GUIMessageWindow.cpp.
Referenced by GUIApplicationWindow::onCmdClearMsgWindow().
00141 { 00142 if (getLength()==0) { 00143 return; 00144 } 00145 FXText::removeText(0, getLength()-1, true); 00146 if (isEnabled()) { 00147 layout(); 00148 update(); 00149 } 00150 }
FXHiliteStyle* GUIMessageWindow::myStyles [private] |
The text colors used.
Definition at line 86 of file GUIMessageWindow.h.
Referenced by ~GUIMessageWindow().
1.5.6