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 <ui/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 BOOL CreateTreeView(); 75 BOOL CreateApplicationView(); 76 BOOL CreateVSplitter(); 77 BOOL CreateLayout(); 78 79 VOID LayoutCleanup(); 80 81 BOOL InitControls(); 82 83 VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam); 84 85 BOOL RemoveSelectedAppFromRegistry(); 86 87 BOOL UninstallSelectedApp(BOOL bModify); 88 89 BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId); 90 91 BOOL IsSelectedNodeInstalled(); 92 93 VOID ShowAboutDlg(); 94 95 VOID OnCommand(WPARAM wParam, LPARAM lParam); 96 97 BOOL CALLBACK EnumInstalledAppProc(CInstalledApplicationInfo *Info); 98 BOOL CALLBACK EnumAvailableAppProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState); 99 static BOOL CALLBACK s_EnumInstalledAppProc(CInstalledApplicationInfo *Info, PVOID param); 100 static BOOL CALLBACK s_EnumAvailableAppProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param); 101 102 static BOOL CALLBACK s_EnumSelectedAppForDownloadProc(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param); 103 104 VOID UpdateStatusBarText(); 105 106 VOID UpdateApplicationsList(INT EnumType); 107 108 public: 109 static ATL::CWndClassInfo &GetWndClassInfo(); 110 111 HWND Create(); 112 113 // this function is called when a item of application-view is checked/unchecked 114 // CallbackParam is the param passed to application-view when adding the item (the one getting focus now). 115 BOOL ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam); 116 117 // this function is called when application-view is asked to install an application 118 // if Info is not zero, this app should be installed. otherwise those checked apps should be installed 119 BOOL InstallApplication(CAvailableApplicationInfo *Info); 120 121 // this function is called when search text is changed 122 BOOL SearchTextChanged(ATL::CStringW &SearchText); 123 124 void HandleTabOrder(int direction); 125 }; 126 127 128 VOID MainWindowLoop(INT nShowCmd); 129