MFC Grid manual

CKeyManager Class Reference

Default implementation of IKeyManager interface. More...

#include <Dapfor/GUI/KeyManager.h>

Inheritance diagram for CKeyManager:

IKeyManager IAutoDelete

List of all members.


Public Member Functions

 CKeyManager (bool autoDelete=false)
 Constructor.
 ~CKeyManager ()
 Destructor.
virtual BOOL OnKeyDown (CGrid &grid, UINT nChar, UINT nRepCnt, UINT nFlags)
 Called when a non-system key is pressed.
virtual BOOL OnKeyUp (CGrid &grid, UINT nChar, UINT nRepCnt, UINT nFlags)
 Called when a non-system key is released.
virtual void NavigateKeyUp (CGrid &grid, bool bShift, bool bCtrl)
 Moves the focus up and scrolls down one line according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyDown (CGrid &grid, bool bShift, bool bCtrl)
 Moves the focus down and scrolls up one line according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyPageUp (CGrid &grid, bool bShift, bool bCtrl)
 Moves the focus up and scrolls down one page according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyPageDown (CGrid &grid, bool bShift, bool bCtrl)
 Moves the focus down and scrolls up one page according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyHome (CGrid &grid, bool bShift, bool bCtrl)
 Focuses the first line in the fixed or scrollable context according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyEnd (CGrid &grid, bool bShift, bool bCtrl)
 Focuses the last line in the fixed or scrollable context according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyLeft (CGrid &grid, bool bShift, bool bCtrl)
 Collapses lines and Moves the focus up according to specified values of bShift and bCtrl and navigation settings.
virtual void NavigateKeyRight (CGrid &grid, bool bShift, bool bCtrl)
 Expands lines and Moves the focus down according to specified values of bShift and bCtrl and navigation settings.
virtual void OnEscape (CGrid &grid)
 Handles 'Escape' key pressing.
virtual void OnReturn (CGrid &grid)
 Handles 'Return' key pressing.
virtual void OnSelectAll (CGrid &grid)
 Handles 'Ctri+A' key pressing. Selects all contents of the grid.
virtual void OnCopySelection (CGrid &grid)
 Handles 'Ctri+C' key pressing. Copies selection to the clipboard.
virtual void OnCutSelection (CGrid &grid)
 Handles 'Ctri+X' key pressing. Cuts selection to the clipboard.
virtual void OnPasteSelection (CGrid &grid)
 Handles 'Ctri+V' key pressing. Copies clipboard content to the grid.
virtual bool AutoDelete () const
 IAutoDelete implementation. Returns the value, passed in the constructor.

Detailed Description

Default implementation of IKeyManager interface.

The given manager processes the following events:

Pressing Shift key together with KeyUp KeyDown inverts selection multiple lines. The manager can be used for navigation and selection in either one or both contexts.


Constructor & Destructor Documentation

CKeyManager ( bool  autoDelete = false  ) 

Constructor.

Parameters:
[in] autoDelete Value indicating that CGrid manages a life cycle of the manager. True - CGrid will destroy the manager in its own destructor. False - it is a responsivity of the programmer to destroy the manager.


Member Function Documentation

BOOL OnKeyDown ( CGrid grid,
UINT  nChar,
UINT  nRepCnt,
UINT  nFlags 
) [virtual]

Called when a non-system key is pressed.

Parameters:
[in] grid The grid.
[in] nChar Specifies a virtual key code of a given key. For a list of standard virtual key codes, see Winuser.h
[in] nRepCnt Repeat a count (a number of times the keystroke is repeated as a result of the user holding down the key).
[in] nFlags Specifies a scan code, key-transition code, previous key state, and context code.
Returns:
TRUE if key pressing has been handled. Otherwise FALSE.

Implements IKeyManager.

BOOL OnKeyUp ( CGrid grid,
UINT  nChar,
UINT  nRepCnt,
UINT  nFlags 
) [virtual]

Called when a non-system key is released.

Parameters:
[in] grid The grid.
[in] nChar Specifies a virtual key code of a given key. For a list of standard virtual key codes, see Winuser.h
[in] nRepCnt Repeat a count (a number of times the keystroke is repeated as a result of the user holding down the key).
[in] nFlags Specifies a scan code, key-transition code, previous key state, and context code.
Returns:
TRUE if key releasing has been handled. Otherwise FALSE.

Implements IKeyManager.

void NavigateKeyUp ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Moves the focus up and scrolls down one line according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyDown ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Moves the focus down and scrolls up one line according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyPageUp ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Moves the focus up and scrolls down one page according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyPageDown ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Moves the focus down and scrolls up one page according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyHome ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Focuses the first line in the fixed or scrollable context according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyEnd ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Focuses the last line in the fixed or scrollable context according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyLeft ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Collapses lines and Moves the focus up according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void NavigateKeyRight ( CGrid grid,
bool  bShift,
bool  bCtrl 
) [virtual]

Expands lines and Moves the focus down according to specified values of bShift and bCtrl and navigation settings.

Parameters:
[in] grid The grid where a focus and selection are changed.
[in] bShift Indicates whether the shift button is pressed
[in] bCtrl Indicates whether the control button is pressed

Implements IKeyManager.

void OnEscape ( CGrid grid  )  [virtual]

Handles 'Escape' key pressing.

Parameters:
[in] grid The grid

void OnReturn ( CGrid grid  )  [virtual]

Handles 'Return' key pressing.

Collapses or expandes a focused line.

Parameters:
[in] grid The grid

void OnSelectAll ( CGrid grid  )  [virtual]

Handles 'Ctri+A' key pressing. Selects all contents of the grid.

Calls CGrid::SelectAll() function.

Parameters:
[in] grid The grid

void OnCopySelection ( CGrid grid  )  [virtual]

Handles 'Ctri+C' key pressing. Copies selection to the clipboard.

Calls CGrid::Copy() function.

Parameters:
[in] grid The grid

void OnCutSelection ( CGrid grid  )  [virtual]

Handles 'Ctri+X' key pressing. Cuts selection to the clipboard.

Calls CGrid::Cut() function.

Parameters:
[in] grid The grid

void OnPasteSelection ( CGrid grid  )  [virtual]

Handles 'Ctri+V' key pressing. Copies clipboard content to the grid.

Calls CGrid::Paste() function.

Parameters:
[in] grid The grid

bool AutoDelete (  )  const [virtual]

IAutoDelete implementation. Returns the value, passed in the constructor.

Returns:
value, passed in the constructor.

Implements IAutoDelete.