-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBEToolboxPlugin.h
136 lines (110 loc) · 4.4 KB
/
BEToolboxPlugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
///////////////////////////////////////////////////////////////////////
// BEToolbox
// Copyright © 1999-2025 Washington State Department of Transportation
// Bridge and Structures Office
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Alternate Route Open Source License as
// published by the Washington State Department of Transportation,
// Bridge and Structures Office.
//
// This program is distributed in the hope that it will be useful, but
// distribution is AS IS, WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the Alternate Route Open Source License for more details.
//
// You should have received a copy of the Alternate Route Open Source
// License along with this program; if not, write to the Washington
// State Department of Transportation, Bridge and Structures Office,
// P.O. Box 47340, Olympia, WA 98503, USA or e-mail
///////////////////////////////////////////////////////////////////////
// BEToolboxPlugin.h : Declaration of the CBEToolboxPlugin
#pragma once
#include "resource.h" // main symbols
#include <EAF\EAFAppPlugin.h>
#include <EAF\EAFAppPluginDocumentationImpl.h>
#include <EAF\EAFUIIntegration.h>
#include <EAF\EAFPluginManagerBase.h>
#include "BEToolboxTool.h"
#include "BEToolbox_i.h"
#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
class CBEToolboxToolManager : public CEAFPluginManagerBase<IBEToolboxTool, CEAFApp>
{
public:
std::vector<CEAFDocTemplate*> CreateDocumentTemplates()
{
std::vector<CEAFDocTemplate*> vTemplates;
vTemplates.reserve(m_Plugins.size());
for (auto& item : m_Plugins)
{
auto plugin = item.second;
vTemplates.push_back(plugin->CreateDocumentTemplate());
}
return vTemplates;
}
};
// CBEToolboxPlugin
class CBEToolboxPlugin;
class CMyCmdTarget : public CCmdTarget
{
public:
CMyCmdTarget() {};
afx_msg void OnManagePlugins();
afx_msg void OnManagePGStablePlugins();
CBEToolboxPlugin* m_pMyAppPlugin;
DECLARE_MESSAGE_MAP()
};
class ATL_NO_VTABLE CBEToolboxPlugin :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CBEToolboxPlugin, &CLSID_BEToolboxPlugin>,
public IEAFAppPlugin,
public IEAFCommandCallback
{
public:
CBEToolboxPlugin()
{
m_MyCmdTarget.m_pMyAppPlugin = this;
}
DECLARE_REGISTRY_RESOURCEID(IDR_BETOOLBOXPLUGIN)
BEGIN_COM_MAP(CBEToolboxPlugin)
COM_INTERFACE_ENTRY(IEAFAppPlugin)
COM_INTERFACE_ENTRY(IEAFCommandCallback)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
CMyCmdTarget m_MyCmdTarget;
void ManagePlugins();
void ManagePGStablePlugins();
// IEAFAppPlugin
public:
virtual BOOL Init(CEAFApp* pParent) override;
virtual void Terminate() override;
virtual void IntegrateWithUI(BOOL bIntegrate) override;
virtual std::vector<CEAFDocTemplate*> CreateDocTemplates() override;
virtual HMENU GetSharedMenuHandle() override;
virtual CString GetName() override;
virtual CString GetDocumentationSetName() override;
virtual CString GetDocumentationURL() override;
virtual CString GetDocumentationMapFile() override;
virtual void LoadDocumentationMap() override;
virtual eafTypes::HelpResult GetDocumentLocation(LPCTSTR lpszDocSetName,UINT nID,CString& strURL) override;
// IEAFCommandCallback
public:
virtual BOOL OnCommandMessage(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL GetStatusBarMessageString(UINT nID, CString& rMessage) const;
virtual BOOL GetToolTipMessageString(UINT nID, CString& rMessage) const;
private:
CEAFAppPluginDocumentationImpl m_DocumentationImpl;
CBEToolboxToolManager m_Tools;
};
OBJECT_ENTRY_AUTO(__uuidof(BEToolboxPlugin), CBEToolboxPlugin)