(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:
twanvl
2007-03-22 22:50:01 +00:00
parent e51af9677b
commit 0fbd417057
7 changed files with 193 additions and 40 deletions
+10 -30
View File
@@ -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);
}
+3
View File
@@ -20,6 +20,9 @@ class KeywordList;
class KeywordsPanel : public SetWindowPanel {
public:
KeywordsPanel(Window* parent, int id);
virtual void onChangeSet();
private:
KeywordList* list;
};