CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csws/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 {
00075   struct HintStore
00076   {
00078     csComponent *comp;
00080     char text [1];
00081   };
00082 
00084   csApp *app;
00086   csTicks time;
00088   csTicks timeout;
00090   iFont *font;
00092   int fontsize;
00094   bool check;
00095 
00096 public:
00098   csHintManager (csApp *iApp);
00100   ~csHintManager ();
00102   void FreeAll ();
00104   void FreeItem (void* Item);
00106   static int Compare (void* const& Item1, void* const& Item2);
00108   static int CompareKey (void* const& Item, csComponent* const& key);
00110   static csArrayCmp<void*,csComponent*> KeyCmp(csComponent* c)
00111   { return csArrayCmp<void*,csComponent*>(c, CompareKey); }
00113   void Add (const char *iText, csComponent *iComp);
00115   void Remove (csComponent *iComp);
00117   void HandleEvent (iEvent &Event);
00119   void SetTimeout (csTicks iTimeout)
00120   { timeout = iTimeout; }
00122   void SetFont (iFont *iNewFont, int iSize);
00123 
00124 private:
00126   static bool do_checkhint (csComponent *comp, void *data);
00127 };
00128 
00131 #endif // __CS_CSHINTS_H__

Generated for Crystal Space by doxygen 1.2.18