Blender V4.3
GHOST_WindowSDL.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#pragma once
11
12#include "GHOST_SystemSDL.hh"
13#include "GHOST_Window.hh"
14
15#include <map>
16
17extern "C" {
18#include "SDL.h"
19}
20
21#if !SDL_VERSION_ATLEAST(2, 0, 0)
22# error "SDL 2.0 or newer is needed to build with Ghost"
23#endif
24
25class GHOST_SystemSDL;
26
28 private:
29 GHOST_SystemSDL *m_system;
30 bool m_valid_setup;
31 bool m_invalid_window;
32
33 SDL_Window *m_sdl_win;
34 SDL_Cursor *m_sdl_custom_cursor;
35
36 public:
38 const char *title,
39 int32_t left,
40 int32_t top,
41 uint32_t width,
42 uint32_t height,
45 const bool stereoVisual = false,
46 const bool exclusive = false,
47 const GHOST_IWindow *parentWindow = nullptr);
48
50
51 /* SDL specific */
52 SDL_Window *getSDLWindow()
53 {
54 return m_sdl_win;
55 }
56
57 GHOST_TSuccess invalidate() override;
58
64 void validate()
65 {
66 m_invalid_window = false;
67 }
68
69 bool getValid() const override;
70
71 void getWindowBounds(GHOST_Rect &bounds) const override;
72 void getClientBounds(GHOST_Rect &bounds) const override;
73
74 protected:
80
82
85
87 uint8_t *mask,
88 int sizex,
89 int sizey,
90 int hotX,
91 int hotY,
92 bool canInvertColor) override;
93
94 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
95
96 void setTitle(const char *title) override;
97
98 std::string getTitle() const override;
99
100 GHOST_TSuccess setClientWidth(uint32_t width) override;
101
102 GHOST_TSuccess setClientHeight(uint32_t height) override;
103
104 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
105
106 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
107
108 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
109
111
112 GHOST_TWindowState getState() const override;
113
115 {
116 // TODO
117 return GHOST_kSuccess;
118 }
119
120 // TODO
122 {
123 return GHOST_kFailure;
124 }
125
127 {
128 return GHOST_kFailure;
129 }
130
131 uint16_t getDPIHint() override;
132};
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
@ GHOST_kDrawingContextTypeNone
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
@ GHOST_kSuccess
Definition GHOST_Types.h:87
GHOST_TGrabCursorMode
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
std::string getTitle() const override
GHOST_TSuccess endFullScreen() const override
GHOST_TWindowState getState() const override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_TSuccess invalidate() override
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setOrder(GHOST_TWindowOrder) override
GHOST_TSuccess setClientHeight(uint32_t height) override
SDL_Window * getSDLWindow()
GHOST_TSuccess beginFullScreen() const override
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type) override
GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) override
void getClientBounds(GHOST_Rect &bounds) const override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
GHOST_TSuccess setClientWidth(uint32_t width) override
GHOST_WindowSDL(GHOST_SystemSDL *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type=GHOST_kDrawingContextTypeNone, const bool stereoVisual=false, const bool exclusive=false, const GHOST_IWindow *parentWindow=nullptr)
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
void getWindowBounds(GHOST_Rect &bounds) const override
uint16_t getDPIHint() override
bool getValid() const override
void setTitle(const char *title) override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape) override
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
static ulong state[N]
unsigned short uint16_t
Definition stdint.h:79
unsigned int uint32_t
Definition stdint.h:80
signed int int32_t
Definition stdint.h:77
unsigned char uint8_t
Definition stdint.h:78