|
20 | 20 | #ifndef __LIBUI_UI_H__ |
21 | 21 | #define __LIBUI_UI_H__ |
22 | 22 |
|
23 | | -#if defined(windows) |
24 | | -# define dllName "libui.dll" |
25 | | -#elif defined(macosx) |
26 | | -# define dllName "libui.dylib" |
27 | | -#else |
28 | | -# define dllName "libui.so" |
29 | | -#endif |
| 23 | +#include <stddef.h> |
| 24 | +#include <stdint.h> |
30 | 25 |
|
31 | 26 | #ifdef __cplusplus |
| 27 | +extern "C" { |
32 | 28 | #endif |
33 | 29 |
|
34 | 30 | // this macro is generated by cmake |
@@ -301,6 +297,48 @@ _UI_EXTERN char *uiWindowTitle(uiWindow *w); |
301 | 297 | */ |
302 | 298 | _UI_EXTERN void uiWindowSetTitle(uiWindow *w, const char *title); |
303 | 299 |
|
| 300 | +/** |
| 301 | + * Gets the window position. |
| 302 | + * |
| 303 | + * Coordinates are measured from the top left corner of the screen. |
| 304 | + * |
| 305 | + * @param w uiWindow instance. |
| 306 | + * @param[out] x X position of the window. |
| 307 | + * @param[out] y Y position of the window. |
| 308 | + * @note This method may return inaccurate or dummy values on Unix platforms. |
| 309 | + * @memberof uiWindow |
| 310 | + */ |
| 311 | +_UI_EXTERN void uiWindowPosition(uiWindow *w, int *x, int *y); |
| 312 | + |
| 313 | +/** |
| 314 | + * Moves the window to the specified position. |
| 315 | + * |
| 316 | + * Coordinates are measured from the top left corner of the screen. |
| 317 | + * |
| 318 | + * @param w uiWindow instance. |
| 319 | + * @param x New x position of the window. |
| 320 | + * @param y New y position of the window. |
| 321 | + * @note This method is merely a hint and may be ignored on Unix platforms. |
| 322 | + * @memberof uiWindow |
| 323 | + */ |
| 324 | +_UI_EXTERN void uiWindowSetPosition(uiWindow *w, int x, int y); |
| 325 | + |
| 326 | +/** |
| 327 | + * Registers a callback for when the window moved. |
| 328 | + * |
| 329 | + * @param w uiWindow instance. |
| 330 | + * @param f Callback function.\n |
| 331 | + * @p sender Back reference to the instance that triggered the callback.\n |
| 332 | + * @p senderData User data registered with the sender instance.\n |
| 333 | + * @param data User data to be passed to the callback. |
| 334 | + * |
| 335 | + * @note Only one callback can be registered at a time. |
| 336 | + * @note The callback is not triggered when calling uiWindowSetPosition(). |
| 337 | + * @memberof uiWindow |
| 338 | + */ |
| 339 | +_UI_EXTERN void uiWindowOnPositionChanged(uiWindow *w, |
| 340 | + void (*f)(uiWindow *sender, void *senderData), void *data); |
| 341 | + |
304 | 342 | /** |
305 | 343 | * Gets the window content size. |
306 | 344 | * |
@@ -352,9 +390,7 @@ _UI_EXTERN void uiWindowSetFullscreen(uiWindow *w, int fullscreen); |
352 | 390 | * @p senderData User data registered with the sender instance. |
353 | 391 | * @param data User data to be passed to the callback. |
354 | 392 | * |
355 | | - * @todo Research if this gets called on uiWindowSetContentSize(). |
356 | | - * The signal on unix does not seem to get masked. Fix this on all |
357 | | - * platforms and document the masking here. |
| 393 | + * @note The callback is not triggered when calling uiWindowSetContentSize(). |
358 | 394 | * @note Only one callback can be registered at a time. |
359 | 395 | * @memberof uiWindow |
360 | 396 | */ |
@@ -1216,6 +1252,7 @@ typedef struct uiProgressBar uiProgressBar; |
1216 | 1252 | * Returns the progress bar value. |
1217 | 1253 | * |
1218 | 1254 | * @param p uiProgressBar instance. |
| 1255 | + * @returns Progress bar value. `[Default 0]` |
1219 | 1256 | * @memberof uiProgressBar |
1220 | 1257 | */ |
1221 | 1258 | _UI_EXTERN int uiProgressBarValue(uiProgressBar *p); |
@@ -3956,6 +3993,7 @@ _UI_EXTERN void uiTableSetSelection(uiTable *t, uiTableSelection *sel); |
3956 | 3993 | _UI_EXTERN void uiFreeTableSelection(uiTableSelection* s); |
3957 | 3994 |
|
3958 | 3995 | #ifdef __cplusplus |
| 3996 | +} |
3959 | 3997 | #endif |
3960 | 3998 |
|
3961 | 3999 | #endif |
0 commit comments