21#ifndef KICAD_API_HANDLER_EDITOR_H
22#define KICAD_API_HANDLER_EDITOR_H
25#include <api/common/commands/editor_commands.pb.h>
30using kiapi::common::types::DocumentSpecifier;
31using kiapi::common::types::ItemRequestStatus;
32using kiapi::common::commands::ItemDeletionStatus;
47 const kiapi::common::types::ItemHeader& aHeader );
97 const types::ItemHeader &aHeader,
98 const google::protobuf::RepeatedPtrField<google::protobuf::Any>& aItems,
99 std::function<
void( commands::ItemStatus, google::protobuf::Any )> aItemHandler ) = 0;
105 const KIID& aId ) = 0;
108 std::map<std::string, std::pair<KIID, std::unique_ptr<COMMIT>>>
m_commits;
tl::expected< T, ApiResponseStatus > HANDLER_RESULT
Base class for API handlers related to editor frames.
HANDLER_RESULT< commands::HitTestResponse > handleHitTest(commands::HitTest &aMsg, const HANDLER_CONTEXT &aCtx)
virtual void pushCurrentCommit(const HANDLER_CONTEXT &aCtx, const wxString &aMessage)
virtual HANDLER_RESULT< ItemRequestStatus > handleCreateUpdateItemsInternal(bool aCreate, const HANDLER_CONTEXT &aCtx, const types::ItemHeader &aHeader, const google::protobuf::RepeatedPtrField< google::protobuf::Any > &aItems, std::function< void(commands::ItemStatus, google::protobuf::Any)> aItemHandler)=0
virtual kiapi::common::types::DocumentType thisDocumentType() const =0
Override this to specify which document type this editor handles.
HANDLER_RESULT< commands::BeginCommitResponse > handleBeginCommit(commands::BeginCommit &aMsg, const HANDLER_CONTEXT &aCtx)
virtual std::unique_ptr< COMMIT > createCommit()=0
Override this to create an appropriate COMMIT subclass for the frame in question.
HANDLER_RESULT< bool > validateDocument(const DocumentSpecifier &aDocument)
HANDLER_RESULT< commands::UpdateItemsResponse > handleUpdateItems(commands::UpdateItems &aMsg, const HANDLER_CONTEXT &aCtx)
virtual std::optional< EDA_ITEM * > getItemFromDocument(const DocumentSpecifier &aDocument, const KIID &aId)=0
HANDLER_RESULT< commands::EndCommitResponse > handleEndCommit(commands::EndCommit &aMsg, const HANDLER_CONTEXT &aCtx)
HANDLER_RESULT< std::optional< KIID > > validateItemHeaderDocument(const kiapi::common::types::ItemHeader &aHeader)
If the header is valid, returns the item container.
COMMIT * getCurrentCommit(const HANDLER_CONTEXT &aCtx)
HANDLER_RESULT< commands::DeleteItemsResponse > handleDeleteItems(commands::DeleteItems &aMsg, const HANDLER_CONTEXT &aCtx)
std::set< std::string > m_activeClients
std::map< std::string, std::pair< KIID, std::unique_ptr< COMMIT > > > m_commits
virtual void deleteItemsInternal(std::map< KIID, ItemDeletionStatus > &aItemsToDelete, const HANDLER_CONTEXT &aCtx)=0
virtual std::optional< ApiResponseStatus > checkForBusy()
Checks if the editor can accept commands.
HANDLER_RESULT< commands::CreateItemsResponse > handleCreateItems(commands::CreateItems &aMsg, const HANDLER_CONTEXT &aCtx)
virtual bool validateDocumentInternal(const DocumentSpecifier &aDocument) const =0
Represent a set of changes (additions, deletions or modifications) of a data model (e....
The base frame for deriving all KiCad main window classes.