2014-12-24 01:32:05 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
2015-01-03 02:15:25 +03:00
|
|
|
* Adrien Destugues, pulkomandy@pulkomandy.ath.cx
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
2014-12-24 01:32:05 +03:00
|
|
|
* John Scipione, jscipione@gmail.com
|
|
|
|
*
|
|
|
|
* Corresponds to:
|
|
|
|
* headers/private/interface/ToolTip.h hrev48560
|
|
|
|
* src/kits/interface/ToolTip.cpp hrev48560
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file ToolTip.h
|
|
|
|
\ingroup interface
|
|
|
|
\ingroup libbe
|
|
|
|
\brief Provides the BToolTip class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BToolTip
|
|
|
|
\ingroup interface
|
|
|
|
\ingroup libbe
|
|
|
|
\brief Displays help text on hover.
|
|
|
|
|
2015-01-03 02:15:25 +03:00
|
|
|
\attention Use at your own risk! This class is private and may change
|
|
|
|
before release.
|
2014-12-24 01:32:05 +03:00
|
|
|
|
2015-01-03 02:15:25 +03:00
|
|
|
This class is for advanced uses of tool tips with custom contents or
|
|
|
|
behavior. The simple way to use tooltips is via BView::SetToolTip().
|
|
|
|
|
|
|
|
\since Haiku R1
|
2014-12-24 01:32:05 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BToolTip::BToolTip()
|
|
|
|
\brief Creates a new BToolTip object.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BToolTip::BToolTip(BMessage* archive)
|
|
|
|
\brief Creates a BToolTip object from the passed in \a archive.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BToolTip::~BToolTip()
|
|
|
|
\brief Frees the memory allocated and destroys the object.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BToolTip::Archive(BMessage* archive, bool deep) const
|
|
|
|
\brief Archives the object into the \a data message.
|
|
|
|
|
|
|
|
Saves the tool tip's sticky flag.
|
|
|
|
|
|
|
|
\param archive A pointer to the BMessage object to archive the object into.
|
|
|
|
\param deep Whether or not to archive child views as well.
|
|
|
|
|
|
|
|
\return A status code, \c B_OK if everything went well or an error code
|
|
|
|
otherwise.
|
|
|
|
\retval B_OK The object was archived.
|
|
|
|
\retval B_NO_MEMORY Ran out of memory while archiving the object.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BToolTip::SetSticky(bool enable)
|
2015-01-03 02:15:25 +03:00
|
|
|
\brief Turns sticky flag on or off which determines whether or not the
|
|
|
|
tool tip stays visible when the mouse moves.
|
2014-12-24 01:32:05 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BToolTip::IsSticky() const
|
|
|
|
\brief Returns whether or not the sticky flag is set.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BToolTip::SetMouseRelativeLocation(BPoint location)
|
|
|
|
\brief Set the location of the tooltip relative to the current mouse position.
|
|
|
|
|
2015-01-03 02:15:25 +03:00
|
|
|
The position is relative to the mouse cursor location at the time the
|
|
|
|
tool tip is shown. It should be as close as possible to the mouse cursor
|
|
|
|
without hiding important parts of the UI near the cursor while the parent
|
|
|
|
view remains visible and reachable.
|
|
|
|
|
2014-12-24 01:32:05 +03:00
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BPoint BToolTip::MouseRelativeLocation() const
|
|
|
|
\brief Returns the tool tip's relative mouse location.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BToolTip::SetAlignment(BAlignment alignment)
|
2015-01-03 02:15:25 +03:00
|
|
|
\brief Set the alignment of the tool tip which determines where the tool
|
|
|
|
tip should appear i.e. left or right from the current mouse cursor
|
|
|
|
position, etc.
|
2014-12-24 01:32:05 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BAlignment BToolTip::Alignment() const
|
|
|
|
\brief Returns the tool tip's alignment.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BToolTip::Lock()
|
2015-01-03 02:15:25 +03:00
|
|
|
\brief Allows derived classes to lock the tool tip while modifying it.
|
2014-12-24 01:32:05 +03:00
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BToolTip::Unlock()
|
|
|
|
\brief Allows derived classes to unlock the tool tip.
|
|
|
|
|
|
|
|
\since Haiku R1
|
|
|
|
*/
|