|
|
|
|
|
SFTTREE_CELL |
The SFTTREE_CELL structure is used with GetCellInfo and SetCellInfo to retrieve and set cell attributes and as part of the SFTTREE_ITEM structure (for a virtual data source).
typedef struct tagSftTreeCELL {
COLORREF colorBg; // foreground color (SFTTREE_NOCOLOR if default wanted)
COLORREF colorFg; // background color (SFTTREE_NOCOLOR if default wanted)
COLORREF colorBgSel; // foreground color if selected (SFTTREE_NOCOLOR if default wanted)
COLORREF colorFgSel; // background color if selected (SFTTREE_NOCOLOR if default wanted)
HFONT hFont; // font handle (NULL if default wanted)
#if defined(SFTTREE_OBSOLETE_4)
HBITMAP hBmp; // cell bitmap (NULL if none wanted)
#else
HBITMAP obsoletehBmp; // not used
#endif
short flag; // misc flag
#define SFTTREE_BMP_LEFT 0 // bitmap alignment
#define SFTTREE_BMP_CENTER 0x01
#define SFTTREE_BMP_RIGHT 0x02
#define SFTTREE_BMP_VCENTER 0x10
#define SFTTREE_BMP_TOP 0x20
#define SFTTREE_BMP_BOTTOM 0x40
#define SFTTREE_TEXT_LEFT 0x0100 // text alignment, overrides column default
#define SFTTREE_TEXT_CENTER 0x0200
#define SFTTREE_TEXT_RIGHT 0x0400
#define SFTTREE_TEXT_VCENTER 0x0800
#define SFTTREE_TEXT_TOP 0x1000
#define SFTTREE_TEXT_BOTTOM 0x2000
short flag2;
#define SFTTREECELL_IGNORE 1 // ignored item (for optimal width calculation)
#define SFTTREECELL_EDITIGNORE 2 // ignored item during cell editing
#define SFTTREECELL_CONTENT_KEEPSIZE 0x04 // keep content window size (requires variable height tree control)
#define SFTTREECELL_CONTENT_DISABLE 0x08 // don't enable/disable content window
SFTTREE_DWORD_PTR cellData; // cell user data
HWND hwndCell; // cell is using this content window
SFT_PICTURE CellPicture1; // cell picture
} SFTTREE_CELL, * LPSFTTREE_CELL;
typedef const SFTTREE_CELL * LPCSFTTREE_CELL;
Members
The background color used to draw the cell when the item is not selected. Specify SFTTREE_NOCOLOR to use the default background color.
The foreground color used to draw the cell text when the item is not selected. Specify SFTTREE_NOCOLOR to use the default text color.
The background color used to draw the cell when the item is selected. Specify SFTTREE_NOCOLOR to use the default background color.
The foreground color used to draw the cell text when the item is selected. Specify SFTTREE_NOCOLOR to use the default text color.
The font used to draw the cell text. If NULL is specified, the tree control's default font is used. The default font can be defined using the WM_SETFONT message or the CWnd::SetFont function.
A bitmap handle defining the cell picture, displayed next to the cell text. Specify NULL to omit the cell picture. This member is provided for compatibility with older SftTree/DLL versions. The CellPicture1 member should be used instead. This member is only accessible if the preprocessor symbol SFTTREE_OBSOLETE_4 is defined.
The cell picture position, relative to the cell text. This member is ignored if CellPicture1 is empty and hBmp is NULL.
One value of each of the following tables can be combined and assigned to the flag member.
|
flag |
Horizontal cell picture alignment |
|
SFTTREE_BMP_LEFT |
The cell picture is displayed to the left of the cell text. If no horizontal cell picture alignment value is specified, SFTTREE_BMP_LEFT is assumed. |
|
SFTTREE_BMP_CENTER |
The cell picture is displayed in the center of the cell, the cell text is not shown. |
|
SFTTREE_BMP_RIGHT |
The cell picture is displayed to the right of the cell text. |
|
flag |
Vertical cell picture alignment |
|
SFTTREE_BMP_VCENTER |
The cell picture is vertically centered within the cell. If no vertical cell picture alignment value is specified, SFTTREE_BMP_VCENTER is assumed. |
|
SFTTREE_BMP_TOP |
The cell picture is vertically aligned with the top of the cell. |
|
SFTTREE_BMP_BOTTOM |
The cell picture is vertically aligned with the bottom of the cell. |
|
flag |
Horizontal cell text alignment |
|
not specified |
If no horizontal cell text alignment is specified, the default defined using the style member of the SFTTREE_COLUMN_EX structure of the cell's column applies. |
|
SFTTREE_TEXT_LEFT |
The cell text is left aligned within the cell. |
|
SFTTREE_TEXT_CENTER |
The cell text is centered within the cell. |
|
SFTTREE_TEXT_RIGHT |
The cell text is right aligned within the cell. |
|
flag |
Vertical cell text alignment |
|
not specified |
If no vertical cell text alignment is specified, the default defined using the style member of the SFTTREE_COLUMN_EX structure of the cell's column applies. |
|
SFTTREE_TEXT_TOP |
The cell text is aligned with the top of the cell. |
|
SFTTREE_TEXT_VCENTER |
The cell text is vertically centered within the cell. |
|
SFTTREE_TEXT_BOTTOM |
The cell text is aligned with the bottom of the cell. |
Cell attributes. The following values can be combined:
|
flag2 |
Cell attributes |
|
0 |
No additional attributes. |
|
SFTTREECELL_IGNORE |
The cell is ignored for optimal column width calculation using MakeColumnOptimal and CalcOptimalColumnWidth. This attribute is typically used if certain cell contents are known to be unusually long, which would make a column too wide. |
|
SFTTREECELL_EDITIGNORE |
The cell is ignored during cell editing. This attribute can be inspected by an application during cell editing and cell navigation to skip certain non-editable cells. While this attribute is not otherwise used by the tree control, it can be used and inspected by the application, simplifying cell editing. |
|
SFTTREECELL_CONTENT_KEEPSIZE |
The original size of the content window is preserved and the cell size adjusts accordingly. While a column can still be smaller or larger than the content window width, the content window is not resized, it is merely clipped. Without SFTTREECELL_CONTENT_KEEPSIZE, a content window is resized in height and width to fit within the cell. SFTTREECELL_CONTENT_KEEPSIZE has no effect in a fixed height tree control. |
|
SFTTREECELL_CONTENT_DISABLE |
A content window is normally enabled and disabled as it is made visible or hidden. When SFTTREECELL_CONTENT_DISABLE is specified, the content window is always disabled, even if it is visible. |
Can be used by the application to store an application-defined value.
Defines the content window to be displayed by this cell. Specify NULL to omit the content window.
Defines the cell picture displayed next to the cell text. If the hBmp member defines a picture, CellPicture1 is ignored.
Comments
The SFTTREE_CELL structure is used with GetCellInfo and SetCellInfo to retrieve and set cell attributes and as part of the SFTTREE_ITEM structure (for a virtual data source).
An RGB value or a GetSysColor index value can be specified for all color values. If a color index is used, the high-order bit must be set (e.g., COLOR_WINDOW | 0x80000000L).
A cell may have an associated cell picture without the picture component actually being visible. The cell picture doesn't become visible until the cell picture size has been registered using SetCellInfo by setting the index member of the SFTTREE_CELLINFOPARM structure to -1. Only one picture is used to register the picture size. After registering the picture size, any number of pictures may be used.
In a fixed height tree control, all cell pictures used for all cells must be the same size. In a variable height tree control, cell pictures can be of varying sizes. The (largest) cell picture size must be registered using SetCellInfo. A new picture size can be registered at any time, but all cell pictures in use must be replaced by pictures of the new size (or smaller).
Fonts are owned by the application and the associated font handles have to remain valid as long as the tree control uses them. Fonts have to be deleted using DeleteObject once they are no longer needed.
Cell text can be retrieved using GetText and modified using SetText.
See Also C/C++ API | Categories | Notifications