diff options
Diffstat (limited to 'src/ui/window.h')
-rw-r--r-- | src/ui/window.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/ui/window.h b/src/ui/window.h index 5bde9065..ddb03847 100644 --- a/src/ui/window.h +++ b/src/ui/window.h | |||
@@ -32,13 +32,35 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
32 | iDeclareType(Window) | 32 | iDeclareType(Window) |
33 | iDeclareTypeConstructionArgs(Window, iRect rect) | 33 | iDeclareTypeConstructionArgs(Window, iRect rect) |
34 | 34 | ||
35 | enum iWindowSnap { | ||
36 | none_WindowSnap = 0, | ||
37 | left_WindowSnap = 1, | ||
38 | right_WindowSnap = 2, | ||
39 | maximized_WindowSnap = 3, | ||
40 | yMaximized_WindowSnap = 4, | ||
41 | fullscreen_WindowSnap = 5, | ||
42 | mask_WindowSnap = 0xff, | ||
43 | topBit_WindowSnap = iBit(9), | ||
44 | bottomBit_WindowSnap = iBit(10), | ||
45 | }; | ||
46 | |||
47 | iDeclareType(WindowPlacement) | ||
48 | |||
49 | /* Tracking of window placement. */ | ||
50 | struct Impl_WindowPlacement { | ||
51 | iInt2 initialPos; | ||
52 | iRect normalRect; /* updated when window is moved/resized */ | ||
53 | iInt2 lastNotifiedSize; /* keep track of horizontal/vertical notifications */ | ||
54 | int snap; /* LAGRANGE_CUSTOM_FRAME */ | ||
55 | int lastHit; | ||
56 | }; | ||
57 | |||
35 | struct Impl_Window { | 58 | struct Impl_Window { |
36 | SDL_Window * win; | 59 | SDL_Window * win; |
37 | iInt2 initialPos; | 60 | iWindowPlacement place; |
38 | iRect lastRect; /* updated when window is moved/resized */ | ||
39 | iInt2 lastNotifiedSize; /* keep track of horizontal/vertical notifications */ | ||
40 | iBool isDrawFrozen; /* avoids premature draws while restoring window state */ | 61 | iBool isDrawFrozen; /* avoids premature draws while restoring window state */ |
41 | iBool isExposed; | 62 | iBool isExposed; |
63 | iBool isMinimized; | ||
42 | iBool isMouseInside; | 64 | iBool isMouseInside; |
43 | uint32_t focusGainedAt; | 65 | uint32_t focusGainedAt; |
44 | SDL_Renderer *render; | 66 | SDL_Renderer *render; |
@@ -60,6 +82,7 @@ void setTitle_Window (iWindow *, const iString *title); | |||
60 | void setUiScale_Window (iWindow *, float uiScale); | 82 | void setUiScale_Window (iWindow *, float uiScale); |
61 | void setFreezeDraw_Window (iWindow *, iBool freezeDraw); | 83 | void setFreezeDraw_Window (iWindow *, iBool freezeDraw); |
62 | void setCursor_Window (iWindow *, int cursor); | 84 | void setCursor_Window (iWindow *, int cursor); |
85 | void setSnap_Window (iWindow *, int snapMode); | ||
63 | 86 | ||
64 | uint32_t id_Window (const iWindow *); | 87 | uint32_t id_Window (const iWindow *); |
65 | iInt2 rootSize_Window (const iWindow *); | 88 | iInt2 rootSize_Window (const iWindow *); |
@@ -68,6 +91,11 @@ iInt2 coord_Window (const iWindow *, int x, int y); | |||
68 | iInt2 mouseCoord_Window (const iWindow *); | 91 | iInt2 mouseCoord_Window (const iWindow *); |
69 | uint32_t frameTime_Window (const iWindow *); | 92 | uint32_t frameTime_Window (const iWindow *); |
70 | SDL_Renderer *renderer_Window (const iWindow *); | 93 | SDL_Renderer *renderer_Window (const iWindow *); |
94 | int snap_Window (const iWindow *); | ||
71 | iBool isFullscreen_Window (const iWindow *); | 95 | iBool isFullscreen_Window (const iWindow *); |
72 | 96 | ||
73 | iWindow * get_Window (void); | 97 | iWindow * get_Window (void); |
98 | |||
99 | #if defined (LAGRANGE_CUSTOM_FRAME) | ||
100 | SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos); | ||
101 | #endif | ||