Merge branch 'master' into blender2.8
[blender.git] / source / blender / windowmanager / wm_window.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2007 Blender Foundation.
19  * All rights reserved.
20  *
21  *
22  * Contributor(s): Blender Foundation
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/windowmanager/wm_window.h
28  *  \ingroup wm
29  */
30
31
32 #ifndef __WM_WINDOW_H__
33 #define __WM_WINDOW_H__
34
35 struct EnumPropertyItem;
36 struct wmEvent;
37 struct wmOperator;
38 struct PointerRNA;
39 struct PropertyRNA;
40
41 /* *************** internal api ************** */
42 void            wm_ghost_init                   (bContext *C);
43 void            wm_ghost_exit(void);
44
45 void wm_get_screensize(int *r_width, int *r_height);
46 void wm_get_desktopsize(int *r_width, int *r_height);
47
48 wmWindow        *wm_window_new                  (bContext *C);
49 wmWindow        *wm_window_copy                 (bContext *C, wmWindow *win_src, const bool duplicate_layout);
50 wmWindow        *wm_window_copy_test    (bContext *C, wmWindow *win_src, const bool duplicate_layout);
51 void            wm_window_free                  (bContext *C, wmWindowManager *wm, wmWindow *win);
52 void            wm_window_close                 (bContext *C, wmWindowManager *wm, wmWindow *win);
53
54 void            wm_window_title                         (wmWindowManager *wm, wmWindow *win);
55 void            wm_window_ghostwindows_ensure(wmWindowManager *wm);
56 void            wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm);
57 void            wm_window_process_events        (const bContext *C);
58 void            wm_window_process_events_nosleep(void);
59
60 void            wm_window_make_drawable(wmWindowManager *wm, wmWindow *win);
61 void            wm_window_reset_drawable(void);
62
63 void            wm_window_raise                 (wmWindow *win);
64 void            wm_window_lower                 (wmWindow *win);
65 void            wm_window_set_size              (wmWindow *win, int width, int height);
66 void            wm_window_get_position  (wmWindow *win, int *r_pos_x, int *r_pos_y);
67 void            wm_window_swap_buffers  (wmWindow *win);
68 void            wm_window_set_swap_interval(wmWindow *win, int interval);
69 bool            wm_window_get_swap_interval(wmWindow *win, int *intervalOut);
70
71 void            wm_get_cursor_position                  (wmWindow *win, int *x, int *y);
72 void            wm_cursor_position_from_ghost   (wmWindow *win, int *x, int *y);
73 void            wm_cursor_position_to_ghost             (wmWindow *win, int *x, int *y);
74
75 void            wm_window_testbreak             (void);
76
77 #ifdef WITH_INPUT_IME
78 void            wm_window_IME_begin     (wmWindow *win, int x, int y, int w, int h, bool complete);
79 void            wm_window_IME_end       (wmWindow *win);
80 #endif
81
82 /* *************** window operators ************** */
83 int                     wm_window_close_exec(bContext *C, struct wmOperator *op);
84 int                     wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op);
85 void            wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) ATTR_NONNULL();
86
87 const struct EnumPropertyItem *wm_window_new_screen_itemf(
88         bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
89 int                     wm_window_new_exec(bContext *C, struct wmOperator *op);
90 int                     wm_window_new_invoke(bContext *C, struct wmOperator *op, const struct wmEvent *event);
91
92 /* Initial (unmaximized) size to start with for
93  * systems that can't find it for themselves (X11).
94  * Clamped by real desktop limits */
95 #define WM_WIN_INIT_SIZE_X 1800
96 #define WM_WIN_INIT_SIZE_Y 1000
97 #define WM_WIN_INIT_PAD 40
98
99 #endif /* __WM_WINDOW_H__ */
100