diff --git a/saco/d3d9/common/DXUTgui.cpp b/saco/d3d9/common/DXUTgui.cpp index e610b32..33631fb 100644 --- a/saco/d3d9/common/DXUTgui.cpp +++ b/saco/d3d9/common/DXUTgui.cpp @@ -11,6 +11,10 @@ #undef min // use __min instead #undef max // use __max instead +double CDXUTDialog::s_fTimeRefresh = 0.0f; +CDXUTControl* CDXUTDialog::s_pControlFocus = NULL; // The control which has focus +CDXUTControl* CDXUTDialog::s_pControlPressed = NULL; // The control currently pressed + //-------------------------------------------------------------------------------------- // CDXUTDialog class //-------------------------------------------------------------------------------------- @@ -391,6 +395,29 @@ CDXUTControl* CDXUTDialog::GetNextControl( CDXUTControl* pControl ) return pDialog->m_Controls.GetAt( index ); } +//-------------------------------------------------------------------------------------- +CDXUTControl* CDXUTDialog::GetPrevControl( CDXUTControl* pControl ) +{ + int index = pControl->m_Index - 1; + + CDXUTDialog* pDialog = pControl->m_pDialog; + + // Cycle through dialogs in the loop to find the next control. Note + // that if only one control exists in all looped dialogs it will + // be the returned 'previous' control. + while( index < 0 ) + { + pDialog = pDialog->m_pPrevDialog; + if( pDialog == NULL ) + pDialog = pControl->m_pDialog; + + index = pDialog->m_Controls.GetSize() - 1; + } + + return pDialog->m_Controls.GetAt( index ); +} + + //-------------------------------------------------------------------------------------- // CDXUTControl class //-------------------------------------------------------------------------------------- diff --git a/saco/d3d9/common/DXUTgui.h b/saco/d3d9/common/DXUTgui.h index 31ddfb4..4c1feab 100644 --- a/saco/d3d9/common/DXUTgui.h +++ b/saco/d3d9/common/DXUTgui.h @@ -103,6 +103,8 @@ public: static CDXUTControl* GetNextControl( CDXUTControl* pControl ); + static CDXUTControl* GetPrevControl( CDXUTControl* pControl ); + void RemoveAllControls(); // Sets the callback used to notify the app of control events @@ -128,6 +130,8 @@ private: static double s_fTimeRefresh; double m_fTimeLastRefresh; + static CDXUTControl* s_pControlFocus; // The control which has focus + static CDXUTControl* s_pControlPressed; // The control currently pressed CDXUTControl* m_pControlMouseOver; // The control which is hovered over