Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ui_qmenu.c File Reference

#include "ui_local.h"

Include dependency graph for ui_qmenu.c:

Include dependency graph

Go to the source code of this file.

Functions

void Action_Draw (menuaction_s *a)
void Action_Init (menuaction_s *a)
void Bitmap_Draw (menubitmap_s *b)
void Bitmap_Init (menubitmap_s *b)
void BText_Draw (menutext_s *b)
void BText_Init (menutext_s *b)
sfxHandle_t Menu_ActivateItem (menuframework_s *s, menucommon_s *item)
void Menu_AddItem (menuframework_s *menu, void *item)
void Menu_AdjustCursor (menuframework_s *m, int dir)
void Menu_Cache (void)
void Menu_CursorMoved (menuframework_s *m)
sfxHandle_t Menu_DefaultKey (menuframework_s *m, int key)
void Menu_Draw (menuframework_s *menu)
void * Menu_ItemAtCursor (menuframework_s *m)
void Menu_SetCursor (menuframework_s *m, int cursor)
void Menu_SetCursorToItem (menuframework_s *m, void *ptr)
void PText_Draw (menutext_s *b)
void PText_Init (menutext_s *b)
void RadioButton_Draw (menuradiobutton_s *rb)
void RadioButton_Init (menuradiobutton_s *rb)
sfxHandle_t RadioButton_Key (menuradiobutton_s *rb, int key)
void ScrollList_Draw (menulist_s *l)
void ScrollList_Init (menulist_s *l)
sfxHandle_t ScrollList_Key (menulist_s *l, int key)
void Slider_Draw (menuslider_s *s)
void Slider_Init (menuslider_s *s)
sfxHandle_t Slider_Key (menuslider_s *s, int key)
void SpinControl_Draw (menulist_s *s)
void SpinControl_Init (menulist_s *s)
sfxHandle_t SpinControl_Key (menulist_s *l, int key)
void Text_Draw (menutext_s *b)
void Text_Init (menutext_s *b)

Variables

vec4_t color_black = {0.00f, 0.00f, 0.00f, 1.00f}
vec4_t color_blue = {0.00f, 0.00f, 1.00f, 1.00f}
vec4_t color_dim = {0.00f, 0.00f, 0.00f, 0.25f}
vec4_t color_lightOrange = {1.00f, 0.68f, 0.00f, 1.00f }
vec4_t color_orange = {1.00f, 0.43f, 0.00f, 1.00f}
vec4_t color_red = {1.00f, 0.00f, 0.00f, 1.00f}
vec4_t color_white = {1.00f, 1.00f, 1.00f, 1.00f}
vec4_t color_yellow = {1.00f, 1.00f, 0.00f, 1.00f}
vec4_t listbar_color = {1.00f, 0.43f, 0.00f, 0.30f}
sfxHandle_t menu_buzz_sound
vec4_t menu_dim_color = {0.0f, 0.0f, 0.0f, 0.75f}
sfxHandle_t menu_in_sound
sfxHandle_t menu_move_sound
sfxHandle_t menu_null_sound
sfxHandle_t menu_out_sound
vec4_t menu_text_color = {1.0f, 1.0f, 1.0f, 1.0f}
vec4_t pulse_color = {1.00f, 1.00f, 1.00f, 1.00f}
qhandle_t sliderBar
qhandle_t sliderButton_0
qhandle_t sliderButton_1
vec4_t text_color_disabled = {0.50f, 0.50f, 0.50f, 1.00f}
vec4_t text_color_highlight = {1.00f, 1.00f, 0.00f, 1.00f}
vec4_t text_color_normal = {1.00f, 0.43f, 0.00f, 1.00f}
vec4_t text_color_status = {1.00f, 1.00f, 1.00f, 1.00f}
sfxHandle_t weaponChangeSound


Function Documentation

void Action_Draw menuaction_s a  )  [static]
 

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:

void Action_Init menuaction_s a  )  [static]
 

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:

void Bitmap_Draw menubitmap_s b  ) 
 

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:

void Bitmap_Init menubitmap_s b  ) 
 

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:

void BText_Draw menutext_s b  )  [static]
 

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:

void BText_Init menutext_s b  )  [static]
 

Definition at line 143 of file ui_qmenu.c.

References menucommon_s::flags, menutext_s::generic, and t.

Referenced by Menu_AddItem().

00144 {
00145     t->generic.flags |= QMF_INACTIVE;
00146 }

sfxHandle_t Menu_ActivateItem menuframework_s s,
menucommon_s item
 

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 }

void Menu_AddItem menuframework_s menu,
void *  item
 

Definition at line 1266 of file ui_qmenu.c.

References Action_Init(), Bitmap_Init(), BText_Init(), menucommon_s::flags, _tag_menuframework::items, MenuField_Init(), menuframework_s, MTYPE_ACTION, MTYPE_BITMAP, MTYPE_BTEXT, MTYPE_FIELD, MTYPE_PTEXT, MTYPE_RADIOBUTTON, MTYPE_SCROLLLIST, MTYPE_SLIDER, MTYPE_SPINCONTROL, MTYPE_TEXT, _tag_menuframework::nitems, PText_Init(), RadioButton_Init(), ScrollList_Init(), Slider_Init(), SpinControl_Init(), Text_Init(), trap_Error(), menucommon_s::type, and va().

Referenced by ArenaServers_MenuInit(), Controls_MenuInit(), Demos_MenuInit(), GraphicsOptions_MenuInit(), InGame_MenuInit(), LoadConfig_MenuInit(), Login_MenuInit(), Options_MenuInit(), PlayerModel_MenuInit(), PlayerSettings_MenuInit(), Preferences_MenuInit(), Rankings_MenuInit(), RankStatus_MenuInit(), ServerOptions_MenuInit(), Signup_MenuInit(), SpecifyLeague_MenuInit(), SpecifyServer_MenuInit(), StartServer_MenuInit(), TeamMain_MenuInit(), UI_AddBotsMenu_Init(), UI_BotSelectMenu_Init(), UI_CDKeyMenu_Init(), UI_CinematicsMenu_Init(), UI_ConfirmMenu_Style(), UI_DisplayOptionsMenu_Init(), UI_DrawConnectScreen(), UI_DriverInfo_Menu(), UI_MainMenu(), UI_Message(), UI_Mods_MenuInit(), UI_NetworkOptionsMenu_Init(), UI_RemoveBotsMenu_Init(), UI_ResetMenu(), UI_SaveConfigMenu_Init(), UI_ServerInfoMenu(), UI_SetupMenu_Init(), UI_SoundOptionsMenu_Init(), UI_SPLevelMenu_Init(), UI_SPPostgameMenu_Init(), UI_SPSkillMenu_Init(), and UI_TeamOrdersMenu_Init().

01267 {
01268     menucommon_s    *itemptr;
01269 
01270     if (menu->nitems >= MAX_MENUITEMS)
01271         trap_Error ("Menu_AddItem: excessive items");
01272 
01273     menu->items[menu->nitems] = item;
01274     ((menucommon_s*)menu->items[menu->nitems])->parent        = menu;
01275     ((menucommon_s*)menu->items[menu->nitems])->menuPosition  = menu->nitems;
01276     ((menucommon_s*)menu->items[menu->nitems])->flags        &= ~QMF_HASMOUSEFOCUS;
01277 
01278     // perform any item specific initializations
01279     itemptr = (menucommon_s*)item;
01280     if (!(itemptr->flags & QMF_NODEFAULTINIT))
01281     {
01282         switch (itemptr->type)
01283         {
01284             case MTYPE_ACTION:
01285                 Action_Init((menuaction_s*)item);
01286                 break;
01287 
01288             case MTYPE_FIELD:
01289                 MenuField_Init((menufield_s*)item);
01290                 break;
01291 
01292             case MTYPE_SPINCONTROL:
01293                 SpinControl_Init((menulist_s*)item);
01294                 break;
01295 
01296             case MTYPE_RADIOBUTTON:
01297                 RadioButton_Init((menuradiobutton_s*)item);
01298                 break;
01299 
01300             case MTYPE_SLIDER:
01301                 Slider_Init((menuslider_s*)item);
01302                 break;
01303 
01304             case MTYPE_BITMAP:
01305                 Bitmap_Init((menubitmap_s*)item);
01306                 break;
01307 
01308             case MTYPE_TEXT:
01309                 Text_Init((menutext_s*)item);
01310                 break;
01311 
01312             case MTYPE_SCROLLLIST:
01313                 ScrollList_Init((menulist_s*)item);
01314                 break;
01315 
01316             case MTYPE_PTEXT:
01317                 PText_Init((menutext_s*)item);
01318                 break;
01319 
01320             case MTYPE_BTEXT:
01321                 BText_Init((menutext_s*)item);
01322                 break;
01323 
01324             default:
01325                 trap_Error( va("Menu_Init: unknown type %d", itemptr->type) );
01326         }
01327     }
01328 
01329     menu->nitems++;
01330 }

Here is the call graph for this function:

void Menu_AdjustCursor menuframework_s m,
int  dir
 

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 }

void Menu_Cache void   ) 
 

Definition at line 1714 of file ui_qmenu.c.

References uiStatic_t::charset, uiStatic_t::charsetProp, uiStatic_t::charsetPropB, uiStatic_t::charsetPropGlow, uiStatic_t::cursor, uiStatic_t::glconfig, glconfig_t::hardwareType, menu_buzz_sound, menu_in_sound, menu_move_sound, menu_null_sound, menu_out_sound, uiStatic_t::menuBackNoLogoShader, uiStatic_t::menuBackShader, qfalse, uiStatic_t::rb_off, uiStatic_t::rb_on, sliderBar, sliderButton_0, sliderButton_1, trap_R_RegisterShaderNoMip(), trap_S_RegisterSound(), uis, weaponChangeSound, and uiStatic_t::whiteShader.

01715 {
01716     uis.charset         = trap_R_RegisterShaderNoMip( "gfx/2d/bigchars" );
01717     uis.charsetProp     = trap_R_RegisterShaderNoMip( "menu/art/font1_prop.tga" );
01718     uis.charsetPropGlow = trap_R_RegisterShaderNoMip( "menu/art/font1_prop_glo.tga" );
01719     uis.charsetPropB    = trap_R_RegisterShaderNoMip( "menu/art/font2_prop.tga" );
01720     uis.cursor          = trap_R_RegisterShaderNoMip( "menu/art/3_cursor2" );
01721     uis.rb_on           = trap_R_RegisterShaderNoMip( "menu/art/switch_on" );
01722     uis.rb_off          = trap_R_RegisterShaderNoMip( "menu/art/switch_off" );
01723 
01724     uis.whiteShader = trap_R_RegisterShaderNoMip( "white" );
01725     if ( uis.glconfig.hardwareType == GLHW_RAGEPRO ) {
01726         // the blend effect turns to shit with the normal 
01727         uis.menuBackShader  = trap_R_RegisterShaderNoMip( "menubackRagePro" );
01728     } else {
01729         uis.menuBackShader  = trap_R_RegisterShaderNoMip( "menuback" );
01730     }
01731     uis.menuBackNoLogoShader = trap_R_RegisterShaderNoMip( "menubacknologo" );
01732 
01733     menu_in_sound   = trap_S_RegisterSound( "sound/misc/menu1.wav", qfalse );
01734     menu_move_sound = trap_S_RegisterSound( "sound/misc/menu2.wav", qfalse );
01735     menu_out_sound  = trap_S_RegisterSound( "sound/misc/menu3.wav", qfalse );
01736     menu_buzz_sound = trap_S_RegisterSound( "sound/misc/menu4.wav", qfalse );
01737     weaponChangeSound   = trap_S_RegisterSound( "sound/weapons/change.wav", qfalse );
01738 
01739     // need a nonzero sound, make an empty sound for this
01740     menu_null_sound = -1;
01741 
01742     sliderBar = trap_R_RegisterShaderNoMip( "menu/art/slider2" );
01743     sliderButton_0 = trap_R_RegisterShaderNoMip( "menu/art/sliderbutt_0" );
01744     sliderButton_1 = trap_R_RegisterShaderNoMip( "menu/art/sliderbutt_1" );
01745 }

Here is the call graph for this function:

void Menu_CursorMoved menuframework_s m  ) 
 

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:

sfxHandle_t Menu_DefaultKey menuframework_s m,
int  key
 

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:

void Menu_Draw menuframework_s menu  ) 
 

Definition at line 1454 of file ui_qmenu.c.

References Action_Draw(), Bitmap_Draw(), menucommon_s::bottom, BText_Draw(), colorWhite, colorYellow, uiStatic_t::debug, menucommon_s::flags, h(), i, _tag_menuframework::items, menucommon_s::left, Menu_ItemAtCursor(), MenuField_Draw(), menuframework_s, MTYPE_ACTION, MTYPE_BITMAP, MTYPE_BTEXT, MTYPE_FIELD, MTYPE_PTEXT, MTYPE_RADIOBUTTON, MTYPE_SCROLLLIST, MTYPE_SLIDER, MTYPE_SPINCONTROL, MTYPE_TEXT, _tag_menuframework::nitems, menucommon_s::ownerdraw, PText_Draw(), RadioButton_Draw(), menucommon_s::right, ScrollList_Draw(), Slider_Draw(), SpinControl_Draw(), menucommon_s::statusbar, Text_Draw(), menucommon_s::top, trap_Error(), menucommon_s::type, UI_DrawRect(), uis, va(), w, x, and y.

Referenced by ArenaServers_MenuDraw(), ConfirmMenu_Draw(), DriverInfo_MenuDraw(), GraphicsOptions_MenuDraw(), Main_MenuDraw(), MessageMenu_Draw(), Reset_MenuDraw(), ServerInfo_MenuDraw(), UI_AddBotsMenu_Draw(), UI_Refresh(), UI_SPLevelMenu_MenuDraw(), and UI_SPPostgameMenu_MenuDraw().

01455 {
01456     int             i;
01457     menucommon_s    *itemptr;
01458 
01459     // draw menu
01460     for (i=0; i<menu->nitems; i++)
01461     {
01462         itemptr = (menucommon_s*)menu->items[i];
01463 
01464         if (itemptr->flags & QMF_HIDDEN)
01465             continue;
01466 
01467         if (itemptr->ownerdraw)
01468         {
01469             // total subclassing, owner draws everything
01470             itemptr->ownerdraw( itemptr );
01471         }   
01472         else 
01473         {
01474             switch (itemptr->type)
01475             {   
01476                 case MTYPE_RADIOBUTTON:
01477                     RadioButton_Draw( (menuradiobutton_s*)itemptr );
01478                     break;
01479 
01480                 case MTYPE_FIELD:
01481                     MenuField_Draw( (menufield_s*)itemptr );
01482                     break;
01483         
01484                 case MTYPE_SLIDER:
01485                     Slider_Draw( (menuslider_s*)itemptr );
01486                     break;
01487  
01488                 case MTYPE_SPINCONTROL:
01489                     SpinControl_Draw( (menulist_s*)itemptr );
01490                     break;
01491         
01492                 case MTYPE_ACTION:
01493                     Action_Draw( (menuaction_s*)itemptr );
01494                     break;
01495         
01496                 case MTYPE_BITMAP:
01497                     Bitmap_Draw( (menubitmap_s*)itemptr );
01498                     break;
01499 
01500                 case MTYPE_TEXT:
01501                     Text_Draw( (menutext_s*)itemptr );
01502                     break;
01503 
01504                 case MTYPE_SCROLLLIST:
01505                     ScrollList_Draw( (menulist_s*)itemptr );
01506                     break;
01507                 
01508                 case MTYPE_PTEXT:
01509