CComCtrl Class ReferenceGeneric Windows control helper functions.
More...
#include <ComCtrl.h>
List of all members.
|
Public Member Functions |
|
| CComCtrl () |
| | Default Constructor.
|
|
virtual | ~CComCtrl () |
| | Destructor.
|
Static Public Member Functions |
| static BOOL | PosWindow (HWND hWnd, LPRECT pRect, BOOL bShow=TRUE, BOOL bRepaint=TRUE) |
| | Sets the position of the specified winodw.
|
| static DWORD | ListGetItemData (HWND hWnd, int item) |
| | Gets the item data from a list control item.
|
| static int | ListGetItemByData (HWND hWnd, DWORD data) |
| | Finds a list control item by matching its item data.
|
| static long | OnScroll (HWND hCtrl, UINT nSBCode, BOOL bRedraw=TRUE, LONG lLine=10) |
| | Implements a standard response to an OnHScroll or OnVScroll message.
|
| static BOOL | EnableCtrl (HWND hWnd, UINT uCtrl, BOOL bEnable) |
| | Enables specified control.
|
| static BOOL | ListSelectSingleItem (HWND hList, int item) |
| | Selects a single item in a list control.
|
| static int | ListFindItemByText (HWND hList, int nSub, LPCTSTR pText) |
| | Finds a list item by matching the specified text.
|
| static int | ListGetItemImage (HWND hWnd, int item) |
| | Returns the items image index.
|
| static BOOL | ListSetItemImage (HWND hWnd, int item, int iImage) |
| | Sets the items image.
|
| static HTREEITEM | TreeSelectByPath (HWND hTree, LPCTSTR pPath) |
| | Selects a tree item using path.
|
| static HTREEITEM | TreeFindItemByPath (HWND hTree, LPCTSTR pPath, HTREEITEM hRoot=NULL, BOOL bDisk=FALSE) |
| | Finds a tree item using path.
|
| static HTREEITEM | TreeFindItemByName (HWND hTree, LPCTSTR pName, HTREEITEM hRoot=NULL) |
| | Searches tree items for item with specified name.
|
| static HTREEITEM | TreeInsertPath (HWND hTree, HTREEITEM hItem, LPCTSTR pPath, DWORD dwFolder, DWORD dwIcon) |
| | Inserts an item into a tree control using a path.
|
| static BOOL | TreeRefreshDirItem (HWND hTree, HTREEITEM hItem) |
| | Refreshes a tree that contains a list of disk folders.
|
| static BOOL | TreeFillSystem (HWND hTree, HTREEITEM hRoot=NULL) |
| | Fills in a tree with system file structure.
|
| static BOOL | TreeSetItemImage (HWND hTree, HTREEITEM hItem, DWORD dwImage) |
| static BOOL | TreeFillDirectory (HWND hTree, HTREEITEM hItem, LPCTSTR pPath) |
| | Fills in a tree with the specified directory.
|
| static BOOL | TreeValidateDirItem (HWND hTree, HTREEITEM hItem) |
| | Validates the folder items in a tree.
|
| static BOOL | TreeGetItemText (HWND hTree, HTREEITEM hItem, LPSTR pText, DWORD dwSize) |
| static BOOL | TreeGetItemPath (HWND hTree, HTREEITEM hItem, LPSTR pPath, DWORD dwDepth=0) |
| | Gets the full path for the specified tree item.
|
| static DWORD | TreeGetFileIcon (LPCTSTR pFile, HWND hWnd=NULL, BOOL bSmall=TRUE, BOOL bLarge=FALSE) |
| | Returns the system icon for the specified file.
|
| static DWORD | TreeGetItemData (HWND hTree, HTREEITEM hItem) |
| | Retreives the item data for a specified tree item.
|
| static HTREEITEM | TreeInsertItem (HWND hTree, HTREEITEM hParent, LPCTSTR pText, DWORD dwImage=0, DWORD dwUser=0, BOOL bExpand=FALSE, HTREEITEM hInsertAfter=TVI_LAST, UINT uMask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM) |
| | Inserts an arbitrary item into a tree control.
|
| static int | TreeGetItemImage (HWND hTree, HTREEITEM hItem) |
| | Returns the image list index for the specified tree item.
|
| static BOOL _cdecl | ListSetColumns (HWND hList, DWORD dwCols,...) |
| | Sets the columns for a specified list control.
|
| static long | ListGetFullWidth (HWND hList) |
| | Width of list control without scroll bar.
|
| static DWORD | ListGetFileIcon (LPCTSTR pFile, HWND hWnd=NULL, BOOL bSmall=TRUE, BOOL bLarge=TRUE) |
| | Gets the system icon associated with the specified file.
|
| static int | ListGetFirstSelectedItem (HWND hListCtrl) |
| | Returns the first selected item in a list control.
|
| static int | ComboSelectItemByData (HWND hWnd, DWORD data) |
| | Selects a combo box item by its data.
|
| static int | ComboGetItemByData (HWND hWnd, DWORD data) |
| | Finds an item in a combo box by user data value.
|
Detailed Description
Generic Windows control helper functions.
This class provides a set of static functions to supplement the functionality of the standard windows controls. It is not necessary to create an instance of this class as it only contains static functions.
Member Function Documentation
| int CComCtrl::ComboGetItemByData |
( |
HWND |
hWnd, |
|
|
DWORD |
data |
|
) |
[static] |
|
|
|
Finds an item in a combo box by user data value.
- Parameters:
-
| [in] | hWnd | - Handle to a combo box |
| [in] | data | - Value of data to search for |
- Returns:
- Index of item with matching data or -1 if not found.
- See also:
|
| int CComCtrl::ComboSelectItemByData |
( |
HWND |
hWnd, |
|
|
DWORD |
data |
|
) |
[static] |
|
|
|
Selects a combo box item by its data.
- Parameters:
-
| [in] | hWnd | - Handle to a combo box |
| [in] | data | - Value of data to search for |
- Returns:
- Index of the item selected or -1 if error
- See also:
|
| BOOL CComCtrl::EnableCtrl |
( |
HWND |
hWnd, |
|
|
UINT |
uCtrl, |
|
|
BOOL |
bEnable |
|
) |
[static] |
|
|
|
Enables specified control.
- Parameters:
-
| [in] | hWnd | - Handle of parent window |
| [in] | uCtrl | - Control ID |
| [in] | bEnable | - Non-zero to enable, zero to disable control |
- Returns:
- Non-zero if success
- See also:
|
| int CComCtrl::ListFindItemByText |
( |
HWND |
hList, |
|
|
int |
nSub, |
|
|
LPCTSTR |
pText |
|
) |
[static] |
|
|
|
Finds a list item by matching the specified text.
- Parameters:
-
| [in] | hList | - Handle to list control |
| [in] | nSub | - Sub item index of text to search |
| [in] | pText | - Text to search for. |
- Returns:
- Index of matching item or -1 if not found
- See also:
|
| DWORD CComCtrl::ListGetFileIcon |
( |
LPCTSTR |
pFile, |
|
|
HWND |
hWnd = NULL, |
|
|
BOOL |
bSmall = TRUE, |
|
|
BOOL |
bLarge = TRUE |
|
) |
[static] |
|
|
|
Gets the system icon associated with the specified file.
- Parameters:
-
| [in] | pFile | - Filename |
| [in] | hWnd | - Handle to list control |
| [in] | bSmall | - Set to non-zero to retreive small icon |
| [in] | bLarge | - Set to non-zero to retreive large icon |
- Returns:
- Image list index of specified file icon.
- See also:
|
| int CComCtrl::ListGetFirstSelectedItem |
( |
HWND |
hListCtrl |
) |
[static] |
|
|
|
Returns the first selected item in a list control.
- Parameters:
-
| [in] | hListCtrl | - Handle of list control |
- Returns:
- Index of the first selected item in a list control
- See also:
|
| long CComCtrl::ListGetFullWidth |
( |
HWND |
hList |
) |
[static] |
|
|
|
Width of list control without scroll bar.
- Parameters:
-
| [in] | hList | - Handle of a list control |
- Returns:
- Width of the list control without scroll bar
- See also:
|
| int CComCtrl::ListGetItemByData |
( |
HWND |
hWnd, |
|
|
DWORD |
data |
|
) |
[static] |
|
|
|
Finds a list control item by matching its item data.
- Parameters:
-
| [in] | hWnd | - Handle to list control |
| [in] | data | - item data value to find |
- Returns:
- Index of list control or -1 if failure
- See also:
|
| DWORD CComCtrl::ListGetItemData |
( |
HWND |
hWnd, |
|
|
int |
item |
|
) |
[static] |
|
|
|
Gets the item data from a list control item.
- Parameters:
-
| [in] | hWnd | - Handle to list control |
| [in] | item | - Item index |
- Returns:
- Item data
- See also:
|
| int CComCtrl::ListGetItemImage |
( |
HWND |
hWnd, |
|
|
int |
item |
|
) |
[static] |
|
|
|
Returns the items image index.
- Parameters:
-
| [in] | hWnd | - Handle to list control |
| [in] | item | - Item index |
- Returns:
- Index of the item image or -1 if failure
- See also:
|
| BOOL CComCtrl::ListSelectSingleItem |
( |
HWND |
hList, |
|
|
int |
item |
|
) |
[static] |
|
|
|
Selects a single item in a list control.
- Parameters:
-
| [in] | hList | - Handle to list control |
| [in] | item | - Index of the list item to select |
- Returns:
- Non-zero if success
- See also:
|
| BOOL _cdecl CComCtrl::ListSetColumns |
( |
HWND |
hList, |
|
|
DWORD |
dwCols, |
|
|
|
... |
|
) |
[static] |
|
|
|
Sets the columns for a specified list control.
- Parameters:
-
| [in] | hList | - Handle to list control |
| [in] | dwCols | - Number of columns |
Use:
- Returns:
- Non-zero if success
- See also:
|
| BOOL CComCtrl::ListSetItemImage |
( |
HWND |
hWnd, |
|
|
int |
item, |
|
|
int |
iImage |
|
) |
[static] |
|
|
|
Sets the items image.
- Parameters:
-
| [in] | hWnd | - Handle to list control |
| [in] | item | - Item index |
| [in] | iImage | - New image index |
- Returns:
- Non-zero if success
- See also:
|
| long CComCtrl::OnScroll |
( |
HWND |
hCtrl, |
|
|
UINT |
nSBCode, |
|
|
BOOL |
bRedraw = TRUE, |
|
|
LONG |
lLine = 10 |
|
) |
[static] |
|
|
|
Implements a standard response to an OnHScroll or OnVScroll message.
- Parameters:
-
| [in] | hCtrl | - Handle to control |
| [in] | nSBCode | - Scroll code |
| [in] | bRedraw | - Set to non zero to redraw |
| [in] | lLine | - Size of a single scroll line |
- Returns:
- New scroll position
- See also:
|
| BOOL CComCtrl::PosWindow |
( |
HWND |
hWnd, |
|
|
LPRECT |
pRect, |
|
|
BOOL |
bShow = TRUE, |
|
|
BOOL |
bRepaint = TRUE |
|
) |
[static] |
|
|
|
Sets the position of the specified winodw.
- Parameters:
-
| [in] | hWnd | - Window handle |
| [in] | pRect | - New position for window |
| [in] | bShow | - Set to non-zero to make the window visible. |
| [in] | bRepaint | - Set to non-zero to repaint the window. |
- Returns:
- Non-zero if success
- See also:
|
| BOOL CComCtrl::TreeFillDirectory |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem, |
|
|
LPCTSTR |
pPath |
|
) |
[static] |
|
|
|
Fills in a tree with the specified directory.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to root item to add directory |
| [in] | pPath | - Disk path to directory |
- Returns:
- Non-zero if success
- See also:
|
| BOOL CComCtrl::TreeFillSystem |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hRoot = NULL |
|
) |
[static] |
|
|
|
Fills in a tree with system file structure.
- Parameters:
-
| [in] | hTree | - Handle of tree control |
| [in] | hRoot | - Root item to add system file structure. |
- Returns:
- Non-zero if success
- See also:
|
| HTREEITEM CComCtrl::TreeFindItemByName |
( |
HWND |
hTree, |
|
|
LPCTSTR |
pName, |
|
|
HTREEITEM |
hRoot = NULL |
|
) |
[static] |
|
|
|
Searches tree items for item with specified name.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | pName | - Item text to search for |
| [in] | hRoot | - Root item |
- Returns:
- Handle to tree item or NULL if not found.
- See also:
|
| HTREEITEM CComCtrl::TreeFindItemByPath |
( |
HWND |
hTree, |
|
|
LPCTSTR |
pPath, |
|
|
HTREEITEM |
hRoot = NULL, |
|
|
BOOL |
bDisk = FALSE |
|
) |
[static] |
|
|
|
Finds a tree item using path.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | pPath | - Path to item |
| [in] | hRoot | - Root item path is relative to |
| [in] | bDisk | - Set to true if path contains a drive letter |
- Returns:
- Handle to tree item or NULL
- See also:
|
| DWORD CComCtrl::TreeGetFileIcon |
( |
LPCTSTR |
pFile, |
|
|
HWND |
hWnd = NULL, |
|
|
BOOL |
bSmall = TRUE, |
|
|
BOOL |
bLarge = FALSE |
|
) |
[static] |
|
|
|
Returns the system icon for the specified file.
- Parameters:
-
| [in] | pFile | - File path |
| [in] | hWnd | - Tree control |
| [in] | bSmall | - Set to non-zero to retreive the small icon |
| [in] | bLarge | - Set to non-zero to retreive the large icon |
- Returns:
- Index into the image list of the added icon
- See also:
|
| DWORD CComCtrl::TreeGetItemData |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem |
|
) |
[static] |
|
|
|
Retreives the item data for a specified tree item.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to tree item |
- Returns:
- The DWORD user data
- See also:
|
| int CComCtrl::TreeGetItemImage |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem |
|
) |
[static] |
|
|
|
Returns the image list index for the specified tree item.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to tree item |
- Returns:
- Image list index of item image.
- See also:
|
| BOOL CComCtrl::TreeGetItemPath |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem, |
|
|
LPSTR |
pPath, |
|
|
DWORD |
dwDepth = 0 |
|
) |
[static] |
|
|
|
Gets the full path for the specified tree item.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to tree item |
| [in] | pPath | - Buffer that receives the path |
| [in] | dwDepth | - Tracks the depth of the current item |
- Returns:
- Non-zero if success
- See also:
|
| BOOL CComCtrl::TreeGetItemText |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem, |
|
|
LPSTR |
pText, |
|
|
DWORD |
dwSize |
|
) |
[static] |
|
|
|
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to tree control item |
| [out] | pText | - Buffer that receives the item text. |
| [in] | dwSize | - Size of the buffer in pText |
- Returns:
- Non-zero if success
- See also:
|
| HTREEITEM CComCtrl::TreeInsertItem |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hParent, |
|
|
LPCTSTR |
pText, |
|
|
DWORD |
dwImage = 0, |
|
|
DWORD |
dwUser = 0, |
|
|
BOOL |
bExpand = FALSE, |
|
|
HTREEITEM |
hInsertAfter = TVI_LAST, |
|
|
UINT |
uMask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM |
|
) |
[static] |
|
|
|
Inserts an arbitrary item into a tree control.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hParent | - Parent tree item |
| [in] | pText | - Item text |
| [in] | dwImage | - Image list index |
| [in] | dwUser | - User value to set |
| [in] | bExpand | - Set to true if item should start expanded. |
| [in] | hInsertAfter | - Tree item to insert after |
| [in] | uMask | - Mask indicating valid arguments. |
- Returns:
- Tree item handle or NULL if error.
- See also:
|
| HTREEITEM CComCtrl::TreeInsertPath |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem, |
|
|
LPCTSTR |
pPath, |
|
|
DWORD |
dwFolder, |
|
|
DWORD |
dwIcon |
|
) |
[static] |
|
|
|
Inserts an item into a tree control using a path.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to parent item |
| [in] | pPath | - Path for item |
| [in] | dwFolder | - Folder icon offset |
| [in] | dwIcon | - Item icon offset |
- Returns:
- Handle to tree item or NULL if failure.
- See also:
|
| BOOL CComCtrl::TreeRefreshDirItem |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem |
|
) |
[static] |
|
|
|
Refreshes a tree that contains a list of disk folders.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Root item to refresh |
- Returns:
- Non-zero if success
- See also:
|
| HTREEITEM CComCtrl::TreeSelectByPath |
( |
HWND |
hTree, |
|
|
LPCTSTR |
pPath |
|
) |
[static] |
|
|
|
Selects a tree item using path.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | pPath | - Path to tree item |
pPath should be set to a standard file path such as "my/path/to/tree/item" or "\\This\\Is really\\My Path"
- Returns:
- Handle to tree item that was selected or NULL if failed.
- See also:
|
| BOOL CComCtrl::TreeSetItemImage |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem, |
|
|
DWORD |
dwImage |
|
) |
[static] |
|
|
|
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Handle to item |
| [in] | dwImage | - New image index |
- Returns:
- Non-zero if success
- See also:
|
| BOOL CComCtrl::TreeValidateDirItem |
( |
HWND |
hTree, |
|
|
HTREEITEM |
hItem |
|
) |
[static] |
|
|
|
Validates the folder items in a tree.
- Parameters:
-
| [in] | hTree | - Handle to tree control |
| [in] | hItem | - Root item to validate |
Adds new folders and removes deleted folders from tree.
- Returns:
- Non-zero if success
- See also:
|
The documentation for this class was generated from the following files:
|