Click here to Skip to main content
14,218,748 members

The Ultimate Toolbox - Updates and User Contributions

Rate this:
4.79 (26 votes)
Please Sign up or sign in to vote.
4.79 (26 votes)
12 Feb 2013CPOL
Updates and User Contributions for the Ultimate Toolbox Libraries
Ultimate Grid
Demos
OutlookStyle
OutlookStyle.aps
OutlookStyle.dsp
OutlookStyle.dsw
OutlookStyle.suo
OutlookStyle.vcproj
res
bitmap1.bmp
bmattach.bmp
bmp00001.bmp
bmp00002.bmp
bmp00003.bmp
Flags.bmp
OutlookStyle.ico
OutlookStyleDoc.ico
Toolbar.bmp
toolbar1.bmp
toolbar2.bmp
toolbarf.bmp
CellTypes
Include
Source
DataSources
ODBC
UGODBC.CPP
OleDB
EditControls
BuildDLL
Build DLL VC2005.vcproj
Build DLL.dsp
Build DLL.dsw
res
BuildLib
ugmfclib.dsp
ugmfclib.dsw
ugmfclib.vcproj
Lib
Skel
Build DLL VC2008.vcproj
ugmfclib VC2008.vcproj
Ultimate TCP-IP
Include
Security
Include
Source
source
Examples
Client
Mail
icon1.ico
icon2.ico
MailClientS.suo
MailClientS.vcproj
test.dsp
test.dsw
Ultimate Toolbox
include
source
lib
Build DLLs
UT2008.vcproj
Build Libs
UTStaticLib2008.vcproj
OXRollup.H
UT2008.vcproj
UTStaticLib2008.vcproj
OXFrameWndDock.CPP
OXRollup.CPP
OXSizeCtrlBar.CPP
// OXSkinnedSpinCtrl.cpp : implementation file
//
// Version: 9.3


#include "stdafx.h"

// v93 update 03 - 64-bit
#include "UTB64Bit.h"

#include "OXSkinnedSpinCtrl.h"
#include "OXSkins.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

IMPLEMENT_DYNCREATE(COXSkinnedSpinCtrl, CSpinButtonCtrl)
/////////////////////////////////////////////////////////////////////////////
// COXSkinnedSpinCtrl
HHOOK COXSkinnedSpinCtrl::m_hMouseHook = NULL;

HWND COXSkinnedSpinCtrl::m_hwndPrevMouseMoveWnd = NULL;

COXSkinnedSpinCtrl::COXSkinnedSpinCtrl() :
	m_pTabSkin(NULL)
{
}

COXSkinnedSpinCtrl::~COXSkinnedSpinCtrl()
{
	if ( m_pTabSkin != NULL )
		delete m_pTabSkin;
}


BEGIN_MESSAGE_MAP(COXSkinnedSpinCtrl, CSpinButtonCtrl)
	//{{AFX_MSG_MAP(COXSkinnedSpinCtrl)
	ON_WM_PAINT()
	ON_WM_MOUSEMOVE()
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
	ON_WM_DESTROY()
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COXSkinnedSpinCtrl message handlers

COXTabSkin* COXSkinnedSpinCtrl::GetTabSkin()
{
	// Check if the app is derived from COXSkinnedApp
	COXSkinnedApp* pSkinnedApp = DYNAMIC_DOWNCAST(COXSkinnedApp, AfxGetApp());
	if (pSkinnedApp != NULL && pSkinnedApp->GetCurrentSkin() != NULL)
		return pSkinnedApp->GetCurrentSkin()->GetTabSkin();
	else
	{
		// Create a classic skin for this class if not created already
		if (m_pTabSkin == NULL)
			m_pTabSkin = new COXTabSkinClassic();

		return m_pTabSkin;
	}
}

void COXSkinnedSpinCtrl::OnPaint() 
{
	GetTabSkin()->OnPaintSpinCtrl(this);
}


// Update the buttons of the mini frame window when the mouse leaves
LRESULT CALLBACK COXSkinnedSpinCtrl::MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if (nCode < 0)
		return ::CallNextHookEx(m_hMouseHook, nCode, wParam, lParam);

	if (nCode == HC_ACTION && (wParam == WM_MOUSEMOVE || wParam == WM_NCMOUSEMOVE))
	{

		MOUSEHOOKSTRUCT* pMH = (MOUSEHOOKSTRUCT*) lParam;

		// If the previous message was for COXSizableMiniDockFrameWnd and the current is not
		// we need to update the caption buttons
		COXSkinnedSpinCtrl* pPrev = DYNAMIC_DOWNCAST(COXSkinnedSpinCtrl,CWnd::FromHandlePermanent(m_hwndPrevMouseMoveWnd));
		COXSkinnedSpinCtrl* pCurrent = DYNAMIC_DOWNCAST(COXSkinnedSpinCtrl,CWnd::FromHandlePermanent(pMH->hwnd));

		if (pPrev != NULL && pCurrent != pPrev)
		{
			// The mouse just left the mini frame window
			::SendMessage( m_hwndPrevMouseMoveWnd, WM_MOUSEMOVE, 0, 0 );
		}
		m_hwndPrevMouseMoveWnd = pMH->hwnd;
	}

	return CallNextHookEx(m_hMouseHook, nCode, wParam, lParam);
}

void COXSkinnedSpinCtrl::PreSubclassWindow()
{
	// Hook the mouse
	if (m_hMouseHook == NULL)
		m_hMouseHook = ::SetWindowsHookEx(WH_MOUSE, MouseProc, 0, AfxGetApp()->m_nThreadID);

	CSpinButtonCtrl::PreSubclassWindow();
}

void COXSkinnedSpinCtrl::OnDestroy()
{
	// Unhook the mouse
	if (m_hMouseHook)
	{
		::UnhookWindowsHookEx(m_hMouseHook);
		m_hMouseHook = NULL;
	}

	CSpinButtonCtrl::OnDestroy();
}

void COXSkinnedSpinCtrl::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	Invalidate();
	
	CSpinButtonCtrl::OnMouseMove(nFlags, point);
}

BOOL COXSkinnedSpinCtrl::OnEraseBkgnd(CDC* /*pDC*/) 
{
	// TODO: Add your message handler code here and/or call default
	return TRUE;
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

The Ultimate Toolbox
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
Group type: Organisation

463 members


Stats

213.5K views
21.9K downloads
168 bookmarked