00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(__INCLUDE_GLWChannelViewh_INCLUDE__)
00022 #define __INCLUDE_GLWChannelViewh_INCLUDE__
00023
00024 #include <GLW/GLWidget.h>
00025 #include <GLW/GLWIconButton.h>
00026 #include <GLW/GLWChannelViewTextRenderer.h>
00027 #include <client/ClientChannelManagerI.h>
00028 #include <common/KeyboardKey.h>
00029 #include <common/Vector.h>
00030 #include <list>
00031
00032 class GLWChannelViewI
00033 {
00034 public:
00035 virtual ~GLWChannelViewI();
00036
00037 virtual void channelsChanged(unsigned int id) = 0;
00038 };
00039
00040 class GLWChannelView :
00041 public GLWidget,
00042 public ClientChannelManagerI,
00043 public GLWButtonI
00044 {
00045 public:
00046 class BaseChannelEntry
00047 {
00048 public:
00049 std::string channel;
00050 unsigned int type;
00051 };
00052 class CurrentChannelEntry : public BaseChannelEntry
00053 {
00054 public:
00055 Vector color;
00056 unsigned int id;
00057 };
00058
00059 GLWChannelView();
00060 virtual ~GLWChannelView();
00061
00062 bool getParentSized() { return parentSized_; }
00063 bool initFromXMLInternal(XMLNode *node);
00064
00065 unsigned int getLastWhisperSrc() { return lastWhisperSrc_; }
00066
00067 std::list<CurrentChannelEntry> &getCurrentChannels() { return currentChannels_; }
00068 std::list<BaseChannelEntry> &getAvailableChannels() { return availableChannels_; }
00069 CurrentChannelEntry *getChannel(const std::string &channelName);
00070
00071 void joinChannel(const std::string &channelName);
00072 void leaveChannel(const std::string &channelName);
00073
00074 void setHandler(GLWChannelViewI *handler) { handler_ = handler; };
00075
00076
00077 virtual void draw();
00078 virtual void simulate(float frameTime);
00079 virtual bool initFromXML(XMLNode *node);
00080 virtual void mouseDown(int button, float x, float y, bool &skipRest);
00081 virtual void mouseUp(int button, float x, float y, bool &skipRest);
00082 virtual void mouseDrag(int button, float mx, float my, float x, float y, bool &skipRest);
00083 virtual void keyDown(char *buffer, unsigned int keyState,
00084 KeyboardHistory::HistoryElement *history, int hisCount,
00085 bool &skipRest);
00086 virtual void setX(float x);
00087 virtual void setY(float y);
00088
00089
00090 virtual void channelText(ChannelText &text);
00091 virtual void registeredForChannels(
00092 std::list<ChannelDefinition> ®isteredChannels,
00093 std::list<ChannelDefinition> &availableChannels);
00094
00095
00096 virtual void buttonDown(unsigned int id);
00097
00098 REGISTER_CLASS_HEADER(GLWChannelView);
00099
00100 protected:
00101 class GLWChannelViewEntry
00102 {
00103 public:
00104 Vector color;
00105 GLWChannelViewTextRenderer text;
00106 float timeRemaining;
00107 };
00108
00109 GLWChannelViewI *handler_;
00110 GLWIconButton upButton_;
00111 GLWIconButton downButton_;
00112 GLWIconButton resetButton_;
00113 bool createdTexture_;
00114 GLTexture upTexture_;
00115 GLTexture downTexture_;
00116 GLTexture resetTexture_;
00117
00118 unsigned int lastChannelId_;
00119 unsigned int lastWhisperSrc_;
00120 bool init_;
00121 bool alignTop_, parentSized_;
00122 bool splitLargeLines_, allowScroll_;
00123 bool showChannelName_, showChannelNumber_;
00124 int lineDepth_;
00125 int scrollPosition_;
00126 float displayTime_;
00127 float fontSize_, outlineFontSize_;
00128 int visibleLines_, totalLines_;
00129 int currentVisible_;
00130 std::list<GLWChannelViewEntry> textLines_;
00131 KeyboardKey *scrollUpKey_;
00132 KeyboardKey *scrollDownKey_;
00133 KeyboardKey *scrollResetKey_;
00134 std::map<std::string, Vector> channelColors_;
00135 std::list<std::string> startupChannels_;
00136 std::list<CurrentChannelEntry> currentChannels_;
00137 std::list<BaseChannelEntry> availableChannels_;
00138 std::string textSound_;
00139
00140 void addInfo(Vector &color, GLWChannelViewTextRenderer &text);
00141 void formCurrentChannelList(std::list<std::string> &result);
00142 int splitLine(const LangString &message);
00143 };
00144
00145 #endif // __INCLUDE_GLWChannelViewh_INCLUDE__