forked from jbanes/rs97-commander
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewer.h
executable file
·69 lines (51 loc) · 1.41 KB
/
viewer.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
#ifndef _VIEWER_H_
#define _VIEWER_H_
#include <string>
#include <vector>
#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "window.h"
#define VIEWER_LINE_HEIGHT 13
#define VIEWER_NB_LINES 17
#define VIEWER_Y_LIST 18
#define VIEWER_MARGIN 1
#define VIEWER_X_STEP 32
#define VIEWER_SIZE_MAX 16777216 // = 16 MB
class CViewer : public CWindow
{
public:
// Constructor
CViewer(const std::string &p_fileName);
// Destructor
virtual ~CViewer(void);
private:
// Forbidden
CViewer(void);
CViewer(const CViewer &p_source);
const CViewer &operator =(const CViewer &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;
// Is window full screen?
virtual const bool isFullScreen(void) const;
// Scroll
const bool moveUp(const unsigned int p_step);
const bool moveDown(const unsigned int p_step);
const bool moveLeft(void);
void moveRight(void);
// The viewed file name
std::string m_fileName;
// Coordinates
unsigned int m_firstLine;
mutable SDL_Rect m_clip;
// Background image
SDL_Surface *m_image;
// List of read lines
std::vector<std::string> m_lines;
// Pointers to resources
TTF_Font *m_font;
};
#endif