-
Notifications
You must be signed in to change notification settings - Fork 6
/
GUIWindow.h
81 lines (54 loc) · 1.59 KB
/
GUIWindow.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
//
// GUIWindow.h
// Deep
//
// Created by Nathan Daly on 9/18/12.
// Copyright (c) 2012 Lions Entertainment. All rights reserved.
//
#ifndef GUIWINDOW_H
#define GUIWINDOW_H
#include <string>
#include "GUIUtility.h"
#include "Compatibility.h"
#include SDL_SDLVIDEO_H
#include SDL_SDLKEYBOARD_H
class SDL_Surface;
namespace GUI {
struct Unhandled_Click {
Unhandled_Click(DispPoint coord_) : coord(coord_) { }
DispPoint coord;
};
struct Unhandled_Key {
Unhandled_Key(SDL_keysym key_) : key(key_) { }
SDL_keysym key;
};
class View;
// This class maintains information about the Window.
// (i.e name, size, etc.) Has one View instance that shows what is displayed in
// the window.
class Window {
public:
Window(int w, int h, const std::string& name_ = "",
int numColors = 256, const Uint32 flags = SDL_SWSURFACE);
void resize(int w, int h);
void stretch(int w, int h);
void rename(const std::string& name_);
View* get_main_view() { return main_view; }
DispPoint get_dim();
// Handle subviews to main_view:
void attach_subview(View* view, DispPoint pos);
void move_subview(View* view, DispPoint pos);
void remove_subview(View* view);
View* remove_last_subview(); // Remove subview last added
// If main_view has changed at all, re-display it.
void refresh();
private:
SDL_Surface* window;
View* main_view;
std::string name;
int num_colors;
Uint32 flags;
static bool WINDOW_ALREADY_CREATED;
};
} // namespace GUI
#endif /* GUIWINDOW_H */