www.pudn.com > ExpBar_src.zip > ExpBarXP.h


/* 
 * file           : ExpBarXP.h 
 * language       : Visual C++ (6+) 
 * plattform      : Win32 (Windows 98/Me/NT/2000/XP) 
 * description    : implements a MFC wrapper for the xp-style explorer bar 
 *                  (explorerbar.dll) 
 * dependencies   : 1.) this source depends on sizecbar.h, scbarg.h and scbarcf.h 
 *                      (sizeable control bar by Cristi Posea http://www.datamekanix.com 
 *                       or http://www.codeproject.com/docking/sizecbar.asp) 
 *                  2.) explorerbar[D|U|UD].dll by Ingo A. Kubbilun 
 * 
 * usage          : add to stdafx.h: 
 * ================ 
 *                  #define _SCB_REPLACE_MINIFRAME 
 *                  #include "sizecbar.h" 
 *                  #include "scbarg.h" 
 *                  #include "scbarcf.h" 
 *                  #include "explorerbar.h" 
 *                  #include "ExpBarXP.h" 
 * 
 * revision history: 
 * ================= 
 * 
 * date:       author:           description: 
 * -------------------------------------------------------------------------- 
 * 02/17/2004  Ingo A. Kubbilun  first published version 1.0 
 */ 
 
#if !defined(_EXPBARXP_H__INCLUDED_) 
#define _EXPBARXP_H__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
///////////////////////////////////////////////////////////////////////////// 
// Class CExpBarXP  
 
#ifndef _baseclassExpBarXP 
//#define _baseclassExpBarXP    CSizingControlBarG 
#define _baseclassExpBarXP    CSizingControlBarCF 
#endif 
 
class CExpBarXP : public _baseclassExpBarXP 
{ 
// Constructor 
public: 
	CExpBarXP(); 
 
// Attributes 
protected: 
  HWND              m_hwndExpBar; // handle to the explorer bar control 
 
// Methods 
public: 
 
  BOOL AddPane ( UINT       uPaneId, 
                 LPCTSTR    lpcszHeaderTitle, 
                 UINT       uHeaderStyle, 
                 LPCTSTR    lpcszDlgTemplate, 
                 CWnd      *pCWndMsg, 
                 int        iIndex=-1 ); 
 
  BOOL AddPane ( UINT         uPaneId, 
                 LPCTSTR      lpcszHeaderTitle, 
                 UINT         uHeaderStyle, 
                 LPCTSTR      lpcszDlgTemplate, 
                 CWnd        *pCWndMsg, 
                 CImageList  *pImgList, 
                 int          iIconIdx, 
                 int          iIndex=-1 ); 
 
  BOOL AddPane ( UINT         uPaneId, 
                 LPCTSTR      lpcszHeaderTitle, 
                 UINT         uHeaderStyle, 
                 LPCTSTR      lpcszDlgTemplate, 
                 CWnd        *pCWndMsg, 
                 HIMAGELIST   hImgList, 
                 int          iIconIdx, 
                 int          iIndex=-1 ); 
 
  BOOL DelPane ( UINT uPaneId ); 
 
  BOOL ExpandPane ( UINT uPaneId, UINT uAnimate=0L ); 
 
  BOOL CollapsePane ( UINT uPaneId, UINT uAnimate=0L ); 
 
  BOOL ScrollPaneVisible ( UINT uPaneId ); 
 
  HWND GetPaneHeaderWindow ( UINT uPaneId ); 
 
  HWND GetPaneDialogWindow ( UINT uPaneId ); 
 
  inline LRESULT ThreadSendMessage ( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) 
  { 
    DWORD_PTR     lResult; 
    if (!SendMessageTimeout(hwnd,uMsg,wParam,lParam,SMTO_NORMAL,100000,&lResult)) 
      return 0L; 
    else 
      return (LRESULT)lResult; 
  } 
 
  inline LRESULT ThreadSendDlgItemMessage ( HWND hwnd, int iItem, UINT uMsg, WPARAM wParam, LPARAM lParam ) 
  { 
    DWORD_PTR     lResult; 
    HWND          hwndCtl = ::GetDlgItem(hwnd,iItem); 
       
    if ((!hwndCtl) || (!SendMessageTimeout(hwndCtl,uMsg,wParam,lParam,SMTO_NORMAL,100000,&lResult))) 
      return 0L; 
    else 
      return (LRESULT)lResult; 
  } 
 
  inline BOOL CheckDlgButton ( HWND hDlg, int nIDButton, UINT uCheck ) 
  { 
    return (BOOL)ThreadSendDlgItemMessage(hDlg,nIDButton,CBBM_SETCHECK,(WPARAM)(uCheck&3),0L); 
  } 
 
  inline BOOL CheckRadioButton ( HWND hDlg, int nIDFirstButton, int nIDLastButton, int nIDCheckButton ) 
  { 
    if ((nIDLastButtonnIDLastButton)) 
      return FALSE; 
    for (int i=nIDFirstButton;i<=nIDLastButton;i++) 
      if (i==nIDCheckButton) 
        ThreadSendDlgItemMessage(hDlg,i,CBBM_SETCHECK,(WPARAM)CBBST_CHECKED,0L); 
      else 
        ThreadSendDlgItemMessage(hDlg,i,CBBM_SETCHECK,(WPARAM)CBBST_UNCHECKED,0L); 
    return TRUE; 
  } 
 
  inline UINT IsDlgButtonChecked ( HWND hDlg, int nIDButton ) 
  { 
    return (UINT)ThreadSendDlgItemMessage(hDlg,nIDButton,CBBM_GETCHECK,0,0); 
  } 
 
	//{{AFX_VIRTUAL(CExpBarXP) 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	virtual ~CExpBarXP(); 
 
  virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd, 
                      UINT nID,  
                      DWORD dwStyle ); 
 
	// Message handling 
protected: 
	//{{AFX_MSG(CExpBarXP) 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
	afx_msg void OnDestroy(); 
	afx_msg void OnSize(UINT nType, int cx, int cy); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
 
#endif // _EXPBARXP_H__INCLUDED_