⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commands.h

📁 TabBars的开源源码
💻 H
字号:
// Commands.h : header file
/*********************************************************************
*	Author:		Simon Wang
*	Date:		2000-10-12
*	Contact us:	inte2000@263.net
*	Web Page: http://www.winmsg.com/cn/orbit.htm (for Chinese version)
*						http://www.winmsg.com/orbit.htm (for English version)
**********************************************************************/

#if !defined(AFX_COMMANDS_H__8549F5E1_E75A_4BE5_9A59_B192929065D4__INCLUDED_)
#define AFX_COMMANDS_H__8549F5E1_E75A_4BE5_9A59_B192929065D4__INCLUDED_

#include "TabBarsTypes.h"

class CCommands : 
	public CComDualImpl<ICommands, &IID_ICommands, &LIBID_TabBars>, 
	public CComObjectRoot,
	public CComCoClass<CCommands, &CLSID_Commands>
{
protected:
	IApplication* m_pApplication;

public:
	CCommands();
	~CCommands();
	void SetApplicationObject(IApplication* m_pApplication);
	IApplication* GetApplicationObject() { return m_pApplication; }
	void UnadviseFromEvents();

	BEGIN_COM_MAP(CCommands)
		COM_INTERFACE_ENTRY(IDispatch)
		COM_INTERFACE_ENTRY(ICommands)
	END_COM_MAP()
	DECLARE_NOT_AGGREGATABLE(CCommands)

protected:
	// This class template is used as the base class for the Application
	//  event handler object and the Debugger event handler object,
	//  which are declared below.
	template <class IEvents, const IID* piidEvents, const GUID* plibid,
		class XEvents, const CLSID* pClsidEvents>
	class XEventHandler :
		public CComDualImpl<IEvents, piidEvents, plibid>,
		public CComObjectRoot,
		public CComCoClass<XEvents, pClsidEvents>
	{
	public:
		BEGIN_COM_MAP(XEvents)
			COM_INTERFACE_ENTRY(IDispatch)
			COM_INTERFACE_ENTRY_IID(*piidEvents, IEvents)
		END_COM_MAP()
		DECLARE_NOT_AGGREGATABLE(XEvents)
		void Connect(IUnknown* pUnk)
		{ VERIFY(SUCCEEDED(AtlAdvise(pUnk, this, *piidEvents, &m_dwAdvise))); }
		void Disconnect(IUnknown* pUnk)
		{ AtlUnadvise(pUnk, *piidEvents, m_dwAdvise); }

		CCommands* m_pCommands;

	protected:
		DWORD m_dwAdvise;
	};

	// This object handles events fired by the Application object
	class XApplicationEvents : public XEventHandler<IApplicationEvents, 
		&IID_IApplicationEvents, &LIBID_TabBars, 
		XApplicationEvents, &CLSID_ApplicationEvents>
	{
	public:
		// IApplicationEvents methods
		STDMETHOD(BeforeBuildStart)(THIS);
		STDMETHOD(BuildFinish)(THIS_ long nNumErrors, long nNumWarnings);
		STDMETHOD(BeforeApplicationShutDown)(THIS);
		STDMETHOD(DocumentOpen)(THIS_ IDispatch * theDocument);
		STDMETHOD(BeforeDocumentClose)(THIS_ IDispatch * theDocument);
		STDMETHOD(DocumentSave)(THIS_ IDispatch * theDocument);
		STDMETHOD(NewDocument)(THIS_ IDispatch * theDocument);
		STDMETHOD(WindowActivate)(THIS_ IDispatch * theWindow);
		STDMETHOD(WindowDeactivate)(THIS_ IDispatch * theWindow);
		STDMETHOD(WorkspaceOpen)(THIS);
		STDMETHOD(WorkspaceClose)(THIS);
		STDMETHOD(NewWorkspace)(THIS);
	};
	typedef CComObject<XApplicationEvents> XApplicationEventsObj;
	XApplicationEventsObj* m_pApplicationEventsObj;

	// This object handles events fired by the Application object
	class XDebuggerEvents : public XEventHandler<IDebuggerEvents, 
		&IID_IDebuggerEvents, &LIBID_TabBars, 
		XDebuggerEvents, &CLSID_DebuggerEvents>
	{
	public:
		// IDebuggerEvents method
	    STDMETHOD(BreakpointHit)(THIS_ IDispatch * pBreakpoint);
	};
	typedef CComObject<XDebuggerEvents> XDebuggerEventsObj;
	XDebuggerEventsObj* m_pDebuggerEventsObj;
public:
	void ForceWindowReactivate();

  void DoHeaderFlip(CString cFullPath);//Switch file cpp/h
  void DoOpenAsText(CString cFullName);
  void DoSetCurrDir(CString cFullName); 
	BOOL PreaseFunctionDeclare(const CString & strFunction,CString & strFuncName,CStringArray & para,CString & strRetType);
public:
	STDMETHOD(OSOptions)(THIS);
	STDMETHOD(OSOpenDswInZip)(THIS);
	STDMETHOD(OSZipWorkspace)(THIS);
	STDMETHOD(OSInsertDiagram)(THIS);
	STDMETHOD(OSFuncDesc)(THIS);
	STDMETHOD(OSUnremark)(THIS);
	STDMETHOD(OSRemark)(THIS);
	STDMETHOD(OSBlockRemark)(THIS);
	STDMETHOD(OSOpenAsText)(THIS);
	STDMETHOD(OSSetCurrDir)(THIS);
	STDMETHOD(OSHeaderFlip)(THIS);
// ICommands methods
protected:
  CString GetActiveDocumentName() const;
  void FlashWindows(CComQIPtr<IWindows, &IID_IWindows>& pWindows, int cWindows, int iWindow) const;
	void OpenZippedWorkspace();
	BOOL ZipFolderToFile(LPCTSTR lpszFolder,LPCTSTR lpszOutputFile,LPCTSTR lpszFileTypes);
	void DoDiagram();
	BOOL EditDiagram(CString& sDiagram);
	BOOL FindDiagram(const CString& sText, int nLineSel);
};

typedef CComObject<CCommands> CCommandsObj;


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COMMANDS_H__8549F5E1_E75A_4BE5_9A59_B192929065D4__INCLUDED)

⌨️ 快捷键说明

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