#include "ui_local.h"
Include dependency graph for ui_qmenu.c:

Go to the source code of this file.
|
|
Definition at line 391 of file ui_qmenu.c. References a, BIGCHAR_WIDTH, _tag_menuframework::cursor, menucommon_s::flags, menuaction_s::generic, menucommon_s::menuPosition, menucommon_s::name, menucommon_s::parent, UI_BLINK, UI_DrawChar(), UI_DrawString(), UI_LEFT, menucommon_s::x, x, menucommon_s::y, and y. Referenced by Menu_Draw(). 00392 {
00393 int x, y;
00394 int style;
00395 float* color;
00396
00397 style = 0;
00398 color = menu_text_color;
00399 if ( a->generic.flags & QMF_GRAYED )
00400 {
00401 color = text_color_disabled;
00402 }
00403 else if (( a->generic.flags & QMF_PULSEIFFOCUS ) && ( a->generic.parent->cursor == a->generic.menuPosition ))
00404 {
00405 color = text_color_highlight;
00406 style = UI_PULSE;
00407 }
00408 else if (( a->generic.flags & QMF_HIGHLIGHT_IF_FOCUS ) && ( a->generic.parent->cursor == a->generic.menuPosition ))
00409 {
00410 color = text_color_highlight;
00411 }
00412 else if ( a->generic.flags & QMF_BLINK )
00413 {
00414 style = UI_BLINK;
00415 color = text_color_highlight;
00416 }
00417
00418 x = a->generic.x;
00419 y = a->generic.y;
00420
00421 UI_DrawString( x, y, a->generic.name, UI_LEFT|style, color );
00422
00423 if ( a->generic.parent->cursor == a->generic.menuPosition )
00424 {
00425 // draw cursor
00426 UI_DrawChar( x - BIGCHAR_WIDTH, y, 13, UI_LEFT|UI_BLINK, color);
00427 }
00428 }
|
Here is the call graph for this function:

|
|
Definition at line 369 of file ui_qmenu.c. References a, menucommon_s::bottom, menuaction_s::generic, menucommon_s::left, menucommon_s::name, menucommon_s::right, strlen(), menucommon_s::top, menucommon_s::x, and menucommon_s::y. Referenced by Menu_AddItem(). 00370 {
00371 int len;
00372
00373 // calculate bounds
00374 if (a->generic.name)
00375 len = strlen(a->generic.name);
00376 else
00377 len = 0;
00378
00379 // left justify text
00380 a->generic.left = a->generic.x;
00381 a->generic.right = a->generic.x + len*BIGCHAR_WIDTH;
00382 a->generic.top = a->generic.y;
00383 a->generic.bottom = a->generic.y + BIGCHAR_HEIGHT;
00384 }
|
Here is the call graph for this function:

|
|
Definition at line 282 of file ui_qmenu.c. References b, colorMdGrey, menubitmap_s::errorpic, menucommon_s::flags, menubitmap_s::focuscolor, menubitmap_s::focuspic, menubitmap_s::focusshader, menubitmap_s::generic, h(), menubitmap_s::height, Menu_ItemAtCursor(), menucommon_s::name, NULL, menucommon_s::parent, PULSE_DIVISOR, uiStatic_t::realtime, menubitmap_s::shader, sin(), trap_R_RegisterShaderNoMip(), trap_R_SetColor(), UI_DrawHandlePic(), uis, w, menubitmap_s::width, x, menucommon_s::x, y, and menucommon_s::y. Referenced by Menu_Draw(), and ServerOptions_LevelshotDraw(). 00283 {
00284 float x;
00285 float y;
00286 float w;
00287 float h;
00288 vec4_t tempcolor;
00289 float* color;
00290
00291 x = b->generic.x;
00292 y = b->generic.y;
00293 w = b->width;
00294 h = b->height;
00295
00296 if (b->generic.flags & QMF_RIGHT_JUSTIFY)
00297 {
00298 x = x - w;
00299 }
00300 else if (b->generic.flags & QMF_CENTER_JUSTIFY)
00301 {
00302 x = x - w/2;
00303 }
00304
00305 // used to refresh shader
00306 if (b->generic.name && !b->shader)
00307 {
00308 b->shader = trap_R_RegisterShaderNoMip( b->generic.name );
00309 if (!b->shader && b->errorpic)
00310 b->shader = trap_R_RegisterShaderNoMip( b->errorpic );
00311 }
00312
00313 if (b->focuspic && !b->focusshader)
00314 b->focusshader = trap_R_RegisterShaderNoMip( b->focuspic );
00315
00316 if (b->generic.flags & QMF_GRAYED)
00317 {
00318 if (b->shader)
00319 {
00320 trap_R_SetColor( colorMdGrey );
00321 UI_DrawHandlePic( x, y, w, h, b->shader );
00322 trap_R_SetColor( NULL );
00323 }
00324 }
00325 else
00326 {
00327 if (b->shader)
00328 UI_DrawHandlePic( x, y, w, h, b->shader );
00329
00330 // bk001204 - parentheses
00331 if ( ( (b->generic.flags & QMF_PULSE)
00332 || (b->generic.flags & QMF_PULSEIFFOCUS) )
00333 && (Menu_ItemAtCursor( b->generic.parent ) == b))
00334 {
00335 if (b->focuscolor)
00336 {
00337 tempcolor[0] = b->focuscolor[0];
00338 tempcolor[1] = b->focuscolor[1];
00339 tempcolor[2] = b->focuscolor[2];
00340 color = tempcolor;
00341 }
00342 else
00343 color = pulse_color;
00344 color[3] = 0.5+0.5*sin(uis.realtime/PULSE_DIVISOR);
00345
00346 trap_R_SetColor( color );
00347 UI_DrawHandlePic( x, y, w, h, b->focusshader );
00348 trap_R_SetColor( NULL );
00349 }
00350 else if ((b->generic.flags & QMF_HIGHLIGHT) || ((b->generic.flags & QMF_HIGHLIGHT_IF_FOCUS) && (Menu_ItemAtCursor( b->generic.parent ) == b)))
00351 {
00352 if (b->focuscolor)
00353 {
00354 trap_R_SetColor( b->focuscolor );
00355 UI_DrawHandlePic( x, y, w, h, b->focusshader );
00356 trap_R_SetColor( NULL );
00357 }
00358 else
00359 UI_DrawHandlePic( x, y, w, h, b->focusshader );
00360 }
00361 }
00362 }
|
Here is the call graph for this function:

|
|
Definition at line 241 of file ui_qmenu.c. References b, menucommon_s::bottom, menucommon_s::flags, menubitmap_s::focusshader, menubitmap_s::generic, h(), menubitmap_s::height, menucommon_s::left, menucommon_s::right, menubitmap_s::shader, menucommon_s::top, w, menubitmap_s::width, x, menucommon_s::x, y, and menucommon_s::y. Referenced by Menu_AddItem(), and UI_SPLevelMenu_SetMenuItems(). 00242 {
00243 int x;
00244 int y;
00245 int w;
00246 int h;
00247
00248 x = b->generic.x;
00249 y = b->generic.y;
00250 w = b->width;
00251 h = b->height;
00252 if( w < 0 ) {
00253 w = -w;
00254 }
00255 if( h < 0 ) {
00256 h = -h;
00257 }
00258
00259 if (b->generic.flags & QMF_RIGHT_JUSTIFY)
00260 {
00261 x = x - w;
00262 }
00263 else if (b->generic.flags & QMF_CENTER_JUSTIFY)
00264 {
00265 x = x - w/2;
00266 }
00267
00268 b->generic.left = x;
00269 b->generic.right = x + w;
00270 b->generic.top = y;
00271 b->generic.bottom = y + h;
00272
00273 b->shader = 0;
00274 b->focusshader = 0;
00275 }
|
Here is the call graph for this function:

|
|
Definition at line 153 of file ui_qmenu.c. References menutext_s::color, menucommon_s::flags, menutext_s::generic, menutext_s::string, menutext_s::style, t, UI_DrawBannerString(), menucommon_s::x, x, menucommon_s::y, and y. Referenced by Menu_Draw(). 00154 {
00155 int x;
00156 int y;
00157 float* color;
00158
00159 x = t->generic.x;
00160 y = t->generic.y;
00161
00162 if (t->generic.flags & QMF_GRAYED)
00163 color = text_color_disabled;
00164 else
00165 color = t->color;
00166
00167 UI_DrawBannerString( x, y, t->string, t->style, color );
00168 }
|
Here is the call graph for this function:

|
|
Definition at line 143 of file ui_qmenu.c. References menucommon_s::flags, menutext_s::generic, and t. Referenced by Menu_AddItem().
|
|
||||||||||||
|
Definition at line 1567 of file ui_qmenu.c. References menucommon_s::callback, menucommon_s::flags, menuframework_s, QM_ACTIVATED, and sfxHandle_t. Referenced by Menu_DefaultKey(). 01567 {
01568 if ( item->callback ) {
01569 item->callback( item, QM_ACTIVATED );
01570 if( !( item->flags & QMF_SILENT ) ) {
01571 return menu_move_sound;
01572 }
01573 }
01574
01575 return 0;
01576 }
|
|
||||||||||||
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1404 of file ui_qmenu.c. References _tag_menuframework::cursor, _tag_menuframework::cursor_prev, menucommon_s::flags, _tag_menuframework::items, m, menuframework_s, _tag_menuframework::nitems, qboolean, QMF_GRAYED, QMF_MOUSEONLY, and _tag_menuframework::wrapAround. Referenced by Menu_DefaultKey(). 01404 {
01405 menucommon_s *item = NULL;
01406 qboolean wrapped = qfalse;
01407
01408 wrap:
01409 while ( m->cursor >= 0 && m->cursor < m->nitems ) {
01410 item = ( menucommon_s * ) m->items[m->cursor];
01411 if (( item->flags & (QMF_GRAYED|QMF_MOUSEONLY|QMF_INACTIVE) ) ) {
01412 m->cursor += dir;
01413 }
01414 else {
01415 break;
01416 }
01417 }
01418
01419 if ( dir == 1 ) {
01420 if ( m->cursor >= m->nitems ) {
01421 if ( m->wrapAround ) {
01422 if ( wrapped ) {
01423 m->cursor = m->cursor_prev;
01424 return;
01425 }
01426 m->cursor = 0;
01427 wrapped = qtrue;
01428 goto wrap;
01429 }
01430 m->cursor = m->cursor_prev;
01431 }
01432 }
01433 else {
01434 if ( m->cursor < 0 ) {
01435 if ( m->wrapAround ) {
01436 if ( wrapped ) {
01437 m->cursor = m->cursor_prev;
01438 return;
01439 }
01440 m->cursor = m->nitems - 1;
01441 wrapped = qtrue;
01442 goto wrap;
01443 }
01444 m->cursor = m->cursor_prev;
01445 }
01446 }
01447 }
|
|
Here is the call graph for this function:

|
|
Definition at line 1337 of file ui_qmenu.c. References _tag_menuframework::cursor, _tag_menuframework::cursor_prev, _tag_menuframework::items, m, menuframework_s, _tag_menuframework::nitems, QM_GOTFOCUS, QM_LOSTFOCUS, and void(). Referenced by Menu_DefaultKey(), and Menu_SetCursor(). 01338 {
01339 void (*callback)( void *self, int notification );
01340
01341 if (m->cursor_prev == m->cursor)
01342 return;
01343
01344 if (m->cursor_prev >= 0 && m->cursor_prev < m->nitems)
01345 {
01346 callback = ((menucommon_s*)(m->items[m->cursor_prev]))->callback;
01347 if (callback)
01348 callback(m->items[m->cursor_prev],QM_LOSTFOCUS);
01349 }
01350
01351 if (m->cursor >= 0 && m->cursor < m->nitems)
01352 {
01353 callback = ((menucommon_s*)(m->items[m->cursor]))->callback;
01354 if (callback)
01355 callback(m->items[m->cursor],QM_GOTFOCUS);
01356 }
01357 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1583 of file ui_qmenu.c. References _tag_menuframework::cursor, _tag_menuframework::cursor_prev, uiStatic_t::debug, EXEC_APPEND, menucommon_s::flags, K_AUX1, K_AUX10, K_AUX11, K_AUX12, K_AUX13, K_AUX14, K_AUX15, K_AUX16, K_AUX2, K_AUX3, K_AUX4, K_AUX5, K_AUX6, K_AUX7, K_AUX8, K_AUX9, K_DOWNARROW, K_ENTER, K_ESCAPE, K_F11, K_F12, K_JOY1, K_JOY2, K_JOY3, K_JOY4, K_KP_DOWNARROW, K_KP_ENTER, K_KP_UPARROW, K_MOUSE1, K_MOUSE2, K_MOUSE3, K_TAB, K_UPARROW, m, Menu_ActivateItem(), Menu_AdjustCursor(), Menu_CursorMoved(), Menu_ItemAtCursor(), MenuField_Key(), menuframework_s, MTYPE_FIELD, MTYPE_RADIOBUTTON, MTYPE_SCROLLLIST, MTYPE_SLIDER, MTYPE_SPINCONTROL, _tag_menuframework::nitems, QMF_GRAYED, QMF_MOUSEONLY, RadioButton_Key(), ScrollList_Key(), sfxHandle_t, Slider_Key(), SpinControl_Key(), trap_Cmd_ExecuteText(), menucommon_s::type, UI_PopMenu(), and uis. Referenced by ArenaServers_MenuKey(), ConfirmMenu_Key(), Controls_MenuKey(), PlayerModel_MenuKey(), PlayerSettings_MenuKey(), Reset_MenuKey(), ServerInfo_MenuKey(), UI_DemosMenu_Key(), UI_KeyEvent(), UI_SPPostgameMenu_MenuKey(), UI_SPSkillMenu_Key(), and UI_TeamOrdersMenu_Key(). 01584 {
01585 sfxHandle_t sound = 0;
01586 menucommon_s *item;
01587 int cursor_prev;
01588
01589 // menu system keys
01590 switch ( key )
01591 {
01592 case K_MOUSE2:
01593 case K_ESCAPE:
01594 UI_PopMenu();
01595 return menu_out_sound;
01596 }
01597
01598 if (!m || !m->nitems)
01599 return 0;
01600
01601 // route key stimulus to widget
01602 item = Menu_ItemAtCursor( m );
01603 if (item && !(item->flags & (QMF_GRAYED|QMF_INACTIVE)))
01604 {
01605 switch (item->type)
01606 {
01607 case MTYPE_SPINCONTROL:
01608 sound = SpinControl_Key( (menulist_s*)item, key );
01609 break;
01610
01611 case MTYPE_RADIOBUTTON:
01612 sound = RadioButton_Key( (menuradiobutton_s*)item, key );
01613 break;
01614
01615 case MTYPE_SLIDER:
01616 sound = Slider_Key( (menuslider_s*)item, key );
01617 break;
01618
01619 case MTYPE_SCROLLLIST:
01620 sound = ScrollList_Key( (menulist_s*)item, key );
01621 break;
01622
01623 case MTYPE_FIELD:
01624 sound = MenuField_Key( (menufield_s*)item, &key );
01625 break;
01626 }
01627
01628 if (sound) {
01629 // key was handled
01630 return sound;
01631 }
01632 }
01633
01634 // default handling
01635 switch ( key )
01636 {
01637 #ifndef NDEBUG
01638 case K_F11:
01639 uis.debug ^= 1;
01640 break;
01641
01642 case K_F12:
01643 trap_Cmd_ExecuteText(EXEC_APPEND, "screenshot\n");
01644 break;
01645 #endif
01646 case K_KP_UPARROW:
01647 case K_UPARROW:
01648 cursor_prev = m->cursor;
01649 m->cursor_prev = m->cursor;
01650 m->cursor--;
01651 Menu_AdjustCursor( m, -1 );
01652 if ( cursor_prev != m->cursor ) {
01653 Menu_CursorMoved( m );
01654 sound = menu_move_sound;
01655 }
01656 break;
01657
01658 case K_TAB:
01659 case K_KP_DOWNARROW:
01660 case K_DOWNARROW:
01661 cursor_prev = m->cursor;
01662 m->cursor_prev = m->cursor;
01663 m->cursor++;
01664 Menu_AdjustCursor( m, 1 );
01665 if ( cursor_prev != m->cursor ) {
01666 Menu_CursorMoved( m );
01667 sound = menu_move_sound;
01668 }
01669 break;
01670
01671 case K_MOUSE1:
01672 case K_MOUSE3:
01673 if (item)
01674 if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE)))
01675 return (Menu_ActivateItem( m, item ));
01676 break;
01677
01678 case K_JOY1:
01679 case K_JOY2:
01680 case K_JOY3:
01681 case K_JOY4:
01682 case K_AUX1:
01683 case K_AUX2:
01684 case K_AUX3:
01685 case K_AUX4:
01686 case K_AUX5:
01687 case K_AUX6:
01688 case K_AUX7:
01689 case K_AUX8:
01690 case K_AUX9:
01691 case K_AUX10:
01692 case K_AUX11:
01693 case K_AUX12:
01694 case K_AUX13:
01695 case K_AUX14:
01696 case K_AUX15:
01697 case K_AUX16:
01698 case K_KP_ENTER:
01699 case K_ENTER:
01700 if (item)
01701 if (!(item->flags & (QMF_MOUSEONLY|QMF_GRAYED|QMF_INACTIVE)))
01702 return (Menu_ActivateItem( m, item ));
01703 break;
01704 }
01705
01706 return sound;
01707 }
|
Here is the call graph for this function:

|