-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathColorPickerRegular.h
More file actions
62 lines (49 loc) · 1.65 KB
/
ColorPickerRegular.h
File metadata and controls
62 lines (49 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef UI_CONTROL_COLORPICKER_REGULAR_H_
#define UI_CONTROL_COLORPICKER_REGULAR_H_
#include "duilib/Box/VirtualListBox.h"
namespace ui
{
/** 颜色选择器:常用颜色
*/
class ColorPickerRegularProvider;
class ColorPickerRegular : public VirtualVTileListBox
{
typedef VirtualVTileListBox BaseClass;
public:
explicit ColorPickerRegular(Window* pWindow);
/** 获取控件类型
*/
virtual DString GetType() const override;
/** 选择一个颜色
*/
void SelectColor(const UiColor& color);
/** 获取当前选择的颜色
*/
UiColor GetSelectedColor() const;
/** 监听选择颜色的事件
* @param [in] callback 选择颜色变化时的回调函数
* @param [in] callbackID 该回调函数对应的ID(用于删除回调函数)
* 参数说明:
* wParam: 当前新选择的颜色值,可以用UiColor((uint32_t)wParam)生成颜色
* lParam: 原来旧选择的颜色值,可以用UiColor((uint32_t)lParam)生成颜色
*/
void AttachSelectColor(const EventCallback& callback, EventCallbackID callbackID = 0) { AttachEvent(kEventSelectColor, callback, callbackID); }
/** 设置控件位置
*/
virtual void SetPos(UiRect rc) override;
/** 设置显示列数
*/
void SetColumns(int32_t nColumns);
/** 设置属性
*/
virtual void SetAttribute(const DString& strName, const DString& strValue) override;
private:
/** 常用颜色数据提供者
*/
std::unique_ptr<ColorPickerRegularProvider> m_regularColors;
/** 原来设置的元素控件大小
*/
UiSize m_szItem;
};
}//namespace ui
#endif //UI_CONTROL_COLORPICKER_REGULAR_H_