From 0ca699b4e7c925fccb44b6d94ba69ed715ab3de7 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 30 Aug 2020 21:32:01 +0200 Subject: [PATCH] GuiButton: Process children --- src/gui/GuiButton.cpp | 27 ++++++++++++++++++++++++--- src/gui/GuiButton.h | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/gui/GuiButton.cpp b/src/gui/GuiButton.cpp index ca64430..d3af71f 100644 --- a/src/gui/GuiButton.cpp +++ b/src/gui/GuiButton.cpp @@ -241,7 +241,7 @@ void GuiButton::update(GuiController *c) { } else if ((isStateSet(STATE_CLICKED, c->chanIdx) || isStateSet(STATE_CLICKED_TOUCH, c->chanIdx)) && (clickedTrigger == trigger[i]) && !isStateSet(STATE_HELD, c->chanIdx) && !trigger[i]->held(c) && ((isClicked == GuiTrigger::CLICKED_NONE) || trigger[i]->released(c))) { if ((isStateSet(STATE_CLICKED_TOUCH, c->chanIdx) && this->isInside(c->data.x, c->data.y)) || (isStateSet(STATE_CLICKED, c->chanIdx))) { - clickedTrigger = NULL; + clickedTrigger = nullptr; clearState(STATE_CLICKED, c->chanIdx); released(this, c, trigger[i]); } @@ -263,13 +263,34 @@ void GuiButton::update(GuiController *c) { } else if (isStateSet(STATE_HELD, c->chanIdx) && (heldTrigger == trigger[i]) && (!isHeld || trigger[i]->released(c))) { //! click is removed at this point and converted to held if (clickedTrigger == trigger[i]) { - clickedTrigger = NULL; + clickedTrigger = nullptr; clearState(STATE_CLICKED, c->chanIdx); } - heldTrigger = NULL; + heldTrigger = nullptr; clearState(STATE_HELD, c->chanIdx); released(this, c, trigger[i]); } } } } + +void GuiButton::process() { + GuiElement::process(); + + if(image) { image->process(); } + if(imageOver) { imageOver->process(); } + if(imageHold) { imageHold->process(); } + if(imageClick) { imageClick->process(); } + if(icon) { icon->process(); } + if(iconOver) { iconOver->process(); } + if(soundOver) { soundOver->process(); } + if(soundHold) { soundHold->process(); } + if(soundClick) { soundClick->process(); } + + for(int i = 0;i<4;i++){ + if(label[i]) { label[i]->process(); } + if(labelOver[i]) { labelOver[i]->process(); } + if(labelHold[i]) { labelHold[i]->process(); } + if(labelClick[i]) { labelClick[i]->process(); } + } +} diff --git a/src/gui/GuiButton.h b/src/gui/GuiButton.h index 40e1e1c..2bcbd73 100644 --- a/src/gui/GuiButton.h +++ b/src/gui/GuiButton.h @@ -100,6 +100,8 @@ public: //!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD void update(GuiController *c) override; + void process() override; + sigslot::signal2 selected; sigslot::signal2 deSelected; sigslot::signal2 pointedOn;