00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef NL_WINDOW_DISPLAYER_H
00028 #define NL_WINDOW_DISPLAYER_H
00029
00030 #include "nel/misc/types_nl.h"
00031
00032 #include "nel/misc/displayer.h"
00033 #include "nel/misc/mutex.h"
00034 #include "nel/misc/thread.h"
00035
00036 namespace NLMISC {
00037
00038
00046 class CWindowDisplayer : public NLMISC::IDisplayer
00047 {
00048 public:
00049
00050 CWindowDisplayer (const char *displayerName = "") :
00051 IDisplayer(displayerName),
00052 _Buffer("CWindowDisplayer::_Buffer"), _Labels("CWindowDisplayer::_Labels"), _CommandsToExecute("CWindowDisplayer::_CommandsToExecute"),
00053 _Continue(true), _Init(false), _ToolBarHeight(22), _InputEditHeight(25), _Thread(NULL)
00054 { }
00055
00056 virtual ~CWindowDisplayer ();
00057
00058
00059 void create (std::string titleBar = "", bool iconified = false, sint x = -1, sint y = -1, sint w = -1, sint h = -1, sint hs = -1, sint fs = 0, const std::string &fn = "", bool ww = false);
00060
00061
00062 uint createLabel (const char *value = "?");
00063
00064
00065 void setLabel (uint label, const std::string &value);
00066
00067
00068 bool update ();
00069
00070
00071 virtual void setTitleBar (const std::string &titleBar) { }
00072
00073 virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x=y=w=h=0; }
00074
00075 protected:
00076
00077
00078 virtual void doDisplay (const NLMISC::TDisplayInfo &args, const char *message);
00079
00080
00081 bool needSlashR;
00082
00083 struct CLabelEntry
00084 {
00085 CLabelEntry (const std::string &value) : Hwnd(NULL), Value(value), NeedUpdate(true) { }
00086 void *Hwnd;
00087 std::string Value;
00088 bool NeedUpdate;
00089 };
00090
00091
00092
00093 CSynchronized<std::vector<std::pair<uint32, std::string> > > _Buffer;
00094 CSynchronized<std::vector<CLabelEntry> > _Labels;
00095 CSynchronized<std::vector<std::string> > _CommandsToExecute;
00096
00097
00098 virtual void open (std::string windowNameEx, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww) = 0;
00099
00100 virtual void display_main () = 0;
00101
00102
00103
00104 bool _Continue;
00105
00106 std::vector<std::string> _History;
00107 uint _PosInHistory;
00108 bool _Init;
00109 sint _HistorySize;
00110 sint _ToolBarHeight;
00111 sint _InputEditHeight;
00112
00113
00114 NLMISC::IThread *_Thread;
00115
00116 friend class CUpdateThread;
00117 };
00118
00119 }
00120
00121 #endif // NL_WINDOW_DISPLAYER_H
00122
00123