Attrib Class

class Attrib: public CObject

This is a helper class that defines the attributes used for drawing a calculator button.

Defined in: CalcBtn.h

Comments

The class Attrib is associated with the class SECalcBtn, which is the base class for the buttons on a calculator edit control. Attrib defines the attributes used for drawing a button on the calculator.

The SECCalculator class implements a calculator edit control capable of decimal arithmetic and other standard operations. The popup window for the calculator is created by the  SECPopupCalculator class.

See the sample CALC in the \SAMPLES\TOOLKIT\STANDARD\CONTROLS\CALC directory for a demonstration of this class.

Class Members

Creation/initialization

Attrib()

Constructs an Attrib object.

Attrib(DWORD dwStyle, COLORREF textColor = 0L, HFONT hFont = NULL, HBITMAP* lphBitmap = NULL)

Constructs an Attrib object.

Attrib(const Attrib& attrib)

Constructs an Attrib object.

~Attrib()

Attrib destructor.

Attributes

HFONT  GetFont() const

Retrieves the font attribute.

COLORREF  GetTextColor() const

Retrieves the text color attribute.

HBITMAP  GetBitmap() const

Retrieves the bitmap attribute.

Operations

const Attrib& operator=(const Attrib& attrib)

Equals operator.

Protected data members

HFONT m_hFont

The font handle attribute.

HBITMAP* m_lphBitmap

The bitmap handle attribute.

COLORREF m_textColor

The text color attribute.

DWORD m_dwStyle

The style attribute (not currently used).

Attributes

BOOL GetWidth() const

Returns the width of the button.

SECCalculator::SECCalcOp GetOp() const

Returns the operation code for this button.

int GetState() const

Get the button state.

void SetState(int nState)

Set the button state.

BOOL IsAccelerator(LPCTSTR lpszChar) const

Tests whether a character is an accelerator for the button.

BOOL IsKeyDownAccelerator(UINT nChar) const

Tests whether the WM_KEYDOWN char is an accelerator for the button.

void SetKeyDownAccel(UINT nChar)

Sets the WM_KEYDOWN accelerator for this button.

const CRect& GetRect() const

Get the rectange of the button (relative to calculators client).

void SetRect(const RECT& rect)

Set the rectange of the button (relative to calculators client).

Overrides

virtual void Draw(CDC& dc)

Draws the button!

Public data members

enum

State values

Protected data members

Attrib m_attribs

Button attributes.

CString m_strCaption

Button caption.

CString m_strAccels

Standard keyboard accelerators.

UINT m_nKeyDownAccel

WM_KEYDOWN accelerators.

int m_nWidth

Width of button.

CRect m_rect

Rectangle of button (relative to calculators client).

int m_nState

State flags (see state bits).

SECCalculator::SECCalcOp m_op

The operation of this button.