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

FXToolTip.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * T o o l T i p W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXToolTip.h,v 1.13 2006/01/22 17:58:11 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXTOOLTIP_H
25 #define FXTOOLTIP_H
26 
27 #ifndef FXSHELL_H
28 #include "FXShell.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXFont;
35 
36 
37 /// Tooltip styles
38 enum {
39  TOOLTIP_PERMANENT = 0x00020000, /// Tooltip stays up indefinitely
40  TOOLTIP_VARIABLE = 0x00040000, /// Tooltip stays up variable time, depending on the length of the string
41  TOOLTIP_NORMAL = 0 /// Normal tooltip
42  };
43 
44 
45 /// Hopefully Helpful Hint message
46 class FXAPI FXToolTip : public FXShell {
48 protected:
49  FXString label; // Text in the tip
50  FXFont *font; // Font of the tip
51  FXColor textColor; // Text color
52  FXbool popped; // Is currently popped up
53 protected:
55  virtual bool doesOverrideRedirect() const;
56  void place(FXint x,FXint y);
57  void autoplace();
58 private:
59  FXToolTip(const FXToolTip&);
60  FXToolTip& operator=(const FXToolTip&);
61 #ifdef WIN32
62  virtual const char* GetClass() const;
63 #endif
64 public:
65  long onPaint(FXObject*,FXSelector,void*);
66  long onUpdate(FXObject*,FXSelector,void*);
67  long onTipShow(FXObject*,FXSelector,void*);
68  long onTipHide(FXObject*,FXSelector,void*);
69  long onCmdGetStringValue(FXObject*,FXSelector,void*);
70  long onCmdSetStringValue(FXObject*,FXSelector,void*);
71 public:
72  enum {
73  ID_TIP_SHOW=FXShell::ID_LAST,
74  ID_TIP_HIDE,
75  ID_LAST
76  };
77 public:
78  /// Construct a tool tip
79  FXToolTip(FXApp* a,FXuint opts=TOOLTIP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
80 
81  /// Create server-side resources
82  virtual void create();
83 
84  /// Detach server-side resources
85  virtual void detach();
86 
87  /// Display the tip
88  virtual void show();
89 
90  /// Return default width
91  virtual FXint getDefaultWidth();
92 
93  /// Return default height
94  virtual FXint getDefaultHeight();
95 
96  /// Set the text for this tip
97  void setText(const FXString& text);
98 
99  /// Get the text for this tip
100  FXString getText() const { return label; }
101 
102  /// Set the tip text font
103  void setFont(FXFont *fnt);
104 
105  /// Get the tip text font
106  FXFont* getFont() const { return font; }
107 
108  /// Get the current tip text color
109  FXColor getTextColor() const { return textColor; }
110 
111  /// Set the current tip text color
112  void setTextColor(FXColor clr);
113 
114  virtual bool doesSaveUnder() const;
115 
116  /// Save tip to a stream
117  virtual void save(FXStream& store) const;
118 
119  /// Load tip from a stream
120  virtual void load(FXStream& store);
121 
122  /// Destructor
123  virtual ~FXToolTip();
124  };
125 
126 }
127 
128 #endif
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:393
Tooltip stays up indefinitely.
Definition: FXToolTip.h:42
Application Object.
Definition: FXApp.h:158
FXuint FXColor
Definition: fxdefs.h:454
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Tooltip stays up variable time, depending on the length of the string.
Definition: FXToolTip.h:43
The Shell widget is used as the base class for top level windows, i.e.
Definition: FXShell.h:38
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Hopefully Helpful Hint message.
Definition: FXToolTip.h:54
Font class.
Definition: FXFont.h:142
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33
Normal tooltip.
Definition: FXToolTip.h:44

Copyright © 1997-2005 Jeroen van der Zijp