411 lines
9.9 KiB
C++
411 lines
9.9 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "EtUIMan.h"
|
|||
|
|
#include "EtUIControl.h"
|
|||
|
|
#include "EtUIDialog.h"
|
|||
|
|
#include "EtUIXML.h"
|
|||
|
|
#include "EtPrimitiveDraw.h"
|
|||
|
|
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
extern bool g_bSkipScene;
|
|||
|
|
|
|||
|
|
namespace EtInterface
|
|||
|
|
{
|
|||
|
|
bool g_bEtUIInitTool = false;
|
|||
|
|
bool g_bEtUIRender = true;
|
|||
|
|
bool g_bEtUIMsgProc = true;
|
|||
|
|
bool g_bEtUIProcess = true;
|
|||
|
|
|
|||
|
|
CEtFontMng *g_pFontMng = NULL;
|
|||
|
|
CEtUIDialog *g_pFocusDialog = NULL;
|
|||
|
|
CEtUINameLinkMgr* g_pNameLinkMgr = NULL;
|
|||
|
|
|
|||
|
|
void Initialize()
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>忡<EFBFBD><E5BFA1> <20>ѹ<EFBFBD><D1B9>̶<EFBFBD><CCB6><EFBFBD> IME<4D><45> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD>, <20>ƹ<EFBFBD><C6B9><EFBFBD> <20>ٽ<EFBFBD> dll <20>ε带 <20>ص<EFBFBD> IMEȰ<45><C8B0>ȭ<EFBFBD><C8AD> <20>ȵǼ<C8B5>
|
|||
|
|
// <20>ƿ<EFBFBD> RefCount<6E><74> 0<><30><EFBFBD><EFBFBD> <20>ȸ<EFBFBD><C8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̷<EFBFBD><CCB7><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ѹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵд<D1B5>.
|
|||
|
|
CEtUIIME::Initialize();
|
|||
|
|
g_pFontMng = new CEtFontMng();
|
|||
|
|
g_pNameLinkMgr = new CEtUINameLinkMgr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Finalize()
|
|||
|
|
{
|
|||
|
|
DeleteAllDialog();
|
|||
|
|
SAFE_DELETE( g_pFontMng );
|
|||
|
|
SAFE_DELETE(g_pNameLinkMgr);
|
|||
|
|
CEtUIIME::Uninitialize();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Process( float fElapsedTime )
|
|||
|
|
{
|
|||
|
|
if( !g_bEtUIProcess ) return;
|
|||
|
|
CEtUIDialogBase::ProcessAll( fElapsedTime );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Render( float fElapsedTime )
|
|||
|
|
{
|
|||
|
|
if( g_bSkipScene ) return;
|
|||
|
|
|
|||
|
|
bool bRender = false;
|
|||
|
|
if( g_bEtUIRender ) bRender = true;
|
|||
|
|
if( !g_bEtUIRender && CEtUIDialog::s_pFadeDlg && CEtUIDialog::s_pFadeDlg->IsShow() ) bRender = true;
|
|||
|
|
if( !bRender ) return;
|
|||
|
|
|
|||
|
|
CEtDevice *pEtDevice = GetEtDevice();
|
|||
|
|
if( !pEtDevice ) return;
|
|||
|
|
|
|||
|
|
IDirect3DDevice9 *pd3dDevice = (IDirect3DDevice9*)pEtDevice->GetDevicePtr();
|
|||
|
|
if( !pd3dDevice ) return;
|
|||
|
|
|
|||
|
|
pEtDevice->EnableAlphaBlend( true );
|
|||
|
|
CEtSprite::GetInstance().Begin( D3DXSPRITE_DONOTSAVESTATE );
|
|||
|
|
GetEtDevice()->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
|
|||
|
|
GetEtDevice()->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
|
|||
|
|
|
|||
|
|
if( g_bEtUIRender )
|
|||
|
|
{
|
|||
|
|
CEtUIDialogBase::RenderAll( fElapsedTime );
|
|||
|
|
drag::Render( fElapsedTime );
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if( CEtUIDialog::s_pFadeDlg )
|
|||
|
|
CEtUIDialog::s_pFadeDlg->Render( fElapsedTime );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GetEtDevice()->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
|
|||
|
|
GetEtDevice()->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
|
|||
|
|
CEtSprite::GetInstance().End();
|
|||
|
|
pEtDevice->EnableAlphaBlend( false );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool StaticMsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
|
|
{
|
|||
|
|
if( !g_bEtUIMsgProc )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
if( !g_bEtUIRender )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
g_pFocusDialog = NULL;
|
|||
|
|
|
|||
|
|
if( focus::IsValid() )
|
|||
|
|
{
|
|||
|
|
if( ( focus::GetType() == UI_CONTROL_IMEEDITBOX ) || ( focus::GetType() == UI_CONTROL_LINE_IMEEDITBOX ) )
|
|||
|
|
{
|
|||
|
|
if( CEtUIIME::StaticMsgProc( uMsg, wParam, lParam ) )
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Note : <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ϵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>켱ó<ECBCB1><C3B3><EFBFBD>մϴ<D5B4>.
|
|||
|
|
//
|
|||
|
|
if( CEtUIDialogBase::MsgProcModal( hWnd, uMsg, wParam, lParam ) )
|
|||
|
|
return true;
|
|||
|
|
|
|||
|
|
if( CEtUIDialogBase::StaticMsgProc( hWnd, uMsg, wParam, lParam ) )
|
|||
|
|
return true;
|
|||
|
|
|
|||
|
|
// Note : UI<55><49><EFBFBD><EFBFBD> ó<><C3B3> <20>ȵǴ<C8B5> <20><><EFBFBD>콺 Ŭ<><C5AC><EFBFBD>϶<EFBFBD> <20>巡<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
//
|
|||
|
|
if( uMsg == WM_RBUTTONDOWN )
|
|||
|
|
{
|
|||
|
|
drag::Command(UI_DRAG_CMD_CANCEL);
|
|||
|
|
drag::ReleaseControl();
|
|||
|
|
}
|
|||
|
|
else if( uMsg == WM_LBUTTONDOWN )
|
|||
|
|
{
|
|||
|
|
if( drag::IsValid() )
|
|||
|
|
{
|
|||
|
|
// Note : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>뿡 <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
|
|||
|
|
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>κ<EFBFBD><CEBA>丮 <20><><EFBFBD>̾<EFBFBD><CCBE>α<CEB1><D7BF><EFBFBD> <20>մϴ<D5B4>.
|
|||
|
|
//
|
|||
|
|
trash::SetControl( drag::GetControl() );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void DeleteAllDialog()
|
|||
|
|
{
|
|||
|
|
// Note : <20><><EFBFBD>⼭ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD><CCBE>α<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
//
|
|||
|
|
CSmartPtrBase< CEtUIDialog >::DeleteAllObject();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const CEtUINameLinkMgr& GetNameLinkMgr()
|
|||
|
|
{
|
|||
|
|
_ASSERT(g_pNameLinkMgr);
|
|||
|
|
return *g_pNameLinkMgr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
namespace xml
|
|||
|
|
{
|
|||
|
|
CEtUIXML *s_pEtUIXML(NULL);
|
|||
|
|
|
|||
|
|
CEtUIXML *GetXML() {return s_pEtUIXML; }
|
|||
|
|
void SetXML( CEtUIXML *pXML )
|
|||
|
|
{
|
|||
|
|
ASSERT(pXML&&"EtInterface::xml::SetEtUIXML");
|
|||
|
|
s_pEtUIXML = pXML;
|
|||
|
|
}
|
|||
|
|
bool IsValid() {return s_pEtUIXML!=NULL; }
|
|||
|
|
const wchar_t* GetString( int nCategoryID, int nIndex )
|
|||
|
|
{
|
|||
|
|
return s_pEtUIXML->GetUIString( (CEtUIXML::emCategoryId)nCategoryID, nIndex );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
namespace drag
|
|||
|
|
{
|
|||
|
|
CEtUIControl* s_pDragControl(NULL);
|
|||
|
|
bool bRender = true;
|
|||
|
|
|
|||
|
|
void SetControl( CEtUIControl *pControl )
|
|||
|
|
{
|
|||
|
|
ASSERT(pControl&&"EtInterface::drag::SetControl");
|
|||
|
|
s_pDragControl = pControl;
|
|||
|
|
bRender = true;
|
|||
|
|
focus::ReleaseControl();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CEtUIControl *GetControl() { return s_pDragControl; }
|
|||
|
|
void Command(UIDragCmdParam param) { if (s_pDragControl) s_pDragControl->OnCmdDrag(param); }
|
|||
|
|
void ReleaseControl() { s_pDragControl = NULL; }
|
|||
|
|
bool IsValid() { return s_pDragControl!=NULL; }
|
|||
|
|
void SetRender(bool enable) { bRender = enable; }
|
|||
|
|
|
|||
|
|
void Render( float fElapsedTime )
|
|||
|
|
{
|
|||
|
|
if( !s_pDragControl || bRender == false ) return;
|
|||
|
|
s_pDragControl->RenderDrag( fElapsedTime );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
namespace trash
|
|||
|
|
{
|
|||
|
|
CEtUIControl *s_pTrashControl(NULL);
|
|||
|
|
|
|||
|
|
void SetControl( CEtUIControl *pControl )
|
|||
|
|
{
|
|||
|
|
ASSERT(pControl&&"EtInterface::trash::SetControl");
|
|||
|
|
s_pTrashControl = pControl;
|
|||
|
|
focus::ReleaseControl();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CEtUIControl *GetControl() { return s_pTrashControl; }
|
|||
|
|
void ReleaseControl() { s_pTrashControl = NULL; }
|
|||
|
|
bool IsValid() { return s_pTrashControl!=NULL; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
namespace focus
|
|||
|
|
{
|
|||
|
|
CEtUIControl *s_pFocusControl(NULL);
|
|||
|
|
std::vector< CEtUIControl * > s_vecPrevFocusControl;
|
|||
|
|
|
|||
|
|
std::vector<CEtUIControl*>& GetPrevControl() { return s_vecPrevFocusControl; }
|
|||
|
|
|
|||
|
|
void PushControl(CEtUIDialog *pDialog)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE>ִ<EFBFBD> s_pFocusControl<6F><6C> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD><CCBE>αװ<CEB1> <20>ƴ<EFBFBD> <20>ٸ<EFBFBD> <20><><EFBFBD>̾<EFBFBD><CCBE>αװ<CEB1> <20><><EFBFBD><EFBFBD>,
|
|||
|
|
if( !IsSameParent(pDialog) )
|
|||
|
|
{
|
|||
|
|
// <20><EFBFBD><F1B1B3B9><EFBFBD> != <20><> <20><><EFBFBD>־<EFBFBD><D6BE>µ<EFBFBD>, <20>̷<EFBFBD><CCB7><EFBFBD> <20>ǹ̻<C7B9> <20>̻<EFBFBD><CCBB>ϴ<EFBFBD>.
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵ<EFBFBD><C8B5>ִ<EFBFBD><D6B4><EFBFBD> ã<>Ƽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ°ǵ<C2B0> == <20><> <20>´°<C2B4> <20>ƴѰ<C6B4>.
|
|||
|
|
// <20><EFBFBD><D7B7><EFBFBD>, <20><><EFBFBD><EFBFBD> focus<75><73> <20><><EFBFBD><EFBFBD> <20>м<EFBFBD><D0BC><EFBFBD> <20><> <20>ǰ<EFBFBD>, <20><><EFBFBD><EFBFBD> <20>̻<EFBFBD><CCBB><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ƽ<EFBFBD>
|
|||
|
|
// <20>׳<EFBFBD> <20>״<EFBFBD><D7B4><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20>ϰڴ<CFB0>.
|
|||
|
|
if( std::find( s_vecPrevFocusControl.begin(), s_vecPrevFocusControl.end(), s_pFocusControl ) != s_vecPrevFocusControl.end() )
|
|||
|
|
{
|
|||
|
|
s_vecPrevFocusControl.push_back( s_pFocusControl );
|
|||
|
|
UnsetFocus();
|
|||
|
|
ReleaseControl();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void PopControl(CEtUIDialog *pDialog)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ǵ<EFBFBD><C7B5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>,
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ȴ<EFBFBD> â<><C3A2> Push <20><> <20>ٸ<EFBFBD> â<><C3A2> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٷ<EFBFBD> Show( false ) <20>ɶ<EFBFBD> <20><> pop<6F><70> <20><><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|||
|
|
//
|
|||
|
|
// <20><EFBFBD><DEBC><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD> <20><>Ÿ <20><><EFBFBD>κ<EFBFBD><CEBA><EFBFBD> â<><C3A2> <20>㶧<EFBFBD><E3B6A7> Ư<><C6AF> <20><>Ʈ<EFBFBD>ѿ<EFBFBD> <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> <20><>û<EFBFBD><C3BB><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.( RequestFocus )
|
|||
|
|
// <20>̶<EFBFBD> s_pFocusControl <20><><EFBFBD><EFBFBD> NULL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD>,
|
|||
|
|
// <20>Ʒ<EFBFBD> <20>˻翡<CBBB><E7BFA1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵȴ<C8B5>.
|
|||
|
|
// s_pFocusControl<6F><6C> NULL<4C><4C> <20><><EFBFBD><EFBFBD>.. <20><><EFBFBD><EFBFBD> <20>̻<EFBFBD><CCBB><EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD>.
|
|||
|
|
if( IsSameParent(pDialog) )
|
|||
|
|
{
|
|||
|
|
ReleaseControl();
|
|||
|
|
|
|||
|
|
if( !s_vecPrevFocusControl.empty() )
|
|||
|
|
{
|
|||
|
|
CEtUIControl *pFocusControl;
|
|||
|
|
pFocusControl = s_vecPrevFocusControl[ s_vecPrevFocusControl.size() - 1 ];
|
|||
|
|
//pFocusControl->GetParent()->RequestFocus( pFocusControl );
|
|||
|
|
// Push<73><68> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ѹ<EFBFBD><D1B9><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD> <20><> <20><><EFBFBD> <20>ϴ<EFBFBD>.
|
|||
|
|
if ( pFocusControl ) pFocusControl->GetParent()->RequestFocus( pFocusControl );
|
|||
|
|
s_vecPrevFocusControl.pop_back();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> â<><C3A2> Show(false)<29>Ǵ°<C7B4> <20>ƴ϶<C6B4>,
|
|||
|
|
// <20>߰<EFBFBD><DFB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿡 <20><><EFBFBD><EFBFBD> â<><C3A2> Show(false)<29>Ǵ°Ŷ<C2B0><C5B6><EFBFBD>, focus<75><73><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
// (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̾<EFBFBD><CCBE>αװ<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>û<EFBFBD><C3BB><EFBFBD><EFBFBD> <20>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD> <20>Ѱ<EFBFBD><D1B0><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ɰ<EFBFBD> <20><><EFBFBD><EFBFBD>.)
|
|||
|
|
for( int i = 0; i < ( int )s_vecPrevFocusControl.size(); i++ )
|
|||
|
|
{
|
|||
|
|
if( s_vecPrevFocusControl[ i ] && s_vecPrevFocusControl[ i ]->GetParent() == pDialog )
|
|||
|
|
{
|
|||
|
|
s_vecPrevFocusControl.erase( s_vecPrevFocusControl.begin() + i );
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CEtUIControl* GetControl()
|
|||
|
|
{
|
|||
|
|
return s_pFocusControl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void SetControl(CEtUIControl* pControl)
|
|||
|
|
{
|
|||
|
|
ASSERT(pControl&&"EtInterface::focus::SetControl");
|
|||
|
|
if( s_pFocusControl ) ReleaseControl();
|
|||
|
|
s_pFocusControl=pControl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ReleaseControl()
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
s_pFocusControl->Focus(false);
|
|||
|
|
OnReleaseControl();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
s_pFocusControl=NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void OnReleaseControl()
|
|||
|
|
{
|
|||
|
|
// <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ɶ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF>ϴٸ<CFB4> <20><><EFBFBD>⼭ <20>Ѵ<EFBFBD>.
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl->GetParent() && s_pFocusControl->GetParent()->IsElementDialog() == false )
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl->IsPressed() || s_pFocusControl->IsRightPressed() || s_pFocusControl->IsHaveScrollBarControl() )
|
|||
|
|
{
|
|||
|
|
s_pFocusControl->SetPressed( false );
|
|||
|
|
s_pFocusControl->SetRightPressed( false );
|
|||
|
|
ReleaseCapture();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool IsValid()
|
|||
|
|
{
|
|||
|
|
return s_pFocusControl!=NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool IsEnable()
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
return s_pFocusControl->IsEnable();
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool IsSameParent( CEtUIDialog *pDlg)
|
|||
|
|
{
|
|||
|
|
ASSERT(pDlg&&"EtInterface::focus::IsSameParent");
|
|||
|
|
|
|||
|
|
if( s_pFocusControl == NULL )
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return (s_pFocusControl->GetParent() == pDlg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool IsSameControl( CEtUIControl* pControl )
|
|||
|
|
{
|
|||
|
|
ASSERT(pControl&&"EtInterface::focus::IsSameControl, pControl is NULL!");
|
|||
|
|
return s_pFocusControl==pControl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void SetFocus()
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
s_pFocusControl->Focus(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void SetFocus(CEtUIControl* pControl)
|
|||
|
|
{
|
|||
|
|
ASSERT(pControl&&"EtInterface::focus::SetFocus");
|
|||
|
|
if (IsSameControl(pControl) == false)
|
|||
|
|
{
|
|||
|
|
ReleaseControl();
|
|||
|
|
s_pFocusControl = pControl;
|
|||
|
|
s_pFocusControl->Focus(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void UnsetFocus()
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
s_pFocusControl->Focus(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CEtUIDialog* GetParent()
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
return s_pFocusControl->GetParent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
UI_CONTROL_TYPE GetType()
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
return s_pFocusControl->GetType();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return UI_CONTROL_SIZE;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
{
|
|||
|
|
return s_pFocusControl->MsgProc(uMsg, wParam, lParam);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool HandleKeyboard( UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
return s_pFocusControl->HandleKeyboard(uMsg, wParam, lParam);
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool HandleMouse( UINT uMsg, float fX, float fY, WPARAM wParam, LPARAM lParam )
|
|||
|
|
{
|
|||
|
|
if( s_pFocusControl )
|
|||
|
|
return s_pFocusControl->HandleMouse(uMsg, fX, fY, wParam, lParam);
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|