MFC Grid manual

CPreferences Class Reference

Provides preferences of GUI library and default implementations of various interfaces. More...

#include <Dapfor/GUI/GuiPreferences.h>

List of all members.


Public Types

enum  ThreadingMode { DirectCall, MemoryBuffer }
 Threading mode. More...

Static Public Member Functions

Threading mode
static ThreadingMode GetThreadingMode ()
 Gets a current threading mode.
static void SetThreadingMode (ThreadingMode threadingMode)
 Sets a new threading mode.
Default appearance
static CFont * GetFont ()
 Gets the default font used in grids.
static void SetFont (CFont *font)
 Sets a default font to be used in grids.
static CAppearanceGetDefaultAppearance ()
 Gets the default appearance used in grids.
static void SetDefaultAppearance (CAppearance &appearance)
 Sets a new appearance to be used in grids.
Default interfaces
static ICustomDrawGetDefaultCustomDraw ()
 Gets a default implementation of ICustomDraw interface.
static ILinePaintFormatGetDefaultLinePaintFormat ()
 Gets a default implementation of ILinePaintFormat interface.
static ICellPaintFormatGetDefaultCellPaintFormat ()
 Gets a default implementation of ICellPaintFormat interface.
static IHeaderPaintFormatGetDefaultHeaderPaintFormat ()
 Gets a default implementation of IHeaderPaintFormat interface.
static IColumnPaintFormatGetDefaultColumnPaintFormat ()
 Gets a default implementation of IColumnPaintFormat interface.
static IDragDropGetDefaultDragDrop ()
 Gets a default implementation of IDragDrop interface.
static ICopyPasteGetDefaultCopyPaste ()
 Gets a default implementation of ICopyPaste interface.
static IEditInPlaceGetDefaultEditInPlace ()
 Gets a default implementation of IEditInPlace interface.
static IKeyManagerGetDefaultKeyManager ()
 Gets a default implementation of IKeyManager interface.
static ITooltipCtrlCreateDefaultTooltipCtrl ()
 Gets a default implementation of ITooltipCtrl interface for tooltips.
static ITooltipCtrlCreateDefaultInPlaceTooltipCtrl ()
 Gets a default implementation of ITooltipCtrl interface for 'in place' tooltips.

Detailed Description

Provides preferences of GUI library and default implementations of various interfaces.

Version:
2.0.0 Initial version

Member Enumeration Documentation

enum ThreadingMode

Threading mode.

The grid is thread safe. Data updating is conducted in an asynchronous way by calling PostMessage without blocking a calling thread. I.e. UpdateRow(), UpdateItem(), UpdateDataObject() functions and coming from Common::CDataObject::ISink interface notifications don't cause the blockage of the calling thread while the messages are being processed in the grid. That's why data can be changed in any thread and notifications can be sent to the grid without preliminary synchronization with the GUI thread.

In all other functions (data inserting, deleting ...) when they are called from a thread different from the GUI thread synchronization is conducted by sending SendMessage blocking by the calling thread for the period of its processing. In order to be used in the applications making very strict demands to multithread safety the grid realizes two mechanisms that allow to meet the requirements.

1. CPreferences::DirectCall. This is the mechanism of requesting information from a data object straight at the moment of painting, sorting and filtration. All these operations are carried out only from the GUI thread. In case if the data object is functioning in a multithread application it has to protect its internal data by such synchronizing objects as critical section or mutex.

2. CPreferences::MemoryBuffer. These mechanism copies unformatted and formatted values of a data object in a calling thread and then forward them to the GUI thread. Having received these data the grid performs their drawing on the screen, filtration and sorting without accessing the data object from the GUI thread. In this case if all simultaneous accesses to the data object can be done only from one thread then it's no need to protect it by critical section.

Enumerator:
DirectCall  Common::CDataObject is protected by critical sections or mutexes.
MemoryBuffer  CGrid copies all data in the calling thread and doesn't call Common::CDataObject functions anymore.


Member Function Documentation

CPreferences::ThreadingMode GetThreadingMode (  )  [static]

Gets a current threading mode.

Returns:
Current threading mode. Default value is DirectCall.

void SetThreadingMode ( ThreadingMode  threadingMode  )  [static]

Sets a new threading mode.

It is recomended to set this parameter only once at start of the application and don't change it anymore.

Parameters:
[in] threadingMode A new threading mode.

CFont * GetFont (  )  [static]

Gets the default font used in grids.

Returns:
The font obtained by GetStockObject(DEFAULT_GUI_FONT) system call or set by SetFont() function

void SetFont ( CFont *  font  )  [static]

Sets a default font to be used in grids.

Parameters:
[in] font A new font

CAppearance & GetDefaultAppearance (  )  [static]

Gets the default appearance used in grids.

Returns:
Default appearance

void SetDefaultAppearance ( CAppearance appearance  )  [static]

Sets a new appearance to be used in grids.

Parameters:
[in] appearance A new appearance

ICustomDraw & GetDefaultCustomDraw (  )  [static]

Gets a default implementation of ICustomDraw interface.

Returns:
Instance of CCustomDraw class

ILinePaintFormat & GetDefaultLinePaintFormat (  )  [static]

Gets a default implementation of ILinePaintFormat interface.

Returns:
Instance of CLinePaintFormat class

ICellPaintFormat & GetDefaultCellPaintFormat (  )  [static]

Gets a default implementation of ICellPaintFormat interface.

Returns:
Instance of CCellPaintFormat class

IHeaderPaintFormat & GetDefaultHeaderPaintFormat (  )  [static]

Gets a default implementation of IHeaderPaintFormat interface.

Returns:
Instance of CHeaderPaintFormat class

IColumnPaintFormat & GetDefaultColumnPaintFormat (  )  [static]

Gets a default implementation of IColumnPaintFormat interface.

Returns:
Instance of CColumnPaintFormat class

IDragDrop & GetDefaultDragDrop (  )  [static]

Gets a default implementation of IDragDrop interface.

Returns:
Instance of CDragDrop class

ICopyPaste & GetDefaultCopyPaste (  )  [static]

Gets a default implementation of ICopyPaste interface.

Returns:
Instance of CCopyPaste class

IEditInPlace & GetDefaultEditInPlace (  )  [static]

Gets a default implementation of IEditInPlace interface.

Returns:
Instance of CEditInPlace class

IKeyManager & GetDefaultKeyManager (  )  [static]

Gets a default implementation of IKeyManager interface.

Returns:
Instance of CKeyManager class

ITooltipCtrl * CreateDefaultTooltipCtrl (  )  [static]

Gets a default implementation of ITooltipCtrl interface for tooltips.

Each time when the function is called it creates a new object of CTooltipCtrl type with 'true' value passed to the constructor. That means, that CGrid will handle a life time of an object and will destroy it in the destructor.

Returns:
CTooltipCtrl type object

ITooltipCtrl * CreateDefaultInPlaceTooltipCtrl (  )  [static]

Gets a default implementation of ITooltipCtrl interface for 'in place' tooltips.

Each time when the function is called it creates a new object of CInPlaceTooltipCtrl type with 'true' value passed to the constructor. That means, that CGrid will handle a life time of an object and will destroy it in the destructor.

Returns:
CInPlaceTooltipCtrl type object