OpenASIP 2.2
Loading...
Searching...
No Matches
ConsoleWindow.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 ConsoleWindow.hh
26 *
27 * Declaration of ConsoleWindow class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#ifndef CONSOLE_WINDOW_HH
34#define CONSOLE_WINDOW_HH
35
36#include <wx/wx.h>
37#include <string>
38#include "SimulatorEvent.hh"
40
42class ProximMainFrame;
43
44/**
45 * Simulator console window class.
46 *
47 * ConsoleWindow is a console with a multiline textual output window,
48 * and a singleline textual input widget. Commands are requested from
49 * the console window using SimulatorEvents.
50 */
52public:
53 ConsoleWindow(ProximMainFrame* parent, wxWindowID id);
54 virtual ~ConsoleWindow();
55 virtual void reset();
56 void write(std::string text);
57 void clear();
58
59private:
60 virtual void onSimulatorBusy(SimulatorEvent& event);
61 virtual void onSimulatorDone(SimulatorEvent& event);
62
63 void createContents();
64 void onSimulatorOutput(const SimulatorEvent& event);
65 void onError(const SimulatorEvent& event);
66 void textEntered(wxCommandEvent& event);
67 void onInputKey(wxKeyEvent& event);
68 /// Output text control.
69 wxTextCtrl* outTextCtrl_;
70 /// Input text control.
71 wxTextCtrl* inTextCtrl_;
72 /// Linereader to send the user input to.
74 /// Stores the command history iterator, used for command history browsing.
76
77 /// IDs for the window widgets.
78 enum {
79 ID_INPUT = 20000,
81 };
82
83 /**
84 * Text input widget for the console.
85 *
86 * This derived wxTextCtrl passes all key events through the parent
87 * console's key event handler. Event passing makes it possible to hook
88 * special keys such as browsing command history with up/down arrow keys.
89 */
90 class ConsoleWindowInputCtrl : public wxTextCtrl {
91 public:
94 private:
95 void onKeyDown(wxKeyEvent& event);
96 /// Parent console of the widget.
98
99 DECLARE_EVENT_TABLE()
100 };
101
102 DECLARE_EVENT_TABLE()
103
104};
105
106#endif
ConsoleWindow * console_
Parent console of the widget.
virtual void onSimulatorDone(SimulatorEvent &event)
virtual void onSimulatorBusy(SimulatorEvent &event)
void onSimulatorOutput(const SimulatorEvent &event)
virtual ~ConsoleWindow()
ProximLineReader * lineReader_
Linereader to send the user input to.
void textEntered(wxCommandEvent &event)
wxTextCtrl * inTextCtrl_
Input text control.
void onInputKey(wxKeyEvent &event)
int historyIterator_
Stores the command history iterator, used for command history browsing.
void write(std::string text)
wxTextCtrl * outTextCtrl_
Output text control.
void onError(const SimulatorEvent &event)
virtual void reset()