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

Derived from TGadget, TButtonGadget represent buttons that you can click on or off. More...

#include <owl/buttonga.h>

Inheritance diagram for owl::TButtonGadget:
owl::TGadget owl::TButtonTextGadget owl::TPopupButtonGadget owl::TPickerGadget owl::TPopupMenuGadget owl::TBitmapPickerGadget owl::TColorPickerGadget

Public Types

enum  TType { Command , Exclusive , NonExclusive , SemiExclusive , RepeatCmd }
 Enumerates the types of button gadgets. More...
 
enum  TState { Up , Down , Indeterminate }
 TState enumerates the three button positions during which the button can be pressed: up (0), down (1), and an indeterminate state (2). More...
 
- Public Types inherited from owl::TGadget
enum  TBorderStyle {
  None , Plain , Raised , Recessed , Embossed , Grooved , ButtonUp , ButtonDn , WndRaised , WndRecessed ,
  WellSet
}
 Gadget border styles. More...
 

Public Member Functions

 TButtonGadget (TResId glyphResIdOrIndex, int id, TType type=Command, bool enabled=false, TState state=Up, bool sharedGlyph=false)
 Construct a button gadget that loads its own bitmap resource.
 
 ~TButtonGadget ()
 Destruct this button gadget, freeing up allocated resources.
 
void SetButtonState (TState newState)
 Set the state of a button.
 
TState GetButtonState () const
 Returns the state of the button.
 
TType GetButtonType () const
 Return the type of the button.
 
bool GetNotchCorners () const
 Returns true if the button has rounded corners.
 
void SetNotchCorners (bool notchCorners=true)
 By default, SetNotchCorners implements notched corners for buttons.
 
bool GetAntialiasEdges () const
 Return the current shadow style of the button.
 
void SetAntialiasEdges (bool anti=true)
 Turns the antialiasing of the button bevels on or off.
 
virtual void GetDesiredSize (TSize &size)
 Find out how big this button gadget wants to be.
 
virtual void SetBounds (const TRect &r)
 Gets the size of the bitmap, calls TGadget::SetBounds to set the boundary of the rectangle, and centers the bitmap within the button's rectangle.
 
virtual void CommandEnable ()
 Initiate a command enable for this button gadget.
 
virtual void SysColorChange ()
 SysColorChange responds to an EvSysColorChange message forwarded by the owning TGadgetWindow by setting the dither brush to zero.
 
- Public Member Functions inherited from owl::TGadget
 TGadget (int id=0, TBorderStyle borderStyle=None)
 Construct a gadget with a given id and border style.
 
virtual ~TGadget ()
 Destroys a TGadget interface object and removes it from its associated window.
 
int GetId () const
 Gets the ID for the gadget.
 
TRectGetBounds ()
 Returns the boundary rectangle for the gadget.
 
const TRectGetBounds () const
 Returns the boundary rectangle for the gadget.
 
virtual void SetEnabled (bool enabled)
 Enables or disables keyboard and mouse input for the gadget.
 
bool GetEnabled () const
 Determines whether keyboard and mouse input have been enabled for the specified gadget.
 
virtual void SetVisible (bool visible)
 Changes the visibility of the gadget.
 
bool IsVisible () const
 Returns true if the gadget is visible.
 
bool IsWindowVisible () const
 check to see if the button's created
 
void SetEndOfRow (bool eor)
 Sets the end of row property for the gadget.
 
bool IsEndOfRow () const
 Returns true if this gadget is at the end of a row.
 
bool IsWideAsPossible () const
 Indicates whether the gadget width will be adjusted by the gadget window to be as wide as possible in the remaining space.
 
void SetWideAsPossible (bool wide=true)
 Sets the flag that indicates whether the gadget width will be adjusted by the gadget window to be as wide as possible in the remaining space.
 
void SetShrinkWrap (bool shrinkWrapWidth, bool shrinkWrapHeight)
 Simple set accessor to set whether shrinkwrapping is performed horizontally and/or vertically.
 
void SetSize (const TSize &size)
 Alters the size of the gadget and then calls TGadgetWindow::GadgetChangedSize() for the size change to take effect.
 
void GetOuterSizes (int &left, int &right, int &top, int &bottom)
 Get the four total outer sizes in pixels which consists of the margins plus the borders.
 
void GetInnerRect (TRect &rect)
 Computes the area of the gadget's rectangle excluding the borders and margins.
 
virtual bool IdleAction (long idleCount)
 Called during idle time to allow the gadget to perform any idle actions.
 
TGadgetNextGadget ()
 Returns the next gadget in the list of gadgets.
 
void SetBorders (const TBorders &borders)
 Sets the borders for the gadget.
 
TBordersGetBorders ()
 Gets the gadget's borders measured in border units that are based on SM_CXBORDER and SM_CYBORDER.
 
void SetMargins (const TMargins &margins)
 Sets the margins of the gadget.
 
TMarginsGetMargins ()
 Gets the margin dimensions.
 
void SetBorderStyle (TBorderStyle bs)
 Set the border style used by this gadget.
 
TBorderStyle GetBorderStyle () const
 Gets the style for the gadget's borders.
 

Protected Types

enum  { CelNormal , CelDisabled , CelIndeterm , CelDown , CelPressed , CelsTotal }
 Glyph types and construction functions. More...
 

Protected Member Functions

virtual void Paint (TDC &dc)
 Perform all of the painting for this button gadget.
 
virtual void PaintBorder (TDC &dc)
 
virtual void MouseEnter (uint modKeys, const TPoint &p)
 Mouse has entered this button, (not pressed).
 
virtual void MouseMove (uint modKeys, const TPoint &p)
 Mouse has moved (back) into this gadget.
 
virtual void MouseLeave (uint modKeys, const TPoint &p)
 Mouse has left this button, (not pressed).
 
virtual void LButtonDown (uint modKeys, const TPoint &p)
 Overrides TGadget member function and responds to a left mouse button click by calling BeginPressed.
 
virtual void LButtonUp (uint modKeys, const TPoint &p)
 Handle the mouse left button up & leave the pressed state.
 
virtual void PaintFace (TDC &dc, const TRect &rect)
 Paints the face of the button.
 
virtual TDibGetGlyphDib ()
 Virtual function responsible for supplying the dib for the glyph.
 
virtual void ReleaseGlyphDib (TDib *glyph)
 Virtual function responsible for releasing glyph dib as needed based on how GetGlyphDib() got it (if different from new/delete).
 
virtual void BuildCelArray ()
 Build the CelArray member using the resource bitmap as the base glyph CelArray may contain an existing cel array that should be deleted if replaced.
 
virtual void BeginPressed (const TPoint &p)
 Begin button pressed state, repaint & enter menuselect state.
 
virtual void CancelPressed (const TPoint &p, bool mstate=false)
 Cancel pressed state, repaint & end menuselect state.
 
virtual void Activate (const TPoint &p)
 The action method called on a completed 'click', generates WM_COMMAND.
 
void SetButtonType (TType newType)
 Sets the type of the button.
 
void SetGlyphIndex (int index)
 
bool IsPressed () const
 Returns true if the button is pushed or false if it is released.
 
void CheckExclusively ()
 Perform an exclusive checking of this gadget by unchecking the neighboring exclusive button gadgets.
 
TResId GetResId () const
 Returns the resource ID for this button gadget's bitmap.
 
TCelArrayGetCelArray ()
 Returns the CelArray used to cache glyph states.
 
const TCelArrayGetCelArray () const
 Returns the CelArray used to cache glyph states.
 
TPointGetBitmapOrigin ()
 Returns the x and y coordinates of the bitmap used for this button gadget.
 
const TPointGetBitmapOrigin () const
 Returns the x and y coordinates of the bitmap used for this button gadget.
 
void SetBitmapOrigin (const TPoint &bitmapOrigin)
 Sets the x and y coordinates of the bitmap used for this button gadget.
 
- Protected Member Functions inherited from owl::TGadget
TGadgetWindowGetGadgetWindow ()
 Return a pointer to the owning or parent window for the gadget.
 
const TGadgetWindowGetGadgetWindow () const
 Return a pointer to the owning or parent window for the gadget.
 
virtual void Created ()
 This is the virtual called after the window holding a gadget has been created.
 
virtual void Inserted ()
 Called after a gadget is inserted into a window.
 
virtual void Moved ()
 This is the virtual called when a gadget is relocated.
 
virtual void Removed ()
 Virtual called after a gadget is removed from a window.
 
bool IsHaveMouse () const
 Return true if mouse inside gadget.
 
void SetInMouse (bool state)
 Sets if mouse inside gadget or not.
 
bool GetTrackMouse () const
 
void SetTrackMouse (bool track)
 
void Invalidate (bool erase=true)
 Used to invalidate the active (usually nonborder) portion of the gadget, Invalidate calls InvalidateRect and passes the boundary width and height of the area to erase.
 
void InvalidateRect (const TRect &rect, bool erase=true)
 Invalidate a rectangle in our containing window.
 
void Update ()
 Paint now if possible.
 
virtual bool PtIn (const TPoint &point)
 Default behavior returns true if the point is within the receiver's bounding rect.
 
virtual void RButtonDown (uint modKeys, const TPoint &point)
 
virtual void RButtonUp (uint modKeys, const TPoint &point)
 
void ChangeBorderStyle (TBorderStyle bs)
 Simply changes the border style without recalculating the gadget size.
 

Friends

class TBarDescr
 

Detailed Description

Derived from TGadget, TButtonGadget represent buttons that you can click on or off.

You can also apply attributes such as color, style, and shape (notched or unnotched) to your button gadgets.

In general, button gadgets are classified as either command or attribute buttons. Attribute buttons include radio buttons (which are considered exclusive), or check boxes (which are nonexclusive). The public data member, TType, enumerates these button types. TButtonGadget contains several functions that let you change the style of a button. Use SetAntialiasEdges to turn antialiasing on and off, SetNotchCorners to control corner notching, and SetShadowStyle to change the style of the button shadow.

TButtonGadget objects respond to mouse events in the following manner: when a mouse button is pressed, the button is pressed; when the mouse button is released, the button is released. Commands can be entered only when the mouse button is in the "up" state. When the mouse is pressed, TButtonGadget objects capture the mouse and reserve all mouse messages for the current window. When the mouse button is up, button gadgets release the capture for the current window. The public data member, TState, enumerates the three button states.

Buttons begin highlighting and do a capture when pressed (the mouse down occurs). they cancel highlighting when the mouse exits, but begin highlighting again when the mouse re-enters. when the mouse goes up the capture is released There are two basic type of buttons: commands and settings (attribute buttons). Settings can be exclusive (like a radio button) or non-exclusive (like a check box), or SemiExclusive where they act like both There are three normal button states: up, down, and indeterminate. in addition the button can be highlighted (pressed) in all three states Commands can only be in the "up" state. Settings can be in all three states

Todo
Move NotchCorners to OWL5COMPAT, implement repeating commands

Definition at line 65 of file buttonga.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Glyph types and construction functions.

Contains values that allow a glyph button to display different glyphs when its state changes. For example, the CelPressed constant could be used to toggle a glyph button between a happy face and a sad face when it is pressed.

Note
Unused at the moment.
Todo
Implement the functionality to allow a glyph button to display different glyphs when its state changes
Enumerator
CelNormal 

Displayed under normal circumstances.

CelDisabled 

Displayed when the button is disabled (grayed).

CelIndeterm 

Displayed when an ambiguous or indeterminate state is encountered.

CelDown 

Displayed when the button is down or checked.

CelPressed 

Displayed when the button is pressed.

CelsTotal 

Definition at line 151 of file buttonga.h.

◆ TState

TState enumerates the three button positions during which the button can be pressed: up (0), down (1), and an indeterminate state (2).

A nonzero value indicates a highlighted button.

Enumerator
Up 

Current state of this button.

Button is up, i.e. unchecked

Down 

Button is down, i.e. checked.

Indeterminate 

Button is neither checked nor unchecked.

Definition at line 80 of file buttonga.h.

◆ TType

Enumerates the types of button gadgets.

An exclusive button is one that works in conjunction with other buttons such that one button is activated at a time.

Enumerator
Command 

Basic type of this button.

Sends a command when pressed.

Exclusive 

Stays down when pressed and causes other buttons in the group to pop back up.

NonExclusive 

Toggles its state when pressed and ignores other buttons.

SemiExclusive 

Same as exclusive, except that it also pops back up if pressed while it is down.

RepeatCmd 

Auto-repeating command button.

Definition at line 69 of file buttonga.h.

Constructor & Destructor Documentation

◆ TButtonGadget()

owl::TButtonGadget::TButtonGadget ( TResId glyphResIdOrIndex,
int id,
TType type = Command,
bool enabled = false,
TState state = Up,
bool sharedGlyph = false )

Construct a button gadget that loads its own bitmap resource.

Constructs a TButtonGadget object using the specified bitmap ID, button gadget ID, and type, with enabled set to false and in a button-up state. The button isn't enabled - its initial state before command enabling occurs. sharedGlyph should be set true if the glyph is being held by the window instead of being loaded from a resource.

Definition at line 107 of file buttonga.cpp.

References OWL_CDLEVEL, SetAntialiasEdges(), owl::TGadget::SetEnabled(), owl::TGadget::SetTrackMouse(), strnewdup(), and TRACEX.

◆ ~TButtonGadget()

owl::TButtonGadget::~TButtonGadget ( )

Destruct this button gadget, freeing up allocated resources.

Definition at line 149 of file buttonga.cpp.

References owl::TResIdT< T >::IsString(), OWL_CDLEVEL, and TRACEX.

Member Function Documentation

◆ Activate()

void owl::TButtonGadget::Activate ( const TPoint & pt)
protectedvirtual

The action method called on a completed 'click', generates WM_COMMAND.

Invoked by mouse-up event inside the Gadget. Sets member data "Pressed" to false, changes state for attribute buttons, and paints the button in its current state. Command buttons just send the command Exclusive buttons check themselves and uncheck neighbors. NonExclusive buttons toggle their check state. SemiExclusive uncheck neighbors on press, but can also be unpressed. Invoked when the mouse is in the "up" state, Activate sets Pressed to false, changes the state for attribute buttons, and paints the button in its current state. To do this, it calls CancelPressed(), posts a WM_COMMAND message to the gadget window's parent, and sends menu messages to the gadget window's parent.

Definition at line 620 of file buttonga.cpp.

References CancelPressed(), CheckExclusively(), Command, Down, Exclusive, owl::TGadget::GetEnabled(), owl::TGadget::GetGadgetWindow(), owl::TGadget::GetId(), NonExclusive, RepeatCmd, SemiExclusive, and Up.

◆ BeginPressed()

void owl::TButtonGadget::BeginPressed ( const TPoint & p)
protectedvirtual

Begin button pressed state, repaint & enter menuselect state.

When the mouse button is pressed, BeginPressed sets Pressed to true, paints the pressed button, and sends menu messages to the gadget window's parent.

Reimplemented in owl::TPopupButtonGadget.

Definition at line 574 of file buttonga.cpp.

References owl::TGadget::GetGadgetWindow(), owl::TGadget::GetId(), owl::TGadget::Invalidate(), owl::TGadgetWindow::PressHints, owl::TGadgetWindow::SetHintCommand(), owl::TGadget::SetInMouse(), and owl::TGadget::Update().

◆ BuildCelArray()

void owl::TButtonGadget::BuildCelArray ( )
protectedvirtual

Build the CelArray member using the resource bitmap as the base glyph CelArray may contain an existing cel array that should be deleted if replaced.

The CelArray and glyph painting can work in one of the following ways:

  • 1. ResId ctor is used, ...., glyph states are cached in this CelArray
  • 2. ResId ctor is used, CelArray holds single glyph and paints state on the fly
  • 3. ResId ctor is used, glyph is added to Window's CelArray and paints state on the fly
  • 4. glyphIndex ctor is used, uses Window's CelArray glyph and paints state on the fly

Reimplemented in owl::TBitmapPickerGadget.

Definition at line 386 of file buttonga.cpp.

References CHECK, owl::TGadgetWindow::GetCelArray(), owl::TGadget::GetGadgetWindow(), GetGlyphDib(), and ReleaseGlyphDib().

◆ CancelPressed()

void owl::TButtonGadget::CancelPressed ( const TPoint & p,
bool mstate = false )
protectedvirtual

Cancel pressed state, repaint & end menuselect state.

When the mouse button is released, CancelPressed sets Pressed to false, paints the button, and sends menu messages to the gadget window's parent. Sets InMouse to mstate.

Reimplemented in owl::TPopupButtonGadget.

Definition at line 592 of file buttonga.cpp.

References owl::TGadget::GetGadgetWindow(), owl::TGadget::Invalidate(), owl::TGadgetWindow::PressHints, owl::TGadgetWindow::SetHintCommand(), owl::TGadget::SetInMouse(), and owl::TGadget::Update().

◆ CheckExclusively()

void owl::TButtonGadget::CheckExclusively ( )
protected

Perform an exclusive checking of this gadget by unchecking the neighboring exclusive button gadgets.

Definition at line 200 of file buttonga.cpp.

References Down, Exclusive, owl::TGadget::GetGadgetWindow(), owl::TGadget::NextGadget(), owl::TGadgetList::NextGadget(), PRECONDITION, SemiExclusive, TYPESAFE_DOWNCAST, and Up.

◆ CommandEnable()

void owl::TButtonGadget::CommandEnable ( )
virtual

Initiate a command enable for this button gadget.

Enables the button gadget to capture messages. Calls SendMessage to send a WM_COMMAND_ENABLE message to the gadget window's parent, passing a TCommandEnable: EvCommandEnable message for this button.

Reimplemented from owl::TGadget.

Reimplemented in owl::TButtonTextGadget.

Definition at line 166 of file buttonga.cpp.

References owl::TGadget::GetGadgetWindow(), owl::TWindow::HandleMessage(), PRECONDITION, and WM_COMMAND_ENABLE.

◆ GetAntialiasEdges()

bool owl::TButtonGadget::GetAntialiasEdges ( ) const
inline

Return the current shadow style of the button.

Returns true if the border edges are antialiased.

Definition at line 284 of file buttonga.h.

◆ GetBitmapOrigin() [1/2]

TPoint & owl::TButtonGadget::GetBitmapOrigin ( )
inlineprotected

Returns the x and y coordinates of the bitmap used for this button gadget.

Definition at line 323 of file buttonga.h.

◆ GetBitmapOrigin() [2/2]

const TPoint & owl::TButtonGadget::GetBitmapOrigin ( ) const
inlineprotected

Returns the x and y coordinates of the bitmap used for this button gadget.

Definition at line 329 of file buttonga.h.

◆ GetButtonState()

TButtonGadget::TState owl::TButtonGadget::GetButtonState ( ) const
inline

Returns the state of the button.

Definition at line 235 of file buttonga.h.

◆ GetButtonType()

TButtonGadget::TType owl::TButtonGadget::GetButtonType ( ) const
inline

Return the type of the button.

Definition at line 242 of file buttonga.h.

◆ GetCelArray() [1/2]

TCelArray * owl::TButtonGadget::GetCelArray ( )
inlineprotected

Returns the CelArray used to cache glyph states.

Definition at line 311 of file buttonga.h.

◆ GetCelArray() [2/2]

const TCelArray * owl::TButtonGadget::GetCelArray ( ) const
inlineprotected

Returns the CelArray used to cache glyph states.

Definition at line 317 of file buttonga.h.

◆ GetDesiredSize()

void owl::TButtonGadget::GetDesiredSize ( TSize & size)
virtual

Find out how big this button gadget wants to be.

Calculated using the base size to get the borders, etc. plus the glyph size. Stores the width and height (measured in pixels) of the button gadget in size. Calls TGadget::GetDesiredSize to calculate the relationship between one rectangle and another.

Reimplemented from owl::TGadget.

Reimplemented in owl::TButtonTextGadget, and owl::TPopupButtonGadget.

Definition at line 322 of file buttonga.cpp.

References _T, BuildCelArray(), owl::TCelArray::CelSize(), owl::TGadgetWindow::GetCelArray(), owl::TGadget::GetDesiredSize(), owl::TGadget::GetGadgetWindow(), PRECONDITION, and TRACEX.

◆ GetGlyphDib()

TDib * owl::TButtonGadget::GetGlyphDib ( )
protectedvirtual

Virtual function responsible for supplying the dib for the glyph.

Can be overriden to get dib from elsewhere, cache it, map colors differently, etc. Returns 0 if no resource was specified for this button

Definition at line 348 of file buttonga.cpp.

References owl::TGadget::GetGadgetWindow(), owl::TDib::MapFace, owl::TDib::MapHighlight, owl::TDib::MapShadow, owl::TDib::MapText, and PRECONDITION.

◆ GetNotchCorners()

bool owl::TButtonGadget::GetNotchCorners ( ) const
inline

Returns true if the button has rounded corners.

This style may be ignores on some UI platforms.

Definition at line 250 of file buttonga.h.

◆ GetResId()

TResId owl::TButtonGadget::GetResId ( ) const
inlineprotected

Returns the resource ID for this button gadget's bitmap.

Definition at line 305 of file buttonga.h.

◆ IsPressed()

bool owl::TButtonGadget::IsPressed ( ) const
inlineprotected

Returns true if the button is pushed or false if it is released.

Definition at line 341 of file buttonga.h.

◆ LButtonDown()

void owl::TButtonGadget::LButtonDown ( uint modKeys,
const TPoint & p )
protectedvirtual

Overrides TGadget member function and responds to a left mouse button click by calling BeginPressed.

Reimplemented from owl::TGadget.

Reimplemented in owl::TPopupButtonGadget.

Definition at line 683 of file buttonga.cpp.

References BeginPressed(), and owl::TGadget::LButtonDown().

◆ LButtonUp()

void owl::TButtonGadget::LButtonUp ( uint modKeys,
const TPoint & pt )
protectedvirtual

Handle the mouse left button up & leave the pressed state.

If the mouse is still on this button, i.e. it is still pressed, then perform the button action. Overrides TGadget member functions and responds to a release of the left mouse button by calling Activate.

Reimplemented from owl::TGadget.

Reimplemented in owl::TPopupButtonGadget.

Definition at line 754 of file buttonga.cpp.

References Activate(), owl::TGadgetWindow::FlatStandard, owl::TGadget::GetGadgetWindow(), owl::TGadget::Invalidate(), and owl::TGadget::LButtonUp().

◆ MouseEnter()

void owl::TButtonGadget::MouseEnter ( uint modKeys,
const TPoint & pt )
protectedvirtual

Mouse has entered this button, (not pressed).

Show hints if that style is enabled Called when the mouse enters the boundary of the button gadget. modKeys indicates the virtual key information and can be any combination of the following values: MK_CONTROL, MK_LBUTTON, MK_MBUTTON, MK_RBUTTON, or MK_SHIFT. p indicates where the mouse entered the button gadget.

Reimplemented from owl::TGadget.

Definition at line 699 of file buttonga.cpp.

References owl::TGadgetWindow::EnterHints, owl::TGadget::GetGadgetWindow(), owl::TGadget::GetId(), owl::TGadget::MouseEnter(), and owl::TGadgetWindow::SetHintCommand().

◆ MouseLeave()

void owl::TButtonGadget::MouseLeave ( uint modKeys,
const TPoint & pt )
protectedvirtual

Mouse has left this button, (not pressed).

Hide hints if that style is enabled Called when the mouse leaves the boundary of the button gadget. modKeys indicates the virtual key information and can be any combination of the following values: MK_CONTROL, MK_LBUTTON, MK_MBUTTON, MK_RBUTTON, or MK_SHIFT. p indicates the place where the mouse left the button gadget.

Reimplemented from owl::TGadget.

Definition at line 738 of file buttonga.cpp.

References owl::TGadgetWindow::EnterHints, owl::TGadget::GetGadgetWindow(), owl::TGadget::MouseLeave(), and owl::TGadgetWindow::SetHintCommand().

◆ MouseMove()

void owl::TButtonGadget::MouseMove ( uint modKeys,
const TPoint & pt )
protectedvirtual

Mouse has moved (back) into this gadget.

Push or pull the button up & down as needed. Calls TGadget::MouseMove in response to the mouse being dragged. If the mouse moves off the button, MouseMove calls CancelPressed(). If the mouse moves back onto the button, MouseMove calls BeginPressed().

Reimplemented from owl::TGadget.

Definition at line 715 of file buttonga.cpp.

References BeginPressed(), CancelPressed(), owl::TGadget::MouseMove(), and owl::TGadget::PtIn().

◆ Paint()

void owl::TButtonGadget::Paint ( TDC & dc)
protectedvirtual

Perform all of the painting for this button gadget.

Gets the width and height of the window frame (in pixels), calls GetImageSize to retrieve the size of the bitmap, and sets the inner rectangle to the specified dimensions. Calls TGadget::PaintBorder to perform the actual painting of the border of the control. Before painting the control, Paint determines whether the corners of the control are notched, and then calls GetSysColor to see if highlighting or shadow colors are used. Paint assumes the border style is plain. Then, Paint draws the top, left, right, and bottom of the control, adjusts the position of the bitmap, and finishes drawing the control using the specified embossing, fading, and dithering.

Reimplemented from owl::TGadget.

Reimplemented in owl::TButtonTextGadget, and owl::TPopupButtonGadget.

Definition at line 457 of file buttonga.cpp.

References owl::TGadget::GetInnerRect(), PaintBorder(), PaintFace(), and PRECONDITION.

◆ PaintBorder()

◆ PaintFace()

◆ ReleaseGlyphDib()

void owl::TButtonGadget::ReleaseGlyphDib ( TDib * glyph)
protectedvirtual

Virtual function responsible for releasing glyph dib as needed based on how GetGlyphDib() got it (if different from new/delete).

Definition at line 366 of file buttonga.cpp.

◆ SetAntialiasEdges()

void owl::TButtonGadget::SetAntialiasEdges ( bool anti = true)
inline

Turns the antialiasing of the button bevels on or off.

By default, antialiasing is on.

Definition at line 292 of file buttonga.h.

◆ SetBitmapOrigin()

void owl::TButtonGadget::SetBitmapOrigin ( const TPoint & bitmapOrigin)
inlineprotected

Sets the x and y coordinates of the bitmap used for this button gadget.

Definition at line 335 of file buttonga.h.

◆ SetBounds()

void owl::TButtonGadget::SetBounds ( const TRect & r)
virtual

Gets the size of the bitmap, calls TGadget::SetBounds to set the boundary of the rectangle, and centers the bitmap within the button's rectangle.

Reimplemented from owl::TGadget.

Reimplemented in owl::TButtonTextGadget, and owl::TPopupButtonGadget.

Definition at line 293 of file buttonga.cpp.

References _T, owl::TCelArray::CelSize(), owl::TGadgetWindow::GetCelArray(), owl::TGadget::GetGadgetWindow(), owl::TGadget::GetInnerRect(), PRECONDITION, owl::TGadget::SetBounds(), and TRACEX.

◆ SetButtonState()

void owl::TButtonGadget::SetButtonState ( TState newState)

Set the state of a button.

Handles setting down on an exclusive button to pop out the neighbors

Definition at line 271 of file buttonga.cpp.

References CheckExclusively(), Down, Exclusive, owl::TGadget::Invalidate(), SemiExclusive, and owl::TGadget::Update().

◆ SetButtonType()

void owl::TButtonGadget::SetButtonType ( TType newType)
inlineprotected

Sets the type of the button.

Definition at line 299 of file buttonga.h.

◆ SetGlyphIndex()

void owl::TButtonGadget::SetGlyphIndex ( int index)
protected

Definition at line 437 of file buttonga.cpp.

◆ SetNotchCorners()

void owl::TButtonGadget::SetNotchCorners ( bool notchCorners = true)
inline

By default, SetNotchCorners implements notched corners for buttons.

To repaint the frame of the button if the window has already been created, call InvalidateRect with the Bounds rectangle. This style may be ignores on some UI platforms.

Definition at line 260 of file buttonga.h.

◆ SysColorChange()

void owl::TButtonGadget::SysColorChange ( )
virtual

SysColorChange responds to an EvSysColorChange message forwarded by the owning TGadgetWindow by setting the dither brush to zero.

If a user-interface bitmap exists, SysColorchange deletes and rebuilds it to get the new button colors.

Reimplemented from owl::TGadget.

Reimplemented in owl::TButtonTextGadget.

Definition at line 187 of file buttonga.cpp.

References BuildCelArray(), and owl::TGadget::SysColorChange().

Friends And Related Symbol Documentation

◆ TBarDescr

Definition at line 222 of file buttonga.h.


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