Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

cshints.h

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 __CSHINTS_H__
00021 #define __CSHINTS_H__
00022 
00023 #define CSWS_INTERNAL
00024 #include "csws.h"
00025 #include "cscomp.h"
00026 #include "csutil/csvector.h"
00027 
00035 class csHint : public csComponent
00036 {
00038   csComponent *oldmo;
00039 
00040 public:
00042   csHint (csComponent *iParent, const char *iText, iFont *Font = NULL,
00043     int iFontSize = -1);
00045   virtual ~csHint ();
00046 
00048   virtual void Draw ();
00050   virtual bool PreHandleEvent (iEvent &Event);
00052   virtual void SetText (const char *iText);
00053 };
00054 
00056 #define CSHINT_DEFAULT_TIMEOUT      3000
00057 
00063 class csHintManager : public csVector
00064 {
00065   // This structure holds the data about one hint
00066   struct HintStore
00067   {
00068     // The component associated with the hint
00069     csComponent *comp;
00070     // The text string starts right after the end of this structure
00071     char text [1];
00072   };
00073 
00075   csApp *app;
00077   csTicks time;
00079   csTicks timeout;
00081   iFont *font;
00083   int fontsize;
00085   bool check;
00086 
00087 public:
00089   csHintManager (csApp *iApp);
00091   virtual ~csHintManager ();
00093   virtual bool FreeItem (csSome Item);
00095   virtual int Compare (csSome Item1, csSome Item2, int Mode) const;
00097   virtual int CompareKey (csSome Item, csConstSome Key, int Mode) const;
00099   void Add (const char *iText, csComponent *iComp);
00101   void Remove (csComponent *iComp);
00103   void HandleEvent (iEvent &Event);
00105   void SetTimeout (csTicks iTimeout)
00106   { timeout = iTimeout; }
00108   void SetFont (iFont *iNewFont, int iSize);
00109 
00110 private:
00111   // Check if this child has an associated hint
00112   static bool do_checkhint (csComponent *comp, void *data);
00113 };
00114 
00115 #endif // __CSHINTS_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000