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 #define CSWS_INTERNAL
00032 #include "csws.h"
00033 #include "cscomp.h"
00034 #include "csutil/array.h"
00035 
00043 class csHint : public csComponent
00044 {
00046   csComponent *oldmo;
00047 
00048 public:
00050   csHint (csComponent *iParent, const char *iText, iFont *Font = 0,
00051     int iFontSize = -1);
00053   virtual ~csHint ();
00054 
00056   virtual void Draw ();
00058   virtual bool PreHandleEvent (iEvent &Event);
00060   virtual void SetText (const char *iText);
00061 };
00062 
00064 #define CSHINT_DEFAULT_TIMEOUT      3000
00065 
00071 class csHintManager : public csArray<void*>
00072 {
00074   struct HintStore
00075   {
00077     csComponent *comp;
00079     char text [1];
00080   };
00081 
00083   csApp *app;
00085   csTicks time;
00087   csTicks timeout;
00089   iFont *font;
00091   int fontsize;
00093   bool check;
00094 
00095 public:
00097   csHintManager (csApp *iApp);
00099   ~csHintManager ();
00101   void FreeAll ();
00103   void FreeItem (void* Item);
00105   static int Compare (void* const& Item1, void* const& Item2);
00107   static int CompareKey (void* const& Item, void* key);
00109   void Add (const char *iText, csComponent *iComp);
00111   void Remove (csComponent *iComp);
00113   void HandleEvent (iEvent &Event);
00115   void SetTimeout (csTicks iTimeout)
00116   { timeout = iTimeout; }
00118   void SetFont (iFont *iNewFont, int iSize);
00119 
00120 private:
00122   static bool do_checkhint (csComponent *comp, void *data);
00123 };
00124 
00127 #endif // __CS_CSHINTS_H__

Generated for Crystal Space by doxygen 1.2.18