xref: /reactos/base/applications/rapps/include/gui.h (revision 3ca21762)
1 #pragma once
2 
3 #include "rapps.h"
4 #include "rosui.h"
5 #include "crichedit.h"
6 #include "asyncinet.h"
7 #include "misc.h"
8 #include "appview.h"
9 #include <shlobj_undoc.h>
10 #include <shlguid_undoc.h>
11 
12 #include <atlbase.h>
13 #include <atlcom.h>
14 #include <atltypes.h>
15 #include <atlwin.h>
16 #include <wininet.h>
17 #include <shellutils.h>
18 #include <rosctrls.h>
19 #include <gdiplus.h>
20 #include <math.h>
21 
22 #define SEARCH_TIMER_ID 'SR'
23 #define TREEVIEW_ICON_SIZE 24
24 
25 
26 
27 class CSideTreeView :
28     public CUiWindow<CTreeView>
29 {
30     HIMAGELIST hImageTreeView;
31 
32 public:
33     CSideTreeView();
34 
35     HTREEITEM AddItem(HTREEITEM hParent, ATL::CStringW &Text, INT Image, INT SelectedImage, LPARAM lParam);
36 
37     HTREEITEM AddCategory(HTREEITEM hRootItem, UINT TextIndex, UINT IconIndex);
38 
39     HIMAGELIST SetImageList();
40 
41     VOID DestroyImageList();
42 
43     ~CSideTreeView();
44 };
45 
46 class CMainWindow :
47     public CWindowImpl<CMainWindow, CWindow, CFrameWinTraits>
48 {
49     CUiPanel *m_ClientPanel = NULL;
50     CUiSplitPanel *m_VSplitter = NULL;
51 
52     CSideTreeView *m_TreeView = NULL;
53     CUiWindow<CStatusBar> *m_StatusBar = NULL;
54 
55     CApplicationView *m_ApplicationView = NULL;
56 
57     CAvailableApps m_AvailableApps;
58     CInstalledApps m_InstalledApps;
59 
60     BOOL bUpdating = FALSE;
61 
62     ATL::CStringW szSearchPattern;
63     INT SelectedEnumType;
64 
65 public:
66     CMainWindow();
67 
68     ~CMainWindow();
69 private:
70 
71     VOID InitCategoriesList();
72 
73     BOOL CreateStatusBar();
74 
75     BOOL CreateTreeView();
76 
77     BOOL CreateApplicationView();
78 
79     BOOL CreateVSplitter();
80 
81     BOOL CreateLayout();
82 
83     VOID LayoutCleanup();
84 
85     BOOL InitControls();
86 
87     VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam);
88 
89     BOOL RemoveSelectedAppFromRegistry();
90 
91     BOOL UninstallSelectedApp(BOOL bModify);
92 
93     BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId);
94 
95     BOOL IsSelectedNodeInstalled();
96 
97     VOID ShowAboutDlg();
98 
99     VOID OnCommand(WPARAM wParam, LPARAM lParam);
100 
101     BOOL CALLBACK EnumInstalledAppProc(CInstalledApplicationInfo *Info);
102 
103     BOOL CALLBACK EnumAvailableAppProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState);
104 
105     static BOOL CALLBACK s_EnumInstalledAppProc(CInstalledApplicationInfo *Info, PVOID param);
106 
107     static BOOL CALLBACK s_EnumAvailableAppProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param);
108 
109     static BOOL CALLBACK s_EnumSelectedAppForDownloadProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param);
110 
111     VOID UpdateStatusBarText();
112 
113     VOID UpdateApplicationsList(INT EnumType);
114 
115 public:
116     static ATL::CWndClassInfo &GetWndClassInfo();
117 
118     HWND Create();
119 
120     // this function is called when a item of application-view is checked/unchecked
121     // CallbackParam is the param passed to application-view when adding the item (the one getting focus now).
122     BOOL ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam);
123 
124     // this function is called when application-view is asked to install an application
125     // if Info is not zero, this app should be installed. otherwise those checked apps should be installed
126     BOOL InstallApplication(CAvailableApplicationInfo *Info);
127 
128     // this function is called when search text is changed
129     BOOL SearchTextChanged(ATL::CStringW &SearchText);
130 
131     void HandleTabOrder(int direction);
132 };
133 
134 
135 VOID MainWindowLoop(INT nShowCmd);
136