- dynscreens.zip
- AddToYourProject
- help
- MFC Screen Designer FREE classes.doc
- MFC Screen Designer FREE classes.pdf
- MFC Screen Designer Retail Classes.doc
- MFC Screen Designer Retail Classes.pdf
- SAMPLE
- FV - VC7
- FV
- NewExample - VC7
- NewExample
- screenshot.gif
- UseInYourProject
- dynscreen.rc
- res
- checkcurs.cur
- combocurs.cur
- datecurs.cur
- dyntoolbar.bmp
- editcurs.cur
- groupcurs.cur
- labelcurs.cur
- multieditcurs.cur
- radiocurs.cur
|
// Copyright � 2002 Oink!
// FILE NAME : DynControlBar.cpp
// DESCRIPTION : Control toolbar
//
// PROGRAMMER DATE PATCH DESCRIPTION
// ============ =========== ======= ===============================================
#include "stdafx.h"
#include "DynControlBar.h"
#include <afxadv.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDynControlBar
CDynControlBar::CDynControlBar()
{
// default constructor
// initialise the clipboard format for drag and drop
m_nIDClipFormat = RegisterClipboardFormat("ScreenDesigner");
m_bMakingVisible = FALSE;
}
CDynControlBar::~CDynControlBar()
{
}
BEGIN_MESSAGE_MAP(CDynControlBar, CToolBar)
//{{AFX_MSG_MAP(CDynControlBar)
ON_WM_CREATE()
ON_WM_WINDOWPOSCHANGED()
//}}AFX_MSG_MAP
ON_NOTIFY_REFLECT(TBN_BEGINDRAG,BeginDrag)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDynControlBar message handlers
void CDynControlBar::BeginDrag(NMHDR* pNotifyStruct, LRESULT* result)
{
// called when the user attempts to drag a button
if (pNotifyStruct->code == TBN_BEGINDRAG)
{
COleDataSource srcItem;
CString sType = _T("");
HGLOBAL hTextData = 0;
TBNOTIFY* sat = (TBNOTIFY*)pNotifyStruct;
CSharedFile clipb (GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT);
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONEDIT)
{
dynDropSource.nCursorType = dynDropSource.EDIT;
CString strText;
strText.Format("%d",ID_DYNBUTTONEDIT);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONEDITMULTI)
{
dynDropSource.nCursorType = dynDropSource.EDIT;
CString strText;
strText.Format("%d",ID_DYNBUTTONEDITMULTI);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONLABEL)
{
dynDropSource.nCursorType = dynDropSource.LABEL;
CString strText;
strText.Format("%d",ID_DYNBUTTONLABEL);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONCOMBO)
{
dynDropSource.nCursorType = dynDropSource.COMBO;
CString strText;
strText.Format("%d",ID_DYNBUTTONCOMBO);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONGROUP)
{
dynDropSource.nCursorType = dynDropSource.GROUP;
CString strText;
strText.Format("%d",ID_DYNBUTTONGROUP);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONCHECK)
{
dynDropSource.nCursorType = dynDropSource.CHECK;
CString strText;
strText.Format("%d",ID_DYNBUTTONCHECK);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONDATE)
{
dynDropSource.nCursorType = dynDropSource.DATE;
CString strText;
strText.Format("%d",ID_DYNBUTTONDATE);
sType = strText;
}
if (((TBNOTIFY*)pNotifyStruct)->iItem == ID_DYNBUTTONRADIO)
{
dynDropSource.nCursorType = dynDropSource.RADIO;
CString strText;
strText.Format("%d",ID_DYNBUTTONRADIO);
sType = strText;
}
if (sType.IsEmpty())
{
// no control selected?
return;
}
GetToolBarCtrl().SetState(((TBNOTIFY*)pNotifyStruct)->iItem,TBSTATE_PRESSED);
clipb.Write(sType, sType.GetLength()*sizeof(TCHAR));
hTextData = clipb.Detach();
srcItem.CacheGlobalData(m_nIDClipFormat, hTextData);
srcItem.DoDragDrop(DROPEFFECT_COPY,NULL,&dynDropSource);
GetToolBarCtrl().SetState(((TBNOTIFY*)pNotifyStruct)->iItem,TBSTATE_ENABLED);
}
}
int CDynControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// called to create the toolbar
if (CToolBar::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
void CDynControlBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
{
// controls closing the screen
CToolBar::OnWindowPosChanged(lpwndpos);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.