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

#include <owl/popupgad.h>

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

Public Types

enum  TPopupType { Normal , DownArrow , DownArrowAction }
 
- Public Types inherited from owl::TButtonTextGadget
enum  TAlign { aLeft , aCenter , aRight }
 Enumerates the text-alignment attributes. More...
 
enum  TStyle { sBitmap =0x001 , sText =0x002 , sBitmapText =0x003 }
 TStyle contains values that defines how gadget will be displayed: More...
 
enum  TLayoutStyle { lTextLeft , lTextTop , lTextRight , lTextBottom }
 TLayoutStyle contains values that defines how bitmap and text will be layout. More...
 
- Public Types inherited from owl::TButtonGadget
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

 TPopupButtonGadget (int id, TResId glyphResIdOrIndex, TStyle style=sBitmapText, TPopupType poptype=DownArrowAction, TType type=Command, bool enabled=false, TState state=Up, bool sharedGlyph=false, uint numChars=4)
 
void SetArrowWidth (uint width)
 
uint GetArrowWidth ()
 
void GetDesiredSize (TSize &size) override
 
void SetBounds (const TRect &rect) override
 
- Public Member Functions inherited from owl::TButtonTextGadget
 TButtonTextGadget (int id, TResId glyphResIdOrIndex, TStyle style=sBitmapText, TType type=Command, bool enabled=false, TState state=Up, bool sharedGlyph=false, uint numChars=4)
 Constructs a TButtonTextGadget object using the specified bitmap ID, button gadget ID, style, and type, with enabled set to false, in a button-up state, and reserved number chars in text = 4.
 
virtual ~TButtonTextGadget ()
 Destroys a TButtonTextGadget object.
 
LPCTSTR GetText () const
 Returns the text for the gadget.
 
void SetText (const tstring &text, bool repaint=true)
 Sets the text of the gadget.
 
void SetText (LPCTSTR s, bool repaint=true)
 
TStyle GetStyle () const
 Returns the Style for the gadget.
 
void SetStyle (const TStyle style, bool repaint=true)
 If the style stored in Style is not the same as the new style, SetStyle sets Style to the new style, and then if repaint is true calls Window->GadgetChangedSize(*this) to recalculate size of gadget.
 
TAlign GetAlign () const
 Returns the Align for the gadget.
 
void SetAlign (const TAlign align, bool repaint=true)
 If the align stored in Style is not the same as the new align, SetAlign sets Align to the new align, and then if repaint is true calls Invalidate to invalidate the rectangle.
 
TLayoutStyle GetLayoutStyle () const
 Returns the LayoutStyle for the gadget.
 
void SetLayoutStyle (const TLayoutStyle style, bool repaint=true)
 If the style stored in LayoutStyle is not the same as the new style, SetLayoutStyle sets LayoutStyle to the new style, and then if repaint is true calls Window->GadgetChangedSize(*this) to recalculate size of gadget.
 
const TFontGetFont () const
 Returns the effective font used to render the text for this gadget.
 
void SetFont (const TFont &, bool repaint=true)
 Sets the font to be used by the gadget.
 
virtual void CommandEnable ()
 Initiates a command enable for this button gadget.
 
- Public Member Functions inherited from 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.
 
 ~TButtonGadget () override
 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.
 
- 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  TPopFlags { ArrowPressed = 0x001 , HasCapture = 0x002 }
 
- Protected Types inherited from owl::TButtonGadget
enum  { CelNormal , CelDisabled , CelIndeterm , CelDown , CelPressed , CelsTotal }
 Glyph types and construction functions. More...
 

Protected Member Functions

void Paint (TDC &dc) override
 
void LButtonDown (uint modKeys, const TPoint &point) override
 
void LButtonUp (uint modKeys, const TPoint &point) override
 
void RButtonDown (uint modKeys, const TPoint &) override
 
void BeginPressed (const TPoint &p) override
 
void CancelPressed (const TPoint &p, bool mstate=false) override
 
virtual void PaintArrowButton (TDC &dc)
 
virtual void PaintArrow (TDC &dc, const TRect &rect)
 
virtual void PopupAction ()
 Start the PopupAction if the user click.
 
- Protected Member Functions inherited from owl::TButtonTextGadget
virtual void Created ()
 Calls TButtonGadget::Created and if Text == 0 and (Style & sText) retrieves text from menu or resource.
 
virtual void Layout (TRect &srcRect, TRect &textRect, TRect &btnRect)
 Layout button and text in the control area.
 
virtual void PaintText (TDC &dc, TRect &rect, const tstring &text)
 Paint Text.
 
virtual void SysColorChange ()
 Respond to a WM_SYSCOLORCHANGE, in this case to rebuild the CelArray with possibly new 3d colors.
 
void GetTextSize (TSize &size)
 
- Protected Member Functions inherited from owl::TButtonGadget
void PaintBorder (TDC &dc) override
 
void MouseEnter (uint modKeys, const TPoint &p) override
 Mouse has entered this button, (not pressed).
 
void MouseMove (uint modKeys, const TPoint &p) override
 Mouse has moved (back) into this gadget.
 
void MouseLeave (uint modKeys, const TPoint &p) override
 Mouse has left this button, (not pressed).
 
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 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 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 RButtonUp (uint modKeys, const TPoint &point)
 
void ChangeBorderStyle (TBorderStyle bs)
 Simply changes the border style without recalculating the gadget size.
 

Protected Attributes

TPopupType PopupType
 
uint PopFlags
 
uint ArrowWidth
 

Detailed Description

Definition at line 45 of file popupgad.h.

Member Enumeration Documentation

◆ TPopFlags

Enumerator
ArrowPressed 
HasCapture 

Definition at line 106 of file popupgad.h.

◆ TPopupType

Enumerator
Normal 

Normal button style.

  • press button -> PopupActionStart()
DownArrow 

Normal button style and additional a down arrow.

  • press button -> PopupActionStart()
DownArrowAction 

Separator between left area and down arrow.

  • press left button area -> Activate()
  • press down arrow area -> PopupActionStart()

Definition at line 47 of file popupgad.h.

Constructor & Destructor Documentation

◆ TPopupButtonGadget()

owl::TPopupButtonGadget::TPopupButtonGadget ( int id,
TResId glyphResIdOrIndex,
TStyle style = sBitmapText,
TPopupType poptype = DownArrowAction,
TType type = Command,
bool enabled = false,
TState state = Up,
bool sharedGlyph = false,
uint numChars = 4 )

Definition at line 94 of file popupgad.cpp.

Member Function Documentation

◆ BeginPressed()

◆ CancelPressed()

void owl::TPopupButtonGadget::CancelPressed ( const TPoint & p,
bool mstate = false )
overrideprotectedvirtual

Reimplemented from owl::TButtonGadget.

Definition at line 296 of file popupgad.cpp.

References owl::TButtonGadget::CancelPressed().

◆ GetArrowWidth()

uint owl::TPopupButtonGadget::GetArrowWidth ( )
inline

Definition at line 164 of file popupgad.h.

References ArrowWidth.

◆ GetDesiredSize()

void owl::TPopupButtonGadget::GetDesiredSize ( TSize & size)
overridevirtual

Reimplemented from owl::TButtonTextGadget.

Definition at line 110 of file popupgad.cpp.

References ArrowWidth, owl::TButtonTextGadget::GetDesiredSize(), Normal, and PopupType.

◆ LButtonDown()

void owl::TPopupButtonGadget::LButtonDown ( uint modKeys,
const TPoint & point )
overrideprotectedvirtual

Reimplemented from owl::TButtonGadget.

Definition at line 307 of file popupgad.cpp.

References HasCapture, owl::TButtonGadget::LButtonDown(), and PopFlags.

◆ LButtonUp()

void owl::TPopupButtonGadget::LButtonUp ( uint modKeys,
const TPoint & point )
overrideprotectedvirtual

Reimplemented from owl::TButtonGadget.

Definition at line 319 of file popupgad.cpp.

References owl::TButtonGadget::LButtonUp(), and PopFlags.

◆ Paint()

◆ PaintArrow()

◆ PaintArrowButton()

◆ PopupAction()

void owl::TPopupButtonGadget::PopupAction ( )
protectedvirtual

Start the PopupAction if the user click.

  • 1) into the button if PopupType != DownArrowAction
  • 2) into the arrow if PopupType == DownArrowAction This function only restore button state, overwrite them with functionality, but don't forget to call inherited one

Reimplemented in owl::TPickerGadget, and owl::TPopupMenuGadget.

Definition at line 348 of file popupgad.cpp.

References ArrowPressed, CancelPressed(), owl::TGadget::Invalidate(), PopFlags, and owl::TGadget::Update().

◆ RButtonDown()

void owl::TPopupButtonGadget::RButtonDown ( uint modKeys,
const TPoint &  )
overrideprotectedvirtual

◆ SetArrowWidth()

void owl::TPopupButtonGadget::SetArrowWidth ( uint width)
inline

Definition at line 157 of file popupgad.h.

References ArrowWidth.

◆ SetBounds()

void owl::TPopupButtonGadget::SetBounds ( const TRect & rect)
overridevirtual

Reimplemented from owl::TButtonTextGadget.

Definition at line 120 of file popupgad.cpp.

References ArrowWidth, and owl::TButtonTextGadget::SetBounds().

Member Data Documentation

◆ ArrowWidth

uint owl::TPopupButtonGadget::ArrowWidth
protected

Definition at line 112 of file popupgad.h.

◆ PopFlags

uint owl::TPopupButtonGadget::PopFlags
protected

Definition at line 111 of file popupgad.h.

◆ PopupType

TPopupType owl::TPopupButtonGadget::PopupType
protected

Definition at line 110 of file popupgad.h.


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