www.pudn.com > 21920013.rar > Dlg1.cpp


// Dlg1.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "test.h" 
#include "Dlg1.h" 
//#include "MainFrm.h" 
 
//#include "stdafx.h" 
#include "resource.h"//"OutWAts1.h" 
#include "GfxOutBarCtrl.h" 
#include "GfxGroupEdit.h" 
 
#include "GfxPopupMenu.h" 
 
#define _ID_GFX_SMALLICON	"小图标方式" 
#define _ID_GFX_LARGEICON	"大图标方式" 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
#define IDC_MYLIST 10100 
///////////////////////////////////////////////////////////////////////////// 
// CDlg1 dialog 
 
IMPLEMENT_DYNCREATE(CDlg1, CDialog) 
 
CDlg1::CDlg1(CWnd* pParent /*=NULL*/) 
	: CDialog(CDlg1::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CDlg1) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CDlg1::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CDlg1) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CDlg1, CDialog) 
	//{{AFX_MSG_MAP(CDlg1) 
	//}}AFX_MSG_MAP 
//	ON_MESSAGE(WM_OUTBAR_NOTIFY, OnOutbarNotify) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CDlg1 message handlers 
 
BOOL CDlg1::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	DWORD dwf = CGfxOutBarCtrl::fDragItems|CGfxOutBarCtrl::fEditGroups|CGfxOutBarCtrl::fEditItems|CGfxOutBarCtrl::fRemoveGroups| 
		CGfxOutBarCtrl::fRemoveItems|CGfxOutBarCtrl::fAddGroups|CGfxOutBarCtrl::fAnimation 
		|CGfxOutBarCtrl::fSelHighlight; 
	 
	 
	wndBar.Create(WS_CHILD|WS_VISIBLE, CRect(10,12,130,300), this,IDC_MYLIST, dwf); 
	wndBar.SetOwner(this); 
	 
	imaLarge.Create(IDB_IMAGELIST, 32, 0, RGB(0,130,132)); 
	imaSmall.Create(IDB_SMALL_IMAGELIST, 16, 0, RGB(0,128,128)); 
	 
	wndBar.SetImageList(&imaLarge, CGfxOutBarCtrl::fLargeIcon); 
	wndBar.SetImageList(&imaSmall, CGfxOutBarCtrl::fSmallIcon); 
	wndBar.SetAnimationTickCount(20); 
	wndBar.SetAnimSelHighlight(200); 
	wndBar.AddFolder("我的好友", 0); 
	wndBar.AddFolder("mm",1); 
	wndBar.AddFolder("小妹妹", 2); 
	wndBar.AddFolder("陌生人", 3); 
	wndBar.AddFolder("黑名单", 4); 
	 
	 
	wndBar.InsertItem(0, 0, "mm", 0, 0); 
	wndBar.InsertItem(0, 1, "angle", 1, 0); 
	wndBar.InsertItem(0, 2, "格格", 2, 0); 
	wndBar.InsertItem(0, 3, "丁晶", 3, 0); 
	wndBar.InsertItem(0, 4, "CoCo", 0, 0); 
	wndBar.InsertItem(0, 5, "frost", 1, 0); 
	wndBar.InsertItem(0, 6, "谢朝阳", 2, 0); 
	wndBar.InsertItem(0, 7, "Kelly", 3, 0); 
	wndBar.InsertItem(0, 8, "宝贝", 0, 0); 
	wndBar.InsertItem(0, 9, "雪儿", 1, 0); 
	wndBar.InsertItem(0, 10, "闭月体花", 2, 0); 
	wndBar.InsertItem(0, 11, "Love", 3, 0); 
	wndBar.InsertItem(0, 12, "wife", 0, 0); 
	wndBar.InsertItem(0, 13, "Yangdd", 1, 0); 
	wndBar.InsertItem(0, 14, "秋叶子", 2, 0); 
	wndBar.InsertItem(0, 15, "马世俊", 3, 0); 
	 
	wndBar.InsertItem(0, 1, "宫立波", 3, 0); 
	wndBar.InsertItem(0, 17, "大师", 3, 0); 
	 
	 
	wndBar.InsertItem(2, 0, "我们", 0, 0); 
	wndBar.InsertItem(2, 1, "测试",0,0); 
	wndBar.InsertItem(2, 2, "fox", 2, 0); 
	wndBar.InsertItem(2, 3, "Virus", 3, 0); 
	 
	wndBar.SetSelFolder(0); 
	m_openWindow.left   =  
		m_openWindow.top    =  
		m_openWindow.right  =  
		m_openWindow.bottom = 0; 
/*	m_SearchBtn.SetIcon(IDR_SEARCH); 
	m_NewsBtn.SetIcon(IDR_SJ); 
	m_MicqBtn.SetBitmap(IDB_XICQ,IDB_MICQ); 
	m_MessageBtn.SetIcon(IDR_MESSAGE); 
	m_LoginBtn.SetIcon(IDR_MDISABLE,IDR_QQ); 
	m_IeBtn.SetIcon(IDR_HOMEPAGE); 
	m_HandBtn.SetIcon(IDR_SJ1); 
	m_FriBtn.SetIcon(IDR_FRIEND); 
	m_ChatBtn.SetIcon(IDR_CHAT); 
*/	 
	 
//	m_resize.Create( this, TRUE,300); 
	 
 
//	m_resize.Add( rInfo ); 
//	m_resize.SetMinimumTrackingSize(); 
	return TRUE;   
} 
long CDlg1::OnOutbarNotify(WPARAM wParam, LPARAM lParam) 
{ 
	switch (wParam) 
	{ 
		case NM_OB_ITEMCLICK: 
		// cast the lParam to an integer to get the clicked item 
			{ 
				int index = (int) lParam; 
				CString cs, cs1; 
				cs1 = wndBar.GetItemText(index); 
				cs.Format("Clicked on %d - <%s>", (int)lParam, cs1); 
				AfxMessageBox(cs); 
			} 
		return 0; 
 
		case NM_OB_ONLABELENDEDIT: 
		// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited item 
		// return 1 to do the change and 0 to cancel it 
			{ 
				OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam; 
				TRACE2("Editing item %d, new text:%s\n", pOI->index, pOI->cText); 
			} 
		return 1; 
 
		case NM_OB_ONGROUPENDEDIT: 
		// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited folder 
		// return 1 to do the change and 0 to cancel it 
			{ 
				OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam; 
				TRACE2("Editing folder %d, new text:%s\n", pOI->index, pOI->cText); 
			} 
		return 1; 
 
		case NM_OB_DRAGITEM: 
		// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the dragged items 
		// return 1 to do the change and 0 to cancel it 
			{ 
				OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam; 
				TRACE2("Drag item %d at position %d\n", pOI->iDragFrom, pOI->iDragTo); 
			} 
		return 1; 
	} 
	return 0; 
} 
 
 
UINT CALLBACK CDlg1::HookProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 
{ 
 /* // subclassing is dont in the first WM_NOTIFY after CDN_INITDONE 
  if( msg == WM_NOTIFY && lParam ) 
  { 
    OFNOTIFY * notify = (OFNOTIFY *)lParam; 
    FOpenInfo *   info   = reinterpret_cast(notify->lpOFN->lCustData); 
 
    // don't use CDN_INITDONE, because at this time 
    // the listview is not created 
    if( notify->hdr.code != CDN_INITDONE && 
        info && info->resize == NULL ) 
    { 
      HWND hWndParent = ::GetParent( hWnd ); 
      CResizeCtrl * resize  = new CResizeCtrl( hWndParent ); 
      // save object in lpOFN->lCustData 
      info->resize = resize; 
 
      // Find Toolbar, because its ID = IDOK 
      HWND hWndToolBar = NULL; 
      for( HWND hWndCtl = ::GetWindow(hWndParent, GW_CHILD);  
           hWndToolBar == NULL && ::IsWindow( hWndCtl);  
           hWndCtl = ::GetWindow( hWndCtl, GW_HWNDNEXT ) ) 
      { 
        char szBuf[ 64 ]; 
        ::GetClassName( hWndCtl, szBuf, sizeof szBuf ); 
        if( ::lstrcmpi( szBuf, TOOLBARCLASSNAME ) == 0 ) 
          hWndToolBar = hWndCtl; 
      } 
    /*  if( hWndToolBar ) 
      // toolbar 1 
      resize->Add(  
             hWndToolBar, 100,   0,   0,   0 ); 
      // ComboBox 
      resize->Add( 0x471,   0,   0, 100,   0 ); 
      // ListView 461 
      resize->Add( 0x461,   0,   0, 100, 100 ); 
      // Edit      480 
      resize->Add( 0x480,   0, 100, 100,   0 ); 
      // ComboBox   470 
      resize->Add( 0x470,   0, 100, 100,   0 ); 
      // Mit Schreibschutz 410 
      resize->Add( 0x410,   0, 100,   0,   0 ); 
      // Dateiname 442 
      // DateiTyp   441 
      resize->Add( 0x441,   0, 100,   0,   0 ); 
      resize->Add( 0x442,   0, 100,   0,   0 ); 
      // 謋fnen 1 
      resize->Add( 1,     100, 100,   0,   0 ); 
      resize->Add( 2,     100, 100,   0,   0 ); 
 
      resize->SetMinimumTrackingSize(); 
      resize->SetGripEnabled( TRUE ); 
	   
      // restore previous Position 
      if( info->rect              && 
          info->rect->Width()  > 0 && 
          info->rect->Height() > 0 ) 
      { 
        ::MoveWindow( hWndParent, info->rect->left, info->rect->top, 
                      info->rect->Width(), info->rect->Height(), TRUE );                              
      } 
    } 
  } 
  */ 
  return 0; 
} 
 
BOOL CDlg1::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	 
	return CDialog::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); 
}