Skip to content

Commit a221b7f

Browse files
committed
Updating headers for current trunk (1.3 alpha)
1 parent 7f9de24 commit a221b7f

29 files changed

+421
-293
lines changed

AppCore/App.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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) 2019 Ultralight, Inc. All rights reserved.
12+
/// Copyright (C) 2021 Ultralight, Inc. All rights reserved.
1313
///
1414
#pragma once
1515
#include "Defines.h"
@@ -119,21 +119,6 @@ class AExport App : public RefCounted {
119119
///
120120
virtual const Settings& settings() const = 0;
121121

122-
///
123-
/// Set the main window. You must set this before calling Run.
124-
///
125-
/// @param window The window to use for all rendering.
126-
///
127-
/// @note We currently only support one Window per App, this will change
128-
/// later once we add support for multiple driver instances.
129-
///
130-
virtual void set_window(Ref<Window> window) = 0;
131-
132-
///
133-
/// Get the main window.
134-
///
135-
virtual RefPtr<Window> window() = 0;
136-
137122
///
138123
/// Set an AppListener to receive callbacks for app-related events.
139124
///
@@ -166,8 +151,6 @@ class AExport App : public RefCounted {
166151
///
167152
/// Run the main loop.
168153
///
169-
/// @note Make sure to call set_window before calling this.
170-
///
171154
virtual void Run() = 0;
172155

173156
///

AppCore/CAPI.h

Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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
///
4242
typedef 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
///
130131
ACExport 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-
147133
typedef void
148134
(*ULUpdateCallback) (void* user_data);
149135

@@ -175,7 +161,7 @@ ACExport ULMonitor ulAppGetMainMonitor(ULApp app);
175161
ACExport 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
///
180166
ACExport 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,
222208
ACExport void ulDestroyWindow(ULWindow window);
223209

224210
typedef 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

234220
typedef 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
///
248239
ACExport 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
///
253249
ACExport 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
///
273292
ACExport 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
///
278312
ACExport 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.

AppCore/Defines.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Copyright 2018 Ultralight, Inc. All rights reserved.
1+
/// This file is a part of Ultralight, a next-generation HTML renderer.
2+
///
3+
/// Website: <http://ultralig.ht>
4+
///
5+
/// Copyright (C) 2021 Ultralight, Inc. All rights reserved.
26
#pragma once
37

48
// Needed for limit defines, like INTMAX_MAX, which is used by the std C++ library
@@ -25,17 +29,25 @@
2529

2630

2731
#if defined(__WIN32__) || defined(_WIN32)
28-
# if defined(APPCORE_IMPLEMENTATION)
29-
# define AExport __declspec(dllexport)
32+
# if defined(ULTRALIGHT_STATIC_BUILD)
33+
# define AExport
3034
# else
31-
# define AExport __declspec(dllimport)
35+
# if defined(APPCORE_IMPLEMENTATION)
36+
# define AExport __declspec(dllexport)
37+
# else
38+
# define AExport __declspec(dllimport)
39+
# endif
3240
# endif
3341
#define _thread_local __declspec(thread)
3442
#ifndef _NATIVE_WCHAR_T_DEFINED
3543
#define DISABLE_NATIVE_WCHAR_T
3644
#endif
3745
#else
38-
# define AExport __attribute__((visibility("default")))
46+
# if defined(ULTRALIGHT_STATIC_BUILD)
47+
# define AExport
48+
# else
49+
# define AExport __attribute__((visibility("default")))
50+
# endif
3951
#define _thread_local __thread
4052
#endif
4153

AppCore/JSHelpers.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/// This file is a part of Ultralight, a next-generation HTML renderer.
2+
///
3+
/// Website: <http://ultralig.ht>
4+
///
5+
/// Copyright (C) 2021 Ultralight, Inc. All rights reserved.
16
#pragma once
27
#include <AppCore/Defines.h>
38
#include <JavaScriptCore/JavaScript.h>

AppCore/Monitor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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) 2019 Ultralight, Inc. All rights reserved.
12+
/// Copyright (C) 2021 Ultralight, Inc. All rights reserved.
1313
///
1414
#pragma once
1515
#include "Defines.h"

AppCore/Overlay.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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) 2019 Ultralight, Inc. All rights reserved.
12+
/// Copyright (C) 2021 Ultralight, Inc. All rights reserved.
1313
///
1414
#pragma once
1515
#include "Window.h"
@@ -28,8 +28,7 @@ class AExport Overlay : public RefCounted {
2828
///
2929
/// Create a new Overlay.
3030
///
31-
/// @param window The window to create the Overlay in. (we currently only
32-
/// support one window per application)
31+
/// @param window The window to create the Overlay in.
3332
///
3433
/// @param width The width in pixels.
3534
///
@@ -47,8 +46,7 @@ class AExport Overlay : public RefCounted {
4746
///
4847
/// Create a new Overlay, wrapping an existing View.
4948
///
50-
/// @param window The window to create the Overlay in. (we currently only
51-
/// support one window per application)
49+
/// @param window The window to create the Overlay in.
5250
///
5351
/// @param view The View to wrap (will use its width and height).
5452
///
@@ -134,7 +132,7 @@ class AExport Overlay : public RefCounted {
134132

135133
protected:
136134
virtual ~Overlay();
137-
virtual void Draw() = 0;
135+
virtual void Paint() = 0;
138136
friend class OverlayManager;
139137
};
140138

AppCore/Platform.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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
#pragma once
1515
#include "Defines.h"

0 commit comments

Comments
 (0)