![]() |
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.4 2002/09/30 13:06:56 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 struct FXTimer; 00035 class FXFont; 00036 00037 00038 /// Tooltip styles 00039 enum { 00040 TOOLTIP_PERMANENT = 0x00020000, /// Tooltip stays up indefinitely 00041 TOOLTIP_VARIABLE = 0x00040000, /// Tooltip stays up variable time, depending on the length of the string 00042 TOOLTIP_NORMAL = 0 /// Normal tooltip 00043 }; 00044 00045 00046 /// Hopefully Helpful Hint message 00047 class FXAPI FXToolTip : public FXShell { 00048 FXDECLARE(FXToolTip) 00049 protected: 00050 FXString label; 00051 FXFont *font; 00052 FXColor textColor; 00053 FXTimer *timer; 00054 FXbool popped; 00055 protected: 00056 FXToolTip(); 00057 virtual FXbool doesOverrideRedirect() const; 00058 void place(FXint x,FXint y); 00059 void autoplace(); 00060 private: 00061 FXToolTip(const FXToolTip&); 00062 FXToolTip& operator=(const FXToolTip&); 00063 #ifdef WIN32 00064 virtual const char* GetClass() const; 00065 #endif 00066 public: 00067 long onPaint(FXObject*,FXSelector,void*); 00068 long onUpdate(FXObject*,FXSelector,void*); 00069 long onTipShow(FXObject*,FXSelector,void*); 00070 long onTipHide(FXObject*,FXSelector,void*); 00071 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00072 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00073 public: 00074 enum { 00075 ID_TIP_SHOW=FXShell::ID_LAST, 00076 ID_TIP_HIDE, 00077 ID_LAST 00078 }; 00079 public: 00080 /// Construct a tool tip 00081 FXToolTip(FXApp* a,FXuint opts=TOOLTIP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00082 00083 /// Create server-side resources 00084 virtual void create(); 00085 00086 /// Detach server-side resources 00087 virtual void detach(); 00088 00089 /// Display the tip 00090 virtual void show(); 00091 00092 /// Return default width 00093 virtual FXint getDefaultWidth(); 00094 00095 /// Return default height 00096 virtual FXint getDefaultHeight(); 00097 00098 /// Set the text for this tip 00099 void setText(const FXString& text); 00100 00101 /// Get the text for this tip 00102 const FXString& getText() const { return label; } 00103 00104 /// Set the tip text font 00105 void setFont(FXFont *fnt); 00106 00107 /// Get the tip text font 00108 FXFont* getFont() const { return font; } 00109 00110 /// Get the current tip text color 00111 FXColor getTextColor() const { return textColor; } 00112 00113 /// Set the current tip text color 00114 void setTextColor(FXColor clr); 00115 00116 virtual FXbool doesSaveUnder() const; 00117 00118 /// Save tip to a stream 00119 virtual void save(FXStream& store) const; 00120 00121 /// Load tip from a stream 00122 virtual void load(FXStream& store); 00123 00124 /// Destructor 00125 virtual ~FXToolTip(); 00126 }; 00127 00128 } 00129 00130 #endif