|
#ifndef __ADVANCEDBUTTON_H__
#define __ADVANCEDBUTTON_H__
/////////////////////////////////////////////////////////////////////////////
// AdvancedButton.h : header file for the CAdvancedButton class
//
// Written by Loic Brayat (dev@pileouface.org)
//
// HOW TO :
//
// - Create the button on the dialog box
// - Include "AdvancedButton.h" in the dialog class's header
// - Declare the button in the dialog class. For example :
// CAdvancedButton adBtn1;
// - Initialize the button in the dialog's class OnInitDialog funtion :
// adBtn1.SubclassDlgItem(IDC_BUTTON1, this, RED, GREEN);
// - Eventually change the colors later :
// adBtn1.SetColors(RED);
// adBtn1.SetBackGround(YELLOW);
// adBtn1.SetForeGround(BLUE);
// ...
//
/////////////////////////////////////////////////////////////////////////////
#include "AdvancedComponent.h"
typedef enum {DRAW_RECT=0, DRAW_ELLIPSE=1} TAdvancedButtonDrawType;
class CAdvancedButton : public CButton, public CAdvancedComponent
{
DECLARE_DYNAMIC(CAdvancedButton)
public:
CAdvancedButton();
virtual ~CAdvancedButton();
bool SubclassDlgItem(
const UINT nID, CWnd* pParent,
const COLORREF BGColor = LTGRAY,
const COLORREF FGColor = BLACK,
const COLORREF DisabledColor = DKGRAY
);
bool SetColors(
const COLORREF BGColor,
const COLORREF FGColor = BLACK,
const COLORREF DisabledColor = DKGRAY
);
COLORREF GetDisabledColor() const { return m_disabled; }
void SetDrawType(TAdvancedButtonDrawType type) {
drawType = type;
this->RedrawComponent();
};
TAdvancedButtonDrawType GetDrawType() const { return drawType; };
protected:
void SetState(bool bHighlight);
void PreSubclassWindow();
void RedrawComponent() {
RedrawWindow();
}
virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
private:
COLORREF m_disabled;
TAdvancedButtonDrawType drawType;
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
#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 member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.