![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * T o o l t i p W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2002 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.16 2002/01/18 22:42:55 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXTOOLTIP_H 00025 #define FXTOOLTIP_H 00026 00027 #ifndef FXSHELL_H 00028 #include "FXShell.h" 00029 #endif 00030 00031 00032 00033 struct FXTimer; 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; 00050 FXFont *font; 00051 FXColor textColor; 00052 FXTimer *timer; 00053 FXbool popped; 00054 protected: 00055 FXTooltip(); 00056 virtual FXbool doesOverrideRedirect() const; 00057 void place(FXint x,FXint y); 00058 void autoplace(); 00059 private: 00060 FXTooltip(const FXTooltip&); 00061 FXTooltip& operator=(const FXTooltip&); 00062 #ifdef WIN32 00063 virtual const char* GetClass() const; 00064 #endif 00065 public: 00066 long onPaint(FXObject*,FXSelector,void*); 00067 long onUpdate(FXObject*,FXSelector,void*); 00068 long onTipShow(FXObject*,FXSelector,void*); 00069 long onTipHide(FXObject*,FXSelector,void*); 00070 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00071 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00072 public: 00073 enum { 00074 ID_TIP_SHOW=FXShell::ID_LAST, 00075 ID_TIP_HIDE, 00076 ID_LAST 00077 }; 00078 public: 00079 /// Construct a tool tip 00080 FXTooltip(FXApp* a,FXuint opts=TOOLTIP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00081 00082 /// Create server-side resources 00083 virtual void create(); 00084 00085 /// Detach server-side resources 00086 virtual void detach(); 00087 00088 /// Display the tip 00089 virtual void show(); 00090 00091 /// Return default width 00092 virtual FXint getDefaultWidth(); 00093 00094 /// Return default height 00095 virtual FXint getDefaultHeight(); 00096 00097 /// Set the text for this tip 00098 void setText(const FXString& text); 00099 00100 /// Get the text for this tip 00101 FXString getText() const { return label; } 00102 00103 /// Set the tip text font 00104 void setFont(FXFont *fnt); 00105 00106 /// Get the tip text font 00107 FXFont* getFont() const { return font; } 00108 00109 /// Get the current tip text color 00110 FXColor getTextColor() const { return textColor; } 00111 00112 /// Set the current tip text color 00113 void setTextColor(FXColor clr); 00114 00115 virtual FXbool doesSaveUnder() const; 00116 00117 /// Save tip to a stream 00118 virtual void save(FXStream& store) const; 00119 00120 /// Load tip from a stream 00121 virtual void load(FXStream& store); 00122 00123 /// Destructor 00124 virtual ~FXTooltip(); 00125 }; 00126 00127 00128 #endif