1 //////////////////////////////////////////////////////////////////////////////// 2 // Scorched3D (c) 2000-2011 3 // 4 // This file is part of Scorched3D. 5 // 6 // Scorched3D is free software; you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation; either version 2 of the License, or 9 // (at your option) any later version. 10 // 11 // Scorched3D is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License along 17 // with this program; if not, write to the Free Software Foundation, Inc., 18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 //////////////////////////////////////////////////////////////////////////////// 20 21 #if !defined(__INCLUDE_ToolTiph_INCLUDE__) 22 #define __INCLUDE_ToolTiph_INCLUDE__ 23 24 #include <lang/LangString.h> 25 26 class GLWToolTip; 27 class ToolTipI 28 { 29 public: 30 virtual ~ToolTipI(); 31 32 virtual void populateCalled(unsigned int id) = 0; 33 }; 34 35 class ToolTip 36 { 37 public: 38 enum ToolTipType 39 { 40 ToolTipNone = 0, 41 ToolTipHelp = 1, 42 ToolTipInfo = 2, 43 ToolTipAlignLeft = 4, 44 ToolTipAlignBottom = 8 45 }; 46 47 friend class GLWToolTip; 48 ToolTip(unsigned int type = ToolTipNone, 49 const LangString &title = LangString(), 50 const LangString &text = LangString()); 51 virtual ~ToolTip(); 52 53 // Used to set the title and text of the tooltip 54 void setText(unsigned int type, 55 const LangString &title, const LangString &text); 56 57 // Called just before the tooltip is shown 58 // can be used to dynamically populate the title and text fields 59 virtual void populate(); 60 setHandler(ToolTipI * handler)61 void setHandler(ToolTipI *handler) { handler_ = handler; } 62 getId()63 unsigned int getId() { return id_; } getText()64 LangString &getText() { return text_; } getTitle()65 LangString &getTitle() { return title_; } getType()66 unsigned int getType() { return type_; } 67 68 protected: 69 unsigned int type_; 70 ToolTipI *handler_; 71 unsigned int id_; 72 static unsigned int nextId_; 73 LangString text_; 74 LangString title_; 75 76 }; 77 #endif // __INCLUDE_ToolTiph_INCLUDE__ 78