Go to the documentation of this file.
69 fullScreen_(
false), windowWidth_(400), windowHeight_(400), xPosition_(0),
70 yPosition_(0), toolbarVisibility_(
false), toolbarLayout_(BOTH),
71 modified_(
false), name_(name) {
320 if (*iter == shortcut) {
340 if (*iter == button) {
361 if (*iter == position) {
382 if ((*iter)->action() == commandName) {
530 const string procName =
"GUIOptions::validate";
535 for (
int i = 0; i < buttons + separators; i++) {
536 bool buttonfound =
false;
537 bool separatorfound =
false;
539 while (button != NULL) {
540 if (button->
slot() == i) {
542 string errorMsg =
"There is at least two toolbar items ";
553 for (
int sepIndex = 0; sepIndex < separators; sepIndex++) {
555 if (separatorfound || buttonfound) {
556 string errorMsg =
"There is at least two toolbar items ";
562 separatorfound =
true;
566 if (!buttonfound && !separatorfound) {
567 string errorMsg =
"There is no separator or button at slot "
569 throw InvalidData(__FILE__, __LINE__, procName, errorMsg);
579 string action = observable->
action();
584 if (action == sc->
action() && sc != observable) {
585 string errorMsg =
"Action \'" + action +
"\' is assigned for"
586 +
" two or more keyboard shortcuts.";
587 throw InvalidData(__FILE__, __LINE__, procName, errorMsg);
589 if (observable->
equals(*sc) && observable != sc) {
590 string errorMsg =
"Same keyboard shortcut is used for \'" +
593 throw InvalidData(__FILE__, __LINE__, procName, errorMsg);
646 const string procName =
"GUIOptions::loadState";
672 for (
int i = 0; i < state->
childCount(); i++) {
677 }
else if (child->
name() ==
770 const wxString& iconsPath) {
777 style = wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT;
779 style = wxTB_HORIZONTAL | wxNO_BORDER;
781 style = wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT | wxTB_NOICONS;
787 wxToolBar* toolbar =
new wxToolBar(
788 parent, -1, wxDefaultPosition, wxDefaultSize, style);
802 while (tool != NULL) {
803 if (tool->
slot() == slot) {
807 wxString iconPath = iconsPath;
814 if (!icon.LoadFile(iconPath, wxBITMAP_TYPE_PNG)) {
815 std::cerr <<
"Toolbar icon file "
826 icon, wxNullBitmap, wxITEM_NORMAL,
844 while (separator != -1) {
845 if (separator == slot) {
847 toolbar->AddSeparator();
static const std::string OSNAME_SEPARATOR
ObjectState name for separator.
static const std::string OSNAME_OPTIONS
ObjectState name for the options.
int xPosition_
Default x position of left side of the application window.
KSTable::const_iterator ksIter_
Iterator used in firstShortcut and nextShortcut functions.
void deleteAllKeyboardShortcuts()
bool modified_
Indicates whether the options are modified or not.
static wxString toWxString(const std::string &source)
bool isEnabled(const std::string command)
std::string commandShortName(const std::string name) const
std::string stringAttribute(const std::string &name) const
static const std::string OSNAME_KEYBOARD_SHORTCUT
ObjectState name for keyboard shortcut.
void setWindowSize(int width, int height)
void addToolbarButton(ToolbarButton *button)
ToolbarLayout toolbarLayout_
Layout of the toolbar.
virtual ObjectState * saveState() const
static const std::string OSKEY_POSITION
ObjectState attribute key for separator position.
static const std::string OSKEY_FULL_SCREEN
ObjectState attribute key for full screen feature.
@ ICON
Buttons contains only icon.
void deleteSeparator(int position)
int nextSeparator() const
static const std::string OSKEY_TOOLBAR_VISIBILITY
ObjectState attribute key for toolbar visibility.
static const std::string TOOLBAR_SEPARATOR
Toolbar separator name.
void setToolbarVisibility(bool visible)
static std::string toString(const T &source)
void deleteAllToolbarButtons()
wxToolBar * createToolbar(wxWindow *parent, CommandRegistry ®istry, const wxString &iconsPath)
@ BOTH
Buttons contains text and icon.
KeyboardShortcut * keyboardShortcut(const std::string commandName) const
#define assert(condition)
std::string commandIcon(const std::string name) const
static const std::string OSKEY_Y_POS
ObjectState attribute key for window y position.
virtual void loadState(const ObjectState *state)
ToolbarLayout toolbarLayout() const
void setWindowPosition(int x, int y)
static const std::string OSKEY_WINDOW_HEIGHT
ObjectState attribute key for window height.
TBTable toolbarButtons_
Toolbar buttons.
KeyboardShortcut * firstShortcut() const
bool equals(const KeyboardShortcut &sc) const
void addSeparator(int position)
static const std::string OSVALUE_ICON
ObjectState attribute value for icon layout.
static const std::string OSVALUE_BOTH
ObjectState attribute value for text & icon layout.
std::string action() const
ObjectState * child(int index) const
void addChild(ObjectState *child)
@ TEXT
Buttons contains only text.
std::string fileName() const
ToolbarButton * firstToolbarButton() const
TBTable::const_iterator tbIter_
Iterator used in firstToolbarButton and nextToolbarButton functions.
void setFileName(const std::string &fileName)
static const std::string OSKEY_X_POS
ObjectState attribute key for window x position.
void addKeyboardShortcut(KeyboardShortcut *shortcut)
void setToolbarLayout(ToolbarLayout layout)
virtual void validate() const
int commandId(const std::string name) const
KSTable keyboardShortcuts_
Keyboard shortcuts.
static const std::string DIRECTORY_SEPARATOR
int windowHeight_
Default height of the window.
ToolbarButton * nextToolbarButton() const
KeyboardShortcut * nextShortcut() const
void deleteKeyboardShortcut(KeyboardShortcut *shortcut)
static const std::string OSKEY_WINDOW_WIDTH
ObjectState attribute key for window width.
int firstSeparator() const
find Finds info of the inner loops in the false
static const std::string OSVALUE_TEXT
ObjectState attribute value for text layout.
SeparatorTable toolbarSeparators_
Toolbar separators.
std::string fileName_
File name assigned to these options.
bool fullScreen_
If true, the application window will open in full screen mode.
ObjectState * saveState() const
void setFullScreen(bool fullScreen)
int intAttribute(const std::string &name) const
SeparatorTable::const_iterator separatorIter_
Iterator used in firstSeparator and nextSeparator functions.
static const std::string OSKEY_TOOLBAR_LAYOUT
ObjectState attribute key for toolbar layout.
bool toolbarVisibility() const
GUIOptions(std::string name)
void deleteToolbarButton(ToolbarButton *button)
static std::string toString(const wxString &source)
int yPosition_
Default y position of the upper side of the application window.
bool toolbarVisibility_
If true, the toolbar is visible.
void setAttribute(const std::string &name, const std::string &value)
int windowWidth_
Default width of the window.