Public Member Functions

BubbleMessageComponent Class Reference

A speech-bubble component that displays a short message. More...

Inherits BubbleComponent, and Timer.

List of all members.

Public Member Functions

 BubbleMessageComponent (int fadeOutLengthMs=150)
 Creates a bubble component.
 ~BubbleMessageComponent ()
 Destructor.
void showAt (int x, int y, const String &message, int numMillisecondsBeforeRemoving, bool removeWhenMouseClicked=true, bool deleteSelfAfterUse=false)
 Shows a message bubble at a particular position.
void showAt (Component *component, const String &message, int numMillisecondsBeforeRemoving, bool removeWhenMouseClicked=true, bool deleteSelfAfterUse=false)
 Shows a message bubble next to a particular component.
void getContentSize (int &w, int &h)
 Subclasses should override this to return the size of the content they want to draw inside the bubble.
void paintContent (Graphics &g, int w, int h)
 Subclasses should override this to draw their bubble's contents.
void timerCallback ()
 The user-defined callback routine that actually gets called periodically.

Detailed Description

A speech-bubble component that displays a short message.

This can be used to show a message with the tail of the speech bubble pointing to a particular component or location on the screen.

See also:
BubbleComponent

Constructor & Destructor Documentation

BubbleMessageComponent::BubbleMessageComponent ( int  fadeOutLengthMs = 150 )

Creates a bubble component.

After creating one a BubbleComponent, do the following:

  • add it to an appropriate parent component, or put it on the desktop with Component::addToDesktop (0).
  • use the showAt() method to show a message.
  • it will make itself invisible after it times-out (and can optionally also delete itself), or you can reuse it somewhere else by calling showAt() again.
BubbleMessageComponent::~BubbleMessageComponent (  )

Destructor.


Member Function Documentation

void BubbleMessageComponent::showAt ( int  x,
int  y,
const String message,
int  numMillisecondsBeforeRemoving,
bool  removeWhenMouseClicked = true,
bool  deleteSelfAfterUse = false 
)

Shows a message bubble at a particular position.

This shows the bubble with its stem pointing to the given location (co-ordinates being relative to its parent component).

For details about exactly how it decides where to position itself, see BubbleComponent::updatePosition().

Parameters:
xthe x co-ordinate of end of the bubble's tail
ythe y co-ordinate of end of the bubble's tail
messagethe text to display
numMillisecondsBeforeRemovinghow long to leave it on the screen before removing itself from its parent compnent. If this is 0 or less, it will stay there until manually removed.
removeWhenMouseClickedif this is true, the bubble will disappear as soon as a mouse button is pressed (anywhere on the screen)
deleteSelfAfterUseif true, then the component will delete itself after it becomes invisible
void BubbleMessageComponent::showAt ( Component component,
const String message,
int  numMillisecondsBeforeRemoving,
bool  removeWhenMouseClicked = true,
bool  deleteSelfAfterUse = false 
)

Shows a message bubble next to a particular component.

This shows the bubble with its stem pointing at the given component.

For details about exactly how it decides where to position itself, see BubbleComponent::updatePosition().

Parameters:
componentthe component that you want to point at
messagethe text to display
numMillisecondsBeforeRemovinghow long to leave it on the screen before removing itself from its parent compnent. If this is 0 or less, it will stay there until manually removed.
removeWhenMouseClickedif this is true, the bubble will disappear as soon as a mouse button is pressed (anywhere on the screen)
deleteSelfAfterUseif true, then the component will delete itself after it becomes invisible
void BubbleMessageComponent::getContentSize ( int &  width,
int &  height 
) [virtual]

Subclasses should override this to return the size of the content they want to draw inside the bubble.

Implements BubbleComponent.

void BubbleMessageComponent::paintContent ( Graphics g,
int  width,
int  height 
) [virtual]

Subclasses should override this to draw their bubble's contents.

The graphics object's clip region and the dimensions passed in here are set up to paint just the rectangle inside the bubble.

Implements BubbleComponent.

void BubbleMessageComponent::timerCallback (  ) [virtual]

The user-defined callback routine that actually gets called periodically.

It's perfectly ok to call startTimer() or stopTimer() from within this callback to change the subsequent intervals.

Implements Timer.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines