You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# pragma once
# pragma once
# include "actionitem.h"
# include <set>
# include <memory>
namespace NAction
{
/**
* 组合 Action, 用于一次撤消多个 Action, 其实还有个 CActionListItem 支持这样的功能,但是它那个设计的太复杂了,不建议用
* 比如我们先操作点,再操作线,这两次行为我们要判定为一次操作,就可以把他们的 Action 都传进来,这样上面看到的只有一次了
*/
class CActionComboItem : public CActionItem
{
public :
CActionComboItem ( ) ;
CActionComboItem ( CSigmaDoc * ppDoc , UINT actionType ) ;
~ CActionComboItem ( ) ;
std : : string GetActionName ( ) const override
{
return typeid ( * this ) . name ( ) ;
}
/**
* 添加 ACtion, 注意: action 添加之后,该 action 生命周期被接管,外面不要再释放,同时不要重复添加的 action, 否则会 double free
*
* \param action
*/
void AddAction ( CActionItem * action ) ;
/**
* 移除指定 ACtion
*
* \param action
*/
void RemoveAction ( CActionItem * action ) ;
int GetCount ( ) const ;
void Clear ( ) ;
void Undo ( void ) override ;
void Redo ( void ) override ;
void accept ( CActionVisitor & visitor ) override ;
friend class BlobSerializer ;
private :
std : : list < std : : shared_ptr < CActionItem > > : : const_iterator FindAction ( CActionItem * action ) const ;
std : : list < std : : shared_ptr < CActionItem > > m_actionItems ;
std : : set < CActionItem * > m_cache ;
} ;
}