41string GUISelectorHController::CONDITION_DISABLED =
"disabled";
42string GUISelectorHController::CONDITION_ENABLED =
"enabled";
44GUISelectorHController::GUISelectorHController(
GUINode* node)
47 this->
disabled = required_dynamic_cast<GUIElementNode*>(
node)->isDisabled();
57 auto& nodeConditions = required_dynamic_cast<GUIElementNode*>(
node)->getActiveConditions();
66 GUIElementController::initialize();
80 if (
node == leftArrowNode) {
81 selectorHController->selectPrevious();
83 if (
node == rightArrowNode) {
84 selectorHController->selectNext();
95 : selectorHController(selectorHController)
96 , leftArrowNode(leftArrowNode)
97 , rightArrowNode(rightArrowNode) {
115 GUIElementController::dispose();
144 auto selectedSelectorHOptionElementController = selectedSelectorHOptionElementNode->
getController();
147 if (selectorHOptionController == selectedSelectorHOptionElementController) {
157 vector<GUINode*> childControllerNodes;
159 required_dynamic_cast<GUIParentNode*>(
node)->getChildControllerNodes(childControllerNodes);
160 for (
auto i = 0; i < childControllerNodes.size(); i++) {
161 auto childControllerNode = childControllerNodes[i];
173 auto disabledCount = 0;
196 auto disabledCount = 0;
215 GUIElementController::handleMouseEvent(
node, event);
219 if (event->
getType() == GUIMouseEvent::MOUSEEVENT_RELEASED) {
220 auto elementNode = required_dynamic_cast<GUIElementNode*>(this->node);
230 GUIElementController::handleKeyboardEvent(event);
233 case GUIKeyboardEvent::KEYCODE_LEFT: {
234 event->setProcessed(
true);
235 if (event->
getType() == GUIKeyboardEvent::KEYBOARDEVENT_KEY_PRESSED) {
240 case GUIKeyboardEvent::KEYCODE_RIGHT: {
241 event->setProcessed(
true);
242 if (event->
getType() == GUIKeyboardEvent::KEYBOARDEVENT_KEY_PRESSED) {
252 GUIElementController::tick();
280 auto selectorHOptionNode = required_dynamic_cast<GUIElementNode*>(selectorHOptionController->getNode());
281 if (
value.
equals(selectorHOptionNode->getValue())) {
294 auto selectorHOptionNode = required_dynamic_cast<GUIElementNode*>(selectorHOptionController->getNode());
295 selectorHOptionController->unselect();
296 if (selectorHOptionNode->isSelected() ==
true) {
void setFoccussedNode(GUIElementNode *newFoccussedNode)
Set focussed node.
GUI selector horizontal controller.
void onFocusGained() override
On focus gained.
void dispose() override
Dispose controller.
void postLayout() override
Post layout event.
GUIParentNode * innerNode
vector< GUISelectorHOptionController * > selectorHOptionControllers
void initialize() override
Initialize controller after element has been created.
void handleKeyboardEvent(GUIKeyboardEvent *event) override
Handle keyboard event.
void selectNext()
Select next node.
void onFocusLost() override
On focus lost.
void setValue(const MutableString &value) override
Set value.
void handleMouseEvent(GUINode *node, GUIMouseEvent *event) override
Handle mouse event.
void tick() override
Tick method will be executed once per frame.
static STATIC_DLL_IMPEXT string CONDITION_DISABLED
static STATIC_DLL_IMPEXT string CONDITION_ENABLED
void setDisabled(bool disabled) override
Set disabled.
const MutableString & getValue() override
bool isDisabled() override
void onSubTreeChange() override
On sub tree change.
void select(int idx)
Select by index.
int selectedHOptionControllerIdx
GUIActionListener * actionListener
void determineSelectorHOptionControllers()
Determine drop down option controllers.
void selectPrevious()
Select previous.
GUI selector horizontal option controller.
GUIKeyboardEventType getType()
GUIMouseEventType getType()
GUI element node conditions.
virtual GUINode * getNode()
bool isEventBelongingToNode(GUIMouseEvent *event, Vector2 &position)
Is event belonging to node.
GUIScreenNode * getScreenNode()
GUINodeController * getController()
GUI parent node base class thats supporting child nodes.
GUI screen node that represents a screen that can be rendered via GUI system.
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
void removeActionListener(GUIActionListener *listener)
Remove action listener.
void addActionListener(GUIActionListener *listener)
Add action listener.
GUINode * getInnerNodeById(const string &nodeId)
Get inner GUI node by id.
MutableString & append(char c)
Append character.
MutableString & reset()
Reset.
bool equals(const string &s2) const
Equals.
GUI action listener interface.