Files
2026-06-01 12:46:52 +02:00

157 lines
2.8 KiB
C++

#include "stdafx.h"
#include "SGameManager.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
//#include "KUIControl.h"
#include "KUIPopup.h"
KUIPopup::KUIPopup( SGameManager * pGameManager )
: SUIWnd( pGameManager ),
m_bOpen( false )
{
}
KUIPopup::~KUIPopup()
{
Release();
}
// 메모리 해제.
void KUIPopup::Release()
{
}
SUIWnd* KUIPopup::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
return SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
}
void KUIPopup::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
pMsg->bUse = true;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
// 가장위에 뜨도록 한다.
this->m_pManager->SetFocus( this );
}
break;
//case IMSG_UI_FOCUS :
// // 가장위에 뜨도록 한다.
// this->m_pManager->SetFocus( this );
// pMsg->bUse = true;
//
// break;
}
}
void KUIPopup::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
{
m_bOpen = bOpen;
if( bOpen )
{
this->SetShow( true );
// 기존 포커스 제거.
this->m_pManager->RemoveWnd( this );
// wnd 출력 리스트의 최하단에 추가. ( wnd 들중 가장 상위에 뜨게 된다. )
this->m_pManager->AddWnd( this );
// 가장위에 뜨도록 한다.
this->m_pManager->SetFocus( this );
}
}
void KUIPopup::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
//case KUI_MESSAGE::KBUTTON_CLICK :
// break;
// 윈도우 이동
case KUI_MESSAGE::KGENWND_MOVE:
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
//// 포커스를 잃어버림.
//case KUI_MESSAGE::KFOCUS_DEACTIVATED :
// m_bOpen = false;
// this->SetShow( false );
// break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
//// 포커스를 잃어버림.
//void KUIPopup::OnKillFocusNotify()
//{
// m_bOpen = false;
// this->SetShow( false );
//
// // 팝업 Wnd 열기.
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_RIGHTCLICK, false ) );
//}
DWORD KUIPopup::OnMouseMessage(DWORD dwMessage, int x, int y)
{
switch( dwMessage )
{
case KMOUSE_MOVE :
// 팝업창이 떠 있는 경우.
if( m_bOpen )
{
PopupVisiblity( x, y ); // 가시성처리.
}
break;
}
return SUIWnd::OnMouseMessage( dwMessage, x, y );
}
// 가시성처리.
void KUIPopup::PopupVisiblity( int x, int y )
{
// 마우스가 영역을 벗어남.
if( !this->GetRect().IsInRect( x, y ) )
{
m_bOpen = false;
this->SetShow( false );
// 팝업 Wnd 열기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_RIGHTCLICK, false ) );
}
}