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,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXToolTip.h,v 1.13 2006/01/22 17:58:11 fox Exp $                         *
00023 ********************************************************************************/
00024 #ifndef FXTOOLTIP_H
00025 #define FXTOOLTIP_H
00026 
00027 #ifndef FXSHELL_H
00028 #include "FXShell.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXFont;
00035 
00036 
00037 /// Tooltip styles
00038 enum {
00039   TOOLTIP_PERMANENT  = 0x00020000,      /// Tooltip stays up indefinitely
00040   TOOLTIP_VARIABLE   = 0x00040000,      /// Tooltip stays up variable time, depending on the length of the string
00041   TOOLTIP_NORMAL     = 0                /// Normal tooltip
00042   };
00043 
00044 
00045 /// Hopefully Helpful Hint message
00046 class FXAPI FXToolTip : public FXShell {
00047   FXDECLARE(FXToolTip)
00048 protected:
00049   FXString  label;                      // Text in the tip
00050   FXFont   *font;                       // Font of the tip
00051   FXColor   textColor;                  // Text color
00052   FXbool    popped;                     // Is currently popped up
00053 protected:
00054   FXToolTip();
00055   virtual bool doesOverrideRedirect() const;
00056   void place(FXint x,FXint y);
00057   void autoplace();
00058 private:
00059   FXToolTip(const FXToolTip&);
00060   FXToolTip& operator=(const FXToolTip&);
00061 #ifdef WIN32
00062   virtual const char* GetClass() const;
00063 #endif
00064 public:
00065   long onPaint(FXObject*,FXSelector,void*);
00066   long onUpdate(FXObject*,FXSelector,void*);
00067   long onTipShow(FXObject*,FXSelector,void*);
00068   long onTipHide(FXObject*,FXSelector,void*);
00069   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00070   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00071 public:
00072   enum {
00073     ID_TIP_SHOW=FXShell::ID_LAST,
00074     ID_TIP_HIDE,
00075     ID_LAST
00076     };
00077 public:
00078   /// Construct a tool tip
00079   FXToolTip(FXApp* a,FXuint opts=TOOLTIP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00080 
00081   /// Create server-side resources
00082   virtual void create();
00083 
00084   /// Detach server-side resources
00085   virtual void detach();
00086 
00087   /// Display the tip
00088   virtual void show();
00089 
00090   /// Return default width
00091   virtual FXint getDefaultWidth();
00092 
00093   /// Return default height
00094   virtual FXint getDefaultHeight();
00095 
00096   /// Set the text for this tip
00097   void setText(const FXString& text);
00098 
00099   /// Get the text for this tip
00100   FXString getText() const { return label; }
00101 
00102   /// Set the tip text font
00103   void setFont(FXFont *fnt);
00104 
00105   /// Get the tip text font
00106   FXFont* getFont() const { return font; }
00107 
00108   /// Get the current tip text color
00109   FXColor getTextColor() const { return textColor; }
00110 
00111   /// Set the current tip text color
00112   void setTextColor(FXColor clr);
00113 
00114   virtual bool doesSaveUnder() const;
00115 
00116   /// Save tip to a stream
00117   virtual void save(FXStream& store) const;
00118 
00119   /// Load tip from a stream
00120   virtual void load(FXStream& store);
00121 
00122   /// Destructor
00123   virtual ~FXToolTip();
00124   };
00125 
00126 }
00127 
00128 #endif

Copyright © 1997-2005 Jeroen van der Zijp