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

FXMenuCaption.h
Go to the documentation of this file.
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,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: FXMenuCaption.h,v 1.33 2006/01/22 17:58:06 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXMENUCAPTION_H
25 #define FXMENUCAPTION_H
26 
27 #ifndef FXWINDOW_H
28 #include "FXWindow.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Menu Caption options
35 enum {
36  MENU_AUTOGRAY = 0x00008000, /// Automatically gray out when not updated
37  MENU_AUTOHIDE = 0x00010000 /// Automatically hide button when not updated
38  };
39 
40 
41 class FXIcon;
42 class FXFont;
43 
44 
45 /**
46 * The menu caption is a widget which can be used as a caption
47 * above a number of menu commands in a menu.
48 */
49 class FXAPI FXMenuCaption : public FXWindow {
51 protected:
52  FXString label;
53  FXString help;
54  FXString tip;
55  FXIcon *icon;
56  FXFont *font;
57  FXint hotoff;
58  FXHotKey hotkey;
59  FXColor textColor;
60  FXColor selbackColor;
61  FXColor seltextColor;
62  FXColor hiliteColor;
63  FXColor shadowColor;
64 protected:
65  FXMenuCaption();
66 private:
67  FXMenuCaption(const FXMenuCaption&);
68  FXMenuCaption &operator=(const FXMenuCaption&);
69 public:
70  long onPaint(FXObject*,FXSelector,void*);
71  long onUpdate(FXObject*,FXSelector,void*);
72  long onCmdGetStringValue(FXObject*,FXSelector,void*);
73  long onCmdSetStringValue(FXObject*,FXSelector,void*);
74  long onCmdSetIconValue(FXObject*,FXSelector,void*);
75  long onCmdGetIconValue(FXObject*,FXSelector,void*);
76  long onCmdSetHelp(FXObject*,FXSelector,void*);
77  long onCmdGetHelp(FXObject*,FXSelector,void*);
78  long onCmdSetTip(FXObject*,FXSelector,void*);
79  long onCmdGetTip(FXObject*,FXSelector,void*);
80  long onQueryHelp(FXObject*,FXSelector,void*);
81  long onQueryTip(FXObject*,FXSelector,void*);
82 public:
83 
84  /// Construct a menu caption
85  FXMenuCaption(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXuint opts=0);
86 
87  /// Create server-side resources
88  virtual void create();
89 
90  /// Detach server-side resources
91  virtual void detach();
92 
93  /// Enable the menu
94  virtual void enable();
95 
96  /// Disable the menu
97  virtual void disable();
98 
99  /// Return default width
100  virtual FXint getDefaultWidth();
101 
102  /// Return default height
103  virtual FXint getDefaultHeight();
105  /// Set the text for this menu
106  void setText(const FXString& text);
107 
108  /// Get the text for this menu
109  FXString getText() const { return label; }
111  /// Set the icon for this menu
112  void setIcon(FXIcon* ic);
113 
114  /// Get the icon for this menu
115  FXIcon* getIcon() const { return icon; }
116 
117  /// Set the text font
118  void setFont(FXFont* fnt);
119 
120  /// Return the text font
121  FXFont* getFont() const { return font; }
123  /// Set menu caption style
124  void setMenuStyle(FXuint style);
125 
126  /// Get menu caption style
127  FXuint getMenuStyle() const;
129  /// Return the current text color
130  void setTextColor(FXColor clr);
131 
132  /// Get the current text color
133  FXColor getTextColor() const { return textColor; }
135  /// Return the selection background color
136  void setSelBackColor(FXColor clr);
137 
138  /// Return the selection background color
139  FXColor getSelBackColor() const { return selbackColor; }
141  /// Return the selection text color
142  void setSelTextColor(FXColor clr);
143 
144  /// Return the selection text color
145  FXColor getSelTextColor() const { return seltextColor; }
147  /// Change highlight color
148  void setHiliteColor(FXColor clr);
149 
150  /// Get highlight color
151  FXColor getHiliteColor() const { return hiliteColor; }
153  /// Change shadow color
154  void setShadowColor(FXColor clr);
156  /// Get shadow color
157  FXColor getShadowColor() const { return shadowColor; }
159  /// Set the status line help text for this menu
160  void setHelpText(const FXString& text);
161 
162  /// Get the status line help text for this menu
163  const FXString& getHelpText() const { return help; }
164 
165  /// Set the tool tip message for this menu
166  void setTipText(const FXString& text){ tip=text; }
167 
168  /// Get the tool tip message for this menu
169  const FXString& getTipText() const { return tip; }
170 
171  /// Save menu to a stream
172  virtual void save(FXStream& store) const;
173 
174  /// Load menu from a stream
175  virtual void load(FXStream& store);
176 
177  /// Destructor
178  virtual ~FXMenuCaption();
179  };
180 
181 }
182 
183 #endif
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXHotKey
Definition: fxdefs.h:457
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
FXuint FXColor
Definition: fxdefs.h:454
Automatically gray out when not updated.
Definition: FXMenuCaption.h:39
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:56
int FXint
Definition: fxdefs.h:397
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Font class.
Definition: FXFont.h:142
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
Automatically hide button when not updated.
Definition: FXMenuCaption.h:40
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp