OWLNext 6.32
Public Types | Public Member Functions
owl::TButtonTextDrawItem Class Reference
Inheritance diagram for owl::TButtonTextDrawItem:
owl::TDrawItem owl::TDrawItemBase owl::TDrawMenuItem

List of all members.

Public Types

enum  TAlign { aLeft, aCenter, aRight }
enum  TStyle { sNone = 0, sBitmap = 0x001, sText = 0x002, sBitmapText = 0x003 }
enum  TLayoutStyle { lTextLeft, lTextTop, lTextRight, lTextBottom }
enum  TSeparator { sepNoBitmap = -2, sepUseBitmap = -1 }

Public Member Functions

 TButtonTextDrawItem (TDrawItemProxy *proxy=0)
 ~TButtonTextDrawItem ()
LPCTSTR GetText () const
void SetText (LPCTSTR text)
void SetText (const tstring &text)
int GetIndex () const
void SetIndex (int index)
TStyle GetStyle () const
void SetStyle (const TStyle style)
TAlign GetAlign () const
void SetAlign (const TAlign align)
TLayoutStyle GetLayoutStyle () const
void SetLayoutStyle (const TLayoutStyle style)
void SetFont (TFont *font)
virtual TFontGetFont ()
void SetCelArray (TCelArray *celarray, TAutoDelete del=AutoDelete)
void SetCelArray (TResId resId, uint count, TModule *module=&GetGlobalModule())
virtual TCelArrayGetCelArray ()
virtual void Draw (DRAWITEMSTRUCT &drawItem)
virtual void Measure (MEASUREITEMSTRUCT &drawItem)
virtual int Compare (COMPAREITEMSTRUCT &drawItem)
virtual void Paint (TDC &rc, TRect &rect)
virtual void Layout (const TRect &src, TRect &textRect, TRect &bmpRect)
virtual void PaintBorder (TDC &rc, TRect &rect)
virtual void PaintText (TDC &rc, TRect &rect)
virtual void PaintBitmap (TDC &rc, TRect &rect)
virtual TColor GetBkColor ()
virtual TColor GetTextColor ()
bool IsEnabled ()
bool IsSelected ()
bool IsFocused ()
bool IsGrayed ()
bool IsChecked ()
virtual void GetTextSize (TSize &size)
virtual void GetButtonSize (TSize &btnSize)

Member Enumeration Documentation

TAlign contains values that defines how text will be layed out.

Enumerator:
aLeft 

Aligns the text at the left edge of the bounding rectangle.

aCenter 

Aligns the text horizontally at the center of the bounding rectangle.

aRight 

Aligns the text at the right edge of the bounding rectangle.

TLayoutStyle contains values that defines how a bitmap and text will be layed out.

Enumerator:
lTextLeft 

Text left, bitmap right.

lTextTop 

Text top, bitmap bottom.

lTextRight 

Text right, bitmap left.

lTextBottom 

Text bottom, bitmap top.

TStyle contains values that defines how the button will be displayed.

Enumerator:
sNone 

Neither text or bitmap is displayed.

sBitmap 

Only the bitmap is displayed.

sText 

Only text is displayed.

sBitmapText 

Both text and bitmap are displayed.


Constructor & Destructor Documentation

owl::TButtonTextDrawItem::TButtonTextDrawItem ( TDrawItemProxy proxy = 0)

Constructs a TButtonTextDrawItem with proxy as it's parent.

owl::TButtonTextDrawItem::~TButtonTextDrawItem ( )

Destroys a TButtonTextDrawItem object. If DeleteCel is true, deletes CelArray.


Member Function Documentation

int owl::TButtonTextDrawItem::Compare ( COMPAREITEMSTRUCT &  drawItem) [virtual]

Does an lstrcmp on Text from the instances contained in drawItem.

Reimplemented from owl::TDrawItem.

References GetText().

void owl::TButtonTextDrawItem::Draw ( DRAWITEMSTRUCT &  drawItem) [virtual]

Extracts information from drawItem and calls Paint.

Reimplemented from owl::TDrawItem.

References Paint().

TButtonTextDrawItem::TAlign owl::TButtonTextDrawItem::GetAlign ( ) const [inline]

Returns Align.

TColor owl::TButtonTextDrawItem::GetBkColor ( ) [virtual]

If selected returns TColor::SysActiveCaption; otherwise returns TColor::SysWindow.

Reimplemented in owl::TDrawMenuItem.

References IsSelected(), owl::TColor::SysActiveCaption, and owl::TColor::SysWindow.

void owl::TButtonTextDrawItem::GetButtonSize ( TSize btnSize) [virtual]

Calculates the size of button.

Reimplemented in owl::TDrawMenuItem.

References owl::TCelArray::CelSize().

int owl::TButtonTextDrawItem::GetIndex ( ) const [inline]

Returns Index, the index of Bitmap in the Proxy CellArray or -1.

TButtonTextDrawItem::TLayoutStyle owl::TButtonTextDrawItem::GetLayoutStyle ( ) const [inline]

Returns LayoutStyle.

TButtonTextDrawItem::TStyle owl::TButtonTextDrawItem::GetStyle ( ) const [inline]

Returns Style: Bitmap only, Text only, or Bitmap and Text.

LPCTSTR owl::TButtonTextDrawItem::GetText ( ) const [inline]

Returns Text, the text do display on the button.

TColor owl::TButtonTextDrawItem::GetTextColor ( ) [virtual]

If selected, returns TColor::Sys3dHilight if a 3d User interface is in use or TColor::SysGrayText otherwise.

Reimplemented in owl::TDrawMenuItem.

References IsEnabled(), IsSelected(), owl::TColor::Sys3dHilight, and owl::TColor::SysWindowText.

void owl::TButtonTextDrawItem::GetTextSize ( TSize size) [virtual]

Calculates the size of the rectangle need to paint the text.

Reimplemented in owl::TDrawMenuItem.

References GetText(), owl::TDC::GetTextExtent(), owl::TDC::RestoreFont(), and owl::TDC::SelectObject().

bool owl::TButtonTextDrawItem::IsChecked ( ) [inline]

Returns true if (Flags & ODS_CHECKED)==0; false otherwise.

bool owl::TButtonTextDrawItem::IsEnabled ( ) [inline]

Returns true if (Flags & ODS_DISABLED)==0; false otherwise.

bool owl::TButtonTextDrawItem::IsFocused ( ) [inline]

Returns true if (Flags & ODS_FOCUS)==0; false otherwise.

bool owl::TButtonTextDrawItem::IsGrayed ( ) [inline]

Returns true if (Flags & ODS_GRAYED)==0; false otherwise.

bool owl::TButtonTextDrawItem::IsSelected ( ) [inline]

Returns true if (Flags & ODS_SELECTED)==0; false otherwise.

void owl::TButtonTextDrawItem::Layout ( const TRect faceRect,
TRect textRect,
TRect btnRect 
) [virtual]

Layout Text and Bitmap

Determines the bounding rectangles for the current style.

References GetButtonSize(), GetTextSize(), owl::TRect::Height(), lTextBottom, lTextLeft, lTextRight, lTextTop, owl::TRect::TopLeft(), and owl::TRect::Width().

void owl::TButtonTextDrawItem::Measure ( MEASUREITEMSTRUCT &  drawItem) [virtual]

Calculates the area required to display the button and text.

Reimplemented from owl::TDrawItem.

References GetButtonSize(), GetStyle(), GetTextSize(), and sBitmap.

void owl::TButtonTextDrawItem::Paint ( TDC rc,
TRect rect 
) [virtual]
void owl::TButtonTextDrawItem::PaintBitmap ( TDC rc,
TRect rect 
) [virtual]

Paint the bitmap.

Reimplemented in owl::TDrawMenuItem.

References owl::TCelArray::BitBlt(), and sBitmap.

void owl::TButtonTextDrawItem::PaintBorder ( TDC rc,
TRect rect 
) [virtual]

Paint the border of the gadget based on the BorderStyle member.

References owl::TDC::DrawFocusRect(), and IsFocused().

void owl::TButtonTextDrawItem::PaintText ( TDC rc,
TRect rect 
) [virtual]
void owl::TButtonTextDrawItem::SetAlign ( const TAlign  align) [inline]

Sets Align to align.

void owl::TButtonTextDrawItem::SetCelArray ( TCelArray celarray,
TAutoDelete  del = AutoDelete 
)

If DeleteCel is true, CelArray is deleted. celarray is assigned to CelArray and del is assigned to DeleteCel.

void owl::TButtonTextDrawItem::SetCelArray ( TResId  resId,
uint  count,
TModule module = &GetGlobalModule() 
)

A bitmap with resource id resId is loaded from module and used to create a TCelArray with count cells. SetCelArray is then called with this TCelArray.

References SetCelArray().

void owl::TButtonTextDrawItem::SetFont ( TFont font)

Deletes Font and then assigns font to Font. Ownership of font is transferred to this instance.

void owl::TButtonTextDrawItem::SetIndex ( int  index)

Index is set to index and the sBitmap style is cleared from Style. If index >= 0, the sBitmap style is added to Style.

References sBitmap.

void owl::TButtonTextDrawItem::SetLayoutStyle ( const TLayoutStyle  style) [inline]

Sets LayoutStyle to style.

void owl::TButtonTextDrawItem::SetStyle ( const TStyle  style) [inline]

Sets Style to style.

void owl::TButtonTextDrawItem::SetText ( LPCTSTR  text)

Deletes Text and clears the text style. If text is not NULL, a copy is assigned to Text and the sText style is added to Style.

References sText.


The documentation for this class was generated from the following files: