ReactOS  0.4.15-dev-5461-g062a8f2
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)
 
void SetRedraw (BOOL bRedraw)
 
void SetFocusOnSearchBar ()
 
BOOL SetDisplayAppType (APPLICATION_VIEW_TYPE AppType)
 
BOOL AddInstalledApplication (CInstalledApplicationInfo *InstAppInfo, LPVOID param)
 
BOOL AddAvailableApplication (CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID param)
 
VOID SetWatermark (const CStringW &Text)
 
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 345 of file appview.h.

Constructor & Destructor Documentation

◆ CApplicationView()

CApplicationView::CApplicationView ( CMainWindow MainWindow)

Definition at line 1929 of file appview.cpp.

1930  : m_MainWindow(MainWindow)
1931 {
1932 }
CMainWindow * m_MainWindow
Definition: appview.h:356

◆ ~CApplicationView()

CApplicationView::~CApplicationView ( )

Definition at line 1934 of file appview.cpp.

1935 {
1936  delete m_Toolbar;
1937  delete m_SearchBar;
1938  delete m_ListView;
1939  delete m_AppsInfo;
1940  delete m_HSplitter;
1941 }
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:352
CAppsListView * m_ListView
Definition: appview.h:353
CUiSplitPanel * m_HSplitter
Definition: appview.h:355
CMainToolbar * m_Toolbar
Definition: appview.h:350
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:354

Member Function Documentation

◆ AddAvailableApplication()

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

Definition at line 2039 of file appview.cpp.

2040 {
2042  {
2043  return FALSE;
2044  }
2045  return m_ListView->AddAvailableApplication(AvlbAppInfo, InitCheckState, param);
2046 }
BOOL AddAvailableApplication(CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID CallbackParam)
Definition: appview.cpp:1462
#define FALSE
Definition: types.h:117
GLfloat param
Definition: glext.h:5796
CAppsListView * m_ListView
Definition: appview.h:353
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:357

Referenced by CMainWindow::EnumAvailableAppProc().

◆ AddInstalledApplication()

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

Definition at line 2030 of file appview.cpp.

2031 {
2033  {
2034  return FALSE;
2035  }
2036  return m_ListView->AddInstalledApplication(InstAppInfo, param);
2037 }
#define FALSE
Definition: types.h:117
GLfloat param
Definition: glext.h:5796
CAppsListView * m_ListView
Definition: appview.h:353
BOOL AddInstalledApplication(CInstalledApplicationInfo *InstAppInfo, LPVOID CallbackParam)
Definition: appview.cpp:1423
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:357

Referenced by CMainWindow::EnumInstalledAppProc().

◆ AppendTabOrderWindow()

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

Reimplemented from CUiWindow< CWindowImpl< CApplicationView > >.

Definition at line 2069 of file appview.cpp.

2070 {
2071  m_Toolbar->AppendTabOrderWindow(Direction, TabOrderList);
2072  m_ComboBox->AppendTabOrderWindow(Direction, TabOrderList);
2073  m_SearchBar->AppendTabOrderWindow(Direction, TabOrderList);
2074  m_ListView->AppendTabOrderWindow(Direction, TabOrderList);
2075  m_AppsInfo->AppendTabOrderWindow(Direction, TabOrderList);
2076 
2077  return;
2078 }
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:352
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:353
CMainToolbar * m_Toolbar
Definition: appview.h:350
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:354
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:351

Referenced by CMainWindow::HandleTabOrder().

◆ CheckAll()

void CApplicationView::CheckAll ( )

Definition at line 2053 of file appview.cpp.

2054 {
2055  m_ListView->CheckAll();
2056  return;
2057 }
CAppsListView * m_ListView
Definition: appview.h:353
VOID CheckAll()
Definition: appview.cpp:1328

Referenced by CMainWindow::OnCommand().

◆ Create()

HWND CApplicationView::Create ( HWND  hwndParent)

Definition at line 1967 of file appview.cpp.

1968 {
1969  RECT r = { 0,0,0,0 };
1970 
1972 
1974 }
#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
#define L(x)
Definition: ntvdm.h:50
static HWND hwndParent
Definition: cryptui.c:300
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 1730 of file appview.cpp.

1731 {
1732  m_AppsInfo = new CAppInfoDisplay();
1736 
1737  return m_AppsInfo->Create(m_hWnd) != NULL;
1738 }
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:1050
CUiSplitPanel * m_HSplitter
Definition: appview.h:355
#define NULL
Definition: types.h:112
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:354

Referenced by ProcessWindowMessage().

◆ CreateComboBox()

BOOL CApplicationView::CreateComboBox ( )
private

Definition at line 1695 of file appview.cpp.

1696 {
1700  m_ComboBox->m_Margin.top = 4;
1701 
1702  return m_ComboBox->Create(m_Toolbar->m_hWnd) != NULL;
1703 }
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:350
CUiMargin m_Margin
Definition: rosui.h:240
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:351

Referenced by ProcessWindowMessage().

◆ CreateHSplitter()

BOOL CApplicationView::CreateHSplitter ( )
private

Definition at line 1705 of file appview.cpp.

1706 {
1707  m_HSplitter = new CUiSplitPanel();
1712  m_HSplitter->m_Pos = INT_MAX; //set INT_MAX to use lowest possible position (m_MinSecond)
1713  m_HSplitter->m_MinFirst = 10;
1714  m_HSplitter->m_MinSecond = 140;
1716 
1717  return m_HSplitter->Create(m_hWnd) != NULL;
1718 }
#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:355
#define NULL
Definition: types.h:112
CUiCollection & Children()
Definition: rosui.h:359
CUiPanel * m_Panel
Definition: appview.h:349

Referenced by ProcessWindowMessage().

◆ CreateListView()

BOOL CApplicationView::CreateListView ( )
private

Definition at line 1720 of file appview.cpp.

1721 {
1722  m_ListView = new CAppsListView();
1726 
1727  return m_ListView->Create(m_hWnd) != NULL;
1728 }
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:353
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
HWND Create(HWND hwndParent)
Definition: appview.cpp:1285
CUiSplitPanel * m_HSplitter
Definition: appview.h:355
#define NULL
Definition: types.h:112

Referenced by ProcessWindowMessage().

◆ CreateSearchBar()

BOOL CApplicationView::CreateSearchBar ( )
private

Definition at line 1684 of file appview.cpp.

1685 {
1689  m_SearchBar->m_Margin.top = 4;
1691 
1692  return m_SearchBar->Create(m_Toolbar->m_hWnd) != NULL;
1693 }
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:352
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:350
CUiMargin m_Margin
Definition: rosui.h:240

Referenced by ProcessWindowMessage().

◆ CreateToolbar()

BOOL CApplicationView::CreateToolbar ( )
private

Definition at line 1674 of file appview.cpp.

1675 {
1676  m_Toolbar = new CMainToolbar();
1680 
1681  return m_Toolbar->Create(m_hWnd) != NULL;
1682 }
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:350
CUiPanel * m_Panel
Definition: appview.h:349

Referenced by ProcessWindowMessage().

◆ GetFocusedItemData()

PVOID CApplicationView::GetFocusedItemData ( )

Definition at line 2059 of file appview.cpp.

2060 {
2061  return m_ListView->GetFocusedItemData();
2062 }
PVOID GetFocusedItemData()
Definition: appview.cpp:1345
CAppsListView * m_ListView
Definition: appview.h:353

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

◆ GetItemCount()

int CApplicationView::GetItemCount ( )

Definition at line 2064 of file appview.cpp.

2065 {
2066  return m_ListView->GetItemCount();
2067 }
CAppsListView * m_ListView
Definition: appview.h:353

Referenced by CMainWindow::UpdateApplicationsList(), and CMainWindow::UpdateStatusBarText().

◆ GetWndClassInfo()

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

Definition at line 1943 of file appview.cpp.

1944 {
1945  DWORD csStyle = CS_VREDRAW | CS_HREDRAW;
1946  static ATL::CWndClassInfo wc =
1947  {
1948  {
1949  sizeof(WNDCLASSEX),
1950  csStyle,
1951  StartWindowProc,
1952  0,
1953  0,
1954  NULL,
1955  NULL,
1956  NULL,
1957  (HBRUSH)(COLOR_BTNFACE + 1),
1958  NULL,
1959  L"RAppsApplicationView",
1960  NULL
1961  },
1962  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
1963  };
1964  return wc;
1965 }
#define TRUE
Definition: types.h:120
#define CS_HREDRAW
Definition: winuser.h:648
#define L(x)
Definition: ntvdm.h:50
#define CS_VREDRAW
Definition: winuser.h:653
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define COLOR_BTNFACE
Definition: winuser.h:922
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5709

◆ ItemCheckStateChanged()

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

Definition at line 2101 of file appview.cpp.

2102 {
2103  m_MainWindow->ItemCheckStateChanged(bChecked, CallbackParam);
2104  return TRUE;
2105 }
#define TRUE
Definition: types.h:120
CMainWindow * m_MainWindow
Definition: appview.h:356
BOOL ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam)
Definition: gui.cpp:763

Referenced by ProcessWindowMessage().

◆ ItemGetFocus()

BOOL CApplicationView::ItemGetFocus ( LPVOID  CallbackParam)

Definition at line 2082 of file appview.cpp.

2083 {
2084  switch (ApplicationViewType)
2085  {
2087  return m_AppsInfo->ShowInstalledAppInfo((CInstalledApplicationInfo *)CallbackParam);
2088 
2090  return m_AppsInfo->ShowAvailableAppInfo((CAvailableApplicationInfo *)CallbackParam);
2091 
2092  case AppViewTypeEmpty:
2093  default:
2095  return FALSE;
2096  }
2097 }
#define FALSE
Definition: types.h:117
BOOL ShowInstalledAppInfo(CInstalledApplicationInfo *Info)
Definition: appview.cpp:1072
VOID SetWelcomeText()
Definition: appview.cpp:1079
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:357
BOOL ShowAvailableAppInfo(CAvailableApplicationInfo *Info)
Definition: appview.cpp:1057
CAppInfoDisplay * m_AppsInfo
Definition: appview.h:354

Referenced by ProcessWindowMessage().

◆ OnCommand()

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

Definition at line 1811 of file appview.cpp.

1812 {
1813  if (lParam)
1814  {
1815  if ((HWND)lParam == m_SearchBar->GetWindow())
1816  {
1817  ATL::CStringW szBuf;
1818  switch (HIWORD(wParam))
1819  {
1820  case EN_SETFOCUS:
1821  {
1822  ATL::CStringW szWndText;
1823 
1824  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1825  m_SearchBar->GetWindowTextW(szWndText);
1826  if (szBuf == szWndText)
1827  {
1828  m_SearchBar->SetWindowTextW(L"");
1829  }
1830  }
1831  break;
1832 
1833  case EN_KILLFOCUS:
1834  {
1835  m_SearchBar->GetWindowTextW(szBuf);
1836  if (szBuf.IsEmpty())
1837  {
1838  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1839  m_SearchBar->SetWindowTextW(szBuf.GetString());
1840  }
1841  }
1842  break;
1843 
1844  case EN_CHANGE:
1845  {
1846  ATL::CStringW szWndText;
1847 
1848  szBuf.LoadStringW(IDS_SEARCH_TEXT);
1849  m_SearchBar->GetWindowTextW(szWndText);
1850  if (szBuf == szWndText)
1851  {
1852  szWndText = L"";
1853  m_MainWindow->SearchTextChanged(szWndText);
1854  }
1855  else
1856  {
1857  m_MainWindow->SearchTextChanged(szWndText);
1858  }
1859  }
1860  break;
1861  }
1862 
1863  return;
1864  }
1865  else if ((HWND)lParam == m_ComboBox->GetWindow())
1866  {
1867  int NotifyCode = HIWORD(wParam);
1868  switch (NotifyCode)
1869  {
1870  case CBN_SELCHANGE:
1871  int CurrSelection = m_ComboBox->SendMessageW(CB_GETCURSEL);
1872 
1873  int ViewModeList[] = { LV_VIEW_DETAILS, LV_VIEW_LIST, LV_VIEW_TILE };
1874  ATLASSERT(CurrSelection < (int)_countof(ViewModeList));
1875  if (!m_ListView->SetViewMode(ViewModeList[CurrSelection]))
1876  {
1877  MessageBoxW(L"View mode invalid or unimplemented");
1878  }
1879  break;
1880  }
1881 
1882  return;
1883  }
1884  else if ((HWND)lParam == m_Toolbar->GetWindow())
1885  {
1886  // the message is sent from Toolbar. fall down to continue process
1887  }
1888  else
1889  {
1890  return;
1891  }
1892  }
1893 
1894  // the LOWORD of wParam contains a Menu or Control ID
1895  WORD wCommand = LOWORD(wParam);
1896 
1897  switch (wCommand)
1898  {
1899  case ID_INSTALL:
1901  break;
1902 
1903  case ID_TOOLBAR_INSTALL:
1904  m_MainWindow->SendMessageW(WM_COMMAND, ID_INSTALL, 0);
1905  break;
1906 
1907  case ID_UNINSTALL:
1908  m_MainWindow->SendMessageW(WM_COMMAND, ID_UNINSTALL, 0);
1909  break;
1910 
1911  case ID_MODIFY:
1912  m_MainWindow->SendMessageW(WM_COMMAND, ID_MODIFY, 0);
1913  break;
1914 
1915  case ID_REGREMOVE:
1916  m_MainWindow->SendMessageW(WM_COMMAND, ID_REGREMOVE, 0);
1917  break;
1918 
1919  case ID_REFRESH:
1920  m_MainWindow->SendMessageW(WM_COMMAND, ID_REFRESH, 0);
1921  break;
1922 
1923  case ID_RESETDB:
1924  m_MainWindow->SendMessageW(WM_COMMAND, ID_RESETDB, 0);
1925  break;
1926  }
1927 }
#define ID_REFRESH
Definition: resource.h:16
_In_ ULONG NotifyCode
Definition: winddi.h:4265
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:352
#define ID_REGREMOVE
Definition: resource.h:83
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
BOOL SetViewMode(DWORD ViewMode)
Definition: appview.cpp:1418
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#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:1933
WPARAM wParam
Definition: combotst.c:138
#define L(x)
Definition: ntvdm.h:50
#define EN_KILLFOCUS
Definition: winuser.h:2015
#define EN_SETFOCUS
Definition: winuser.h:2017
BOOL InstallApplication(CAvailableApplicationInfo *Info)
Definition: gui.cpp:793
#define LV_VIEW_DETAILS
Definition: commctrl.h:2841
HWND GetWindow()
Definition: rosui.h:458
#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:353
#define WM_COMMAND
Definition: winuser.h:1730
#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:356
#define CBN_SELCHANGE
Definition: winuser.h:1969
#define LV_VIEW_LIST
Definition: commctrl.h:2843
BOOL SearchTextChanged(ATL::CStringW &SearchText)
Definition: gui.cpp:824
#define HIWORD(l)
Definition: typedefs.h:247
CMainToolbar * m_Toolbar
Definition: appview.h:350
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:2059
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:351
#define EN_CHANGE
Definition: winuser.h:2012

Referenced by ProcessWindowMessage().

◆ OnSize()

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

Definition at line 1751 of file appview.cpp.

1752 {
1753  if (wParam == SIZE_MINIMIZED)
1754  return;
1755 
1756  /* Size tool bar */
1757  m_Toolbar->AutoSize();
1758 
1759  /* Automatically hide captions */
1760  DWORD dToolbarTreshold = m_Toolbar->GetMaxButtonsWidth();
1761  DWORD dSearchbarMargin = (LOWORD(lParam) - m_SearchBar->m_Width - m_ComboBox->m_Width - TOOLBAR_PADDING * 2);
1762 
1763  if (dSearchbarMargin > dToolbarTreshold)
1764  {
1766  }
1767  else if (dSearchbarMargin < dToolbarTreshold)
1768  {
1770 
1771  }
1772 
1773  RECT r = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
1774  HDWP hdwp = NULL;
1776 
1777  hdwp = BeginDeferWindowPos(count);
1778  if (hdwp)
1779  {
1780  hdwp = m_Panel->OnParentSize(r, hdwp);
1781  if (hdwp)
1782  {
1783  EndDeferWindowPos(hdwp);
1784  }
1785  }
1786 
1788  hdwp = BeginDeferWindowPos(count);
1789  if (hdwp)
1790  {
1791  hdwp = m_SearchBar->OnParentSize(r, hdwp);
1792  if (hdwp)
1793  {
1794  EndDeferWindowPos(hdwp);
1795  }
1796  }
1797 
1800  hdwp = BeginDeferWindowPos(count);
1801  if (hdwp)
1802  {
1803  hdwp = m_ComboBox->OnParentSize(r, hdwp);
1804  if (hdwp)
1805  {
1806  EndDeferWindowPos(hdwp);
1807  }
1808  }
1809 }
DWORD GetMaxButtonsWidth() const
Definition: appview.cpp:174
int m_Width
Definition: appview.h:337
HDWP WINAPI BeginDeferWindowPos(_In_ int)
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:352
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:312
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:2496
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:350
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:351
CUiPanel * m_Panel
Definition: appview.h:349

Referenced by ProcessWindowMessage().

◆ ProcessWindowMessage()

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

Definition at line 1522 of file appview.cpp.

1523 {
1524  theResult = 0;
1525  switch (message)
1526  {
1527  case WM_CREATE:
1528  {
1529  BOOL bSuccess = TRUE;
1530  m_Panel = new CUiPanel();
1533 
1534  bSuccess &= CreateToolbar();
1536  bSuccess &= CreateComboBox();
1538  bSuccess &= CreateListView();
1540 
1541  m_Toolbar->AutoSize();
1542 
1543  RECT rTop;
1544 
1545  ::GetWindowRect(m_Toolbar->m_hWnd, &rTop);
1546  m_HSplitter->m_Margin.top = rTop.bottom - rTop.top;
1547  if (!bSuccess)
1548  {
1549  return -1; // creation failure
1550  }
1551  }
1552  break;
1553 
1554  case WM_NOTIFY:
1555  {
1556  LPNMHDR pNotifyHeader = (LPNMHDR)lParam;
1557  if (pNotifyHeader->hwndFrom == m_ListView->GetWindow())
1558  {
1559  switch (pNotifyHeader->code)
1560  {
1561  case LVN_ITEMCHANGED:
1562  {
1564 
1565  /* Check if this is a valid item
1566  * (technically, it can be also an unselect) */
1567  INT ItemIndex = pnic->iItem;
1568  if (ItemIndex == -1 ||
1569  ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
1570  {
1571  break;
1572  }
1573 
1574  /* Check if the focus has been moved to another item */
1575  if ((pnic->uChanged & LVIF_STATE) &&
1576  (pnic->uNewState & LVIS_FOCUSED) &&
1577  !(pnic->uOldState & LVIS_FOCUSED))
1578  {
1579  ItemGetFocus((LPVOID)pnic->lParam);
1580  }
1581 
1582  /* Check if the item is checked/unchecked */
1583  if (pnic->uChanged & LVIF_STATE)
1584  {
1585  int iOldState = STATEIMAGETOINDEX(pnic->uOldState);
1586  int iNewState = STATEIMAGETOINDEX(pnic->uNewState);
1587 
1588  if (iOldState == STATEIMAGE_UNCHECKED && iNewState == STATEIMAGE_CHECKED)
1589  {
1590  // this item is just checked
1593  }
1594  else if (iOldState == STATEIMAGE_CHECKED && iNewState == STATEIMAGE_UNCHECKED)
1595  {
1596  // this item is just unchecked
1599  }
1600  }
1601  }
1602  break;
1603 
1604  case LVN_COLUMNCLICK:
1605  {
1607 
1608  m_ListView->ColumnClick(pnmv);
1609  }
1610  break;
1611 
1612  case NM_DBLCLK:
1613  {
1615  if (Item->iItem != -1)
1616  {
1617  /* this won't do anything if the program is already installed */
1618 
1620  {
1622  }
1623  }
1624  }
1625  break;
1626 
1627  case NM_RCLICK:
1628  {
1629  if (((LPNMLISTVIEW)lParam)->iItem != -1)
1630  {
1631  ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL);
1632  }
1633  }
1634  break;
1635  }
1636  }
1637  else if (pNotifyHeader->hwndFrom == m_Toolbar->GetWindow())
1638  {
1639  switch (pNotifyHeader->code)
1640  {
1641  case TTN_GETDISPINFO:
1643  break;
1644  }
1645  }
1646  }
1647  break;
1648 
1649  case WM_SYSCOLORCHANGE:
1650  {
1651  /* Forward WM_SYSCOLORCHANGE to common controls */
1652  m_ListView->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1654  m_Toolbar->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1655  m_ComboBox->SendMessageW(WM_SYSCOLORCHANGE, wParam, lParam);
1656  }
1657  break;
1658 
1659  case WM_SIZE:
1660  {
1661  OnSize(hwnd, wParam, lParam);
1662  break;
1663  }
1664 
1665  case WM_COMMAND:
1666  {
1668  }
1669  break;
1670  }
1671  return FALSE;
1672 }
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
VOID OnGetDispInfo(LPTOOLTIPTEXT lpttt)
Definition: appview.cpp:71
Definition: tftpd.h:59
UINT uNewState
Definition: commctrl.h:3036
BOOL CreateComboBox()
Definition: appview.cpp:1695
#define TRUE
Definition: types.h:120
VOID ItemCheckStateNotify(int iItem, BOOL bCheck)
Definition: appview.cpp:1506
#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:433
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
VOID ColumnClick(LPNMLISTVIEW pnmv)
Definition: appview.cpp:1168
VOID OnCommand(WPARAM wParam, LPARAM lParam)
Definition: appview.cpp:1811
UINT code
Definition: winuser.h:3149
#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:2082
BOOL CreateHSplitter()
Definition: appview.cpp:1705
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:793
BOOL ItemCheckStateChanged(BOOL bChecked, LPVOID CallbackParam)
Definition: appview.cpp:2101
#define LPTOOLTIPTEXT
Definition: commctrl.h:1890
HWND GetWindow()
Definition: rosui.h:458
#define WM_SIZE
Definition: winuser.h:1601
CAppsListView * m_ListView
Definition: appview.h:353
BOOL CreateToolbar()
Definition: appview.cpp:1674
#define STATEIMAGE_CHECKED
Definition: appview.h:66
#define COLOR_BTNFACE
Definition: winuser.h:922
VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: appview.cpp:1751
#define WM_COMMAND
Definition: winuser.h:1730
HWND hwndFrom
Definition: winuser.h:3147
CUiAlignment m_VerticalAlignment
Definition: rosui.h:243
BOOL CreateAppInfoDisplay()
Definition: appview.cpp:1730
#define NM_DBLCLK
Definition: commctrl.h:131
#define ID_INSTALL
Definition: resource.h:74
CMainWindow * m_MainWindow
Definition: appview.h:356
struct tagNMLISTVIEW * LPNMLISTVIEW
BOOL CreateSearchBar()
Definition: appview.cpp:1684
#define NM_RCLICK
Definition: commctrl.h:133
CUiSplitPanel * m_HSplitter
Definition: appview.h:355
BOOL CreateListView()
Definition: appview.cpp:1720
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:357
#define WM_CREATE
Definition: winuser.h:1598
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:44
CMainToolbar * m_Toolbar
Definition: appview.h:350
LPARAM lParam
Definition: commctrl.h:3040
#define LVIF_STATE
Definition: commctrl.h:2312
CUiMargin m_Margin
Definition: rosui.h:240
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define LVIS_FOCUSED
Definition: commctrl.h:2318
CUiWindow< CComboBox > * m_ComboBox
Definition: appview.h:351
#define WM_NOTIFY
Definition: richedit.h:61
CUiPanel * m_Panel
Definition: appview.h:349

◆ SetDisplayAppType()

BOOL CApplicationView::SetDisplayAppType ( APPLICATION_VIEW_TYPE  AppType)

Definition at line 1976 of file appview.cpp.

1977 {
1978  if (!m_ListView->SetDisplayAppType(AppType))
1979  {
1980  return FALSE;
1981  }
1982  ApplicationViewType = AppType;
1984 
1985  HMENU hMenu = ::GetMenu(m_hWnd);
1986  switch (AppType)
1987  {
1988  case AppViewTypeEmpty:
1989  default:
1994 
1995  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
1996  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
1997  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
1998  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
1999  break;
2000 
2006 
2007  // TODO: instead of disable these button, I would rather remove them.
2008  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
2009  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
2010  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
2011  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
2012  break;
2013 
2019 
2020  // TODO: instead of disable these button, I would rather remove them.
2021  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_REGREMOVE, FALSE);
2022  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_INSTALL, TRUE);
2023  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_UNINSTALL, FALSE);
2024  m_Toolbar->SendMessageW(TB_ENABLEBUTTON, ID_MODIFY, FALSE);
2025  break;
2026  }
2027  return TRUE;
2028 }
#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:1355
#define MF_ENABLED
Definition: winuser.h:128
CAppsListView * m_ListView
Definition: appview.h:353
VOID SetWelcomeText()
Definition: appview.cpp:1079
#define ID_INSTALL
Definition: resource.h:74
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:357
CMainToolbar * m_Toolbar
Definition: appview.h:350
#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:354

Referenced by CMainWindow::UpdateApplicationsList().

◆ SetFocusOnSearchBar()

void CApplicationView::SetFocusOnSearchBar ( )

Definition at line 1746 of file appview.cpp.

1747 {
1748  m_SearchBar->SetFocus();
1749 }
HWND SetFocus()
Definition: atlwin.h:1192
CUiWindow< CSearchBar > * m_SearchBar
Definition: appview.h:352

Referenced by CMainWindow::OnCommand().

◆ SetRedraw()

void CApplicationView::SetRedraw ( BOOL  bRedraw)

Definition at line 1740 of file appview.cpp.

1741 {
1742  CWindow::SetRedraw(bRedraw);
1743  m_ListView->SetRedraw(bRedraw);
1744 }
CAppsListView * m_ListView
Definition: appview.h:353

Referenced by CMainWindow::UpdateApplicationsList().

◆ SetWatermark()

VOID CApplicationView::SetWatermark ( const CStringW Text)

Definition at line 2048 of file appview.cpp.

2049 {
2051 }
VOID SetWatermark(const CStringW &Text)
Definition: appview.cpp:1148
CAppsListView * m_ListView
Definition: appview.h:353
char * Text
Definition: combotst.c:136

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 356 of file appview.h.

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

◆ m_Panel

CUiPanel* CApplicationView::m_Panel = NULL
private

Definition at line 349 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: