add 'ondefocus' ui event
This commit is contained in:
parent
e6dea9ed48
commit
9befbb9795
@ -74,6 +74,11 @@ UINode* UINode::listenDoubleClick(const onaction& action) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINode* UINode::listenDefocus(const onaction& action) {
|
||||||
|
defocusCallbacks.listen(action);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
void UINode::click(int, int) {
|
void UINode::click(int, int) {
|
||||||
pressed = true;
|
pressed = true;
|
||||||
}
|
}
|
||||||
@ -98,6 +103,7 @@ bool UINode::isPressed() const {
|
|||||||
|
|
||||||
void UINode::defocus() {
|
void UINode::defocus() {
|
||||||
focused = false;
|
focused = false;
|
||||||
|
defocusCallbacks.notify(gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UINode::isFocused() const {
|
bool UINode::isFocused() const {
|
||||||
|
|||||||
@ -114,6 +114,8 @@ namespace gui {
|
|||||||
ActionsSet actions;
|
ActionsSet actions;
|
||||||
/// @brief 'ondoubleclick' callbacks
|
/// @brief 'ondoubleclick' callbacks
|
||||||
ActionsSet doubleClickCallbacks;
|
ActionsSet doubleClickCallbacks;
|
||||||
|
/// @brief 'ondefocus' callbacks
|
||||||
|
ActionsSet defocusCallbacks;
|
||||||
/// @brief element tooltip text
|
/// @brief element tooltip text
|
||||||
std::wstring tooltip;
|
std::wstring tooltip;
|
||||||
/// @brief element tooltip delay
|
/// @brief element tooltip delay
|
||||||
@ -169,8 +171,9 @@ namespace gui {
|
|||||||
/// @brief Get element z-index
|
/// @brief Get element z-index
|
||||||
int getZIndex() const;
|
int getZIndex() const;
|
||||||
|
|
||||||
virtual UINode* listenAction(const onaction &action);
|
virtual UINode* listenAction(const onaction& action);
|
||||||
virtual UINode* listenDoubleClick(const onaction &action);
|
virtual UINode* listenDoubleClick(const onaction& action);
|
||||||
|
virtual UINode* listenDefocus(const onaction& action);
|
||||||
|
|
||||||
virtual void onFocus() {focused = true;}
|
virtual void onFocus() {focused = true;}
|
||||||
virtual void doubleClick(int x, int y);
|
virtual void doubleClick(int x, int y);
|
||||||
|
|||||||
@ -180,6 +180,10 @@ static void read_uinode(
|
|||||||
node.listenAction(onclick);
|
node.listenAction(onclick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto ondefocus = create_action(reader, element, "ondefocus")) {
|
||||||
|
node.listenDefocus(ondefocus);
|
||||||
|
}
|
||||||
|
|
||||||
if (auto ondoubleclick = create_action(reader, element, "ondoubleclick")) {
|
if (auto ondoubleclick = create_action(reader, element, "ondoubleclick")) {
|
||||||
node.listenDoubleClick(ondoubleclick);
|
node.listenDoubleClick(ondoubleclick);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user