Skip to content

Commit 0253fe2

Browse files
committed
update ui.h
1 parent c6af399 commit 0253fe2

File tree

1 file changed

+48
-10
lines changed

1 file changed

+48
-10
lines changed

headers/ui.h

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@
2020
#ifndef __LIBUI_UI_H__
2121
#define __LIBUI_UI_H__
2222

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>
3025

3126
#ifdef __cplusplus
27+
extern "C" {
3228
#endif
3329

3430
// this macro is generated by cmake
@@ -301,6 +297,48 @@ _UI_EXTERN char *uiWindowTitle(uiWindow *w);
301297
*/
302298
_UI_EXTERN void uiWindowSetTitle(uiWindow *w, const char *title);
303299

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+
304342
/**
305343
* Gets the window content size.
306344
*
@@ -352,9 +390,7 @@ _UI_EXTERN void uiWindowSetFullscreen(uiWindow *w, int fullscreen);
352390
* @p senderData User data registered with the sender instance.
353391
* @param data User data to be passed to the callback.
354392
*
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().
358394
* @note Only one callback can be registered at a time.
359395
* @memberof uiWindow
360396
*/
@@ -1216,6 +1252,7 @@ typedef struct uiProgressBar uiProgressBar;
12161252
* Returns the progress bar value.
12171253
*
12181254
* @param p uiProgressBar instance.
1255+
* @returns Progress bar value. `[Default 0]`
12191256
* @memberof uiProgressBar
12201257
*/
12211258
_UI_EXTERN int uiProgressBarValue(uiProgressBar *p);
@@ -3956,6 +3993,7 @@ _UI_EXTERN void uiTableSetSelection(uiTable *t, uiTableSelection *sel);
39563993
_UI_EXTERN void uiFreeTableSelection(uiTableSelection* s);
39573994

39583995
#ifdef __cplusplus
3996+
}
39593997
#endif
39603998

39613999
#endif

0 commit comments

Comments
 (0)