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

FXMenuCaption.h
1 /********************************************************************************
2 * *
3 * M e n u C a p t i o n W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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 FXMENUCAPTION_H
22 #define FXMENUCAPTION_H
23 
24 #ifndef FXWINDOW_H
25 #include "FXWindow.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  MENU_AUTOGRAY = 0x00008000,
34  MENU_AUTOHIDE = 0x00010000
35  };
36 
37 
38 class FXIcon;
39 class FXFont;
40 
41 
52 class FXAPI FXMenuCaption : public FXWindow {
53  FXDECLARE(FXMenuCaption)
54 protected:
55  FXString label; // Text on the label
56  FXIcon *icon; // Icon on the label
57  FXFont *font; // Label font
58  FXString help; // Help message
59  FXString tip; // Tooltip
60  FXColor textColor; // Text color
61  FXColor selbackColor; // Selection background color
62  FXColor seltextColor; // Selected text color
63  FXColor hiliteColor; // Highlight color
64  FXColor shadowColor; // Shadow color
65  FXHotKey hotkey; // Hotkey
66  FXint hotoff; // Offset in string
67 protected:
68  FXMenuCaption();
69 private:
71  FXMenuCaption &operator=(const FXMenuCaption&);
72 public:
73  long onPaint(FXObject*,FXSelector,void*);
74  long onUpdate(FXObject*,FXSelector,void*);
75  long onCmdSetValue(FXObject*,FXSelector,void*);
76  long onCmdGetStringValue(FXObject*,FXSelector,void*);
77  long onCmdSetStringValue(FXObject*,FXSelector,void*);
78  long onCmdSetIconValue(FXObject*,FXSelector,void*);
79  long onCmdGetIconValue(FXObject*,FXSelector,void*);
80  long onCmdSetHelp(FXObject*,FXSelector,void*);
81  long onCmdGetHelp(FXObject*,FXSelector,void*);
82  long onCmdSetTip(FXObject*,FXSelector,void*);
83  long onCmdGetTip(FXObject*,FXSelector,void*);
84  long onQueryHelp(FXObject*,FXSelector,void*);
85  long onQueryTip(FXObject*,FXSelector,void*);
86 public:
87 
89  FXMenuCaption(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXuint opts=0);
90 
92  virtual void create();
93 
95  virtual void detach();
96 
98  virtual void enable();
99 
101  virtual void disable();
102 
104  virtual FXint getDefaultWidth();
105 
107  virtual FXint getDefaultHeight();
108 
110  void setTextAndHotKey(const FXString& hotkeytext);
111 
113  void setText(const FXString& text);
114 
116  FXString getText() const { return label; }
117 
119  void setIcon(FXIcon* ic);
120 
122  FXIcon* getIcon() const { return icon; }
123 
125  void setFont(FXFont* fnt);
126 
128  FXFont* getFont() const { return font; }
129 
131  void setMenuStyle(FXuint style);
132 
134  FXuint getMenuStyle() const;
135 
137  void setTextColor(FXColor clr);
138 
140  FXColor getTextColor() const { return textColor; }
141 
143  void setSelBackColor(FXColor clr);
144 
146  FXColor getSelBackColor() const { return selbackColor; }
147 
149  void setSelTextColor(FXColor clr);
150 
152  FXColor getSelTextColor() const { return seltextColor; }
153 
155  void setHiliteColor(FXColor clr);
156 
158  FXColor getHiliteColor() const { return hiliteColor; }
159 
161  void setShadowColor(FXColor clr);
162 
164  FXColor getShadowColor() const { return shadowColor; }
165 
167  void setHelpText(const FXString& text);
168 
170  const FXString& getHelpText() const { return help; }
171 
173  void setTipText(const FXString& text){ tip=text; }
174 
176  const FXString& getTipText() const { return tip; }
177 
179  virtual void save(FXStream& store) const;
180 
182  virtual void load(FXStream& store);
183 
185  virtual ~FXMenuCaption();
186  };
187 
188 }
189 
190 #endif
FXString getText() const
Get the text for this menu.
Definition: FXMenuCaption.h:116
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
FXColor getShadowColor() const
Get shadow color.
Definition: FXMenuCaption.h:164
Base composite.
Definition: FXComposite.h:32
FXColor getHiliteColor() const
Get highlight color.
Definition: FXMenuCaption.h:158
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
const FXString & getTipText() const
Get the tool tip message for this menu.
Definition: FXMenuCaption.h:176
The menu caption is a widget which can be used as a caption above a number of menu commands in a menu...
Definition: FXMenuCaption.h:52
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
FXColor getSelTextColor() const
Return the selection text color.
Definition: FXMenuCaption.h:152
FXIcon * getIcon() const
Get the icon for this menu.
Definition: FXMenuCaption.h:122
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXColor getSelBackColor() const
Return the selection background color.
Definition: FXMenuCaption.h:146
FXColor getTextColor() const
Get the current text color.
Definition: FXMenuCaption.h:140
const FXString & getHelpText() const
Get the status line help text for this menu.
Definition: FXMenuCaption.h:170
FXFont * getFont() const
Return the text font.
Definition: FXMenuCaption.h:128
void setTipText(const FXString &text)
Set the tool tip message for this menu.
Definition: FXMenuCaption.h:173
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