ReactOS 0.4.15-dev-8419-g7f0e8a3
CACListView Class Reference

#include <CAutoComplete.h>

Inheritance diagram for CACListView:
Collaboration diagram for CACListView:

Public Member Functions

 CACListView ()
 
HWND Create (HWND hwndParent)
 
VOID SetFont (HFONT hFont)
 
INT GetVisibleCount ()
 
CStringW GetItemText (INT iItem)
 
INT ItemFromPoint (INT x, INT y)
 
INT GetCurSel ()
 
VOID SetCurSel (INT iItem)
 
VOID SelectHere (INT x, INT y)
 

Static Public Member Functions

static LPCWSTR GetWndClassName ()
 

Public Attributes

CAutoCompletem_pDropDown
 
INT m_cyItem
 

Protected Member Functions

LRESULT OnButtonUp (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDown (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMRButtonDown (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMouseWheel (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNCHitTest (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Detailed Description

Definition at line 35 of file CAutoComplete.h.

Constructor & Destructor Documentation

◆ CACListView()

CACListView::CACListView ( )

Definition at line 380 of file CAutoComplete.cpp.

381{
382}
#define CY_ITEM
CAutoComplete * m_pDropDown
Definition: CAutoComplete.h:38
#define NULL
Definition: types.h:112

Member Function Documentation

◆ Create()

HWND CACListView::Create ( HWND  hwndParent)

Definition at line 384 of file CAutoComplete.cpp.

385{
386 ATLASSERT(m_hWnd == NULL);
387 DWORD dwStyle = WS_CHILD | /*WS_VISIBLE |*/ WS_CLIPSIBLINGS | LVS_NOCOLUMNHEADER |
389 HWND hWnd = ::CreateWindowExW(0, GetWndClassName(), L"Internet Explorer", dwStyle,
390 0, 0, 0, 0, hwndParent, NULL,
391 _AtlBaseModule.GetModuleInstance(), NULL);
392 SubclassWindow(hWnd); // do subclass to handle messages
393 // set extended listview style
395 SetExtendedListViewStyle(exstyle, exstyle);
396 // insert one column (needed to insert items)
398 column.fmt = LVCFMT_LEFT;
400 InsertColumn(0, &column);
401 return m_hWnd;
402}
#define CX_LIST
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HWND hWnd
Definition: settings.c:17
static LPCWSTR GetWndClassName()
Definition: CAutoComplete.h:40
static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
Definition: column.c:67
static HWND hwndParent
Definition: cryptui.c:300
unsigned long DWORD
Definition: ntddk_ex.h:95
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define LVS_EX_ONECLICKACTIVATE
Definition: commctrl.h:2735
#define LVS_SINGLESEL
Definition: commctrl.h:2266
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2284
#define LVS_OWNERDATA
Definition: commctrl.h:2274
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2283
#define LVS_REPORT
Definition: commctrl.h:2262
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVS_EX_TRACKSELECT
Definition: commctrl.h:2732
#define LV_COLUMNW
Definition: commctrl.h:2546
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define SM_CXVSCROLL
Definition: winuser.h:961
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
int WINAPI GetSystemMetrics(_In_ int)

Referenced by CAutoComplete::OnCreate().

◆ GetCurSel()

INT CACListView::GetCurSel ( )

Definition at line 454 of file CAutoComplete.cpp.

455{
456 return GetNextItem(-1, LVNI_ALL | LVNI_SELECTED);
457}
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define LVNI_ALL
Definition: commctrl.h:2422

Referenced by CAutoComplete::GetDropDownStatus(), CAutoComplete::OnEditKeyDown(), CAutoComplete::OnListSelChange(), and CAutoComplete::OnListUpDown().

◆ GetItemText()

CStringW CACListView::GetItemText ( INT  iItem)

Definition at line 436 of file CAutoComplete.cpp.

437{
438 // NOTE: LVS_OWNERDATA doesn't support LVM_GETITEMTEXT.
440 ATLASSERT(GetStyle() & LVS_OWNERDATA);
441 return m_pDropDown->GetItemText(iItem);
442}
CStringW GetItemText(INT iItem) const

Referenced by CAutoComplete::GetDropDownStatus(), CAutoComplete::OnDrawItem(), and OnLButtonDown().

◆ GetVisibleCount()

INT CACListView::GetVisibleCount ( )

Definition at line 426 of file CAutoComplete.cpp.

427{
428 if (m_cyItem <= 0) // avoid "division by zero"
429 return 0;
430 CRect rc;
431 GetClientRect(&rc);
432 return rc.Height() / m_cyItem;
433}
int Height() const noexcept
Definition: atltypes.h:318
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by CAutoComplete::OnListUpDown(), CAutoComplete::OnVScroll(), and CAutoComplete::UpdateScrollBar().

◆ GetWndClassName()

static LPCWSTR CACListView::GetWndClassName ( )
inlinestatic

Definition at line 40 of file CAutoComplete.h.

40{ return WC_LISTVIEW; }
#define WC_LISTVIEW
Definition: commctrl.h:2259

Referenced by Create().

◆ ItemFromPoint()

INT CACListView::ItemFromPoint ( INT  x,
INT  y 
)

Definition at line 445 of file CAutoComplete.cpp.

446{
447 LV_HITTESTINFO hittest;
448 hittest.pt.x = x;
449 hittest.pt.y = y;
450 return HitTest(&hittest);
451}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define LV_HITTESTINFO
Definition: commctrl.h:2504

Referenced by OnLButtonDown(), CAutoComplete::OnNotify(), and SelectHere().

◆ OnButtonUp()

LRESULT CACListView::OnButtonUp ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 475 of file CAutoComplete.cpp.

476{
477 TRACE("CACListView::OnButtonUp(%p)\n", this);
478 return 0; // eat
479}
#define TRACE(s)
Definition: solgame.cpp:4

◆ OnLButtonDown()

LRESULT CACListView::OnLButtonDown ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 483 of file CAutoComplete.cpp.

484{
485 TRACE("CACListView::OnLButtonDown(%p)\n", this);
488 if (iItem != -1)
489 {
490 m_pDropDown->SelectItem(iItem); // select the item
491 CStringW strText = GetItemText(iItem); // get text of item
492 m_pDropDown->SetEditText(strText); // set text
493 m_pDropDown->SetEditSel(0, strText.GetLength()); // select all
494 m_pDropDown->HideDropDown(); // hide
495 }
496 return 0;
497}
int GetLength() const noexcept
Definition: atlsimpstr.h:362
INT ItemFromPoint(INT x, INT y)
CStringW GetItemText(INT iItem)
VOID SetEditText(LPCWSTR pszText)
VOID SelectItem(INT iItem)
VOID SetEditSel(INT ich0, INT ich1)
LPARAM lParam
Definition: combotst.c:139
int32_t INT
Definition: typedefs.h:58
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299

◆ OnMouseWheel()

LRESULT CACListView::OnMouseWheel ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 507 of file CAutoComplete.cpp.

508{
509 TRACE("CACListView::OnMouseWheel(%p)\n", this);
511 LRESULT ret = DefWindowProcW(uMsg, wParam, lParam); // do default
513 return ret;
514}
VOID UpdateScrollBar()
WPARAM wParam
Definition: combotst.c:138
int ret
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ OnMRButtonDown()

LRESULT CACListView::OnMRButtonDown ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 500 of file CAutoComplete.cpp.

501{
502 TRACE("CACListView::OnMRButtonDown(%p)\n", this);
503 return 0; // eat
504}

◆ OnNCHitTest()

LRESULT CACListView::OnNCHitTest ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 517 of file CAutoComplete.cpp.

518{
519 TRACE("CACListView::OnNCHitTest(%p)\n", this);
521 POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; // in screen coordinates
522 ScreenToClient(&pt); // into client coordinates
523 HWND hwndTarget = m_pDropDown->ChildWindowFromPoint(pt);
524 if (hwndTarget != m_hWnd)
525 return HTTRANSPARENT; // pass through (for resizing the drop-down window)
526 bHandled = FALSE; // do default
527 return 0;
528}
#define FALSE
Definition: types.h:117
#define pt(x, y)
Definition: drawing.c:79
#define HTTRANSPARENT
Definition: winuser.h:2473
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

◆ SelectHere()

VOID CACListView::SelectHere ( INT  x,
INT  y 
)

Definition at line 469 of file CAutoComplete.cpp.

470{
472}
VOID SetCurSel(INT iItem)

◆ SetCurSel()

VOID CACListView::SetCurSel ( INT  iItem)

Definition at line 460 of file CAutoComplete.cpp.

461{
462 if (iItem == -1)
463 SetItemState(-1, 0, LVIS_SELECTED); // select none
464 else
465 SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
466}
#define LVIS_SELECTED
Definition: commctrl.h:2319

Referenced by CAutoComplete::OnListUpDown(), CAutoComplete::OnNotify(), SelectHere(), and CAutoComplete::SelectItem().

◆ SetFont()

VOID CACListView::SetFont ( HFONT  hFont)

Definition at line 405 of file CAutoComplete.cpp.

406{
407 SendMessageW(WM_SETFONT, (WPARAM)hFont, TRUE); // set font
408
409 // get listview item height
411 HDC hDC = GetDC();
412 if (hDC)
413 {
414 HGDIOBJ hFontOld = ::SelectObject(hDC, hFont);
416 if (::GetTextMetricsW(hDC, &tm))
417 {
418 m_cyItem = (tm.tmHeight * 3) / 2; // 3/2 of text height
419 }
420 ::SelectObject(hDC, hFontOld);
421 ReleaseDC(hDC);
422 }
423}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
Definition: time.h:68
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_SETFONT
Definition: winuser.h:1650
HDC WINAPI GetDC(_In_opt_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by CAutoComplete::OnCreate().

Member Data Documentation

◆ m_cyItem

INT CACListView::m_cyItem

◆ m_pDropDown


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