-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextBox.h
More file actions
55 lines (39 loc) · 1.24 KB
/
Copy pathtextBox.h
File metadata and controls
55 lines (39 loc) · 1.24 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
#pragma once
#include <sstream>
#include <windows.h>
#include <optional>
#include "../UIElement/uiElement.h"
#include "../LabelElement/labelElement.h"
#include "../MouseHandle/mouseHandle.h"
namespace gui
{
class TextBox : public gui::UIElement
{
public:
bool getSet() { return isSet; };
virtual int getType() { return gui::TEXTBOX; };
virtual void draw(sf::RenderTarget &window, sf::RenderStates state) const;
virtual void update();
void getEvent(std::optional<sf::Event> event);
virtual void setSize(sf::Vector2f size);
virtual void setPosition(sf::Vector2f position);
TextBox(sf::RenderWindow* window, sf::Vector2f size, sf::Color boxColor, sf::Color foreColor, sf::Font* font, float characterSize, std::string message = "", sf::Vector2f position = {0,0});
private:
#define _DELETE 8
#define ENTER 13
#define ESCAPE 27
sf::Clock timer;
std::string textValue = "";
std::string defaultMessage; // message that appears when there're no text
sf::RectangleShape box;
gui::Label text;
gui::MouseHandle boxFrame;
sf::RenderWindow* window;
bool isFocused = false;
bool isSet = false;
bool isFlick = false;
int setTime = 0;
void inputLogic(int charTyped);
void fill();
};
}