'suffix' is no longer a safe global variable name in scripts;

Drop down list for word lists stay open after clicking on a prefix choice.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@663 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-09-02 18:18:04 +00:00
parent 0157f96f9a
commit 01de02b904
7 changed files with 42 additions and 34 deletions
+1 -24
View File
@@ -22,20 +22,14 @@ class DropDownMultipleChoiceList : public DropDownChoiceListBase {
virtual void onShow();
virtual void select(size_t item);
virtual size_t selection() const;
virtual bool stayOpen() const { return true; }
virtual bool stayOpen(size_t selection) const { return true; }
virtual DropDownList* createSubMenu(ChoiceField::ChoiceP group) const;
virtual void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const;
virtual void onMouseLeave(wxMouseEvent&);
private:
DECLARE_EVENT_TABLE();
bool kept_open; ///< Was the list kept open after selecting a choice, if so, be eager to close it
};
DropDownMultipleChoiceList::DropDownMultipleChoiceList
(Window* parent, bool is_submenu, ValueViewer& cve, ChoiceField::ChoiceP group)
: DropDownChoiceListBase(parent, is_submenu, cve, group)
, kept_open(false)
{
icon_size.width += 16;
}
@@ -50,7 +44,6 @@ void DropDownMultipleChoiceList::select(size_t item) {
}
// keep the box open
DropDownChoiceListBase::onShow(); // update 'enabled'
kept_open = true;
}
void DropDownMultipleChoiceList::drawIcon(DC& dc, int x, int y, size_t item, bool selected) const {
@@ -82,7 +75,6 @@ void DropDownMultipleChoiceList::onShow() {
DropDownChoiceListBase::onShow();
// we need thumbnail images soon
const_cast<DropDownMultipleChoiceList*>(this)->generateThumbnailImages();
kept_open = false;
}
size_t DropDownMultipleChoiceList::selection() const {
@@ -93,21 +85,6 @@ DropDownList* DropDownMultipleChoiceList::createSubMenu(ChoiceField::ChoiceP gro
return new DropDownMultipleChoiceList(const_cast<DropDownMultipleChoiceList*>(this), true, cve, group);
}
void DropDownMultipleChoiceList::onMouseLeave(wxMouseEvent& ev) {
if (kept_open) {
wxSize cs = GetClientSize();
if (ev.GetX() < 0 || ev.GetY() < 0 || ev.GetX() >= cs.x || ev.GetY() >= cs.y) {
hide(false); // outside box; hide it
ev.Skip();
return;
}
}
}
BEGIN_EVENT_TABLE(DropDownMultipleChoiceList, DropDownChoiceListBase)
EVT_LEAVE_WINDOW(DropDownMultipleChoiceList::onMouseLeave)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------- : MultipleChoiceValueEditor
IMPLEMENT_VALUE_EDITOR(MultipleChoice) {}