199 lines
5.6 KiB
C++
199 lines
5.6 KiB
C++
#pragma once
|
|
|
|
#include "KTextRender.h"
|
|
// 2010.06.03 - prodongi
|
|
#include "KTextParser.h"
|
|
|
|
class CInput;
|
|
|
|
|
|
class CEditBoxInfo
|
|
{
|
|
public:
|
|
CEditBoxInfo(void);
|
|
~CEditBoxInfo(void);
|
|
|
|
void SetLimitation(int nLimitation, bool bBufferLimit=true);
|
|
|
|
bool OnChar(WPARAM wParam);
|
|
bool OnKeyDown(WPARAM wParam);
|
|
bool OnKeyUp(WPARAM wParam);
|
|
bool OnMouseMessage( DWORD dwMessage, int x, int y );
|
|
|
|
int FindMouseTextPos(int pos);
|
|
|
|
|
|
//int GetInputBuffer(char* text, int len);
|
|
|
|
|
|
int GetInputBuffer(wchar_t* text, int len);
|
|
// 2010.06.08 - prodongi
|
|
int GetInputBufferOri(wchar_t* text, int len);
|
|
// 2010.06.08 - prodongi
|
|
int GetCursorPos();
|
|
//int GetCursorPos() {return m_nCursorPos;}
|
|
bool IsMaxInput();
|
|
|
|
void CursorPosUpdate(int i);
|
|
/// 커서 위치가 유효한지 검사후 다시 셋팅
|
|
void CurrentCursorPos();
|
|
|
|
void ClearInputBuffer()
|
|
{
|
|
m_InputBuffer.clear();
|
|
m_nTextLen = 0;
|
|
m_nCursorPos = 1;
|
|
m_nSelectIndexBegin = 0;
|
|
m_nSelectIndexEnd = 0;
|
|
m_scrollInfo.m_inputClipBuffer.clear(); /// 2011.10.24 - prodongi
|
|
}
|
|
|
|
void AddInputBuffer(wchar_t* buffer,int len);
|
|
|
|
|
|
|
|
|
|
|
|
/// 선택 문자열을 나타내기 위한 함수
|
|
void SetSelectIndexBegin(int i);
|
|
|
|
void SetSelectIndexEnd(int i);
|
|
|
|
|
|
int GetSelectIndexBegin()
|
|
{
|
|
return m_nSelectIndexBegin;
|
|
}
|
|
|
|
int GetSelectIndexEnd()
|
|
{
|
|
return m_nSelectIndexEnd;
|
|
}
|
|
|
|
int DeleteSelectText();
|
|
|
|
void TextPaste(const wchar_t* buffer,int textlen, int pos);
|
|
std::wstring TextCut();
|
|
std::wstring TextCopy();
|
|
|
|
int FindNearSpace(int Pos, bool bRight);
|
|
void SetInputInterface(CInput* pInput)
|
|
{
|
|
m_pInput=pInput;
|
|
}
|
|
|
|
int GetInputBufferSize( bool bMemSize );
|
|
|
|
static void AddClipException( const char * pWord, const char * pLastWord );
|
|
static void SetUseClipException( bool bFlag );
|
|
static bool IsUseClipException() { return s_bUseClipException; }
|
|
|
|
void ClearExceptionList( std::string & string );
|
|
bool IsCandidate();
|
|
|
|
// 2010.06.03 - prodongi
|
|
void setMaxWidth(int width);
|
|
void setFontFlag(DWORD fontFlag);
|
|
void setFontName(std::string const& fontName);
|
|
// 2010.06.17 - prodongi
|
|
void setBold(bool bold);
|
|
// 2010.06.07 - prodongi
|
|
void setFontSize(int size);
|
|
// 2010.06.08 - prodongi
|
|
void setCaption(std::string const& caption);
|
|
void setScroll(bool scroll);
|
|
bool isScroll() const { return m_scrollInfo.m_is; }
|
|
// 2010.06.23 - prodongi
|
|
void setCompBuffer(wchar_t const* compBuffer);
|
|
// 2010.06.24 - prodongi
|
|
void setAlign(DWORD align);
|
|
void setSpacing(int spacing);
|
|
/// 2012.02.16 - prodongi
|
|
bool isEndComposing() const;
|
|
|
|
private:
|
|
std::wstring m_InputBuffer;
|
|
int m_nTextLen;
|
|
int m_nCursorPos;
|
|
int m_nSelectIndexBegin;
|
|
int m_nSelectIndexEnd;
|
|
|
|
|
|
CInput* m_pInput;
|
|
|
|
bool m_bShiftOn;
|
|
bool m_bCtrlOn;
|
|
bool m_bLButtonDown;
|
|
int m_OldCursorPos;
|
|
|
|
int m_nLimitation;
|
|
bool m_bBufferLimit;
|
|
|
|
typedef struct _exception_word_
|
|
{
|
|
std::string strWord;
|
|
std::string strLastWord;
|
|
} _EXCEPTION_WORD_;
|
|
|
|
static std::vector<_EXCEPTION_WORD_> s_ClipExceptionList;
|
|
static bool s_bUseClipException;
|
|
|
|
// 2010.06.07 - prodongi
|
|
struct sScrollInfo
|
|
{
|
|
sScrollInfo();
|
|
void syncPos(int cursorPos, std::wstring const& inputBuffer, UINT codePage);
|
|
void syncPosAtStart(int startPos, std::wstring const& inputBuffer, UINT codePage);
|
|
void syncPosAtEnd(int endPos, std::wstring const& inputBuffer, UINT codePage);
|
|
// 2010.06.23 - prodongi
|
|
void syncPosAtEndWithCompose(int endPos, std::wstring const& inputBuffer, UINT codePage);
|
|
// 2010.06.22 - prodongi
|
|
//void setInputBuffer(std::wstring const& inputBuffer);
|
|
void setInputBuffer(std::wstring const& inputBuffer, int startPos, int endPos);
|
|
int getInputBuffer(wchar_t* text, int len) const;
|
|
void setStartPos(int pos);
|
|
void setEndPos(int pos, std::wstring const& inputBuffer);
|
|
void setCursorPos(int pos);
|
|
// 2010.06.23 - prodongi
|
|
void getStringSize(std::wstring& wstr, UINT codePage, DWORD& strWidth, DWORD& strHeight);
|
|
DWORD getClipStringWidth(UINT codePage);
|
|
void modifyCursorPos(int value) { setCursorPos(m_cursorPos + value); }
|
|
/// 오리지날 커서의 위치로 스크롤된 커서의 위치를 구한다
|
|
void syncCursorPos(int cursorPos);
|
|
// 2010.06.17 - prodongi
|
|
void setBold(bool bold) { m_bold = bold; }
|
|
void setFontFlag(DWORD fontFlag) { m_bold = ((fontFlag & KTextRender::KTFLAG_BOLD) == 0) ? false : true; }
|
|
void setFontName(std::string const& fontName) { m_fontName = fontName; }
|
|
void setFontSize(int fontSize) { m_fontSize = fontSize; }
|
|
void setMaxWidth(int width) { m_maxWidth = width; }
|
|
void setIs(bool is) { m_is = is; }
|
|
// 2010.06.24 - prodongi
|
|
void setAlign(DWORD align) { m_align = align; }
|
|
void setSpacing(int spacing) { m_spacing = spacing; }
|
|
// 2010.06.22 - prodongi
|
|
void setCompBuffer(wchar_t const* compBuffer);
|
|
void trace(std::wstring const& inputBuffer, UINT codePage);
|
|
|
|
int m_startPos;
|
|
int m_endPos;
|
|
int m_maxWidth;
|
|
int m_fontSize;
|
|
int m_cursorPos;
|
|
// 2010.06.24 - prodongi
|
|
DWORD m_align;
|
|
int m_spacing;
|
|
bool m_bold;
|
|
bool m_is;
|
|
std::string m_fontName;
|
|
std::wstring m_inputClipBuffer;
|
|
// 2010.06.22 조합문자가 맨 나중에 추가 되기 때문에 조합 문자가 짤려 보인다,
|
|
// 따라서 조합문자가 있는 경우에는 미리 공간을 만들어 놓는다- prodongi
|
|
std::wstring m_compBuffer;
|
|
|
|
// <edit_scroll>를 KTextParser::_InterpretCommand에 있는 문자열에 세팅하고 갖고 올려고 하였으나,
|
|
// 문자열 리스트와 TEXT_TOKEN::TOKEN_TYPE이 맞지 않아서 그냥 세팅함..
|
|
static char* token;
|
|
};
|
|
sScrollInfo m_scrollInfo;
|
|
};
|