added SetWindow (formerly MainWindow)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@8 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-07 13:11:24 +00:00
parent b8c6ad0f69
commit cdb4ecf031
19 changed files with 1050 additions and 5 deletions
+106
View File
@@ -0,0 +1,106 @@
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_CARDS_PANEL
#define HEADER_GUI_SET_CARDS_PANEL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <gui/set/panel.hpp>
// ----------------------------------------------------------------------------- : CardsPanel
/// A card list and card editor panel
class CardsPanel : public SetWindowPanel {
public:
CardsPanel(Window* parent, int id);
~CardsPanel();
void onSetChange();
// --------------------------------------------------- : Meta information
virtual String shortName();
virtual String longName();
virtual String description();
// --------------------------------------------------- : UI
virtual void initUI (wxToolBar* tb, wxMenuBar* mb);
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb);
virtual void onUpdateUI(wxUpdateUIEvent& e);
virtual void onCommand(int id);
// --------------------------------------------------- : Actions
virtual bool wantsToHandle(const Action&);
virtual void onAction(const Action&);
virtual void onRenderSettingsChange();
private:
void updateSize();
public:
// --------------------------------------------------- : Clipboard
virtual bool canCut();
virtual bool canCopy();
virtual bool canPaste();
virtual void doCut();
virtual void doCopy();
virtual void doPaste();
// --------------------------------------------------- : Searching (find/replace)
virtual bool canFind();
virtual bool canReplace();
virtual bool doFind(wxFindReplaceData& what);
virtual bool doReplace(wxFindReplaceData& what);
private:
// Functions that handle finding
/*
typedef void (CardsPanel::*FindHandler)(const CardP&, const TextValueP&, const size_t, const size_t, wxFindReplaceData&);
/// Execute a find (or replace), and start with the currently selected card and value
/** if findSame==true then find will also find the currently highlighted word
* Returns true if found
* /
bool find(FindReplaceData& what, const FindHandler& handler, bool findSame = false);
/// find handler : select found value
void handleFind(const CardP& card, const TextValueP& value, size_t start, size_t end, FindReplaceData& what);
/// replace handler : replace found value, move selection to end
void handleReplace(const CardP& card, const TextValueP& value, size_t start, size_t end, FindReplaceData& what);
/// Find in all cards
/** NOTE: this function is essentially the same as findInCard * /
bool findInCards(const CardP& firstCard, const ValueP& firstValue, int firstChar, FindReplaceData& what, const FindHandler& handler);
/// Find in a card, if firstValue is specified start searching there
/** NOTE: this function is essentially the same as findInCards * /
bool findInCard(const CardP& card, const ValueP& firstValue, int firstChar, FindReplaceData& what, const FindHandler& handler);
/// Find the current search string in the specified value
/** if searchDir = up searches from the end and only before firstChar, unless firstChar == -1 * /
bool findInValue(const CardP& crd_, virtual const ValueP& value, int firstChar, FindReplaceData& what, const FindHandler& handler);
*/
public:
// --------------------------------------------------- : Selection
virtual CardP selectedCard();
virtual void selectCard(const CardP& card);
private:
// --------------------------------------------------- : Controls
// wxSplitterWindow* splitter;
// Editor* editor;
// EditCardList* cardList;
// DataTextCtrl* notes;
// --------------------------------------------------- : Menus & tools
wxMenu* cardMenu, formatMenu;
};
// ----------------------------------------------------------------------------- : EOF
#endif