OpenASIP 2.2
Loading...
Searching...
No Matches
OptionsDialog.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 OptionsDialog.hh
26 *
27 * Declaration of OptionsDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_OPTIONS_DIALOG_HH
34#define TTA_OPTIONS_DIALOG_HH
35
36#include <string>
37#include <wx/wx.h>
38#include <wx/notebook.h>
39#include <wx/listctrl.h>
40#include <wx/spinctrl.h>
41#include <vector>
42
43class ToolbarButton;
45class GUIOptions;
46class wxListCtrl;
47class CommandRegistry;
48
49/**
50 * Dialog for editing GUIOptions.
51 *
52 * This class allows modification of options in the GUIOptions class.
53 * If an application uses custom options class derived from the GUIOptions
54 * class, this class can be used as a base class for the application specific
55 * options dialog. To customize the derived dialog, override readOptions and
56 * writeOptions. Controls for modifying the application specific options can
57 * be added by creating a wxPanel containing the controls, and adding it to
58 * the dialog as a tab using the addPage method.
59 */
60class OptionsDialog : public wxDialog {
61public:
63 wxWindow* parent,
65 CommandRegistry& commandRegisry);
66
67 virtual ~OptionsDialog();
68
69protected:
70 void addPage(wxPanel* page, const wxString& title);
71 virtual void readOptions();
72 virtual void writeOptions();
73
74 /// Notebook containing dialog pages.
75 wxNotebook* notebook_;
76
77
78private:
79
80 virtual wxSizer* createContents(
81 wxWindow* parent, bool callFit, bool set_sizer);
82
83 void readCommands();
84 void initialize();
85
86 void onShortcutSelection(wxListEvent& event);
87 void onToolbarSelection(wxListEvent& event);
88 void onCommandSelection(wxListEvent& event);
89
90 void onDeleteShortcut(wxCommandEvent& event);
91 void onActivateShortcut(wxListEvent& event);
92 void onEditShortcut(wxCommandEvent& event);
93 void onShortcutRightClick(wxListEvent& event);
94 void onInsertTool(wxCommandEvent& event);
95 void onRemoveTool(wxCommandEvent& event);
96 void onMoveTool(wxCommandEvent& event);
97 void onOK(wxCommandEvent& event);
98 void onHelp(wxCommandEvent& event);
99 void setTexts();
100
101 virtual bool TransferDataToWindow();
102
103 wxSizer* createKBShortcutPage(
104 wxWindow* parent, bool callFit, bool set_sizer);
105 wxSizer* createToolbarPage(
106 wxWindow* parent, bool callFit, bool set_sizer);
107
108 /**
109 * Describes a keyboard shortcut.
110 */
111 struct Shortcut {
112 std::string name; ///< Name of the command.
113 int id; ///< ID of the command.
114 KeyboardShortcut* shortcut; ///< A keyboard shortcut.
115 };
116
118
119 /// parent window of the dialog
120 wxWindow* parent_;
121 /// current editor options
123 /// Keyboard shortcut list control.
124 wxListCtrl* shortcutList_;
125 /// Toolbar buttons list control.
126 wxListCtrl* toolbarList_;
127 /// List control for commands not in the toolbar.
128 wxListCtrl* commandList_;
129 // Toolbar contents choicer item variable
131
132 /// Keyboard shortcuts.
133 std::vector<Shortcut*> shortcuts_;
134 /// Toolbar buttons and separators.
135 std::vector<std::string> toolbar_;
136
137 /// Command registry containing available commands for shortcuts.
139
140 // control IDs
141 enum {
142 ID_NOTEBOOK = 10000,
157 };
158
159 /// Title of the keyboard shortcut list command name column.
160 static const wxString COMMAND_COLUMN_TITLE;
161 /// Title of the keyboard shortcut list shortcut column.
162 static const wxString SHORTCUT_COLUMN_TITLE;
163 /// Title of the toolbar tab toolbar button list.
164 static const wxString TOOLBAR_BUTTONS_COLUMN_TITLE;
165 /// Title of the toolbar tab available commands list.
166 static const wxString AVAILABLE_COMMANDS_COLUMN_TITLE;
167 /// Text fot the toolbar contents choicer icon-mode item.
168 static const wxString CONTENTS_ICONS;
169 /// Text for the toolbar contents choicer icon&text mode item.
170 static const wxString CONTENTS_BOTH;
171 /// Text for the toolbar contents choicer text-mode item.
172 static const wxString CONTENTS_TEXT;
173
174 /// Label for Edit-button.
175 static const wxString EDIT_BUTTON_LABEL;
176 /// Label for delete-button.
177 static const wxString DELETE_BUTTON_LABEL;
178
179 /// The event table for the controls of the dialog.
180 DECLARE_EVENT_TABLE()
181};
182
183#endif
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
void onShortcutSelection(wxListEvent &event)
static const wxString CONTENTS_BOTH
Text for the toolbar contents choicer icon&text mode item.
wxListCtrl * commandList_
List control for commands not in the toolbar.
Shortcut * selectedShortcut()
void onCommandSelection(wxListEvent &event)
wxSizer * createToolbarPage(wxWindow *parent, bool callFit, bool set_sizer)
void onOK(wxCommandEvent &event)
void onRemoveTool(wxCommandEvent &event)
static const wxString CONTENTS_ICONS
Text fot the toolbar contents choicer icon-mode item.
virtual wxSizer * createContents(wxWindow *parent, bool callFit, bool set_sizer)
GUIOptions & options_
current editor options
void onHelp(wxCommandEvent &event)
virtual void readOptions()
void onInsertTool(wxCommandEvent &event)
static const wxString CONTENTS_TEXT
Text for the toolbar contents choicer text-mode item.
void onShortcutRightClick(wxListEvent &event)
virtual void writeOptions()
virtual bool TransferDataToWindow()
wxWindow * parent_
parent window of the dialog
wxSizer * createKBShortcutPage(wxWindow *parent, bool callFit, bool set_sizer)
void onDeleteShortcut(wxCommandEvent &event)
std::vector< Shortcut * > shortcuts_
Keyboard shortcuts.
void addPage(wxPanel *page, const wxString &title)
static const wxString EDIT_BUTTON_LABEL
Label for Edit-button.
wxListCtrl * shortcutList_
Keyboard shortcut list control.
static const wxString TOOLBAR_BUTTONS_COLUMN_TITLE
Title of the toolbar tab toolbar button list.
void onMoveTool(wxCommandEvent &event)
std::vector< std::string > toolbar_
Toolbar buttons and separators.
CommandRegistry & commandRegistry_
Command registry containing available commands for shortcuts.
static const wxString AVAILABLE_COMMANDS_COLUMN_TITLE
Title of the toolbar tab available commands list.
void onToolbarSelection(wxListEvent &event)
void onActivateShortcut(wxListEvent &event)
wxNotebook * notebook_
Notebook containing dialog pages.
wxListCtrl * toolbarList_
Toolbar buttons list control.
void onEditShortcut(wxCommandEvent &event)
static const wxString SHORTCUT_COLUMN_TITLE
Title of the keyboard shortcut list shortcut column.
static const wxString COMMAND_COLUMN_TITLE
Title of the keyboard shortcut list command name column.
static const wxString DELETE_BUTTON_LABEL
Label for delete-button.
virtual ~OptionsDialog()
KeyboardShortcut * shortcut
A keyboard shortcut.
int id
ID of the command.
std::string name
Name of the command.