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