ReactOS 0.4.15-dev-7712-gbbbcd8e
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 373 of file CAutoComplete.cpp.

374{
375}
#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 377 of file CAutoComplete.cpp.

378{
379 ATLASSERT(m_hWnd == NULL);
380 DWORD dwStyle = WS_CHILD | /*WS_VISIBLE |*/ WS_CLIPSIBLINGS | LVS_NOCOLUMNHEADER |
382 HWND hWnd = ::CreateWindowExW(0, GetWndClassName(), L"Internet Explorer", dwStyle,
383 0, 0, 0, 0, hwndParent, NULL,
384 _AtlBaseModule.GetModuleInstance(), NULL);
385 SubclassWindow(hWnd); // do subclass to handle messages
386 // set extended listview style
388 SetExtendedListViewStyle(exstyle, exstyle);
389 // insert one column (needed to insert items)
391 column.fmt = LVCFMT_LEFT;
393 InsertColumn(0, &column);
394 return m_hWnd;
395}
#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:960
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 447 of file CAutoComplete.cpp.

448{
449 return GetNextItem(-1, LVNI_ALL | LVNI_SELECTED);
450}
#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 429 of file CAutoComplete.cpp.

430{
431 // NOTE: LVS_OWNERDATA doesn't support LVM_GETITEMTEXT.
433 ATLASSERT(GetStyle() & LVS_OWNERDATA);
434 return m_pDropDown->GetItemText(iItem);
435}
CStringW GetItemText(INT iItem) const

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

◆ GetVisibleCount()

INT CACListView::GetVisibleCount ( )

Definition at line 419 of file CAutoComplete.cpp.

420{
421 if (m_cyItem <= 0) // avoid "division by zero"
422 return 0;
423 CRect rc;
424 GetClientRect(&rc);
425 return rc.Height() / m_cyItem;
426}
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 438 of file CAutoComplete.cpp.

439{
440 LV_HITTESTINFO hittest;
441 hittest.pt.x = x;
442 hittest.pt.y = y;
443 return HitTest(&hittest);
444}
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 468 of file CAutoComplete.cpp.

469{
470 TRACE("CACListView::OnButtonUp(%p)\n", this);
471 return 0; // eat
472}
#define TRACE(s)
Definition: solgame.cpp:4

◆ OnLButtonDown()

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

Definition at line 476 of file CAutoComplete.cpp.

477{
478 TRACE("CACListView::OnLButtonDown(%p)\n", this);
481 if (iItem != -1)
482 {
483 m_pDropDown->SelectItem(iItem); // select the item
484 CStringW strText = GetItemText(iItem); // get text of item
485 m_pDropDown->SetEditText(strText); // set text
486 m_pDropDown->SetEditSel(0, strText.GetLength()); // select all
487 m_pDropDown->HideDropDown(); // hide
488 }
489 return 0;
490}
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 500 of file CAutoComplete.cpp.

501{
502 TRACE("CACListView::OnMouseWheel(%p)\n", this);
504 LRESULT ret = DefWindowProcW(uMsg, wParam, lParam); // do default
506 return ret;
507}
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 493 of file CAutoComplete.cpp.

494{
495 TRACE("CACListView::OnMRButtonDown(%p)\n", this);
496 return 0; // eat
497}

◆ OnNCHitTest()

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

Definition at line 510 of file CAutoComplete.cpp.

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

◆ SelectHere()

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

Definition at line 462 of file CAutoComplete.cpp.

463{
465}
VOID SetCurSel(INT iItem)

◆ SetCurSel()

VOID CACListView::SetCurSel ( INT  iItem)

Definition at line 453 of file CAutoComplete.cpp.

454{
455 if (iItem == -1)
456 SetItemState(-1, 0, LVIS_SELECTED); // select none
457 else
458 SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
459}
#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 398 of file CAutoComplete.cpp.

399{
400 SendMessageW(WM_SETFONT, (WPARAM)hFont, TRUE); // set font
401
402 // get listview item height
404 HDC hDC = GetDC();
405 if (hDC)
406 {
407 HGDIOBJ hFontOld = ::SelectObject(hDC, hFont);
409 if (::GetTextMetricsW(hDC, &tm))
410 {
411 m_cyItem = (tm.tmHeight * 3) / 2; // 3/2 of text height
412 }
413 ::SelectObject(hDC, hFontOld);
414 ReleaseDC(hDC);
415 }
416}
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:1539
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_SETFONT
Definition: winuser.h:1649
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: