-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScrollbarSDL.h
93 lines (75 loc) · 1.92 KB
/
ScrollbarSDL.h
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
#pragma once
#include "Drawable.h"
#include "DrawableSDL.h"
#include "ScrollBarInterface.h"
class ScrollbarSDL : public ScrollBarInterface, public DrawableSDL
{
protected:
int width, height, a, b, scrollPos;
double vop;
Orientation orientation;
double value;
int move;
DrawableSDL *upBtt, *downBtt, *scroll, *bar;
void moveByVect(int x, int y);
class DownButtonActions
: public EventDelegate
{
protected:
ScrollbarSDL* there;
public:
bool onClick(SDL_Event e, void *sender);
bool mouseUp(SDL_Event e, void *sender);
bool mouseDown(SDL_Event e, void *sender);
DownButtonActions(ScrollbarSDL *there) {this->there = there;};
};
class BarActions
: public EventDelegate
{
protected:
ScrollbarSDL* there;
public:
bool onClick(SDL_Event e, void *sender);
BarActions(ScrollbarSDL *there) {this->there = there;};
};
class UpButtonActions
: public EventDelegate
{
protected:
ScrollbarSDL* there;
public:
bool onClick(SDL_Event e, void *sender);
bool mouseUp(SDL_Event e, void *sender);
bool mouseDown(SDL_Event e, void *sender);
UpButtonActions(ScrollbarSDL * there) {this->there = there;};
};
class ScrollActions
: public EventDelegate
{
protected:
ScrollbarSDL* there;
bool scrollMoving;
int lastPos;
public:
bool mouseDown(SDL_Event e, void *sender);
bool mouseUp(SDL_Event e, void *sender);
bool mouseMove(SDL_Event e, void *sender);
ScrollActions(ScrollbarSDL * there) {this->there = there; scrollMoving = false;};
};
public:
ScrollbarSDL(void);
void setSizes(int width, int height);
int getWidth();
int getHeight();
double getValue();
void setBounds(int a, int b);
void setOrientation(Orientation orientation);
void setUppBtt(Drawable &uppbtt);
void setDownBtt(Drawable &downbtt);
void setScroll(Drawable &scroll);
void setBar(Drawable &bar);
void setHeight(int height);
void draw(int x, int y);
bool spreadEvent(SDL_Event e);
~ScrollbarSDL(void);
};