1 // Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // This file was generated by the CEF translator tool and should not edited 33 // by hand. See the translator.README.txt file in the tools directory for 34 // more information. 35 // 36 // $hash=15f88e3521ca96947fe8b1f91f251eb3405fb293$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_image_capi.h" 44 #include "include/capi/cef_menu_model_capi.h" 45 #include "include/capi/views/cef_display_capi.h" 46 #include "include/capi/views/cef_panel_capi.h" 47 #include "include/capi/views/cef_window_delegate_capi.h" 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 /// 54 // A Window is a top-level Window/widget in the Views hierarchy. By default it 55 // will have a non-client area with title bar, icon and buttons that supports 56 // moving and resizing. All size and position values are in density independent 57 // pixels (DIP) unless otherwise indicated. Methods must be called on the 58 // browser process UI thread unless otherwise indicated. 59 /// 60 typedef struct _cef_window_t { 61 /// 62 // Base structure. 63 /// 64 cef_panel_t base; 65 66 /// 67 // Show the Window. 68 /// 69 void(CEF_CALLBACK* show)(struct _cef_window_t* self); 70 71 /// 72 // Hide the Window. 73 /// 74 void(CEF_CALLBACK* hide)(struct _cef_window_t* self); 75 76 /// 77 // Sizes the Window to |size| and centers it in the current display. 78 /// 79 void(CEF_CALLBACK* center_window)(struct _cef_window_t* self, 80 const cef_size_t* size); 81 82 /// 83 // Close the Window. 84 /// 85 void(CEF_CALLBACK* close)(struct _cef_window_t* self); 86 87 /// 88 // Returns true (1) if the Window has been closed. 89 /// 90 int(CEF_CALLBACK* is_closed)(struct _cef_window_t* self); 91 92 /// 93 // Activate the Window, assuming it already exists and is visible. 94 /// 95 void(CEF_CALLBACK* activate)(struct _cef_window_t* self); 96 97 /// 98 // Deactivate the Window, making the next Window in the Z order the active 99 // Window. 100 /// 101 void(CEF_CALLBACK* deactivate)(struct _cef_window_t* self); 102 103 /// 104 // Returns whether the Window is the currently active Window. 105 /// 106 int(CEF_CALLBACK* is_active)(struct _cef_window_t* self); 107 108 /// 109 // Bring this Window to the top of other Windows in the Windowing system. 110 /// 111 void(CEF_CALLBACK* bring_to_top)(struct _cef_window_t* self); 112 113 /// 114 // Set the Window to be on top of other Windows in the Windowing system. 115 /// 116 void(CEF_CALLBACK* set_always_on_top)(struct _cef_window_t* self, int on_top); 117 118 /// 119 // Returns whether the Window has been set to be on top of other Windows in 120 // the Windowing system. 121 /// 122 int(CEF_CALLBACK* is_always_on_top)(struct _cef_window_t* self); 123 124 /// 125 // Maximize the Window. 126 /// 127 void(CEF_CALLBACK* maximize)(struct _cef_window_t* self); 128 129 /// 130 // Minimize the Window. 131 /// 132 void(CEF_CALLBACK* minimize)(struct _cef_window_t* self); 133 134 /// 135 // Restore the Window. 136 /// 137 void(CEF_CALLBACK* restore)(struct _cef_window_t* self); 138 139 /// 140 // Set fullscreen Window state. 141 /// 142 void(CEF_CALLBACK* set_fullscreen)(struct _cef_window_t* self, 143 int fullscreen); 144 145 /// 146 // Returns true (1) if the Window is maximized. 147 /// 148 int(CEF_CALLBACK* is_maximized)(struct _cef_window_t* self); 149 150 /// 151 // Returns true (1) if the Window is minimized. 152 /// 153 int(CEF_CALLBACK* is_minimized)(struct _cef_window_t* self); 154 155 /// 156 // Returns true (1) if the Window is fullscreen. 157 /// 158 int(CEF_CALLBACK* is_fullscreen)(struct _cef_window_t* self); 159 160 /// 161 // Set the Window title. 162 /// 163 void(CEF_CALLBACK* set_title)(struct _cef_window_t* self, 164 const cef_string_t* title); 165 166 /// 167 // Get the Window title. 168 /// 169 // The resulting string must be freed by calling cef_string_userfree_free(). 170 cef_string_userfree_t(CEF_CALLBACK* get_title)(struct _cef_window_t* self); 171 172 /// 173 // Set the Window icon. This should be a 16x16 icon suitable for use in the 174 // Windows's title bar. 175 /// 176 void(CEF_CALLBACK* set_window_icon)(struct _cef_window_t* self, 177 struct _cef_image_t* image); 178 179 /// 180 // Get the Window icon. 181 /// 182 struct _cef_image_t*(CEF_CALLBACK* get_window_icon)( 183 struct _cef_window_t* self); 184 185 /// 186 // Set the Window App icon. This should be a larger icon for use in the host 187 // environment app switching UI. On Windows, this is the ICON_BIG used in Alt- 188 // Tab list and Windows taskbar. The Window icon will be used by default if no 189 // Window App icon is specified. 190 /// 191 void(CEF_CALLBACK* set_window_app_icon)(struct _cef_window_t* self, 192 struct _cef_image_t* image); 193 194 /// 195 // Get the Window App icon. 196 /// 197 struct _cef_image_t*(CEF_CALLBACK* get_window_app_icon)( 198 struct _cef_window_t* self); 199 200 /// 201 // Show a menu with contents |menu_model|. |screen_point| specifies the menu 202 // position in screen coordinates. |anchor_position| specifies how the menu 203 // will be anchored relative to |screen_point|. 204 /// 205 void(CEF_CALLBACK* show_menu)(struct _cef_window_t* self, 206 struct _cef_menu_model_t* menu_model, 207 const cef_point_t* screen_point, 208 cef_menu_anchor_position_t anchor_position); 209 210 /// 211 // Cancel the menu that is currently showing, if any. 212 /// 213 void(CEF_CALLBACK* cancel_menu)(struct _cef_window_t* self); 214 215 /// 216 // Returns the Display that most closely intersects the bounds of this Window. 217 // May return NULL if this Window is not currently displayed. 218 /// 219 struct _cef_display_t*(CEF_CALLBACK* get_display)(struct _cef_window_t* self); 220 221 /// 222 // Returns the bounds (size and position) of this Window's client area. 223 // Position is in screen coordinates. 224 /// 225 cef_rect_t(CEF_CALLBACK* get_client_area_bounds_in_screen)( 226 struct _cef_window_t* self); 227 228 /// 229 // Set the regions where mouse events will be intercepted by this Window to 230 // support drag operations. Call this function with an NULL vector to clear 231 // the draggable regions. The draggable region bounds should be in window 232 // coordinates. 233 /// 234 void(CEF_CALLBACK* set_draggable_regions)( 235 struct _cef_window_t* self, 236 size_t regionsCount, 237 cef_draggable_region_t const* regions); 238 239 /// 240 // Retrieve the platform window handle for this Window. 241 /// 242 cef_window_handle_t(CEF_CALLBACK* get_window_handle)( 243 struct _cef_window_t* self); 244 245 /// 246 // Simulate a key press. |key_code| is the VKEY_* value from Chromium's 247 // ui/events/keycodes/keyboard_codes.h header (VK_* values on Windows). 248 // |event_flags| is some combination of EVENTFLAG_SHIFT_DOWN, 249 // EVENTFLAG_CONTROL_DOWN and/or EVENTFLAG_ALT_DOWN. This function is exposed 250 // primarily for testing purposes. 251 /// 252 void(CEF_CALLBACK* send_key_press)(struct _cef_window_t* self, 253 int key_code, 254 uint32 event_flags); 255 256 /// 257 // Simulate a mouse move. The mouse cursor will be moved to the specified 258 // (screen_x, screen_y) position. This function is exposed primarily for 259 // testing purposes. 260 /// 261 void(CEF_CALLBACK* send_mouse_move)(struct _cef_window_t* self, 262 int screen_x, 263 int screen_y); 264 265 /// 266 // Simulate mouse down and/or mouse up events. |button| is the mouse button 267 // type. If |mouse_down| is true (1) a mouse down event will be sent. If 268 // |mouse_up| is true (1) a mouse up event will be sent. If both are true (1) 269 // a mouse down event will be sent followed by a mouse up event (equivalent to 270 // clicking the mouse button). The events will be sent using the current 271 // cursor position so make sure to call send_mouse_move() first to position 272 // the mouse. This function is exposed primarily for testing purposes. 273 /// 274 void(CEF_CALLBACK* send_mouse_events)(struct _cef_window_t* self, 275 cef_mouse_button_type_t button, 276 int mouse_down, 277 int mouse_up); 278 279 /// 280 // Set the keyboard accelerator for the specified |command_id|. |key_code| can 281 // be any virtual key or character value. cef_window_delegate_t::OnAccelerator 282 // will be called if the keyboard combination is triggered while this window 283 // has focus. 284 /// 285 void(CEF_CALLBACK* set_accelerator)(struct _cef_window_t* self, 286 int command_id, 287 int key_code, 288 int shift_pressed, 289 int ctrl_pressed, 290 int alt_pressed); 291 292 /// 293 // Remove the keyboard accelerator for the specified |command_id|. 294 /// 295 void(CEF_CALLBACK* remove_accelerator)(struct _cef_window_t* self, 296 int command_id); 297 298 /// 299 // Remove all keyboard accelerators. 300 /// 301 void(CEF_CALLBACK* remove_all_accelerators)(struct _cef_window_t* self); 302 } cef_window_t; 303 304 /// 305 // Create a new Window. 306 /// 307 CEF_EXPORT cef_window_t* cef_window_create_top_level( 308 struct _cef_window_delegate_t* delegate); 309 310 #ifdef __cplusplus 311 } 312 #endif 313 314 #endif // CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_ 315