home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-28 | 48.6 KB | 1,302 lines |
- /*
- Copyright (c) 1992, 1993 by Barking Spider Software, Inc. All rights reserved
-
- Filename...: bslist.h
-
- Version....: 1.0
-
- Language...: Microsoft C/C++ 7.0
-
- Model......: Small
-
- Environment: Microsoft Windows 3.1
-
- Description: This header file describes the exported APIs supported by
- the list control. For a description of error codes,
- notification messages, structures, etc. reference the header
- file BSCORE.H.
- Notes......:
-
- History....:
-
- Author.....: Peter J. Kaufman
-
- */
-
- /****************************************************************************/
- /* LIST CONTROL EXPORTED APIs */
- /****************************************************************************/
- /*
- BSL_AddListItems ( )
- BSL_ChangeListItemText ( )
- BSL_ChangeUserData ( )
- BSL_ConvertPointToSelectNotif ( )
- BSL_CreateListBox ( )
- BSL_DeleteListItem ( )
- BSL_DragAcceptFiles ( )
- BSL_GetCurSel ( )
- BSL_GetListItem ( )
- BSL_GetListItemCount ( )
- BSL_GetVersion ( )
- BSL_InsertListItems ( )
- BSL_ResetList ( )
- BSL_SetBitmap ( )
- BSL_SetBitmapAndActiveBitmap ( )
- BSL_SetBitmapSpace ( )
- BSL_SetCurSel ( )
- BSL_SetDeleteListItemCallBack ( )
- BSL_SetFont ( )
- BSL_SetIcon ( )
- BSL_SetXSpaceBeforeText ( )
- */
-
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_AddListItems ( HWND hwndList,
- WORD wNodeDefCount,
- LP_TREE_NODE_DEF lpTreeNodeDef);
- Description:
-
- This API allows the application to add one or more list items to the given
- list.
-
- Arguments:
-
- HWND hwndList:
-
- This argument indicates which list control will create the new
- list items and append them to the end of the list. This is the window
- handle that was returned to the application after calling
- BSL_CreateListBox ( ). BSL_CreateListBox ( ) creates an empty list.
-
- WORD wNodeDefCount:
-
- wNodeDefCount contains the number of list items to be added. In other
- words, wNodeDefCount is the number of TREE_NODE_DEF array elements in
- the TREE_NODE_DEF array pointed to by lpTreeNodeDef.
-
- LP_TREE_NODE_DEF lpTreeNodeDef:
-
- lpTreeNodeDef is a pointer to an array of TREE_NODE_DEFs that describe
- each of the list items to be added.
-
- If the list already has list items, then the new list items are
- appended to end of the list.
-
- While adding list items to the list control, the list control could
- receive either a memory allocation failure or realize that the total
- number of list items in the list has exceeded the maximum number of
- list items allowed. If either of these conditions occur then the
- list items that were added to the list control prior to the
- problem, are NOT removed from the list. The application will receive
- error messages if there is a memory allocation problem or the maximum
- number of list items is exceeded. The application can determine what
- list items did not make it into the list by looking at the value
- of the lpTreeNode member of each TREE_NODE_DEF array starting from the
- beginning of the array. When a TREE_NODE_DEF's lpTreeNode member is
- found that has a value of zero, then that TREE_NODE_DEF and all
- subsequent TREE_NODE_DEFs in the TREE_NODE_DEF array were not used to
- create new list items.
-
- Comments:
-
- Where do TREE_NODE pointers come from? There are several ways to retrieve
- TREE_NODE pointers.
-
- 1) TREE_NODE pointers are supplied to the application by the list control.
- They are returned to the application via the lpTreeNode member of the
- TREE_NODE_DEF structure, when the application successfully calls
- BSL__AddListItems ( ) or BSL_InsertListItems ( ), which add list items to
- the given list. The application can store these TREE_NODE pointers for
- future references. Via the TREE_NODE pointers, the index where the
- list item is position in the list can be accessed.
-
- 2) The application will receive the pointer to the list control owned
- SELECT_NOTIF structure as the result of a notification of an event.
- From the SELECT_NOTIF structure, the TREE_NODE pointer to the list item
- involved in the event is available. Below is a list of notifications
- with the associated events:
-
- Notification Event
-
- WM_BST_SELECT_NOTIF
- - Single click left mouse button while over a
- list item.
- - Select list item with up or down arrow.
- - Select list item with page up or page down
- key.
- - Select list item with home or end key.
- - Select list item with Ctrl Up or Ctrl Down.
-
- WM_BST_SELECT_NOTIF_DBLCLK
- - Double click left mouse button while over
- list item. Sends WM_BST_SELECT_NOTIF on
- first click.
- - Hit carriage return while a list item is
- selected.
- - '+' key.
- WM_BST_DODRAG
- - Depress the left mouse button over a list
- item and while continuing to hold down the
- left button, move the mouse a predetermined
- distance.
-
-
- 3) Calling BSL_GetListItem ( ) will return the TREE_NODE pointer of the
- list item specified by the given index.
-
- 4) Calling BSL_ConvertPointToSelectNotif ( ) will return a pointer to
- the list control owned SELECT_NOTIF structure which in turn, the pointer
- to the list item that lies under the coordinate supplied by the
- application can be retrieved.
-
- 5) BSL_SetDeleteNodeCallBack ( ) allows the application to register a
- callback with the given list control. The callback will be called
- everytime a list item is deleted from the list. List items can be
- deleted from the list with two list control export APIs or with the
- Windows API DestroyWindow ( ). The two list control exported APIs are:
-
- BSL_DeleteListItem ( )
- BSL_ResetList ( )
-
- Return Codes:
-
- BST_NO_ERROR
- BST_ERR_MEMORY_ALLOC_FAILED
- BST_ERR_LEVEL_LIMIT_EXCEEDED
- BST_ERR_TOO_MANY_NODES
- BST_ERR_ONLY_ONE_ROOT_ALLOWED
- BST_ERR_INVALID_PARENT_FOR_INSERTION
- BSL_ERR_INVALID_INDEX
- */
-
-
- short _export FAR PASCAL BSL_AddListItems ( HWND hwndList,
- WORD wNodeDefCount,
- LP_TREE_NODE_DEF lpTreeNodeDef);
-
-
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_ChangeListItemText( HWND hwndList,
- WORD wIndex,
- WORD wTextLength,
- LPSTR lpszText);
-
- Description:
-
- This API allows the application to change the text of the list item
- which is indexed by the argument wIndex.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that contains the list item
- that will have the text changed.
-
- WORD wIndex:
-
- Specifies the zero based index of the list item that will be assigned
- the given text.
-
- WORD wTextLength:
-
- This argument states the number of characters for the list control
- to display as text for the given list item, indexed by wIndex. The
- source of the list item text is the lpszText argument described below.
- Normally, the application does a lstrlen ( ) on lpszText and assigns
- the result to wTextLength. But there may be cases that the string
- pointed to by lpszText is just too long and fewer characters are
- required.
-
- There is a special attribute of wTextLength in which the most
- significant bit or the sign bit acts as a flag. Depending on how
- this bit is set there are two ways to handle text in a list item.
- In both cases, the application passes a long pointer to the text
- via the lpszText argument. The two methods are,
-
- 1) If the sign bit of wTextLength is set to 1, then the pointer
- in lpszText points to memory owned by the application and is
- guaranteed not to change (be deleted or moved). This signals the
- list control to use the supplied string pointer to display the text and
- not worry about allocating, copying, and freeing its memory.
-
- 2) If the sign bit of wTextLength is set to 0, then the list control
- allocates wTextLength + 1 worth of memory. The list control then
- copies wTextLength worth of characters from the string pointed to by
- the lpszText argument to the allocated memory. This allocated memory
- is owned by the list control, therefore the application does not have
- to manage it. When the list item, indexed by the argument wIndex,
- is deleted, the list control will free the memory pointed to by
- lpszText in the TREE_NODE.
-
- The 1) method is usually used with static databases and the 2)
- method is used with real-time systems. And of course, both methods
- can be intermixed.
-
- NOTE: If the low 15 bits of wTextLength are set to 0 then lpszText is
- set to NULL by the list control.
-
- LPSTR lpszText:
-
- lpszText is a long pointer to a string that will be displayed
- in the list control for the given list item. The application must
- specify the length of string to be displayed in wTextLength.
- Please refer to the wTextLength documentation above for an
- understanding of the different methods that can be applied to the
- handling of lpszText.
-
- Comments:
-
- If a memory allocation failure occurs, then the lpszText member of
- TREE_NODE will be assigned a NULL and NO text will be displayed for the
- given list item.
-
- If the low 15 bits of wTextLength are set to 0 then lpszText is set to
- NULL by the list control.
-
- Return Codes:
-
- BST_NO_ERROR
- BST_ERR_MEMORY_ALLOC_FAILED
- BSL_ERR_INVALID_INDEX
- */
-
- short _export FAR PASCAL BSL_ChangeListItemText( HWND hwndList,
- WORD wIndex,
- WORD wTextLength,
- LPSTR lpszText);
-
-
- /*---------------------------------------------------------------------------
-
- short _export FAR PASCAL BSL_ChangeUserData ( HWND hwndList,
- WORD wIndex,
- WORD wUserDataSize,
- LPSTR lpUserData);
- Description:
-
- This API allows the application to change the user-defined data stored
- by the lpUserData member of the list item pointed to by the argument
- lpUserData.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that contains the list item
- that will be assigned the new user-defined data.
-
- WORD wIndex:
-
- Specifies the zero based index of the list item that will be assigned
- the given user-defined data.
-
- WORD wUserDataSize:
-
- If wUserDataSize is 0 then the given pointer, lpUserData, is assigned
- to the list item indexed by wIndex. It will then be the
- responsibility of the application to free the memory pointed to by
- lpUserData.
-
- If wUserDataSize is not zero, it then signals the list control to
- allocate wUserDataSize worth of memory. The list control will then
- copy wUserDataSize bytes from the location pointed to by the given
- argument, lpUserData, in to the newly allocated memory. The list
- control will free this allocated memory when the list item is deleted.
-
- LPSTR lpUserData:
-
- Points to the application defined memory that the application wishes
- stored with the list item indexed by wIndex.
-
- If the wUserDataSize argument is set to 0 then the lpUserData pointer
- will be directly assigned to the lpUserData member of the list item
- indexed by wIndex. It will be the responsibility of the application to
- free the memory pointed to by lpUserData.
-
- If wUserDataSize is non-zero, then the list control will allocate
- wUserDataSize worth of memory, copy wUserDataSize worth of memory from
- the location pointed to by the argument lpUserData to the newly
- allocated memory, and then assign the pointer to the newly allocated
- memory to the lpUserData member of the list item indexed by wIndex.
-
- Comments:
-
- BSL_SetDeleteNodeCallBack ( ) allows the application to register a
- callback with the given list control. The callback will be called
- everytime a list item is deleted from the list. List items can be deleted
- from the list with two list control export APIs or with the Windows API
- DestroyWindow ( ). The two list control exported APIs are:
-
- BSL_DeleteListItem ( )
- BSL_ResetList ( )
-
- Return Codes:
-
- BST_NO_ERROR
- BST_ERR_MEMORY_ALLOC_FAILED
- BSL_ERR_INVALID_INDEX
- */
-
-
- short _export FAR PASCAL BSL_ChangeUserData ( HWND hwndList,
- WORD wIndex,
- WORD wUserDataSize,
- LPSTR lpUserData);
-
-
-
- /*---------------------------------------------------------------------------
-
- LP_SELECT_NOTIF _export FAR PASCAL BSL_ConvertPointToSelectNotif (
- HWND hwndList,
- short x,
- short y);
-
- Description:
-
- This API allows the application to request the given x, y coordinate
- to be converted into a pointer to the list control's SELECT_NOTIF
- structure. The SELECT_NOTIF structure will contain a pointer to the
- TREE_NODE that the coordinated landed on and a wFlags member that
- describes where on the list item the point landed. The x, y coordinate
- is relative to the client area of the list control specified by the
- hwndList argument.
-
- Arguments:
-
- HWND hwndList:
-
- This is the window handle of the list control that will evaluate the
- given x, y coordinate. hwndList is the result of calling the exported
- API BSL_CreateListBox ( ).
-
- short x:
-
- X axis of the point to be converted to a pointer to the list
- control's SELECT_NOTIF structure. The value is pixel based and
- relative to the list control's upper left corner of the client area.
-
- short y:
-
- Y axis of the point to be converted to a pointer to the list
- control's SELECT_NOTIF structure. The value is pixel based and
- relative to the list control's upper left corner of the client area.
-
- Comments:
-
- Normally, this API will be used in drag and drop operations. To process
- the drop notification message from the File Manager, which is
- WM_DROPFILES, the application will need BSL_ConvertPointToSelectNotif ( )
- to determine what list item the files were dropped on. Just as well,
- if the application decides to allow the dragging of a list item, the
- application will need to determine what the mouse cursor shape should be
- when the cursor is over other list control list items. Since the
- application captures the mouse and monitors the WM_MOUSEMOVE messages, it
- can get the window handle of the window that the mouse is over, determine
- the x, y point in the client area where the mouse is located, and call
- BSL_ConvertPointToSelectNotif ( ) to retrieve the TREE_NODE pointer via
- the SELECT_NOTIF structure. Of course, OLE 2.0 will require the
- utilization of this API.
-
- REMEMBER: The memory pointed to by SELECT_NOTIF pointer belongs to the
- list control and is read only. Do not write to it or free the memory
- or the list control's integrity will be violated.
-
- Return Codes:
-
- NULL will be returned if the coordinate is not over a list item.
-
- If the x, y coordinate landed on a list item, then the return value will
- be the LP_SELECT_NOTIF pointer which will contain the hit flags and a
- pointer to the list item that the x, y coordinate landed on.
- */
-
- LP_SELECT_NOTIF _export FAR PASCAL BSL_ConvertPointToSelectNotif (
- HWND hwndList,
- short x,
- short y);
-
-
- /*---------------------------------------------------------------------------
- HWND _export FAR PASCAL BSL_CreateListBox ( HANDLE hInstance,
- HWND hwndApp,
- int x, int y,
- int nWidth, int nHeight,
- DWORD dwStyle,
- DWORD dwExStyle);
- Description:
-
- Creates an empty list. BSL_CreateListBox ( ) ORs the style bits specified
- in dwStyle to the list control's required styles and calls the Windows
- API, CreateWindowEx ( ). In effect, BSL_CreateListBox calls ( )
- CreateWindowEx ( ) as:
-
- CreateWindowEx ( dwExStyle,
- "BST_Tree",
- "",
- dwStyle | dwTreeControlStyles,
- x,
- y,
- nWidth,
- nHeight,
- hwndApp,
- NULL,
- hInstance,
- NULL);
-
- Once the list is created then list items can be added by calling the
- exported APIs:
-
- BSL_AddListItems ( )
- BSL_InsertListItems ( )
-
- Arguments:
-
- HANDLE hInstance:
-
- Instance associated with the creation of the list control window.
-
- HWND hwndApp:
-
- Window handle of the parent window that is creating the list control.
-
- int x:
-
- X location of the upper left corner of the list control in client area
- coordinates of the parent window.
-
- int y:
-
- Y location of the upper left corner of the list control in client
- area coordinates of the parent window.
-
- int nWidth:
-
- Width of the list control in device (pixel) units.
-
- int nHeight:
-
- Height of the list control in device (pixel) units.
-
- DWORD dwStyle:
-
- Application requested CreateWindowEx ( ) styles.
-
- DWORD dwExStyle:
-
- Application requested CreateWindowEx ( ) extended styles.
-
- Comments:
-
- The successful return value from this call, which is a window handle,
- will be used as the list control identifier for applying the
- list control exported APIs. Most of the list control APIs require
- the list control window handle.
-
- Return Codes:
-
- If successful, BSL_CreateListBox ( ) will return the window handle of the
- newly created list control. If failure, then a NULL will be returned.
- */
-
- HWND _export FAR PASCAL BSL_CreateListBox ( HANDLE hInstance,
- HWND hwndApp,
- int x, int y,
- int nWidth, int nHeight,
- DWORD dwStyle,
- DWORD dwExStyle);
-
-
- /*---------------------------------------------------------------------------
-
- short _export FAR PASCAL BSL_DeleteListItem ( HWND hwndList,
- WORD wIndex);
-
- Description:
-
- Delete the list item indexed by wIndex from the given list control.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that will destroy the list
- item indexed by wIndex.
-
- WORD wIndex:
-
- Specifies the zero based index of the list item that will be deleted
- from the list specified by the argument hwndList.
-
- Comments:
-
- When a list item is deleted the list control frees the deleted list
- item's memory. If a notification of a list item's deletion is desired,
- then the application can use the list control exported API,
- BSL_SetDeleteNodeCallBack ( ), to register a callback function that the
- list control will call just before deletion of the list item. If the
- application has assigned a pointer to dynamically allocated memory in
- the lpUserData member of the list item, it is the responsibility of the
- application to free this memory.
-
- Return Codes:
-
- BST_NO_ERROR
- BSL_ERR_INVALID_INDEX
- */
-
- short _export FAR PASCAL BSL_DeleteListItem ( HWND hwndList,
- WORD wIndex);
-
-
- /*---------------------------------------------------------------------------
- void _export FAR PASCAL BSL_DragAcceptFiles( HWND hwndList, BOOL bAccept);
-
- Description:
-
- Registers the list control to accept dropped files.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that will accept the message,
- WM_DROPFILES.
-
- BOOL bAccept:
-
- If set to TRUE then the given list control will accept the
- WM_DROPFILES message.
-
- Comments:
-
- The Windows File Manager (WINFILE.EXE) will send the WM_DROPFILES message
- to the window that registers when files are dropped onto it.
-
- Return Codes:
-
- None
- */
-
- void _export FAR PASCAL BSL_DragAcceptFiles ( HWND hwndList, BOOL bAccept);
-
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_GetCurSel ( HWND hwndList ) ;
-
-
- Description:
-
- Returns the zero based index of the active/highlighted list item of the
- given list. If there are no list items in the list, the return value
- will be -1.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that contains the current
- selection.
-
- Comments:
-
- If the deletion of the active list item occurs, then the next
- list item becomes the next active item. If there is no next item, then
- the previous item to the deleted item becomes the active/highlighted item.
-
- Return Codes:
-
- Returns the zero based index of the active/highlighted list item of the
- given list. If there are no list items in the list, the return value
- will be -1.
- */
-
- short _export FAR PASCAL BSL_GetCurSel ( HWND hwndList ) ;
-
-
-
- /*---------------------------------------------------------------------------
- LP_TREE_NODE _export FAR PASCAL BSL_GetListItem ( HWND hwndList,
- WORD wIndex);
-
- Description:
-
- Returns a pointer to the TREE_NODE structure that belongs to the
- list item indexed by wIndex. The TREE_NODE structure contains the
- pointer to the user-defined data, the pointer to the list item text,
- the length of the text, etc.
-
- typedef struct TreeNodeTag
- {
- LPSTR lpUserData;
- WORD wTextLength;
- LPSTR lpszText;
- WORD wState;
- WORD wIndex;
- BYTE chBitmapTypeBits;
- HBITMAP hBitmap[MAX_BITMAPS];
- HBITMAP hActiveBitmap[MAX_BITMAPS];
- }
- TREE_NODE;
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that contains the list item
- indexed by wIndex.
-
- WORD wIndex:
-
- Specifies the zero based index of the list item that will have a
- pointer to it's associated TREE_NODE structure returned to the
- application.
-
- Comments:
-
- Reference the header file BSCORE.H for more documentation on
- the TREE_NODE structure.
-
- Return Codes:
-
- Returns NULL if the wIndex value is not valid else a pointer to the
- TREE_NODE associated with the list item indexed by wIndex will be
- returned.
- */
-
- LP_TREE_NODE _export FAR PASCAL BSL_GetListItem ( HWND hwndList,
- WORD wIndex);
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_GetListItemCount ( HWND hwndList ) ;
-
- Description:
-
- Returns the number of list items in the given list.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that contains the list items.
-
- Comments:
-
- By using the return value of BSL_GetListItemCount ( ) as the upper
- limit, an application can traverse the list starting at 0.
-
- Return Codes:
-
- Returns 0 if no list items are in the list, else the number of list
- items in the list will be returned.
- */
-
- short _export FAR PASCAL BSL_GetListItemCount ( HWND hwndList ) ;
-
-
- /*---------------------------------------------------------------------------
- WORD _export FAR PASCAL BSL_GetVersion( void );
-
- Description:
-
- Returns the version number of the list control. The returned word
- contains the the version number. The high order byte of the word
- contains the minor version and the low order byte of the word
- contains the major version number.
-
- Arguments:
-
- void:
-
- Only one list control DLL can be loaded at a time so any instance
- of the tree control can reflect the version.
-
- Comments:
-
- To decipher the returned WORD, use the following piece of code:
- wMinorVersion = wVersion >> 8;
- wMajorVersion = wVersion & 0x00FF;
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- WORD _export FAR PASCAL BSL_GetVersion ( void );
-
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_InsertListItems ( HWND hwndList,
- WORD wIndex,
- WORD wNodeDefCount,
- LP_TREE_NODE_DEF lpTreeNodeDef);
- Description:
-
- This API allows the application to insert one or more list items into the
- given list.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that will create the new
- list items. This is the window handle that was returned to
- the application by calling BSL_CreateListBox ( ). BSL_CreateListBox ( )
- creates an empty list.
-
- WORD wIndex:
-
- Specifies the zero based index where the list items will be inserted
- into the list. If wIndex equals -1 then the list of items will be
- appended to the end of the list.
-
- WORD wNodeDefCount:
-
- wNodeDefCount contains the number of list items to be inserted. In
- other words, wNodeDefCount is the number of TREE_NODE_DEF elements in
- the TREE_NODE_DEF array pointed to by lpTreeNodeDef.
-
- LP_TREE_NODE_DEF lpTreeNodeDef:
-
- This is a pointer to a list of TREE_NODE_DEFs that describe each of
- the list items to be inserted.
-
- Comments:
-
- When BSL_InsertListItems ( ) is called, the list control allocates
- room for wNodeDefCount worth of list items in the list starting at the
- index specified by the argument wIndex. The list control then
- creates wNodeDefCount worth of new list items. It then serially
- traverses the lpTreeNodeDef array, initializing the newly created list
- items.
-
- Return Codes:
-
- BST_NO_ERROR
- BST_ERR_MEMORY_ALLOC_FAILED
- BST_ERR_LEVEL_LIMIT_EXCEEDED
- BST_ERR_TOO_MANY_NODES
- BST_ERR_ONLY_ONE_ROOT_ALLOWED
- BST_ERR_INVALID_PARENT_FOR_INSERTION
- BSL_ERR_INVALID_INDEX
- */
-
- short _export FAR PASCAL BSL_InsertListItems ( HWND hwndList,
- WORD wIndex,
- WORD wNodeDefCount,
- LP_TREE_NODE_DEF lpTreeNodeDef);
-
-
- /*---------------------------------------------------------------------------
- void _export FAR PASCAL BSL_ResetList ( HWND hwndList);
-
- Description:
-
- Remove all of the list items in the specified list control but do not
- destroy the list control.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that will destroy all of it's
- list items. This list control handle can still be used in any of the
- APIs such as BSL_AddListItems ( ). It does not invalidate the list
- control window handle.
-
- Comments:
-
- When a list item is deleted, it's TREE_NODE structure is no longer valid.
-
- If a notification of a list item's deletion is desired, then the
- application can use the list control exported API,
- BSL_SetDeleteNodeCallBack ( ), to register a callback function that the
- list control will call just before deletion of the list item. If the
- application has assigned a pointer to dynamically allocated memory in
- the lpUserData member of the list item, it is the responsibility of the
- application to free this memory.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- void _export FAR PASCAL BSL_ResetList ( HWND hwndList);
-
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_SetBitmap ( HWND hwndList,
- short nBitmap,
- WORD wIndex,
- HBITMAP hBitmap);
- Description:
-
- Assigns a bitmap handle to a specified list item for the specified
- bitmap space. Erases, but not deletes, the old bitmap or icon if it
- exists and then draws the new one.
-
- Arguments:
-
- HWND hwndList:
-
- hwndList is the list control in which the list item will receive the
- bitmap handle.
-
- short nBitmap:
-
- nBitmap is the index into the bitmap/icon array of the list item in
- which the given bitmap handle will be stored. This index is zero
- based and the maximum index is MAX_BITMAPS - 1.
-
- WORD wIndex:
-
- Specifies the zero based index of the list item which will be
- assigned the new bitmap handle specified by the argument hBitmap.
-
- HBITMAP hBitmap:
-
- hBitmap is the handle to the bitmap which will be drawn in the
- specified bitmap space for the given list item indexed by wIndex. It
- will be stored in the list item's hBitmap[] array in the member
- indexed by nBitmap.
-
- Bitmap spaces are the regions before the list item text where the
- bitmaps/icons are painted. The left most bitmap space corresponds
- with the first array member of the list item's hBitmap[] array.
- The second left most bitmap space corresponds with the second array
- member of the list item's hBitmap[] array, and so on.
- The hBitmap[] array stores the list item's bitmap/icon handles but the
- bitmap spaces are defined globally for all list items. This keeps
- column alignment which looks good and makes hit testing consistent.
-
- Reference the list control exported API, BSL_SetBitmapSapce ( ) to
- learn the process of defining a bitmap space.
-
- Comments:
-
- Bitmap/icon handles are NOT the property of the list control. The list
- control treats the bitmap/icon handle as read only. It will use the
- handle to draw the bitmap/icon associated with the list item. If the
- list item already has a bitmap/icon handle stored in the specified bitmap
- position then the old handle is simply overwritten. It is the
- responsibility of the application to manage creation and destruction of
- bitmaps/icons. If the application deletes/destroys bitmaps/icons before
- the list items are destroyed, then the tree control will possibly
- reference invalid bitmap/icon handles.
-
- For more information regarding bitmaps/icons and list items, refer to the
- TREE_NODE structure documentation in the header BSCORE.H.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- short _export FAR PASCAL BSL_SetBitmap ( HWND hwndList,
- short nBitmap,
- WORD wIndex,
- HBITMAP hBitmap);
-
-
- /* ---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_SetBitmapAndActiveBitmap ( HWND hwndList,
- short nBitmap,
- WORD wIndex,
- HBITMAP hBitmap,
- HBITMAP hActiveBitmap);
- Description:
-
- Assigns two bitmap handles to a specified list item for the specified
- bitmap space. Erases, but not deletes, the old bitmap if defined
- and draws the new bitmap. The hBitmap handle will be used to draw the
- bitmap if the list item is not active else the hActiveBitmap handle
- will be used to draw the bitmap if the list item is active.
-
- This API provides a way to provide a background masked bitmap
- to match the highlight color used in showing list item selection.
-
- Arguments:
-
- HWND hwndList:
-
- hwndList is the list control in which the list item will receive the
- bitmaps.
-
- short nBitmap:
-
- nBitmap is the index into the hBitmap[] array and the hActiveBitmap[]
- array of the specified list item, indexed by wIndex, in which the new
- bitmaps will replace the old bitmaps if they are defined. This index
- is zero based and the maximum index is MAX_BITMAPS - 1;
-
- WORD wIndex:
-
- Specifies the zero based index of the list item which will be
- assigned the new bitmap handles specified by the arguments hBitmap
- and hActiveBitmap.
-
- HBITMAP hBitmap:
-
- hBitmap is the handle to the bitmap in which the above list item,
- indexed by wIndex, will draw in the specified bitmap space when the
- list item is not selected. This handle will be store in the
- list item's hBitmap[] array.
-
- HBITMAP hActiveBitmap:
-
- hActiveBitmap is the handle to the bitmap in which the above
- list item will draw in the specified bitmap space when the list item is
- active. This handle will be store in the list item's hActiveBitmap[]
- array.
-
- Comments:
-
- Bitmap handles are NOT the property of the list control. The list
- control treats the bitmap as read only. It will use the handle to draw
- the bitmap of each list item. When a list item is assigned a new bitmap
- handle, the old handle is simply overwritten. It is the application's
- responsibility to manage creation and destruction of bitmaps. If the
- application destroys the bitmaps before the list control, then there
- will be trouble in paradise.
-
- For more information regarding bitmaps and list items, refer to the
- TREE_NODE structure documentation.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- short _export FAR PASCAL BSL_SetBitmapAndActiveBitmap ( HWND hwndList,
- short nBitmap,
- WORD wIndex,
- HBITMAP hBitmap,
- HBITMAP hActiveBitmap);
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_SetBitmapSpace ( HWND hwndList,
- short nBitmap,
- short nWidth,
- short nHeight,
- BOOL bCenterBitmap);
- Description:
-
- Define the list control's maximum width and height (in pixels) of the
- bitmap space, identified by the argument nBitmap, for all items in the
- list. This API will reserve space before the beginning of the list's
- text for the drawing of the bitmap identified by nBitmap. If the
- bitmap/icon handle associated with bitmap space is NULL, the empty bitmap
- space will still be represented. If the next thing after the empty bitmap
- space is the list item text, then the list control shifts the text left
- until it is butted against a non empty bitmap space or the lines.
-
- Bitmap spaces offer the application the ability to fine tune each bitmap
- position and to define each bitmap hit test area. Hit testing is not
- performed on the bitmap but on the bitmap space.
-
- The dimensions of a bitmap space are defined globally for all tree nodes.
- The reason for this is to keep column alignment of the bitmaps. This
- is visually pleasing and offers consistency with hit testing.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control in which to reserve the
- bitmap space. This space will be used to draw a bitmap. This space
- is before the start of the list item's text, if it has text.
-
- short nBitmap:
-
- Identifies the bitmap space. This is a zero based index into a
- MAX_BITMAPS size array where each member of the array is a structure.
- This structure has two members which hold the width and height of the
- bitmap space. The width and height are defined in device coordinates
- (pixels).
-
- short nWidth:
-
- nWidth is the width, in pixels, of the reserved bitmap space.
-
- short nHeight:
-
- nHeight is the height, in pixels, of the reserved bitmap space.
-
- BOOL bCentered:
-
- If set to TRUE then center the bitmap/icon in the bitmap space.
-
- Comments:
-
- The bitmap/icon will be painted in the reserved space centered
- between the top and bottom boundaries. If bCentered is set to TRUE then
- the bitmap/icon will be centered between the left and right boundaries.
- If bCentered is set to FALSE then the bitmap/icon will be left justified
- in the bitmap space. If the bitmap is larger than the
- width and/or the height, then the bitmap will be clipped. If the icon
- is larger than the bitmap space there will be no clipping since the
- Windows API, DrawIcon(), does not provide it. Therefore, if an
- icon is going to be associated with a bitmap space, make the width and
- height of the bitmap space at least as wide and tall as the values
- returned from GetSystemMetrics (SM_CXICON) and
- GetSystemMetrics (SM_CXICON).
-
- If either nHeight or nWidth is zero, then there is no bitmap space.
-
- Remember, that the bitmap space definitions, 0 thru MAX_BITMAPS-1, are
- global to all list items in the given list control.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- short _export FAR PASCAL BSL_SetBitmapSpace ( HWND hwndList,
- short nBitmap,
- short nWidth,
- short nHeight,
- BOOL bCenterBitmap);
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_SetCurSel ( HWND hwndList,
- WORD wIndex);
-
- Description:
-
- This API makes the list item indexed by the argument wIndex the active
- list item in the given list.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control in which the given list item,
- indexed by the argument wIndex, will be made active. Only one active
- list item is allowed in each list.
-
- WORD wIndex:
-
- Specifies the zero based index of the list item which will be
- made the new active list item in the list control hwndList.
-
- Comments:
-
- When the given list item is made active, the previously active list item
- becomes inactive. Only one active list item is allowed in each list.
-
- If the active list item is not visible, in the client area of the tree
- control, then the active list item will be made visible.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- short _export FAR PASCAL BSL_SetCurSel ( HWND hwndList,
- WORD wIndex);
-
-
-
- /*---------------------------------------------------------------------------
-
- typedef BOOL (_export FAR PASCAL * FP_DELETE_LIST_ITEM_CB) ( HWND,
- LP_TREE_NODE);
- short _export FAR PASCAL BSL_SetDeleteListItemCallBack (
- HWND hwndList,
- FP_DELETE_LIST_ITEM_CB fpDeleteItemCB);
-
- Description:
-
- This API allows the application to register a callback with the given
- list control. The callback will be called everytime a list item is
- deleted from the list. List items can be deleted from the list with two
- list control export APIs or with the Windows API DestroyWindow ( ). The
- two list control exported APIs are:
-
- BSL_DeleteListItem ( )
- BSL_ResetList ( )
-
- Arguments:
-
- HWND hwndList:
-
- hwndList identifies the list control in which to register the callback
- with.
-
- FP_DELETE_LIST_ITEM_CB fpDeleteItemCB:
-
- The address of the callback. This will be called everytime a list item
- deletion occurs.
-
- Comments:
-
- Know how to define callbacks before using this feature!
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- typedef BOOL (_export FAR PASCAL * FP_DELETE_LIST_ITEM_CB) ( HWND,
- LP_TREE_NODE);
- short _export FAR PASCAL BSL_SetDeleteListItemCallBack (
- HWND hwndList,
- FP_DELETE_LIST_ITEM_CB fpDeleteItemCB);
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_SetFont ( HWND hwndList, HFONT hFont);
-
- Description:
-
- Apply a given font to the drawing of the text for all the list items of
- the given list control.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control that will apply the given
- font to the text of every list item.
-
- HFONT hFont:
-
- hFont is a handle to a font that was created by the application.
-
- Comments:
-
- Once the list control receives the font handle, it becomes the property
- of the list control and it is the responsibility of the list control to
- delete the font. The font will be deleted if a new font is sent to the
- list control by the application or if the list control receives a
- WM_DESTROY message. The system font is the default font.
-
- Return Codes:
-
- BST_NO_ERROR
- */
- short _export FAR PASCAL BSL_SetFont ( HWND hwndList, HFONT hFont);
-
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BSL_SetIcon ( HWND hwndList,
- short nIcon,
- WORD wIndex,
- HICON hIcon);
- Description:
-
- Assigns an icon handle to a specified list item for the specified
- bitmap space. Erases, but not deletes, the old icon or bitmap and draws
- the given icon.
-
- Arguments:
-
- HWND hwndList:
-
- hwndList is the list control in which the list item will receive the
- icon handle.
-
- short nIcon:
-
- nIcon is the index into the bitmap array of the list item in which the
- new handle will replace the old handle if the old handle exists.
- This index is zero based and the maximum index is MAX_BITMAPS - 1;
-
- WORD wIndex:
-
- Specifies the zero based index of the list item which will be
- assigned the new bitmap handle specified by the argument hBitmap.
-
- HICON hIcon:
-
- hIcon is the handle to the icon which will be drawn in the specified
- bitmap space for the given list item, indexed by wIndex. It will be
- stored in the list item's hBitmap[] array in the member indexed by
- nIcon.
-
- Bitmap spaces are the regions before the list item text where the
- bitmaps/icons are painted. The left most bitmap space corresponds
- with the first array member of the list item's hBitmap[] array.
- The second left most bitmap space corresponds with the second array
- member of the list item's hBitmap[] array, and so on.
- The hBitmap[] array stores the list item's bitmap/icon handles but the
- bitmap spaces are defined globally for all list items. This keeps
- column alignment which looks good and makes hit testing tolerable.
-
- Reference the list control exported API, BSL_SetBitmapSapce ( ) to
- learn the process of defining a bitmap space.
-
- Comments:
-
- Bitmap/icon handles are NOT the property of the list control. The list
- control treats the bitmap/icon handle as read only. It will use the
- handle to draw the bitmap/icon associated with the list item. If the
- list item already has a bitmap/icon handle stored in the specified bitmap
- position then the old handle is simply overwritten. It is the
- responsibility of the application to manage creation and destruction of
- bitmaps/icons. If the application deletes/destroys bitmaps/icons before
- the list item are destroyed, then the list control will possibly
- reference invalid bitmap/icon handles.
-
- For more information regarding bitmaps/icons and list items, refer to the
- TREE_NODE structure documentation in the header BSCORE.H.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
- short _export FAR PASCAL BSL_SetIcon ( HWND hwndList,
- short nIcon,
- WORD wIndex,
- HICON hIcon);
-
-
- /*---------------------------------------------------------------------------
- short _export FAR PASCAL BST_SetXSpaceBeforeText( HWND hwndList,
- short nWidth);
-
- Description:
-
- Allows the application to adjust the space between the last bitmap
- (if any) and the first character of the text string.
-
- Arguments:
-
- HWND hwndList:
-
- This argument specifies the list control in which to reserve space
- before the first character of the list items's text string.
-
- short nWidth:
-
- nWidth is the width of the reserved space before the text. This is
- expressed in pixels.
-
- Comments:
-
- There is no default space between the rightmost bitmap space and the
- first character of the text.
-
- Return Codes:
-
- BST_NO_ERROR
- */
-
-
- short _export FAR PASCAL BSL_SetXSpaceBeforeText ( HWND hwndList,
- short nWidth);
- /*----------------------------------EOF-------------------------------------*/
-