1
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3
Copyright (C) 2010 Red Hat, Inc.
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, see <http://www.gnu.org/licenses/>.
21
#include "softrenderer.h"
22
#include "screen_layer.h"
23
#include "inputs_handler.h"
24
#include "application.h"
28
class GUI : public ScreenLayer, public KeyHandler {
34
typedef std::list<TabFactory*> TabFactorys;
36
GUI(Application& app, Application::State state);
39
void set_screen(RedScreen* screen); //show and hide
41
Application& get_application() { return _app;}
43
CEGUI::System& gui_system() { return *_gui_system;}
46
void set_state(Application::State state);
47
bool is_visible() { return !!_dialog;}
48
bool prepare_dialog();
49
bool is_disconnect_allowed() { return _app.is_disconnect_allowed();}
51
virtual bool pointer_test(int x, int y) { return contains_point(x, y);}
52
virtual void on_pointer_enter(int x, int y, unsigned int buttons_state);
53
virtual void on_pointer_leave();
54
virtual void on_pointer_motion(int x, int y, unsigned int buttons_state);
55
virtual void on_mouse_button_press(int button, int buttons_state);
56
virtual void on_mouse_button_release(int button, int buttons_state);
58
virtual void on_key_down(RedKey key);
59
virtual void on_key_up(RedKey key);
60
virtual void on_char(uint32_t ch);
61
virtual bool permit_focus_loss() { return false;}
65
virtual void copy_pixels(const QRegion& dest_region, RedDrawable& dest_dc);
66
virtual void on_size_changed();
68
void register_tab_factory(TabFactory& factory);
69
void unregister_tab_factory(TabFactory& factory);
73
virtual ~BoxResponse() {}
74
virtual void response(int response) = 0;
75
virtual void aborted() = 0;
90
typedef std::vector<ButtonInfo> ButtonsList;
91
bool message_box(MessageType type, const char *text, const ButtonsList& buttons,
92
BoxResponse* _response_handler);
95
TabFactorys& get_factoris() { return _tab_factorys;}
99
void update_layer_area();
101
void conditional_update();
102
void set_dialog(Dialog* dialog);
103
void dettach_dialog(Dialog* dialog);
107
Application::State _state;
108
RedPixmapSw* _pixmap;
110
CEGUI::SoftRenderer* _renderer;
111
CEGUI::System* _gui_system;
115
TabFactorys _tab_factorys;
125
virtual CEGUI::Window& get_root_window() = 0;
127
virtual const std::string& get_name() = 0;
130
class GUI::TabFactory {
132
TabFactory() : _order (-1) {}
133
TabFactory(int order) : _order (order) {}
135
virtual ~TabFactory() {}
136
virtual Tab* create_tab(bool connected, int width, int hight) = 0;
137
int get_order() { return _order;}