eMenuItemChat Class Reference

Handles the chat prompt. More...

Inheritance diagram for eMenuItemChat:

Inheritance graph
[legend]
Collaboration diagram for eMenuItemChat:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 eMenuItemChat (uMenu *M, tString &c, ePlayer *Me, uAutoCompleter *completer)
virtual ~eMenuItemChat ()
virtual bool Event (SDL_Event &e)
 Handles an event.

Private Attributes

ePlayerme
 The player the chat prompt is for.


Detailed Description

Handles the chat prompt.

Definition at line 3401 of file ePlayer.cpp.


Constructor & Destructor Documentation

eMenuItemChat::eMenuItemChat ( uMenu M,
tString c,
ePlayer Me,
uAutoCompleter completer 
) [inline]

Constructor

Parameters:
M passed on to uMenuItemStringWithHistory
c passed on to uMenuItemStringWithHistory
Me the player the chat prompt is for
completer the completer to be used

Definition at line 3409 of file ePlayer.cpp.

03411                                                                             :
    uMenuItemStringWithHistory(M,"$chat_title_text","",c, se_SpamMaxLen, se_chatHistory(), se_chatHistoryMaxSize, completer),me(Me) {}

virtual eMenuItemChat::~eMenuItemChat (  )  [inline, virtual]

Definition at line 3412 of file ePlayer.cpp.

03412 {}


Member Function Documentation

virtual bool eMenuItemChat::Event ( SDL_Event &  e  )  [inline, virtual]

Handles an event.

Parameters:
e the event to process
Returns:
true if the event was handled, false if it wasn't

Reimplemented from uMenuItemStringWithHistory.

Definition at line 3414 of file ePlayer.cpp.

03414                             { }
03415 
03416     virtual bool Event(SDL_Event &e){
03417 #ifndef DEDICATED
03418         if (e.type==SDL_KEYDOWN &&
03419                 (e.key.keysym.sym==SDLK_KP_ENTER || e.key.keysym.sym==SDLK_RETURN)){
03420 
03421             for(int i=se_PlayerNetIDs.Len()-1;i>=0;i--)
03422                 if (se_PlayerNetIDs(i)->pID==me->ID())
03423                     se_PlayerNetIDs(i)->Chat(*content);
03424 
03425             MyMenu()->Exit();
03426             return true;
03427         }
03428         else if (e.type==SDL_KEYDOWN &&
03429                  uActionGlobal::IsBreakingGlobalBind(e.key.keysym.sym))
03430             return su_HandleEvent(e, true);
03431         else
03432         {
03433             if ( uMenuItemStringWithHistory::Event(e) )
03434             {
03435                 return true;
03436             }
03437             // exclude modifier keys from possible control triggers
03438             else if ( e.key.keysym.sym < SDLK_NUMLOCK || e.key.keysym.sym > SDLK_COMPOSE )
03439             {
03440                 // maybe it's an instant chat button?
03441                 try
03442                 {
03443                     return su_HandleEvent(e, false);
03444                 }
03445                 catch ( eChatInsertionCommand & insertion )
03446                 {
03447                     if ( content->Len() + insertion.insertion_.Len() <= maxLength_ )
03448                     {
03449                         *content = content->SubStr( 0, cursorPos ) + insertion.insertion_ + content->SubStr( cursorPos );
03450                         cursorPos += insertion.insertion_.Len()-1;
03451                     }
03452 
03453                     return true;
03454                 }
03455             }
03456         }
03457 #endif // DEDICATED
03458 


Member Data Documentation

ePlayer* eMenuItemChat::me [private]

The player the chat prompt is for.

Definition at line 3402 of file ePlayer.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:26:06 2008 for Armagetron Advanced by  doxygen 1.5.4