From a0bb47d791fc69aa12980ed21484ba4260504593 Mon Sep 17 00:00:00 2001 From: gzytom Date: Mon, 19 Mar 2018 00:06:30 +0800 Subject: [PATCH] 1. Support to set list item' selectedIcon in Editor. 2. Set popup's sorting order automatically. --- libfairygui/Classes/GList.cpp | 3 +++ libfairygui/Classes/GRoot.cpp | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libfairygui/Classes/GList.cpp b/libfairygui/Classes/GList.cpp index cc8200f..4c1e83b 100644 --- a/libfairygui/Classes/GList.cpp +++ b/libfairygui/Classes/GList.cpp @@ -2518,6 +2518,9 @@ void GList::setup_BeforeAdd(TXMLElement * xml) p = ix->Attribute("name"); if (p) obj->name = p; + p = ix->Attribute("selectedIcon"); + if (p && dynamic_cast(obj)) + dynamic_cast(obj)->setSelectedIcon(p); } ix = ix->NextSiblingElement("item"); diff --git a/libfairygui/Classes/GRoot.cpp b/libfairygui/Classes/GRoot.cpp index 44ba97c..e6f9576 100644 --- a/libfairygui/Classes/GRoot.cpp +++ b/libfairygui/Classes/GRoot.cpp @@ -233,6 +233,23 @@ void GRoot::showPopup(GObject * popup, GObject * target, PopupDirection dir) _popupStack.push_back(WeakPtr(popup)); + if (target != nullptr) + { + GObject* p = target; + while (p != nullptr) + { + if (p->getParent() == this) + { + if (popup->getSortingOrder() < p->getSortingOrder()) + { + popup->setSortingOrder(p->getSortingOrder()); + } + break; + } + p = p->getParent(); + } + } + addChild(popup); adjustModalLayer();