Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXToolTip.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                           T o o l   T i p   W i d g e t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXToolTip.h,v 1.21 2009/01/06 13:07:28 fox Exp $                         *
00022 ********************************************************************************/
00023 #ifndef FXTOOLTIP_H
00024 #define FXTOOLTIP_H
00025 
00026 #ifndef FXSHELL_H
00027 #include "FXShell.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXFont;
00034 
00035 
00036 /// Tooltip styles
00037 enum {
00038   TOOLTIP_PERMANENT  = 0x00020000,      /// Tooltip stays up indefinitely
00039   TOOLTIP_VARIABLE   = 0x00040000,      /// Tooltip stays up variable time, depending on the length of the string
00040   TOOLTIP_NORMAL     = 0                /// Normal tooltip
00041   };
00042 
00043 
00044 /// Hopefully Helpful Hint message
00045 class FXAPI FXToolTip : public FXShell {
00046   FXDECLARE(FXToolTip)
00047 protected:
00048   FXString  label;                      // Text in the tip
00049   FXFont   *font;                       // Font of the tip
00050   FXColor   textColor;                  // Text color
00051   FXbool    popped;                     // Is currently popped up
00052 protected:
00053   FXToolTip();
00054   virtual FXbool doesOverrideRedirect() const;
00055   void place(FXint x,FXint y);
00056   void autoplace();
00057 private:
00058   FXToolTip(const FXToolTip&);
00059   FXToolTip& operator=(const FXToolTip&);
00060 #ifdef WIN32
00061   virtual const void* GetClass() const;
00062 #endif
00063 public:
00064   long onPaint(FXObject*,FXSelector,void*);
00065   long onUpdate(FXObject*,FXSelector,void*);
00066   long onTipShow(FXObject*,FXSelector,void*);
00067   long onTipHide(FXObject*,FXSelector,void*);
00068   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00069   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00070 public:
00071   enum {
00072     ID_TIP_SHOW=FXShell::ID_LAST,
00073     ID_TIP_HIDE,
00074     ID_LAST
00075     };
00076 public:
00077   /// Construct a tool tip
00078   FXToolTip(FXApp* a,FXuint opts=TOOLTIP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00079 
00080   /// Create server-side resources
00081   virtual void create();
00082 
00083   /// Detach server-side resources
00084   virtual void detach();
00085 
00086   /// Display the tip
00087   virtual void show();
00088 
00089   /// Return default width
00090   virtual FXint getDefaultWidth();
00091 
00092   /// Return default height
00093   virtual FXint getDefaultHeight();
00094 
00095   /// Set the text for this tip
00096   void setText(const FXString& text);
00097 
00098   /// Get the text for this tip
00099   FXString getText() const { return label; }
00100 
00101   /// Set the tip text font
00102   void setFont(FXFont *fnt);
00103 
00104   /// Get the tip text font
00105   FXFont* getFont() const { return font; }
00106 
00107   /// Get the current tip text color
00108   FXColor getTextColor() const { return textColor; }
00109 
00110   /// Set the current tip text color
00111   void setTextColor(FXColor clr);
00112 
00113   virtual FXbool doesSaveUnder() const;
00114 
00115   /// Save tip to a stream
00116   virtual void save(FXStream& store) const;
00117 
00118   /// Load tip from a stream
00119   virtual void load(FXStream& store);
00120 
00121   /// Destructor
00122   virtual ~FXToolTip();
00123   };
00124 
00125 }
00126 
00127 #endif

Copyright © 1997-2009 Jeroen van der Zijp