Пример #1
0
BOOL CCmdTarget::OnCmdMsg(UINT nID, int nCode, void* /*pExtra*/, AFX_CMDHANDLERINFO* /*pHandlerInfo*/)
{
	TRACE("CCmdTarget::OnCmdMsg {%s}\n", GetRuntimeClass()->m_lpszClassName);
	if (_ProcessMessage(_Check, NULL, WM_COMMAND, MAKEWPARAM(nID, nCode), 0))
	{
		TRACE("  ProcessMessage{%s}\n", GetRuntimeClass()->m_lpszClassName);
		_ProcessMessage(_Command, NULL, WM_COMMAND, MAKEWPARAM(nID, nCode), 0);
		return TRUE;
	}
	return FALSE;
}
Пример #2
0
BOOL CWnd::SubclassWindow(HWND hWnd)
{
	if (!Attach(hWnd))
		return FALSE;

	// allow any other subclassing to occur
	PreSubclassWindow();

	// now hook into the AFX WndProc
	WNDPROC* lplpfn = GetSuperWndProcAddr();
	WNDPROC oldWndProc = (WNDPROC)::SetWindowLong(hWnd, GWL_WNDPROC,
		(DWORD)AfxGetAfxWndProc());
	ASSERT(oldWndProc != (WNDPROC)AfxGetAfxWndProc);

	if (*lplpfn == NULL)
		*lplpfn = oldWndProc;   // the first control of that type created
#ifdef _DEBUG
	else if (*lplpfn != oldWndProc)
	{
		TRACE0("Error: Trying to use SubclassWindow with incorrect CWnd\n");
		TRACE0("\tderived class.\n");
		TRACE3("\thWnd = $%04X (nIDC=$%04X) is not a %hs.\n", (UINT)hWnd,
			_AfxGetDlgCtrlID(hWnd), GetRuntimeClass()->m_lpszClassName);
		ASSERT(FALSE);
		// undo the subclassing if continuing after assert
		::SetWindowLong(hWnd, GWL_WNDPROC, (DWORD)oldWndProc);
	}
#endif

	return TRUE;
}
Пример #3
0
HRESULT CBaseMatchWnd::GetGenericView(IGenericView** ppView)
{
	if ( m_pMatches == NULL ) return S_FALSE;
	CRuntimeClass* pClass = GetRuntimeClass();
	*ppView = CMatchListView::Attach( CString( pClass->m_lpszClassName ), m_pMatches );
	return S_OK;
}
Пример #4
0
BOOL PathProcessorStrokeVector::IsDifferent(PathProcessorStroke *pOther)
{
	ERROR3IF(pOther == NULL, "Illegal NULL param");

	if (GetRuntimeClass() != pOther->GetRuntimeClass())
		return(TRUE);

	// We're different if we use different stroke definitions
	return(StrokeID != ((PathProcessorStrokeVector *)pOther)->StrokeID);
}
Пример #5
0
bool CObject::IsKindOf (const CRuntimeClass * pClass)  const
{
    CRuntimeClass * pClassThis = GetRuntimeClass ();
    while (pClassThis) {
        if (pClassThis == pClass)   
            return true;

        pClassThis = pClassThis->m_pBaseClass;
    }

    return  false;
}
Пример #6
0
BOOL CObject::IsKindOf(const CRuntimeClass* pClass)const
{
	CRuntimeClass* pClassThis = GetRuntimeClass();
	while(NULL != pClassThis)
	{
		if (pClassThis == pClass)
		{
			return TRUE;
		}
		pClassThis = pClassThis->m_pBaseClass;
	}
	return FALSE;
}
Пример #7
0
/********************************************************************************************

>	BitmapExportOptions *MakeBitmapExportOptions::MakeCopy()

	Author:		Neville_Humphrys (Xara Group Ltd) <*****@*****.**> from Stefan code
	Created:	2/7/97
	Purpose:	Makes a copy object of this object
	See Also:	BitmapExportOptions::CopyFrom(); BitmapExportOptions::MakeCopy();

********************************************************************************************/
BitmapExportOptions *MakeBitmapExportOptions::MakeCopy()
{
	// Get the runtime class info on this object
	CCRuntimeClass *pCCRuntimeClass = GetRuntimeClass();

	// Create another object of the same type
	MakeBitmapExportOptions *temp = (MakeBitmapExportOptions *) pCCRuntimeClass->CreateObject();

	if (temp != NULL)
		temp->CopyFrom(this); // copy the contents accross
	
	return temp;
}
Пример #8
0
BOOL NodeAttribute::IsDifferent(Node *pOther)
{
	// First, check with the base class - this checks the classes are the same type
	if (NodeRenderable::IsDifferent(pOther))
		return(TRUE);

	ERROR3IF(GetRuntimeClass() != pOther->GetRuntimeClass(),
			"Node::IsDifferent base class method seems to have been broken");

	// Check if different using the operator== which is defined from NodeAttribute onwards
	if (*this == *((NodeAttribute *)pOther) )
		return(FALSE);

	return(TRUE);
}
Пример #9
0
BOOL CDialog::OnCmdMsg(UINT nID, int nCode, void* pExtra,
	AFX_CMDHANDLERINFO* pHandlerInfo)
{
	if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
		return TRUE;

	if ((nCode != CN_COMMAND && nCode != CN_UPDATE_COMMAND_UI) ||
			!IS_COMMAND_ID(nID) || nID >= 0xf000)
	{
		// control notification or non-command button or system command
		return FALSE;       // not routed any further
	}

	// if we have an owner window, give it second crack
	CWnd* pOwner = GetParent();
	if (pOwner != NULL)
	{
#ifdef _DEBUG
		if (afxTraceFlags & traceCmdRouting)
			TRACE1("Routing command id 0x%04X to owner window.\n", nID);
#endif
		ASSERT(pOwner != this);
		if (pOwner->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
			return TRUE;
	}

	// last crack goes to the current CWinThread object
	CWinThread* pThread = AfxGetThread();
	if (pThread != NULL)
	{
#ifdef _DEBUG
		if (afxTraceFlags & traceCmdRouting)
			TRACE1("Routing command id 0x%04X to app.\n", nID);
#endif
		if (pThread->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
			return TRUE;
	}

#ifdef _DEBUG
	if (afxTraceFlags & traceCmdRouting)
	{
		TRACE2("IGNORING command id 0x%04X sent to %hs dialog.\n", nID,
				GetRuntimeClass()->m_lpszClassName);
	}
#endif
	return FALSE;
}
Пример #10
0
BOOL PathProcessorStrokeAirbrush::IsDifferent(PathProcessorStroke *pOther)
{
	ERROR3IF(pOther == NULL, "Illegal NULL param");

	if (GetRuntimeClass() != pOther->GetRuntimeClass())
		return(TRUE);

	PathProcessorStrokeAirbrush *pOtherAir = (PathProcessorStrokeAirbrush *)pOther;

	ValueFunction *pMyFunc	  = GetIntensityFunction();
	ValueFunction *pOtherFunc = pOtherAir->GetIntensityFunction();
	if (pMyFunc == NULL || pOtherFunc == NULL)
		return(TRUE);

	// We're the same if we share the same intensity function
	return(pMyFunc->IsDifferent(pOtherFunc));
}
Пример #11
0
BOOL CChildWnd::SaveState(LPCTSTR pszName)
{
	if ( m_bTabMode && m_pGroupParent == NULL )
	{
		CString strName = ( pszName != NULL ) ? CString( pszName ) : CString( GetRuntimeClass()->m_lpszClassName );
		strName += _T(".Splitter");
		theApp.WriteProfileInt( _T("Windows"), strName, (int)( m_nGroupSize * 1000 ) );
		return TRUE;
	}

	if ( ! m_bPanelMode )
	{
		Settings.SaveWindow( pszName, this );
		return TRUE;
	}

	return FALSE;
}
Пример #12
0
// This hack is necessary because the menu ID is a member of the class.
// MFC message maps need the IDs to be global.
BOOL CDocTemplateEx::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
	// determine the message number and code (packed into nCode)
	UINT nMsg = 0;
	int nCod = nCode;

	if (nCod != CN_UPDATE_COMMAND_UI)
	{
		nMsg = HIWORD(nCod);
		nCod = LOWORD(nCod);
	}

	// for backward compatibility HIWORD(nCode)==0 is WM_COMMAND
	if (nMsg == 0)
		nMsg = WM_COMMAND;

	if ((nCod==CN_UPDATE_COMMAND_UI) && (nID>=m_nMenuId) && (nID<=m_nMenuId+MRU_RANGE))	
	{
		BOOL bResult = TRUE; // default is ok
		ASSERT(pExtra != NULL);
		CCmdUI* pCmdUI = (CCmdUI*)pExtra;
		ASSERT(!pCmdUI->m_bContinueRouting);    // idle - not set
		OnUpdateRecentFileMenu(pCmdUI);
		bResult = !pCmdUI->m_bContinueRouting;
		pCmdUI->m_bContinueRouting = FALSE;     // go back to idle
		return bResult;
	}

	if ((nMsg==WM_COMMAND) && (nCod==CN_COMMAND) && (nID>=m_nMenuId) && (nID<=m_nMenuId+MRU_RANGE))	
	{

#ifdef _DEBUG
			if (afxTraceFlags & traceCmdRouting)
			{
				TRACE2("SENDING command id 0x%04X to %hs target.\n", nID,
					GetRuntimeClass()->m_lpszClassName);
			}
#endif //_DEBUG

		return OnOpenRecentFile(nID);
	}

	return CMultiDocTemplate::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
CRichSettingsPage::CRichSettingsPage(LPCTSTR pszName) : CSettingsPage(CRichSettingsPage::IDD)
{
	if ( pszName == NULL )
		m_sName = GetRuntimeClass()->m_lpszClassName;
	else
		m_sName = pszName;
	
	m_pDocument = NULL;
	
	if ( CXMLElement* pXML = Skin.GetDocument( m_sName ) )
	{
		m_sCaption = pXML->GetAttributeValue( _T("title"), m_sName );
		
		m_pDocument = new CRichDocument();
		m_pDocument->CreateFonts( theApp.m_sDefaultFont, theApp.m_nDefaultFontSize );
		m_pDocument->m_crBackground = CCoolInterface::GetDialogBkColor();
		m_pDocument->LoadXML( pXML );
	}
}
Пример #14
0
BOOL CChildWnd::LoadState(LPCTSTR pszName, BOOL bDefaultMaximise)
{
	CRect rcParent, rcChild;
	GetParent()->GetClientRect( &rcParent );

	if ( ! m_bPanelMode && Settings.LoadWindow( pszName, this ) )
	{
		if ( rcParent.Width() > 64 && rcParent.Height() > 32 )
		{
			GetWindowRect( &rcChild );
			GetParent()->ScreenToClient( &rcChild );

			if ( rcChild.right > rcParent.right || rcChild.bottom > rcParent.bottom )
			{
				rcChild.right	= min( rcChild.right, rcParent.right );
				rcChild.bottom	= min( rcChild.bottom, rcParent.bottom );
				MoveWindow( &rcChild );
			}
		}

		OnSkinChange();

		return TRUE;
	}

	if ( m_bPanelMode || bDefaultMaximise )		// Was m_bGroupMode
	{
		if ( m_bTabMode )
		{
			CString strClassName( GetRuntimeClass()->m_lpszClassName );
			CString strName( pszName ? pszName : (LPCTSTR)strClassName );
			m_nGroupSize = (float)theApp.GetProfileInt( _T("Windows"), strName + _T(".Splitter"), 500 ) / 1000;
		}

		if ( rcParent.Width() > 64 && rcParent.Height() > 32 )
			MoveWindow( &rcParent );
	}

	OnSkinChange();

	return FALSE;
}
Пример #15
0
void CSettingsPage::OnSkinChange()
{
	if ( ! IsWindow( GetSafeHwnd() ) )
		return;		// No created page yet

	if ( m_sName.IsEmpty() )
		m_sName = GetRuntimeClass()->m_lpszClassName;

	SetWindowText( m_sCaption );

	Skin.Apply( m_sName, this, 0, &m_wndToolTip );

	if ( Images.m_bmDialog.m_hObject )
	{
		CDC* pDC = GetDC();
		CRect rc;
		GetClientRect( &rc );
		CoolInterface.DrawWatermark( pDC, &rc, &Images.m_bmDialog );
	}

	// Fix Checkbox/Groupbox color skinning if needed (remove modern Windows theming)

	CoolInterface.FixThemeControls( this );		// Checkbox/Groupbox text colors (Remove theme if needed)

// Moved to CCoolInterface::FixTheme:
//	const BOOL bThemed =
//		GetRValue( Colors.m_crDialogText ) < 100 &&
//		GetGValue( Colors.m_crDialogText ) < 100 &&
//		GetBValue( Colors.m_crDialogText ) < 100;
//
//	for ( CWnd* pWnd = GetWindow( GW_CHILD ); pWnd; pWnd = pWnd->GetNextWindow() )
//	{
//		TCHAR szName[8];
//		GetClassName( pWnd->GetSafeHwnd(), szName, 8 );			// Alt detection method for exceptions
//		if ( _tcsnicmp( szName, _P( L"Button" ) ) == 0 &&
//			 ( pWnd->GetStyle() & BS_CHECKBOX ) || ( ( pWnd->GetStyle() & BS_GROUPBOX ) && pWnd->GetDlgCtrlID() == IDC_STATIC ) )
//			CCoolInterface::EnableTheme( pWnd, bThemed );
//	}
}
Пример #16
0
void CChatWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
    Skin.TrackPopupMenu( CString( GetRuntimeClass()->m_lpszClassName ), point );
}
Пример #17
0
void CChatWnd::OnSkinChange()
{
    CPanelWnd::OnSkinChange();

    Skin.CreateToolBar( CString( GetRuntimeClass()->m_lpszClassName ), &m_wndToolBar );
}