OpenASIP  2.0
ProximMainFrame.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2016 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 ProximMainFrame.hh
26  *
27  * Declaration of ProximMainFrame class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef PROXIM_MAIN_FRAME_HH
34 #define PROXIM_MAIN_FRAME_HH
35 
36 #include <vector>
37 #include <wx/wx.h>
38 #include <wx/splitter.h>
39 #include "SimulatorEvent.hh"
40 #include "Exception.hh"
41 
42 
43 class ConsoleWindow;
45 class wxProgressDialog;
46 
47 /**
48  * Main window of the Proxim application.
49  *
50  * ProximMainFrame is the top level window of the Proxim window hierarchy.
51  * This class is responsible for managing the simulation windows. All
52  * simulator backend events are passed to all subwindows. This class is
53  * also responsible for the menubar and executing command registry commands
54  * corresponding to the menu bar item ids. All subwindows are handled as
55  * wxPanels, and the simulator events are passed as custom wxEvents
56  * (see SimulatorEvent class).
57  */
58 class ProximMainFrame : public wxFrame {
59 public:
61  const wxString& title, const wxPoint& pos, const wxSize& size);
62 
63  virtual ~ProximMainFrame();
64 
65  void addSubWindow(ProximSimulatorWindow* window);
67  void createToolbar();
68  void createMenubar();
69  void reset();
70 private:
71  void initialize();
72  void dockWindow(wxWindow* window);
73 
74  void onCommandEvent(wxCommandEvent& event);
75  void onToggleWindow(wxCommandEvent& event);
77  void onSimulatorEvent(SimulatorEvent& event);
78  void onKeyEvent(wxKeyEvent& event);
79  void onClose(wxCloseEvent& event);
80  void onStatusTimer(wxTimerEvent& event);
81  void onReset(const SimulatorEvent& event);
82  void updateCommand(wxUpdateUIEvent& event);
83  void updateToggleItem(wxUpdateUIEvent& event);
86  wxString menuAccelerator(int id);
87 
88  /// Toplevel sizer of the window managing the basic layout.
89  wxBoxSizer* sizer_;
90  /// Top level splitter window of the splitted subwindow hierarchy.
91  wxWindow* topSplitter_;
92  /// List of subwindows where to send the simulator events.
93  std::vector<ProximSimulatorWindow*> subwindows;
94 
95  /// Mainframe toolbar.
96  wxToolBar* toolbar_;
97  /// True, if an instance of the stop dialog is currently visible.
99 
100  /// Mutex for the resetCondition_.
101  wxMutex* resetMutex_;
102  /// Condition which is signalled when the subwindow reset is complete.
103  wxCondition* resetCondition_;
104 
105  /// True if the subwindow reset is complete.
106  bool isReset_;
107 
108  DECLARE_EVENT_TABLE()
109 };
110 #endif
ProximMainFrame
Definition: ProximMainFrame.hh:58
ProximMainFrame::topSplitter_
wxWindow * topSplitter_
Top level splitter window of the splitted subwindow hierarchy.
Definition: ProximMainFrame.hh:91
ProximMainFrame::subwindows
std::vector< ProximSimulatorWindow * > subwindows
List of subwindows where to send the simulator events.
Definition: ProximMainFrame.hh:93
Exception.hh
SimulatorEvent.hh
ProximMainFrame::ProximMainFrame
ProximMainFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
ProximMainFrame::onClose
void onClose(wxCloseEvent &event)
Definition: ProximMainFrame.cc:924
ProximMainFrame::toolbar_
wxToolBar * toolbar_
Mainframe toolbar.
Definition: ProximMainFrame.hh:96
ProximMainFrame::onReset
void onReset(const SimulatorEvent &event)
Definition: ProximMainFrame.cc:1002
ProximMainFrame::onToggleWindow
void onToggleWindow(wxCommandEvent &event)
Definition: ProximMainFrame.cc:691
ProximMainFrame::onStatusTimer
void onStatusTimer(wxTimerEvent &event)
ProximMainFrame::reset
void reset()
Definition: ProximMainFrame.cc:1016
ProximMainFrame::updateMemoryWindowMenuItem
void updateMemoryWindowMenuItem()
Definition: ProximMainFrame.cc:980
ProximMainFrame::onSimulatorTerminated
void onSimulatorTerminated(SimulatorEvent &event)
Definition: ProximMainFrame.cc:214
ProximSimulatorWindow
Definition: ProximSimulatorWindow.hh:47
ProximMainFrame::updateSimulationStatus
void updateSimulationStatus()
Definition: ProximMainFrame.cc:946
ProximMainFrame::resetCondition_
wxCondition * resetCondition_
Condition which is signalled when the subwindow reset is complete.
Definition: ProximMainFrame.hh:103
ProximMainFrame::createMenubar
void createMenubar()
Definition: ProximMainFrame.cc:223
ProximMainFrame::updateCommand
void updateCommand(wxUpdateUIEvent &event)
Definition: ProximMainFrame.cc:815
ProximMainFrame::onKeyEvent
void onKeyEvent(wxKeyEvent &event)
Definition: ProximMainFrame.cc:910
ProximMainFrame::initialize
void initialize()
Definition: ProximMainFrame.cc:188
ProximMainFrame::onCommandEvent
void onCommandEvent(wxCommandEvent &event)
Definition: ProximMainFrame.cc:490
ProximMainFrame::addSubWindow
void addSubWindow(ProximSimulatorWindow *window)
Definition: ProximMainFrame.cc:666
ProximMainFrame::dockWindow
void dockWindow(wxWindow *window)
Definition: ProximMainFrame.cc:514
ProximMainFrame::~ProximMainFrame
virtual ~ProximMainFrame()
Definition: ProximMainFrame.cc:176
ProximMainFrame::resetMutex_
wxMutex * resetMutex_
Mutex for the resetCondition_.
Definition: ProximMainFrame.hh:101
ProximMainFrame::createToolbar
void createToolbar()
Definition: ProximMainFrame.cc:420
ProximMainFrame::onSimulatorEvent
void onSimulatorEvent(SimulatorEvent &event)
Definition: ProximMainFrame.cc:551
ProximMainFrame::isReset_
bool isReset_
True if the subwindow reset is complete.
Definition: ProximMainFrame.hh:106
ProximMainFrame::sizer_
wxBoxSizer * sizer_
Toplevel sizer of the window managing the basic layout.
Definition: ProximMainFrame.hh:89
SimulatorEvent
Definition: SimulatorEvent.hh:42
ProximMainFrame::menuAccelerator
wxString menuAccelerator(int id)
Definition: ProximMainFrame.cc:448
ProximMainFrame::removeSubWindow
void removeSubWindow(ProximSimulatorWindow *window)
Definition: ProximMainFrame.cc:678
ProximMainFrame::stopDialogInstantiated_
bool stopDialogInstantiated_
True, if an instance of the stop dialog is currently visible.
Definition: ProximMainFrame.hh:98
ProximMainFrame::updateToggleItem
void updateToggleItem(wxUpdateUIEvent &event)
Definition: ProximMainFrame.cc:841
ConsoleWindow
Definition: ConsoleWindow.hh:51