gMemuItemConsole Class Reference

Handles the console prompt. More...

Inheritance diagram for gMemuItemConsole:

Inheritance graph
[legend]
Collaboration diagram for gMemuItemConsole:

Collaboration graph
[legend]

List of all members.

Public Member Functions

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


Detailed Description

Handles the console prompt.

Definition at line 599 of file gMenus.cpp.


Constructor & Destructor Documentation

gMemuItemConsole::gMemuItemConsole ( uMenu M,
tString c,
uAutoCompleter completer 
)

Constructor.

Parameters:
M passed on to uMenuItemStringWithHistory
c passed on to uMenuItemStringWithHistory
completer the completer to be used

Definition at line 609 of file gMenus.cpp.

00609                                                                                 :
00610         uMenuItemStringWithHistory(M,"Con:","", c, 1024, sg_consoleHistory(), sg_consoleHistoryMaxSize, completer)
00611 {}

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

Definition at line 602 of file gMenus.cpp.

00602 {}


Member Function Documentation

bool gMemuItemConsole::Event ( SDL_Event &  e  )  [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 614 of file gMenus.cpp.

References tColoredString::ColorString(), con, uMenuItemString::content, uMenuItemStringWithHistory::Event(), uMenu::Exit(), uActionGlobal::IsBreakingGlobalBind(), tRecorderBase::IsPlayingBack(), tConfItemBase::LoadAll(), tConfItemBase::LoadPlayback(), uMenuItemString::MyMenu(), and su_HandleEvent().

00614                                         {
00615     if (e.type==SDL_KEYDOWN &&
00616             (e.key.keysym.sym==SDLK_KP_ENTER || e.key.keysym.sym==SDLK_RETURN)){
00617 
00618         con << tColoredString::ColorString(.5,.5,1) << " > " << *content << '\n';
00619 
00620         if ( tRecorder::IsPlayingBack() )
00621         {
00622             // the command was also recorded; better play it back,
00623             // or the playback gets out of sync
00624             tConfItemBase::LoadPlayback( false );
00625         }
00626         else
00627         {
00628             // pass the console command to the configuration system
00629             std::stringstream s(&((*content)[0]));
00630             tConfItemBase::LoadAll(s);
00631         }
00632 
00633         MyMenu()->Exit();
00634         return true;
00635     }
00636     else if (e.type==SDL_KEYDOWN &&
00637              uActionGlobal::IsBreakingGlobalBind(e.key.keysym.sym))
00638         return su_HandleEvent(e, true);
00639     else
00640         return uMenuItemStringWithHistory::Event(e);
00641 }

Here is the call graph for this function:


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