Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
cshints.h
Go to the documentation of this file.00001 /* 00002 Crystal Space Windowing System: floating hints class 00003 Copyright (C) 2000 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSHINTS_H__ 00021 #define __CS_CSHINTS_H__ 00022 00031 #include "csextern.h" 00032 00033 #define CSWS_INTERNAL 00034 #include "csws.h" 00035 #include "cscomp.h" 00036 #include "csutil/array.h" 00037 00045 class CS_CSWS_EXPORT csHint : public csComponent 00046 { 00048 csComponent *oldmo; 00049 00050 public: 00052 csHint (csComponent *iParent, const char *iText, iFont *Font = 0); 00054 virtual ~csHint (); 00055 00057 virtual void Draw (); 00059 virtual bool PreHandleEvent (iEvent &Event); 00061 virtual void SetText (const char *iText); 00062 }; 00063 00065 #define CSHINT_DEFAULT_TIMEOUT 3000 00066 00072 class CS_CSWS_EXPORT csHintManager : public csArray<void*> 00073 { 00074 private: 00078 struct HintStore 00079 { 00083 csComponent *comp; 00087 char text [1]; 00088 }; 00089 00091 csApp *app; 00093 csTicks time; 00095 csTicks timeout; 00097 iFont *font; 00099 int fontsize; 00101 bool check; 00102 00103 public: 00105 csHintManager (csApp *iApp); 00107 ~csHintManager (); 00109 void FreeAll (); 00111 void FreeItem (void* Item); 00113 static int Compare (void* const& Item1, void* const& Item2); 00115 static int CompareKey (void* const& Item, csComponent* const& key); 00117 static csArrayCmp<void*,csComponent*> KeyCmp(csComponent* c) 00118 { return csArrayCmp<void*,csComponent*>(c, CompareKey); } 00120 void Add (const char *iText, csComponent *iComp); 00122 void Remove (csComponent *iComp); 00124 void HandleEvent (iEvent &Event); 00126 void SetTimeout (csTicks iTimeout) 00127 { timeout = iTimeout; } 00129 void SetFont (iFont *iNewFont, int iSize); 00130 00131 private: 00135 static bool do_checkhint (csComponent *comp, void *data); 00136 }; 00137 00140 #endif // __CS_CSHINTS_H__
Generated for Crystal Space by doxygen 1.3.9.1