home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / directx / bellhop / cgrptree.h < prev    next >
C/C++ Source or Header  |  1997-07-14  |  4KB  |  121 lines

  1. #ifndef __CGRPTREE__
  2. #define __CGRPTREE__
  3.  
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include <commctrl.h>
  7. #include <dplay.h>
  8. #include <dplobby.h>
  9. #include "resource.h"
  10.  
  11. //#DEFINES
  12. #define ST_NO_SUBGROUPS            0
  13. #define ST_SEARCH_SUBGROUPS        1
  14.  
  15. class CGroupTree;
  16.  
  17. typedef enum {  BT_INVALID = 0,
  18.                 BT_GROUP,
  19.                 BT_SHORTCUT_IN_GROUP,
  20.                 BT_PLAYER_IN_GROUP,
  21.                 BT_PLAYER,
  22.              } BRANCH_TYPE;
  23.  
  24. typedef struct tagBRANCHSTRUCT
  25. {
  26.     DPID        dpid;
  27.     BRANCH_TYPE    btType;
  28.     DWORD        dwFlags;
  29. } BRANCHSTRUCT, *LPBRANCHSTRUCT;
  30.  
  31. typedef struct tagENUMTREESTRUCT
  32. {
  33.     DPID            dpidParent;
  34.     CGroupTree *    lpTree;
  35.     BOOL            bRecursive;
  36. } ENUMTREESTRUCT, *LPENUMTREESTRUCT;
  37.  
  38.  
  39. class CGroupTree{
  40. private:
  41.     HINSTANCE        m_hInst;
  42.     HWND            m_hwndTreeView;
  43.     HWND            m_hwndParent;
  44.     HWND            m_hwndEditCtrl;
  45.     HIMAGELIST        m_hImageList;
  46.     int                m_nStagingAreaImg;
  47.     int                m_nGroupImg;
  48.     int                m_nInGroupImg;
  49.     int                m_nPlayerImg;
  50.     int                m_nShortcutInGroupImg;
  51.     int                m_nSpectatorImg;
  52.     int                m_nSessionInProgressImg;
  53.     BOOL            m_fDragging;
  54.     BRANCHSTRUCT    m_bsParentOfDragging;
  55.     BRANCHSTRUCT    m_bsDragging;
  56.     BRANCHSTRUCT    m_bsDropTarget;
  57.     HMENU            m_hMenu,
  58.                     m_hRootMenu,
  59.                     m_hGroupMenu,
  60.                     m_hPlayerMenu,
  61.                     m_hShortcutMenu,
  62.                     m_hPlayerInGroupMenu;
  63.     DPID            m_dpidMenuTarget;
  64.     DPID            m_dpidPlayer;
  65.     DPID            m_dpidLastGroup;
  66.  
  67. private:
  68.     HTREEITEM FindItem( HTREEITEM htiSearchRoot, 
  69.                         DPID dpidTarget, 
  70.                         BRANCH_TYPE bt, 
  71.                         DWORD dwSearch );
  72.     HTREEITEM Insert(    HTREEITEM htiParent, 
  73.                         DPID dpID, 
  74.                         LPSTR lpShortNameA, 
  75.                         BRANCH_TYPE bt, DWORD dwFlags );
  76.     HRESULT    RecursiveRename(    HTREEITEM htiSearchRoot, 
  77.                                 DPID dpidTarget, 
  78.                                 LPSTR lpszName );
  79.     DPID    GetBranchStructOfParent( HTREEITEM htChildItem, LPBRANCHSTRUCT lpbt);
  80.  
  81. public:
  82.     LPDIRECTPLAY3A    m_lpDP3A;
  83.  
  84. public:
  85.     CGroupTree();
  86.     ~CGroupTree();
  87.  
  88.     BOOL    Init( HWND hWnd, LPDIRECTPLAY3A lpDP3A, DPID dpidPlayer );
  89.     HRESULT CreateGroup( DPID dpidGroup,  LPSTR lpszShortNameA, DWORD dwFlags );
  90.     HRESULT CreatePlayer( DPID dpidPlayer,  LPSTR lpszShortNameA, DWORD dwFlags );
  91.     HRESULT DestroyGroup( DPID dpidGroup );
  92.     HRESULT DestroyPlayer( DPID dpidPlayer );
  93.     HRESULT CreateGroupInGroup( DPID dpidParentGroup, DPID dpidChildGroup, LPSTR lpszShortNameA, DWORD dwFlags );
  94.     HRESULT AddPlayerToGroup(DPID dpidGroup, DPID dpidPlayer, DWORD dwFlags);
  95.     HRESULT AddGroupToGroup( DPID dpidParentGroup, DPID dpidShortcut, DWORD dwFlags );
  96.     HRESULT DeletePlayerFromGroup(DPID dpidGroup, DPID dpidPlayer );
  97.     HRESULT DeleteGroupFromGroup( DPID dpidParentGroup, DPID dpidShortcut );
  98.     HRESULT GetPlayerName( DPID dpidPlayerName, LPDPNAME * lplpName );
  99.     HRESULT GetGroupName( DPID dpidGroupName, LPDPNAME * lplpName );
  100.     DPID    GetDPIDOfCurrentSelection(LPBRANCHSTRUCT lpbt = NULL);
  101.     DPID    GetDPIDOfCurrentSelectionParent( LPBRANCHSTRUCT lpbt = NULL);
  102.     HRESULT    SetPlayerName( DPID dpidPlayer, LPSTR lpszShortName );
  103.     HRESULT SetGroupName( DPID dpidPlayer, LPSTR lpszShortName );
  104.     HRESULT Refresh( BOOL bRecursive = TRUE );
  105.     BOOL    Update(LPVOID lpvMsg);
  106.     void    OnBeginDrag(NM_TREEVIEW *lpnmtv); 
  107.     void    OnMouseMove( LONG xCur, LONG yCur); 
  108.     void    OnLButtonUp(void); 
  109.     void    OnRButtonDown( LONG xCur, LONG yCur); 
  110.     void    OnDblClk( LONG xCur, LONG yCur);
  111.     void    Redraw();
  112.     HRESULT    BeginLabelEdit(); 
  113.     void    EndLabelEdit(TV_DISPINFO FAR * lpTVDisp );
  114.     BOOL    OnWM_NOTIFY( WPARAM wParam, LPARAM lParam );
  115.     HRESULT    EditLabel();
  116.     HRESULT CheckAccessRights(TV_DISPINFO FAR * lpTVDisp = NULL);
  117.  
  118. };
  119.  
  120. #endif
  121.