|
//---------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
// THE AUTHOR DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
// INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
// CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES,
//
// Written by Chris Maunder (chrismaunder@codeguru.com)
// Copyright (c) 1998.
// Adapted to work with CCustomButton as a base class.
//
//---------------------------------------------------------------------------
#ifndef _CROUNDBUTTON_
#define _CROUNDBUTTON_
#ifndef _CCUSTOMBUTTON_
#include "CCustomButton.h"
#endif
///////////////////////////////////////////////////////////////////////
// Class CRoundButton
///////////////////////////////////////////////////////////////////////
class CRoundButton : public CCustomButton
{
DECLARE_DYNAMIC(CRoundButton)
public:
CRoundButton(){}
virtual ~CRoundButton(){}
virtual bool CustomDraw()const{return true;} //Return true so OnDraw() is called
virtual void OnDraw(CDC* pDC,const CCustomButtonState& state);//Custom drawing
virtual bool ModifyHitRegion(const CRect& Client,CHitRgn& hitRgn);//Override to define own hit testing
virtual bool HoverEffects()const{return s_Hovering;}
virtual void OnHover(bool bEnteringButton);
DECLARE_MESSAGE_MAP()
protected:
int GetRadius(const CRect& rClient)const{return rClient.bottom/2-1;}
//Drawing helpers
static COLORREF GetColour(double dAngle,COLORREF crBright,COLORREF crDark);
static void DrawCircle(CDC* pDC,CPoint p,LONG lRadius,COLORREF crColour,BOOL bDashed=FALSE);
static void DrawCircle(CDC* pDC,CPoint p,LONG lRadius,COLORREF crBright,COLORREF crDark);
public:
static bool s_Hovering;
};
#endif
|
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.