7c3b282a2bc14da5abd74b8edd1de818884abc84
[iec.git] / src / type3_AndroidCloud / anbox-master / src / anbox / wm / window.h
1 /*
2  * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3, as published
6  * by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranties of
10  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11  * PURPOSE.  See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17
18 #ifndef ANBOX_WM_WINDOW_H_
19 #define ANBOX_WM_WINDOW_H_
20
21 #include "anbox/wm/window_state.h"
22
23 #include <string>
24 #include <vector>
25
26 #include <EGL/egl.h>
27
28 #include <memory>
29
30 class Renderer;
31
32 namespace anbox {
33 namespace wm {
34 // FIXME(morphis): move this somewhere else once we have the integration
35 // with the emugl layer.
36 class Layer {
37  public:
38   graphics::Rect frame() const { return frame_; }
39
40  private:
41   graphics::Rect frame_;
42 };
43
44 class Window {
45  public:
46   typedef std::vector<Window> List;
47
48   Window(const std::shared_ptr<Renderer> &renderer, const Task::Id &task, const graphics::Rect &frame, const std::string &title);
49   virtual ~Window();
50
51   bool attach();
52   void release();
53
54   void update_state(const WindowState::List &states);
55   void update_frame(const graphics::Rect &frame);
56
57   virtual EGLNativeWindowType native_handle() const;
58   graphics::Rect frame() const;
59   Task::Id task() const;
60   std::string title() const;
61
62  private:
63   std::shared_ptr<Renderer> renderer_;
64   Task::Id task_;
65   graphics::Rect frame_;
66   std::string title_;
67   bool attached_ = false;
68 };
69 }  // namespace wm
70 }  // namespace anbox
71
72 #endif