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

FXMenuCommand.h
1 /********************************************************************************
2 * *
3 * M e n u C o m m a n d 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 FXMENUCOMMAND_H
22 #define FXMENUCOMMAND_H
23 
24 #ifndef FXMENUCAPTION_H
25 #include "FXMenuCaption.h"
26 #endif
27 
28 namespace FX {
29 
30 
44 class FXAPI FXMenuCommand : public FXMenuCaption {
45  FXDECLARE(FXMenuCommand)
46 protected:
47  FXString accel; // Accelerator string
48  FXHotKey acckey; // Accelerator key
49 protected:
50  FXMenuCommand();
51 private:
53  FXMenuCommand &operator=(const FXMenuCommand&);
54 public:
55  long onPaint(FXObject*,FXSelector,void*);
56  long onEnter(FXObject*,FXSelector,void*);
57  long onLeave(FXObject*,FXSelector,void*);
58  long onButtonPress(FXObject*,FXSelector,void*);
59  long onButtonRelease(FXObject*,FXSelector,void*);
60  long onKeyPress(FXObject*,FXSelector,void*);
61  long onKeyRelease(FXObject*,FXSelector,void*);
62  long onHotKeyPress(FXObject*,FXSelector,void*);
63  long onHotKeyRelease(FXObject*,FXSelector,void*);
64  long onCmdAccel(FXObject*,FXSelector,void*);
65 public:
66 
68  FXMenuCommand(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0);
69 
71  virtual FXint getDefaultWidth();
72 
74  virtual FXint getDefaultHeight();
75 
77  virtual FXbool canFocus() const;
78 
80  virtual void setFocus();
81 
83  virtual void killFocus();
84 
86  void setAccelText(const FXString& text,FXbool acc=false);
87 
89  FXString getAccelText() const { return accel; }
90 
92  virtual void save(FXStream& store) const;
93 
95  virtual void load(FXStream& store);
96 
98  virtual ~FXMenuCommand();
99  };
100 
101 }
102 
103 #endif
FXString getAccelText() const
Return accelarator text.
Definition: FXMenuCommand.h:89
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
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
The menu command widget is used to invoke a command in the application from a menu.
Definition: FXMenuCommand.h:44
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
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp