OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TButtonTextDrawItem Class Reference

#include <owl/drawitem.h>

Inheritance diagram for owl::TButtonTextDrawItem:
owl::TDrawItem owl::TDrawItemBase owl::TDrawMenuItem

Public Types

enum  TAlign { aLeft , aCenter , aRight }
 TAlign contains values that defines how text will be layed out. More...
 
enum  TStyle { sNone =0 , sBitmap =0x001 , sText =0x002 , sBitmapText =0x003 }
 TStyle contains values that defines how the button will be displayed. More...
 
enum  TLayoutStyle { lTextLeft , lTextTop , lTextRight , lTextBottom }
 TLayoutStyle contains values that defines how a bitmap and text will be layed out. More...
 
enum  TSeparator { sepNoBitmap =-2 , sepUseBitmap =-1 }
 
- Public Types inherited from owl::TDrawItem
typedef const charType_id
 
- Public Types inherited from owl::TDrawItemBase
enum  TDrawItemId { drawId = 0x69777264 }
 

Public Member Functions

 TButtonTextDrawItem (TDrawItemProxy *proxy=0)
 Constructs a TButtonTextDrawItem with proxy as it's parent.
 
 ~TButtonTextDrawItem ()
 Destroys a TButtonTextDrawItem object. If DeleteCel is true, deletes CelArray.
 
LPCTSTR GetText () const
 Returns Text, the text do display on the button.
 
void SetText (LPCTSTR text)
 Deletes Text and clears the text style.
 
void SetText (const tstring &text)
 
int GetIndex () const
 Returns Index, the index of Bitmap in the Proxy CellArray or -1.
 
void SetIndex (int index)
 Index is set to index and the sBitmap style is cleared from Style.
 
TStyle GetStyle () const
 Returns Style: Bitmap only, Text only, or Bitmap and Text.
 
void SetStyle (const TStyle style)
 Sets Style to style.
 
TAlign GetAlign () const
 Returns Align.
 
void SetAlign (const TAlign align)
 Sets Align to align.
 
TLayoutStyle GetLayoutStyle () const
 Returns LayoutStyle.
 
void SetLayoutStyle (const TLayoutStyle style)
 Sets LayoutStyle to style.
 
void SetFont (TFont *font)
 Deletes Font and then assigns font to Font.
 
virtual TFontGetFont ()
 
void SetCelArray (TCelArray *celarray, TAutoDelete del=AutoDelete)
 If DeleteCel is true, CelArray is deleted.
 
void 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.
 
virtual TCelArrayGetCelArray ()
 
virtual void Draw (DRAWITEMSTRUCT &drawItem)
 Extracts information from drawItem and calls Paint.
 
virtual void Measure (MEASUREITEMSTRUCT &drawItem)
 Calculates the area required to display the button and text.
 
virtual int Compare (COMPAREITEMSTRUCT &drawItem)
 Does an lstrcmp on Text from the instances contained in drawItem.
 
virtual void Paint (TDC &rc, TRect &rect)
 Paint function.
 
virtual void Layout (const TRect &src, TRect &textRect, TRect &bmpRect)
 Layout Text and Bitmap.
 
virtual void PaintBorder (TDC &rc, TRect &rect)
 Paint the border of the gadget based on the BorderStyle member.
 
virtual void PaintText (TDC &rc, TRect &rect)
 Paint the text.
 
virtual void PaintBitmap (TDC &rc, TRect &rect)
 Paint the bitmap.
 
virtual TColor GetBkColor ()
 If selected returns TColor::SysActiveCaption; otherwise returns TColor::SysWindow.
 
virtual TColor GetTextColor ()
 If selected, returns TColor::Sys3dHilight if a 3d User interface is in use or TColor::SysGrayText otherwise.
 
bool IsEnabled ()
 Returns true if (Flags & ODS_DISABLED)==0; false otherwise.
 
bool IsSelected ()
 Returns true if (Flags & ODS_SELECTED)==0; false otherwise.
 
bool IsFocused ()
 Returns true if (Flags & ODS_FOCUS)==0; false otherwise.
 
bool IsGrayed ()
 Returns true if (Flags & ODS_GRAYED)==0; false otherwise.
 
bool IsChecked ()
 Returns true if (Flags & ODS_CHECKED)==0; false otherwise.
 
virtual void GetTextSize (TSize &size)
 Calculates the size of the rectangle need to paint the text.
 
virtual void GetButtonSize (TSize &btnSize)
 Calculates the size of button.
 
- Public Member Functions inherited from owl::TDrawItemBase
 TDrawItemBase ()
 
virtual ~TDrawItemBase ()
 

Additional Inherited Members

- Public Attributes inherited from owl::TDrawItem
 DECLARE_CASTABLE
 
- Public Attributes inherited from owl::TDrawItemBase
 DECLARE_CASTABLE
 
uint32 __itemId
 

Detailed Description

Definition at line 70 of file drawitem.h.

Member Enumeration Documentation

◆ TAlign

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.

Definition at line 73 of file drawitem.h.

◆ TLayoutStyle

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.

Definition at line 90 of file drawitem.h.

◆ TSeparator

Enumerator
sepNoBitmap 
sepUseBitmap 

Definition at line 98 of file drawitem.h.

◆ TStyle

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.

Definition at line 81 of file drawitem.h.

Constructor & Destructor Documentation

◆ TButtonTextDrawItem()

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

Constructs a TButtonTextDrawItem with proxy as it's parent.

Definition at line 103 of file drawitem.cpp.

◆ ~TButtonTextDrawItem()

owl::TButtonTextDrawItem::~TButtonTextDrawItem ( )

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

Definition at line 120 of file drawitem.cpp.

Member Function Documentation

◆ Compare()

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

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

Reimplemented from owl::TDrawItem.

Definition at line 230 of file drawitem.cpp.

◆ Draw()

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

Extracts information from drawItem and calls Paint.

Reimplemented from owl::TDrawItem.

Definition at line 202 of file drawitem.cpp.

References Paint().

◆ GetAlign()

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

Returns Align.

Definition at line 304 of file drawitem.h.

◆ GetBkColor()

TColor owl::TButtonTextDrawItem::GetBkColor ( )
virtual

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

Reimplemented in owl::TDrawMenuItem.

Definition at line 241 of file drawitem.cpp.

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

◆ GetButtonSize()

void owl::TButtonTextDrawItem::GetButtonSize ( TSize & btnSize)
virtual

Calculates the size of button.

Reimplemented in owl::TDrawMenuItem.

Definition at line 406 of file drawitem.cpp.

References owl::TDrawItemProxy::GetCelArray(), and sepNoBitmap.

◆ GetCelArray()

virtual TCelArray * owl::TButtonTextDrawItem::GetCelArray ( )
inlinevirtual

Definition at line 122 of file drawitem.h.

◆ GetFont()

virtual TFont * owl::TButtonTextDrawItem::GetFont ( )
inlinevirtual

Definition at line 119 of file drawitem.h.

◆ GetIndex()

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

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

Definition at line 283 of file drawitem.h.

◆ GetLayoutStyle()

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

Returns LayoutStyle.

Definition at line 318 of file drawitem.h.

◆ GetStyle()

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

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

Definition at line 290 of file drawitem.h.

◆ GetText()

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

Returns Text, the text do display on the button.

Definition at line 276 of file drawitem.h.

◆ GetTextColor()

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.

Definition at line 250 of file drawitem.cpp.

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

◆ GetTextSize()

void owl::TButtonTextDrawItem::GetTextSize ( TSize & size)
virtual

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

Reimplemented in owl::TDrawMenuItem.

Definition at line 261 of file drawitem.cpp.

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

◆ IsChecked()

bool owl::TButtonTextDrawItem::IsChecked ( )
inline

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

Definition at line 151 of file drawitem.h.

◆ IsEnabled()

bool owl::TButtonTextDrawItem::IsEnabled ( )
inline

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

Definition at line 139 of file drawitem.h.

◆ IsFocused()

bool owl::TButtonTextDrawItem::IsFocused ( )
inline

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

Definition at line 145 of file drawitem.h.

◆ IsGrayed()

bool owl::TButtonTextDrawItem::IsGrayed ( )
inline

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

Definition at line 148 of file drawitem.h.

◆ IsSelected()

bool owl::TButtonTextDrawItem::IsSelected ( )
inline

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

Definition at line 142 of file drawitem.h.

◆ Layout()

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

Layout Text and Bitmap.

Determines the bounding rectangles for the current style.

Definition at line 306 of file drawitem.cpp.

References owl::ButtonSpaceH, owl::ButtonSpaceV, GetButtonSize(), GetTextSize(), lTextBottom, lTextLeft, lTextRight, lTextTop, owl::TextSpaceH, and owl::TextSpaceV.

◆ Measure()

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

Calculates the area required to display the button and text.

Reimplemented from owl::TDrawItem.

Definition at line 214 of file drawitem.cpp.

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

◆ Paint()

void owl::TButtonTextDrawItem::Paint ( TDC & rc,
TRect & rect )
virtual

Paint function.

Definition at line 281 of file drawitem.cpp.

References GetBkColor(), Layout(), PaintBitmap(), PaintBorder(), PaintText(), owl::TDC::SetBkColor(), and owl::TDC::TextRect().

◆ PaintBitmap()

void owl::TButtonTextDrawItem::PaintBitmap ( TDC & rc,
TRect & rect )
virtual

Paint the bitmap.

Reimplemented in owl::TDrawMenuItem.

Definition at line 428 of file drawitem.cpp.

References owl::TDrawItemProxy::GetCelArray(), and sBitmap.

◆ PaintBorder()

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

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

Definition at line 419 of file drawitem.cpp.

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

◆ PaintText()

◆ SetAlign()

void owl::TButtonTextDrawItem::SetAlign ( const TAlign align)
inline

Sets Align to align.

Definition at line 311 of file drawitem.h.

◆ SetCelArray() [1/2]

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.

Definition at line 181 of file drawitem.cpp.

References owl::AutoDelete.

◆ SetCelArray() [2/2]

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.

Definition at line 193 of file drawitem.cpp.

References owl::TColor::LtGray, and SetCelArray().

◆ SetFont()

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

Deletes Font and then assigns font to Font.

Ownership of font is transferred to this instance.

Definition at line 171 of file drawitem.cpp.

◆ SetIndex()

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.

Definition at line 157 of file drawitem.cpp.

References sBitmap.

◆ SetLayoutStyle()

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

Sets LayoutStyle to style.

Definition at line 325 of file drawitem.h.

◆ SetStyle()

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

Sets Style to style.

Definition at line 297 of file drawitem.h.

◆ SetText() [1/2]

void owl::TButtonTextDrawItem::SetText ( const tstring & text)
inline

Definition at line 107 of file drawitem.h.

References SetText().

◆ SetText() [2/2]

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.

Definition at line 132 of file drawitem.cpp.

References _T, _tcschr, sText, and strnewdup().


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