home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////////
- // subvbctl.cpp : implementation of the CVBClone class and CMyGrid class
- //
-
- #include "stdafx.h"
- #include "subvbctl.h"
-
- /////////////////////////////////////////////////////////////////////////////
- // CVBClone
- typedef CVBControl* __based((__segment)_self)* FAR* CVBHandle;
-
- //***********************************************************
- //
- // CVBClone :: SubclassVBControl()
- //
- // Purpose: Copies data from an existing CVBControl class
- // into this class. It also detaches the old
- // class and attaches this one.
- //
- // Parameters: CWnd* pParent parent window of the control
- // UINT idChild child window ID of control
- // BOOL bEmbedded Inicates if contol is embedded
- // in an object that will be
- // cleaned up or if this object
- // should be deleted when the
- // control is deleted
- //
- // Return: None
- //
- // Comments:
- //
- // History: Date Author Comment
- // 5/13/93 Brian Scott Created
- // with help from John Seghers
- //
- //*************************************************************
-
- void CVBClone::SubclassVBControl(CWnd* pParent, UINT idChild, BOOL bEmbedded)
- {
- ASSERT(pParent != NULL);
- ASSERT(idChild != 0 && idChild != -1);
-
- //
- // Get the existing CVBControl. Cast it to this class type
- // so that we will have access to the protected data
- //
- CVBClone* pControl = (CVBClone*)pParent->GetDlgItem(idChild);
- ASSERT(pControl->IsKindOf(RUNTIME_CLASS(CVBControl)));
-
- // Copy over all of the appropriate data
- m_pModel = pControl->m_pModel;
-
- m_bRecreating = pControl->m_bRecreating;
- m_bInPostNcDestroy = pControl->m_bInPostNcDestroy;
- m_bLoading = pControl->m_bLoading;
- m_nCursorID = pControl->m_nCursorID;
-
- m_nInitialStack = pControl->m_nInitialStack;
- m_nRecursionLevel = pControl->m_nRecursionLevel;
- m_bStackFault = pControl->m_bStackFault;
- m_nFaultRecurse = pControl->m_nFaultRecurse;
-
- m_hbrBkgnd = pControl->m_hbrBkgnd;
- m_hFontCreated = pControl->m_hFontCreated;
- m_hcurMouse = pControl->m_hcurMouse;
- m_hCtl = pControl->m_hCtl;
- m_clrBkgnd = pControl->m_clrBkgnd;
- m_clrFore = pControl->m_clrFore;
- m_rectCreate = pControl->m_rectCreate;
- m_strTag = pControl->m_strTag;
-
- m_bAutoDelete = !bEmbedded;
-
- // Clear data in the old CVBControl that would cause problems
- pControl->m_pModel = NULL;
- pControl->m_hCtl = NULL;
- CVBHandle hpControl = (CVBHandle) m_hCtl;
- **hpControl = this;
-
- pControl->m_hFontCreated=NULL;
- pControl->m_hbrBkgnd=NULL;
- pControl->m_hcurMouse=NULL;
-
- // Transfer hWnd
- Attach(pControl->Detach());
-
- // Delete old object if necessary
- if (pControl->m_bAutoDelete)
- delete pControl;
- }
-
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyGrid
-
- BEGIN_MESSAGE_MAP(CMyGrid, CVBClone)
- //{{AFX_MSG_MAP(CMyGrid)
- ON_WM_GETDLGCODE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyCircle construction/destruction
-
- CMyGrid::CMyGrid()
- {
- // TODO: add construction code here
- }
-
- CMyGrid::~CMyGrid()
- {
- // TODO: add destruction code here
- }
-
-
- UINT CMyGrid::OnGetDlgCode()
- {
- return (CVBClone::OnGetDlgCode() | DLGC_WANTARROWS);
- }
-