Planeshift
eeditshortcutstoolbox.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Robberts
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef EEDIT_SHORTCUTS_TOOLBOX_WINDOW_HEADER
21 #define EEDIT_SHORTCUTS_TOOLBOX_WINDOW_HEADER
22 
23 #include <csutil/array.h>
24 #include "eedittoolbox.h"
25 #include "paws/pawswidget.h"
26 
27 class pawsListBox;
28 
34 {
35  EEditShortcutKey(const char * _command, int _key, int _modifiers)
36  : command(_command), key(_key), modifiers(_modifiers)
37  {
38  }
39 
40  csString command;
41  int key;
42  int modifiers;
43 };
44 
47 class EEditShortcutsToolbox : public EEditToolbox, public pawsWidget, public scfImplementation0<EEditShortcutsToolbox>
48 {
49 public:
51  virtual ~EEditShortcutsToolbox();
52 
56  void AddShortcut(const char * name);
57 
62  void ExecuteShortcutCommand(int key, int modifiers=0) const;
63 
64  // inheritted from EEditToolbox
65  virtual void Update(unsigned int elapsed);
66  virtual size_t GetType() const;
67  virtual const char * GetName() const;
68 
69  // inheritted from pawsWidget
70  virtual bool PostSetup();
71  virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
72  virtual void Show();
73  virtual void OnListAction(pawsListBox * selected, int status);
74 
75 private:
76 
79  void SaveShortcuts();
80 
83  void RedrawShortcuts();
84 
85  pawsListBox * shortcutsList;
86  pawsButton * applyButton;
87  pawsButton * cancelButton;
88  pawsButton * okButton;
89 
90  csArray<EEditShortcutKey> shortcuts;
91 };
92 
94 
97 #endif
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
const char * GetName(int id)
CREATE_PAWS_FACTORY(EEditShortcutsToolbox)
EEditShortcutKey(const char *_command, int _key, int _modifiers)
A simple list box widget.
Definition: pawslistbox.h:202
This manages the shortcuts.
A base class for all eedit toolbox windows.
Definition: eedittoolbox.h:26
A simple button widget.
Definition: pawsbutton.h:43