NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class represents a window, which can be created by the user during run-time by using a layout script and the window
command.
More...
#include <customwindow.hpp>
Public Types | |
enum | WindowItemType { CHECKBOX , TEXT , TEXTCTRL , TREELIST , SPINCTRL , BUTTON , RADIOGROUP , DROPDOWN , COMBOBOX , GAUGE , IMAGE , TABLE , GRAPHER , SLIDER , MENUITEM } |
Public Member Functions | |
CustomWindow (wxWindow *parent, const NumeRe::Window &windowRef) | |
CustomWindow constructor. Connects this window with the NumeRe::Window instance and triggers the layouting algorithm. More... | |
std::vector< int > | getWindowItems (WindowItemType _type) const |
Returns a list of all window item IDs, which correspond to the selected WindowItemType. More... | |
bool | closeWindow () |
Close this window. More... | |
WindowItemValue | getItemValue (int windowItemID) const |
Get the value of the selected item. More... | |
wxString | getItemLabel (int windowItemID) const |
Get the label of the selected item. More... | |
wxString | getItemState (int windowItemID) const |
Get the state of the selected item. More... | |
wxString | getItemColor (int windowItemID) const |
Get the color of the selected item. More... | |
wxString | getPropValue (const wxString &varName) const |
Returns the value of the selected window property. More... | |
wxString | getProperties () const |
Returns a list of all available window properties. More... | |
bool | setItemValue (WindowItemValue &_value, int windowItemID) |
Change the value of the selected item. More... | |
bool | setItemLabel (const wxString &_label, int windowItemID) |
Change the label of the selected item. More... | |
bool | setItemState (const wxString &_state, int windowItemID) |
Change the state of the selected item. More... | |
bool | setItemColor (const wxString &_color, int windowItemID) |
Change the color of the selected item. More... | |
bool | setItemGraph (GraphHelper *_helper, int windowItemID) |
Updates the selected grapher item. More... | |
bool | setPropValue (const wxString &_value, const wxString &varName) |
Sets the value of the selected window property. More... | |
void | OnMenuEvent (wxCommandEvent &event) |
Menu event handler. More... | |
void | OnClick (wxCommandEvent &event) |
Button click event handler. More... | |
void | OnChange (wxCommandEvent &event) |
Generic onchange event handler. More... | |
void | OnSpin (wxSpinEvent &event) |
wxSpinCtrl event handler. More... | |
void | OnCellSelect (wxGridEvent &event) |
wxGrid event handler. More... | |
void | OnClose (wxCloseEvent &event) |
OnClose event handler. More... | |
void | OnMouseLeftDown (wxMouseEvent &event) |
Mouse event handler. More... | |
void | OnTreeListEvent (wxTreeListEvent &event) |
Tree list control event handler. More... | |
void | OnSizeEvent (wxSizeEvent &event) |
On size event handler. More... | |
DECLARE_EVENT_TABLE () | |
Private Member Functions | |
void | layout () |
This member function evaluates the layout supplied by the user via a tinyxml2::XMLDocument instance. More... | |
void | layoutChild (const tinyxml2::XMLElement *currentChild, wxWindow *currParent, wxSizer *currSizer, GroupPanel *_groupPanel) |
This member function can be called recursively and creates the layout for the current XMLElement's children. More... | |
void | layoutMenu (const tinyxml2::XMLElement *currentChild, wxMenu *currMenu) |
This member function can be called recursively and creates menus and submenus for the current window layout. More... | |
void | handleEvent (wxEvent &event, const wxString &sEventType) |
This member function is the central kernel interaction event handler. Will be called from the wxWidgets' event handler and all the registered procedures (if any). More... | |
bool | getWindowParameters (WindowItemParams ¶ms) const |
Returns the parameters of this window. More... | |
bool | getItemParameters (int windowItemID, WindowItemParams ¶ms) const |
Returns the parameters of the selected window item. More... | |
wxArrayString | getChoices (wxString &choices) const |
A simple tokenizer to separate a list of strings into multiple strings. More... | |
wxArrayString | decodeEventHandlerFunction (const wxString &sEventHandler) const |
This member function decodes the arguments of a event handler function and returns them as a wxArrayString. More... | |
wxString | removeQuotationMarks (wxString sString) const |
Private member function to convert a kernel string into a usual string. More... | |
void | Refresh () |
Wrapper for wxWindow::Refresh to use it together with CallAfter(). More... | |
Private Attributes | |
std::map< int, std::pair< WindowItemType, wxObject * > > | m_windowItems |
std::map< int, wxString > | m_eventTable |
std::map< wxString, wxString > | m_varTable |
NumeRe::Window | m_windowRef |
This class represents a window, which can be created by the user during run-time by using a layout script and the window
command.
Definition at line 71 of file customwindow.hpp.
Enumerator | |
---|---|
CHECKBOX | |
TEXT | |
TEXTCTRL | |
TREELIST | |
SPINCTRL | |
BUTTON | |
RADIOGROUP | |
DROPDOWN | |
COMBOBOX | |
GAUGE | |
IMAGE | |
TABLE | |
GRAPHER | |
SLIDER | |
MENUITEM |
Definition at line 74 of file customwindow.hpp.
CustomWindow::CustomWindow | ( | wxWindow * | parent, |
const NumeRe::Window & | windowRef | ||
) |
CustomWindow constructor. Connects this window with the NumeRe::Window instance and triggers the layouting algorithm.
parent | wxWindow* |
windowRef | const NumeRe::Window& |
Definition at line 266 of file customwindow.cpp.
bool CustomWindow::closeWindow | ( | ) |
Close this window.
Definition at line 1494 of file customwindow.cpp.
Referenced by NumeRe::Window::closeWindow(), and handleEvent().
CustomWindow::DECLARE_EVENT_TABLE | ( | ) |
|
private |
This member function decodes the arguments of a event handler function and returns them as a wxArrayString.
sEventHandler | const wxString& |
Definition at line 1410 of file customwindow.cpp.
References getChoices().
Referenced by handleEvent().
|
private |
A simple tokenizer to separate a list of strings into multiple strings.
choices | wxString& |
Definition at line 1376 of file customwindow.cpp.
References removeQuotationMarks().
Referenced by decodeEventHandlerFunction(), layoutChild(), setItemLabel(), and setItemValue().
wxString CustomWindow::getItemColor | ( | int | windowItemID | ) | const |
Get the color of the selected item.
windowItemID | int |
Definition at line 1575 of file customwindow.cpp.
References WindowItemParams::color, and getItemParameters().
Referenced by NumeRe::Window::getItemColor().
wxString CustomWindow::getItemLabel | ( | int | windowItemID | ) | const |
Get the label of the selected item.
windowItemID | int |
Definition at line 1534 of file customwindow.cpp.
References getItemParameters(), and WindowItemParams::label.
Referenced by NumeRe::Window::getItemLabel().
|
private |
Returns the parameters of the selected window item.
windowItemID | int |
params | WindowItemParams& |
Definition at line 1211 of file customwindow.cpp.
References BUTTON, CHECKBOX, WindowItemParams::color, COMBOBOX, convertToCodeString(), DROPDOWN, GAUGE, wxMGL::getClickedCoords(), wxTreeListCtrl::GetColumn(), wxTreeListCtrl::GetColumnCount(), TableViewer::GetDataCopy(), TableViewer::getSelectedValues(), getTreeListCtrlValue(), getWindowParameters(), GRAPHER, IMAGE, WindowItemParams::label, m_windowItems, MENUITEM, RADIOGROUP, SLIDER, SPINCTRL, WindowItemParams::state, WindowItemParams::table, TABLE, TEXT, TEXTCTRL, toWxString(), TREELIST, WindowItemParams::type, and WindowItemParams::value.
Referenced by getItemColor(), getItemLabel(), getItemState(), getItemValue(), and handleEvent().
wxString CustomWindow::getItemState | ( | int | windowItemID | ) | const |
Get the state of the selected item.
windowItemID | int |
Definition at line 1557 of file customwindow.cpp.
References getItemParameters(), and WindowItemParams::state.
Referenced by NumeRe::Window::getItemState().
WindowItemValue CustomWindow::getItemValue | ( | int | windowItemID | ) | const |
Get the value of the selected item.
windowItemID | int |
Definition at line 1507 of file customwindow.cpp.
References getItemParameters(), WindowItemValue::stringValue, WindowItemParams::table, WindowItemValue::tableValue, WindowItemParams::type, WindowItemValue::type, and WindowItemParams::value.
Referenced by NumeRe::Window::getItemValue().
wxString CustomWindow::getProperties | ( | ) | const |
Returns a list of all available window properties.
Definition at line 1612 of file customwindow.cpp.
References m_varTable.
Referenced by NumeRe::Window::getProperties().
wxString CustomWindow::getPropValue | ( | const wxString & | varName | ) | const |
Returns the value of the selected window property.
varName | const wxString& |
Definition at line 1594 of file customwindow.cpp.
References m_varTable.
Referenced by NumeRe::Window::getPropValue().
std::vector< int > CustomWindow::getWindowItems | ( | CustomWindow::WindowItemType | _type | ) | const |
Returns a list of all window item IDs, which correspond to the selected WindowItemType.
_type | CustomWindow::WindowItemType |
Definition at line 1474 of file customwindow.cpp.
References m_windowItems.
Referenced by NumeRe::Window::getWindowItems().
|
private |
Returns the parameters of this window.
params | WindowItemParams& |
Definition at line 1190 of file customwindow.cpp.
References WindowItemParams::color, WindowItemParams::label, WindowItemParams::state, toWxString(), WindowItemParams::type, and WindowItemParams::value.
Referenced by getItemParameters().
|
private |
This member function is the central kernel interaction event handler. Will be called from the wxWidgets' event handler and all the registered procedures (if any).
event | wxEvent& |
sEventType | const wxString& |
Definition at line 1084 of file customwindow.cpp.
References closeWindow(), decodeEventHandlerFunction(), NumeRe::Window::getId(), getItemParameters(), m_eventTable, m_windowRef, NumeReWindow::pass_command(), setItemState(), setItemValue(), WindowItemParams::state, WindowItemValue::stringValue, WindowItemParams::table, WindowItemValue::tableValue, toString(), WindowItemParams::type, WindowItemValue::type, and WindowItemParams::value.
Referenced by OnCellSelect(), OnChange(), OnClick(), OnClose(), OnMenuEvent(), OnMouseLeftDown(), OnSpin(), and OnTreeListEvent().
|
private |
This member function evaluates the layout supplied by the user via a tinyxml2::XMLDocument instance.
Definition at line 282 of file customwindow.cpp.
References tinyxml2::XMLElement::Attribute(), tinyxml2::XMLNode::FirstChild(), tinyxml2::XMLNode::FirstChildElement(), NumeRe::Window::getLayout(), GroupPanel::getMainSizer(), layoutChild(), m_windowRef, OnMouseLeftDown(), and tinyxml2::XMLNode::ToElement().
|
private |
This member function can be called recursively and creates the layout for the current XMLElement's children.
currentChild | const tinyxml2::XMLElement* |
currParent | wxWindow* |
currSizer | wxSizer* |
_groupPanel | GroupPanel* |
Definition at line 368 of file customwindow.cpp.
References GroupPanel::AddSpacer(), GroupPanel::AddStaticText(), wxTreeListCtrl::AppendItem(), tinyxml2::XMLElement::Attribute(), BUTTON, CHECKBOX, COMBOBOX, GroupPanel::CreateBitmap(), GroupPanel::CreateButton(), GroupPanel::CreateCheckBox(), GroupPanel::CreateChoices(), GroupPanel::createCollapsibleGroup(), GroupPanel::CreateComboBox(), GroupPanel::CreateGauge(), GroupPanel::createGroup(), GroupPanel::CreateRadioBox(), GroupPanel::CreateSlider(), GroupPanel::CreateSpinControl(), GroupPanel::CreateTextInput(), GroupPanel::CreateTreeListCtrl(), DISABLED, tinyxml2::XMLElement::DoubleAttribute(), DROPDOWN, SpinBut::Enable(), TextField::Enable(), ENABLED, tinyxml2::XMLNode::FirstChildElement(), GAUGE, getChoices(), GroupPanel::getMainSizer(), wxTreeListCtrl::GetRootItem(), tinyxml2::XMLElement::GetText(), GRAPHER, HIDDEN, IMAGE, tinyxml2::XMLElement::IntAttribute(), layoutChild(), layoutMenu(), m_eventTable, m_varTable, m_windowItems, name, tinyxml2::XMLNode::NextSibling(), populateTreeListCtrl(), RADIOGROUP, removeQuotationMarks(), TableViewer::SetData(), wxTreeListCtrl::SetFont(), TableViewer::SetTableReadOnly(), SpinBut::Show(), TextField::Show(), SLIDER, SPINCTRL, TABLE, TEXT, TEXTCTRL, tinyxml2::XMLNode::ToElement(), toWxColour(), TREELIST, and tinyxml2::XMLNode::Value().
Referenced by layout(), and layoutChild().
|
private |
This member function can be called recursively and creates menus and submenus for the current window layout.
currentChild | const tinyxml2::XMLElement* |
currMenu | wxMenu* |
Definition at line 953 of file customwindow.cpp.
References tinyxml2::XMLElement::Attribute(), DISABLED, tinyxml2::XMLElement::DoubleAttribute(), ENABLED, tinyxml2::XMLNode::FirstChildElement(), tinyxml2::XMLElement::GetText(), layoutMenu(), m_eventTable, m_windowItems, MENUITEM, tinyxml2::XMLNode::NextSibling(), removeQuotationMarks(), tinyxml2::XMLNode::ToElement(), toWxColour(), and tinyxml2::XMLNode::Value().
Referenced by layoutChild(), and layoutMenu().
void CustomWindow::OnCellSelect | ( | wxGridEvent & | event | ) |
wxGrid event handler.
event | wxGridEvent& |
Definition at line 2079 of file customwindow.cpp.
References convertToCodeString(), handleEvent(), and m_windowItems.
void CustomWindow::OnChange | ( | wxCommandEvent & | event | ) |
Generic onchange event handler.
event | wxCommandEvent& |
Definition at line 2050 of file customwindow.cpp.
References handleEvent(), m_windowItems, and SPINCTRL.
void CustomWindow::OnClick | ( | wxCommandEvent & | event | ) |
Button click event handler.
event | wxCommandEvent& |
Definition at line 2037 of file customwindow.cpp.
References handleEvent().
void CustomWindow::OnClose | ( | wxCloseEvent & | event | ) |
OnClose event handler.
event | wxCloseEvent& |
Definition at line 2093 of file customwindow.cpp.
References handleEvent(), m_windowRef, NumeRe::STATUS_CANCEL, and NumeRe::Window::updateWindowInformation().
void CustomWindow::OnMenuEvent | ( | wxCommandEvent & | event | ) |
Menu event handler.
event | wxCommandEvent& |
Definition at line 2024 of file customwindow.cpp.
References handleEvent().
void CustomWindow::OnMouseLeftDown | ( | wxMouseEvent & | event | ) |
Mouse event handler.
event | wxMouseEvent& |
Definition at line 2109 of file customwindow.cpp.
References handleEvent().
Referenced by layout().
void CustomWindow::OnSizeEvent | ( | wxSizeEvent & | event | ) |
On size event handler.
event | wxSizeEvent& |
Definition at line 2139 of file customwindow.cpp.
References Refresh().
void CustomWindow::OnSpin | ( | wxSpinEvent & | event | ) |
wxSpinCtrl event handler.
event | wxSpinEvent& |
Definition at line 2066 of file customwindow.cpp.
References handleEvent().
void CustomWindow::OnTreeListEvent | ( | wxTreeListEvent & | event | ) |
Tree list control event handler.
event | wxTreeListEvent& |
Definition at line 2122 of file customwindow.cpp.
References handleEvent(), and m_windowItems.
|
private |
Wrapper for wxWindow::Refresh to use it together with CallAfter().
Definition at line 1459 of file customwindow.cpp.
Referenced by OnSizeEvent(), setItemColor(), and setItemValue().
|
private |
Private member function to convert a kernel string into a usual string.
sString | wxString |
Definition at line 1438 of file customwindow.cpp.
Referenced by getChoices(), layoutChild(), layoutMenu(), setItemLabel(), and setItemValue().
bool CustomWindow::setItemColor | ( | const wxString & | _color, |
int | windowItemID | ||
) |
Change the color of the selected item.
_color | const wxString& |
windowItemID | int |
Definition at line 1900 of file customwindow.cpp.
References BUTTON, CHECKBOX, COMBOBOX, DROPDOWN, GAUGE, GRAPHER, IMAGE, m_windowItems, MENUITEM, RADIOGROUP, Refresh(), SLIDER, SPINCTRL, TABLE, TEXT, TEXTCTRL, toWxColour(), and TREELIST.
Referenced by NumeRe::Window::setItemColor().
bool CustomWindow::setItemGraph | ( | GraphHelper * | _helper, |
int | windowItemID | ||
) |
Updates the selected grapher item.
_helper | GraphHelper* |
windowItemID | int |
Definition at line 1971 of file customwindow.cpp.
References wxMGL::AnimateAsynch(), wxMGL::Animation(), wxMGL::getNumFrames(), GRAPHER, m_windowItems, wxMGL::SetDraw(), wxMGL::SetGraph(), GraphHelper::setGrapher(), and wxMGL::SetSize().
Referenced by NumeRe::Window::setItemGraph().
bool CustomWindow::setItemLabel | ( | const wxString & | _label, |
int | windowItemID | ||
) |
Change the label of the selected item.
_label | const wxString& |
windowItemID | int |
Definition at line 1777 of file customwindow.cpp.
References BUTTON, CHECKBOX, COMBOBOX, DROPDOWN, GAUGE, getChoices(), wxTreeListCtrl::GetColumn(), wxTreeListCtrl::GetColumnCount(), GRAPHER, IMAGE, m_windowItems, MENUITEM, RADIOGROUP, removeQuotationMarks(), SLIDER, SPINCTRL, TABLE, TEXT, TEXTCTRL, and TREELIST.
Referenced by NumeRe::Window::setItemLabel().
bool CustomWindow::setItemState | ( | const wxString & | _state, |
int | windowItemID | ||
) |
Change the state of the selected item.
_state | const wxString& |
windowItemID | int |
Definition at line 1851 of file customwindow.cpp.
References m_windowItems, and MENUITEM.
Referenced by handleEvent(), and NumeRe::Window::setItemState().
bool CustomWindow::setItemValue | ( | WindowItemValue & | _value, |
int | windowItemID | ||
) |
Change the value of the selected item.
_value | WindowItemValue& |
windowItemID | int |
Definition at line 1639 of file customwindow.cpp.
References BUTTON, CHECKBOX, COMBOBOX, DROPDOWN, GAUGE, getChoices(), GRAPHER, IMAGE, m_windowItems, MENUITEM, populateTreeListCtrl(), RADIOGROUP, Refresh(), removeQuotationMarks(), TableViewer::SetData(), SLIDER, SPINCTRL, WindowItemValue::stringValue, TABLE, WindowItemValue::tableValue, TEXT, TEXTCTRL, and TREELIST.
Referenced by handleEvent(), and NumeRe::Window::setItemValue().
bool CustomWindow::setPropValue | ( | const wxString & | _value, |
const wxString & | varName | ||
) |
Sets the value of the selected window property.
_value | const wxString& |
varName | const wxString& |
Definition at line 2003 of file customwindow.cpp.
References m_varTable.
Referenced by NumeRe::Window::setPropValue().
|
private |
Definition at line 95 of file customwindow.hpp.
Referenced by handleEvent(), layoutChild(), and layoutMenu().
|
private |
Definition at line 96 of file customwindow.hpp.
Referenced by getProperties(), getPropValue(), layoutChild(), and setPropValue().
|
private |
Definition at line 94 of file customwindow.hpp.
Referenced by getItemParameters(), getWindowItems(), layoutChild(), layoutMenu(), OnCellSelect(), OnChange(), OnTreeListEvent(), setItemColor(), setItemGraph(), setItemLabel(), setItemState(), and setItemValue().
|
private |
Definition at line 98 of file customwindow.hpp.
Referenced by handleEvent(), layout(), and OnClose().