31#ifndef FENNEC_PLATFORM_INTERFACE_WINDOW_H
32#define FENNEC_PLATFORM_INTERFACE_WINDOW_H
34#include <fennec/platform/interface/fwd.h>
38#include <fennec/string/string.h>
42#include <fennec/memory/pointers.h>
50 static constexpr size_t nullid = -1;
57 mode_exclusive_fullscreen,
67 flag_always_on_top = 0,
88 using flags_t = bitfield<flag_count>;
89 using state_t = bitfield<state_count>;
91 struct accessibility {
92 string name, description;
105 accessibility accessibility;
116 window(display_server* server,
const config& conf, window* parent);
120 const config& get_config()
const {
return cfg; }
122 window* get_parent()
const {
return parent; }
123 window* get_root()
const {
return root; }
125 const ivec2& get_size()
const {
return state.rect.size; }
126 const ivec2& get_position()
const {
return state.rect.position; }
128 int get_width()
const {
return state.rect.size.x; }
129 int get_height()
const {
return state.rect.size.y; }
130 int get_pos_x()
const {
return state.rect.position.x; }
131 int get_pos_y()
const {
return state.rect.position.y; }
133 bool is_visible()
const {
return state.flags.test(state_visible); }
134 bool is_child()
const {
return state.flags.test(state_child); }
135 bool is_running()
const {
return state.flags.test(state_running); }
136 bool is_suspended()
const {
return state.flags.test(state_suspended); }
138 bool get_flag(uint8_t flag)
const {
return cfg.flags.test(flag); }
140 bool is_always_on_top()
const {
return get_flag(flag_always_on_top); }
141 bool is_borderless()
const {
return get_flag(flag_borderless); }
142 bool is_modal()
const {
return get_flag(flag_modal); }
143 bool is_passing_mouse()
const {
return get_flag(flag_pass_mouse); }
144 bool is_popup()
const {
return get_flag(flag_popup); }
145 bool is_resizable()
const {
return get_flag(flag_resizable); }
146 bool is_transparent()
const {
return get_flag(flag_transparent); }
147 bool is_no_focus()
const {
return get_flag(flag_no_focus); }
150 virtual bool set_flag(uint8_t flag,
bool val) = 0;
152 bool set_always_on_top(
bool val) {
return set_flag(flag_always_on_top, val); }
153 bool set_borderless(
bool val) {
return set_flag(flag_borderless, val); }
154 bool set_modal(
bool val) {
return set_flag(flag_modal, val); }
155 bool set_passing_mouse(
bool val) {
return set_flag(flag_pass_mouse, val); }
156 bool set_popup(
bool val) {
return set_flag(flag_popup, val); }
157 bool set_resizable(
bool val) {
return set_flag(flag_resizable, val); }
158 bool set_transparent(
bool val) {
return set_flag(flag_transparent, val); }
159 bool set_no_focus(
bool val) {
return set_flag(flag_no_focus, val); }
161 virtual void initialize() = 0;
162 virtual void shutdown() = 0;
164 virtual void begin_frame();
165 virtual void end_frame();
167 virtual void* get_native_handle() = 0;
170 display_server*
const server;
171 window*
const parent;
175 unique_ptr<gfxsurface> gfx_surface;
178template<
typename DisplayT>
179class window_base :
public window {
181 window_base(display_server* display,
const config& conf, window* parent)
182 : window(display, conf, parent) {
185 using display_t = DisplayT;
A header containing the definition for a container with an optionally present variable.
double double_t
A double-precision floating-point type, typically with a size of 64-bits.
Definition types.h:235
::uint8_t uint8_t
Unsigned 8-bit integer.
Definition types.h:272
signed int int_t
A signed integer type, size varies by implementation, but typically 32-bit.
Definition types.h:225
tvec2< int32_t > ivec2
A two-component signed integer vector.
Definition vector.h:153