modelactionhandler.cpp

来自「A Model-View-Controller Framework that i」· C++ 代码 · 共 93 行

CPP
93
字号
// ActionHandler.cpp : implementation file
//

#include "stdafx.h"
#include "ModelActionHandler.h"
#include "ModelAction.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif


namespace SbjCore
{
	namespace Mvc
	{
		namespace Model
		{
			struct ActionHandlerImpl
			{
				Action* pTheAction; 
				HANDLE hItem;

				ActionHandlerImpl()
				{
				}
				virtual ~ActionHandlerImpl()
				{
				}
			};

			/////////////////////////////////////////////////////////

			IMPLEMENT_DYNCREATE(ActionHandler, CCmdTarget)

			ActionHandler::ActionHandler() :
				m_pImpl(new ActionHandlerImpl)
			{
			}

			ActionHandler::~ActionHandler()
			{
				try
				{
					delete m_pImpl;
				}
				catch(...)
				{
					ASSERT(FALSE);
				}
			}

			Action* ActionHandler::GetAction() const
			{
				return m_pImpl->pTheAction;
			}

			HANDLE ActionHandler::GetItem() const
			{
				return m_pImpl->hItem;
			}

			void ActionHandler::Initialize( Action* pAction, HANDLE hItem )
			{
				m_pImpl->pTheAction = pAction;
				m_pImpl->hItem = hItem;
			}

			int ActionHandler::BeginHandling()
			{
				return OnBeginHandling();
			}

			int ActionHandler::EndHandling()
			{
				return OnEndHandling();
			}

			int ActionHandler::OnBeginHandling()
			{
				return Action::kContinue;
			}

			int ActionHandler::OnEndHandling()
			{
				return Action::kContinue;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?