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 61 CStringW szSearchPattern; 62 AppsCategories SelectedEnumType; 63 64 public: 65 CMainWindow(CAppDB *db); 66 67 ~CMainWindow(); 68 69 private: 70 VOID 71 InitCategoriesList(); 72 73 BOOL 74 CreateStatusBar(); 75 BOOL 76 CreateTreeView(); 77 BOOL 78 CreateApplicationView(); 79 BOOL 80 CreateVSplitter(); 81 BOOL 82 CreateLayout(); 83 VOID 84 LayoutCleanup(); 85 BOOL 86 InitControls(); 87 88 VOID 89 OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam); 90 91 BOOL 92 RemoveSelectedAppFromRegistry(); 93 BOOL 94 UninstallSelectedApp(BOOL bModify); 95 96 BOOL 97 ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId); 98 VOID 99 ShowAboutDlg(); 100 VOID 101 OnCommand(WPARAM wParam, LPARAM lParam); 102 VOID 103 UpdateStatusBarText(); 104 105 VOID 106 UpdateApplicationsList(AppsCategories EnumType, BOOL bReload = FALSE); 107 VOID 108 AddApplicationsToView(CAtlList<CAppInfo *> &List); 109 110 public: 111 static ATL::CWndClassInfo & 112 GetWndClassInfo(); 113 114 HWND 115 Create(); 116 117 // this function is called when a item of application-view is checked/unchecked 118 // CallbackParam is the param passed to application-view when adding the item (the one getting focus now). 119 VOID 120 ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam); 121 122 // this function is called when application-view is asked to install an application 123 // if Info is not zero, this app should be installed. otherwise those checked apps should be installed 124 BOOL 125 InstallApplication(CAppInfo *Info); 126 127 // this function is called when search text is changed 128 BOOL 129 SearchTextChanged(CStringW &SearchText); 130 131 void 132 HandleTabOrder(int direction); 133 }; 134