home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / bsscdemo / bscore.h next >
Encoding:
C/C++ Source or Header  |  1993-05-26  |  62.0 KB  |  1,095 lines

  1. /*
  2.  Copyright (c) 1992, 1993 by Barking Spider Software Inc.  All rights reserved
  3.                                        
  4.    Filename...:  bscore.h
  5.    
  6.    Version....:  1.0
  7.    
  8.    Language...:  Microsoft C/C++ 7.0
  9.    
  10.    Model......:  Small
  11.    
  12.    Environment:  Microsoft Windows 3.1
  13.                                        
  14.    Description:  This header file is probably the most important document of
  15.                  the tree/list control package.  It describes the internal
  16.                  tree node/list item structure and the external tree node/
  17.                  list item definition structure used by the application to
  18.                  define a tree node or list item.  It describes the
  19.                  notification messages that the tree/list control sends to
  20.                  the application as a result of an event.  Error codes
  21.                  returned by the exported APIs are defined in this header
  22.                  plus a list of useful macros to aid the developer.
  23.                  
  24.                  IMPORTANT! The tree portion of this control was developed
  25.                  first therefore there are many references to tree, tree
  26.                  nodes, etc.  If the developer is building a tree, then
  27.                  the jargon will be helpful.  But if the developer is
  28.                  building a list then it will be helpful for the developer to
  29.                  relate references to trees with lists, tree nodes with list
  30.                  items, and ignore the concept of children and levels.
  31.                  
  32.                  Essentially, in the context of a listbox control, tree nodes
  33.                  are list items, and trees are lists.
  34.            
  35.                  The header BSTREE.H contains the prototypes for all the 
  36.                  exported APIs for the tree control.
  37.                  
  38.                  The header BSLIST.H contains the prototypes for all the 
  39.                  exported APIs for the list control.
  40.                  
  41.                  
  42.           
  43.                  BSCORE.H is divided into the following sections.
  44.          
  45.                  Useful Macros
  46.                  Tree/List Class Name And Styles
  47.                  Tree/List Limits
  48.                  Version Macros
  49.                  Error Codes
  50.                  Tree/List Control Structures
  51.                  Tree/List Control Node States
  52.                  Tree/List Control Notification Messages
  53.  
  54.    Notes......:  
  55.                                        
  56.    History....:
  57.                                           
  58.    Author.....:  Peter J. Kaufman
  59.                                           
  60. */
  61.  
  62. /****************************************************************************/
  63. /*                            USEFUL MACROS                                 */
  64. /****************************************************************************/
  65.  
  66. #define MAKEP(sel,off)  ((VOID FAR *)MAKELONG(off,sel))
  67. #define ALLOCP(dwBytes) ((VOID FAR*) MAKELONG (0, GlobalAlloc(GPTR,(DWORD)(dwBytes))))
  68. #define FREEP(lp)       GlobalFree((HANDLE)HIWORD((DWORD)(lp)));
  69. #define FP_SEG(fp) (*((unsigned __far *)&(fp)+1))
  70. #define FP_OFF(fp) (*((unsigned __far *)&(fp)))
  71.  
  72.  
  73. /****************************************************************************/
  74. /*                 TREE/LIST CONTROL CLASS NAME AND STYLES                  */
  75. /****************************************************************************/
  76.  
  77. #define    TREE_CLASS            "BST_Tree"  // Same class name for a list.
  78. #define    BST_TREE_STYLE        0x0001L
  79. #define    BSL_LIST_STYLE        0x0002L
  80.  
  81. /****************************************************************************/
  82. /*                          TREE/LIST LIMITS                                   */
  83. /****************************************************************************/
  84.  
  85. #define MAX_LEVELS         64    // Maximum tree indentation (tree only)
  86. #define MAX_NODES_IN_TREE  32767 // Maximum number of nodes in one tree and
  87. #define MAX_BITMAPS        3     // Maximum bitmap spaces per node per tree
  88. #define MAX_LINE_COLORS    3     // The number of different colors used in
  89.                                  // line drawing.
  90.                 
  91.                 
  92. /****************************************************************************/
  93. /*                            VERSION MACROS                                */
  94. /****************************************************************************/
  95.                
  96. // wVersion = (((wVersion|MINOR_TREE_VERSION) << 8) | MAJOR_TREE_VERSION);
  97. #define MAJOR_TREE_VERSION  0x0001
  98. #define MINOR_TREE_VERSION  0x0000
  99.  
  100. /****************************************************************************/
  101. /*                             ERROR CODES                                  */
  102. /****************************************************************************/
  103.  
  104. #define BST_NO_ERROR                         0
  105. #define BST_ERR_MEMORY_ALLOC_FAILED          1
  106. #define BST_ERR_LEVEL_LIMIT_EXCEEDED         2  // only MAX_LEVELS allowed
  107. #define BST_ERR_TOO_MANY_NODES               3  // only MAX_NODES_IN_TREE
  108.                                                 // allowed
  109. #define BST_ERR_ONLY_ONE_ROOT_ALLOWED        4
  110. #define BST_ERR_INVALID_PARENT_FOR_INSERTION 5
  111. #define BST_ERR_INVALID_PARENT_FOR_CHILDREN  6
  112. #define BSL_ERR_INVALID_INDEX                7
  113.  
  114. /****************************************************************************/
  115. /*                        TREE/LIST CONTROL STRUCTURES                      */
  116. /****************************************************************************/
  117.  
  118. /* TREE_NODE structure - Internal tree node or list item.
  119.  
  120. typedef struct TreeNodeTag   
  121. {
  122.    LPSTR   lpUserData;          
  123.    WORD    wTextLength;         
  124.    LPSTR   lpszText;            
  125.    WORD    wState;              
  126.    WORD    wIndex;              
  127.    BYTE    chBitmapTypeBits;    
  128.    HBITMAP hBitmap[MAX_BITMAPS];
  129.    HBITMAP hActiveBitmap[MAX_BITMAPS];
  130. }
  131. TREE_NODE;
  132.  
  133. typedef TREE_NODE FAR* LP_TREE_NODE;
  134.  
  135.   NOTE: If in the the context of a listbox control, references to the word
  136.   "tree" should be replaced with the word "list" and references to the 
  137.   phrase "tree node" should be replaced with the phrase "list item".
  138.   
  139.   The TREE_NODE structure is the description of a tree node belonging to a
  140.   tree control.  When a node is created by the tree control, at the request
  141.   of the application, it allocates sizeof ( TREE_NODE ) worth of memory.
  142.   The tree control then initializes the members of the newly created tree
  143.   node by copying the contents of the application supplied TREE_NODE_DEF
  144.   structure.  The TREE_NODE_DEF structure describes the tree node to be
  145.   created.  After the newly created tree is initialized, the pointer to the
  146.   tree node is then returned to the application to be used as a handle or
  147.   identifier in future references.  Since the memory for each tree node is NOT
  148.   allocated by the application but by the tree control, the memory is
  149.   read-only.  If the application writes to any part of this structure or 
  150.   frees the memory of this structure, the integrity of the tree will be
  151.   violated.
  152.   
  153.   Below are somes ways of retrieving the TREE_NODE pointer of a tree node in
  154.   a tree.
  155.   
  156.      1. Calling BST_GetActiveNode ( ) will return a TREE_NODE pointer of the
  157.         currently highlighted node.
  158.     
  159.      2. The application will receive a notification when an event takes
  160.         place, such as a mouse click.  The notification messages are:
  161.          WM_BST_SELECT_NOTIF
  162.          WM_BST_SELECT_NOTIF_DBLCLK
  163.         When the application receives any of these notifications, the
  164.         lParam points to the tree control owned SELECT_NOTIF structure.  In
  165.         this structure is a member called 'lpTreeNode' which points to the
  166.         tree node (TREE_NODE) which was selected.
  167.     
  168.      3. After a tree node addition or insertion via the exported APIs
  169.         BST_AddChildrenToParent ( ) and
  170.         BST_InsertSiblingNodes ( ), the pointer to the newly created tree
  171.         node(s) can be accessed.  First, to create new tree nodes, the
  172.         application passes an array of TREE_NODE_DEF structures to the tree
  173.         control via the above APIs to describe the desired tree nodes. 
  174.         After the new tree node(s) are created and before returning to the
  175.         application, the tree control copies the pointers to the newly
  176.         created tree node(s) into the 'lpTreeNode' members of the application
  177.         supplied TREE_NODE_DEFs.  On return, the application can read the
  178.         pointers stored the 'lpTreeNode' members of the TREE_NODE_DEFS and
  179.         copy them for future references to the newly created tree nodes.
  180.     
  181.      4. Calling BST_ConvertPointToSelectNotif ( ) or the list equivalent,
  182.         BSL_ConvertPointToSelectNotif ( ), will return a pointer to
  183.         the tree node that lies under the coordinate supplied by the
  184.         application.
  185.     
  186.      5. The application will receive notification when the user holds the left
  187.         button down and drags the mouse a distance greater than the average
  188.         character width or height of the current font.  The notification
  189.         message is WM_BST_DODRAG.  The lParam of this message points to the
  190.         tree control owned SELECT_NOTIF structure in which it's 'lpTreeNode'
  191.         member points to the node to be dragged.
  192.     
  193.      5. BST_SetDeleteNodeCallBack ( ), or the list equivalent 
  194.         BSL_SetDeleteListItemCallBack ( ), allows the application to register
  195.         a callback with the given tree control.  The callback will be called
  196.         everytime a node is deleted from the tree.  Nodes can be deleted from
  197.         the tree with three tree control export APIs or with the Windows API
  198.         DestroyWindow ( ).  The three tree control exported APIs are:
  199.      
  200.         BST_DeleteChildrenOfParent ( )
  201.         BST_DeleteNode ( )
  202.         BST_EraseTree ( )
  203.         
  204.         The list equivalents are:
  205.         
  206.         BSL_ResetList ( )
  207.         BSL_DeleteListItem ( )
  208.         
  209.      6. For the list control, the index of a list item can be converted to 
  210.         a TREE_NODE pointer by calling, BSL_GetListItem ( ) with the index
  211.         value as it's argument.
  212. */
  213.  
  214. typedef struct TreeNodeTag
  215. {
  216.    LPSTR   lpUserData;          // This member stores a pointer or value
  217.                                 // that is supplied by the application
  218.                                 // via the TREE_NODE_DEF structure when the
  219.                                 // application calls
  220.                                 //    BST_AddChildrenToParent ( ),
  221.                                 //    BST_InsertSiblingNodes ( ), 
  222.                                 //    BSL_AddListItems ( ), or
  223.                                 //    BSL_InsertListItems ( ).  
  224.                                 // (The APIs add nodes to the tree.)
  225.                                 // The tree control only stores this value or
  226.                                 // pointer.  If the item in lpUserData is a 
  227.                                 // pointer, then the tree control
  228.                                 // will NOT free the memory that this pointer
  229.                                 // points to when the node is destroyed.  This
  230.                                 // is the responsibility of the application. 
  231.                                 // A node can be destroyed by a call to
  232.                                 //     BST_DeleteChildrenOfParent ( ),
  233.                                 //     BST_DeleteNode ( ),
  234.                                 //     BST_EraseTree ( ), 
  235.                                 //     BSL_ResetList ( ),
  236.                                 //     BSL_DeleteListItem ( ), or 
  237.                                 // when the tree control receives a WM_DESTROY
  238.                                 // message. To aid in the managing of the data
  239.                                 // stored in lpUserData, the tree control
  240.                                 // provides a method of registering a callback
  241.                                 // in which the tree control calls just
  242.                                 // before the tree node is destroyed.  The API
  243.                                 // to register a callback with the tree control
  244.                                 // is the exported API 
  245.                                 // BST_SetDeleteNodeCallBack ( ) for trees and
  246.                                 // BSL_SetDeleteNodeCallBack ( ) for lists.
  247.                                 
  248.    WORD    wTextLength;         // This member states the number of characters
  249.                                 // in which the tree control is to display as 
  250.                                 // text for this tree node.  The source of the
  251.                                 // node text is the lpszText member.  Both the
  252.                                 // wTextLength and lpszText member values are
  253.                                 // copied from the corresponding TREE_NODE_DEF
  254.                                 // structure used in defining the TREE_NODE.
  255.                                 // Normally, the application does a 
  256.                                 // lstrlen ( ) on lpszText and assigns the
  257.                                 // result to wTextLength.  But there may be
  258.                                 // cases that the string pointed to by 
  259.                                 // lpszText is just too long and fewer
  260.                                 // characters are required.
  261.                                 
  262.                                 // There is a special attribute of wTextLength
  263.                                 // in which the most significant bit or the
  264.                                 // sign bit acts as a flag.  Depending
  265.                                 // on how this bit is set there are
  266.                                 // two ways to handle text in a tree node.
  267.                                 // In both cases, the application passes
  268.                                 // a long pointer to the text via the lpszText
  269.                                 // member of TREE_NODE_DEF structure.  The
  270.                                 // two methods are:
  271.                 
  272.                                 // 1) If the sign bit of wTextLength
  273.                                 // (0x8000) is set to 1, then the pointer
  274.                                 // in lpszText points to memory owned by 
  275.                                 // the application and is guaranteed not to 
  276.                                 // change (deleted or moved).  
  277.                                 // This signals the tree control to just
  278.                                 // copy the pointer in lpszText of the the
  279.                                 // TREE_NODE_DEF structure to the TREE_NODE
  280.                                 // structure.  The tree control will NOT
  281.                                 // worry about allocating, copying, and
  282.                                 // freeing the memory pointed to be lpszText.
  283.                                 // The pointer is used "as is", to display
  284.                                 // wTextLength worth of the characters pointed
  285.                                 // to by lpszText.
  286.                 
  287.                                 // 2) If the sign bit of
  288.                                 // wTextLength is set to 0, then the tree
  289.                                 // control allocates wTextLength + 1 worth of
  290.                                 // memory.  The tree control then copies
  291.                                 // wTextLength worth of characters from the
  292.                                 // string pointed to by the lpszText member
  293.                                 // of the TREE_NODE_DEF to the memory pointed
  294.                                 // to by the lpszText member of the newly
  295.                                 // created TREE_NODE.  This will be the text
  296.                                 // displayed by the tree control.  When the
  297.                                 // node is to be deleted, the tree control
  298.                                 // will free the memory pointed to by lpszText
  299.                                 // in the TREE_NODE since it belongs to the 
  300.                                 // tree control.
  301.                 
  302.                                 // The 1) method is usually
  303.                                 // used with static databases and the 2)
  304.                                 // method is used with real-time systems.  And
  305.                                 // of course, both methods can be intermixed.
  306.                                 // The obvious advantage of using method 1)
  307.                                 // is the faster performance and use of 
  308.                                 // less memory since the application already
  309.                                 // has memory allocated.
  310.                 
  311.                                 // NOTE:  If the low 15 bits of wTextLength
  312.                                 // are set to 0 then lpszText is set to NULL
  313.                                 // by the tree control, meaning there is no
  314.                                 // text to display.
  315.                 
  316.    LPSTR   lpszText;            // The application supplies a long pointer to
  317.                                 // a string that it wishes to be displayed in
  318.                                 // the tree control for a given node.  The
  319.                                 // application must specify the length of
  320.                                 // string to be displayed in wTextLength.
  321.                                 // Please refer to the wTextLength
  322.                                 // documentation above for an understanding
  323.                                 // of the different methods that can be 
  324.                                 // applied to the handling of lpszText.
  325.                 
  326.    WORD    wState;              // The low byte of this word maintains the
  327.                                 // state of the node.  The node can be open
  328.                                 // or closed.  If BST_AddChildrenToParent() is
  329.                                 // called by the application, the parent
  330.                                 // node's wState member will be assigned a
  331.                                 // value of NODE_OPENED in the low byte since
  332.                                 // it now has children.  If a tree node has no
  333.                                 // children, probably from the fact it has 
  334.                                 // just been created or a call to
  335.                                 // BST_DeleteChildrenOfParent ( ) has been
  336.                                 // made, wState will be assigned a value of 
  337.                                 // NODE_CLOSED.
  338.                 
  339.                                 // The high byte of this member is reserved.
  340.                                 // Any modification of this byte will
  341.                                 // invalidate the tree control.
  342.                 
  343.    WORD    wIndex;              // For trees and lists, wIndex is an index
  344.                                 // value used/ internally and should not be
  345.                                 // modified in any way.  If modified, the tree
  346.                                 // will die!
  347.  
  348.                                 // If this control is used as a tree then
  349.                                 // wIndex has no usefulness to the
  350.                                 // application.  If this control is used
  351.                                 // as a list then this is a different
  352.                                 // story.  wIndex represents the position of
  353.                                 // a list item in a list.  This index value
  354.                                 // is 0 for the first list item,
  355.                                 // 1 for the second list item, 2 for the next,
  356.                                 // and so on.
  357.                                 
  358.    BYTE    chBitmapTypeBits;    // Starting from the least significant bit,
  359.                                 // each bit position corresponds to an 
  360.                                 // index into the hBitmap[] array starting at
  361.                                 // 0.  Only MAX_BITMAPS worth of bits have
  362.                                 // significance.
  363.                                 // These bits tell the tree control whether
  364.                                 // it's corresponding hBitmap[] array member
  365.                                 // is a bitmap handle or an icon
  366.                                 // handle.  For example, if the least
  367.                                 // significant bit of chBitmapTypeBits
  368.                                 // is set to 0 then the handle in
  369.                                 // hBitmap[0] is a handle to a bitmap.
  370.                                 // If this bit is set to 1 then
  371.                                 // the handle in hBitmap[0] is a handle
  372.                                 // to an icon.
  373.                                 // This TREE_NODE member is copied from the
  374.                                 // TREE_NODE_DEF structure when the tree node
  375.                                 // is created.
  376.       
  377.    HBITMAP hBitmap[MAX_BITMAPS];// hBitmap[] is an array of handles to bitmaps
  378.                                 // and icons to be displayed for the given
  379.                                 // node, left to right, before the tree node
  380.                                 // text.  
  381.                    
  382.                                 // The TREE_NODE member chBitmapTypeBits is
  383.                                 // referenced by the tree control to determine
  384.                                 // which handles are bitmap handles and which
  385.                                 // are icon handles.  chBitmapTypeBits and
  386.                                 // hBitmap[] are initially defined by the
  387.                                 // application via the TREE_NODE_DEF structure
  388.                                 // when a tree node is created.
  389.                                 // These items can be changed later by calling
  390.                                 // the exported APIs, 
  391.                                 //    BST_SetBitmap ( ), 
  392.                                 //    BST_SetBitmapAndActiveBitmap ( ),
  393.                                 //    BST_SetIcon ( ),
  394.                                 //    BSL_SetBitmap ( ), 
  395.                                 //    BSL_SetBitmapAndActiveBitmap ( ),
  396.                                 //    BSL_SetIcon ( ).
  397.                                                 
  398.                                 // For documentation purposes icons and
  399.                                 // bitmaps will be referred to as bitmaps for
  400.                                 // the rest of this discussion.
  401.                  
  402.                                 // A NULL value for any of the array
  403.                                 // members will signal to the tree control
  404.                                 // that NO bitmap has been specified for this
  405.                                 // array member.  All array members are
  406.                                 // checked by the tree control for non-NULL
  407.                                 // handles.  Each non-NULL bitmap handle will
  408.                                 // be used to display the bitmap in it's
  409.                                 // corresponding bitmap position.  Applications
  410.                                 // must make sure that the array members NOT
  411.                                 // containing a bitmap handle are set to NULL
  412.                                 // in the TREE_NODE_DEF describing a tree
  413.                                 // node.  The tree control does NOT validate
  414.                                 // tree handles!
  415.                 
  416.                                 // Each handle in the hBitmap[] array 
  417.                                 // is associated with a bitmap space.  A
  418.                                 // bitmap is displayed inside the rectangular
  419.                                 // region of it's corresponding bitmap space.
  420.                                 // Bitmap spaces offer the application the
  421.                                 // ability to fine tune each bitmap position
  422.                                 // and to define each bitmap hit test area.
  423.                                 // Hit testing is not performed on the bitmap
  424.                                 // but on the bitmap space.  The width and
  425.                                 // height of a bitmap space are defined by
  426.                                 // the exported APIs, BST_SetBitmapSpace ( )
  427.                                 // and BSL_SetBitmapSpace ( ).
  428.                                 // The dimensions of a bitmap space are 
  429.                                 // defined globally.  The reason for this
  430.                                 // is to keep column alignment of the
  431.                                 // bitmaps.  This is visually pleasing
  432.                                 // and offers consistency with hit testing.
  433.                                 // If the application does not call 
  434.                                 // BST_SetBitmapSpace ( ) or 
  435.                                 // BSL_SetBitmapSpace ( ) to define a 
  436.                                 // bitmap space width and height, then the
  437.                                 // bitmap space default width and height are
  438.                                 // both zero making the bitmap space
  439.                                 // invisible.  Even if a valid handle is 
  440.                                 // associated with this bitmap space, the
  441.                                 // bitmap will not be displayed.  
  442.                 
  443.                                 // Some useful techniques and tips to utilize
  444.                                 // bitmap spaces are listed below:
  445.                 
  446.                                 // 1) Setting the bitmap space width greater
  447.                                 // than the corresponding bitmap's width can
  448.                                 // be used to set gaps between bitmaps.
  449.                 
  450.                                 // 2) Setting the bitmap space height greater
  451.                                 // than the corresponding bitmap's height
  452.                                 // can be used to allocate space between tree
  453.                                 // nodes.
  454.                 
  455.                                 // 3) If the application needs to make a
  456.                                 // bitmap and it's corresponding bitmap space
  457.                                 // disappear but leave the bitmap handle
  458.                                 // unchanged in the hBitmap[] array, the 
  459.                                 // application only needs to set the bitmap
  460.                                 // space width or height to 0.  The
  461.                                 // tree control will collapse the bitmap
  462.                                 // space out of existence.
  463.                                 // Later, if the application wishes to show
  464.                                 // the bitmap again, the application will need
  465.                                 // to set the bitmap space width and height
  466.                                 // to non zero values.
  467.                 
  468.                                 // 4) If a hBitmap[] array element contains
  469.                                 // a NULL bitmap handle but it's corresponding 
  470.                                 // bitmap space width and height are non zero
  471.                                 // then the tree control will draw the space
  472.                                 // with no bitmap in it.  This is true only
  473.                                 // if there is a bitmap that is displayable
  474.                                 // to the right of the empty space.  If there
  475.                                 // is no bitmap that is displayable to the
  476.                                 // right of the empty space, then the tree
  477.                                 // node text will be left justified next
  478.                                 // to the last displayed bitmap.
  479.                 
  480.    HBITMAP hActiveBitmap[MAX_BITMAPS];
  481.                                 // Handles of bitmaps/icons to be display when
  482.                                 // the tree node is active (which means
  483.                                 // highlighted).
  484.                                 
  485.                                 // For documentation purposes icons and
  486.                                 // bitmaps will be referred to as bitmaps for
  487.                                 // the rest of this discussion.
  488.                                 
  489.                                 // hActiveBitmap[] array elements need to be
  490.                                 // assigned to a NULL by the application
  491.                                 // if no bitmap handle is supplied.  If a 
  492.                                 // hActiveBitmap[] array element is
  493.                                 // NULL but the hBitmap[] index equivalent is
  494.                                 // non-NULL then that hBitmap[] handle is used
  495.                                 // to display the bitmap when the tree node
  496.                                 // is selected.  hActiveBitmap[] is only
  497.                                 // referenced to display the bitmap if the
  498.                                 // tree node is highlighted
  499.                                 // and hActiveBitmap[] has a non-zero
  500.                                 // corresponding hBitmap[] array member.
  501.                                 // Besides the above conditions, the handling
  502.                                 // of this array of bitmap handles
  503.                                 // follow the same rules and conditions as
  504.                                 // hBitmap[].
  505. }
  506. TREE_NODE;
  507.  
  508. typedef TREE_NODE FAR* LP_TREE_NODE;
  509.  
  510.  
  511. /*   TREE_NODE_DEF structure - Allows the app to describe a tree node or
  512.                                list item to the tree/list control.
  513.  
  514. typedef struct TreeNodeDefTag
  515. {
  516.    LP_TREE_NODE  lpTreeNode;    
  517.    LPSTR   lpUserData;          
  518.    WORD    wTextLength; 
  519.    LPSTR   lpszText;            
  520.    BYTE    chBitmapTypeBits; 
  521.    HBITMAP hBitmap[MAX_BITMAPS];
  522.    HBITMAP hActiveBitmap[MAX_BITMAPS];
  523. }
  524. TREE_NODE_DEF;
  525.  
  526. typedef TREE_NODE_DEF FAR* LP_TREE_NODE_DEF;
  527.  
  528.   NOTE: If in the the context of a listbox control, references to the word
  529.   "tree" should be replaced with the word "list" and references to the 
  530.   phrase "tree node" should be replaced with the phrase "list item".
  531.  
  532.   The TREE_NODE_DEF structure is the "node definition structure" that serves
  533.   as a vehicle for the application to describe a node to the tree control
  534.   in the case of a node add or node insertion.  When the tree control receives
  535.   the TREE_NODE_DEF structure, it creates a TREE_NODE with the information in
  536.   the given TREE_NODE_DEF.  The tree control then passes back the pointer to
  537.   the newly created TREE_NODE via the 'lpTreeNode' member of the TREE_NODE_DEF
  538.   structure.
  539.  
  540.   The detailed process of creating tree nodes is described below:
  541.     
  542.   1) An application will allocate an array of TREE_NODE_DEF structures,
  543.   each corresponding to a tree node to be created, all belonging to the 
  544.   same parent.
  545.   
  546.   2) The application will initialize the TREE_NODE_DEF structures with each
  547.   node's desired bitmap/icon handles, text, and user defined data.
  548.   
  549.   3) The the application will make a call to either BST_AddChildrenToParent ( ) or
  550.   BST_InsertSiblingNodes ( ) to create the new tree nodes.  The list
  551.   equivalents are BSL_AddListItems ( ) and BSL_InsertListItems ( ).
  552.   
  553.   NOTE: All the child tree nodes for the same parent node DO NOT have to be
  554.   defined all at once.  Additional calls to BST_AddChildrenToParent ( ) with
  555.   the same parent tree node will result in the concatenation of the newly
  556.   created child tree nodes to the parent's already existing children.
  557.   This allows for a greater capability for multitasking under Windows.
  558.   
  559.   4) The tree control will allocate TREE_NODE memory for the requested tree
  560.   nodes.
  561.   
  562.   5) The tree control will traverse the given TREE_NODE_DEF array, copying
  563.   the TREE_NODE_DEF structure data to the corresponding TREE_NODE structure
  564.   for each newly created node.  During this traversal the tree control
  565.   stores each new TREE_NODE pointer into the 'lpTreeNode' member of each
  566.   of the TREE_NODE_DEF structures.  
  567.   
  568.   6) For trees, on return from BST_AddChildrenToParent ( ) or BST_InsertSiblingNodes ( ),
  569.   the application usually retrieves the pointer value from the TREE_NODE_DEF
  570.   member 'lpTreeNode', especially for the tree root, and stores it for
  571.   future references to the tree node.  Some of the tree control's
  572.   exported APIs require it as an argument.  In many cases the
  573.   'lpTreeNode' member of the TREE_NODE_DEF structure is ignored.  The 
  574.   notification messages supply the pointer to the tree node involved in a
  575.   event such as a mouse click, so why store it?  Plus, when the tree is
  576.   destroyed, if there is a need to access each tree node before they are 
  577.   deleted then a callback routine can be registered by the application via
  578.   the tree control exported API BST_SetDeleteNodeCallBack ( ).
  579.  
  580.   For lists, once the list items are added via the calls, 
  581.   BSL_AddListItems ( ) and BSL_InsertListItems ( ), the TREE_NODE_DEF
  582.   structures used to defined the list items do not need to be accessed.
  583.   Since a list is linear, indexes are used instead of pointers.  Given an
  584.   index, the API BSL_GetListItem ( ) will return the TREE_NODE pointer so
  585.   the application can access any vital data.
  586. */
  587.  
  588.  
  589. typedef struct TreeNodeDefTag
  590. {
  591.    LP_TREE_NODE  lpTreeNode;    // This member will be assigned the pointer to
  592.                                 // the tree node that the tree control created
  593.                                 // as a result of the application passing this
  594.                                 // structure to the tree control.  In other
  595.                                 // words, this member will be assigned a
  596.                                 // TREE_NODE pointer as a result of the
  597.                                 // application calling
  598.                                 //   BST_AddChildrenToParent ( )
  599.                                 //   BST_InsertSiblingNodes ( ),
  600.                                 //   BSL_AddListItems ( ),  
  601.                                 // or BSL_InsertListItems ( ).  The
  602.                                 // application will use this pointer value as
  603.                                 // an ID in referencing the newly created
  604.                                 // TREE_NODE.  In the case of a list, the
  605.                                 // index location of the list item in the
  606.                                 // list will be used.
  607.             
  608.    WORD    wUserDataSize;       // If this member is 0 then the tree control
  609.                                 // will copy the below pointer, lpUserData,
  610.                                 // into the lpUserData member of the 
  611.                                 // newly created tree node.  When the tree
  612.                                 // node is deleted, it is the reponsibility
  613.                                 // of the application to manage the memory or
  614.                                 // data represented by the lpUserData member.
  615.                                 
  616.                                 // If this member is non zero then the
  617.                                 // tree control will allocate wUserDataSize
  618.                                 // worth of memory and use the below pointer,
  619.                                 // lpUserData, to copy wUserDataSize worth
  620.                                 // of memory pointed to by lpUserData, into
  621.                                 // the newly allocated memory.  Then the 
  622.                                 // pointer to the newly allocated memory will
  623.                                 // be copied into the lpUserData member of
  624.                                 // the new tree node.  When the tree node
  625.                                 // is destroyed, the tree control will free
  626.                                 // the memory.  It is the responsibility of 
  627.                                 // the tree control to manage the memory.
  628.                 
  629.    LPSTR   lpUserData;          // lpUserData is an application defined
  630.                                 // pointer or value that will be stored with
  631.                                 // the newly created tree node.  This member
  632.                                 // will be copied from every TREE_NODE_DEF to
  633.                                 // it's corresponding TREE_NODE.  This is a
  634.                                 // facility that the tree control provides to
  635.                                 // allow the application to tie data to the
  636.                                 // tree node.
  637.                                 // Typically, the application will retrieve
  638.                                 // this pointer when it receives a 
  639.                                 // WM_BST_SELECT_NOTIF or
  640.                                 // WM_BST_SELECT_NOTIF_DBLCLK notification
  641.                                 // from the tree control as a result of an
  642.                                 // event.
  643.                                 // If the above member, wUserDataSize, is zero
  644.                                 // then the tree control only stores the data
  645.                                 // in lpUserData.  If lpUserData is a pointer
  646.                                 // to dynamically allocated data then the tree
  647.                                 // control only stores this pointer.  It will
  648.                                 // not free the memory that this pointer
  649.                                 // points to when the node is destroyed by
  650.                                 // a call to BST_DeleteChildrenOfParent ( ),
  651.                                 // BST_DeleteNode ( ),  BST_EraseTree ( ), or
  652.                                 // when the tree control receives a WM_DESTROY
  653.                                 // message.  This is the responsibility of the
  654.                                 // application.
  655.                 
  656.                                 // To aid in the managing of the data in
  657.                                 // lpUserData, the tree control provides a
  658.                                 // way to register a callback in which the
  659.                                 // tree control will call just before the
  660.                                 // node is destroyed. The API to register a 
  661.                                 // callback is BST_SetDeleteNodeCallBack ( ).
  662.                                 
  663.                                 // If the above member, wUserDataSize, is non
  664.                                 // zero then the tree control will allocate
  665.                                 // wUserDataSize worth of memory and use
  666.                                 // lpUserData to copy wUserDataSize worth
  667.                                 // of memory into the newly allocated memory.
  668.                                 // Then the pointer to the newly allocated
  669.                                 // memory will be copied into the lpUserData 
  670.                                 // member of the new tree node.  When the tree
  671.                                 // node is destroyed, the tree control will
  672.                                 // free the memory.  It is the responsibility
  673.                                 // of the tree control to manage the memory.                                
  674.                 
  675.    WORD    wTextLength; 
  676.                                 // This member states the number of characters
  677.                                 // in which the tree control is to display as 
  678.                                 // text for this tree node.  The source of the
  679.                                 // node text is the lpszText member.
  680.                                 // Normally, the application does a 
  681.                                 // lstrlen ( ) on lpszText and assigns the
  682.                                 // result to wTextLength.  But there may be
  683.                                 // cases that the string pointed to by 
  684.                                 // lpszText is just too long and fewer
  685.                                 // characters are required.
  686.                 
  687.                                 // There is a special attribute of wTextLength
  688.                                 // in which the most significant bit or the
  689.                                 // sign bit acts as a flag.  Depending
  690.                                 // on how this bit is set there are
  691.                                 // two ways to handle text in a tree node.
  692.                                 // In both cases, the application passes
  693.                                 // a long pointer to the text via the lpszText
  694.                                 // member of TREE_NODE_DEF structure.  The
  695.                                 // two methods are:
  696.                 
  697.                                 // 1) If the sign bit of wTextLength
  698.                                 // (0x8000) is set to 1, then the pointer
  699.                                 // in lpszText points to memory owned by 
  700.                                 // the application and is guaranteed not to 
  701.                                 // change (deleted or moved).  
  702.                                 // This signals the tree control to just
  703.                                 // copy the pointer in lpszText of the the
  704.                                 // TREE_NODE_DEF structure to the TREE_NODE
  705.                                 // structure.  The tree control will NOT
  706.                                 // worry about allocating, copying, and
  707.                                 // freeing the memory pointed to be lpszText.
  708.                                 // The pointer is used "as is", to display
  709.                                 // wTextLength worth of the characters pointed
  710.                                 // to by lpszText.
  711.                 
  712.                                 // 2) If the sign bit of
  713.                                 // wTextLength is set to 0, then the tree
  714.                                 // control allocates wTextLength + 1 worth of
  715.                                 // memory.  The tree control then copies
  716.                                 // wTextLength worth of characters from the
  717.                                 // string pointed to by the lpszText member
  718.                                 // of the TREE_NODE_DEF to the memory pointed
  719.                                 // to by the lpszText member of the newly
  720.                                 // created TREE_NODE.  This will be the text
  721.                                 // displayed by the tree control.  When the
  722.                                 // node is to be deleted, the tree control
  723.                                 // will free the memory pointed to by lpszText
  724.                                 // in the TREE_NODE since it belongs to the 
  725.                                 // tree control.
  726.                 
  727.                                 // The 1) method is usually
  728.                                 // used with static databases and the 2)
  729.                                 // method is used with real-time systems.  And
  730.                                 // of course, both methods can be intermixed.
  731.                                 // The obvious advantage of using method 1)
  732.                                 // is the faster performance and use of 
  733.                                 // less memory since the application already
  734.                                 // has memory allocated.
  735.                                 
  736.                                 // NOTE:  If the low 15 bits of wTextLength
  737.                                 // are set to 0 then lpszText is set to NULL
  738.                                 // by the tree control, meaning there is no
  739.                                 // text to display.   
  740.    LPSTR   lpszText;            
  741.                                 // The application supplies a long pointer to
  742.                                 // a string that it wishes to be displayed in
  743.                                 // the tree control for a given node.  The
  744.                                 // application must specify the length of
  745.                                 // string to be displayed in wTextLength.
  746.                                 
  747.                                 // Please refer to the wTextLength
  748.                                 // documentation above for an understanding
  749.                                 // of the different methods that can be 
  750.                                 // applied to the handling of lpszText.   
  751.  
  752.    BYTE    chBitmapTypeBits; 
  753.                                 // Starting from the least significant bit,
  754.                                 // each bit position corresponds to an 
  755.                                 // index into the hBitmap[] array starting at
  756.                                 // 0.  Only MAX_BITMAPS worth of bits have
  757.                                 // significance.
  758.                                 // These bits tell the tree control whether
  759.                                 // it's corresponding hBitmap[] array member
  760.                                 // is a bitmap handle or an icon
  761.                                 // handle.  For example, if the least
  762.                                 // significant bit of chBitmapTypeBits
  763.                                 // is set to 0 then the handle in
  764.                                 // hBitmap[0] is a handle to a bitmap.
  765.                                 // If this bit is set to 1 then
  766.                                 // the handle in hBitmap[0] is a handle
  767.                                 // to an icon.
  768.       
  769.    HBITMAP hBitmap[MAX_BITMAPS];// hBitmap[] is an array of handles to bitmaps
  770.                                 // and icons to be displayed for the given
  771.                                 // node, left to right, before the tree node
  772.                                 // text.  
  773.                    
  774.                                 // The member chBitmapTypeBits is the
  775.                                 // indicator of which handles are bitmap
  776.                                 // handles and which are icon handles.
  777.                                 // chBitmapTypeBits and hBitmap[] are
  778.                                 // initially defined by the
  779.                                 // application before a tree node is created.
  780.                                 // These items can be changed later by calling
  781.                                 // the exported APIs, 
  782.                                 //  BST_SetBitmap ( ), 
  783.                                 //  BST_SetBitmapAndActiveBitmap ( ),
  784.                                 //  BST_SetIcon ( ),
  785.                                 //  BSL_SetBitmap ( ), 
  786.                                 //  BSL_SetBitmapAndActiveBitmap ( ), and
  787.                                 //  BSL_SetIcon ( ).
  788.                 
  789.                                 // For documentation purposes icons and
  790.                                 // bitmaps will be referred to as bitmaps for
  791.                                 // the rest of this discussion.
  792.                  
  793.                                 // A NULL value for any of the array
  794.                                 // members will signal to the tree control
  795.                                 // that NO bitmap has been specified for this
  796.                                 // array member.  All array members are
  797.                                 // checked by the tree control for non-NULL
  798.                                 // handles.  Each non-NULL bitmap handle will
  799.                                 // be used to display the bitmap in it's
  800.                                 // corresponding bitmap position.  Applications
  801.                                 // must make sure that the array members NOT
  802.                                 // containing a bitmap handle are set to NULL.
  803.                                 // The tree control does NOT validate
  804.                                 // tree handles!
  805.                 
  806.                                 // Each handle in the hBitmap[] array 
  807.                                 // is associated with a bitmap space.  A
  808.                                 // bitmap is displayed inside the rectangular
  809.                                 // region of it's corresponding bitmap space.
  810.                                 // Bitmap spaces offer the application the
  811.                                 // ability to fine tune each bitmap position
  812.                                 // and to define each bitmap hit test area.
  813.                                 // Hit testing is not performed on the bitmap
  814.                                 // but the bitmap space.  The width and
  815.                                 // height of a bitmap space are defined by
  816.                                 // the exported APIs, BST_SetBitmapSpace ( )
  817.                                 // and BSL_SetBitmapSpace ( ).
  818.                                 // The dimensions of a bitmap space are 
  819.                                 // defined globally.  The reason for this
  820.                                 // is to keep column alignment of the
  821.                                 // bitmaps.  This is visually pleasing
  822.                                 // and offers consistency with hit testing.
  823.                                 // If the application does not call 
  824.                                 // BST_SetBitmapSpace ( ) or 
  825.                                 // BSL_SetBitmapSpace ( ), to define a 
  826.                                 // bitmap space width and height, then the
  827.                                 // bitmap space default width and height are
  828.                                 // both zero making the bitmap space
  829.                                 // invisible.  Even if a valid handle is 
  830.                                 // associated with this bitmap space, the
  831.                                 // bitmap will not be displayed.  
  832.                 
  833.                                 // Some useful techniques and tips to utilize
  834.                                 // bitmap spaces are listed below:
  835.                                 
  836.                                 // 1) Setting the bitmap space width greater
  837.                                 // than the corresponding bitmap's width can
  838.                                 // be used to set gaps between bitmaps.
  839.                 
  840.                                 // 2) Setting the bitmap space height greater
  841.                                 // than the corresponding bitmap's height
  842.                                 // can be used to allocate space between tree
  843.                                 // nodes.
  844.                 
  845.                                 // 3) If the application needs to make a
  846.                                 // bitmap and it's corresponding bitmap space
  847.                                 // disappear but leave the bitmap handle
  848.                                 // unchanged in the hBitmap[] array, the 
  849.                                 // application only needs to set the bitmap
  850.                                 // space width or height to 0.  The
  851.                                 // tree control will collapse the bitmap
  852.                                 // space out of existance.
  853.                                 // Later, if the application wishes to show
  854.                                 // the bitmap again, the application will need
  855.                                 // to set the bitmap space width and height
  856.                                 // to non zero values.
  857.                                 
  858.                                 // 4) If a hBitmap[] array element contains
  859.                                 // a NULL bitmap handle but it's corresponding 
  860.                                 // bitmap space width and height are non zero
  861.                                 // then the tree control will draw the space
  862.                                 // with no bitmap in it.  This is true only
  863.                                 // if there is a bitmap that is displayable
  864.                                 // to the right of the empty space.  If there
  865.                                 // is no bitmap that is displayable to the
  866.                                 // right of the empty space, then the tree
  867.                                 // node text will be left justified next
  868.                                 // to the last displayed bitmap.
  869.  
  870.    HBITMAP hActiveBitmap[MAX_BITMAPS];
  871.                                 // Handles of bitmaps/icons to be display when
  872.                                 // the tree node is active (which means
  873.                                 // highlighted).
  874.                 
  875.                                 // For documentation purposes icons and
  876.                                 // bitmaps will be referred to as bitmaps for
  877.                                 // the rest of this discussion.
  878.                 
  879.                                 // Handles of bitmaps/icons to be display when
  880.                                 // the tree node is active (which means
  881.                                 // highlighted).
  882.                 
  883.                                 // For documentation purposes icons and
  884.                                 // bitmaps will be referred to as bitmaps for
  885.                                 // the rest of this discussion.
  886.                 
  887.                                 // hActiveBitmap[] array elements need to be
  888.                                 // assigned to a NULL by the application
  889.                                 // if no bitmap handle is supplied.  If a 
  890.                                 // hActiveBitmap[] array element is
  891.                                 // NULL but the hBitmap[] index equivalent is
  892.                                 // non-NULL then that hBitmap[] handle is used
  893.                                 // to display the bitmap when the tree node
  894.                                 // is selected.  hActiveBitmap[] is only
  895.                                 // referenced to display the bitmap if the
  896.                                 // tree node is highlighted
  897.                                 // and hActiveBitmap[] has a non-zero
  898.                                 // corresponding hBitmap[] array member.
  899.                                 // Besides the above conditions, the handling
  900.                                 // of this array of bitmap handles
  901.                                 // follow the same rules and conditions as
  902.                                 // hBitmap[].
  903. }
  904. TREE_NODE_DEF;
  905.  
  906. typedef TREE_NODE_DEF FAR* LP_TREE_NODE_DEF;
  907.  
  908.  
  909.  
  910.  
  911. /*  SELECT_NOTIF structure
  912.  
  913. typedef struct SelectNotifTag
  914. {
  915.    WORD         wFlags;      
  916.    LP_TREE_NODE lpTreeNode;  
  917. }
  918. SELECT_NOTIF;
  919.  
  920. typedef SELECT_NOTIF FAR* LP_SELECT_NOTIF;
  921.  
  922.    NOTE: If in the the context of a listbox control, references to the word
  923.    "tree" should be replaced with the word "list" and references to the 
  924.    phrase "tree node" should be replaced with the phrase "list item".
  925.  
  926.  
  927.    A pointer to this structure is passed as the lParam of the 
  928.    node selection notification messages.  These notification messages are:
  929.    
  930.    Notification                   Cause
  931.       
  932.    WM_BST_SELECT_NOTIF         - Single click left mouse button while over
  933.                                  tree node.
  934.                                - Select node with up or down arrow.
  935.                                - Select node with page up or page down key.
  936.                                - Select node with home or end key.
  937.                                - Select node with Ctrl Up or Ctrl Down.
  938.                  
  939.    WM_BST_SELECT_NOTIF_DBLCLK  - Double click left mouse button while over
  940.                                  tree node.  Sends WM_BST_SELECT_NOTIF on
  941.                                  first click.
  942.                                - Hit carriage return while a node is selected.
  943.                                - '+' key if the currently selected node has no
  944.                                  children.
  945.                                - '-' key if the currently selected node has
  946.                                  children.
  947.                  
  948.    WM_BST_DODRAG               - Depress the left mouse button over a tree
  949.                                  node and while continuing to hold down the
  950.                                  left button, move the mouse a predetermined
  951.                                  distance.
  952.       
  953.    When a notification is received the wParam is the window handle of the
  954.    tree control and lParam is a pointer to a SELECT_NOTIF structure.
  955.    The 'lpTreeNode' member of the SELECT_NOTIF structure is a pointer to the
  956.    TREE_NODE that is involved in the notification.  The 'wFlags' member
  957.    reflects the state of tree node.  The bit definitions for the 'wFlags'
  958.    member are described below under the title TREE CONTROL NODE STATES..
  959.    
  960.    The SELECT_NOTIF memory is the property of the tree control and is NOT to be
  961.    freed or modified by the application.  Just return back to the tree control
  962.    from the SendMessage (notification) and everything will be alright.
  963. */
  964.  
  965. typedef struct SelectNotifTag
  966. {
  967.    WORD         wFlags;      // The states of the node are discussed below.
  968.    LP_TREE_NODE lpTreeNode;  // Selected node from a single click or double
  969.                              // click.
  970. }
  971. SELECT_NOTIF;
  972.  
  973. typedef SELECT_NOTIF FAR* LP_SELECT_NOTIF;
  974.  
  975.  
  976. /****************************************************************************/
  977. /*                    TREE/LIST CONTROL NODE STATES                         */
  978. /****************************************************************************/
  979.  
  980. /*
  981.    NOTE: If in the the context of a listbox control, references to the word
  982.    "tree" should be replaced with the word "list" and references to the 
  983.    phrase "tree node" should be replaced with the phrase "list item".
  984.  
  985.    The 'wFlags' member of the notification structure reflects the tree node's
  986.    state.  This member tells:
  987.     1) the hardware (mouse or keyboard) cause of the click or the double
  988.        click (if it is a click notification) plus the shift states,
  989.     2) whether the node is open or closed where open means that the node
  990.        has children,
  991.     3) what part of the node did the click or drag occur (bitmap space,
  992.        text, ...)
  993.    When the app gets a WM_BST_SELECT_NOTIF_DBLCLK, WM_BST_SELECT_NOTIF, or
  994.    WM_BST_DODRAG notification, the application can examine the 'wFlags' bits
  995.    and determine the appropriate action.
  996. */
  997.  
  998. #define NODE_CLOSED                    0x0000
  999. #define NODE_OPENED                    0x0001
  1000. #define TEXT_HIT                       0x0002
  1001. #define SPACE_BEFORE_FIRST_BITMAP_HIT  0x0004
  1002.  
  1003. //                                       0x0008
  1004. //        R E S E R V E D                0x0010
  1005. //                                       0x0020
  1006.  
  1007. #define KEYBOARD_HIT                   0x0040
  1008. #define SHIFT_KEY_DOWN                 0x0080
  1009. #define CTRL_KEY_DOWN                  0x0100
  1010. #define RBUTTON_DOWN                   0x0200
  1011. #define BITMAP0_HIT                    0x8000
  1012. #define BITMAP1_HIT                    0x4000
  1013. #define BITMAP2_HIT                    0x2000
  1014. //#define BITMAP3_HIT   N O T            0x1000
  1015. //#define BITMAP4_HIT A V A I L A B L E  0x0800
  1016. //#define BITMAP5_HIT                    0x0400
  1017.  
  1018. /****************************************************************************/
  1019. /*                TREE/LIST CONTROL NOTIFICATION MESSAGES                   */
  1020. /****************************************************************************/
  1021. /*
  1022.    NOTE: If in the the context of a listbox control, references to the word
  1023.    "tree" should be replaced with the word "list" and references to the 
  1024.    phrase "tree node" should be replaced with the phrase "list item".
  1025.  
  1026.    Notification                   Event
  1027.       
  1028.    WM_BST_SELECT_NOTIF         - Single click left mouse button while over
  1029.                                  tree node.
  1030.                                - Select node with up or down arrow.
  1031.                                - Select node with page up or page down key.
  1032.                                - Select node with home or end key.
  1033.                                - Select node with Ctrl Up or Ctrl Down.
  1034.  
  1035.   WM_BST_SELECT_NOTIF_DBLCLK  - Double click left mouse button while over
  1036.                                 tree node.  Sends WM_BST_SELECT_NOTIF on
  1037.                                  first click.
  1038.                                - Hit carriage return while a node is selected.
  1039.                                - '+' key if the currently selected node has no
  1040.                                  children.
  1041.                                - '-' key if the currently selected node has
  1042.                                  children.
  1043.                  
  1044.    When a node is selected from the tree, typically by a mouse single or
  1045.    double click, the WM_BST_SELECT_NOTIF or WM_BST_SELECT_NOTIF_DBLCLK 
  1046.    notification is sent to the parent window.  wParam is the window handle of
  1047.    the tree control  and lParam is a pointer to a SELECT_NOTIF structure.
  1048.    This structure is described above.  This pointer is the property of the
  1049.    tree control so just use it to access the members.  The 'lpTreeNode' member
  1050.    will point to the TREE_NODE that was selected and the 'wFlags' member will
  1051.    be set to the attributes listed above.
  1052. */
  1053.  
  1054. #define WM_BST_SELECT_NOTIF        WM_USER+160    // single click
  1055. #define WM_BST_SELECT_NOTIF_DBLCLK WM_USER+170    // double click
  1056.  
  1057. /*
  1058.  
  1059.    When a tree control receives a WM_DROPFILES, a WM_BST_DROPFILES is sent to
  1060.    the parent with wParam and lParam the same values as the WM_DROPFILES.
  1061.    It is the responsibility of the application to process dropped information
  1062.    as if it had received the WM_DROPFILE directly.
  1063. */
  1064.  
  1065. #define WM_BST_DROPFILES           WM_USER+180
  1066.  
  1067. /*
  1068.  
  1069.    WM_BST_DODRAG               - Depress the left mouse button over a tree
  1070.                                  node and while continuing to hold down the
  1071.                                  left button, move the mouse a predetermined
  1072.                                  distance.
  1073.  
  1074.    This notification message is sent to the parent window (application) of the 
  1075.    tree control when the user clicks and holds the left mouse button over a
  1076.    tree node and while continuing to hold down the left button, moves the
  1077.    mouse a predetermined distance.  This predetermined distance is
  1078.    the average character width of the current font for the x axis and the 
  1079.    average character height of the current font for the y axis.  In effect,
  1080.    this notification informs the application that the user is dragging a tree
  1081.    node and that the tree control is relinquishing control to the application
  1082.    so that the application will handle the drag.  The application may use the
  1083.    OLE 2.0 drag/drop classes or process the drag similar to the the article in
  1084.    MSJ May/June 1992 Vol 7 No 3.  wParam is the window handle of
  1085.    the tree control  and lParam is a pointer to a SELECT_NOTIF structure.
  1086.    This structure is described above.  This pointer is the property of the
  1087.    tree control so just use it to access the members.  The 'lpTreeNode'
  1088.    member will point to the TREE_NODE that is being dragged and the 'wFlags'
  1089.    member will be set to the attributes listed above.   
  1090. */
  1091.  
  1092. #define WM_BST_DODRAG              WM_USER+190
  1093.  
  1094. /*----------------------------------EOF-------------------------------------*/
  1095.