Files
MagicSetEditor2/src/gui/set/panel.hpp
T
GenevensiS 436c437189 add compiler directives
add compiler directives
2025-12-30 01:18:04 +01:00

89 lines
4.2 KiB
C++

//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make card games |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#pragma once
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/set.hpp>
#include <gui/card_select_window.hpp>
class CardListBase;
class wxFindReplaceData;
// ----------------------------------------------------------------------------- : SetWindowPanel
/// A panel that is one of the panels in the set window.
/** This class is a virtual base class for all actual panels used in the set window.
*/
class SetWindowPanel : public wxPanel, public SetView {
public:
SetWindowPanel(Window* parent, int id, bool autoTabbing = true);
/// We will probably want to respond to set changes
virtual void onSetChange() {}
// // --------------------------------------------------- : Meta information
//
// virtual String helpFile() { return _(""); } ///< help file to use when this panel is active
// --------------------------------------------------- : UI
/// Init extra toolbar items and menus needed for this panel.
virtual void initUI (wxToolBar* tb, wxMenuBar* mb) {}
/// Destroy the extra items added by initUI.
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb) {}
/// Update the UI by enabling/disabling items.
/** Note: copy/paste and find/replace are not handled here.
*/
virtual void onUpdateUI(wxUpdateUIEvent&) {}
/// Respond to one of those extra menu/tool items
virtual void onCommand(int id) {}
/// Called before a menu is opened in the parent window
virtual void onMenuOpen(wxMenuEvent&) {}
// --------------------------------------------------- : Actions/Events
/// Should return true if this panel wants to get focus to show an action
virtual bool wantsToHandle(const Action&, bool undone) const { return false; }
/// Handle an action that changes the current set
virtual void onAction(const Action&, bool undone) override {}
// --------------------------------------------------- : Clipboard
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
// --------------------------------------------------- : Selecting
virtual bool canSelectAll() const { return false; }
virtual void doSelectAll() {}
// --------------------------------------------------- : Searching (find/replace)
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
virtual bool doReplaceAll(wxFindReplaceData&) { return false; } ///< Replace all matches
// --------------------------------------------------- : Selection
virtual CardP selectedCard() const; ///< Return the currently selected card, or CardP()
virtual void selectCard(const CardP& card) {} ///< Switch the view to another card, can be null
virtual void selectFirstCard() {} ///< Switch the view to the first card
virtual void selectionChoices(ExportCardSelectionChoices& out) {} ///< Card subsets that can be exported from this panel
virtual void getCardLists(vector<CardListBase*>& out) {}
protected:
/// Have any controls been created?
bool isInitialized() const;
};