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

FXToolTip.h
1 /********************************************************************************
2 * *
3 * T o o l T i p W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXTOOLTIP_H
22 #define FXTOOLTIP_H
23 
24 #ifndef FXSHELL_H
25 #include "FXShell.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXFont;
32 
33 
35 enum {
36  TOOLTIP_PERMANENT = 0x00020000,
37  TOOLTIP_VARIABLE = 0x00040000,
38  TOOLTIP_NORMAL = 0
39  };
40 
41 
43 class FXAPI FXToolTip : public FXShell {
44  FXDECLARE(FXToolTip)
45 protected:
46  FXString label; // Text in the tip
47  FXFont *font; // Font of the tip
48  FXColor textColor; // Text color
49  FXbool popped; // Is currently popped up
50 protected:
51  FXToolTip();
52  virtual FXbool doesOverrideRedirect() const;
53  void place(FXint x,FXint y);
54  void autoplace();
55 private:
56  FXToolTip(const FXToolTip&);
57  FXToolTip& operator=(const FXToolTip&);
58 #ifdef WIN32
59  virtual const void* GetClass() const;
60 #endif
61 public:
62  long onPaint(FXObject*,FXSelector,void*);
63  long onUpdate(FXObject*,FXSelector,void*);
64  long onTipShow(FXObject*,FXSelector,void*);
65  long onTipHide(FXObject*,FXSelector,void*);
66  long onCmdGetStringValue(FXObject*,FXSelector,void*);
67  long onCmdSetStringValue(FXObject*,FXSelector,void*);
68 public:
69  enum {
70  ID_TIP_SHOW=FXShell::ID_LAST,
71  ID_TIP_HIDE,
72  ID_LAST
73  };
74 public:
75 
77  FXToolTip(FXApp* a,FXuint opts=TOOLTIP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
78 
80  virtual void create();
81 
83  virtual void detach();
84 
86  virtual void show();
87 
89  virtual FXint getDefaultWidth();
90 
92  virtual FXint getDefaultHeight();
93 
95  void setText(const FXString& text);
96 
98  FXString getText() const { return label; }
99 
101  void setFont(FXFont *fnt);
102 
104  FXFont* getFont() const { return font; }
105 
107  FXColor getTextColor() const { return textColor; }
108 
110  void setTextColor(FXColor clr);
111 
112  virtual FXbool doesSaveUnder() const;
113 
115  virtual void save(FXStream& store) const;
116 
118  virtual void load(FXStream& store);
119 
121  virtual ~FXToolTip();
122  };
123 
124 }
125 
126 #endif
The Application object is the central point of a FOX user-interface.
Definition: FXApp.h:134
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
FXColor getTextColor() const
Get the current tip text color.
Definition: FXToolTip.h:107
FXFont * getFont() const
Get the tip text font.
Definition: FXToolTip.h:104
Definition: FX4Splitter.h:28
The Shell widget is used as the base class for top level windows, i.e.
Definition: FXShell.h:35
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXString getText() const
Get the text for this tip.
Definition: FXToolTip.h:98
Hopefully Helpful Hint message.
Definition: FXToolTip.h:43
Font class.
Definition: FXFont.h:137
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp