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

TUIFace assists in painting UI elements in various states. More...

#include <owl/uihelper.h>

Public Types

enum  TState { Normal , Down , Indeterm , Disabled , Default }
 Enumeration describing the state of the bitmap to be drawn. More...
 

Public Member Functions

 TUIFace (const TRect &faceRect, const TBitmap &bm, const TColor &bgndColor=TColor::Sys3dFace, const TColor &fillColor=TColor::Sys3dFace)
 Initializes the button face with a bitmap.
 
 TUIFace (const TRect &faceRect, const tstring &text, const TColor &fillColor=TColor::Sys3dFace, uint format=0)
 Initializes the button face with a text string.
 
 TUIFace (const TRect &faceRect, const TIcon &icon, const TColor &bgndColor=TColor::Sys3dFace, const TColor &fillColor=TColor::Sys3dFace)
 Initializes the button face with an icon.
 
void Paint (TDC &dc, const TPoint &dstPt, TState state, bool pressed, bool fillFace=true)
 Paint the face of a button onto a DC.
 
void Paint (TDC &dc, const TRect &srcRect, const TPoint &dstPt, TState state, bool pressed, bool fillFace=true)
 Paint a portion of the source bitmap onto a DC.
 
void PaintMask (TDC &dc, const TPoint &pt)
 Paint the mask onto a DC.
 

Static Public Member Functions

static bool Draw (TDC &dc, HBRUSH hbr, LPARAM lp, WPARAM wp, int x, int y, int cx, int cy, uint flags)
 Encapsulates and emulate the 32-bit DrawState API.
 
static void PaintBm (const TBitmap &glyph, const TRect &glyphSrcRect, TDC &dc, const TRect &faceRect, const TPoint &dstPt, TState state, bool pressed, bool fillFace, const TColor &maskColor, const TColor &fillColor)
 Internal bitmap painting function.
 
static void PaintIcon (const TIcon &icon, const TRect &glyphSrcRect, TDC &dc, const TRect &faceRect, const TPoint &dstPt, TState state, bool pressed, bool fillFace, const TColor &maskColor, const TColor &fillColor)
 Internal static helper function that can be used alone.
 
static void PaintText (const tstring &text, TDC &dc, const TRect &faceRect, const TPoint &dstPt, TState state, bool pressed, bool fillFace, const TColor &fillColor, uint16 format)
 Internal static helper function that can be used alone.
 
static void PaintMaskBm (const TBitmap &glyph, TDC &dc, const TPoint &pt, const TColor &maskColor)
 Internal static helper function that can be used alone.
 
static void BuildMask (TDC &maskDC, const TPoint &maskDst, const TSize &maskSize, TDC &glyphDC, const TRect &glyphRect, const TColor &maskColor)
 Internal static helper function that can be used alone.
 
static void FillBackground (TDC &dc, TDC &maskDC, const TRect &dstRect, const TBrush &brush)
 Internal static helper function that can be used alone.
 
static void DitherBackground (TDC &dc, TDC &maskDC, const TRect &dstRect)
 Internal static helper function that can be used alone.
 
static int DrawTextEtched (TDC &dc, const tstring &str, int count, const TRect &rect, uint16 format)
 Internal static helper function that can be used alone.
 
static THatch8x8BrushGetDitherBrush ()
 Internal static helper function that can be used alone.
 
static TBitmapGetGlyphMask (const TSize &minSize)
 Internal static helper function that can be used alone.
 

Detailed Description

TUIFace assists in painting UI elements in various states.

Definition at line 367 of file uihelper.h.

Member Enumeration Documentation

◆ TState

Enumeration describing the state of the bitmap to be drawn.

Enumerator
Normal 

Normal state.

Down 

Down or Option set state (hilit background, +1,+1)

Indeterm 

Indeterminant, or mixed-value state.

Disabled 

Disabled or Unavailable state (embossed 3d no color)

Default 

Default btn state (bold)

Definition at line 372 of file uihelper.h.

Constructor & Destructor Documentation

◆ TUIFace() [1/3]

owl::TUIFace::TUIFace ( const TRect & faceRect,
const TBitmap & bm,
const TColor & bgndColor = TColor::Sys3dFace,
const TColor & fillColor = TColor::Sys3dFace )
inline

Initializes the button face with a bitmap.

Definition at line 522 of file uihelper.h.

◆ TUIFace() [2/3]

owl::TUIFace::TUIFace ( const TRect & faceRect,
const tstring & text,
const TColor & fillColor = TColor::Sys3dFace,
uint format = 0 )
inline

Initializes the button face with a text string.

Definition at line 534 of file uihelper.h.

◆ TUIFace() [3/3]

owl::TUIFace::TUIFace ( const TRect & faceRect,
const TIcon & icon,
const TColor & bgndColor = TColor::Sys3dFace,
const TColor & fillColor = TColor::Sys3dFace )
inline

Initializes the button face with an icon.

Definition at line 546 of file uihelper.h.

Member Function Documentation

◆ BuildMask()

void owl::TUIFace::BuildMask ( TDC & maskDC,
const TPoint & maskDst,
const TSize & maskSize,
TDC & glyphDC,
const TRect & glyphRect,
const TColor & maskedColor )
static

Internal static helper function that can be used alone.

Build a monochrome mask bitmap for the glyph that has 1's where color maskedColor is and 0's everywhere else.

Note
Assumes DC's are already setup - i.e. maskDC has the destination monochrome bitmap selected in it and glyphDC has the image selected in it..

Definition at line 153 of file uiface.cpp.

References owl::TColor::None.

◆ DitherBackground()

void owl::TUIFace::DitherBackground ( TDC & dc,
TDC & maskDC,
const TRect & dstRect )
static

Internal static helper function that can be used alone.

Tiles the rectangle with a even dithered (checkerboard) pattern maskDC determines the stencil area of dither

Definition at line 192 of file uiface.cpp.

References FillBackground(), and GetDitherBrush().

◆ Draw()

bool owl::TUIFace::Draw ( TDC & dc,
HBRUSH hbr,
LPARAM lp,
WPARAM wp,
int x,
int y,
int cx,
int cy,
uint flags )
static

Encapsulates and emulate the 32-bit DrawState API.

Definition at line 469 of file uiface.cpp.

◆ DrawTextEtched()

int owl::TUIFace::DrawTextEtched ( TDC & dc,
const tstring & str,
int count,
const TRect & rect,
uint16 format )
static

Internal static helper function that can be used alone.

An extension to ::DrawText that draws etched text by writing twice, the first one offset down & right in a light color, and the second not offset

Definition at line 203 of file uiface.cpp.

References owl::TDC::DrawText(), owl::TDC::SetBkMode(), owl::TDC::SetTextColor(), owl::TColor::Sys3dHilight, and owl::TColor::Sys3dShadow.

◆ FillBackground()

void owl::TUIFace::FillBackground ( TDC & dc,
TDC & maskDC,
const TRect & dstRect,
const TBrush & brush )
static

Internal static helper function that can be used alone.

Paint onto a given DC withing a given rect using a monochrome BM in a dc as a stencil and an arbitrary brush

Definition at line 172 of file uiface.cpp.

References owl::TDC::BitBlt(), owl::TColor::Black, owl::TDC::RestoreBrush(), owl::RopDSPDxax, owl::TDC::SelectObject(), owl::TDC::SetBkColor(), owl::TDC::SetTextColor(), and owl::TColor::White.

◆ GetDitherBrush()

THatch8x8Brush & owl::TUIFace::GetDitherBrush ( )
static

Internal static helper function that can be used alone.

Return a brush created using a hatched [checkerboard] pattern of the button highlight color. This brush is commonly used for rendering 'indeterminate' or 'mixed-value' appearances.

Note
Automatically reconstructs the brush if the relevant system color changed during a session...

Definition at line 124 of file uiface.cpp.

◆ GetGlyphMask()

TBitmap & owl::TUIFace::GetGlyphMask ( const TSize & minSize)
static

Internal static helper function that can be used alone.

Return a reference to a static monochrome bitmap. The optional TSize pointer allows the routine to ensure that the bitmap is big enough for a given use.

Definition at line 138 of file uiface.cpp.

◆ Paint() [1/2]

void owl::TUIFace::Paint ( TDC & dc,
const TPoint & pt,
TState state,
bool pressed,
bool fillFace = true )

Paint the face of a button onto a DC.

Assumes the entire bitmap is the face.

Definition at line 431 of file uiface.cpp.

References PaintBm(), PaintIcon(), PaintText(), and owl::TBitmap::Size().

◆ Paint() [2/2]

void owl::TUIFace::Paint ( TDC & dc,
const TRect & srcRect,
const TPoint & pt,
TState state,
bool pressed,
bool fillFace = true )

Paint a portion of the source bitmap onto a DC.

This allows one bitmap to be the source for multiple TUIFaces.

Definition at line 449 of file uiface.cpp.

References PaintBm(), PaintIcon(), and PaintText().

◆ PaintBm()

void owl::TUIFace::PaintBm ( const TBitmap & glyph,
const TRect & glyphSrcRect,
TDC & dc,
const TRect & faceRect,
const TPoint & dstPt,
TState state,
bool pressed,
bool fillFace,
const TColor & maskColor,
const TColor & fillColor )
static

◆ PaintIcon()

void owl::TUIFace::PaintIcon ( const TIcon & icon,
const TRect & glyphSrcRect,
TDC & dc,
const TRect & faceRect,
const TPoint & dstPt,
TState state,
bool pressed,
bool fillFace,
const TColor & maskColor,
const TColor & fillColor )
static

Internal static helper function that can be used alone.

Definition at line 315 of file uiface.cpp.

References PaintBm().

◆ PaintMask()

void owl::TUIFace::PaintMask ( TDC & dc,
const TPoint & pt )

Paint the mask onto a DC.

Definition at line 534 of file uiface.cpp.

References PaintMaskBm().

◆ PaintMaskBm()

void owl::TUIFace::PaintMaskBm ( const TBitmap & glyph,
TDC & dc,
const TPoint & pt,
const TColor & maskColor )
static

Internal static helper function that can be used alone.

Paint the mask onto a DC.

Definition at line 497 of file uiface.cpp.

References owl::TDC::BitBlt(), BuildMask(), GetGlyphMask(), and owl::TColor::Sys3dHilight.

◆ PaintText()

void owl::TUIFace::PaintText ( const tstring & text,
TDC & dc,
const TRect & faceRect,
const TPoint & dstPt,
TState state,
bool pressed,
bool fillFace,
const TColor & fillColor,
uint16 format )
static

Internal static helper function that can be used alone.

Definition at line 331 of file uiface.cpp.

References BuildMask(), Default, Disabled, DitherBackground(), Down, DrawTextEtched(), GetGlyphMask(), Indeterm, and Normal.


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