CEditBar.h
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:2k
- #ifndef __CEDITBAR
- #define __CEDITBAR
- #include <windows.h>
- #include <ddraw.h>
- class CEditBar
- {
- private:
- HWND hwnd;
- HBITMAP hBmp;
- RECT rcEditPos;
- POINT ptCaretPos;
- SIZE sizeEdit;
- int iCaretWidth;
- int iCaretHeight;
- BOOL bEnable;
- BOOL bPassword;
- LPTSTR lpstrEdit;
- LPTSTR lpstrPassword;
- int iEditMaxLen;
- int iEditLen;
- int iEditPos;
- TCHAR cChina;
- HFONT fontOld;
- private:
- inline int SetCaretPos();
- inline void SetChar(TCHAR Char);
- inline void DeleteChar();
- inline void DeleteBack();
- inline void SetNULL();
- inline void GetLeft();
- inline void GetRight();
- protected:
- public:
- CEditBar():hBmp(NULL),lpstrEdit(NULL),lpstrPassword(NULL){}
- CEditBar(HWND hwndParent,LPTSTR lpstrBmp,int iCaretWidth,int iCaretHeight,int iMaxEditLen,LPRECT lprcRange,LPTSTR lpstr,BOOL bStar){Initiate(hwndParent,lpstrBmp,iCaretWidth,iCaretHeight,iMaxEditLen,lprcRange,lpstr,bStar);}
- ~CEditBar(){}
- int Initiate(HWND hwndParent,LPTSTR lpstrBmp,int iCaretWidth,int iCaretHeight,int iMaxEditLen,LPRECT lprcRange,LPTSTR lpstr,BOOL bStar);
- void Release();
- void Enable();
- void Disable();
- void PutChar(WPARAM wParam,int iRepeat);
- void ControlEdit(WPARAM wParam);
- int ShowEdit(IDirectDrawSurface *pddsBack,IDirectDrawSurface *pdds,LPRECT lprcCaret,HFONT font,COLORREF colorEnable,COLORREF colorDisable,BOOL bShow);
- void Clear();
- int GetEditLen(){return iEditLen;}
- int GetEditPos(){return iEditPos;}
- LPTSTR GetEdit(){return lpstrEdit;}
- BOOL IsEnable(){return bEnable;}
- BOOL IsEmpty(){return iEditLen==0;}
- };
- #endif