GME  13
SearchCtl.h
Go to the documentation of this file.
00001 #if !defined(AFX_SEARCHCTL_H__E14E5717_51B5_4F31_87EF_1512A4E4D109__INCLUDED_)
00002 #define AFX_SEARCHCTL_H__E14E5717_51B5_4F31_87EF_1512A4E4D109__INCLUDED_
00003 
00004 
00005 #if _MSC_VER > 1000
00006 #pragma once
00007 #endif // _MSC_VER > 1000
00008 
00009 #include "SearchDefs.h"
00010 #include "SearchDlg.h"
00011 
00012 
00013 // SearchCtl.h : Declaration of the CSearchCtrl ActiveX Control class.
00014 
00016 // CSearchCtrl : See SearchCtl.cpp for implementation.
00017 
00018 class CSearchCtrl : public COleControl
00019 {
00020         DECLARE_DYNCREATE(CSearchCtrl)
00021 
00022 // Constructor
00023 public:
00024         CSearchCtrl();
00025 
00026 // Overrides
00027         // ClassWizard generated virtual function overrides
00028         //{{AFX_VIRTUAL(CSearchCtrl)
00029         public:
00030         virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
00031         virtual void DoPropExchange(CPropExchange* pPX);
00032         virtual void OnResetState();
00033         protected:
00034         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00035         //}}AFX_VIRTUAL
00036 
00037 // These functions can be used from the dialog
00038 public: //there is a "protected:" in the AFX section above..
00039         CComPtr<IMgaProject> GetProject() { return m_project; }
00040         CComPtr<IMgaObjects> GetScopedL() { return m_MgaObjs; }
00041         void BeginTransaction(transactiontype_enum=TRANSACTION_READ_ONLY);
00042         void CommitTransaction();
00043         void AbortTransaction();
00044         CComPtr<IMgaTerritory> Terr();
00045         CComPtr<IMgaObjects> PutInMyTerritory(CComPtr<IMgaObjects> &in_coll);
00046         void ClickOnObject(CComPtr<IMgaObject> object);
00047         void ClickOnObject(CComPtr<IMgaObjects> object);
00048         void DblClickOnObject(CComPtr<IMgaObject> object);
00049         void WantToBeClosed();
00050         void LocateMgaObject(CComPtr<IMgaObject> object);
00051     virtual BOOL PreTranslateMessage(MSG *pMsg);
00052         
00053 
00054 // Implementation
00055 protected:
00056         ~CSearchCtrl();
00057 
00058         DECLARE_OLECREATE_EX(CSearchCtrl)    // Class factory and guid
00059         DECLARE_OLETYPELIB(CSearchCtrl)      // GetTypeInfo
00060         DECLARE_PROPPAGEIDS(CSearchCtrl)     // Property page IDs
00061         DECLARE_OLECTLTYPE(CSearchCtrl)         // Type name and misc status
00062 
00063         CSearchDlg      m_searchDlg;
00064         CComPtr<IMgaTerritory>  m_territory;
00065         CComPtr<IMgaProject>    m_project;
00066         CComPtr<IMgaObjects>    m_MgaObjs;
00067 
00068 // Message maps
00069         //{{AFX_MSG(CSearchCtrl)
00070         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00071         //}}AFX_MSG
00072         DECLARE_MESSAGE_MAP()
00073 
00074 // Dispatch maps
00075         //{{AFX_DISPATCH(CSearchCtrl)
00076         afx_msg LPUNKNOWN GetMgaProject();
00077         afx_msg void SetMgaProject(LPUNKNOWN newValue);
00078         afx_msg void OpenProject(LPCTSTR connStr);
00079         //}}AFX_DISPATCH
00080         DECLARE_DISPATCH_MAP()
00081 
00082         afx_msg void AboutBox();
00083 
00084 // MGA Event handlers
00085         void OnMgaObjectEvent(IMgaObject * obj, unsigned long eventmask);
00086         void OnMgaGlobalEvent(globalevent_enum event);
00087 
00088 // Event maps
00089         //{{AFX_EVENT(CSearchCtrl)
00090         void FireClickMgaObject(LPUNKNOWN mgaObject)
00091                 {FireEvent(eventidClickMgaObject,EVENT_PARAM(VTS_UNKNOWN), mgaObject);}
00092         void FireDblClickMgaObject(LPUNKNOWN mgaObject)
00093                 {FireEvent(eventidDblClickMgaObject,EVENT_PARAM(VTS_UNKNOWN), mgaObject);}
00094         void FireWantToBeClosed()
00095                 {FireEvent(eventidWantToBeClosed,EVENT_PARAM(VTS_NONE));}
00096     void FireLocateMgaObject(LPCTSTR mgaObjectId)
00097                 {FireEvent(eventidLocateMgaObject, EVENT_PARAM(VTS_BSTR), mgaObjectId);}
00098 
00099 
00100         //}}AFX_EVENT
00101         DECLARE_EVENT_MAP()
00102 
00103 // Native COM interfaces - peter
00104         DECLARE_INTERFACE_MAP()
00105 
00106         BEGIN_INTERFACE_PART(EventSink, IMgaEventSink)
00107                 STDMETHOD(GlobalEvent(globalevent_enum event));
00108                 STDMETHOD(ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v));
00109         END_INTERFACE_PART(EventSink)
00110 
00111 // Dispatch and event IDs
00112 public:
00113         enum {  
00114         //{{AFX_DISP_ID(CSearchCtrl)
00115         dispidMgaProject = 1L,
00116         dispidOpenProject = 2L,
00117         dispidSelMgaObjects = 3L,
00118         eventidClickMgaObject = 1L,
00119         eventidDblClickMgaObject = 2L,
00120         eventidWantToBeClosed = 3L,
00121         eventidLocateMgaObject = 4L,
00122         //}}AFX_DISP_ID
00123         };
00124 
00125 private:
00126 
00127         int     m_transactionCnt;
00128         bool m_inEventTransactionMode;
00129 protected:
00130         void SelMgaObjects(IUnknown* p_selMgaObjs);
00131 };
00132 
00133 //{{AFX_INSERT_LOCATION}}
00134 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00135 
00136 #endif // !defined(AFX_SEARCHCTL_H__E14E5717_51B5_4F31_87EF_1512A4E4D109__INCLUDED)