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

ui_confirm.c File Reference

#include "ui_local.h"

Include dependency graph for ui_confirm.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  confirmMenu_t

Defines

#define ART_CONFIRM_FRAME   "menu/art/cut_frame"
#define ID_CONFIRM_NO   10
#define ID_CONFIRM_YES   11

Functions

void ConfirmMenu_Cache (void)
void ConfirmMenu_Draw (void)
void ConfirmMenu_Event (void *ptr, int event)
sfxHandle_t ConfirmMenu_Key (int key)
void MessageMenu_Draw (void)
void UI_ConfirmMenu (const char *question, void(*draw)(void), void(*action)(qboolean result))
void UI_ConfirmMenu_Style (const char *question, int style, void(*draw)(void), void(*action)(qboolean result))
void UI_Message (const char **lines)

Variables

confirmMenu_t s_confirm


Define Documentation

#define ART_CONFIRM_FRAME   "menu/art/cut_frame"
 

Definition at line 35 of file ui_confirm.c.

Referenced by ConfirmMenu_Cache(), ConfirmMenu_Draw(), and MessageMenu_Draw().

#define ID_CONFIRM_NO   10
 

Definition at line 37 of file ui_confirm.c.

#define ID_CONFIRM_YES   11
 

Definition at line 38 of file ui_confirm.c.


Function Documentation

void ConfirmMenu_Cache void   ) 
 

Definition at line 163 of file ui_confirm.c.

References ART_CONFIRM_FRAME, and trap_R_RegisterShaderNoMip().

Referenced by UI_Cache_f(), UI_ConfirmMenu_Style(), and UI_Message().

00163                                {
00164     trap_R_RegisterShaderNoMip( ART_CONFIRM_FRAME );
00165 }

Here is the call graph for this function:

void ConfirmMenu_Draw void   )  [static]
 

Definition at line 145 of file ui_confirm.c.

References ART_CONFIRM_FRAME, color_red, confirmMenu_t::draw, confirmMenu_t::menu, Menu_Draw(), confirmMenu_t::question, s_confirm, confirmMenu_t::slashX, confirmMenu_t::style, UI_DrawNamedPic(), UI_DrawProportionalString(), UI_INVERSE, and UI_LEFT.

00145                                      {
00146     UI_DrawNamedPic( 142, 118, 359, 256, ART_CONFIRM_FRAME );
00147     UI_DrawProportionalString( 320, 204, s_confirm.question, s_confirm.style, color_red );
00148     UI_DrawProportionalString( s_confirm.slashX, 265, "/", UI_LEFT|UI_INVERSE, color_red );
00149 
00150     Menu_Draw( &s_confirm.menu );
00151 
00152     if( s_confirm.draw ) {
00153         s_confirm.draw();
00154     }
00155 }

Here is the call graph for this function:

void ConfirmMenu_Event void *  ptr,
int  event
[static]
 

Definition at line 65 of file ui_confirm.c.

References confirmMenu_t::action, qboolean, s_confirm, and UI_PopMenu().

Referenced by ConfirmMenu_Key().

00065                                                       {
00066     qboolean    result;
00067 
00068     if( event != QM_ACTIVATED ) {
00069         return;
00070     }
00071 
00072     UI_PopMenu();
00073 
00074     if( ((menucommon_s*)ptr)->id == ID_CONFIRM_NO ) {
00075         result = qfalse;
00076     }
00077     else {
00078         result = qtrue;
00079     }
00080 
00081     if( s_confirm.action ) {
00082         s_confirm.action( result );
00083     }
00084 }

Here is the call graph for this function:

sfxHandle_t ConfirmMenu_Key int  key  )  [static]
 

Definition at line 92 of file ui_confirm.c.

References ConfirmMenu_Event(), K_KP_LEFTARROW, K_KP_RIGHTARROW, K_LEFTARROW, K_RIGHTARROW, confirmMenu_t::menu, Menu_DefaultKey(), confirmMenu_t::no, QM_ACTIVATED, s_confirm, sfxHandle_t, and confirmMenu_t::yes.

00092                                               {
00093     switch ( key ) {
00094     case K_KP_LEFTARROW:
00095     case K_LEFTARROW:
00096     case K_KP_RIGHTARROW:
00097     case K_RIGHTARROW:
00098         key = K_TAB;
00099         break;
00100 
00101     case 'n':
00102     case 'N':
00103         ConfirmMenu_Event( &s_confirm.no, QM_ACTIVATED );
00104         break;
00105 
00106     case 'y':
00107     case 'Y':
00108         ConfirmMenu_Event( &s_confirm.yes, QM_ACTIVATED );
00109         break;
00110     }
00111 
00112     return Menu_DefaultKey( &s_confirm.menu, key );
00113 }

Here is the call graph for this function:

void MessageMenu_Draw void   )  [static]
 

Definition at line 121 of file ui_confirm.c.

References ART_CONFIRM_FRAME, color_red, confirmMenu_t::draw, i, confirmMenu_t::lines, confirmMenu_t::menu, Menu_Draw(), s_confirm, confirmMenu_t::style, UI_DrawNamedPic(), UI_DrawProportionalString(), and y.

00121                                      {
00122     int i,y;
00123     
00124     UI_DrawNamedPic( 142, 118, 359, 256, ART_CONFIRM_FRAME );
00125     
00126     y = 188;
00127     for(i=0; s_confirm.lines[i]; i++)
00128     {
00129         UI_DrawProportionalString( 320, y, s_confirm.lines[i], s_confirm.style, color_red );
00130         y += 18;
00131     }
00132 
00133     Menu_Draw( &s_confirm.menu );
00134 
00135     if( s_confirm.draw ) {
00136         s_confirm.draw();
00137     }
00138 }

Here is the call graph for this function:

void UI_ConfirmMenu const char *  question,
void(*)(void)  draw,
void(*)(qboolean result)  action
 

Definition at line 241 of file ui_confirm.c.

References UI_CENTER, UI_ConfirmMenu_Style(), and UI_INVERSE.

Referenced by Controls_MenuEvent(), InGame_Event(), Main_MenuEvent(), UI_SetActiveMenu(), UI_SetupMenu_Event(), and UI_SPLevelMenu_ResetEvent().

00241                                                                                                      {
00242     UI_ConfirmMenu_Style(question, UI_CENTER|UI_INVERSE, draw, action);
00243 }

Here is the call graph for this function:

void UI_ConfirmMenu_Style const char *  question,
int  style,
void(*)(void)  draw,
void(*)(qboolean result)  action
 

Definition at line 173 of file ui_confirm.c.

References confirmMenu_t::action, menucommon_s::callback, menutext_s::color, ConfirmMenu_Cache(), uiClientState_t::connState, confirmMenu_t::draw, _tag_menuframework::draw, menucommon_s::flags, _tag_menuframework::fullscreen, menutext_s::generic, menucommon_s::id, _tag_menuframework::key, memset(), confirmMenu_t::menu, Menu_AddItem(), Menu_SetCursorToItem(), confirmMenu_t::no, QMF_LEFT_JUSTIFY, confirmMenu_t::question, s_confirm, confirmMenu_t::slashX, menutext_s::string, confirmMenu_t::style, menutext_s::style, trap_GetClientState(), menucommon_s::type, UI_ProportionalStringWidth(), UI_PushMenu(), _tag_menuframework::wrapAround, menucommon_s::x, menucommon_s::y, and confirmMenu_t::yes.

Referenced by ArenaServers_Event(), and UI_ConfirmMenu().

00173                                                                                                                       {
00174     uiClientState_t cstate;
00175     int n1, n2, n3;
00176     int l1, l2, l3;
00177 
00178     // zero set all our globals
00179     memset( &s_confirm, 0, sizeof(s_confirm) );
00180 
00181     ConfirmMenu_Cache();
00182 
00183     n1 = UI_ProportionalStringWidth( "YES/NO" );
00184     n2 = UI_ProportionalStringWidth( "YES" ) + PROP_GAP_WIDTH;
00185     n3 = UI_ProportionalStringWidth( "/" )  + PROP_GAP_WIDTH;
00186     l1 = 320 - ( n1 / 2 );
00187     l2 = l1 + n2;
00188     l3 = l2 + n3;
00189     s_confirm.slashX = l2;
00190 
00191     s_confirm.question = question;
00192     s_confirm.draw = draw;
00193     s_confirm.action = action;
00194     s_confirm.style = style;
00195 
00196     s_confirm.menu.draw       = ConfirmMenu_Draw;
00197     s_confirm.menu.key        = ConfirmMenu_Key;
00198     s_confirm.menu.wrapAround = qtrue;
00199 
00200     trap_GetClientState( &cstate );
00201     if ( cstate.connState >= CA_CONNECTED ) {
00202         s_confirm.menu.fullscreen = qfalse;
00203     }
00204     else {
00205         s_confirm.menu.fullscreen = qtrue;
00206     }
00207 
00208     s_confirm.yes.generic.type      = MTYPE_PTEXT;      
00209     s_confirm.yes.generic.flags     = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; 
00210     s_confirm.yes.generic.callback  = ConfirmMenu_Event;
00211     s_confirm.yes.generic.id        = ID_CONFIRM_YES;
00212     s_confirm.yes.generic.x         = l1;
00213     s_confirm.yes.generic.y         = 264;
00214     s_confirm.yes.string            = "YES";
00215     s_confirm.yes.color             = color_red;
00216     s_confirm.yes.style             = UI_LEFT;
00217 
00218     s_confirm.no.generic.type       = MTYPE_PTEXT;      
00219     s_confirm.no.generic.flags      = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; 
00220     s_confirm.no.generic.callback   = ConfirmMenu_Event;
00221     s_confirm.no.generic.id         = ID_CONFIRM_NO;
00222     s_confirm.no.generic.x          = l3;
00223     s_confirm.no.generic.y          = 264;
00224     s_confirm.no.string             = "NO";
00225     s_confirm.no.color              = color_red;
00226     s_confirm.no.style              = UI_LEFT;
00227 
00228     Menu_AddItem( &s_confirm.menu,  &s_confirm.yes );             
00229     Menu_AddItem( &s_confirm.menu,  &s_confirm.no );
00230 
00231     UI_PushMenu( &s_confirm.menu );
00232 
00233     Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.no );
00234 }

Here is the call graph for this function:

void UI_Message const char **  lines  ) 
 

Definition at line 251 of file ui_confirm.c.

References menucommon_s::callback, menutext_s::color, ConfirmMenu_Cache(), uiClientState_t::connState, _tag_menuframework::draw, menucommon_s::flags, _tag_menuframework::fullscreen, menutext_s::generic, menucommon_s::id, _tag_menuframework::key, confirmMenu_t::lines, memset(), confirmMenu_t::menu, Menu_AddItem(), Menu_SetCursorToItem(), QMF_LEFT_JUSTIFY, s_confirm, menutext_s::string, confirmMenu_t::style, menutext_s::style, trap_GetClientState(), menucommon_s::type, UI_CENTER, UI_INVERSE, UI_ProportionalStringWidth(), UI_PushMenu(), _tag_menuframework::wrapAround, menucommon_s::x, menucommon_s::y, and confirmMenu_t::yes.

Referenced by Punkbuster_ConfirmDisable().

00251                                       {
00252     uiClientState_t cstate;
00253     int n1, l1;
00254     
00255     // zero set all our globals
00256     memset( &s_confirm, 0, sizeof(s_confirm) );
00257 
00258     ConfirmMenu_Cache();
00259 
00260     n1 = UI_ProportionalStringWidth( "OK" );
00261     l1 = 320 - ( n1 / 2 );
00262     
00263     s_confirm.lines = lines;
00264     s_confirm.style = UI_CENTER|UI_INVERSE|UI_SMALLFONT;
00265 
00266     s_confirm.menu.draw       = MessageMenu_Draw;
00267     s_confirm.menu.key        = ConfirmMenu_Key;
00268     s_confirm.menu.wrapAround = qtrue;
00269     
00270     trap_GetClientState( &cstate );
00271     if ( cstate.connState >= CA_CONNECTED ) {
00272         s_confirm.menu.fullscreen = qfalse;
00273     }
00274     else {
00275         s_confirm.menu.fullscreen = qtrue;
00276     }
00277 
00278     s_confirm.yes.generic.type      = MTYPE_PTEXT;      
00279     s_confirm.yes.generic.flags     = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; 
00280     s_confirm.yes.generic.callback  = ConfirmMenu_Event;
00281     s_confirm.yes.generic.id        = ID_CONFIRM_YES;
00282     s_confirm.yes.generic.x         = l1;
00283     s_confirm.yes.generic.y         = 280;
00284     s_confirm.yes.string            = "OK";
00285     s_confirm.yes.color             = color_red;
00286     s_confirm.yes.style             = UI_LEFT;
00287 
00288     Menu_AddItem( &s_confirm.menu,  &s_confirm.yes );
00289     
00290     UI_PushMenu( &s_confirm.menu );
00291 
00292     Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.yes );
00293 }

Here is the call graph for this function:


Variable Documentation

confirmMenu_t s_confirm [static]
 

Definition at line 57 of file ui_confirm.c.

Referenced by ConfirmMenu_Draw(), ConfirmMenu_Event(), ConfirmMenu_Key(), MessageMenu_Draw(), UI_ConfirmMenu_Style(), and UI_Message().


Generated on Thu Aug 25 14:27:59 2005 for Quake III Arena by  doxygen 1.3.9.1