Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
CCtrlHexEdit.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_CCtrlHexEdit_H
7 #define _INC_CCtrlHexEdit_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
13 #ifdef _MFC_VER
14 #include "GrayCore/include/cHeap.h"
15 #include "../Geometry/cRectI.h"
16 
17 // Resource.
18 #define IDR_POPUP_HEX_EDIT 500
19 
20 namespace GrayLib
21 {
22  class CCtrlHexEdit : public CEdit
23  {
24  public:
25  CCtrlHexEdit();
26 
27  enum EDITMODE_TYPE
28  {
29  EDIT_NONE,
30  EDIT_ASCII,
31  EDIT_HIGH,
32  EDIT_LOW
33  };
34  // Attributes
35  public:
36  cHeapBlock m_Data;
37  int m_topindex;
38 
39  int m_currentAddress;
40  EDITMODE_TYPE m_currentMode;
41  int m_selStart;
42  int m_selEnd;
43 
44  size_t m_BytesPerRow;
45  int m_LinesPerPage;
46  BOOL m_bShowAddress;
47  BOOL m_bShowAscii;
48  BOOL m_bShowHex;
49  BOOL m_bAddressIsWide;
50 
51  BOOL m_bNoAddressChange;
52  BOOL m_bHalfPage;
53 
54  CFont m_Font;
55  int m_lineHeight;
56  int m_nullWidth;
57  BOOL m_bUpdate;
58 
59  size_t m_offHex;
60  size_t m_offAscii;
61  size_t m_offAddress;
62 
63  cPoint2i m_editPos;
64 
65  // Operations
66  public:
67  BYTE* GetDataPtr() const;
68 
69  // Overrides
70  // ClassWizard generated virtual function overrides
71  //{{AFX_VIRTUAL(CCtrlHexEdit)
72  protected:
73  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
74  //}}AFX_VIRTUAL
75 
76  // Implementation
77  public:
78  int GetData(LPBYTE p, int len);
79  void SetData(LPBYTE p, int len);
80  CSize GetSel(void);
81  void SetSel(int s, int e);
82  void SetBPR(size_t bpr);
83  void SetOptions(BOOL a, BOOL h, BOOL c, BOOL w);
84  virtual ~CCtrlHexEdit();
85 
86  // Generated message map functions
87  protected:
88  void ScrollIntoView(int p);
89  void RepositionCaret(int p);
90  void Move(int x, int y);
91  inline BOOL IsSelected(void);
92  void UpdateScrollBars(void);
93  void CreateEditCaret(void);
94  void CreateAddressCaret(void);
95  cPoint2i CalcPos(int x, int y);
96  void SelInsert(int s, int l);
97  void SelDelete(int s, int e);
98  inline void NormalizeSel(void);
99 
100  //{{AFX_MSG(CCtrlHexEdit)
101  afx_msg void OnContextMenu(CWnd*, CPoint point);
102  afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
103  afx_msg void OnKillFocus(CWnd* pNewWnd);
104  afx_msg void OnPaint();
105  afx_msg void OnSetFocus(CWnd* pOldWnd);
106  afx_msg void OnSize(UINT nType, int cx, int cy);
107  afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
108  afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
109  afx_msg UINT OnGetDlgCode();
110  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
111  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
112  afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
113  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
114  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
115  afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
116  afx_msg void OnEditClear();
117  afx_msg void OnEditCopy();
118  afx_msg void OnEditCut();
119  afx_msg void OnEditPaste();
120  afx_msg void OnEditSelectAll();
121  afx_msg void OnEditUndo();
122  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
123  //}}AFX_MSG
124 
125  DECLARE_MESSAGE_MAP()
126  };
127 };
128 #endif
129 #endif // _INC_CCtrlHexEdit_H
Definition: cMesh.h:22
cWndHandle CWnd
Definition: cWndHandle.h:669
cPoint2i CPoint
Compatible with MFC 2d CPoint,CRect.
Definition: cPoint2.h:65