94 lines
2.5 KiB
C++
94 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "KTypes.h"
|
|
//#include <string>
|
|
//#include <vector>
|
|
|
|
struct KTextEmoticon
|
|
{
|
|
public:
|
|
KTextEmoticon( int nType, int nOffsetX, int nOffsetY, int nWidth, int nHeight, const char* szAniName, const char* szSprName, float fZPos );
|
|
virtual ~KTextEmoticon();
|
|
|
|
enum EMOTICON_TYPE
|
|
{
|
|
TYPE_NORMAL = 0,
|
|
TYPE_HARMFUL,
|
|
};
|
|
|
|
bool Initialize( bool bStaticSize );
|
|
void SetOffset( int nX, int nY );
|
|
void Render( class KViewportObject* pViewport, bool bIsFront );
|
|
const int GetWidth() const { return m_nWidth; };
|
|
const int GetHeight() const { return m_nHeight; };
|
|
|
|
/// 2010.05.06 - prodongi
|
|
void setSize(std::string const& aniName, int width, int height);
|
|
|
|
private:
|
|
int m_nType;
|
|
int m_nOffsetX;
|
|
int m_nOffsetY;
|
|
int m_nWidth;
|
|
int m_nHeight;
|
|
KRect m_rcRegion;
|
|
|
|
float m_fZPos;
|
|
|
|
std::string m_strAniName;
|
|
std::string m_strSprName;
|
|
|
|
class KSpritePrimitive* m_pPrimitive;
|
|
};
|
|
|
|
typedef struct _EMOTICON_DATA
|
|
{
|
|
std::string strFilter;
|
|
std::string strAniName;
|
|
} EMOTICON_DATA;
|
|
|
|
|
|
class KTextEmoticonRender
|
|
{
|
|
public:
|
|
KTextEmoticonRender() : m_bStaticSize(true) {};
|
|
~KTextEmoticonRender();
|
|
|
|
public:
|
|
void Render( class KViewportObject* pViewport, bool bIsFront = false );
|
|
|
|
/// emoticon 있는지 검사해서 있으면 생성해준다.
|
|
void CheckEmoticon( std::string & strText, const char* szFontName, int nFontSize, DWORD dwFlag, DWORD & dwWidth, DWORD & dwHeight, bool bStaticSize, float fZPos );
|
|
static const char* GetExistFilter( const char* szText );
|
|
void CheckFiltering( const char* szFilter, std::string & strText, const char* szFontName, int nFontSize, DWORD dwFlag, DWORD & dwWidth, DWORD & dwHeight, float fZPos );
|
|
|
|
/// offset : text 시작 위치
|
|
void SetOffset( int nOffsetX, int nOffsetY );
|
|
|
|
/// emoticon 제외한 텍스트 길이 리턴
|
|
static const int GetTextSize( const char* szBuf );
|
|
static void GetText( std::string & strBuf );
|
|
|
|
static void SetSprName( const char * pSprName );
|
|
static void AddFilter( const char * pFilter, const char * pAniName );
|
|
static void ClearFilter();
|
|
|
|
static bool FindFilter( std::string & strText );
|
|
|
|
/// 2010.05.06 - prodongi
|
|
void modifyEmoticonSize(std::string const& aniName, int width, int height);
|
|
|
|
protected:
|
|
void Clear();
|
|
|
|
private:
|
|
/** MIMI 2005/08/16
|
|
edit box 는 고정된 크기(라인과 폰트크기)를 가지고 static control 은 이모티콘 원본 리소스 크기를 가진다. */
|
|
bool m_bStaticSize;
|
|
|
|
static std::vector< EMOTICON_DATA > s_vFilterList;
|
|
static std::string s_strSprName;
|
|
|
|
std::vector<KTextEmoticon*> m_vecEmoticonList;
|
|
|
|
}; |