ReactOS  0.4.15-dev-2522-g9e0a3cd
CApplicationView Class Reference

#include <appview.h>

Inheritance diagram for CApplicationView:
Collaboration diagram for CApplicationView:

Public Member Functions

 CApplicationView (CMainWindow *MainWindow)
 
 ~CApplicationView ()
 
HWND Create (HWND hwndParent)
 
BOOL SetDisplayAppType (APPLICATION_VIEW_TYPE AppType)
 
BOOL AddInstalledApplication (CInstalledApplicationInfo *InstAppInfo, LPVOID param)
 
BOOL AddAvailableApplication (CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID param)
 
void CheckAll ()
 
PVOID GetFocusedItemData ()
 
int GetItemCount ()
 
VOID AppendTabOrderWindow (int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
 
BOOL ItemGetFocus (LPVOID CallbackParam)
 
BOOL ItemCheckStateChanged (BOOL bChecked, LPVOID CallbackParam)
 
- Public Member Functions inherited from CUiWindow< CWindowImpl< CApplicationView > >
virtual CUiBoxAsBox ()
 
HWND GetWindow ()
 
virtual VOID ComputeMinimalSize (SIZE *size)
 
virtual VOID ComputeContentBounds (RECT *rect)
 
virtual DWORD_PTR CountSizableChildren ()
 
virtual HDWP OnParentSize (RECT parentRect, HDWP hDwp)
 
virtual ~CUiWindow ()
 
VOID GetWindowTextW (ATL::CStringW &szText)
 
- Public Member Functions inherited from CUiPrimitive
virtual ~CUiPrimitive ()
 

Static Public Member Functions

static ATL::CWndClassInfoGetWndClassInfo ()
 

Private Member Functions

BOOL ProcessWindowMessage (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT &theResult, DWORD dwMapId)
 
BOOL CreateToolbar ()
 
BOOL CreateSearchBar ()
 
BOOL CreateComboBox ()
 
BOOL CreateHSplitter ()
 
BOOL CreateListView ()
 
BOOL CreateAppInfoDisplay ()
 
VOID OnSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
VOID OnCommand (WPARAM wParam, LPARAM lParam)
 

Private Attributes

CUiPanelm_Panel = NULL
 
CMainToolbarm_Toolbar = NULL
 
CUiWindow< CComboBox > * m_ComboBox = NULL
 
CUiWindow< CSearchBar > * m_SearchBar = NULL
 
CAppsListViewm_ListView = NULL
 
CAppInfoDisplaym_AppsInfo = NULL
 
CUiSplitPanelm_HSplitter = NULL
 
CMainWindowm_MainWindow = NULL
 
APPLICATION_VIEW_TYPE ApplicationViewType = AppViewTypeEmpty
 

Additional Inherited Members

- Public Attributes inherited from CUiBox
CUiMargin m_Margin
 
CUiAlignment m_HorizontalAlignment
 
CUiAlignment m_VerticalAlignment
 
- Protected Member Functions inherited from CUiBox
 CUiBox ()
 
virtual VOID ComputeRect (RECT parentRect, RECT currentRect, RECT *newRect)
 
- Protected Attributes inherited from CUiPrimitive
CUiPrimitivem_Parent
 

Detailed Description

Definition at line 336 of file appview.h.

Constructor & Destructor Documentation

◆ CApplicationView()

CApplicationView::CApplicationView ( CMainWindow MainWindow)

Definition at line 1880 of file appview.cpp.

1881  : m_MainWindow(MainWindow)
1882 {
1883 }
CMainWindow * m_MainWindow
Definition: appview.h:347

◆ ~CApplicationView()

CApplicationView::~CApplicationView ( )

Definition at line 1885 of file appview.cpp.

1886 {
1887  delete m_Toolbar;
1888  delete m_SearchBar;
1889  delete m_ListView;
1890  delete m_AppsInfo;
1891  delete m_HSplitter;
1892 }
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:343
CAppsListView * m_ListView
Definition: appview.h:344
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
CMainToolbar * m_Toolbar
Definition: appview.h:341
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:345

Member Function Documentation

◆ AddAvailableApplication()

BOOL CApplicationView::AddAvailableApplication ( CAvailableApplicationInfo AvlbAppInfo,
BOOL  InitCheckState,
LPVOID  param 
)

Definition at line 1990 of file appview.cpp.

1991 {
1993  {
1994  return FALSE;
1995  }
1996  return m_ListView->AddAvailableApplication(AvlbAppInfo, InitCheckState, param);
1997 }
BOOL AddAvailableApplication(CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID CallbackParam)
Definition: appview.cpp:1424
#define FALSE
Definition: types.h:117
GLfloat param
Definition: glext.h:5796
CAppsListView * m_ListView
Definition: appview.h:344
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:348

Referenced by CMainWindow::EnumAvailableAppProc().

◆ AddInstalledApplication()

BOOL CApplicationView::AddInstalledApplication ( CInstalledApplicationInfo InstAppInfo,
LPVOID  param 
)

Definition at line 1981 of file appview.cpp.

1982 {
1984  {
1985  return FALSE;
1986  }
1987  return m_ListView->AddInstalledApplication(InstAppInfo, param);
1988 }
#define FALSE
Definition: types.h:117
GLfloat param
Definition: glext.h:5796
CAppsListView * m_ListView
Definition: appview.h:344
BOOL AddInstalledApplication(CInstalledApplicationInfo *InstAppInfo, LPVOID CallbackParam)
Definition: appview.cpp:1385
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:348

Referenced by CMainWindow::EnumInstalledAppProc().

◆ AppendTabOrderWindow()

VOID CApplicationView::AppendTabOrderWindow ( int  Direction,
ATL::CSimpleArray< HWND > &  TabOrderList 
)
virtual

Reimplemented from CUiWindow< CWindowImpl< CApplicationView > >.

Definition at line 2015 of file appview.cpp.

2016 {
2017  m_Toolbar->AppendTabOrderWindow(Direction, TabOrderList);
2018  m_ComboBox->AppendTabOrderWindow(Direction, TabOrderList);
2019  m_SearchBar->AppendTabOrderWindow(Direction, TabOrderList);
2020  m_ListView->AppendTabOrderWindow(Direction, TabOrderList);
2021  m_AppsInfo->AppendTabOrderWindow(Direction, TabOrderList);
2022 
2023  return;
2024 }
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:343
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION Direction
virtual VOID AppendTabOrderWindow(int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
Definition: rosui.h:500
CAppsListView * m_ListView
Definition: appview.h:344
CMainToolbar * m_Toolbar
Definition: appview.h:341
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:345
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:342

Referenced by CMainWindow::HandleTabOrder().

◆ CheckAll()

void CApplicationView::CheckAll ( )

Definition at line 1999 of file appview.cpp.

2000 {
2001  m_ListView->CheckAll();
2002  return;
2003 }
CAppsListView * m_ListView
Definition: appview.h:344
VOID CheckAll()
Definition: appview.cpp:1290

Referenced by CMainWindow::OnCommand().

◆ Create()

HWND CApplicationView::Create ( HWND  hwndParent)

Definition at line 1918 of file appview.cpp.

1919 {
1920  RECT r = { 0,0,0,0 };
1921 
1923 
1925 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_In_ BOOLEAN Create
Definition: pstypes.h:527
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define IDR_APPLICATIONMENU
Definition: resource.h:70
static HWND hwndParent
Definition: cryptui.c:300
static const WCHAR L[]
Definition: oid.c:1250
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
HINSTANCE hInst
Definition: dxdiag.c:13
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by CMainWindow::CreateApplicationView().

◆ CreateAppInfoDisplay()

BOOL CApplicationView::CreateAppInfoDisplay ( )
private

Definition at line 1692 of file appview.cpp.

1693 {
1694  m_AppsInfo = new CAppInfoDisplay();
1698 
1699  return m_AppsInfo->Create(m_hWnd) != NULL;
1700 }
CUiCollection & Second()
Definition: rosui.h:568
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
HWND Create(HWND hwndParent)
Definition: appview.cpp:1048
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
#define NULL
Definition: types.h:112
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:345

Referenced by ProcessWindowMessage().

◆ CreateComboBox()

BOOL CApplicationView::CreateComboBox ( )
private

Definition at line 1657 of file appview.cpp.

1658 {
1662  m_ComboBox->m_Margin.top = 4;
1663 
1664  return m_ComboBox->Create(m_Toolbar->m_hWnd) != NULL;
1665 }
LONG top
Definition: windef.h:307
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
#define NULL
Definition: types.h:112
HWND Create(HWND hwndParent)
Definition: appview.cpp:215
CMainToolbar * m_Toolbar
Definition: appview.h:341
CUiMargin m_Margin
Definition: rosui.h:240
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:342

Referenced by ProcessWindowMessage().

◆ CreateHSplitter()

BOOL CApplicationView::CreateHSplitter ( )
private

Definition at line 1667 of file appview.cpp.

1668 {
1669  m_HSplitter = new CUiSplitPanel();
1674  m_HSplitter->m_Pos = INT_MAX; //set INT_MAX to use lowest possible position (m_MinSecond)
1675  m_HSplitter->m_MinFirst = 10;
1676  m_HSplitter->m_MinSecond = 140;
1678 
1679  return m_HSplitter->Create(m_hWnd) != NULL;
1680 }
#define INT_MAX
Definition: limits.h:40
#define TRUE
Definition: types.h:120
INT m_MinFirst
Definition: rosui.h:544
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
INT m_MinSecond
Definition: rosui.h:545
HWND Create(HWND hwndParent)
Definition: rosui.h:803
BOOL m_DynamicFirst
Definition: rosui.h:543
BOOL m_Horizontal
Definition: rosui.h:542
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
INT m_Pos
Definition: rosui.h:541
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
#define NULL
Definition: types.h:112
CUiCollection & Children()
Definition: rosui.h:359
CUiPanel * m_Panel
Definition: appview.h:340

Referenced by ProcessWindowMessage().

◆ CreateListView()

BOOL CApplicationView::CreateListView ( )
private

Definition at line 1682 of file appview.cpp.

1683 {
1684  m_ListView = new CAppsListView();
1688 
1689  return m_ListView->Create(m_hWnd) != NULL;
1690 }
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
CUiCollection & First()
Definition: rosui.h:567
CAppsListView * m_ListView
Definition: appview.h:344
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
HWND Create(HWND hwndParent)
Definition: appview.cpp:1253
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
#define NULL
Definition: types.h:112

Referenced by ProcessWindowMessage().

◆ CreateSearchBar()

BOOL CApplicationView::CreateSearchBar ( )
private

Definition at line 1646 of file appview.cpp.

1647 {
1651  m_SearchBar->m_Margin.top = 4;
1653 
1654  return m_SearchBar->Create(m_Toolbar->m_hWnd) != NULL;
1655 }
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:343
LONG top
Definition: windef.h:307
LONG right
Definition: windef.h:308
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
#define TOOLBAR_PADDING
Definition: appview.h:38
HWND Create(HWND hwndParent)
Definition: appview.cpp:192
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
#define NULL
Definition: types.h:112
CMainToolbar * m_Toolbar
Definition: appview.h:341
CUiMargin m_Margin
Definition: rosui.h:240

Referenced by ProcessWindowMessage().

◆ CreateToolbar()

BOOL CApplicationView::CreateToolbar ( )
private

Definition at line 1636 of file appview.cpp.

1637 {
1638  m_Toolbar = new CMainToolbar();
1642 
1643  return m_Toolbar->Create(m_hWnd) != NULL;
1644 }
HWND Create(HWND hwndParent)
Definition: appview.cpp:107
INT Append(T *ptr)
Definition: rosui.h:79
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
#define NULL
Definition: types.h:112
CUiCollection & Children()
Definition: rosui.h:359
CMainToolbar * m_Toolbar
Definition: appview.h:341
CUiPanel * m_Panel
Definition: appview.h:340

Referenced by ProcessWindowMessage().

◆ GetFocusedItemData()

PVOID CApplicationView::GetFocusedItemData ( )

Definition at line 2005 of file appview.cpp.

2006 {
2007  return m_ListView->GetFocusedItemData();
2008 }
PVOID GetFocusedItemData()
Definition: appview.cpp:1307
CAppsListView * m_ListView
Definition: appview.h:344

Referenced by CMainWindow::OnCommand(), OnCommand(), CMainWindow::RemoveSelectedAppFromRegistry(), and CMainWindow::UninstallSelectedApp().

◆ GetItemCount()

int CApplicationView::GetItemCount ( )

Definition at line 2010 of file appview.cpp.

2011 {
2012  return m_ListView->GetItemCount();
2013 }
int GetItemCount()
Definition: rosctrls.h:121
CAppsListView * m_ListView
Definition: appview.h:344

Referenced by CMainWindow::UpdateStatusBarText().

◆ GetWndClassInfo()

ATL::CWndClassInfo & CApplicationView::GetWndClassInfo ( )
static

Definition at line 1894 of file appview.cpp.

1895 {
1896  DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
1897  static ATL::CWndClassInfo wc =
1898  {
1899  {
1900  sizeof(WNDCLASSEX),
1901  csStyle,
1902  StartWindowProc,
1903  0,
1904  0,
1905  NULL,
1906  NULL,
1907  NULL,
1908  (HBRUSH)(COLOR_BTNFACE + 1),
1909  NULL,
1910  L"RAppsApplicationView",
1911  NULL
1912  },
1913  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
1914  };
1915  return wc;
1916 }
#define TRUE
Definition: types.h:120
#define CS_HREDRAW
Definition: winuser.h:648
#define CS_VREDRAW
Definition: winuser.h:653
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define COLOR_BTNFACE
Definition: winuser.h:918
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694

◆ ItemCheckStateChanged()

BOOL CApplicationView::ItemCheckStateChanged ( BOOL  bChecked,
LPVOID  CallbackParam 
)

Definition at line 2047 of file appview.cpp.

2048 {
2049  m_MainWindow->ItemCheckStateChanged(bChecked, CallbackParam);
2050  return TRUE;
2051 }
#define TRUE
Definition: types.h:120
CMainWindow * m_MainWindow
Definition: appview.h:347
BOOL ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam)
Definition: gui.cpp:751

Referenced by ProcessWindowMessage().

◆ ItemGetFocus()

BOOL CApplicationView::ItemGetFocus ( LPVOID  CallbackParam)

Definition at line 2028 of file appview.cpp.

2029 {
2030  switch (ApplicationViewType)
2031  {
2033  return m_AppsInfo->ShowInstalledAppInfo((CInstalledApplicationInfo *)CallbackParam);
2034 
2036  return m_AppsInfo->ShowAvailableAppInfo((CAvailableApplicationInfo *)CallbackParam);
2037 
2038  case AppViewTypeEmpty:
2039  default:
2041  return FALSE;
2042  }
2043 }
#define FALSE
Definition: types.h:117
BOOL ShowInstalledAppInfo(CInstalledApplicationInfo *Info)
Definition: appview.cpp:1070
VOID SetWelcomeText()
Definition: appview.cpp:1077
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:348
BOOL ShowAvailableAppInfo(CAvailableApplicationInfo *Info)
Definition: appview.cpp:1055
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:345

Referenced by ProcessWindowMessage().

◆ OnCommand()

VOID CApplicationView::OnCommand ( WPARAM  wParam,
LPARAM  lParam 
)
private

Definition at line 1762 of file appview.cpp.

1763 {
1764  if (lParam)
1765  {
1766  if ((HWND)lParam == m_SearchBar->GetWindow())
1767  {
1768  ATL::CStringW szBuf;
1769  switch (HIWORD(wParam))
1770  {
1771  case EN_SETFOCUS:
1772  {
1773  ATL::CStringW szWndText;
1774 
1775  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1776  m_SearchBar->GetWindowTextW(szWndText);
1777  if (szBuf == szWndText)
1778  {
1779  m_SearchBar->SetWindowTextW(L"");
1780  }
1781  }
1782  break;
1783 
1784  case EN_KILLFOCUS:
1785  {
1786  m_SearchBar->GetWindowTextW(szBuf);
1787  if (szBuf.IsEmpty())
1788  {
1789  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1790  m_SearchBar->SetWindowTextW(szBuf.GetString());
1791  }
1792  }
1793  break;
1794 
1795  case EN_CHANGE:
1796  {
1797  ATL::CStringW szWndText;
1798 
1799  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1800  m_SearchBar->GetWindowTextW(szWndText);
1801  if (szBuf == szWndText)
1802  {
1803  szWndText = L"";
1804  m_MainWindow->SearchTextChanged(szWndText);
1805  }
1806  else
1807  {
1808  m_MainWindow->SearchTextChanged(szWndText);
1809  }
1810  }
1811  break;
1812  }
1813 
1814  return;
1815  }
1816  else if ((HWND)lParam == m_ComboBox->GetWindow())
1817  {
1818  int NotifyCode = HIWORD(wParam);
1819  switch (NotifyCode)
1820  {
1821  case CBN_SELCHANGE:
1822  int CurrSelection = m_ComboBox->SendMessageW(CB_GETCURSEL);
1823 
1824  int ViewModeList[] = { LV_VIEW_DETAILS, LV_VIEW_LIST, LV_VIEW_TILE };
1825  ATLASSERT(CurrSelection < (int)_countof(ViewModeList));
1826  if (!m_ListView->SetViewMode(ViewModeList[CurrSelection]))
1827  {
1828  MessageBoxW(L"View mode invalid or unimplemented");
1829  }
1830  break;
1831  }
1832 
1833  return;
1834  }
1835  else if ((HWND)lParam == m_Toolbar->GetWindow())
1836  {
1837  // the message is sent from Toolbar. fall down to continue process
1838  }
1839  else
1840  {
1841  return;
1842  }
1843  }
1844 
1845  // the LOWORD of wParam contains a Menu or Control ID
1846  WORD wCommand = LOWORD(wParam);
1847 
1848  switch (wCommand)
1849  {
1850  case ID_INSTALL:
1852  break;
1853 
1854  case ID_TOOLBAR_INSTALL:
1855  m_MainWindow->SendMessageW(WM_COMMAND, ID_INSTALL, 0);
1856  break;
1857 
1858  case ID_UNINSTALL:
1859  m_MainWindow->SendMessageW(WM_COMMAND, ID_UNINSTALL, 0);
1860  break;
1861 
1862  case ID_MODIFY:
1863  m_MainWindow->SendMessageW(WM_COMMAND, ID_MODIFY, 0);
1864  break;
1865 
1866  case ID_REGREMOVE:
1867  m_MainWindow->SendMessageW(WM_COMMAND, ID_REGREMOVE, 0);
1868  break;
1869 
1870  case ID_REFRESH:
1871  m_MainWindow->SendMessageW(WM_COMMAND, ID_REFRESH, 0);
1872  break;
1873 
1874  case ID_RESETDB:
1875  m_MainWindow->SendMessageW(WM_COMMAND, ID_RESETDB, 0);
1876  break;
1877  }
1878 }
#define ID_REFRESH
Definition: resource.h:16
_In_ ULONG NotifyCode
Definition: winddi.h:4265
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:343
#define ID_REGREMOVE
Definition: resource.h:83
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
BOOL SetViewMode(DWORD ViewMode)
Definition: appview.cpp:1380
#define ID_RESETDB
Definition: resource.h:84
#define IDS_SEARCH_TEXT
Definition: resource.h:91
#define ID_TOOLBAR_INSTALL
Definition: resource.h:87
#define ID_UNINSTALL
Definition: resource.h:75
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
#define EN_KILLFOCUS
Definition: winuser.h:2007
#define EN_SETFOCUS
Definition: winuser.h:2009
BOOL InstallApplication(CAvailableApplicationInfo *Info)
Definition: gui.cpp:781
#define LV_VIEW_DETAILS
Definition: commctrl.h:2841
HWND GetWindow()
Definition: rosui.h:458
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define _countof(array)
Definition: sndvol32.h:68
PCXSTR GetString() const
Definition: atlsimpstr.h:361
unsigned short WORD
Definition: ntddk_ex.h:93
VOID GetWindowTextW(ATL::CStringW &szText)
Definition: rosui.h:514
CAppsListView * m_ListView
Definition: appview.h:344
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1722
#define LV_VIEW_TILE
Definition: commctrl.h:2844
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define ID_INSTALL
Definition: resource.h:74
CMainWindow * m_MainWindow
Definition: appview.h:347
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define LV_VIEW_LIST
Definition: commctrl.h:2843
BOOL SearchTextChanged(ATL::CStringW &SearchText)
Definition: gui.cpp:812
#define HIWORD(l)
Definition: typedefs.h:247
CMainToolbar * m_Toolbar
Definition: appview.h:341
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define ID_MODIFY
Definition: resource.h:78
PVOID GetFocusedItemData()
Definition: appview.cpp:2005
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:342
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by ProcessWindowMessage().

◆ OnSize()

VOID CApplicationView::OnSize ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
private

Definition at line 1702 of file appview.cpp.

1703 {
1704  if (wParam == SIZE_MINIMIZED)
1705  return;
1706 
1707  /* Size tool bar */
1708  m_Toolbar->AutoSize();
1709 
1710  /* Automatically hide captions */
1711  DWORD dToolbarTreshold = m_Toolbar->GetMaxButtonsWidth();
1712  DWORD dSearchbarMargin = (LOWORD(lParam) - m_SearchBar->m_Width - m_ComboBox->m_Width - TOOLBAR_PADDING * 2);
1713 
1714  if (dSearchbarMargin > dToolbarTreshold)
1715  {
1717  }
1718  else if (dSearchbarMargin < dToolbarTreshold)
1719  {
1721 
1722  }
1723 
1724  RECT r = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
1725  HDWP hdwp = NULL;
1727 
1728  hdwp = BeginDeferWindowPos(count);
1729  if (hdwp)
1730  {
1731  hdwp = m_Panel->OnParentSize(r, hdwp);
1732  if (hdwp)
1733  {
1734  EndDeferWindowPos(hdwp);
1735  }
1736  }
1737 
1739  hdwp = BeginDeferWindowPos(count);
1740  if (hdwp)
1741  {
1742  hdwp = m_SearchBar->OnParentSize(r, hdwp);
1743  if (hdwp)
1744  {
1745  EndDeferWindowPos(hdwp);
1746  }
1747  }
1748 
1751  hdwp = BeginDeferWindowPos(count);
1752  if (hdwp)
1753  {
1754  hdwp = m_ComboBox->OnParentSize(r, hdwp);
1755  if (hdwp)
1756  {
1757  EndDeferWindowPos(hdwp);
1758  }
1759  }
1760 }
DWORD GetMaxButtonsWidth() const
Definition: appview.cpp:174
int m_Width
Definition: appview.h:328
HDWP WINAPI BeginDeferWindowPos(_In_ int)
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:343
VOID ShowButtonCaption()
Definition: appview.cpp:168
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:476
GLuint GLuint GLsizei count
Definition: gl.h:1545
const INT m_Width
Definition: appview.h:303
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:421
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
DWORD AutoSize()
Definition: rosctrls.h:378
#define TOOLBAR_PADDING
Definition: appview.h:38
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SIZE_MINIMIZED
Definition: winuser.h:2481
VOID HideButtonCaption()
Definition: appview.cpp:162
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
CMainToolbar * m_Toolbar
Definition: appview.h:341
CUiMargin m_Margin
Definition: rosui.h:240
virtual DWORD_PTR CountSizableChildren()
Definition: rosui.h:407
LPARAM lParam
Definition: combotst.c:139
virtual HDWP OnParentSize(RECT parentRect, HDWP hDwp)
Definition: rosui.h:481
#define LOWORD(l)
Definition: pedump.c:82
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:342
CUiPanel * m_Panel
Definition: appview.h:340

Referenced by ProcessWindowMessage().

◆ ProcessWindowMessage()

BOOL CApplicationView::ProcessWindowMessage ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult,
DWORD  dwMapId 
)
private

Definition at line 1484 of file appview.cpp.

1485 {
1486  theResult = 0;
1487  switch (message)
1488  {
1489  case WM_CREATE:
1490  {
1491  BOOL bSuccess = TRUE;
1492  m_Panel = new CUiPanel();
1495 
1496  bSuccess &= CreateToolbar();
1498  bSuccess &= CreateComboBox();
1500  bSuccess &= CreateListView();
1502 
1503  m_Toolbar->AutoSize();
1504 
1505  RECT rTop;
1506 
1507  ::GetWindowRect(m_Toolbar->m_hWnd, &rTop);
1508  m_HSplitter->m_Margin.top = rTop.bottom - rTop.top;
1509  if (!bSuccess)
1510  {
1511  return -1; // creation failure
1512  }
1513  }
1514  break;
1515 
1516  case WM_NOTIFY:
1517  {
1518  LPNMHDR pNotifyHeader = (LPNMHDR)lParam;
1519  if (pNotifyHeader->hwndFrom == m_ListView->GetWindow())
1520  {
1521  switch (pNotifyHeader->code)
1522  {
1523  case LVN_ITEMCHANGED:
1524  {
1526 
1527  /* Check if this is a valid item
1528  * (technically, it can be also an unselect) */
1529  INT ItemIndex = pnic->iItem;
1530  if (ItemIndex == -1 ||
1531  ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
1532  {
1533  break;
1534  }
1535 
1536  /* Check if the focus has been moved to another item */
1537  if ((pnic->uChanged & LVIF_STATE) &&
1538  (pnic->uNewState & LVIS_FOCUSED) &&
1539  !(pnic->uOldState & LVIS_FOCUSED))
1540  {
1541  ItemGetFocus((LPVOID)pnic->lParam);
1542  }
1543 
1544  /* Check if the item is checked/unchecked */
1545  if (pnic->uChanged & LVIF_STATE)
1546  {
1547  int iOldState = STATEIMAGETOINDEX(pnic->uOldState);
1548  int iNewState = STATEIMAGETOINDEX(pnic->uNewState);
1549 
1550  if (iOldState == STATEIMAGE_UNCHECKED && iNewState == STATEIMAGE_CHECKED)
1551  {
1552  // this item is just checked
1555  }
1556  else if (iOldState == STATEIMAGE_CHECKED && iNewState == STATEIMAGE_UNCHECKED)
1557  {
1558  // this item is just unchecked
1561  }
1562  }
1563  }
1564  break;
1565 
1566  case LVN_COLUMNCLICK:
1567  {
1569 
1570  m_ListView->ColumnClick(pnmv);
1571  }
1572  break;
1573 
1574  case NM_DBLCLK:
1575  {
1577  if (Item->iItem != -1)
1578  {
1579  /* this won't do anything if the program is already installed */
1580 
1582  {
1584  }
1585  }
1586  }
1587  break;
1588 
1589  case NM_RCLICK:
1590  {
1591  if (((LPNMLISTVIEW)lParam)->iItem != -1)
1592  {
1593  ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL);
1594  }
1595  }
1596  break;
1597  }
1598  }
1599  else if (pNotifyHeader->hwndFrom == m_Toolbar->GetWindow())
1600  {
1601  switch (pNotifyHeader->code)
1602  {
1603  case TTN_GETDISPINFO:
1605  break;
1606  }
1607  }
1608  }
1609  break;
1610 
1611  case WM_SYSCOLORCHANGE:
1612  {
1613  /* Forward WM_SYSCOLORCHANGE to common controls */
1614  m_ListView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1616  m_Toolbar->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1617  m_ComboBox->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1618  }
1619  break;
1620 
1621  case WM_SIZE:
1622  {
1623  OnSize(hwnd, wParam, lParam);
1624  break;
1625  }
1626 
1627  case WM_COMMAND:
1628  {
1630  }
1631  break;
1632  }
1633  return FALSE;
1634 }
DWORD_PTR GetItemData(int i)
Definition: rosctrls.h:204
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
VOID OnGetDispInfo(LPTOOLTIPTEXT lpttt)
Definition: appview.cpp:71
Definition: tftpd.h:59
UINT uNewState
Definition: commctrl.h:3036
BOOL CreateComboBox()
Definition: appview.cpp:1657
#define TRUE
Definition: types.h:120
VOID ItemCheckStateNotify(int iItem, BOOL bCheck)
Definition: appview.cpp:1468
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
LONG top
Definition: windef.h:307
#define STATEIMAGE_UNCHECKED
Definition: appview.h:65
int32_t INT
Definition: typedefs.h:58
static BOOLEAN bSuccess
Definition: drive.cpp:432
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
VOID ColumnClick(LPNMLISTVIEW pnmv)
Definition: appview.cpp:1136
VOID OnCommand(WPARAM wParam, LPARAM lParam)
Definition: appview.cpp:1762
UINT code
Definition: winuser.h:3134
#define STATEIMAGETOINDEX(x)
Definition: appview.h:61
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL ItemGetFocus(LPVOID CallbackParam)
Definition: appview.cpp:2028
BOOL CreateHSplitter()
Definition: appview.cpp:1667
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
#define TTN_GETDISPINFO
Definition: commctrl.h:1878
UINT uOldState
Definition: commctrl.h:3037
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
DWORD AutoSize()
Definition: rosctrls.h:378
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
struct tagNMITEMACTIVATE * LPNMITEMACTIVATE
BOOL InstallApplication(CAvailableApplicationInfo *Info)
Definition: gui.cpp:781
BOOL ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam)
Definition: appview.cpp:2047
#define LPTOOLTIPTEXT
Definition: commctrl.h:1890
HWND GetWindow()
Definition: rosui.h:458
#define WM_SIZE
Definition: winuser.h:1593
CAppsListView * m_ListView
Definition: appview.h:344
BOOL CreateToolbar()
Definition: appview.cpp:1636
#define STATEIMAGE_CHECKED
Definition: appview.h:66
#define COLOR_BTNFACE
Definition: winuser.h:918
VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: appview.cpp:1702
#define WM_COMMAND
Definition: winuser.h:1722
HWND hwndFrom
Definition: winuser.h:3132
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
BOOL CreateAppInfoDisplay()
Definition: appview.cpp:1692
#define NM_DBLCLK
Definition: commctrl.h:131
#define ID_INSTALL
Definition: resource.h:74
CMainWindow * m_MainWindow
Definition: appview.h:347
struct tagNMLISTVIEW * LPNMLISTVIEW
BOOL CreateSearchBar()
Definition: appview.cpp:1646
#define NM_RCLICK
Definition: commctrl.h:133
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
BOOL CreateListView()
Definition: appview.cpp:1682
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:348
#define WM_CREATE
Definition: winuser.h:1590
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
VOID ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
Definition: misc.cpp:76
CMainToolbar * m_Toolbar
Definition: appview.h:341
LPARAM lParam
Definition: commctrl.h:3040
#define LVIF_STATE
Definition: commctrl.h:2312
CUiMargin m_Margin
Definition: rosui.h:240
LPARAM lParam
Definition: combotst.c:139
#define LVIS_FOCUSED
Definition: commctrl.h:2318
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:342
#define WM_NOTIFY
Definition: richedit.h:61
CUiPanel * m_Panel
Definition: appview.h:340

◆ SetDisplayAppType()

BOOL CApplicationView::SetDisplayAppType ( APPLICATION_VIEW_TYPE  AppType)

Definition at line 1927 of file appview.cpp.

1928 {
1929  if (!m_ListView->SetDisplayAppType(AppType))
1930  {
1931  return FALSE;
1932  }
1933  ApplicationViewType = AppType;
1935 
1936  HMENU hMenu = ::GetMenu(m_hWnd);
1937  switch (AppType)
1938  {
1939  case AppViewTypeEmpty:
1940  default:
1945 
1946  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
1947  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
1948  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
1949  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
1950  break;
1951 
1957 
1958  // TODO: instead of disable these button, I would rather remove them.
1959  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
1960  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
1961  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
1962  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
1963  break;
1964 
1970 
1971  // TODO: instead of disable these button, I would rather remove them.
1972  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, FALSE);
1973  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, TRUE);
1974  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, FALSE);
1975  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, FALSE);
1976  break;
1977  }
1978  return TRUE;
1979 }
#define ID_REGREMOVE
Definition: resource.h:83
#define TRUE
Definition: types.h:120
#define ID_UNINSTALL
Definition: resource.h:75
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define FALSE
Definition: types.h:117
#define TB_ENABLEBUTTON
Definition: commctrl.h:1042
BOOL SetDisplayAppType(APPLICATION_VIEW_TYPE AppType)
Definition: appview.cpp:1317
#define MF_ENABLED
Definition: winuser.h:128
CAppsListView * m_ListView
Definition: appview.h:344
VOID SetWelcomeText()
Definition: appview.cpp:1077
#define ID_INSTALL
Definition: resource.h:74
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:348
CMainToolbar * m_Toolbar
Definition: appview.h:341
#define MF_GRAYED
Definition: winuser.h:129
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ID_MODIFY
Definition: resource.h:78
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:345

Referenced by CMainWindow::UpdateApplicationsList().

Member Data Documentation

◆ ApplicationViewType

APPLICATION_VIEW_TYPE CApplicationView::ApplicationViewType = AppViewTypeEmpty
private

◆ m_AppsInfo

CAppInfoDisplay* CApplicationView::m_AppsInfo = NULL
private

◆ m_ComboBox

CUiWindow<CComboBox>* CApplicationView::m_ComboBox = NULL
private

◆ m_HSplitter

CUiSplitPanel* CApplicationView::m_HSplitter = NULL
private

◆ m_ListView

◆ m_MainWindow

CMainWindow* CApplicationView::m_MainWindow = NULL
private

Definition at line 347 of file appview.h.

Referenced by ItemCheckStateChanged(), OnCommand(), and ProcessWindowMessage().

◆ m_Panel

CUiPanel* CApplicationView::m_Panel = NULL
private

Definition at line 340 of file appview.h.

Referenced by CreateHSplitter(), CreateToolbar(), OnSize(), and ProcessWindowMessage().

◆ m_SearchBar

CUiWindow<CSearchBar>* CApplicationView::m_SearchBar = NULL
private

◆ m_Toolbar


The documentation for this class was generated from the following files: