CHexEditCtrl Class Reference

CHexEditCtrl Inheritance Diagram

Inheritance graph

List of all members.

Public Methods

 CHexEditCtrl ()

Protected Methods

void TextOutWithCheck (CDC *pdc, const CRect &rcInvalid, int x, int y, CString &strText)
bool EnterNumber ()
void ClearSelection ()
void DeleteSelection ()
void RecalcSelection (CPoint point)
bool IsSelectionEmpty ()
bool UpdateScrollBars ()
void InvalidateEditRect (long nEditPos)
void DeleteData (DWORD dwPos, DWORD dwCount=1)
void InsertData (DWORD dwPos, DWORD dwCount=1)
bool NormalizeEditPos ()
void ChangeEditPos (CPoint pt)
void ChangeEditPos (long dx, long dy, bool bRepaint=false)
void PlaceCaret ()
void RecalcLayout ()
 ~CHexEditCtrl ()

Protected Attributes

COleSafeArray m_data
short m_digitsInAddress
short m_digitsInData
short m_columns
short m_fontHeight
DWORD m_dwStartAddr
bool m_bDataModified
bool m_bRealShowAscii
int m_nHorzScroll
bool m_bMouseDown
bool m_bMouseMove
int m_posMouseDown
CSize m_charCountWindow
CSize m_charCountView
CSize m_cellSize
long m_selStart
long m_selEnd
long m_editPos
long m_viewPos
int m_nEditDigit
int m_addrMargin
int m_asciiMargin
int m_editMode
CRect m_rcClient
bool m_bTimer
CPoint m_prevMousePoint

Static Protected Attributes

CString m_strWindowClass
CCriticalSection _critSect


Constructor & Destructor Documentation

CHexEditCtrl::CHexEditCtrl ( )
 

Constructor

CHexEditCtrl::~CHexEditCtrl ( ) [protected]
 

Destructor


Member Function Documentation

void CHexEditCtrl::ChangeEditPos ( long dx,
long dy,
bool bRepaint = false ) [protected]
 

Set new edit position after moving caret.

Parameters:
dx   - horizontal shift of cursor (in numbers), positive - left-hand side, negative - right-hand side direction
dx   - vertical shift of cursor (in numbers), positive - downward, negative - upward direction
bRepaint   = true - always repaint the control, false - only if scrolling is nesessary

void CHexEditCtrl::ChangeEditPos ( CPoint pt ) [protected]
 

Set new edit position after mouse click.

Parameters:
pt   - mouse co-ordinates.

void CHexEditCtrl::ClearSelection ( ) [protected]
 

Clear selection.

void CHexEditCtrl::DeleteData ( DWORD dwPos,
DWORD dwCount = 1 ) [protected]
 

Delete dwCount numbers (not bytes!) from m_data, starting from dwPos.

void CHexEditCtrl::DeleteSelection ( ) [protected]
 

Delete currently selected data.

bool CHexEditCtrl::EnterNumber ( ) [protected]
 

This function is called prior to entering a new number or ascii byte. It does InsertBytes, scrolling and repainting, if nesessary.

Returns:
false, if it's impossible to insert number because of m_allowChangeSize == false, otherwise - true.

void CHexEditCtrl::InsertData ( DWORD dwPos,
DWORD dwCount = 1 ) [protected]
 

Insert dwCount numbers (not bytes!) in m_data, starting from dwPos.

void CHexEditCtrl::InvalidateEditRect ( long nEditPos ) [protected]
 

Invalidate rect occupied by number with address nEditPos.

bool CHexEditCtrl::IsSelectionEmpty ( ) [protected]
 

Returns true, if nothing is selected, and false otherwise.

bool CHexEditCtrl::NormalizeEditPos ( ) [protected]
 

Update caret position and scroll bars when m_editPos is changed.

void CHexEditCtrl::PlaceCaret ( ) [protected]
 

Calculate co-ordinates and show caret.

void CHexEditCtrl::RecalcLayout ( ) [protected]
 

Compute m_editPos, m_viewPos, margins etc. after changing control properties.

void CHexEditCtrl::RecalcSelection ( CPoint point ) [protected]
 

Update selection margins when the mouse is moving.

Parameters:
point   mouse co-ordinates.

void CHexEditCtrl::TextOutWithCheck ( CDC * pdc,
const CRect & rcInvalid,
int x,
int y,
CString & strText ) [protected]
 

This function calls pdc->TextOut ( x, y, strText ) function if text overlaps with rcInvalid.

bool CHexEditCtrl::UpdateScrollBars ( ) [protected]
 

Recalculate scroll ranges and positions of scrollbars, show or hide scroll bars, if nesessary.


Member Data Documentation

CCriticalSection CHexEditCtrl::_critSect [static, protected]
 

Lock for m_strWindowClass.

int CHexEditCtrl::m_addrMargin [protected]
 

Right margin of address field in chars.

int CHexEditCtrl::m_asciiMargin [protected]
 

Left margin of ASCII field in chars.

bool CHexEditCtrl::m_bDataModified [protected]
 

True if data is modified.

bool CHexEditCtrl::m_bMouseDown [protected]
 

True after WM_LBUTTONDOWN, false after WM_LBUTTONUP.

bool CHexEditCtrl::m_bMouseMove [protected]
 

True after WM_MOUSEMOVE, false after WM_LBUTTONUP.

bool CHexEditCtrl::m_bRealShowAscii [protected]
 

This value equals the following expression: (m_showAscii && m_digitsInData == 2).

bool CHexEditCtrl::m_bTimer [protected]
 

True if timer is active.

CSize CHexEditCtrl::m_cellSize [protected]
 

Char size in device points.

CSize CHexEditCtrl::m_charCountView [protected]
 

Total view size in chars.

CSize CHexEditCtrl::m_charCountWindow [protected]
 

Window size in chars.

short CHexEditCtrl::m_columns [protected]
 

Number of columns.

COleSafeArray CHexEditCtrl::m_data [protected]
 

Data displayed.

short CHexEditCtrl::m_digitsInAddress [protected]
 

Number of hex digits shown in address field (4 or 8).

short CHexEditCtrl::m_digitsInData [protected]
 

Number of hex digits in one number

  • 2 - BYTE view
  • 4 - WORD view
  • 8 - DWORD view

DWORD CHexEditCtrl::m_dwStartAddr [protected]
 

Starting address to display.

int CHexEditCtrl::m_editMode [protected]
 

This value is a combination of the following flags:

  • EDIT_BYTES - edit hex data mode (if not set - edit ASCII data)
  • EDIT_INSERT - insert mode (if not set - overwrite mode)

long CHexEditCtrl::m_editPos [protected]
 

Address of number being edited.

short CHexEditCtrl::m_fontHeight [protected]
 

Font height.

int CHexEditCtrl::m_nEditDigit [protected]
 

Digit being edited (0 - leftmost).

int CHexEditCtrl::m_nHorzScroll [protected]
 

Current horizontal scroll shift in chars.

int CHexEditCtrl::m_posMouseDown [protected]
 

Address of number under mouse cursor in WM_LBUTTONDOWN.

CPoint CHexEditCtrl::m_prevMousePoint [protected]
 

Co-ordinates of last point in OnMouseMove.

CRect CHexEditCtrl::m_rcClient [protected]
 

Control client rect.

long CHexEditCtrl::m_selEnd [protected]
 

Selection end (in numbers).

long CHexEditCtrl::m_selStart [protected]
 

Selection start (in numbers).

CString CHexEditCtrl::m_strWindowClass [static, protected]
 

Name of the window class.