55///
66/// @author
77///
8- /// This file is a part of Ultralight, a fast, lightweight, HTML UI engine
8+ /// This file is a part of Ultralight, a next-generation HTML renderer.
99///
1010/// Website: <http://ultralig.ht>
1111///
12- /// Copyright (C) 2020 Ultralight, Inc. All rights reserved.
12+ /// Copyright (C) 2021 Ultralight, Inc. All rights reserved.
1313///
1414#ifndef APPCORE_CAPI_H
1515#define APPCORE_CAPI_H
@@ -40,10 +40,11 @@ typedef struct C_Overlay* ULOverlay;
4040/// Window creation flags. @see Window::Create
4141///
4242typedef enum {
43- kWindowFlags_Borderless = 1 << 0 ,
44- kWindowFlags_Titled = 1 << 1 ,
45- kWindowFlags_Resizable = 1 << 2 ,
43+ kWindowFlags_Borderless = 1 << 0 ,
44+ kWindowFlags_Titled = 1 << 1 ,
45+ kWindowFlags_Resizable = 1 << 2 ,
4646 kWindowFlags_Maximizable = 1 << 3 ,
47+ kWindowFlags_Hidden = 1 << 4 ,
4748} ULWindowFlags ;
4849
4950///
@@ -129,21 +130,6 @@ ACExport ULApp ulCreateApp(ULSettings settings, ULConfig config);
129130///
130131ACExport void ulDestroyApp (ULApp app );
131132
132- ///
133- /// Set the main window, you must set this before calling ulAppRun.
134- ///
135- /// @param window The window to use for all rendering.
136- ///
137- /// @note We currently only support one Window per App, this will change
138- /// later once we add support for multiple driver instances.
139- ///
140- ACExport void ulAppSetWindow (ULApp app , ULWindow window );
141-
142- ///
143- /// Get the main window.
144- ///
145- ACExport ULWindow ulAppGetWindow (ULApp app );
146-
147133typedef void
148134(* ULUpdateCallback ) (void * user_data );
149135
@@ -175,7 +161,7 @@ ACExport ULMonitor ulAppGetMainMonitor(ULApp app);
175161ACExport ULRenderer ulAppGetRenderer (ULApp app );
176162
177163///
178- /// Run the main loop, make sure to call ulAppSetWindow before calling this .
164+ /// Run the main loop.
179165///
180166ACExport void ulAppRun (ULApp app );
181167
@@ -204,9 +190,9 @@ ACExport unsigned int ulMonitorGetHeight(ULMonitor monitor);
204190///
205191/// @param monitor The monitor to create the Window on.
206192///
207- /// @param width The width (in device coordinates).
193+ /// @param width The width (in screen coordinates).
208194///
209- /// @param height The height (in device coordinates).
195+ /// @param height The height (in screen coordinates).
210196///
211197/// @param fullscreen Whether or not the window is fullscreen.
212198///
@@ -222,7 +208,7 @@ ACExport ULWindow ulCreateWindow(ULMonitor monitor, unsigned int width,
222208ACExport void ulDestroyWindow (ULWindow window );
223209
224210typedef void
225- (* ULCloseCallback ) (void * user_data );
211+ (* ULCloseCallback ) (void * user_data , ULWindow window );
226212
227213///
228214/// Set a callback to be notified when a window closes.
@@ -232,7 +218,7 @@ ACExport void ulWindowSetCloseCallback(ULWindow window,
232218 void * user_data );
233219
234220typedef void
235- (* ULResizeCallback ) (void * user_data , unsigned int width , unsigned int height );
221+ (* ULResizeCallback ) (void * user_data , ULWindow window , unsigned int width , unsigned int height );
236222
237223///
238224/// Set a callback to be notified when a window resizes
@@ -242,16 +228,49 @@ ACExport void ulWindowSetResizeCallback(ULWindow window,
242228 ULResizeCallback callback ,
243229 void * user_data );
244230
231+ ///
232+ /// Get window width (in screen coordinates).
233+ ///
234+ ACExport unsigned int ulWindowGetScreenWidth (ULWindow window );
235+
245236///
246237/// Get window width (in pixels).
247238///
248239ACExport unsigned int ulWindowGetWidth (ULWindow window );
249240
241+ ///
242+ /// Get window height (in screen coordinates).
243+ ///
244+ ACExport unsigned int ulWindowGetScreenHeight (ULWindow window );
245+
250246///
251247/// Get window height (in pixels).
252248///
253249ACExport unsigned int ulWindowGetHeight (ULWindow window );
254250
251+ ///
252+ /// Move the window to a new position (in screen coordinates) relative to the top-left of the
253+ /// monitor area.
254+ ///
255+ ACExport void ulWindowMoveTo (ULWindow window , int x , int y );
256+
257+ ///
258+ /// Move the window to the center of the monitor.
259+ ///
260+ ACExport void ulWindowMoveToCenter (ULWindow );
261+
262+ ///
263+ /// Get the x-position of the window (in screen coordinates) relative to the top-left of the
264+ /// monitor area.
265+ ///
266+ ACExport int ulWindowGetPositionX (ULWindow window );
267+
268+ ///
269+ /// Get the y-position of the window (in screen coordinates) relative to the top-left of the
270+ /// monitor area.
271+ ///
272+ ACExport int ulWindowGetPositionY (ULWindow window );
273+
255274///
256275/// Get whether or not a window is fullscreen.
257276///
@@ -272,20 +291,35 @@ ACExport void ulWindowSetTitle(ULWindow window, const char* title);
272291///
273292ACExport void ulWindowSetCursor (ULWindow window , ULCursor cursor );
274293
294+ ///
295+ /// Show the window (if it was previously hidden).
296+ ///
297+ ACExport void ulWindowShow (ULWindow window );
298+
299+ ///
300+ /// Hide the window.
301+ ///
302+ ACExport void ulWindowHide (ULWindow window );
303+
304+ ///
305+ /// Whether or not the window is currently visible (not hidden).
306+ ///
307+ ACExport bool ulWindowIsVisible (ULWindow window );
308+
275309///
276310/// Close a window.
277311///
278312ACExport void ulWindowClose (ULWindow window );
279313
280314///
281- /// Convert device coordinates to pixels using the current DPI scale.
315+ /// Convert screen coordinates to pixels using the current DPI scale.
282316///
283- ACExport int ulWindowDeviceToPixel (ULWindow window , int val );
317+ ACExport int ulWindowScreenToPixels (ULWindow window , int val );
284318
285319///
286- /// Convert pixels to device coordinates using the current DPI scale.
320+ /// Convert pixels to screen coordinates using the current DPI scale.
287321///
288- ACExport int ulWindowPixelsToDevice (ULWindow window , int val );
322+ ACExport int ulWindowPixelsToScreen (ULWindow window , int val );
289323
290324///
291325/// Get the underlying native window handle.
@@ -299,12 +333,11 @@ ACExport void* ulWindowGetNativeHandle(ULWindow window);
299333///
300334/// Create a new Overlay.
301335///
302- /// @param window The window to create the Overlay in. (we currently only
303- /// support one window per application)
336+ /// @param window The window to create the Overlay in.
304337///
305- /// @param width The width in device coordinates .
338+ /// @param width The width in pixels .
306339///
307- /// @param height The height in device coordinates .
340+ /// @param height The height in pixels .
308341///
309342/// @param x The x-position (offset from the left of the Window), in
310343/// pixels.
0 commit comments