21#include "tk/toolkit_priv.h"
23#define INPUT_DELAY conf.repeat_delay
24#define INPUT_FREQ conf.repeat_freq
74 int x,
int y,
int rx,
int ry );
76static int toolkit_textEvent( Window *wdw, SDL_Event *event );
96 for ( Window *wdw =
windows; wdw != NULL; wdw = wdw->next )
97 if ( !window_isFlag( wdw, WINDOW_KILL | WINDOW_NORENDER ) )
122 wgt->x = wdw->w - wgt->w + x;
128 wgt->y = wdw->h - wgt->h + y;
145 window_rmFlag( wdw, WINDOW_CENTERX );
146 window_rmFlag( wdw, WINDOW_CENTERY );
152 window_setFlag( wdw, WINDOW_CENTERX );
154 wdw->x =
gl_screen.nw - wdw->w + (double)x;
162 window_setFlag( wdw, WINDOW_CENTERY );
164 wdw->y =
gl_screen.nh - wdw->h + (double)y;
200 wdw->w = ( w == -1 ) ?
gl_screen.nw : (double)w;
201 wdw->h = ( h == -1 ) ?
gl_screen.nh : (double)h;
202 if ( ( w == -1 ) && ( h == -1 ) ) {
203 window_setFlag( wdw, WINDOW_FULLSCREEN );
206 window_setFlag( wdw, WINDOW_CENTERX );
207 window_setFlag( wdw, WINDOW_CENTERY );
209 window_rmFlag( wdw, WINDOW_FULLSCREEN );
210 if ( window_isFlag( wdw, WINDOW_CENTERX ) &&
211 window_isFlag( wdw, WINDOW_CENTERY ) )
225 Widget *wgt, *wlast, *wtmp;
226 char *saved_name = NULL;
234 for ( wgt = w->widgets; wgt != NULL; wgt = wgt->next ) {
237 if ( strcmp( name, wgt->name ) != 0 ) {
243 if ( !wgt_isFlag( wgt, WGT_FLAG_KILL ) ) {
244 WARN( _(
"Trying to create widget '%s' over existing one that hasn't "
252 w->widgets = wgt->next;
254 wlast->next = wgt->next;
257 saved_name = wgt->name;
265 wgt = nmalloc(
sizeof( Widget ) );
268 memset( wgt, 0,
sizeof( Widget ) );
269 wgt->type = WIDGET_NULL;
270 wgt->status = WIDGET_STATUS_NORMAL;
274 wgt->name = saved_name;
276 wgt->name = strdup( name );
277 wgt->id = ++w->idgen;
281 for ( wtmp = w->widgets; wtmp != NULL; wtmp = wtmp->next )
301 WARN( _(
"Window '%u' not found in list!" ), wid );
306 WARN( _(
"Window '%u' not found in list!" ), wid );
318 for ( Window *w =
windows; w != NULL; w = w->next )
332 for ( Window *w =
windows; w != NULL; w = w->next )
333 if ( strcmp( w->name, name ) == 0 )
350 WARN( _(
"Widget '%s' not found in window '%u'!" ), name, wid );
355 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next )
356 if ( strcmp( wgt->name, name ) == 0 )
359 WARN( _(
"Widget '%s' not found in window '%u'!" ), name, wid );
534 wgt_setFlag( wgt, WGT_FLAG_CANFOCUS );
536 wgt_rmFlag( wgt, WGT_FLAG_CANFOCUS );
550 while ( n != NULL ) {
551 if ( !window_isFlag( n, WINDOW_KILL | WINDOW_NORENDER ) )
573 for ( Widget *w = wgt->next; w != NULL; w = w->next ) {
574 if ( ( wgt->render == NULL ) || wgt_isFlag( w, WGT_FLAG_KILL ) )
579 if ( !( ( rx < 0 ) || ( rx >= w->w ) || ( ry < 0 ) || ( ry >= w->h ) ) )
595 for ( Window *w =
windows; w != NULL; w = w->next )
596 if ( ( strcmp( w->name, wdwname ) == 0 ) &&
597 !window_isFlag( w, WINDOW_KILL ) )
610 if ( (
windows == NULL ) || ( wid == 0 ) )
612 for ( Window *w =
windows; w != NULL; w = w->next )
613 if ( ( w->id == wid ) && !window_isFlag( w, WINDOW_KILL ) )
630 free( wdw->displayname );
631 wdw->displayname = NULL;
632 if ( displayname != NULL )
633 wdw->displayname = strdup( displayname );
649 wdw->flags |= WINDOW_DYNAMIC;
651 wdw->flags &= ~WINDOW_DYNAMIC;
668 for ( Window *w =
windows; w != NULL; w = w->next )
669 if ( ( strcmp( w->name, wdwname ) == 0 ) &&
670 !window_isFlag( w, WINDOW_KILL ) )
689 const int x,
const int y,
const int w,
const int h )
707 const int x,
const int y,
const int w,
708 const int h,
unsigned int flags )
710 Window *wdw = ncalloc( 1,
sizeof( Window ) );
712 const int wid = ( ++
genwid );
716 wdw->name = strdup( name );
717 wdw->displayname = strdup( displayname );
725 wdw->exposed = !window_isFlag( wdw, WINDOW_NOFOCUS );
728 wdw->w = ( w == -1 ) ?
gl_screen.nw : (double)w;
729 wdw->h = ( h == -1 ) ?
gl_screen.nh : (double)h;
730 if ( ( w == -1 ) && ( h == -1 ) ) {
731 window_setFlag( wdw, WINDOW_FULLSCREEN );
753 if ( wdw->exposed ) {
761 if ( ( strcmp( wlast->name, name ) == 0 ) &&
762 !window_isFlag( wlast, WINDOW_KILL ) &&
763 !window_isFlag( wlast, WINDOW_NOFOCUS ) )
764 WARN( _(
"Window with name '%s' already exists!" ), wlast->name );
766 if ( wlast->next == NULL )
795 wdw->parent = parent;
825 void ( *fptr )(
unsigned int,
const char * ) )
833 wdw->close_fptr = fptr;
847 void ( *accept )(
unsigned int,
const char * ) )
855 wdw->accept_fptr = accept;
869 void ( *cancel )(
unsigned int,
const char * ) )
877 wdw->cancel_fptr = cancel;
897 wdw->focus_fptr = focus;
950 window_rmFlag( wdw, WINDOW_NOBORDER );
952 window_setFlag( wdw, WINDOW_NOBORDER );
962 int ( *keyhandler )(
unsigned int, SDL_Keycode,
971 wdw->keyevent = keyhandler;
980 int ( *eventhandler )(
unsigned int, SDL_Event * ) )
988 wdw->eventevent = eventhandler;
999 if ( widget->cleanup != NULL )
1000 widget->cleanup( widget );
1003 free( widget->name );
1006void widget_setStatus( Widget *wgt, WidgetStatus sts )
1008 if ( wgt->status != sts )
1018 for ( Window *w =
windows; w != NULL; w = w->next )
1044 for ( Window *wdw =
windows; wdw != NULL; wdw = wdw->next ) {
1048 if ( wdw->id != wid )
1052 if ( window_isFlag( wdw, WINDOW_KILL ) )
1056 for ( Window *w =
windows; w != NULL; w = w->next )
1057 if ( w->parent == wid )
1062 window_setFlag( wdw, WINDOW_KILL );
1069 if ( wactive == NULL )
1077 for ( Window *w =
windows; w != NULL; w = w->next ) {
1078 if ( !window_isFlag( w, WINDOW_KILL ) && ( w->focus_fptr != NULL ) )
1079 w->focus_fptr( w->id );
1090 for ( Window *w =
windows; w != NULL; w = w->next )
1091 if ( w->parent == wdw->id )
1094 window_setFlag( wdw, WINDOW_KILL );
1107 if ( wdw->close_fptr != NULL )
1108 wdw->close_fptr( wdw->id, wdw->name );
1109 wdw->close_fptr = NULL;
1124 free( wdw->displayname );
1126 while ( wgt != NULL ) {
1127 Widget *wgtkill = wgt;
1128 wgt = wgtkill->next;
1149 WARN( _(
"window '%d' does not exist" ), wid );
1154 for ( Widget *wgt = w->widgets; wgt != NULL; wgt = wgt->next )
1155 if ( strcmp( wgtname, wgt->name ) == 0 )
1156 return !wgt_isFlag( wgt, WGT_FLAG_KILL );
1178 for ( wgt = wdw->widgets; wgt != NULL; wgt = wgt->next )
1179 if ( strcmp( wgt->name, wgtname ) == 0 )
1182 if ( wgt == NULL ) {
1183 WARN( _(
"Widget '%s' not found in window '%s'" ), wgtname,
1191 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
1192 wgt_setFlag( wgt, WGT_FLAG_KILL );
1195void window_clearWidgets(
unsigned int wid )
1206 for ( wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
1210 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
1211 wgt_setFlag( wgt, WGT_FLAG_KILL );
1240 const glColour *
c,
const glColour *lc )
1243 glColour colours[10];
1246 w += 2 * ( b - thick );
1248 h += 2 * ( b - thick );
1254 tri[0][2] = x - thick;
1255 tri[0][3] = y - thick;
1262 tri[1][2] = x - thick;
1263 tri[1][3] = y + h + thick;
1270 tri[2][2] = x + w + thick;
1271 tri[2][3] = y + h + thick;
1278 tri[3][2] = x + w + thick;
1279 tri[3][3] = y - thick;
1286 tri[4][2] = x - thick;
1287 tri[4][3] = y - thick;
1296 gl_beginSmoothProgram( gl_view_matrix );
1301 glDrawArrays( GL_TRIANGLE_STRIP, 0, 10 );
1302 gl_endSmoothProgram();
1319 const glColour *lc )
1321 GLshort lines[4][2];
1322 glColour colours[4];
1334 lines[1][1] = y + h;
1337 lines[2][0] = x + w;
1338 lines[2][1] = y + h;
1341 lines[3][0] = x + w;
1350 gl_beginSmoothProgram( gl_view_matrix );
1355 glDrawArrays( GL_LINE_LOOP, 0, 4 );
1356 gl_endSmoothProgram();
1371 const glColour *lc )
1373 GLshort vertex[4][2];
1374 glColour colours[4];
1376 lc = lc == NULL ?
c : lc;
1384 vertex[1][1] = y + h;
1387 vertex[2][0] = x + w;
1391 vertex[3][0] = x + w;
1392 vertex[3][1] = y + h;
1400 gl_beginSmoothProgram( gl_view_matrix );
1405 glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
1406 gl_endSmoothProgram();
1423 GLshort vertex[3][2];
1424 glColour colours[3];
1444 gl_beginSmoothProgram( gl_view_matrix );
1449 glDrawArrays( GL_TRIANGLE_STRIP, 0, 3 );
1450 gl_endSmoothProgram();
1468 glClear( GL_DEPTH_BUFFER_BIT );
1511 if ( window_isFlag( w, WINDOW_FULLSCREEN ) ) {
1541 glClear( GL_DEPTH_BUFFER_BIT );
1544 if ( !window_isFlag( w, WINDOW_NOBORDER ) )
1548 for ( Widget *wgt = w->widgets; wgt != NULL; wgt = wgt->next ) {
1549 if ( wgt->render == NULL )
1551 if ( wgt_isFlag( wgt, WGT_FLAG_KILL ) )
1555 if ( !wgt_isFlag( wgt, WGT_FLAG_DYNAMIC ) || !top )
1556 wgt->render( wgt, w->x, w->y );
1558 if ( wgt->id == w->focus ) {
1559 double wx = w->x + wgt->x - 2;
1560 double wy = w->y + wgt->y - 2;
1562 wx, wy, wgt->w + 4, wgt->h + 4, 0, 2,
1563 ( wgt->type == WIDGET_BUTTON ? &cGrey70 : &cGrey30 ), NULL );
1574 for ( Widget *wgt = w->widgets; wgt != NULL; wgt = wgt->next ) {
1575 if ( wgt->render == NULL )
1577 if ( wgt_isFlag( wgt, WGT_FLAG_KILL ) )
1579 if ( wgt_isFlag( wgt, WGT_FLAG_DYNAMIC ) ||
1580 window_isFlag( w, WINDOW_DYNAMIC ) )
1581 wgt->render( wgt, w->x, w->y );
1582 if ( wgt->renderDynamic != NULL )
1583 wgt->renderDynamic( wgt, w->x, w->y );
1595 for ( Widget *wgt = w->widgets; wgt != NULL; wgt = wgt->next )
1596 if ( ( wgt->renderOverlay != NULL ) && !wgt_isFlag( wgt, WGT_FLAG_KILL ) )
1597 wgt->renderOverlay( wgt, w->x, w->y );
1617 sy = y + ( h - 30. ) * ( 1. - pos );
1630 NTracingZone( _ctx, 1 );
1633 GLuint current_fbo =
gl_screen.current_fbo;
1637 glBindFramebuffer( GL_FRAMEBUFFER,
gl_screen.current_fbo );
1638 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
1641 for ( Window *w =
windows; w != NULL; w = w->next ) {
1642 if ( window_isFlag( w, WINDOW_NORENDER | WINDOW_KILL ) )
1644 if ( ( w == top ) && window_isFlag( w, WINDOW_DYNAMIC ) )
1652 glBindFramebuffer( GL_FRAMEBUFFER,
gl_screen.current_fbo );
1663 if ( ( top != NULL ) &&
1664 !window_isFlag( top, WINDOW_NORENDER | WINDOW_KILL ) ) {
1669 NTracingZoneEnd( _ctx );
1705 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
1706 if ( !wgt_isFlag( wgt, WGT_FLAG_RAWINPUT ) )
1708 if ( wgt->rawevent == NULL )
1710 ret = wgt->rawevent( wgt, event );
1718 if ( wdw->eventevent != NULL ) {
1719 ret = wdw->eventevent( wdw->id, event );
1728 if ( !window_isFlag( wdw, WINDOW_KILL ) ) {
1730 switch ( event->type ) {
1731 case SDL_MOUSEMOTION:
1732 case SDL_MOUSEBUTTONDOWN:
1733 case SDL_MOUSEBUTTONUP:
1734 case SDL_MOUSEWHEEL:
1744 ret |= toolkit_textEvent( wdw, event );
1746 case SDL_TEXTEDITING:
1777 int *y,
int *rx,
int *ry )
1780 if ( event->type == SDL_MOUSEMOTION ) {
1781 *x =
event->motion.x;
1782 *y =
event->motion.y;
1783 }
else if ( ( event->type == SDL_MOUSEBUTTONDOWN ) ||
1784 ( event->type == SDL_MOUSEBUTTONUP ) ) {
1785 *x =
event->button.x;
1786 *y =
event->button.y;
1787 }
else if ( event->type == SDL_MOUSEWHEEL )
1788 SDL_GetMouseState( x, y );
1798 if ( event->type == SDL_MOUSEMOTION ) {
1799 *ry = (double)event->motion.yrel *
gl_screen.mxscale;
1800 *rx = (double)event->motion.xrel *
gl_screen.myscale;
1809static int toolkit_mouseEventSingle( Window *w, SDL_Event *event, Widget *wgt,
1810 int x,
int y,
int rx,
int ry )
1814 if ( wgt->type == WIDGET_CUST ) {
1815 if ( wgt->dat.cst.mouse )
1816 ret = wgt->dat.cst.mouse( w->id, event, x - wgt->x, y - wgt->y, wgt->w,
1817 wgt->h, rx, ry, wgt->dat.cst.userdata );
1822static int toolkit_mouseEventReverse( Window *w, SDL_Event *event, Widget *wgt,
1823 int x,
int y,
int rx,
int ry )
1825 if ( wgt->next != NULL ) {
1826 int ret = toolkit_mouseEventReverse( w, event, wgt->next, x, y, rx, ry );
1831 return toolkit_mouseEventSingle( w, event, wgt, x, y, rx, ry );
1847 if ( w->widgets != NULL )
1848 return toolkit_mouseEventReverse( w, event, w->widgets, x, y, rx, ry );
1864 int x,
int y,
int rx,
int ry )
1874 if ( event->type == SDL_MOUSEMOTION )
1875 button =
event->motion.state;
1877 button =
event->button.button;
1880 inbounds = !( ( x < 0 ) || ( x >= wgt->w ) || ( y < 0 ) || ( y >= wgt->h ) );
1884 switch ( event->type ) {
1885 case SDL_MOUSEMOTION:
1889 if ( wgt->status != WIDGET_STATUS_SCROLLING ) {
1891 if ( wgt->status != WIDGET_STATUS_MOUSEDOWN )
1892 widget_setStatus( wgt, WIDGET_STATUS_MOUSEOVER );
1894 widget_setStatus( wgt, WIDGET_STATUS_NORMAL );
1899 if ( wgt_isFlag( wgt, WGT_FLAG_ALWAYSMMOVE ) )
1903 if ( inbounds && ( wgt->mmoveevent != NULL ) )
1904 ret |= ( *wgt->mmoveevent )( wgt, x, y, rx, ry );
1908 case SDL_MOUSEWHEEL:
1913 if ( wgt->mwheelevent != NULL )
1914 ret |= ( *wgt->mwheelevent )( wgt, event->wheel );
1920 case SDL_MOUSEBUTTONDOWN:
1925 if ( button == SDL_BUTTON_LEFT )
1926 widget_setStatus( wgt, WIDGET_STATUS_MOUSEDOWN );
1934 if ( wgt->mdoubleclickevent != NULL &&
1936 ret |= ( *wgt->mdoubleclickevent )( wgt, button, x, y );
1937 else if ( wgt->mclickevent != NULL )
1938 ret |= ( *wgt->mclickevent )( wgt, button, x, y );
1945 case SDL_MOUSEBUTTONUP:
1948 if ( button != SDL_BUTTON_LEFT )
1951 if ( wgt->status == WIDGET_STATUS_MOUSEDOWN ) {
1953 if ( ( wgt->type == WIDGET_BUTTON ) &&
1954 ( ( wgt->dat.btn.disabled == 0 ) ||
1955 ( wgt->dat.btn.softdisable ) ) ) {
1956 if ( wgt->dat.btn.fptr == NULL )
1957 DEBUG( _(
"Toolkit: Button '%s' of Window '%s' "
1958 "doesn't have a function trigger" ),
1959 wgt->name, w->displayname );
1961 ( *wgt->dat.btn.fptr )( w->id, wgt->name );
1969 if ( ( wgt->status == WIDGET_STATUS_SCROLLING ) &&
1970 ( wgt->scrolldone != NULL ) )
1971 wgt->scrolldone( wgt );
1975 widget_setStatus( wgt, WIDGET_STATUS_MOUSEOVER );
1977 widget_setStatus( wgt, WIDGET_STATUS_NORMAL );
2070 key =
event->key.keysym.sym;
2071 mod =
event->key.keysym.mod;
2072 rep =
event->key.repeat;
2075 if ( event->type == SDL_KEYDOWN )
2077 else if ( event->type == SDL_KEYUP )
2088 if ( event->type != SDL_KEYDOWN )
2092 if ( wgt != NULL ) {
2093 if ( wgt->keyevent != NULL ) {
2103 for ( wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
2104 if ( ( wgt->type == WIDGET_BUTTON ) &&
2105 ( wgt->dat.btn.key ==
input_key ) && wgt->keyevent != NULL ) {
2106 ret = wgt->keyevent( wgt, SDLK_RETURN,
input_mod, rep );
2117 if ( wdw->accept_fptr != NULL ) {
2118 wdw->accept_fptr( wdw->id, wdw->name );
2124 if ( wdw->cancel_fptr != NULL ) {
2125 wdw->cancel_fptr( wdw->id, wdw->name );
2137 if ( wdw->keyevent != NULL ) {
2144 if ( key == SDLK_TAB ) {
2145 if ( mod & ( KMOD_LSHIFT | KMOD_RSHIFT ) )
2154static int toolkit_textEvent( Window *wdw, SDL_Event *event )
2166 if ( ( wgt != NULL ) && ( wgt->textevent != NULL ) ) {
2167 int ret = ( *wgt->textevent )( wgt, event->text.text );
2180 Window *wdw, *wlast;
2189 while ( wdw != NULL ) {
2190 if ( window_isFlag( wdw, WINDOW_KILL ) ) {
2192 Window *wkill = wdw;
2196 if ( wlast == NULL )
2199 wlast->next = wdw->next;
2205 Widget *wgtlast = NULL;
2206 Widget *wgt = wdw->widgets;
2207 while ( wgt != NULL ) {
2208 if ( wgt_isFlag( wgt, WGT_FLAG_KILL ) ) {
2210 Widget *wgtkill = wgt;
2212 if ( wgtlast == NULL )
2213 wdw->widgets = wgt->next;
2215 wgtlast->next = wgt->next;
2218 wgtkill->next = NULL;
2268 if ( expose == wdw->exposed )
2271 wdw->exposed = expose;
2278 if ( wdw->focus != -1 )
2282 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next )
2283 if ( wgt->exposeevent != NULL )
2284 wgt->exposeevent( wgt, expose );
2292 if ( wdw->focus == -1 )
2295 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next )
2306 int focus = wdw->focus;
2316 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
2317 if ( focus == wgt->id ) {
2340 next = ( wdw->focus == -1 );
2341 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
2348 }
else if ( wdw->focus == wgt->id ) {
2365 int focus = wdw->focus;
2372 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next ) {
2377 if ( focus == wgt->id ) {
2403 wdw->focus = wgt->id;
2404 wgt_setFlag( wgt, WGT_FLAG_FOCUSED );
2405 if ( wgt->focusGain != NULL )
2406 wgt->focusGain( wgt );
2417 if ( wdw->focus != wgt->id || !wgt_isFlag( wgt, WGT_FLAG_FOCUSED ) )
2421 wgt_rmFlag( wgt, WGT_FLAG_FOCUSED );
2422 if ( wgt->focusLose != NULL )
2423 wgt->focusLose( wgt );
2439 return wgt_isFlag( wgt, WGT_FLAG_CANFOCUS );
2450 Window *wlast = NULL;
2451 for ( Window *wdw =
windows; wdw != NULL; wdw = wdw->next )
2452 if ( !window_isFlag( wdw, WINDOW_NOFOCUS ) &&
2453 !window_isFlag( wdw, WINDOW_KILL ) )
2467 if ( wdw->focus == -1 )
2471 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next )
2472 if ( wdw->focus == wgt->id )
2501 wgt = wgtname == NULL ? NULL :
window_getwgt( wid, wgtname );
2522 for ( Widget *wgt = wdw->widgets; wgt != NULL; wgt = wgt->next )
2523 if ( wgt->id == wdw->focus )
2524 return strdup( wgt->name );
2536 Window *wdw, *wtmp, *wprev, *wlast;
2541 if ( wdw == NULL || wdw->next == NULL )
2547 for ( wtmp =
windows; wtmp != NULL; wtmp = wtmp->next )
2548 if ( wtmp->next == wdw )
2550 else if ( wtmp->next == NULL )
2553 if ( wprev != NULL )
2554 wprev->next = wdw->next;
2556 if ( wlast != NULL )
2564 if ( wtmp == NULL || wtmp == wdw )
2579 Window *wdw, *wtmp, *wprev;
2584 if ( wdw == NULL || wdw ==
windows )
2588 for ( wtmp =
windows; wtmp != NULL; wtmp = wtmp->next )
2589 if ( wtmp->next == wdw )
2592 if ( wprev != NULL )
2593 wprev->next = wdw->next;
2601 if ( wtmp == NULL || wtmp == wdw )
2614 for ( Window *w =
windows; w != NULL; w = w->next ) {
2619 if ( window_isFlag( w, WINDOW_FULLSCREEN ) ) {
2626 if ( w->xrel == -1. && w->yrel == -1. )
2632 if ( w->xrel != -1. ) {
2634 w->x = (
gl_screen.nw - w->w ) * w->xrel;
2635 xdiff = w->x - xorig;
2638 if ( w->yrel != -1. ) {
2640 w->y = (
gl_screen.nh - w->h ) * w->yrel;
2641 ydiff = w->y - yorig;
2645 for ( Widget *wgt = w->widgets; wgt != NULL; wgt = wgt->next ) {
2646 if ( wgt->type != WIDGET_TABBEDWINDOW )
2649 for (
int i = 0; i < wgt->dat.tab.ntabs; i++ ) {
2650 Window *wtmp =
window_wget( wgt->dat.tab.windows[i] );
2670 size = (
sizeof( GLshort ) * 2 +
sizeof( GLfloat ) * 4 ) * 31;
int dialogue_isOpen(void)
Checks to see if a dialogue is open.
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
int gl_printWidthRaw(const glFont *ft_font, const char *text)
Gets the width that it would take to print some text.
int gl_printMidRaw(const glFont *ft_font, int width, double x, double y, const glColour *c, double outlineR, const char *text)
Displays text centered in position and width.
int gl_printTextRaw(const glFont *ft_font, const int width, const int height, double bx, double by, int line_height, const glColour *c, double outlineR, const char *text)
Prints a block of text that fits in the dimensions given.
mat4 mat4_identity(void)
Creates an identity matrix.
mat4 mat4_ortho(double left, double right, double bottom, double top, double nearVal, double farVal)
Creates an orthographic projection matrix.
Header file with generic functions and naev-specifics.
void gl_defViewport(void)
Resets viewport to default.
void gl_windowToScreenPos(int *sx, int *sy, int wx, int wy)
Translates the window position to screen position.
void gl_renderTextureRawH(GLuint texture, const mat4 *projection, const mat4 *tex_mat, const glColour *c)
Texture blitting backend.
void gl_vboDestroy(gl_vbo *vbo)
Destroys a VBO.
gl_vbo * gl_vboCreateStream(GLsizei size, const void *data)
Creates a stream vbo.
void gl_vboActivateAttribOffset(gl_vbo *vbo, GLuint index, GLuint offset, GLint size, GLenum type, GLsizei stride)
Activates a VBO's offset.
void gl_vboSubData(gl_vbo *vbo, GLint offset, GLsizei size, const void *data)
Loads some data into the VBO.
void pause_game(void)
Pauses the game.
void unpause_game(void)
Unpauses the game.