Add SetNextScreenName(string) and SetPrevScreenName(string) Lua bindings to Screen

This commit is contained in:
AJ Kelly
2010-12-21 21:37:26 -06:00
parent a14ab84dc7
commit 2d6d081c30
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -17,6 +17,8 @@ sm-ssc v1.2 | 201012xx
-------- --------
* SM5SVN r28586: Only unload fonts if not used by the next screen. [shakesoda] * SM5SVN r28586: Only unload fonts if not used by the next screen. [shakesoda]
* [ScreenSelectMaster] Fix DoSwitchAnyways to actually work again. * [ScreenSelectMaster] Fix DoSwitchAnyways to actually work again.
* [Screen] Added SetNextScreenName(string) and SetPrevScreenName(string)
Lua bindings. [freem]
20101220 20101220
-------- --------
+7
View File
@@ -84,6 +84,7 @@ void Screen::BeginScreen()
/* Screens set these when they determine their next screen dynamically. Reset them /* Screens set these when they determine their next screen dynamically. Reset them
* here, so a reused screen doesn't inherit these from the last time it was used. */ * here, so a reused screen doesn't inherit these from the last time it was used. */
m_sNextScreen = RString(); m_sNextScreen = RString();
m_sPrevScreen = RString();
m_fLockInputSecs = 0; m_fLockInputSecs = 0;
@@ -250,6 +251,8 @@ RString Screen::GetNextScreenName() const
RString Screen::GetPrevScreen() const RString Screen::GetPrevScreen() const
{ {
if( !m_sPrevScreen.empty() )
return m_sPrevScreen;
return PREV_SCREEN; return PREV_SCREEN;
} }
@@ -283,6 +286,8 @@ class LunaScreen: public Luna<Screen>
public: public:
static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; } static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; }
static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; } static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; }
static int SetNextScreenName( T* p, lua_State *L ) { p->SetNextScreen(SArg(1)); return 0; }
static int SetPrevScreenName( T* p, lua_State *L ) { p->SetPrevScreen(SArg(1)); return 0; }
static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; } static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; }
DEFINE_METHOD( GetScreenType, GetScreenType() ) DEFINE_METHOD( GetScreenType, GetScreenType() )
@@ -298,6 +303,8 @@ public:
{ {
ADD_METHOD( GetNextScreenName ); ADD_METHOD( GetNextScreenName );
ADD_METHOD( GetPrevScreenName ); ADD_METHOD( GetPrevScreenName );
ADD_METHOD( SetNextScreenName );
ADD_METHOD( SetPrevScreenName );
ADD_METHOD( PostScreenMessage ); ADD_METHOD( PostScreenMessage );
ADD_METHOD( lockinput ); ADD_METHOD( lockinput );
ADD_METHOD( GetScreenType ); ADD_METHOD( GetScreenType );
+3
View File
@@ -86,6 +86,7 @@ protected:
// If left blank, the NextScreen metric will be used. // If left blank, the NextScreen metric will be used.
RString m_sNextScreen; RString m_sNextScreen;
RString m_sPrevScreen;
ScreenMessage m_smSendOnPop; ScreenMessage m_smSendOnPop;
float m_fLockInputSecs; float m_fLockInputSecs;
@@ -96,6 +97,8 @@ protected:
public: public:
RString GetNextScreenName() const; RString GetNextScreenName() const;
RString GetPrevScreen() const; RString GetPrevScreen() const;
void SetNextScreen(RString sNextScreen){ m_sNextScreen = sNextScreen; };
void SetPrevScreen(RString sPrevScreen){ m_sPrevScreen = sPrevScreen; };
// let subclass override if they want // let subclass override if they want
virtual void MenuUp( const InputEventPlus &input ) { } virtual void MenuUp( const InputEventPlus &input ) { }