Serialization | |
virtual void | Serialize (CArchive &ar) |
Serializes or deserializes data to/from the archive. | |
static int | GetSerializeVersion () |
Current serialization version. | |
Public Types | |
enum | Alignment { Auto, Left, Right, Center } |
Text alignment. More... | |
enum | ImageAlignment { ImageLeft, ImageRight, ImageCenter } |
Image alignment. More... | |
enum | NotificationType { NameChanged, WidthChanged, AlignmentChanged, DescriptionChanged, CellPaintFormatChanged, ColumnPaintFormatChanged, TextFormatChanged, CellImageChanged, ColumnImageChanged, VisibleChanged, EditableChanged, ColumnDelete } |
Notification type. More... | |
Public Member Functions | |
CColumn (Common::FID fid, const TString &name, int width, Alignment alignment=Auto, bool editable=false, int cellImageId=-1, int columnImageId=-1, const Common::CFormat *textFormat=0, const ICellPaintFormat *cellPaintFormat=0, const IColumnPaintFormat *columnPaintFormat=0, const TString &description=_T("")) | |
Constructor. | |
CColumn (const CColumn &column) | |
Copy constructor. | |
virtual | ~CColumn () |
Destructor. | |
CColumn & | operator= (const CColumn &) |
Get- methods | |
Common::FID | GetFid () const |
Gets field identifier. | |
const TString & | GetName () const |
Gets a column name. | |
int | GetWidth () const |
Gets a column width. | |
Alignment | GetAlignment () const |
Gets text alignment. | |
bool | IsEditable () const |
Indicates whether cells belonging to this column can be editable. | |
bool | IsVisible () const |
Indicates whether the column is visible. | |
int | GetCellImageId () const |
Gets Zero-based index of the image to draw an icon in the cell. | |
int | GetColumnImageId () const |
Gets Zero-based index of the image to draw an icon in the column. | |
const Common::CFormat * | GetTextFormat () const |
Gets custom textual format to convert the non-formatted value to the formatted string. | |
const ICellPaintFormat * | GetCellPaintFormat () const |
Gets the format to draw the cells belonged to this column. | |
const IColumnPaintFormat * | GetColumnPaintFormat () const |
Gets custom format to draw this column. | |
TString | GetDescription () const |
Gets the column description. | |
ImageAlignment | GetImageAlignement () const |
Gets image alignment in cells. | |
Set- methods | |
void | SetName (const TString &name) |
Sets a new column name. | |
bool | SetWidth (int columnWidth) |
Sets a new column width. | |
void | SetAlignment (Alignment alignment) |
Sets a new text alignment. | |
void | SetEditable (bool bEditable) |
Allows cells to be editable. | |
void | SetVisible (bool bVisible) |
Shows or hides a column. | |
void | SetCellImageId (int imageId) |
Sets a new zero-based index of the image to draw an icon in the cell. | |
void | SetColumnImageId (int imageId) |
Sets a new zero-based index of the image to draw an icon in the column. | |
const Common::CFormat * | SetTextFormat (const Common::CFormat *format) |
Sets a new textual format to convert the non-formatted value to the formatted string. | |
const ICellPaintFormat * | SetCellPaintFormat (const ICellPaintFormat *cellPaintFormat) |
Sets a new format to draw the cells belonged to this column. | |
const IColumnPaintFormat * | SetColumnPaintFormat (const IColumnPaintFormat *columnPaintFormat) |
Sets a new format to draw this column. | |
void | SetDescription (const TString &description) |
Sets a new column description. | |
void | SetImageAlignement (ImageAlignment alignment) |
Sets a new image alignment in cells. | |
Notifications | |
void | Subscribe (INotify *callBack) |
Subscribes to events. | |
void | Unsubscribe (INotify *callBack) |
Unsubscribes from events. | |
Protected Member Functions | |
void | Notify (NotificationType type) |
Sends specified notification to all subscribers. | |
Classes | |
struct | INotify |
Interface for receiving notifications about column state modification. More... |
This class contains the necessary data for displaying columns in the grid. The grid works with C++ objects of almost any class. The only condition is that these classes should inherit from Common::CDataObject. The basic application of the given interface is to give the opportunity of receiving as unformatted so formatted values through data fields identifiers. Unformatted data consists of values of basic types (long, double...) returned by data object functions. These functions can be called through integer identifiers, and then the received unformatted value can be converted into a string and displayed in the corresponding grid cell. Each column contains an identifier, and if it corresponds to a data object field identifier, value of this field is displayed in a grid cell via a system of formats. As mentioned above, data objects usually return an unformatted value that cannot be displayed directly on the screen. The way of displaying depends on text format that converts the value into a string. The type of chosen format is defined by the following: First the format is searched in a grid column. If it is not found, the search occurs in the data fields table (Common::CFieldMap) of the corresponding object and if the format is still not found, the default format returned by Common::CFormat::GetDefaultFormat() function is used. A class object of a column contains such parameters as column width, alignment of a text including an automatically defined one, depending on a field type, indexes of pictures for grid cells and for a header. A column can store graphic formats for an individual portrayal of cells within the bounds of a column, and also in a header.
It's also possible to organize a subscription for receiving notifications from CColumn class object. When internal data changes occur, all subscribers recieve notifications. When a column is inserted to a header, there is an automatic subscription to events that are later transfered in the grid. This way, when class Set-methods of a column is called, the grid updates screen contents in the appropriate way.
It is also important to note, that almost all the functions of CColumn class are thread-safe and can be called from any thread. All events are sent in such a way that during sending such synchronizing objects as critical section or mutex are not occupied.
enum Alignment |
enum ImageAlignment |
enum NotificationType |
Notification type.
NameChanged | Name of the column is changed. |
WidthChanged | Width of the column is changed. |
AlignmentChanged | Alignment type is changed. |
DescriptionChanged | Column description is changed. |
CellPaintFormatChanged | Cell painting format is changed. |
ColumnPaintFormatChanged | Column painting format is changed. |
TextFormatChanged | Text format that converts non-formatted data to strings is changed. |
CellImageChanged | Image list or index of the icon drawn in the cell is changed. |
ColumnImageChanged | Image list or index of the icon drawn in the column is changed. |
VisibleChanged | Visibility of the column is changed. |
EditableChanged | Editable flag is changed. |
ColumnDelete | Is sent in the destructor of CColumn object. |
CColumn | ( | Common::FID | fid, | |
const TString & | name, | |||
int | width, | |||
Alignment | alignment = Auto , |
|||
bool | editable = false , |
|||
int | cellImageId = -1 , |
|||
int | columnImageId = -1 , |
|||
const Common::CFormat * | textFormat = 0 , |
|||
const ICellPaintFormat * | cellPaintFormat = 0 , |
|||
const IColumnPaintFormat * | columnPaintFormat = 0 , |
|||
const TString & | description = _T("") | |||
) |
Constructor.
[in] | fid | field's identifier. |
[in] | name | column name, which is displayed on the header. |
[in] | width | Column width in pixels. |
[in] | alignment | Text alignment |
[in] | editable | Indicates that the cells belonged to this column can be editable |
[in] | cellImageId | Zero-based index of the image to draw an icon in the cell. -1 means that icon drawing in the cells is not allowed |
[in] | columnImageId | Zero-based index of the image to draw an icon in the column. -1 means that icon drawing in the column is not allowed |
[in] | textFormat | Custom textual format to convert non-formatted value to the formatted string. Can be 0. |
[in] | cellPaintFormat | Custom painting format to draw the cells belonged to this column. Can be 0. |
[in] | columnPaintFormat | Custom format to draw this column. Can be 0. |
[in] | description | Description of the column. |
Copy constructor.
[in] | column | The column to be copied. |
Common::FID GetFid | ( | ) | const |
Gets field identifier.
const TString & GetName | ( | ) | const |
Gets a column name.
int GetWidth | ( | ) | const |
Gets a column width.
CColumn::Alignment GetAlignment | ( | ) | const |
Gets text alignment.
bool IsEditable | ( | ) | const |
Indicates whether cells belonging to this column can be editable.
bool IsVisible | ( | ) | const |
Indicates whether the column is visible.
int GetCellImageId | ( | ) | const |
Gets Zero-based index of the image to draw an icon in the cell.
int GetColumnImageId | ( | ) | const |
Gets Zero-based index of the image to draw an icon in the column.
const Common::CFormat * GetTextFormat | ( | ) | const |
Gets custom textual format to convert the non-formatted value to the formatted string.
const ICellPaintFormat * GetCellPaintFormat | ( | ) | const |
Gets the format to draw the cells belonged to this column.
const IColumnPaintFormat * GetColumnPaintFormat | ( | ) | const |
Gets custom format to draw this column.
TString GetDescription | ( | ) | const |
Gets the column description.
CColumn::ImageAlignment GetImageAlignement | ( | ) | const |
Gets image alignment in cells.
void SetName | ( | const TString & | name | ) |
Sets a new column name.
If the value has been really changed, then CColumn::NameChanged notification will be raised.
[in] | name | New column name |
bool SetWidth | ( | int | columnWidth | ) |
Sets a new column width.
The width should be greater than zero. If the value has been really changed, then CColumn::WidthChanged notification will be raised.
[in] | columnWidth | New column width |
void SetAlignment | ( | Alignment | alignment | ) |
Sets a new text alignment.
If the value has been really changed, then CColumn::AlignmentChanged notification will be raised.
[in] | alignment | New text alignement. |
void SetEditable | ( | bool | bEditable | ) |
Allows cells to be editable.
If the value has been really changed, then CColumn::EditableChanged notification will be raised.
[in] | bEditable | True - allows cells to be editable. False - forbids. |
void SetVisible | ( | bool | bVisible | ) |
Shows or hides a column.
If the value has been really changed, then CColumn::VisibleChanged notification will be raised.
[in] | bVisible | True - shows the column. False - hides. |
void SetCellImageId | ( | int | imageId | ) |
Sets a new zero-based index of the image to draw an icon in the cell.
If the value has been really changed, then CColumn::CellImageChanged notification will be raised.
[in] | imageId | New zero-based index of the image to draw an icon in the cell. -1 means that icon drawing in the cells is not allowed |
void SetColumnImageId | ( | int | imageId | ) |
Sets a new zero-based index of the image to draw an icon in the column.
If the value has been really changed, then CColumn::ColumnImageChanged notification will be raised.
[in] | imageId | New zero-based index of the image to draw an icon in the column. -1 means that icon drawing in the column is not allowed |
const Common::CFormat * SetTextFormat | ( | const Common::CFormat * | format | ) |
Sets a new textual format to convert the non-formatted value to the formatted string.
If the value has been really changed, then CColumn::TextFormatChanged notification will be raised.
[in] | format | New textual format to convert non-formatted value to the formatted string |
const ICellPaintFormat * SetCellPaintFormat | ( | const ICellPaintFormat * | cellPaintFormat | ) |
Sets a new format to draw the cells belonged to this column.
If the value has been really changed, then CColumn::CellPaintFormatChanged notification will be raised.
[in] | cellPaintFormat | New format to draw the cells belonged to this column. Can be 0. |
const IColumnPaintFormat * SetColumnPaintFormat | ( | const IColumnPaintFormat * | columnPaintFormat | ) |
Sets a new format to draw this column.
If the value has been really changed, then CColumn::ColumnPaintFormatChanged notification will be raised.
[in] | columnPaintFormat | New format to draw this column. Can be 0. |
void SetDescription | ( | const TString & | description | ) |
Sets a new column description.
If the value has been really changed, then CColumn::DescriptionChanged notification will be raised.
[in] | description | New description |
void SetImageAlignement | ( | ImageAlignment | alignment | ) |
Sets a new image alignment in cells.
[in] | alignment | New image alignment |
void Subscribe | ( | INotify * | callBack | ) |
Subscribes to events.
[in] | callBack | Callback interface to be called when an event is raised. |
void Unsubscribe | ( | INotify * | callBack | ) |
Unsubscribes from events.
[in] | callBack | Callback interface to be unsubscribed from events receiving. |
void Serialize | ( | CArchive & | ar | ) | [virtual] |
Serializes or deserializes data to/from the archive.
[in] | ar | Archive to store or restore the columns data. |
int GetSerializeVersion | ( | ) | [static] |
Current serialization version.
[in] | column | The column to be copied. |
void Notify | ( | NotificationType | type | ) | [protected] |
Sends specified notification to all subscribers.
[in] | type | Notification type. |
Copyright Dapfor 2007-2009 | Generated on Wed Jul 7 03:24:43 2010 for MFCGrid by 1.5.5 |