This repository was archived by the owner on Mar 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpm_slider.h
More file actions
101 lines (84 loc) · 1.94 KB
/
pm_slider.h
File metadata and controls
101 lines (84 loc) · 1.94 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* File : pm_slider.h
* COPYRIGHT (C) 2012-2017, Shanghai Real-Thread Technology Co., Ltd
*
* Change Logs:
* Date Author Notes
* 2017-11-05 realthread the first version
*/
#pragma once
#include <pm_widget.h>
#include <pm_image.h>
#include <sigslot.h>
namespace Persimmon
{
class Slider : public Widget
{
public:
enum type
{
HORIZONTAL = 0,
VERTICAL = 1,
};
Slider(Image *norImg, Image *barImg, Image *sliderImg);
virtual ~Slider();
void setDirection(enum type t = HORIZONTAL)
{
direction = t;
}
void setValueLimits(int min, int max)
{
minValue = min;
maxValue = max;
}
void setCurrentValue(int value)
{
currentValue = value;
}
int getCurrentValue(void)
{
return currentValue;
}
void setNorImg(Image *img)
{
if (norImage)
{
delete norImage;
}
norImage = img;
}
void setBarImg(Image *img)
{
if (barImage)
{
delete barImage;
}
barImage = img;
}
void setSliderImg(Image *img)
{
if (sliderImage)
{
delete sliderImage;
}
sliderImage = img;
}
void enableGesture(bool ges = true)
{
if (ges)
setInterestGesture(RTGUI_GESTURE_DRAG | RTGUI_GESTURE_TAP);
else
setInterestGesture(RTGUI_GESTURE_NONE);
}
Signal<int> clicked;
virtual bool handleGestureEvent(struct rtgui_event_gesture *, const struct rtgui_gesture *); //´¥ÃþÊÖÊÆÊ¼þ´¦Àíº¯Êý
virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
const Rect &srcRect = Rect(),
RenderFlag flags = DrawNormal);
private:
enum type direction;
Image *norImage, *barImage, *sliderImage;
int progress, baseProgress;
int minValue, maxValue, currentValue;
};
}