Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Pusher

 

class Pusher : public Ctrl

Pusher is a base class for classes that perform simple action when clicked by mouse or by some keyboard interface (usually access key). Pusher handles all mouse input and checks whether keyboard events match Pusher's access key, however keyboard input can be also processed by derived classes and projected into Pusher's state by its methods (KeyPush, FinishPush). Accelerator key for Pusher is assigned either through the label (using '&' or '\b', see LabelBase).

When Pusher is pushed and mouse is then released while hovering over pusher, PerformAction virtual method is invoked and its standard implementation invokes in turn WhenAction callback. Other than that, WhenPush and WhenRepeat callbacks are available.

 

Derived from Ctrl

 

 

Constructor Detail

 

Pusher()

Initializes Pusher. Font is sent to standard GUI font, accelerator key is cleared.

 


 

~Pusher()

Default destructor.

 

 

Protected Field List

 

byte accesskey

Access key assigned to the Pusher.

 


 

String label

Text assigned to the Pusher.

 


 

Font font

Font assigned to the Pusher.

 

 

Protected Member List

 

void KeyPush()

This method puts Pusher into "pushed by keyboard" state. It should be used as reaction to accelerator key by derived class.

 


 

bool IsPush() const

Return value

true when in pushed state.

 


 

bool IsKeyPush()

Return value

true when in pushed state initiated by keyboard.

 


 

bool FinishPush()

Forces end of pushed state and invokes PerformAction method (default implementation invokes standard WhenAction callback).

 


 

virtual void RefreshPush()

This method should refresh part of concrete derived Pusher class that is being graphically changed as reaction to push state. Default implementation calls Refresh, however some classes (like Option) overload this to minimize repaint area size.

 


 

virtual void RefreshFocus()

This method should refresh part of concrete derived Pusher class that is being graphically changed as reaction to change of input focus. Default implementation calls Refresh, however some classes (like Option) overload this to minimize repaint area size.

 


 

virtual void PerformAction()

This method is called when "push" is finished. Default implementation invokes WhenAction.

 

 

Public Member List

 

Pusher& SetFont(Font fnt)

Sets the font that should be used in painting the concrete derived Pusher class. Pusher itself does not use this font anywhere, but most derived classes do.

fnt

Font.

Return value

*this for method chaining.

 


 

Pusher& SetLabel(const char *text)

Sets the text of pusher. Pusher itself does not use this font anywhere, but most derived classes do. Text can contain '&' or '\b' characters to define access keys.

text

new text

Return value

*this for method chaining.

 


 

void PseudoPush()

Invokes "push emulation". Pusher will animate through states as if it would be pushed by the user, including calls to PerformAction (WhenAction), WhenPush and WhenRepeat.

 


 

Callback WhenPush

This callback is invoked when pusher goes from "unpushed" to "pushed" state.

 


 

Callback WhenRepeat

"Pusher autorepeat" - this callback is periodically invoked when user holds mouse button over Pusher - it emulates keyboard autorepeat (e.g. arrow buttons in scrollbar).

 


 

virtual Pusher& ClickFocus(bool cf = true)

If cf is true, Pusher will get focused on a mouse click.

cf

click focusing

Return value

*this for method chaining.

 


 

Pusher& NoClickFocus()

Same as ClickFocus(false).

 


 

bool IsClickFocus() const

Retrieves the value of ClickFocus.

 


 

Font GetFont() const

Returns the font that should be used in painting the concrete derived Pusher class. Pusher itself does not use this font anywhere, but most derived classes do.

 


 

String GetLabel() const

Returns the text of pusher. Pusher itself does not use this font anywhere, but most derived classes do. Text can contain '&' or '\b' characters to define access keys.

 


 

int GetVisualState() const

Returns the current visual state of the current pusher:

CTRL_NORMAL

pusher is enabled and not interacting with mouse

CTRL_HOT

pusher is enabled and under the mouse cursor

CTRL_PRESSED

pusher is enabled and pressed

CTRL_DISABLED

pusher is disabled

 

 

Last edit by cxl on 12/02/2017. Do you want to contribute?. T++