convert line ends
[canaan.git] / prj / tech / libsrc / appcore / wappcore.h
blobf2df929f2097297ce0d203d8bb61ef2f57cdaf07
1 ///////////////////////////////////////////////////////////////////////////////
2 // $Source: x:/prj/tech/libsrc/appcore/RCS/wappcore.h $
3 // $Author: TOML $
4 // $Date: 1997/08/05 13:13:27 $
5 // $Revision: 1.18 $
6 //
8 #ifndef __WAPPCORE_H
9 #define __WAPPCORE_H
11 #include <comtools.h>
12 #include <comconn.h>
13 #include <appapi.h>
14 #include <wappapi.h>
15 #include <objcoll.h>
17 #include <str.h>
19 ///////////////////////////////////////////////////////////////////////////////
21 F_DECLARE_INTERFACE(IAggregate);
23 ///////////////////////////////////////////////////////////////////////////////
25 // class cWindowsApplication
27 // Implements IApplication and IWinApp
30 class cWindowsApplication
32 public:
33 cWindowsApplication(int argc, const char *argv[],
34 const char * pszName,
35 IUnknown * pOuterUnknown);
36 private:
38 // Command line values
40 int m_argc;
41 const char ** m_argv;
42 cStr m_NameStr;
44 ///////////////////////////////////////////////////////////////////////////
46 // class cWindowsApplication::cWinAppOperations
48 // Implements IWinApp on behalf of outer class
50 class cWinAppOperations : public IWinApp
52 DECLARE_DELEGATION();
53 public:
54 cWinAppOperations(cWindowsApplication * pWindowsApplication, IUnknown * pOuterUnknown)
55 : m_pWindowsApplication(pWindowsApplication), m_fFlags(0)
57 INIT_DELEGATION(pOuterUnknown);
60 STDMETHOD_(HWND, GetMainWnd)();
61 STDMETHOD_(HWND, SetMainWnd)(HWND);
63 STDMETHOD_(HINSTANCE, GetInstance)();
64 STDMETHOD_(HINSTANCE, GetResourceInstance)();
66 STDMETHOD_(const char *, GetCommandLine)();
67 STDMETHOD_(int, GetCommandShow)();
69 STDMETHOD_(void, SetRegistryKey)(const char *);
70 STDMETHOD_(const char *, GetRegistryKey)();
72 STDMETHOD_(void, SetProfileName)(const char *);
73 STDMETHOD_(const char *, GetProfileName)();
75 STDMETHOD_(void, SetDialogBkColor)(COLORREF clrCtlBk /* = RGB(192, 192, 192)*/,
76 COLORREF clrCtlText /* = RGB(0, 0, 0)*/ );
78 STDMETHOD_(eWinPumpResult, PumpEvents)(int fPumpFlags, eWinPumpDuration fDuration);
80 STDMETHOD (ModalDialogBox)(LPCTSTR lpTemplate, DLGPROC lpDialogFunc);
82 DECLARE_CONNECTION_POINT(IWinAppAdviseSink);
84 private:
85 eWinPumpResult DispatchOneMessage(MSG *, unsigned, unsigned);
86 int PreTranslateMessage(MSG *);
88 enum
90 kReceivedQuit = 0x01
93 HWND m_hMainWnd;
94 int m_fFlags;
96 cWindowsApplication * m_pWindowsApplication;
99 cWinAppOperations m_WinAppOperations;
101 ///////////////////////////////////////////////////////////////////////////
103 // class cWindowsApplication::cApplicationOperations
105 // Implements IApplication on behalf of outer class
107 class cApplicationOperations : public IApplication
109 DECLARE_DELEGATION();
110 public:
111 cApplicationOperations(cWindowsApplication * pWindowsApplication, IUnknown * pOuterUnknown)
112 : m_pWindowsApplication(pWindowsApplication)
114 INIT_DELEGATION(pOuterUnknown);
117 STDMETHOD (QueryQuit)();
118 STDMETHOD_(void, Quit)();
119 STDMETHOD_(void, Abort)(const char * pszReason);
121 STDMETHOD_(void, SetCaption)(const char *);
122 STDMETHOD_(const char *, GetCaption)();
124 STDMETHOD_(void, SetDefaultFilePath)(const char *);
125 STDMETHOD_(const char *, GetDefaultFilePath)();
127 STDMETHOD_(const char *, GetFullName)();
128 STDMETHOD_(const char *, GetPath)();
130 STDMETHOD_(int, MessageBox)(const char * pszMessage, const char * pszCaption, int fFlags);
131 STDMETHOD_(int, CriticalMessageBox)(const char * pszMessage, const char * pszCaption, int errorCode);
133 DECLARE_CONNECTION_POINT(IAppAdviseSink);
135 STDMETHOD_(void, AppCommand)(unsigned nCmdId);
137 private:
138 cWindowsApplication * m_pWindowsApplication;
141 cApplicationOperations m_ApplicationOperations;
143 friend class cWinAppOperations;
144 friend class cApplicationOperations;
146 DECLARE_SIMPLE_AGGREGATE_CONTROL(cWindowsApplication);
149 #endif /* !__WAPPCORE_H */