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 #pragma once
25 
26 struct wmOperator;
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /* *************** internal api ************** */
33 void wm_ghost_init(bContext *C);
34 void wm_ghost_exit(void);
35 
36 void wm_get_screensize(int *r_width, int *r_height);
37 void wm_get_desktopsize(int *r_width, int *r_height);
38 
39 wmWindow *wm_window_new(const struct Main *bmain,
40                         wmWindowManager *wm,
41                         wmWindow *parent,
42                         bool dialog);
43 wmWindow *wm_window_copy(struct Main *bmain,
44                          wmWindowManager *wm,
45                          wmWindow *win_src,
46                          const bool duplicate_layout,
47                          const bool child);
48 wmWindow *wm_window_copy_test(bContext *C,
49                               wmWindow *win_src,
50                               const bool duplicate_layout,
51                               const bool child);
52 void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win);
53 void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win);
54 
55 void wm_window_title(wmWindowManager *wm, wmWindow *win);
56 void wm_window_ghostwindows_ensure(wmWindowManager *wm);
57 void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm);
58 void wm_window_process_events(const bContext *C);
59 
60 void wm_window_clear_drawable(wmWindowManager *wm);
61 void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win);
62 void wm_window_reset_drawable(void);
63 
64 void wm_window_raise(wmWindow *win);
65 void wm_window_lower(wmWindow *win);
66 void wm_window_set_size(wmWindow *win, int width, int height);
67 void wm_window_get_position(wmWindow *win, int *r_pos_x, int *r_pos_y);
68 void wm_window_swap_buffers(wmWindow *win);
69 void wm_window_set_swap_interval(wmWindow *win, int interval);
70 bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut);
71 
72 void wm_get_cursor_position(wmWindow *win, int *x, int *y);
73 void wm_cursor_position_from_ghost(wmWindow *win, int *x, int *y);
74 void wm_cursor_position_to_ghost(wmWindow *win, int *x, int *y);
75 
76 #ifdef WITH_INPUT_IME
77 void wm_window_IME_begin(wmWindow *win, int x, int y, int w, int h, bool complete);
78 void wm_window_IME_end(wmWindow *win);
79 #endif
80 
81 /* *************** window operators ************** */
82 int wm_window_close_exec(bContext *C, struct wmOperator *op);
83 int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op);
84 void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) ATTR_NONNULL();
85 
86 int wm_window_new_exec(bContext *C, struct wmOperator *op);
87 int wm_window_new_main_exec(bContext *C, struct wmOperator *op);
88 
89 void wm_test_autorun_warning(bContext *C);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94