104 lines
2.7 KiB
C++
104 lines
2.7 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "KTextEmoticonRender.h"
|
|
|
|
#include "KUIControlStatic.h"
|
|
#include "KUITipControl.h"
|
|
#include "KUIWndManager.h"
|
|
|
|
namespace
|
|
{
|
|
enum KTIP_CONTROL_VALUE
|
|
{
|
|
KTIP_SIZE_X = 270,
|
|
KTIP_SIZE_Y = 20,
|
|
KTIP_DELAY_DEFAULT = 0,
|
|
KTIP_CONTINUE_DEFAULT = 60000,
|
|
|
|
// Tip text gap
|
|
KTIP_HORIZON_MARGIN = 9,
|
|
KTIP_VERTICAL_MARGIN = 9,
|
|
|
|
};
|
|
|
|
KUIWnd* Creator()
|
|
{
|
|
return new KUITipControl;
|
|
}
|
|
|
|
bool bRegister = KUIFactory::GetInstance()->RegisterCreator(Creator, "tooltip" );
|
|
|
|
}
|
|
|
|
DWORD KUITipControl::m_dwTipDelayTime = KTIP_DELAY_DEFAULT;
|
|
DWORD KUITipControl::m_dwTipContinueTime = KTIP_CONTINUE_DEFAULT;
|
|
bool KUITipControl::s_bIsToolTipOn = false;
|
|
const DWORD KUITipControl::m_dwTipWindowWidth = KTIP_SIZE_X;
|
|
const DWORD KUITipControl::m_dwTipWindowHeight = KTIP_SIZE_Y;
|
|
|
|
|
|
// Tip Control Implement
|
|
KUITipControl::KUITipControl()
|
|
{
|
|
m_fZPos = 1.f;
|
|
}
|
|
|
|
KUITipControl::~KUITipControl()
|
|
{
|
|
}
|
|
|
|
void KUITipControl::Render(KViewportObject* pViewport, bool isFront )
|
|
{
|
|
KUIControl::Render( pViewport, isFront );
|
|
}
|
|
void KUITipControl::_initControl()
|
|
{
|
|
// KSize size = KTextPhrase::GetStringSize(m_sCaption.c_str(), m_rcRegion.GetWidth());
|
|
bool bIsEmotiocon = KTextEmoticonRender::FindFilter( m_sCaption );
|
|
SetCaptionAlign( KTextRender::KTALIGN_LEFT | KTextRender::KTALIGN_VCENTER );
|
|
m_rcRegion = KRect( 0, 0, m_rcRegion.GetWidth() + KTIP_HORIZON_MARGIN * 2, m_rcRegion.GetHeight() + KTIP_VERTICAL_MARGIN * 2 );
|
|
|
|
// Back Ground Set
|
|
UpdateBack();
|
|
|
|
// Caption Set
|
|
m_rcCaptionArea = m_rcRegion;
|
|
m_rcCaptionArea.left += KTIP_HORIZON_MARGIN;
|
|
m_rcCaptionArea.top += KTIP_VERTICAL_MARGIN;
|
|
m_rcCaptionArea.right -= KTIP_HORIZON_MARGIN;
|
|
m_rcCaptionArea.bottom -= KTIP_VERTICAL_MARGIN;
|
|
UpdateCaption();
|
|
|
|
if( bIsEmotiocon )
|
|
m_nToolTipTextWidth += 4;
|
|
}
|
|
|
|
void KUITipControl::UpdateTooltipRegion( int nW, int nH )
|
|
{
|
|
//if( nW < m_rcRegion.GetWidth() ) nW = m_rcRegion.GetWidth();
|
|
//if( nH < m_rcRegion.GetHeight() ) nH = m_rcRegion.GetHeight();
|
|
m_rcRegion = KRect( 0, 0, nW + KTIP_HORIZON_MARGIN * 2, nH + KTIP_VERTICAL_MARGIN * 2 );
|
|
|
|
// Back Ground Set
|
|
UpdateBack();
|
|
|
|
// Caption Set
|
|
m_rcCaptionArea = m_rcRegion;
|
|
m_rcCaptionArea.left += KTIP_HORIZON_MARGIN;
|
|
m_rcCaptionArea.top += KTIP_VERTICAL_MARGIN;
|
|
m_rcCaptionArea.right -= KTIP_HORIZON_MARGIN;
|
|
m_rcCaptionArea.bottom -= KTIP_VERTICAL_MARGIN;
|
|
|
|
// 2010.09.03 _initControl에서 캡션을 KUITipControl::m_dwTipWindowWidth 크기로 짤랐기 때문에, 여기서도 같은
|
|
// 길이를 세팅해 줘야 된다. - prodongi
|
|
UpdateCaption( KUITipControl::m_dwTipWindowWidth);
|
|
InvalidateWnd();
|
|
}
|
|
|
|
// 2010.05.06 - prodongi
|
|
void KUITipControl::applyEmoticonSize(std::string const& aniName, int width, int height)
|
|
{
|
|
if (!m_pCaptionPhrase)
|
|
return ;
|
|
m_pCaptionPhrase->modifyEmoticonSize(aniName, width, height);
|
|
} |