From a1f4cd19ee053800bd8766a829fd770201309772 Mon Sep 17 00:00:00 2001 From: twanvl Date: Thu, 6 Jan 2011 22:37:00 +0000 Subject: [PATCH] update members of cached dropdown menu, this fixes #13 git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1583 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/value/text.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp index 122e70b3..b8f5b538 100644 --- a/src/gui/value/text.cpp +++ b/src/gui/value/text.cpp @@ -108,7 +108,7 @@ struct DropDownWordListItem { WordListWordP word; String name; int flags; - DropDownListP submenu; + DropDownWordListP submenu; inline bool active() const { return flags & FLAG_ACTIVE; } inline void setActive(bool a) { flags = (flags & ~FLAG_ACTIVE) | a * FLAG_ACTIVE; } @@ -238,7 +238,11 @@ void DropDownWordList::drawIcon(DC& dc, int x, int y, size_t item, bool selected DropDownList* DropDownWordList::submenu(size_t item) const { DropDownWordListItem& i = items[item]; - if (i.submenu) return i.submenu.get(); + if (i.submenu) { + // make sure the members of the submenu are still up to date (in particular the pos, see #13) + i.submenu->pos = pos; + return i.submenu.get(); + } if (i.flags & FLAG_SUBMENU) { // create submenu? if (!i.submenu) {