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

Derived from TButtonTextDrawItem, the TDrawMenuItem class is used for owner drawn menus. More...

#include <owl/drawitem.h>

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

Public Types

typedef void(TDrawMenuItem::* TCheckPainter) (TDC &dc, TRect &rect)
 Prototype for a function used to paint the check image of a menu item.
 
- Public Types inherited from owl::TButtonTextDrawItem
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

 TDrawMenuItem (TDrawItemProxy *proxy, int cmdId, int index, LPCTSTR title=0)
 Called with the proxy parent, the command it, the index in the menu and the text to display.
 
 TDrawMenuItem (TDrawItemProxy *proxy, int cmdId, int index, const tstring &title)
 String-aware overload.
 
virtual void PaintBitmap (TDC &dc, TRect &rect)
 Paint the bitmap on the menu entry.
 
virtual void PaintText (TDC &rc, TRect &rect)
 
virtual void GetTextSize (TSize &size)
 
virtual void GetButtonSize (TSize &btnSize)
 Get the size of the bitmap button.
 
virtual TColor GetBkColor ()
 If the menu item is selected returns TColor::SysActiveCaption; otherwise returns TColor::SysMenu.
 
virtual TColor GetTextColor ()
 Returns the text color.
 
virtual void PaintCheckFace (TDC &dc, TRect &rect)
 If checked, clears the area in preparation for painting the check mark.
 
int GetCmdId ()
 Returns CmdId.
 
void SetCheckPainter (TCheckPainter painter)
 Set the routine to be used to paint the check mark.
 
void PaintCheck_None (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_3Angle (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_Arrow (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_Box (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_Diamond (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_Dot (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_Plus (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_V (TDC &dc, TRect &rect)
 Draw this:
 
void PaintCheck_X (TDC &dc, TRect &rect)
 Draw this:
 
- Public Member Functions inherited from owl::TButtonTextDrawItem
 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.
 
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.
 
- Public Member Functions inherited from owl::TDrawItemBase
 TDrawItemBase ()
 
virtual ~TDrawItemBase ()
 

Public Attributes

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

Detailed Description

Derived from TButtonTextDrawItem, the TDrawMenuItem class is used for owner drawn menus.

Definition at line 184 of file drawitem.h.

Member Typedef Documentation

◆ TCheckPainter

typedef void(TDrawMenuItem::* owl::TDrawMenuItem::TCheckPainter) (TDC &dc, TRect &rect)

Prototype for a function used to paint the check image of a menu item.

Definition at line 187 of file drawitem.h.

Constructor & Destructor Documentation

◆ TDrawMenuItem() [1/2]

owl::TDrawMenuItem::TDrawMenuItem ( TDrawItemProxy * proxy,
int cmdId,
int index,
LPCTSTR title = 0 )

Called with the proxy parent, the command it, the index in the menu and the text to display.

Definition at line 447 of file drawitem.cpp.

References owl::TButtonTextDrawItem::SetIndex(), and owl::TButtonTextDrawItem::SetText().

◆ TDrawMenuItem() [2/2]

owl::TDrawMenuItem::TDrawMenuItem ( TDrawItemProxy * proxy,
int cmdId,
int index,
const tstring & title )

String-aware overload.

Definition at line 458 of file drawitem.cpp.

References owl::TButtonTextDrawItem::SetIndex(), and owl::TButtonTextDrawItem::SetText().

Member Function Documentation

◆ GetBkColor()

TColor owl::TDrawMenuItem::GetBkColor ( )
virtual

If the menu item is selected returns TColor::SysActiveCaption; otherwise returns TColor::SysMenu.

Reimplemented from owl::TButtonTextDrawItem.

Definition at line 498 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsSelected(), owl::TColor::SysActiveCaption, and owl::TColor::SysMenu.

◆ GetButtonSize()

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

Get the size of the bitmap button.

Reimplemented from owl::TButtonTextDrawItem.

Definition at line 481 of file drawitem.cpp.

References owl::TButtonTextDrawItem::sepNoBitmap.

◆ GetCmdId()

int owl::TDrawMenuItem::GetCmdId ( )
inline

Returns CmdId.

Definition at line 340 of file drawitem.h.

◆ GetTextColor()

TColor owl::TDrawMenuItem::GetTextColor ( )
virtual

◆ GetTextSize()

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

◆ PaintBitmap()

◆ PaintCheck_3Angle()

void owl::TDrawMenuItem::PaintCheck_3Angle ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 ---x----
1 ---xx---
2 ---xxx--
3 ---xxxx-
4 ---xxx--
5 ---xx---
6 ---x----
7 --------

Definition at line 708 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsEnabled(), PaintCheckFace(), owl::TDC::SetPixel(), and owl::TColor::Sys3dHilight.

◆ PaintCheck_Arrow()

void owl::TDrawMenuItem::PaintCheck_Arrow ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 ---x----
1 ---xx---
2 ---xxx--
4 ---xxx--
5 ---xx---
6 ---x----
7 --------

Definition at line 780 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsEnabled(), PaintCheckFace(), owl::TDC::SetPixel(), and owl::TColor::Sys3dHilight.

◆ PaintCheck_Box()

◆ PaintCheck_Diamond()

void owl::TDrawMenuItem::PaintCheck_Diamond ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 --------
1 ----x---
2 ---xxx--
3 --xxxxx-
5 --xxxxx-
6 ---xxx--
7 ----x---

Definition at line 918 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsEnabled(), PaintCheckFace(), owl::TDC::SetPixel(), and owl::TColor::Sys3dHilight.

◆ PaintCheck_Dot()

void owl::TDrawMenuItem::PaintCheck_Dot ( TDC & dc,
TRect & rect )

◆ PaintCheck_None()

void owl::TDrawMenuItem::PaintCheck_None ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 --------
1 --------
2 --------
3 --------
4 --------
5 --------
6 --------
7 --------

Definition at line 1076 of file drawitem.cpp.

References PaintCheckFace().

◆ PaintCheck_Plus()

void owl::TDrawMenuItem::PaintCheck_Plus ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 --------
1 ---xx---
2 ---xx---
3 -xxxxxx-
4 -xxxxxx-
5 ---xx---
6 ---xx---
7 --------

Definition at line 1111 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsEnabled(), owl::TDC::LineTo(), owl::TDC::MoveTo(), PaintCheckFace(), owl::TDC::RestorePen(), owl::TDC::SelectObject(), owl::TDC::SetPixel(), and owl::TColor::Sys3dHilight.

◆ PaintCheck_V()

void owl::TDrawMenuItem::PaintCheck_V ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 ------x-
1 -----xx-
2 x---xxx-
3 xx-xxx--
4 xxxxx---
5 -xxx----
6 --x-----
7 --------

Definition at line 1183 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsEnabled(), PaintCheckFace(), owl::TDC::SetPixel(), and owl::TColor::Sys3dHilight.

◆ PaintCheck_X()

void owl::TDrawMenuItem::PaintCheck_X ( TDC & dc,
TRect & rect )

Draw this:

01234567
0 --------
1 xx---xx-
2 -xx-xx--
3 --xx----
4 ---xx---
5 -xx-xx--
6 xx---xx-
7 --------

Definition at line 1263 of file drawitem.cpp.

References owl::TButtonTextDrawItem::IsEnabled(), PaintCheckFace(), owl::TDC::SetPixel(), and owl::TColor::Sys3dHilight.

◆ PaintCheckFace()

void owl::TDrawMenuItem::PaintCheckFace ( TDC & dc,
TRect & rect )
virtual

◆ PaintText()

◆ SetCheckPainter()

void owl::TDrawMenuItem::SetCheckPainter ( TCheckPainter painter)
inline

Set the routine to be used to paint the check mark.

Definition at line 332 of file drawitem.h.

Member Data Documentation

◆ DECLARE_CASTABLE

owl::TDrawMenuItem::DECLARE_CASTABLE

Definition at line 193 of file drawitem.h.


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