Files
MagicSetEditor2/src/gui/set/cards_panel.hpp
T
twanvl e36f697855 Add 'insert symbol menu' in EVT_MENU_OPEN instead of updateUI, this fixes crash on wxGTK
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1647 0fc631ac-6414-0410-93d0-97cfa31319b6
2011-02-02 23:16:59 +00:00

104 lines
3.6 KiB
C++

//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2010 Twan van Laarhoven and Sean Hunt |
//| 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>
class wxSplitterWindow;
class FilteredImageCardList;
class DataEditor;
class TextCtrl;
class IconMenu;
class HoverButton;
class FindInfo;
class FilterCtrl;
// ----------------------------------------------------------------------------- : CardsPanel
/// A card list and card editor panel
class CardsPanel : public SetWindowPanel {
public:
CardsPanel(Window* parent, int id);
~CardsPanel();
virtual void onChangeSet();
// --------------------------------------------------- : UI
virtual void initUI (wxToolBar* tb, wxMenuBar* mb);
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb);
virtual void onUpdateUI(wxUpdateUIEvent&);
virtual void onCommand(int id);
virtual void onMenuOpen(wxMenuEvent&);
// --------------------------------------------------- : Actions
virtual bool wantsToHandle(const Action&, bool undone) const;
// --------------------------------------------------- : Clipboard
virtual bool canCut() const;
virtual bool canCopy() const;
virtual bool canPaste() const;
virtual void doCut();
virtual void doCopy();
virtual void doPaste();
// --------------------------------------------------- : Searching (find/replace)
virtual bool canFind() const { return true; }
virtual bool canReplace() const { return true; }
virtual bool doFind (wxFindReplaceData&);
virtual bool doReplace (wxFindReplaceData&);
virtual bool doReplaceAll(wxFindReplaceData&);
private:
/// Do a search or replace action for the given FindInfo in all cards
bool search(FindInfo& find, bool from_start);
class SearchFindInfo;
class ReplaceFindInfo;
friend class CardsPanel::SearchFindInfo;
friend class CardsPanel::ReplaceFindInfo;
public:
// --------------------------------------------------- : Selection
virtual CardP selectedCard() const;
virtual void selectCard(const CardP& card);
virtual void selectFirstCard();
private:
// --------------------------------------------------- : Controls
wxSizer* s_left;
wxSplitterWindow* splitter;
DataEditor* editor;
FilteredImageCardList* card_list;
Panel* nodes_panel;
TextCtrl* notes;
HoverButton* collapse_notes;
FilterCtrl* filter;
bool notes_below_editor;
/// Move the notes panel below the editor or below the card list
void updateNotesPosition();
// before Layout, call updateNotesPosition.
// NOTE: docs say this function returns void, but the code says bool
virtual bool Layout();
// --------------------------------------------------- : Menus & tools
IconMenu* menuCard, *menuFormat;
wxToolBarToolBase* toolAddCard;
wxMenuItem* insertSymbolMenu; // owned by menuFormat, but submenu owned by SymbolFont
wxMenuItem* insertManyCardsMenu; // owned my menuCard, but submenu can be changed
wxMenu* makeAddCardsSubmenu(bool add_single_card_option);
};
// ----------------------------------------------------------------------------- : EOF
#endif