00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef _MSC_VER
00025 #include <windows_config.h>
00026 #else
00027 #include <config.h>
00028 #endif
00029
00030 #include <cassert>
00031 #include "GUIMessageWindow.h"
00032
00033 #ifdef CHECK_MEMORY_LEAKS
00034 #include <foreign/nvwa/debug_new.h>
00035 #endif // CHECK_MEMORY_LEAKS
00036
00037
00038
00039
00040
00041 GUIMessageWindow::GUIMessageWindow(FXComposite *parent) throw()
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
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
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
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
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 }
00086
00087
00088 GUIMessageWindow::~GUIMessageWindow() throw() {
00089 delete[] myStyles;
00090 }
00091
00092
00093 void
00094 GUIMessageWindow::appendText(GUIEventType eType, const std::string &msg) throw() {
00095 if (!isEnabled()) {
00096 show();
00097 }
00098
00099 FXint style = 1;
00100 switch (eType) {
00101 case EVENT_ERROR_OCCURED:
00102
00103 style = 2;
00104 break;
00105 case EVENT_WARNING_OCCURED:
00106
00107 style = 3;
00108 break;
00109 case EVENT_MESSAGE_OCCURED:
00110
00111 style = 1;
00112 break;
00113 default:
00114 assert(false);
00115 }
00116
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 }
00125
00126
00127 void
00128 GUIMessageWindow::addSeparator() throw() {
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 }
00138
00139
00140 void
00141 GUIMessageWindow::clear() throw() {
00142 if (getLength()==0) {
00143 return;
00144 }
00145 FXText::removeText(0, getLength()-1, true);
00146 if (isEnabled()) {
00147 layout();
00148 update();
00149 }
00150 }
00151
00152
00153
00154
00155