OWLNext 7.0
Borland's Object Windows Library for the modern age
|
#include <owl/drawitem.h>
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 char * | Type_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 TFont * | GetFont () |
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 TCelArray * | GetCelArray () |
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 |
Definition at line 70 of file drawitem.h.
TAlign contains values that defines how text will be layed out.
Definition at line 73 of file drawitem.h.
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.
Enumerator | |
---|---|
sepNoBitmap | |
sepUseBitmap |
Definition at line 98 of file drawitem.h.
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.
owl::TButtonTextDrawItem::TButtonTextDrawItem | ( | TDrawItemProxy * | proxy = 0 | ) |
Constructs a TButtonTextDrawItem with proxy as it's parent.
Definition at line 103 of file drawitem.cpp.
owl::TButtonTextDrawItem::~TButtonTextDrawItem | ( | ) |
Destroys a TButtonTextDrawItem object. If DeleteCel is true, deletes CelArray.
Definition at line 120 of file drawitem.cpp.
|
virtual |
Does an lstrcmp on Text from the instances contained in drawItem.
Reimplemented from owl::TDrawItem.
Definition at line 230 of file drawitem.cpp.
|
virtual |
Extracts information from drawItem and calls Paint.
Reimplemented from owl::TDrawItem.
Definition at line 202 of file drawitem.cpp.
References Paint().
|
inline |
Returns Align.
Definition at line 304 of file drawitem.h.
|
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.
Calculates the size of button.
Reimplemented in owl::TDrawMenuItem.
Definition at line 406 of file drawitem.cpp.
References owl::TDrawItemProxy::GetCelArray(), and sepNoBitmap.
Definition at line 122 of file drawitem.h.
Definition at line 119 of file drawitem.h.
|
inline |
Returns Index, the index of Bitmap in the Proxy CellArray or -1.
Definition at line 283 of file drawitem.h.
|
inline |
Returns LayoutStyle.
Definition at line 318 of file drawitem.h.
|
inline |
Returns Style: Bitmap only, Text only, or Bitmap and Text.
Definition at line 290 of file drawitem.h.
|
inline |
Returns Text, the text do display on the button.
Definition at line 276 of file drawitem.h.
|
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.
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().
|
inline |
Returns true if (Flags & ODS_CHECKED)==0; false otherwise.
Definition at line 151 of file drawitem.h.
|
inline |
Returns true if (Flags & ODS_DISABLED)==0; false otherwise.
Definition at line 139 of file drawitem.h.
|
inline |
Returns true if (Flags & ODS_FOCUS)==0; false otherwise.
Definition at line 145 of file drawitem.h.
|
inline |
Returns true if (Flags & ODS_GRAYED)==0; false otherwise.
Definition at line 148 of file drawitem.h.
|
inline |
Returns true if (Flags & ODS_SELECTED)==0; false otherwise.
Definition at line 142 of file drawitem.h.
|
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.
|
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 function.
Definition at line 281 of file drawitem.cpp.
References GetBkColor(), Layout(), PaintBitmap(), PaintBorder(), PaintText(), owl::TDC::SetBkColor(), and owl::TDC::TextRect().
Paint the bitmap.
Reimplemented in owl::TDrawMenuItem.
Definition at line 428 of file drawitem.cpp.
References owl::TDrawItemProxy::GetCelArray(), and sBitmap.
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().
Paint the text.
Reimplemented in owl::TDrawMenuItem.
Definition at line 348 of file drawitem.cpp.
References aCenter, aLeft, aRight, owl::TUIFace::Disabled, GetBkColor(), owl::TDrawItemProxy::GetFont(), GetTextColor(), IsEnabled(), IsGrayed(), IsSelected(), lTextBottom, lTextLeft, lTextRight, lTextTop, owl::TUIFace::Normal, owl::TDC::RestoreFont(), owl::TDC::SelectObject(), owl::TDC::SetTextColor(), and sText.
Sets Align to align.
Definition at line 311 of file drawitem.h.
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.
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().
Deletes Font and then assigns font to Font.
Ownership of font is transferred to this instance.
Definition at line 171 of file drawitem.cpp.
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.
|
inline |
Sets LayoutStyle to style.
Definition at line 325 of file drawitem.h.
Sets Style to style.
Definition at line 297 of file drawitem.h.
Definition at line 107 of file drawitem.h.
References SetText().
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().