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