ReactOS  0.4.15-dev-1384-g878186b
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 1879 of file appview.cpp.

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

◆ ~CApplicationView()

CApplicationView::~CApplicationView ( )

Definition at line 1884 of file appview.cpp.

1885 {
1886  delete m_Toolbar;
1887  delete m_SearchBar;
1888  delete m_ListView;
1889  delete m_AppsInfo;
1890  delete m_HSplitter;
1891 }
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 1989 of file appview.cpp.

1990 {
1992  {
1993  return FALSE;
1994  }
1995  return m_ListView->AddAvailableApplication(AvlbAppInfo, InitCheckState, param);
1996 }
BOOL AddAvailableApplication(CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID CallbackParam)
Definition: appview.cpp:1423
#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 1980 of file appview.cpp.

1981 {
1983  {
1984  return FALSE;
1985  }
1986  return m_ListView->AddInstalledApplication(InstAppInfo, param);
1987 }
#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:1384
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 2014 of file appview.cpp.

2015 {
2016  m_Toolbar->AppendTabOrderWindow(Direction, TabOrderList);
2017  m_ComboBox->AppendTabOrderWindow(Direction, TabOrderList);
2018  m_SearchBar->AppendTabOrderWindow(Direction, TabOrderList);
2019  m_ListView->AppendTabOrderWindow(Direction, TabOrderList);
2020  m_AppsInfo->AppendTabOrderWindow(Direction, TabOrderList);
2021 
2022  return;
2023 }
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 1998 of file appview.cpp.

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

Referenced by CMainWindow::OnCommand().

◆ Create()

HWND CApplicationView::Create ( HWND  hwndParent)

Definition at line 1917 of file appview.cpp.

1918 {
1919  RECT r = { 0,0,0,0 };
1920 
1922 
1924 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_In_ BOOLEAN Create
Definition: pstypes.h:519
#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 1691 of file appview.cpp.

1692 {
1693  m_AppsInfo = new CAppInfoDisplay();
1697 
1698  return m_AppsInfo->Create(m_hWnd) != NULL;
1699 }
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:1047
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 1656 of file appview.cpp.

1657 {
1661  m_ComboBox->m_Margin.top = 4;
1662 
1663  return m_ComboBox->Create(m_Toolbar->m_hWnd) != NULL;
1664 }
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 1666 of file appview.cpp.

1667 {
1668  m_HSplitter = new CUiSplitPanel();
1673  m_HSplitter->m_Pos = INT_MAX; //set INT_MAX to use lowest possible position (m_MinSecond)
1674  m_HSplitter->m_MinFirst = 10;
1675  m_HSplitter->m_MinSecond = 140;
1677 
1678  return m_HSplitter->Create(m_hWnd) != NULL;
1679 }
#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 1681 of file appview.cpp.

1682 {
1683  m_ListView = new CAppsListView();
1687 
1688  return m_ListView->Create(m_hWnd) != NULL;
1689 }
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:1252
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
#define NULL
Definition: types.h:112

Referenced by ProcessWindowMessage().

◆ CreateSearchBar()

BOOL CApplicationView::CreateSearchBar ( )
private

Definition at line 1645 of file appview.cpp.

1646 {
1650  m_SearchBar->m_Margin.top = 4;
1652 
1653  return m_SearchBar->Create(m_Toolbar->m_hWnd) != NULL;
1654 }
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 1635 of file appview.cpp.

1636 {
1637  m_Toolbar = new CMainToolbar();
1641 
1642  return m_Toolbar->Create(m_hWnd) != NULL;
1643 }
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 2004 of file appview.cpp.

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

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

◆ GetItemCount()

int CApplicationView::GetItemCount ( )

Definition at line 2009 of file appview.cpp.

2010 {
2011  return m_ListView->GetItemCount();
2012 }
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 1893 of file appview.cpp.

1894 {
1895  DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
1896  static ATL::CWndClassInfo wc =
1897  {
1898  {
1899  sizeof(WNDCLASSEX),
1900  csStyle,
1901  StartWindowProc,
1902  0,
1903  0,
1904  NULL,
1905  NULL,
1906  NULL,
1907  (HBRUSH)(COLOR_BTNFACE + 1),
1908  NULL,
1909  L"RAppsApplicationView",
1910  NULL
1911  },
1912  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
1913  };
1914  return wc;
1915 }
#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 2046 of file appview.cpp.

2047 {
2048  m_MainWindow->ItemCheckStateChanged(bChecked, CallbackParam);
2049  return TRUE;
2050 }
#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 2027 of file appview.cpp.

2028 {
2029  switch (ApplicationViewType)
2030  {
2032  return m_AppsInfo->ShowInstalledAppInfo((CInstalledApplicationInfo *)CallbackParam);
2033 
2035  return m_AppsInfo->ShowAvailableAppInfo((CAvailableApplicationInfo *)CallbackParam);
2036 
2037  case AppViewTypeEmpty:
2038  default:
2040  return FALSE;
2041  }
2042 }
#define FALSE
Definition: types.h:117
BOOL ShowInstalledAppInfo(CInstalledApplicationInfo *Info)
Definition: appview.cpp:1069
VOID SetWelcomeText()
Definition: appview.cpp:1076
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:348
BOOL ShowAvailableAppInfo(CAvailableApplicationInfo *Info)
Definition: appview.cpp:1054
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:345

Referenced by ProcessWindowMessage().

◆ OnCommand()

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

Definition at line 1761 of file appview.cpp.

1762 {
1763  if (lParam)
1764  {
1765  if ((HWND)lParam == m_SearchBar->GetWindow())
1766  {
1767  ATL::CStringW szBuf;
1768  switch (HIWORD(wParam))
1769  {
1770  case EN_SETFOCUS:
1771  {
1772  ATL::CStringW szWndText;
1773 
1774  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1775  m_SearchBar->GetWindowTextW(szWndText);
1776  if (szBuf == szWndText)
1777  {
1778  m_SearchBar->SetWindowTextW(L"");
1779  }
1780  }
1781  break;
1782 
1783  case EN_KILLFOCUS:
1784  {
1785  m_SearchBar->GetWindowTextW(szBuf);
1786  if (szBuf.IsEmpty())
1787  {
1788  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1789  m_SearchBar->SetWindowTextW(szBuf.GetString());
1790  }
1791  }
1792  break;
1793 
1794  case EN_CHANGE:
1795  {
1796  ATL::CStringW szWndText;
1797 
1798  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1799  m_SearchBar->GetWindowTextW(szWndText);
1800  if (szBuf == szWndText)
1801  {
1802  szWndText = L"";
1803  m_MainWindow->SearchTextChanged(szWndText);
1804  }
1805  else
1806  {
1807  m_MainWindow->SearchTextChanged(szWndText);
1808  }
1809  }
1810  break;
1811  }
1812 
1813  return;
1814  }
1815  else if ((HWND)lParam == m_ComboBox->GetWindow())
1816  {
1817  int NotifyCode = HIWORD(wParam);
1818  switch (NotifyCode)
1819  {
1820  case CBN_SELCHANGE:
1821  int CurrSelection = m_ComboBox->SendMessageW(CB_GETCURSEL);
1822 
1823  int ViewModeList[] = { LV_VIEW_DETAILS, LV_VIEW_LIST, LV_VIEW_TILE };
1824  ATLASSERT(CurrSelection < (int)_countof(ViewModeList));
1825  if (!m_ListView->SetViewMode(ViewModeList[CurrSelection]))
1826  {
1827  MessageBoxW(L"View mode invalid or unimplemented");
1828  }
1829  break;
1830  }
1831 
1832  return;
1833  }
1834  else if ((HWND)lParam == m_Toolbar->GetWindow())
1835  {
1836  // the message is sent from Toolbar. fall down to continue process
1837  }
1838  else
1839  {
1840  return;
1841  }
1842  }
1843 
1844  // the LOWORD of wParam contains a Menu or Control ID
1845  WORD wCommand = LOWORD(wParam);
1846 
1847  switch (wCommand)
1848  {
1849  case ID_INSTALL:
1851  break;
1852 
1853  case ID_TOOLBAR_INSTALL:
1854  m_MainWindow->SendMessageW(WM_COMMAND, ID_INSTALL, 0);
1855  break;
1856 
1857  case ID_UNINSTALL:
1858  m_MainWindow->SendMessageW(WM_COMMAND, ID_UNINSTALL, 0);
1859  break;
1860 
1861  case ID_MODIFY:
1862  m_MainWindow->SendMessageW(WM_COMMAND, ID_MODIFY, 0);
1863  break;
1864 
1865  case ID_REGREMOVE:
1866  m_MainWindow->SendMessageW(WM_COMMAND, ID_REGREMOVE, 0);
1867  break;
1868 
1869  case ID_REFRESH:
1870  m_MainWindow->SendMessageW(WM_COMMAND, ID_REFRESH, 0);
1871  break;
1872 
1873  case ID_RESETDB:
1874  m_MainWindow->SendMessageW(WM_COMMAND, ID_RESETDB, 0);
1875  break;
1876  }
1877 }
#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:1379
#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:2837
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:2840
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:2839
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:2004
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 1701 of file appview.cpp.

1702 {
1703  if (wParam == SIZE_MINIMIZED)
1704  return;
1705 
1706  /* Size tool bar */
1707  m_Toolbar->AutoSize();
1708 
1709  /* Automatically hide captions */
1710  DWORD dToolbarTreshold = m_Toolbar->GetMaxButtonsWidth();
1711  DWORD dSearchbarMargin = (LOWORD(lParam) - m_SearchBar->m_Width - m_ComboBox->m_Width - TOOLBAR_PADDING * 2);
1712 
1713  if (dSearchbarMargin > dToolbarTreshold)
1714  {
1716  }
1717  else if (dSearchbarMargin < dToolbarTreshold)
1718  {
1720 
1721  }
1722 
1723  RECT r = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
1724  HDWP hdwp = NULL;
1726 
1727  hdwp = BeginDeferWindowPos(count);
1728  if (hdwp)
1729  {
1730  hdwp = m_Panel->OnParentSize(r, hdwp);
1731  if (hdwp)
1732  {
1733  EndDeferWindowPos(hdwp);
1734  }
1735  }
1736 
1738  hdwp = BeginDeferWindowPos(count);
1739  if (hdwp)
1740  {
1741  hdwp = m_SearchBar->OnParentSize(r, hdwp);
1742  if (hdwp)
1743  {
1744  EndDeferWindowPos(hdwp);
1745  }
1746  }
1747 
1750  hdwp = BeginDeferWindowPos(count);
1751  if (hdwp)
1752  {
1753  hdwp = m_ComboBox->OnParentSize(r, hdwp);
1754  if (hdwp)
1755  {
1756  EndDeferWindowPos(hdwp);
1757  }
1758  }
1759 }
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:376
#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 1483 of file appview.cpp.

1484 {
1485  theResult = 0;
1486  switch (message)
1487  {
1488  case WM_CREATE:
1489  {
1490  BOOL bSuccess = TRUE;
1491  m_Panel = new CUiPanel();
1494 
1495  bSuccess &= CreateToolbar();
1497  bSuccess &= CreateComboBox();
1499  bSuccess &= CreateListView();
1501 
1502  m_Toolbar->AutoSize();
1503 
1504  RECT rTop;
1505 
1506  ::GetWindowRect(m_Toolbar->m_hWnd, &rTop);
1507  m_HSplitter->m_Margin.top = rTop.bottom - rTop.top;
1508  if (!bSuccess)
1509  {
1510  return -1; // creation failure
1511  }
1512  }
1513  break;
1514 
1515  case WM_NOTIFY:
1516  {
1517  LPNMHDR pNotifyHeader = (LPNMHDR)lParam;
1518  if (pNotifyHeader->hwndFrom == m_ListView->GetWindow())
1519  {
1520  switch (pNotifyHeader->code)
1521  {
1522  case LVN_ITEMCHANGED:
1523  {
1525 
1526  /* Check if this is a valid item
1527  * (technically, it can be also an unselect) */
1528  INT ItemIndex = pnic->iItem;
1529  if (ItemIndex == -1 ||
1530  ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
1531  {
1532  break;
1533  }
1534 
1535  /* Check if the focus has been moved to another item */
1536  if ((pnic->uChanged & LVIF_STATE) &&
1537  (pnic->uNewState & LVIS_FOCUSED) &&
1538  !(pnic->uOldState & LVIS_FOCUSED))
1539  {
1540  ItemGetFocus((LPVOID)pnic->lParam);
1541  }
1542 
1543  /* Check if the item is checked/unchecked */
1544  if (pnic->uChanged & LVIF_STATE)
1545  {
1546  int iOldState = STATEIMAGETOINDEX(pnic->uOldState);
1547  int iNewState = STATEIMAGETOINDEX(pnic->uNewState);
1548 
1549  if (iOldState == STATEIMAGE_UNCHECKED && iNewState == STATEIMAGE_CHECKED)
1550  {
1551  // this item is just checked
1554  }
1555  else if (iOldState == STATEIMAGE_CHECKED && iNewState == STATEIMAGE_UNCHECKED)
1556  {
1557  // this item is just unchecked
1560  }
1561  }
1562  }
1563  break;
1564 
1565  case LVN_COLUMNCLICK:
1566  {
1568 
1569  m_ListView->ColumnClick(pnmv);
1570  }
1571  break;
1572 
1573  case NM_DBLCLK:
1574  {
1576  if (Item->iItem != -1)
1577  {
1578  /* this won't do anything if the program is already installed */
1579 
1581  {
1583  }
1584  }
1585  }
1586  break;
1587 
1588  case NM_RCLICK:
1589  {
1590  if (((LPNMLISTVIEW)lParam)->iItem != -1)
1591  {
1592  ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL);
1593  }
1594  }
1595  break;
1596  }
1597  }
1598  else if (pNotifyHeader->hwndFrom == m_Toolbar->GetWindow())
1599  {
1600  switch (pNotifyHeader->code)
1601  {
1602  case TTN_GETDISPINFO:
1604  break;
1605  }
1606  }
1607  }
1608  break;
1609 
1610  case WM_SYSCOLORCHANGE:
1611  {
1612  /* Forward WM_SYSCOLORCHANGE to common controls */
1613  m_ListView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1615  m_Toolbar->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1616  m_ComboBox->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1617  }
1618  break;
1619 
1620  case WM_SIZE:
1621  {
1622  OnSize(hwnd, wParam, lParam);
1623  break;
1624  }
1625 
1626  case WM_COMMAND:
1627  {
1629  }
1630  break;
1631  }
1632  return FALSE;
1633 }
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:3032
BOOL CreateComboBox()
Definition: appview.cpp:1656
#define TRUE
Definition: types.h:120
VOID ItemCheckStateNotify(int iItem, BOOL bCheck)
Definition: appview.cpp:1467
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
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:419
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
VOID ColumnClick(LPNMLISTVIEW pnmv)
Definition: appview.cpp:1135
VOID OnCommand(WPARAM wParam, LPARAM lParam)
Definition: appview.cpp:1761
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:2027
BOOL CreateHSplitter()
Definition: appview.cpp:1666
CUiAlignment m_HorizontalAlignment
Definition: rosui.h:242
#define TTN_GETDISPINFO
Definition: commctrl.h:1874
UINT uOldState
Definition: commctrl.h:3033
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
DWORD AutoSize()
Definition: rosctrls.h:376
#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:2046
#define LPTOOLTIPTEXT
Definition: commctrl.h:1886
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:1635
#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:1701
#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:1691
#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:1645
#define NM_RCLICK
Definition: commctrl.h:133
CUiSplitPanel * m_HSplitter
Definition: appview.h:346
BOOL CreateListView()
Definition: appview.cpp:1681
#define LVN_COLUMNCLICK
Definition: commctrl.h:3135
_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:3036
#define LVIF_STATE
Definition: commctrl.h:2308
CUiMargin m_Margin
Definition: rosui.h:240
LPARAM lParam
Definition: combotst.c:139
#define LVIS_FOCUSED
Definition: commctrl.h:2314
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 1926 of file appview.cpp.

1927 {
1928  if (!m_ListView->SetDisplayAppType(AppType))
1929  {
1930  return FALSE;
1931  }
1932  ApplicationViewType = AppType;
1934 
1935  HMENU hMenu = ::GetMenu(m_hWnd);
1936  switch (AppType)
1937  {
1938  case AppViewTypeEmpty:
1939  default:
1944 
1945  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
1946  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
1947  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
1948  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
1949  break;
1950 
1956 
1957  // TODO: instead of disable these button, I would rather remove them.
1958  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
1959  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
1960  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
1961  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
1962  break;
1963 
1969 
1970  // TODO: instead of disable these button, I would rather remove them.
1971  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, FALSE);
1972  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, TRUE);
1973  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, FALSE);
1974  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, FALSE);
1975  break;
1976  }
1977  return TRUE;
1978 }
#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:1038
BOOL SetDisplayAppType(APPLICATION_VIEW_TYPE AppType)
Definition: appview.cpp:1316
#define MF_ENABLED
Definition: winuser.h:128
CAppsListView * m_ListView
Definition: appview.h:344
VOID SetWelcomeText()
Definition: appview.cpp:1076
#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: