📄 editctrl.h
字号:
#include "stdafx.h"
#include "DrawEx.h"
#include "MCFonts.h"
#include <list>
#ifndef _EDITBOX_CTRL_
#define _EDITBOX_CTRL_
// Define constant for CIMEEdit
#define BUFFERSIZE 256
#define WCHARSIZE 2
// Define language ID
#define LID_TRADITIONAL_CHINESE 0x0404
#define LID_JAPANESE 0x0411
#define LID_KOREAN 0x0412
#define LID_SIMPLIFIED_CHINESE 0x0804
//define custom message
#define WM_SETINPUTLANG WM_USER + 1
#define WM_SETMODE WM_USER + 2
#define WM_RESETMODE WM_USER + 3
#define WM_TOGGLE WM_USER + 4
//=============================================
//Edit Box class
class CEditBoxCtrl
{
public:
CEditBoxCtrl(LPDIRECT3DDEVICE9 m_pDevice, CDrawEx *pDraw);
~CEditBoxCtrl();
HRESULT CreateEditBox(int iX, int iY, int Width, int Height, DWORD Id,int Max,bool Enable = true, char *fnameBG = NULL, char* fnameNULL = NULL);
void Release();
void Draw_EditBox(int x = 0, int y = 0, int CaretWidth = 2, int CatetHeight = 12, DWORD dwCaretColor = D3DCOLOR_ARGB(355,0,0,0));
void Reset();
void LButtonDown();
void LButtonUp();
void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
void SetFontColor(DWORD color){m_dwFontColor = color;}
void setWindowPos(int iX, int iY, int Width, int Height);
void setPassWord(bool bPass){ bPassWord = bPass;};
bool Check_Mouse_Focus(int x, int y);
void DrawMyCaret(int x, int y, int width, int height, DWORD color);
void ShowMyCaret() {if(m_bEnable == true)
bShowCaret = true;}
void HideMyCaret() {bShowCaret = false;}
//================================================
//metaljack 眠啊
void SetID(DWORD ID){m_dwID = ID;}
DWORD GetID(){return m_dwID;}
void Add_Pos(int x, int y); // 器瘤记 焊沥 累诀捞促. 促捞倔肺弊冠胶俊 器窃瞪锭 茄锅静牢促.
void Set_TextItem(char* str);
void Set_EditBoxEnable(bool Enable){m_bEnable = Enable;}
bool Get_EditBoxEnable(){return m_bEnable; }
bool Get_EditBoxState(){return bShowCaret; }
virtual LRESULT InputProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
protected:
bool MouseCheck(POINT pt);
protected:
int m_xEndPos; // End position of buffer
int m_xInsertPos; // Insert position of buffer
int m_nComSize; // Composition string size
DWORD m_dwProperty; // Property of IME
UINT m_nCodePage; // Code page
BYTE m_nCharSet; // Character set
BOOL m_fShowInvert; // If true, sample show invert string
BOOL m_fStat; // If true, IME composite string //茄臂 炼钦吝捞扼绰 舵狼 阂赴函荐.
public:
wchar_t m_szWFontName[50]; // Font name in UNICODE
char m_szMBFontName[50]; // Font name in multibyte
int m_nLanguage; // Internal index of language
BOOL m_fIsNT; // If true, NT. Or Win9X
char SendString[BUFFERSIZE+1];
char TempPrintstr[BUFFERSIZE+1];
char m_szBuffer[BUFFERSIZE+1]; // Buffer for input string
char m_szComStr[BUFFERSIZE+1]; // Buffer for composition string
char m_szBackup[BUFFERSIZE+1]; // Buffer for backup last string
DWORD m_dwID;
// Operations
public:
//皋矫瘤甫 罐酒辑 贸府茄促.
BOOL OnImeComposition(HWND hWnd, UINT wParam,LONG lParam); //茄臂 炼钦吝捞促.
void OnImeStartComposition(HWND hWnd, UINT wParam,LONG lParam); //茄臂 炼钦阑 矫累茄促.
void OnImeEndComposition(HWND hWnd, UINT wParam,LONG lParam); //茄臂 炼钦阑 场辰促.
//=======================================================================
int InsertCompStr();
void SetFont(HKL hKeyboardLayout, LPCTSTR szSelectedFont); //虐焊靛狼 饭捞酒眶苞 攫绢阑 备茄促.
void ClearBuffer(); //巩磊凯 滚欺甫 瘤款促.
int GetCombinedCharLength(int);
void SetCompositionWindowPos();
public:
SPRITE_TEXTURE* m_pBackTexture;
SPRITE_TEXTURE* m_pTextureNULL;
CMcFonts *m_pFonts;
int m_iMax; //嘛绢临荐 乐绰 沥秦柳 byte 荐
int m_iMaxByte; //沥秦柳 康开俊 弥措茄 嘛阑荐 乐绰 BYTE.
bool bShowCaret; //某返阑 焊咯临瘤 救 焊咯临瘤 => 巩磊甫 涝仿 矫懦荐 乐绰瘤 绝绰瘤.
bool m_bCaretBlink; //某返捞 喉傅农登绰 鸥烙
bool bPassWord; //菩胶况靛
DWORD m_dwFontColor; //迄飘 祸彬.
bool m_bParent; //何葛啊 乐绰瘤 绝绰瘤.. 促捞倔肺弊 冠胶俊 加秦乐绰瘤 咯何
bool m_bEnable;
// bool m_bState;
protected:
LPDIRECT3DDEVICE9 m_pd3DDevice;
CDrawEx *m_pDraw;
int iPosX;
int iPosY;
int iWidth;
int iHeight;
int m_iPosX;
int m_iPosY;
int m_iPosImageX;
int m_iposImageY;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -