-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathScrollBar.h
52 lines (39 loc) · 1.18 KB
/
ScrollBar.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
#ifndef SCROLL_BAR_H
#define SCROLL_BAR_H
#include"SFML\Graphics.hpp"
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
using namespace std;
using namespace sf;
class ScrollBar : public Drawable
{
private:
RectangleShape scrollArea;
RectangleShape bar;
RectangleShape scrollUpButton;
RectangleShape scrollDownButton;
Sprite sUp;
Sprite sDown;
int scrollValue;
Vector2f targetSize;
View & targetView;
static Texture caretUp;
static Texture caretDown;
static bool isTextureLoaded;
static void loadTextures();
public:
ScrollBar(const Vector2f & position, const Vector2f & size, View & view, const Vector2f & targetViewSize);
void setSettings(const Vector2f & position, const Vector2f & size);
void updateTargetSize(const Vector2f & targetViewSize);
bool scrollUpButtonClick();
bool scrollDownButtonClick();
bool onScrollUpButton(const Vector2f & point);
bool onScrollDownButton(const Vector2f & point);
bool onBar(const Vector2f & point);
bool scroll(float value);
bool contains(const Vector2f & point);
virtual void draw(RenderTarget& target, RenderStates states) const;
};
#endif // !SCROLL_BAR_H