// RcSampleCmd.h : Declaration of the CRcSampleCmd
#pragma once

#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif

// text connector
// {460B9977-C68B-434e-9904-5C9843C55DC6}
RS_DEFINE_GUID(CON_SAMPLECMD_TEXTMGS, 
	0x460b9977, 0xc68b, 0x434e, 0x99, 0x4, 0x5c, 0x98, 0x43, 0xc5, 0x5d, 0xc6);


// {6DA4782F-05ED-4b81-BAFF-D29667A91E51}
RS_DEFINE_GUID(CON_SAMPLECMD_LOGTYPE, 
0x6da4782f, 0x5ed, 0x4b81, 0xba, 0xff, 0xd2, 0x96, 0x67, 0xa9, 0x1e, 0x51);


typedef enum tagRtLogTypeEvent
{
	LOGEVENT_INFO = 1,
	LOGEVENT_ERROR
} RtLogTypeEvent;

// IRcSampleCmd
MIDL_INTERFACE("13DFB1FD-F3C9-4275-AD8F-36CDB0E8410C")
IRcSampleCmd :IUnknown
{
};


// CRcSampleCmd
class ATL_NO_VTABLE CRcSampleCmd : 
    public CComObjectRootEx<CComGlobalsThreadModel>,
    public IRsUnknownNode,
    public IRsCommand,
	public IRcSampleCmd
{
private:
    /**@name Attributes */
    //@{
        /// RsBase interface (aggregated).
    CComPtr<IUnknown> m_spUnkAgg;
	
    //@}


public:
    /**@name methods */
    //@{
        /// Constructor, this constructor does nothing important.
	CRcSampleCmd()
	{
	}

	HRESULT FinalConstruct();
	
	void FinalRelease() 
	{
        m_spUnkAgg.Release();
	}

	    /**@name Methods of interface IRsCommand */
        //@{
        /** Execution method of command creates node CRnLinkEdit. 
            This node is automatically appended as SubObject to available
            Windows Manager nodes.
         */
    STDMETHOD(Execute)(void);
        /// This method does nothing because Undo/Redo for this command is not implemented.
    STDMETHOD(Undo)(void);
        /// This method does nothing because Undo/Redo for this command is not implemented.
    STDMETHOD(Redo)(void);
        /** This method allow to check if the command support Undo or not.
            @param isUndoable Out parameter is set to true when Undo is implemented otherwise
                   it is set to false.
        */
    STDMETHOD(HasUndo)(RtBool* isUndoable);
        //@}
	    /**@name Methods of interface IRsUnknownNode */
        //@{
        /// This method does nothing.
    STDMETHOD(OnGetValue)(CONID con_id, IRsDataCache* pDataCache, VARIANT* pVtData, RtBool* pHandled);
        /// This method does nothing.
    STDMETHOD(OnSetValue)(CONID con_id, IRsDataCache* pDataCache, VARIANT* pvtData, RtBool* pHandled);
    STDMETHOD(OnDefaultValue)(CONID con_id, VARIANT* pVtData, RtBool* pHandled);
        /// This method does nothing.
    STDMETHOD(OnInvalidate)(CONID con_id, RtBool* pHandled);
        /// This method does nothing.
    STDMETHOD(OnInitialize)(void);
        /// This method does nothing.
    STDMETHOD(OnLoadDefault)(void);
        /// This method does nothing.
    STDMETHOD(OnDestroy)(void);
        //@}
    //@}

	    
    // IRsObject
    RS_DECLARE_IRS_OBJECT(IRcSampleCmd, L"Sample Plugin Command")

    BEGIN_COM_MAP(CRcSampleCmd)
        COM_INTERFACE_ENTRY(IRcSampleCmd)
        COM_INTERFACE_ENTRY(IRsUnknownNode)
        COM_INTERFACE_ENTRY(IRsCommand)
        COM_INTERFACE_ENTRY2(IUnknown, IRsUnknownNode)
        COM_INTERFACE_ENTRY2(IRsObject, IRsUnknownNode)
        COM_INTERFACE_ENTRY_AGGREGATE(DEF_GUIDNAME(IRsBaseNode), m_spUnkAgg.p)
        COM_INTERFACE_ENTRY_AGGREGATE_BLIND(m_spUnkAgg.p)    // Just for safety, the speed is slower only for unknown interfaces
    END_COM_MAP()

    DECLARE_GET_CONTROLLING_UNKNOWN()
    DECLARE_PROTECT_FINAL_CONSTRUCT()
};
