1#ifndef __SLISTVIEW__H__
2#define __SLISTVIEW__H__
5#include <core/SItemPanel.h>
6#include <interface/SAdapter-i.h>
7#include <interface/SListViewItemLocator-i.h>
8#include <proxy/SPanelProxy.h>
12class SOUI_EXP SListView
13 :
public TPanelProxy<IListView>
14 ,
protected SHostProxy
15 ,
protected IItemContainer {
16 DEF_SOBJECT(SPanel, L
"listview")
18 friend class SListViewDataSetObserver;
36 STDMETHOD_(BOOL, SetAdapter)(THIS_ ILvAdapter *adapter) OVERRIDE;
42 STDMETHOD_(ILvAdapter *, GetAdapter)(THIS) SCONST OVERRIDE;
48 STDMETHOD_(IListViewItemLocator *, GetItemLocator)(THIS) SCONST OVERRIDE;
54 STDMETHOD_(
void, SetItemLocator)(THIS_ IListViewItemLocator *pItemLocator) OVERRIDE;
60 STDMETHOD_(
void, EnsureVisible)(THIS_
int iItem) OVERRIDE;
67 STDMETHOD_(
void, SetSel)(THIS_
int iItem, BOOL bNotify = FALSE) OVERRIDE;
73 STDMETHOD_(
int, GetSel)(THIS) SCONST OVERRIDE;
80 STDMETHOD_(IItemPanel *, HitTest)(THIS_
const POINT *pt) SCONST OVERRIDE;
87 SItemPanel *HitTest(CPoint &pt)
const;
95 STDMETHOD_(
void, GetDesiredSize)(THIS_ SIZE *psz,
int nParentWid,
int nParentHei) OVERRIDE;
103 virtual void OnItemSetCapture(SOsrPanel *pItem, BOOL bCapture);
111 virtual BOOL OnItemGetRect(
const SOsrPanel *pItem, CRect &rcItem)
const;
117 virtual BOOL IsItemRedrawDelay()
const;
123 void onDataSetChanged();
128 void onDataSetInvalidated();
134 void onItemDataChanged(
int iItem);
142 BOOL OnItemClick(IEvtArgs *pEvt);
152 virtual BOOL
OnScroll(BOOL bVertical, UINT uCode,
int nPos);
174 virtual BOOL
UpdateToolTip(CPoint pt, SwndToolTipInfo &tipInfo);
219 void DispatchMessage2Items(UINT uMsg, WPARAM wParam, LPARAM lParam);
224 void UpdateScrollBar();
230 void RedrawItem(SOsrPanel *pItem);
237 SItemPanel *GetItemPanel(
int iItem);
242 void UpdateVisibleItems();
248 void UpdateVisibleItem(
int iItem);
254 void OnPaint(IRenderTarget *pRT);
261 void OnSize(UINT nType, CSize size);
275 LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
284 LRESULT OnKeyEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
292 void OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags);
306 BOOL
OnMouseWheel(UINT nFlags,
short zDelta, CPoint pt);
328 MSG_WM_PAINT_EX(OnPaint)
330 MSG_WM_DESTROY(OnDestroy)
331 MSG_WM_MOUSEWHEEL(OnMouseWheel)
332 MSG_WM_MOUSELEAVE(OnMouseLeave)
333 MSG_WM_KEYDOWN(OnKeyDown)
334 MSG_WM_KILLFOCUS_EX(OnKillFocus)
335 MSG_WM_SETFOCUS_EX(OnSetFocus)
336 MSG_WM_SHOWWINDOW(OnShowWindow)
337 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseEvent)
338 MESSAGE_RANGE_HANDLER_EX(WM_KEYFIRST, WM_KEYLAST, OnKeyEvent)
339 MESSAGE_RANGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, WM_IME_KEYLAST, OnKeyEvent)
340 MESSAGE_HANDLER_EX(WM_IME_CHAR, OnKeyEvent)
341 MESSAGE_HANDLER_EX(WM_IME_REQUEST, OnKeyEvent)
345 ATTR_SKIN(L
"dividerSkin", m_pSkinDivider, TRUE)
346 ATTR_LAYOUTSIZE(L
"dividerSize", m_nDividerSize, FALSE)
347 ATTR_BOOL(L
"wantTab", m_bWantTab, FALSE)
348 ATTR_BOOL(L
"vertical", m_bVertical, FALSE)
352 SAutoRefPtr<ILvAdapter> m_adapter;
353 SAutoRefPtr<ILvDataSetObserver> m_observer;
354 SAutoRefPtr<IListViewItemLocator> m_lvItemLocator;
362 bool m_bPendingUpdate;
363 int m_iPendingUpdateItem;
364 int m_iPendingViewItem;
367 SList<ItemInfo> m_lstItems;
368 SOsrPanel *m_itemCapture;
371 SOsrPanel *m_pHoverItem;
372 BOOL m_bDataSetInvalidated;
374 SArray<SList<SItemPanel *> *> m_itemRecycle;
376 SXmlDoc m_xmlTemplate;
377 SAutoRefPtr<ISkinObj> m_pSkinDivider;
378 SLayoutSize m_nDividerSize;
SOUI Panel with Scrollbar Support.
virtual int GetScrollLineSize(BOOL bVertical)
Gets the line size for scrolling.
virtual void OnColorize(COLORREF cr)
Handles colorization events.
virtual void OnScaleChanged(int nScale)
Handles scale change events.
void OnShowWindow(BOOL bShow, UINT nStatus)
Handles the WM_SHOWWINDOW message.
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
Handles the WM_MOUSEWHEEL message.
virtual BOOL OnScroll(BOOL bVertical, UINT uCode, int nPos)
Handles scroll events.
void OnDestroy()
Handles the WM_DESTROY message.
UINT OnGetDlgCode() SCONST OVERRIDE
Retrieves the dialog code for the window.
virtual BOOL UpdateToolTip(CPoint pt, SwndToolTipInfo &tipInfo)
Handle tooltip updates.
void OnKillFocus(SWND wndFocus)
Handles losing focus.
void OnPaint(IRenderTarget *pRT)
Handles the painting of the window.
void OnMouseLeave()
Handles the mouse leave event.
virtual HRESULT OnLanguageChanged()
Called when the language of the window changes.
void OnSize(UINT nType, CSize size)
Handles the resizing of the window.
virtual void OnRebuildFont()
Called when the font of the window needs to be rebuilt.
virtual BOOL OnSetCursor(const CPoint &pt)
Sets the cursor when the mouse hovers over the window.
virtual BOOL CreateChildren(SXmlNode xmlNode)
Create child windows from XML node.
void OnSetFocus(SWND wndOld)
Handles gaining focus.