mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
(partially working) keyword list
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@230 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -7,48 +7,28 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <gui/set/keywords_panel.hpp>
|
||||
#include <gui/control/keyword_list.hpp>
|
||||
#include <data/keyword.hpp>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
// ----------------------------------------------------------------------------- : KeywordsList
|
||||
|
||||
/// A control that lists the keywords in a set or game
|
||||
class KeywordList : public wxListView {
|
||||
public:
|
||||
KeywordList(Window* parent, int id);
|
||||
|
||||
/// Set the list of keywords to show
|
||||
void setData(vector<KeywordP>& dat);
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
|
||||
inline KeywordP getKeyword() const { return selected_keyword; }
|
||||
inline void setKeyword(const KeywordP& kw) { /* TODO */ }
|
||||
|
||||
bool canSelectPrevious() const;
|
||||
bool canSelectNext() const;
|
||||
void selectPrevious();
|
||||
void selectNext();
|
||||
|
||||
protected:
|
||||
/// Get the text of an item in a specific column
|
||||
/** Overrides a function from wxListCtrl */
|
||||
virtual String OnGetItemText (long pos, long col) const;
|
||||
private:
|
||||
KeywordP selected_keyword;
|
||||
long selected_keyword_pos;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : KeywordsPanel
|
||||
|
||||
KeywordsPanel::KeywordsPanel(Window* parent, int id)
|
||||
: SetWindowPanel(parent, id)
|
||||
{
|
||||
// init controls
|
||||
list = new KeywordList(this, wxID_ANY);
|
||||
// init sizer
|
||||
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
|
||||
s->Add(new wxStaticText(this, wxID_ANY, _("Sorry, no keywords for now"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTER), 1, wxALIGN_CENTER); // TODO: Remove
|
||||
s->Add(list, 1, wxEXPAND);
|
||||
//s->Add(new wxStaticText(this, wxID_ANY, _("Sorry, no keywords for now"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTER), 1, wxALIGN_CENTER); // TODO: Remove
|
||||
/* wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
|
||||
s2->Add(list_active, 1, wxEXPAND);
|
||||
s2->Add(list_inactive, 1, wxEXPAND);*/
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
}
|
||||
|
||||
void KeywordsPanel::onChangeSet() {
|
||||
list->setSet(set);
|
||||
}
|
||||
Reference in New Issue
Block a user