CEditBar.h
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:2k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. #ifndef __CEDITBAR
  2. #define __CEDITBAR
  3. #include <windows.h>
  4. #include <ddraw.h>
  5. class CEditBar
  6. {
  7. private:
  8. HWND hwnd;
  9. HBITMAP hBmp;
  10. RECT rcEditPos;
  11. POINT ptCaretPos;
  12. SIZE sizeEdit;
  13. int iCaretWidth;
  14. int iCaretHeight;
  15. BOOL bEnable;
  16. BOOL bPassword;
  17. LPTSTR lpstrEdit;
  18. LPTSTR lpstrPassword;
  19. int iEditMaxLen;
  20. int iEditLen;
  21. int iEditPos;
  22. TCHAR cChina;
  23. HFONT fontOld;
  24. private:
  25. inline int SetCaretPos();
  26. inline void SetChar(TCHAR Char);
  27. inline void DeleteChar();
  28. inline void DeleteBack();
  29. inline void SetNULL();
  30. inline void GetLeft();
  31. inline void GetRight();
  32. protected:
  33. public:
  34. CEditBar():hBmp(NULL),lpstrEdit(NULL),lpstrPassword(NULL){}
  35. 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);}
  36. ~CEditBar(){}
  37. int Initiate(HWND hwndParent,LPTSTR lpstrBmp,int iCaretWidth,int iCaretHeight,int iMaxEditLen,LPRECT lprcRange,LPTSTR lpstr,BOOL bStar);
  38. void Release();
  39. void Enable();
  40. void Disable();
  41. void PutChar(WPARAM wParam,int iRepeat);
  42. void ControlEdit(WPARAM wParam);
  43. int ShowEdit(IDirectDrawSurface *pddsBack,IDirectDrawSurface *pdds,LPRECT lprcCaret,HFONT font,COLORREF colorEnable,COLORREF colorDisable,BOOL bShow);
  44. void Clear();
  45. int GetEditLen(){return iEditLen;}
  46. int GetEditPos(){return iEditPos;}
  47. LPTSTR GetEdit(){return lpstrEdit;}
  48. BOOL IsEnable(){return bEnable;}
  49. BOOL IsEmpty(){return iEditLen==0;}
  50. };
  51. #endif