mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
Implemented CardList
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@23 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+11
-14
@@ -26,12 +26,9 @@ class SetWindowPanel : public wxPanel, public SetView {
|
||||
/// We will probably want to respond to set changes
|
||||
virtual void onSetChange() {}
|
||||
|
||||
// --------------------------------------------------- : Meta information
|
||||
|
||||
virtual String shortName() { return _("<undefined>"); } ///< for tab bar
|
||||
virtual String longName() { return shortName(); } ///< for menu
|
||||
virtual String description() { return _("<undefined>"); } ///< for status bar
|
||||
virtual String helpFile() { return _(""); } ///< help file to use when this panel is active
|
||||
// // --------------------------------------------------- : Meta information
|
||||
//
|
||||
// virtual String helpFile() { return _(""); } ///< help file to use when this panel is active
|
||||
|
||||
// --------------------------------------------------- : UI
|
||||
|
||||
@@ -49,29 +46,29 @@ class SetWindowPanel : public wxPanel, public SetView {
|
||||
// --------------------------------------------------- : Actions/Events
|
||||
|
||||
/// Should return true if this panel wants to get focus to show an action
|
||||
virtual bool wantsToHandle(const Action&) { return false; }
|
||||
virtual bool wantsToHandle(const Action&) const { return false; }
|
||||
/// Handle an action that changes the current set
|
||||
virtual void onAction(const Action&) {}
|
||||
/// The settings for rendering cards have changed, refresh card viewers/editors
|
||||
virtual void onRenderSettingsChange() {}
|
||||
|
||||
// --------------------------------------------------- : Clipboard
|
||||
virtual bool canPaste() { return false; } ///< Is pasting possible?
|
||||
virtual bool canCopy() { return false; } ///< Is copying possible?
|
||||
virtual bool canCut() { return canCopy(); } ///< Is cutting possible?
|
||||
virtual bool canPaste() const { return false; } ///< Is pasting possible?
|
||||
virtual bool canCopy() const { return false; } ///< Is copying possible?
|
||||
virtual bool canCut() const { return canCopy(); } ///< Is cutting possible?
|
||||
virtual void doPaste() {} ///< Paste the contents of the clipboard
|
||||
virtual void doCopy() {} ///< Copy the selection to the clipboard
|
||||
virtual void doCut() {} ///< Cut the selection to the clipboard
|
||||
|
||||
// --------------------------------------------------- : Searching (find/replace)
|
||||
virtual bool canFind() { return false; } ///< Is finding possible?
|
||||
virtual bool canReplace() { return false; } ///< Is replacing possible?
|
||||
virtual bool canFind() const { return false; } ///< Is finding possible?
|
||||
virtual bool canReplace() const { return false; } ///< Is replacing possible?
|
||||
virtual bool doFind(wxFindReplaceData&) { return false; } ///< Find the next math
|
||||
virtual bool doReplace(wxFindReplaceData&) { return false; } ///< Replace the next match
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
virtual CardP selectedCard() { return CardP(); } ///< Return the currently selected card, or CardP()
|
||||
virtual void selectCard(CardP card) {} ///< Switch the view to another card
|
||||
virtual CardP selectedCard() const { return CardP(); } ///< Return the currently selected card, or CardP()
|
||||
virtual void selectCard(CardP card) {} ///< Switch the view to another card
|
||||
|
||||
protected:
|
||||
// --------------------------------------------------- : Helper functions for UI
|
||||
|
||||
@@ -10,9 +10,14 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <gui/set/panel.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : SetInfoPanel
|
||||
|
||||
class SetInfoPanel : public SetWindowPanel {
|
||||
public:
|
||||
SetInfoPanel(Window* parent, int id);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -7,5 +7,18 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <gui/set/style_panel.hpp>
|
||||
#include <gui/control/package_list.hpp>
|
||||
#include <data/game.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : StylePanel
|
||||
|
||||
StylePanel::StylePanel(Window* parent, int id)
|
||||
: SetWindowPanel(parent, id)
|
||||
{
|
||||
PackageList* list = new PackageList(this, wxID_ANY);
|
||||
list->showData<Game>();
|
||||
|
||||
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
|
||||
s->Add(list, 1, wxEXPAND);
|
||||
SetSizer(s);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,14 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <gui/set/panel.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : StylePanel
|
||||
|
||||
class StylePanel : public SetWindowPanel {
|
||||
public:
|
||||
StylePanel(Window* parent, int id);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -113,16 +113,16 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
||||
// NOTE: place the CardsPanel last in the panels list,
|
||||
// this way the card list is the last to be told of a set change
|
||||
// this way everyone else already uses the new set when it sends a CardSelectEvent
|
||||
// addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 4, _("F5"));
|
||||
// addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 4, _("F5"), _("Cards"), _("Cards"));
|
||||
// addPanel(menuWindow, tabBar, new SetInfoPanel (this, wxID_ANY), 0, _("F6"));
|
||||
// addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 1, _("F7"));
|
||||
addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 1, _("F7"), _("Style"), _("Style"), _("Chnage the style of cards"));
|
||||
// addPanel(menuWindow, tabBar, new KeywordsPanel(this, wxID_ANY), 2, _("F8"));
|
||||
// addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("F9"));
|
||||
// addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("F9"), _("Stats"), _("Statistics"), _("Show statistics about the cards in the set"));
|
||||
//addPanel(*s, *menuWindow, *tabBar, new DraftPanel (&this, wxID_ANY), 4, _("F10"))
|
||||
// selectPanel(idWindowMin + 4); // select cards panel
|
||||
|
||||
addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 0, _("F9"));
|
||||
selectPanel(ID_WINDOW_MIN); // test
|
||||
addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 0, _("F9"), _("Stats"), _("Statistics"), _("Show statistics about the cards in the set"));
|
||||
selectPanel(ID_WINDOW_MIN+1); // test
|
||||
|
||||
// loose ends
|
||||
tabBar->Realize();
|
||||
@@ -162,15 +162,16 @@ SetWindow::~SetWindow() {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Panel managment
|
||||
|
||||
void SetWindow::addPanel(wxMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel* panel, UInt pos, const String& shortcut) {
|
||||
void SetWindow::addPanel(wxMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel* panel, UInt pos,
|
||||
const String& shortcut, const String& shortName, const String& longName, const String& description) {
|
||||
// insert in list
|
||||
if (panels.size() <= pos) panels.resize(pos + 1);
|
||||
panels[pos] = panel;
|
||||
// add to tab bar
|
||||
int id = ID_WINDOW_MIN + pos;
|
||||
tabBar->AddTool(id,panel->shortName(), wxNullBitmap, wxNullBitmap, wxITEM_CHECK, panel->longName(), panel->description());
|
||||
tabBar->AddTool(id, shortName, wxNullBitmap, wxNullBitmap, wxITEM_CHECK, longName, description);
|
||||
// add to menu bar
|
||||
windowMenu->AppendCheckItem(id, panel->longName() + _("\t") + shortcut, panel->description());
|
||||
windowMenu->AppendCheckItem(id, longName + _("\t") + shortcut, description);
|
||||
// add to sizer
|
||||
GetSizer()->Add(panel, 1, wxEXPAND);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ class SetWindow : public wxFrame, public SetView {
|
||||
/// Add a panel to the window, as well as to the menu and tab bar
|
||||
/** The position only determines the order in which events will be send.
|
||||
*/
|
||||
void addPanel(wxMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel* panel, UInt pos, const String& shortcut);
|
||||
void addPanel(wxMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel* panel, UInt pos,
|
||||
const String& shortcut, const String& shortName, const String& longName, const String& description);
|
||||
|
||||
/// Select a panel, based on a tab id
|
||||
void selectPanel(int id);
|
||||
|
||||
Reference in New Issue
Block a user