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 BOOL 94 RemoveSelectedAppFromRegistry(); 95 BOOL 96 UninstallSelectedApp(BOOL bModify); 97 98 BOOL 99 ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId); 100 VOID 101 ShowAboutDlg(); 102 VOID 103 OnCommand(WPARAM wParam, LPARAM lParam); 104 VOID 105 UpdateStatusBarText(); 106 107 VOID 108 UpdateApplicationsList(AppsCategories EnumType, BOOL bReload = FALSE); 109 VOID 110 AddApplicationsToView(CAtlList<CAppInfo *> &List); 111 112 public: 113 static ATL::CWndClassInfo & 114 GetWndClassInfo(); 115 116 HWND 117 Create(); 118 119 // this function is called when a item of application-view is checked/unchecked 120 // CallbackParam is the param passed to application-view when adding the item (the one getting focus now). 121 VOID 122 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 127 InstallApplication(CAppInfo *Info); 128 129 // this function is called when search text is changed 130 BOOL 131 SearchTextChanged(CStringW &SearchText); 132 133 void 134 HandleTabOrder(int direction); 135 }; 136 137 // Main window 138 VOID 139 MainWindowLoop(CMainWindow *wnd, INT nShowCmd); 140