Added word lists for choosing things like card type;

Added 'in_place' pattern to spec_sort

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@616 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-08-23 16:33:12 +00:00
parent 9e35698194
commit 9f2b30b2db
23 changed files with 461 additions and 60 deletions
+12 -6
View File
@@ -20,13 +20,15 @@ class DropDownMultipleChoiceList : public DropDownChoiceListBase {
protected:
virtual void onShow();
virtual bool select(size_t item);
virtual void select(size_t item);
virtual size_t selection() const;
virtual bool stayOpen() 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 onMotion(wxMouseEvent&);
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
};
@@ -38,7 +40,7 @@ DropDownMultipleChoiceList::DropDownMultipleChoiceList
icon_size.width += 16;
}
bool DropDownMultipleChoiceList::select(size_t item) {
void DropDownMultipleChoiceList::select(size_t item) {
MultipleChoiceValueEditor& mcve = dynamic_cast<MultipleChoiceValueEditor&>(cve);
if (isFieldDefault(item)) {
mcve.toggleDefault();
@@ -49,7 +51,6 @@ bool DropDownMultipleChoiceList::select(size_t item) {
// keep the box open
DropDownChoiceListBase::onShow(); // update 'enabled'
kept_open = true;
return false;
}
void DropDownMultipleChoiceList::drawIcon(DC& dc, int x, int y, size_t item, bool selected) const {
@@ -92,16 +93,21 @@ DropDownList* DropDownMultipleChoiceList::createSubMenu(ChoiceField::ChoiceP gro
return new DropDownMultipleChoiceList(const_cast<DropDownMultipleChoiceList*>(this), true, cve, group);
}
void DropDownMultipleChoiceList::onMotion(wxMouseEvent& ev) {
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;
}
}
DropDownChoiceListBase::onMotion(ev);
}
BEGIN_EVENT_TABLE(DropDownMultipleChoiceList, DropDownChoiceListBase)
EVT_LEAVE_WINDOW(DropDownMultipleChoiceList::onMouseLeave)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------- : MultipleChoiceValueEditor
IMPLEMENT_VALUE_EDITOR(MultipleChoice) {}