This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / subsys / system / explorer / Seashell / SeaShellExt / Include / UIApp.h
1 //*******************************************************************************
2 // COPYRIGHT NOTES
3 // ---------------
4 // You may use this source code, compile or redistribute it as part of your application 
5 // for free. You cannot redistribute it as a part of a software development 
6 // library without the agreement of the author. If the sources are 
7 // distributed along with the application, you should leave the original 
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
10 // 
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com 
13 // after Sept 2000
14 // 
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
17
18 #ifndef __UIAPP_H__
19 #define __UIAPP_H__
20
21 #ifndef __AFXWIN_H__
22         #error include 'stdafx.h' before including this file for PCH
23 #endif
24
25 class CTRL_EXT_CLASS CUIApp : public CWinApp
26 {
27         DECLARE_DYNAMIC(CUIApp)
28 public:
29         CUIApp();
30
31         void SetStatusBarText(UINT nPaneID,LPCTSTR Text,UINT nIconID=0);
32         void SetStatusBarText(UINT nPaneID,LPCTSTR Text,CView *pView,UINT nIconID=0);
33         void SetStatusBarText(UINT nPaneID,UINT nResID,UINT nIconID=0);
34         void SetStatusBarText(LPCTSTR Text);
35         void SetStatusBarIcon(UINT nPaneID,UINT nIconID,bool bAdd);
36         void SetStatusBarIdleMessage();
37         CString GetRegAppKey();
38
39         static bool COMMessage(HRESULT hr,UINT nID);
40         static void ErrorMessage(UINT nID,DWORD dwError=0);
41         static bool COMMessage(HRESULT hr,LPCTSTR pszMess=NULL);
42         static void ErrorMessage(LPCTSTR pszMess=NULL,DWORD dwError=0);
43 // Overrides
44         // ClassWizard generated virtual function overrides
45         //{{AFX_VIRTUAL(CUIApp)
46         public:
47         virtual BOOL InitInstance();
48         virtual int ExitInstance();
49         //}}AFX_VIRTUAL
50 //      CMultiDocTemplate* m_pWebSitesDocTemplate;
51         void ChangeProfile(LPCTSTR szRegistryKey,LPCTSTR szProfileName);
52         void RestoreProfile();
53 // Implementation
54         CFrameWnd *GetMainFrame(CWnd *pWnd);
55         CView *GetView(CRuntimeClass *pClass);
56         CDocTemplate *GetFirstDocTemplate();
57         CDocument *GetDocument();
58 protected:
59         bool RegisterMyClass();
60         BOOL FirstInstance();
61         //{{AFX_MSG(CUIApp)
62                 // NOTE - the ClassWizard will add and remove member functions here.
63                 //    DO NOT EDIT what you see in these blocks of generated code !
64         //}}AFX_MSG
65         DECLARE_MESSAGE_MAP()
66 private:
67         CString m_strOldProfileName;
68         CString m_strOldRegistryKey;
69         CString m_sMyClassName;
70         UINT m_IDMyIcon;
71         bool m_bMyClassRegistered;
72 public:
73         void SetMyClass(const CString &sMyClassName,UINT nIconID);
74         LPCTSTR GetMyClass() const;
75         bool IsMyClassRegistered() const;
76 };
77
78 inline bool CUIApp::IsMyClassRegistered() const
79 {
80         return m_bMyClassRegistered;
81 }
82
83 inline void CUIApp::SetMyClass(const CString &sMyClassName,UINT nIconID)
84 {
85         m_sMyClassName = sMyClassName;
86         m_IDMyIcon = nIconID;
87 }
88
89 inline LPCTSTR CUIApp::GetMyClass() const
90 {
91         return m_sMyClassName;
92 }
93
94 /////////////////////////////////////////////////////////////////////////////
95 class CTRL_EXT_CLASS CAppReg 
96 {
97 public:
98         CAppReg(CWinApp *pApp,LPCTSTR szRegistryKey,LPCTSTR szProfileName);
99         ~CAppReg();
100         CString GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault = NULL );
101         BOOL WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue );
102 private:
103         CUIApp *m_pApp;
104 };
105
106 inline BOOL CAppReg::WriteProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszValue )
107 {
108         return m_pApp->WriteProfileString(lpszSection,lpszEntry,lpszValue);
109 }
110
111 inline CString CAppReg::GetProfileString( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault)
112 {
113         return m_pApp->GetProfileString(lpszSection,lpszEntry,lpszDefault);
114 }
115
116
117 #endif //__UIAPP_H__