From a0e0ab7149742369a12baca143d316e01bfe49ac Mon Sep 17 00:00:00 2001 From: twanvl Date: Wed, 9 Jul 2008 22:32:16 +0000 Subject: [PATCH] controls to select packs on the RandomPackPanel git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1018 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/set/random_pack_panel.cpp | 25 +++++++++++++++++++++++-- src/gui/set/random_pack_panel.hpp | 14 ++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/gui/set/random_pack_panel.cpp b/src/gui/set/random_pack_panel.cpp index 4b3d4784..72f34853 100644 --- a/src/gui/set/random_pack_panel.cpp +++ b/src/gui/set/random_pack_panel.cpp @@ -10,6 +10,11 @@ #include #include #include +#include +#include +#include + +DECLARE_TYPEOF_COLLECTION(PackTypeP); // ----------------------------------------------------------------------------- : RandomPackPanel @@ -26,9 +31,12 @@ RandomPackPanel::RandomPackPanel(Window* parent, int id) wxSizer* s2 = new wxBoxSizer(wxVERTICAL); wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s4 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack selection")); - s3->Add(s4, 1, wxEXPAND, 8); + packsSizer = new wxFlexGridSizer(0, 2, 4, 8); + packsSizer->AddGrowableCol(0); + s4->Add(packsSizer, 1, wxEXPAND | wxALL, 4); + s3->Add(s4, 1, wxEXPAND, 8); wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals")); - s3->Add(s5, 1, wxEXPAND | wxLEFT, 8); + s3->Add(s5, 1, wxEXPAND | wxLEFT, 8); s3->Add(generate, 0, wxALIGN_BOTTOM | wxLEFT, 8); s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(card_list, 1, wxEXPAND); @@ -40,6 +48,19 @@ RandomPackPanel::RandomPackPanel(Window* parent, int id) void RandomPackPanel::onChangeSet() { preview ->setSet(set); card_list->setSet(set); + + // add pack controls + FOR_EACH(pack, set->game->pack_types) { + PackItem i; + i.pack = pack; + i.label = new wxStaticText(this, wxID_ANY, pack->name); + i.value = new wxSpinCtrl(this, wxID_ANY, _("0"), wxDefaultPosition, wxSize(50,-1)); + //i.value->SetSizeHints(0,0,50,100); + packsSizer->Add(i.label, 0, wxALIGN_CENTER_VERTICAL); + packsSizer->Add(i.value, 0, wxEXPAND | wxALIGN_CENTER); + packs.push_back(i); + } + Layout(); } // ----------------------------------------------------------------------------- : UI diff --git a/src/gui/set/random_pack_panel.hpp b/src/gui/set/random_pack_panel.hpp index 5beddc79..749f53d9 100644 --- a/src/gui/set/random_pack_panel.hpp +++ b/src/gui/set/random_pack_panel.hpp @@ -14,6 +14,7 @@ class CardViewer; class FilteredCardList; +DECLARE_POINTER_TYPE(PackType); // ----------------------------------------------------------------------------- : RandomPackPanel @@ -39,6 +40,19 @@ class RandomPackPanel : public SetWindowPanel { private: CardViewer* preview; ///< Card preview FilteredCardList* card_list; ///< The list of cards + wxFlexGridSizer* packsSizer; + wxFlexGridSizer* totalsSizer; + + struct PackItem { + PackTypeP pack; + wxStaticText* label; + wxSpinCtrl* value; + }; + vector packs; + + struct TotalItem { + }; + vector totals; /// Generate the cards void generate();