naev 0.11.5
nlua_tk.c
Go to the documentation of this file.
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
10#include <lauxlib.h>
11#include <stdlib.h>
12
13#include "naev.h"
16#include "nlua_tk.h"
17
18#include "array.h"
19#include "dialogue.h"
20#include "input.h"
21#include "land.h"
22#include "land_outfits.h"
23#include "log.h"
24#include "nlua_colour.h"
25#include "nlua_gfx.h"
26#include "nlua_outfit.h"
27#include "nluadef.h"
28#include "toolkit.h"
29#include "tk/toolkit_priv.h"
30
31/* Stuff for the custom toolkit. */
32#define TK_CUSTOMDONE "__customDone"
33typedef struct custom_functions_s {
34 lua_State *L;
35 int done;
36 /* Function references. */
37 int update;
38 int draw;
39 int keyboard;
40 int mouse;
41 int resize;
42 int textinput;
44static int cust_update( double dt, void* data );
45static void cust_render( double x, double y, double w, double h, void* data );
46static int cust_event( unsigned int wid, SDL_Event *event, void* data );
47static int cust_key( SDL_Keycode key, SDL_Keymod mod, int pressed, int isrepeat, custom_functions_t *cf );
48static int cust_text( const char *str, custom_functions_t *cf );
49static int cust_mouse( int type, int button, double x, double y, custom_functions_t *cf );
50static int cust_event_window( SDL_WindowEventID event, Sint32 w, Sint32 h, custom_functions_t *cf );
51
52/* Toolkit methods. */
53static int tkL_isOpen( lua_State *L );
54static int tkL_query( lua_State *L );
55static int tkL_msg( lua_State *L );
56static int tkL_yesno( lua_State *L );
57static int tkL_input( lua_State *L );
58static int tkL_choice( lua_State *L );
59static int tkL_list( lua_State *L );
60static int tkL_merchantOutfit( lua_State *L );
61static int tkL_custom( lua_State *L );
62static int tkL_customRename( lua_State *L );
63static int tkL_customFullscreen( lua_State *L );
64static int tkL_customResize( lua_State *L );
65static int tkL_customSize( lua_State *L );
66static int tkL_customDone( lua_State *L );
67static int tkL_refresh( lua_State *L );
68static const luaL_Reg tkL_methods[] = {
69 { "isOpen", tkL_isOpen },
70 { "query", tkL_query },
71 { "msg", tkL_msg },
72 { "yesno", tkL_yesno },
73 { "input", tkL_input },
74 { "choice", tkL_choice },
75 { "list", tkL_list },
76 { "merchantOutfit", tkL_merchantOutfit },
77 { "custom", tkL_custom },
78 { "customRename", tkL_customRename },
79 { "customFullscreen", tkL_customFullscreen },
80 { "customResize", tkL_customResize },
81 { "customSize", tkL_customSize },
82 { "customDone", tkL_customDone },
83 { "refresh", tkL_refresh },
84 {0,0}
85};
93int nlua_loadTk( nlua_env env )
94{
95 nlua_register(env, "tk", tkL_methods, 0);
96 nlua_loadCol(env);
97 nlua_loadGFX(env);
98 return 0;
99}
100
126static int tkL_isOpen( lua_State *L )
127{
128 lua_pushboolean(L,toolkit_isOpen());
129 return 1;
130}
131
143static int tkL_query( lua_State *L )
144{
145 const char *wdwname, *wgtname;
146 unsigned int wid;
147 int bx, by, x, y, w, h;
148 wdwname = luaL_checkstring( L, 1 );
149 wgtname = luaL_optstring( L, 2, NULL );
150 wid = window_get( wdwname );
151 if (wid == 0)
152 return 0;
153 window_posWindow( wid, &bx, &by );
154 if (wgtname == NULL) {
155 x = bx;
156 y = by;
157 window_dimWindow( wid, &w, &h );
158 }
159 else {
160 window_posWidget( wid, wgtname, &x, &y );
161 window_dimWidget( wid, wgtname, &w, &h );
162 x += bx;
163 y += by;
164 }
165 lua_pushinteger( L, x );
166 lua_pushinteger( L, y );
167 lua_pushinteger( L, w );
168 lua_pushinteger( L, h );
169 return 4;
170}
171
185static int tkL_msg( lua_State *L )
186{
187 /* Get fixed arguments : title, string to display and image filename. */
188 const char *title = luaL_checkstring(L,1);
189 const char *str = luaL_checkstring(L,2);
190
191 if (lua_gettop(L) > 2) {
192 int width, height;
193 const char *img = luaL_checkstring(L,3);
194
195 // Get optional arguments : width and height
196 width = (lua_gettop(L) < 4) ? -1 : luaL_checkinteger(L,4);
197 height = (lua_gettop(L) < 5) ? -1 : luaL_checkinteger(L,5);
198
199 dialogue_msgImgRaw( title, str, img, width, height );
200 return 0;
201 }
202 dialogue_msgRaw( title, str );
203 return 0;
204}
215static int tkL_yesno( lua_State *L )
216{
217 const char *title = luaL_checkstring(L,1);
218 const char *str = luaL_checkstring(L,2);
219
220 int ret = dialogue_YesNoRaw( title, str );
221 lua_pushboolean(L,ret);
222 return 1;
223}
236static int tkL_input( lua_State *L )
237{
238 const char *title, *str;
239 char *ret;
240 int min, max;
241
242 title = luaL_checkstring(L,1);
243 min = luaL_checkint(L,2);
244 max = luaL_checkint(L,3);
245 str = luaL_checkstring(L,4);
246
247 ret = dialogue_inputRaw( title, min, max, str );
248 if (ret != NULL) {
249 lua_pushstring(L, ret);
250 free(ret);
251 }
252 else
253 lua_pushnil(L);
254 return 1;
255}
256
269static int tkL_choice( lua_State *L )
270{
271 int ret, opts;
272 const char *title, *str;
273 char *result;
274
275 /* Handle parameters. */
276 opts = lua_gettop(L) - 2;
277 title = luaL_checkstring(L,1);
278 str = luaL_checkstring(L,2);
279
280 /* Do an initial scan for invalid arguments. */
281 for (int i=0; i<opts; i++)
282 luaL_checkstring(L, i+3);
283
284 /* Create dialogue. */
285 dialogue_makeChoice( title, str, opts );
286 for (int i=0; i<opts; i++)
287 dialogue_addChoice( title, str, luaL_checkstring(L,i+3) );
288 result = dialogue_runChoice();
289 if (result == NULL) /* Something went wrong, return nil. */
290 return 0;
291
292 /* Handle results. */
293 ret = -1;
294 for (int i=0; i<opts && ret==-1; i++) {
295 if (strcmp(result, luaL_checkstring(L,i+3)) == 0)
296 ret = i+1; /* Lua uses 1 as first index. */
297 }
298
299 /* Push parameters. */
300 lua_pushnumber(L,ret);
301 lua_pushstring(L,result);
302
303 /* Clean up. */
304 free(result);
305
306 return 2;
307}
308
321static int tkL_list( lua_State *L )
322{
323 int ret, opts;
324 const char *title, *str;
325 char **choices;
326 NLUA_MIN_ARGS(3);
327
328 /* Handle parameters. */
329 opts = lua_gettop(L) - 2;
330 title = luaL_checkstring(L,1);
331 str = luaL_checkstring(L,2);
332
333 /* Do an initial scan for invalid arguments. */
334 for (int i=0; i<opts; i++)
335 luaL_checkstring(L, i+3);
336
337 /* Will be freed by the toolkit. */
338 choices = malloc( sizeof(char*) * opts );
339 for (int i=0; i<opts; i++)
340 choices[i] = strdup( luaL_checkstring(L, i+3) );
341
342 ret = dialogue_listRaw( title, choices, opts, str );
343
344 /* Cancel returns -1, do nothing. */
345 if (ret == -1)
346 return 0;
347
348 /* Push index and choice string. */
349 lua_pushnumber(L, ret+1);
350 lua_pushstring(L, choices[ret]);
351
352 return 2;
353}
354
366static int tkL_merchantOutfit( lua_State *L )
367{
368 const Outfit **outfits;
369 unsigned int wid;
370 const char *name;
371 int w, h;
372
373 name = luaL_checkstring(L,1);
374
375 if (!lua_istable(L,2))
376 NLUA_INVALID_PARAMETER(L,2);
377
378 outfits = array_create_size( const Outfit*, lua_objlen(L,2) );
379 /* Iterate over table. */
380 lua_pushnil(L);
381 while (lua_next(L, -2) != 0) {
382 array_push_back( &outfits, luaL_validoutfit(L, -1) );
383 lua_pop(L,1);
384 }
385
386 /* Create window. */
387 if (SCREEN_W < LAND_WIDTH || SCREEN_H < LAND_HEIGHT) {
388 w = -1; /* Fullscreen. */
389 h = -1;
390 }
391 else {
392 w = LAND_WIDTH + 0.5 * (SCREEN_W - LAND_WIDTH);
393 h = LAND_HEIGHT + 0.5 * (SCREEN_H - LAND_HEIGHT);
394 }
395 wid = window_create( "wdwMerchantOutfit", name, -1, -1, w, h );
396 outfits_open( wid, outfits, lua_toboolean(L,3) );
397
398 return 0;
399}
400
416static int tkL_custom( lua_State *L )
417{
418 int w = luaL_checkinteger(L, 2);
419 int h = luaL_checkinteger(L, 3);
420 const char *caption = luaL_checkstring(L, 1);
421 custom_functions_t *cf = calloc( 1, sizeof(custom_functions_t) );
422 int nodynamic;
423
424 /* Set up custom function pointers. */
425 cf->L = L;
426#define GETFUNC( address, pos ) \
427do { \
428 lua_pushvalue( L, (pos) ); \
429 luaL_checktype(L, -1, LUA_TFUNCTION); \
430 (address) = luaL_ref(L, LUA_REGISTRYINDEX); \
431} while (0)
432 GETFUNC( cf->update, 4 );
433 GETFUNC( cf->draw, 5 );
434 GETFUNC( cf->keyboard, 6 );
435 GETFUNC( cf->mouse, 7 );
436 GETFUNC( cf->resize, 8 );
437 GETFUNC( cf->textinput, 9 );
438#undef GETFUNC
439 nodynamic = lua_toboolean(L,10);
440
441 /* Set done condition. */
442 lua_pushboolean(L, 0);
443 lua_setglobal(L, TK_CUSTOMDONE );
444
445 /* Create the dialogue. */
446 dialogue_custom( caption, w, h, cust_update, cust_render, cust_event, cf, 1, !nodynamic );
447
448 /* Clean up. */
449 cf->done = 1;
450 luaL_unref(L, LUA_REGISTRYINDEX, cf->update);
451 luaL_unref(L, LUA_REGISTRYINDEX, cf->draw);
452 luaL_unref(L, LUA_REGISTRYINDEX, cf->keyboard);
453 luaL_unref(L, LUA_REGISTRYINDEX, cf->mouse);
454 luaL_unref(L, LUA_REGISTRYINDEX, cf->resize);
455 luaL_unref(L, LUA_REGISTRYINDEX, cf->textinput);
456
457 return 0;
458}
459
466static int tkL_customRename( lua_State *L )
467{
468 const char *s = luaL_checkstring(L,1);
469 unsigned int wid = window_get( "dlgMsg" );
470 if (wid == 0)
471 return NLUA_ERROR(L, _("custom dialogue not open"));
472 window_setDisplayname( wid, s );
473 return 0;
474}
475
482static int tkL_customFullscreen( lua_State *L )
483{
484 int enable = lua_toboolean(L,1);
485 unsigned int wid = window_get( "dlgMsg" );
486 if (wid == 0)
487 return NLUA_ERROR(L, _("custom dialogue not open"));
489 return 0;
490}
491
499static int tkL_customResize( lua_State *L )
500{
501 int w, h;
502 unsigned int wid = window_get( "dlgMsg" );
503 if (wid == 0)
504 return NLUA_ERROR(L, _("custom dialogue not open"));
505 w = luaL_checkinteger(L,1);
506 h = luaL_checkinteger(L,2);
507 dialogue_customResize( w, h );
508 return 0;
509}
510
518static int tkL_customSize( lua_State *L )
519{
520 int w, h;
521 unsigned int wid = window_get( "dlgMsg" );
522 if (wid == 0)
523 return NLUA_ERROR(L, _("custom dialogue not open"));
524 window_dimWindow( wid, &w, &h );
525 lua_pushinteger(L,w);
526 lua_pushinteger(L,h);
527 return 2;
528}
529
534static int tkL_customDone( lua_State *L )
535{
536 unsigned int wid = window_get( "dlgMsg" );
537 if (wid == 0)
538 return NLUA_ERROR(L, _("custom dialogue not open"));
539 lua_pushboolean(L, 1);
540 lua_setglobal(L, TK_CUSTOMDONE );
541 return 0;
542}
543
544static int cust_pcall( lua_State *L, int nargs, int nresults )
545{
546 int errf, ret;
547
548#if DEBUGGING
549 errf = lua_gettop(L) - nargs;
550 lua_pushcfunction(L, nlua_errTrace);
551 lua_insert(L, errf);
552#else /* DEBUGGING */
553 errf = 0;
554#endif /* DEBUGGING */
555
556 ret = lua_pcall( L, nargs, nresults, errf );
557
558#if DEBUGGING
559 lua_remove(L, errf);
560#endif /* DEBUGGING */
561
562 return ret;
563}
564static int cust_update( double dt, void* data )
565{
566 int ret;
568 if (cf->done)
569 return 1; /* Mark done. */
570 lua_State *L = cf->L;
571 lua_rawgeti(L, LUA_REGISTRYINDEX, cf->update);
572 lua_pushnumber(L, dt);
573 if (cust_pcall( L, 1, 0 )) {
574 cf->done = 1;
575 WARN(_("Custom dialogue internal error: %s"), lua_tostring(L,-1));
576 lua_pop(L,1);
577 return 1;
578 }
579 /* Check if done. */
580 lua_getglobal(L, TK_CUSTOMDONE );
581 ret = lua_toboolean(L, -1);
582 lua_pop(L, 1);
583 return ret;
584}
585static void cust_render( double x, double y, double w, double h, void* data )
586{
588 if (cf->done)
589 return;
590 lua_State *L = cf->L;
591 lua_rawgeti(L, LUA_REGISTRYINDEX, cf->draw);
592 lua_pushnumber(L, x);
593 lua_pushnumber(L, y);
594 lua_pushnumber(L, w);
595 lua_pushnumber(L, h);
596 if (cust_pcall( L, 4, 0 )) {
597 cf->done = 1;
598 WARN(_("Custom dialogue internal error: %s"), lua_tostring(L,-1));
599 lua_pop(L,1);
600 }
601}
602static int cust_event( unsigned int wid, SDL_Event *event, void* data )
603{
604 (void) wid;
605 double x, y;
607 if (cf->done)
608 return 0;
609
610 /* Handle all the events. */
611 switch (event->type) {
612 case SDL_MOUSEBUTTONDOWN:
613 x = gl_screen.x;
614 y = gl_screen.y;
615 return cust_mouse( 1, event->button.button, event->button.x+x, event->button.y+y, cf );
616 case SDL_MOUSEBUTTONUP:
617 x = gl_screen.x;
618 y = gl_screen.y;
619 return cust_mouse( 2, event->button.button, event->button.x+x, event->button.y+y, cf );
620 case SDL_MOUSEMOTION:
621 x = gl_screen.x;
622 y = gl_screen.y;
623 return cust_mouse( 3, -1, event->button.x+x, event->button.y+y, cf );
624 case SDL_MOUSEWHEEL:
625 return cust_mouse( 4, -1, event->wheel.x, event->wheel.y, cf );
626
627 case SDL_KEYDOWN:
628 return cust_key( event->key.keysym.sym, event->key.keysym.mod, 1, event->key.repeat, cf );
629 case SDL_KEYUP:
630 return cust_key( event->key.keysym.sym, event->key.keysym.mod, 0, event->key.repeat, cf );
631
632 case SDL_TEXTINPUT:
633 return cust_text( event->text.text, cf );
634
635 case SDL_WINDOWEVENT:
636 return cust_event_window( event->window.event, event->window.data1, event->window.data2, cf );
637
638 default:
639 return 0;
640 }
641
642 return 0;
643}
644static int cust_key( SDL_Keycode key, SDL_Keymod mod, int pressed, int isrepeat, custom_functions_t *cf )
645{
646 int b;
647 lua_State *L = cf->L;
648 lua_rawgeti(L, LUA_REGISTRYINDEX, cf->keyboard);
649 lua_pushboolean(L, pressed);
650 lua_pushstring(L, SDL_GetKeyName(key));
651 lua_pushstring(L, input_modToText(mod));
652 lua_pushboolean(L, isrepeat);
653 if (cust_pcall( L, 4, 1 )) {
654 cf->done = 1;
655 WARN(_("Custom dialogue internal error: %s"), lua_tostring(L,-1));
656 lua_pop(L,1);
657 return 0;
658 }
659 b = lua_toboolean(L, -1);
660 lua_pop(L,1);
661 return b;
662}
663static int cust_text( const char *str, custom_functions_t *cf )
664{
665 int b;
666 lua_State *L = cf->L;
667 lua_rawgeti(L, LUA_REGISTRYINDEX, cf->textinput);
668 lua_pushstring(L, str);
669 if (cust_pcall( L, 1, 1 )) {
670 cf->done = 1;
671 WARN(_("Custom dialogue internal error: %s"), lua_tostring(L,-1));
672 lua_pop(L,1);
673 return 0;
674 }
675 b = lua_toboolean(L, -1);
676 lua_pop(L,1);
677 return b;
678}
679static int cust_mouse( int type, int button, double x, double y, custom_functions_t *cf )
680{
681 int b, nargs = 3;
682 lua_State *L = cf->L;
683 lua_rawgeti(L, LUA_REGISTRYINDEX, cf->mouse);
684 lua_pushnumber(L, x);
685 lua_pushnumber(L, y);
686 lua_pushnumber(L, type);
687 if (type < 3) {
688 switch (button) {
689 case SDL_BUTTON_LEFT: button=1; break;
690 case SDL_BUTTON_RIGHT: button=2; break;
691 default: button=3; break;
692 }
693 lua_pushnumber(L, button);
694 nargs++;
695 }
696 if (cust_pcall( L, nargs, 1 )) {
697 cf->done = 1;
698 WARN(_("Custom dialogue internal error: %s"), lua_tostring(L,-1));
699 lua_pop(L,1);
700 return 0;
701 }
702 b = lua_toboolean(L, -1);
703 lua_pop(L,1);
704 return b;
705}
706static int cust_event_window( SDL_WindowEventID event, Sint32 w, Sint32 h, custom_functions_t *cf )
707{
708 int b;
709 lua_State *L = cf->L;
710
711 if (event == SDL_WINDOWEVENT_RESIZED)
712 return 1;
713
714 lua_rawgeti(L, LUA_REGISTRYINDEX, cf->resize);
715 lua_pushinteger(L, w );
716 lua_pushinteger(L, h );
717 if (cust_pcall( L, 2, 1 )) {
718 cf->done = 1;
719 WARN(_("Custom dialogue internal error: %s"), lua_tostring(L,-1));
720 lua_pop(L,1);
721 return 0;
722 }
723 b = lua_toboolean(L, -1);
724 lua_pop(L,1);
725 return b;
726}
727
731static int tkL_refresh( lua_State *L )
732{
733 (void) L;
735 return 0;
736}
Provides macros to work with dynamic arrays.
#define array_create_size(basic_type, capacity)
Creates a new dynamic array of ‘basic_type’ with an initial capacity.
Definition array.h:102
#define array_push_back(ptr_array, element)
Adds a new element at the end of the array.
Definition array.h:129
char * dialogue_runChoice(void)
Run the dialog and return the clicked string.
Definition dialogue.c:795
char * dialogue_inputRaw(const char *title, int min, int max, const char *msg)
Creates a dialogue that allows the player to write a message.
Definition dialogue.c:469
void dialogue_custom(const char *caption, int width, int height, int(*update)(double dt, void *data), void(*render)(double x, double y, double w, double h, void *data), int(*event)(unsigned int wid, SDL_Event *event, void *data), void *data, int autofree, int dynamic)
Opens a custom dialogue window.
Definition dialogue.c:867
int dialogue_listRaw(const char *title, char **items, int nitems, const char *msg)
Creates a list dialogue with OK and Cancel button.
Definition dialogue.c:603
int dialogue_YesNoRaw(const char *caption, const char *msg)
Runs a dialogue with both yes and no options.
Definition dialogue.c:373
void dialogue_addChoice(const char *caption, const char *msg, const char *opt)
Add a choice to the dialog.
Definition dialogue.c:773
int dialogue_customResize(int width, int height)
Resizes a custom dialogue.
Definition dialogue.c:969
void dialogue_msgImgRaw(const char *caption, const char *msg, const char *img, int width, int height)
Opens a dialogue window with an ok button, a fixed message and an image.
Definition dialogue.c:298
void dialogue_makeChoice(const char *caption, const char *msg, int opts)
Create the choice dialog. Need to add choices with below method.
Definition dialogue.c:751
void dialogue_msgRaw(const char *caption, const char *msg)
Opens a dialogue window with an ok button and a fixed message.
Definition dialogue.c:271
int dialogue_customFullscreen(int enable)
Converts a custom dialogue to fullscreen.
Definition dialogue.c:932
const char * input_modToText(SDL_Keymod mod)
Gets the human readable version of mod.
Definition input.c:516
void outfits_open(unsigned int wid, const Outfit **outfits, int blackmarket)
Opens the outfit exchange center window.
Header file with generic functions and naev-specifics.
int nlua_errTrace(lua_State *L)
Gets a trace from Lua.
Definition nlua.c:830
int nlua_loadCol(nlua_env env)
Loads the colour library.
Definition nlua_colour.c:54
int nlua_loadGFX(nlua_env env)
Loads the graphics library.
Definition nlua_gfx.c:98
const Outfit * luaL_validoutfit(lua_State *L, int ind)
Makes sure the outfit is valid or raises a Lua error.
static int tkL_customSize(lua_State *L)
Gets the size of a custom widget.
Definition nlua_tk.c:518
static int tkL_customRename(lua_State *L)
Renames the custom widget window.
Definition nlua_tk.c:466
static int tkL_isOpen(lua_State *L)
Bindings for interacting with the Toolkit.
Definition nlua_tk.c:126
static const luaL_Reg tkL_methods[]
Definition nlua_tk.c:68
static int tkL_msg(lua_State *L)
Creates a window with an ok button, and optionally an image.
Definition nlua_tk.c:185
int nlua_loadTk(nlua_env env)
Loads the Toolkit Lua library.
Definition nlua_tk.c:93
static int tkL_input(lua_State *L)
Creates a window that allows player to write text input.
Definition nlua_tk.c:236
static int tkL_choice(lua_State *L)
Creates a window with a number of selectable options.
Definition nlua_tk.c:269
static int tkL_refresh(lua_State *L)
Forces the toolkit to rerender the screen.
Definition nlua_tk.c:731
static int tkL_query(lua_State *L)
Gets the position and dimensions of either a window or a widget.
Definition nlua_tk.c:143
static int tkL_yesno(lua_State *L)
Displays a window with Yes and No buttons.
Definition nlua_tk.c:215
static int tkL_customFullscreen(lua_State *L)
Sets the custom widget fullscreen.
Definition nlua_tk.c:482
static int tkL_list(lua_State *L)
Creates a window with an embedded list of choices.
Definition nlua_tk.c:321
static int tkL_customDone(lua_State *L)
Ends the execution of a custom widget.
Definition nlua_tk.c:534
static int tkL_customResize(lua_State *L)
Sets the custom widget fullscreen.
Definition nlua_tk.c:499
static int tkL_merchantOutfit(lua_State *L)
Opens an outfit merchant window.
Definition nlua_tk.c:366
static int tkL_custom(lua_State *L)
Creates a custom widget window.
Definition nlua_tk.c:416
glInfo gl_screen
Definition opengl.c:51
A ship outfit, depends radically on the type.
Definition outfit.h:328
lua_State * L
Definition nlua_tk.c:34
int y
Definition opengl.h:42
int x
Definition opengl.h:41
unsigned int window_create(const char *name, const char *displayname, const int x, const int y, const int w, const int h)
Creates a window.
Definition toolkit.c:691
void window_dimWidget(unsigned int wid, const char *name, int *w, int *h)
Gets the dimensions of a widget.
Definition toolkit.c:416
void window_dimWindow(unsigned int wid, int *w, int *h)
Gets the dimensions of a window.
Definition toolkit.c:371
int toolkit_isOpen(void)
Checks to see if the toolkit is open.
Definition toolkit.c:94
void window_posWidget(unsigned int wid, const char *name, int *x, int *y)
Gets a widget's position.
Definition toolkit.c:442
unsigned int window_get(const char *wdwname)
Gets the ID of a window.
Definition toolkit.c:666
void toolkit_rerender(void)
Marks the toolkit for needing a full rerender.
Definition toolkit.c:1661
void window_posWindow(unsigned int wid, int *x, int *y)
Gets the dimensions of a window.
Definition toolkit.c:393
int window_setDisplayname(unsigned int wid, const char *displayname)
Sets the displayname of a window.
Definition toolkit.c:629