DXEdit.h
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:

DirextX编程

开发平台:

Visual C++

  1. // Copyright (C) 1998-1999 DXGuide.  All Rights Reserved.
  2. // File: DXEdit.h
  3. #ifndef _DXEDIT__H
  4. #define _DXEDIT__H
  5. #if _MSC_VER >= 1000
  6. #pragma once
  7. #endif // _MSC_VER >= 1000
  8. #include "DXSpriteButton.h"
  9. class CDDTextSurface;
  10. class CDXIMDBar;
  11. class CDXEdit : public  CDXSpriteButton
  12. {
  13. public:
  14. CDXEdit(void);
  15. virtual ~CDXEdit();
  16. public:
  17. bool Create(int  nMaxLen,
  18. LPCTSTR  lpszEditFontName,
  19. int  nEditFontSize,
  20. COLORREF  clrNormalText,
  21. COLORREF clrFocusedText,
  22. COLORREF  clrBack,
  23. LPCTSTR  lpszCaretName,
  24. int  nLeft,
  25. int  nTop,
  26. LPCRECT  lprcBounds,
  27. CDXDialog*  pParent,
  28. CDSBuffer*  pSoundFocused,
  29. CDDDevice*  pDDDevice,
  30. LPCTSTR  lpszBMPName,
  31. CPackFileManager*  pPackFileManager = NULL,
  32. bool  bTrans = false,
  33. int  nHoriBlocks = DXBUTTON_NUMBER_STATE);
  34. public:
  35. virtual void OnLButtonDown(int  nMouseX, int  nMouseY);
  36. virtual bool OnKeyDown(CDIKeyState*  pKeyState);
  37. virtual void Draw(CDDSurface*  pDestSurface);
  38. public:
  39. void SetText(LPCTSTR  lpszText);
  40. CString GetText(void) const;
  41. protected:
  42. CDXSprite* m_pCaret;
  43. UINT m_uiLastBlinkTime;
  44. protected:
  45. CDXIMDBar* m_pDXIMDBar;
  46. bool m_bEnableIMD;
  47. CDDTextSurface* m_pTextSurface;
  48. CFont m_fontEdit;
  49. TCHAR* m_pData;
  50. int m_nMaxLen;
  51. int m_nCurPos;
  52. bool m_bInsertMode;
  53. COLORREF m_clrNormalText;
  54. COLORREF m_clrFocusedText;
  55. CRect m_rcText;
  56. int m_nCharWidth;
  57. int m_nCharHeight;
  58. protected:
  59. void DrawCaret(CDDSurface*  pDestSurface);
  60. bool IsDBCSTrailByte(const char*  pBase, const char*  pCur) const;
  61. void StoreChar(TCHAR  ch);
  62. void StoreDBCSChar(WORD  wDBCSChar);
  63. private:
  64. WORD m_wDBCSChar;
  65. };
  66. #endif // _DXEDIT__H