forked from zfteam/rs97-commander-sdl2
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdialog.h
executable file
·91 lines (68 loc) · 1.98 KB
/
dialog.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
#ifndef _DIALOG_H_
#define _DIALOG_H_
#include <string>
#include <vector>
#include <SDL.h>
#include <SDL_ttf.h>
#include "window.h"
class CDialog : public CWindow
{
public:
// Constructor
// Coordinates = 0 => centered
CDialog(const std::string &p_title, const Sint16 p_x, const Sint16 p_y);
// Destructor
virtual ~CDialog(void);
// Add a label
void addLabel(const std::string &p_label);
// Add a menu option
void addOption(const std::string &p_option);
// Init. Call after all options are added.
void init(void);
// Accessors
const Sint16 &getX(void) const;
const Sint16 &getY(void) const;
const SDL_Surface * const getImage(void) const;
const unsigned int &getHighlightedIndex(void) const;
private:
// Forbidden
CDialog(void);
CDialog(const CDialog &p_source);
const CDialog &operator =(const CDialog &p_source);
// Key press management
virtual const bool keyPress(const SDL_Event &p_event);
// Key hold management
virtual const bool keyHold(void);
// Draw
virtual void render(const bool p_focus) const;
// Move cursor
const bool moveCursorUp(const bool p_loop);
const bool moveCursorDown(const bool p_loop);
// Number of titles (0 or 1), labels, and options
bool m_nbTitle;
unsigned char m_nbLabels;
unsigned char m_nbOptions;
// List of lines
std::vector<std::string> m_lines;
SDL_Surface *m_titleImg;
std::vector<SDL_Surface *> m_linesImg;
std::vector<SDL_Surface *> m_linesImgCursor1;
std::vector<SDL_Surface *> m_linesImgCursor2;
// The highlighted item
unsigned int m_highlightedLine;
// The image representing the dialog
SDL_Surface *m_image;
// The cursor
SDL_Surface *m_cursor1;
SDL_Surface *m_cursor2;
// Coordinates
Sint16 m_x;
Sint16 m_y;
Sint16 m_cursorX;
Sint16 m_cursorY;
// Line clip
mutable SDL_Rect m_clip;
// Pointers to resources
TTF_Font *m_font;
};
#endif