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

Derived from TGadget, TBitmapGadget is a simple gadget that can display an array of bitmap images one at a time. More...

#include <owl/bitmapga.h>

Inheritance diagram for owl::TBitmapGadget:
owl::TGadget owl::TDynamicBitmapGadget

Public Member Functions

 TBitmapGadget (TResId imageResIdOrIndex, int id, TBorderStyle borderStyle, int numImages, int startImage=0, bool sharedCels=false)
 Construct a bitmap gadget.
 
 ~TBitmapGadget ()
 Destruct a bitmap gadget and free its resources.
 
int SelectImage (int imageNum, bool immediate)
 Choose the relative image to display.
 
int GetImage () const
 Returns the number of the currently selected image.
 
void SysColorChange ()
 When the system colors have been changed, SysColorChange is called by the gadget window's EvSysColorChange so that bitmap gadgets can be rebuilt and repainted.
 
- 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.
 
virtual void CommandEnable ()
 Provided so that the gadget can perform command enabling (so it can handle an incoming message if it's appropriate to do so).
 
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 Member Functions

void Paint (TDC &dc)
 Paint this bitmap gadget. Uses normal borders, plus draws the image centered.
 
void SetBounds (const TRect &boundRect)
 Set the bounding rect for this button gadget.
 
void GetDesiredSize (TSize &size)
 Find out how big this bitmap gadget wants to be.
 
virtual TCelArrayCreateCelArray (TResId resId, int numImages) const
 
- 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 PaintBorder (TDC &dc)
 Self sent by method Paint().
 
virtual void MouseEnter (uint modKeys, const TPoint &point)
 Mouse is entering this gadget.
 
virtual void MouseMove (uint modKeys, const TPoint &point)
 Mouse is moving over this gadget.
 
virtual void MouseLeave (uint modKeys, const TPoint &point)
 Mouse is leaving this gadget.
 
virtual void LButtonDown (uint modKeys, const TPoint &point)
 Captures the mouse if TrackMouse is set.
 
virtual void RButtonDown (uint modKeys, const TPoint &point)
 
virtual void LButtonUp (uint modKeys, const TPoint &point)
 Releases the mouse capture if TrackMouse is set.
 
virtual void RButtonUp (uint modKeys, const TPoint &point)
 
void ChangeBorderStyle (TBorderStyle bs)
 Simply changes the border style without recalculating the gadget size.
 

Additional Inherited Members

- Public Types inherited from owl::TGadget
enum  TBorderStyle {
  None , Plain , Raised , Recessed , Embossed , Grooved , ButtonUp , ButtonDn , WndRaised , WndRecessed ,
  WellSet
}
 Gadget border styles. More...
 

Detailed Description

Derived from TGadget, TBitmapGadget is a simple gadget that can display an array of bitmap images one at a time.

Definition at line 33 of file bitmapga.h.

Constructor & Destructor Documentation

◆ TBitmapGadget()

owl::TBitmapGadget::TBitmapGadget ( TResId imageResIdOrIndex,
int id,
TBorderStyle borderStyle,
int numImages,
int startImage = 0,
bool sharedCels = false )

Construct a bitmap gadget.

Constructs a TBitmapGadget and sets the current image to the beginning image (startImage) in the array of images. Then, sets the border style to the current TGadget border style and numImages to the number of images in the array.

If sharedCels is false, imageResIdOrIndex specifies a single bitmap image that can be evenly divided into numImages parts. If sharedCels is true, imageResIdOrIndex specifies the starting image to use in the common TGadgetWindow bitmap image.

Definition at line 31 of file bitmapga.cpp.

References OWL_CDLEVEL, and TRACEX.

◆ ~TBitmapGadget()

owl::TBitmapGadget::~TBitmapGadget ( )

Destruct a bitmap gadget and free its resources.

Deletes the array of images.

Definition at line 61 of file bitmapga.cpp.

References OWL_CDLEVEL, and TRACEX.

Member Function Documentation

◆ CreateCelArray()

TCelArray * owl::TBitmapGadget::CreateCelArray ( TResId resId,
int numImages ) const
protectedvirtual

◆ GetDesiredSize()

void owl::TBitmapGadget::GetDesiredSize ( TSize & size)
protectedvirtual

Find out how big this bitmap gadget wants to be.

Calculated using the base size to get the borders, etc. plus the image size. Calls TGadget::GetDesiredSize, which determines how big the bitmap gadget can be. The gadget window sends this message to query the gadget's size. If shrink-wrapping is requested, GetDesiredSize returns the size needed to accommodate the borders and margins. If shrink-wrapping is not requested, it returns the gadget's current width and height. TGadgetWindow needs this information to determine how big the gadget needs to be, but it can adjust these dimensions if necessary. If WideAsPossible is true, then the width parameter (size.cx) is ignored.

Reimplemented from owl::TGadget.

Definition at line 128 of file bitmapga.cpp.

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

◆ GetImage()

int owl::TBitmapGadget::GetImage ( ) const
inline

Returns the number of the currently selected image.

Definition at line 95 of file bitmapga.h.

◆ Paint()

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

Paint this bitmap gadget. Uses normal borders, plus draws the image centered.

Reimplemented from owl::TGadget.

Definition at line 164 of file bitmapga.cpp.

References owl::TGadgetWindow::GetCelArray(), owl::TGadget::GetGadgetWindow(), owl::TGadget::GetInnerRect(), and owl::TGadget::PaintBorder().

◆ SelectImage()

int owl::TBitmapGadget::SelectImage ( int imageNum,
bool immediate )

Choose the relative image to display.

If immediate is true, this gadget is repainted immediately

Definition at line 144 of file bitmapga.cpp.

References owl::TGadget::Invalidate(), PRECONDITION, and owl::TGadget::Update().

◆ SetBounds()

void owl::TBitmapGadget::SetBounds ( const TRect & boundRect)
protectedvirtual

Set the bounding rect for this button gadget.

Also takes care of re-centering the image Calls TGadget::SetBounds and passes the dimensions of the bitmap gadget. SetBounds informs the control gadget of a change in its bounding rectangle.

Reimplemented from owl::TGadget.

Definition at line 100 of file bitmapga.cpp.

References owl::TCelArray::CelSize(), owl::TGadget::GetInnerRect(), owl::TGadget::SetBounds(), and TRACEX.

◆ SysColorChange()

void owl::TBitmapGadget::SysColorChange ( )
virtual

When the system colors have been changed, SysColorChange is called by the gadget window's EvSysColorChange so that bitmap gadgets can be rebuilt and repainted.

Handle a system color change by cleaning up & reloading & processing the bitmap. Is also called to create the initial bitmap.

Reimplemented from owl::TGadget.

Definition at line 75 of file bitmapga.cpp.

References CreateCelArray().


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