soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
STileViewItemLocator.h
1#ifndef __STILEVIEWITEMLOCATOR__H__
2#define __STILEVIEWITEMLOCATOR__H__
3
4#include <interface/STileViewItemLocator-i.h>
5
6SNSBEGIN
7
8/**
9 * @class STileViewItemLocator
10 * @brief 瓷砖视图项定位器类
11 */
12class SOUI_EXP STileViewItemLocator : public TObjRefImpl<ITileViewItemLocator> {
13 public:
14 /**
15 * @brief 构造函数
16 * @param owner 所属窗口对象指针
17 * @param nItemHei 每个项的高度
18 * @param nItemWid 每个项的宽度
19 * @param nMarginSize 项之间的间距(默认为0)
20 */
21 STileViewItemLocator(SWindow *owner, int nItemHei, int nItemWid, int nMarginSize = 0);
22
23 /**
24 * @brief 构造函数
25 * @param owner 所属窗口对象指针
26 * @param szItemHei 每个项的高度(字符串形式)
27 * @param szItemWid 每个项的宽度(字符串形式)
28 * @param marginSize 项之间的间距(默认为SLayoutSize())
29 */
30 STileViewItemLocator(SWindow *owner, LPCWSTR szItemHei, LPCWSTR szItemWid, SLayoutSize marginSize = SLayoutSize());
31
32 public:
33 /**
34 * @brief 设置适配器
35 * @param pAdapter 列表适配器对象指针
36 */
37 STDMETHOD_(void, SetAdapter)(THIS_ ILvAdapter *pAdapter) OVERRIDE;
38
39 /**
40 * @brief 数据集改变时调用
41 */
42 STDMETHOD_(void, OnDataSetChanged)(THIS) OVERRIDE
43 {
44 }
45
46 /**
47 * @brief 获取指定项的高度
48 * @param iItem 项索引
49 * @return 项的高度
50 */
51 STDMETHOD_(int, GetItemHeight)(THIS_ int iItem) SCONST OVERRIDE;
52
53 /**
54 * @brief 设置指定项的高度
55 * @param iItem 项索引
56 * @param nHeight 新的高度
57 */
58 STDMETHOD_(void, SetItemHeight)(THIS_ int iItem, int nHeight) OVERRIDE;
59
60 /**
61 * @brief 获取指定项的矩形区域(相对于TileView)
62 * @param iItem 项索引
63 * @return 项的矩形区域
64 */
65 STDMETHOD_(RECT, GetItemRect)(THIS_ int iItem) OVERRIDE;
66
67 /**
68 * @brief 设置TileView的宽度(在TileView的OnSize中调用)
69 * @param width TileView的宽度
70 * @param bDpiAware 是否考虑DPI缩放
71 */
72 STDMETHOD_(void, SetTileViewWidth)(THIS_ int width, BOOL bDpiAware) OVERRIDE;
73
74 /**
75 * @brief 获取指定项的行和列索引
76 * @param iItem 项索引
77 * @param row 行索引指针
78 * @param col 列索引指针
79 */
80 STDMETHOD_(void, GetItemRowAndColIndex)(THIS_ int iItem, int *row, int *col) OVERRIDE;
81
82 /**
83 * @brief 判断指定项是否为每行的最后一个元素
84 * @param iItem 项索引
85 * @return 如果是最后一个元素返回TRUE,否则返回FALSE
86 */
87 STDMETHOD_(BOOL, IsLastInRow)(THIS_ int iItem) OVERRIDE;
88
89 /**
90 * @brief 获取上一行同一列的元素索引
91 * @param iItem 项索引
92 * @return 上一行同一列的元素索引
93 */
94 STDMETHOD_(int, GetUpItem)(THIS_ int iItem) OVERRIDE;
95
96 /**
97 * @brief 获取下一行同一列的元素索引
98 * @param iItem 项索引
99 * @return 下一行同一列的元素索引
100 */
101 STDMETHOD_(int, GetDownItem)(THIS_ int iItem) OVERRIDE;
102
103 /**
104 * @brief 获取总高度
105 * @return 总高度
106 */
107 STDMETHOD_(int, GetTotalHeight)(THIS) OVERRIDE;
108
109 /**
110 * @brief 将项索引转换为位置
111 * @param iItem 项索引
112 * @return 位置
113 */
114 STDMETHOD_(int, Item2Position)(THIS_ int iItem) OVERRIDE;
115
116 /**
117 * @brief 将位置转换为项索引
118 * @param position 位置
119 * @return 项索引
120 */
121 STDMETHOD_(int, Position2Item)(THIS_ int position) OVERRIDE;
122
123 /**
124 * @brief 获取滚动行大小
125 * @return 滚动行大小
126 */
127 STDMETHOD_(int, GetScrollLineSize)(THIS) SCONST OVERRIDE;
128
129 /**
130 * @brief 获取间距大小
131 * @return 间距大小
132 */
133 STDMETHOD_(int, GetMarginSize)(THIS) SCONST OVERRIDE;
134
135 /**
136 * @brief 设置缩放比例
137 * @param scale 缩放比例
138 * @return 新的缩放比例
139 */
140 STDMETHOD_(int, SetScale)(THIS_ int scale) OVERRIDE;
141
142 /**
143 * @brief 获取每行的项数量
144 * @return 每行的项数量
145 */
146 STDMETHOD_(int, GetCountInRow)(THIS) SCONST OVERRIDE;
147
148 /**
149 * @brief 获取项的行高
150 * @return 项的行高
151 */
152 STDMETHOD_(int, GetItemLineHeight)(THIS) SCONST OVERRIDE;
153
154 /**
155 * @brief 获取项的宽度
156 * @return 项的宽度
157 */
158 STDMETHOD_(int, GetItemWidth)(THIS) SCONST OVERRIDE;
159
160 protected:
161 int m_scale; // 缩放比例
162 SLayoutSize m_nItemWidth; // 项宽
163 SLayoutSize m_nItemHeight; // 项高
164 SLayoutSize m_nTileViewWidth; // TileView宽度(用于计算m_nCountInRow)
165 SLayoutSize m_nItemMargin; // 块间距
166 int m_nCountInRow; // 每行的项个数
167
168 SAutoRefPtr<ILvAdapter> m_adapter; // 列表适配器对象指针
169 SWindow *m_pOwner; // 所属窗口对象指针
170};
171
172SNSEND
173
174#endif // __STILEVIEWITEMLOCATOR__H__
Smart pointer class for managing COM-style reference-counted objects.
布局大小类
Definition SLayoutSize.h:10
void SetAdapter(ILvAdapter *pAdapter) OVERRIDE
设置适配器
void OnDataSetChanged() OVERRIDE
数据集改变时调用
STileViewItemLocator(SWindow *owner, int nItemHei, int nItemWid, int nMarginSize=0)
构造函数
Base class for SOUI DUI windows.
Definition SWnd.h:286