OpenASIP  2.0
GUICommand.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file GUICommand.hh
26  *
27  * Declaration of GUICommand class.
28  *
29  * @author Veli-Pekka Jääskeläinen (vjaaskel-no.spam-cs.tut.fi)
30  */
31 
32 #ifndef TTA_GUI_COMMAND_HH
33 #define TTA_GUI_COMMAND_HH
34 
35 #include <wx/wx.h>
36 #include <string>
37 
38 class wxWindow;
39 
40 /**
41  * Base class for editor commands, which can be added to menus or toolbar.
42  */
43 class GUICommand {
44 public:
45  GUICommand(std::string name, wxWindow* parent);
46  virtual ~GUICommand();
47 
48  /**
49  * Returns the ID of the command.
50  *
51  * @return The ID of the command.
52  */
53  virtual int id() const = 0;
54 
55  /**
56  * Creates a new GUICommand instance.
57  *
58  * @return New GUICommand instance.
59  */
60  virtual GUICommand* create() const = 0;
61 
62  /**
63  * Executes the command.
64  *
65  * @return True, if the command was succesfully executed, false otherwise.
66  */
67  virtual bool Do() = 0;
68 
69  /**
70  * Returns true if the command is executable, false otherwise.
71  *
72  * @return True, if the command is executable, false otherwise.
73  */
74  virtual bool isEnabled() = 0;
75 
76  /**
77  * Returns name of the command icon file.
78  *
79  * @return Name of the command icon file.
80  */
81  virtual std::string icon() const = 0;
82 
83  virtual bool isChecked() const;
84  virtual std::string shortName() const;
85  void setParentWindow(wxWindow* view);
86  wxWindow* parentWindow() const;
87  std::string name() const;
88 
89 private:
90  /// Parent window of the command.
91  wxWindow* parent_;
92  /// Name of the command.
93  std::string name_;
94 };
95 
96 #endif
GUICommand::setParentWindow
void setParentWindow(wxWindow *view)
Definition: GUICommand.cc:64
GUICommand::isEnabled
virtual bool isEnabled()=0
GUICommand::name_
std::string name_
Name of the command.
Definition: GUICommand.hh:93
GUICommand::isChecked
virtual bool isChecked() const
Definition: GUICommand.cc:112
GUICommand::parent_
wxWindow * parent_
Parent window of the command.
Definition: GUICommand.hh:91
GUICommand::name
std::string name() const
Definition: GUICommand.cc:99
GUICommand::Do
virtual bool Do()=0
GUICommand
Definition: GUICommand.hh:43
GUICommand::GUICommand
GUICommand(std::string name, wxWindow *parent)
Definition: GUICommand.cc:42
GUICommand::~GUICommand
virtual ~GUICommand()
Definition: GUICommand.cc:52
GUICommand::icon
virtual std::string icon() const =0
GUICommand::create
virtual GUICommand * create() const =0
GUICommand::id
virtual int id() const =0
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
GUICommand::shortName
virtual std::string shortName() const
Definition: GUICommand.cc:88