1d87c6913SJohn Scipione/* 2d87c6913SJohn Scipione * Copyright 2014 Haiku, Inc. All rights reserved. 3d87c6913SJohn Scipione * Distributed under the terms of the MIT License. 4d87c6913SJohn Scipione * 5d87c6913SJohn Scipione * Authors: 64536c603SJohn Scipione * Adrien Destugues, pulkomandy@pulkomandy.ath.cx 74536c603SJohn Scipione * Axel Dörfler, axeld@pinc-software.de 8d87c6913SJohn Scipione * John Scipione, jscipione@gmail.com 9d87c6913SJohn Scipione * 10d87c6913SJohn Scipione * Corresponds to: 11d87c6913SJohn Scipione * headers/private/interface/ToolTip.h hrev48560 12d87c6913SJohn Scipione * src/kits/interface/ToolTip.cpp hrev48560 13d87c6913SJohn Scipione */ 14d87c6913SJohn Scipione 15d87c6913SJohn Scipione 16*42dcaf37SNiels Sascha Reedijk//! \cond INTERNAL 17*42dcaf37SNiels Sascha Reedijk 18*42dcaf37SNiels Sascha Reedijk 19d87c6913SJohn Scipione/*! 20d87c6913SJohn Scipione \file ToolTip.h 21d87c6913SJohn Scipione \ingroup interface 22d87c6913SJohn Scipione \ingroup libbe 23d87c6913SJohn Scipione \brief Provides the BToolTip class. 24d87c6913SJohn Scipione*/ 25d87c6913SJohn Scipione 26d87c6913SJohn Scipione 27d87c6913SJohn Scipione/*! 28d87c6913SJohn Scipione \class BToolTip 29d87c6913SJohn Scipione \ingroup interface 30d87c6913SJohn Scipione \ingroup libbe 31d87c6913SJohn Scipione \brief Displays help text on hover. 32d87c6913SJohn Scipione 334536c603SJohn Scipione \attention Use at your own risk! This class is private and may change 344536c603SJohn Scipione before release. 35d87c6913SJohn Scipione 364536c603SJohn Scipione This class is for advanced uses of tool tips with custom contents or 374536c603SJohn Scipione behavior. The simple way to use tooltips is via BView::SetToolTip(). 384536c603SJohn Scipione 394536c603SJohn Scipione \since Haiku R1 40d87c6913SJohn Scipione*/ 41d87c6913SJohn Scipione 42d87c6913SJohn Scipione 43d87c6913SJohn Scipione/*! 44d87c6913SJohn Scipione \fn BToolTip::BToolTip() 45d87c6913SJohn Scipione \brief Creates a new BToolTip object. 46d87c6913SJohn Scipione 47d87c6913SJohn Scipione \since Haiku R1 48d87c6913SJohn Scipione*/ 49d87c6913SJohn Scipione 50d87c6913SJohn Scipione 51d87c6913SJohn Scipione/*! 52d87c6913SJohn Scipione \fn BToolTip::BToolTip(BMessage* archive) 53d87c6913SJohn Scipione \brief Creates a BToolTip object from the passed in \a archive. 54d87c6913SJohn Scipione 55d87c6913SJohn Scipione \since Haiku R1 56d87c6913SJohn Scipione*/ 57d87c6913SJohn Scipione 58d87c6913SJohn Scipione 59d87c6913SJohn Scipione/*! 60d87c6913SJohn Scipione \fn BToolTip::~BToolTip() 61d87c6913SJohn Scipione \brief Frees the memory allocated and destroys the object. 62d87c6913SJohn Scipione 63d87c6913SJohn Scipione \since Haiku R1 64d87c6913SJohn Scipione*/ 65d87c6913SJohn Scipione 66d87c6913SJohn Scipione 67d87c6913SJohn Scipione/*! 68d87c6913SJohn Scipione \fn status_t BToolTip::Archive(BMessage* archive, bool deep) const 69d87c6913SJohn Scipione \brief Archives the object into the \a data message. 70d87c6913SJohn Scipione 71d87c6913SJohn Scipione Saves the tool tip's sticky flag. 72d87c6913SJohn Scipione 73d87c6913SJohn Scipione \param archive A pointer to the BMessage object to archive the object into. 74d87c6913SJohn Scipione \param deep Whether or not to archive child views as well. 75d87c6913SJohn Scipione 76d87c6913SJohn Scipione \return A status code, \c B_OK if everything went well or an error code 77d87c6913SJohn Scipione otherwise. 78d87c6913SJohn Scipione \retval B_OK The object was archived. 79d87c6913SJohn Scipione \retval B_NO_MEMORY Ran out of memory while archiving the object. 80d87c6913SJohn Scipione 81d87c6913SJohn Scipione \since Haiku R1 82d87c6913SJohn Scipione*/ 83d87c6913SJohn Scipione 84d87c6913SJohn Scipione 85d87c6913SJohn Scipione/*! 86d87c6913SJohn Scipione \fn void BToolTip::SetSticky(bool enable) 874536c603SJohn Scipione \brief Turns sticky flag on or off which determines whether or not the 884536c603SJohn Scipione tool tip stays visible when the mouse moves. 89d87c6913SJohn Scipione 90d87c6913SJohn Scipione \since Haiku R1 91d87c6913SJohn Scipione*/ 92d87c6913SJohn Scipione 93d87c6913SJohn Scipione 94d87c6913SJohn Scipione/*! 95d87c6913SJohn Scipione \fn bool BToolTip::IsSticky() const 96d87c6913SJohn Scipione \brief Returns whether or not the sticky flag is set. 97d87c6913SJohn Scipione 98d87c6913SJohn Scipione \since Haiku R1 99d87c6913SJohn Scipione*/ 100d87c6913SJohn Scipione 101d87c6913SJohn Scipione 102d87c6913SJohn Scipione/*! 103d87c6913SJohn Scipione \fn void BToolTip::SetMouseRelativeLocation(BPoint location) 104d87c6913SJohn Scipione \brief Set the location of the tooltip relative to the current mouse position. 105d87c6913SJohn Scipione 1064536c603SJohn Scipione The position is relative to the mouse cursor location at the time the 1074536c603SJohn Scipione tool tip is shown. It should be as close as possible to the mouse cursor 1084536c603SJohn Scipione without hiding important parts of the UI near the cursor while the parent 1094536c603SJohn Scipione view remains visible and reachable. 1104536c603SJohn Scipione 111d87c6913SJohn Scipione \since Haiku R1 112d87c6913SJohn Scipione*/ 113d87c6913SJohn Scipione 114d87c6913SJohn Scipione 115d87c6913SJohn Scipione/*! 116d87c6913SJohn Scipione \fn BPoint BToolTip::MouseRelativeLocation() const 117d87c6913SJohn Scipione \brief Returns the tool tip's relative mouse location. 118d87c6913SJohn Scipione 119d87c6913SJohn Scipione \since Haiku R1 120d87c6913SJohn Scipione*/ 121d87c6913SJohn Scipione 122d87c6913SJohn Scipione 123d87c6913SJohn Scipione/*! 124d87c6913SJohn Scipione \fn void BToolTip::SetAlignment(BAlignment alignment) 1254536c603SJohn Scipione \brief Set the alignment of the tool tip which determines where the tool 1264536c603SJohn Scipione tip should appear i.e. left or right from the current mouse cursor 1274536c603SJohn Scipione position, etc. 128d87c6913SJohn Scipione 129d87c6913SJohn Scipione \since Haiku R1 130d87c6913SJohn Scipione*/ 131d87c6913SJohn Scipione 132d87c6913SJohn Scipione 133d87c6913SJohn Scipione/*! 134d87c6913SJohn Scipione \fn BAlignment BToolTip::Alignment() const 135d87c6913SJohn Scipione \brief Returns the tool tip's alignment. 136d87c6913SJohn Scipione 137d87c6913SJohn Scipione \since Haiku R1 138d87c6913SJohn Scipione*/ 139d87c6913SJohn Scipione 140d87c6913SJohn Scipione 141d87c6913SJohn Scipione/*! 142d87c6913SJohn Scipione \fn bool BToolTip::Lock() 1434536c603SJohn Scipione \brief Allows derived classes to lock the tool tip while modifying it. 144d87c6913SJohn Scipione 145d87c6913SJohn Scipione \since Haiku R1 146d87c6913SJohn Scipione*/ 147d87c6913SJohn Scipione 148d87c6913SJohn Scipione 149d87c6913SJohn Scipione/*! 150d87c6913SJohn Scipione \fn void BToolTip::Unlock() 151d87c6913SJohn Scipione \brief Allows derived classes to unlock the tool tip. 152d87c6913SJohn Scipione 153d87c6913SJohn Scipione \since Haiku R1 154d87c6913SJohn Scipione*/ 155*42dcaf37SNiels Sascha Reedijk 156*42dcaf37SNiels Sascha Reedijk 157*42dcaf37SNiels Sascha Reedijk/*! 158*42dcaf37SNiels Sascha Reedijk \fn virtual void BToolTip::AttachedToWindow() 159*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 160*42dcaf37SNiels Sascha Reedijk 161*42dcaf37SNiels Sascha Reedijk \since Haiku R1 162*42dcaf37SNiels Sascha Reedijk*/ 163*42dcaf37SNiels Sascha Reedijk 164*42dcaf37SNiels Sascha Reedijk 165*42dcaf37SNiels Sascha Reedijk/*! 166*42dcaf37SNiels Sascha Reedijk \fn virtual void BToolTip::DetachedFromWindow() 167*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 168*42dcaf37SNiels Sascha Reedijk 169*42dcaf37SNiels Sascha Reedijk \since Haiku R1 170*42dcaf37SNiels Sascha Reedijk*/ 171*42dcaf37SNiels Sascha Reedijk 172*42dcaf37SNiels Sascha Reedijk 173*42dcaf37SNiels Sascha Reedijk/*! 174*42dcaf37SNiels Sascha Reedijk \fn virtual BView* BToolTip::View() const =0 175*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 176*42dcaf37SNiels Sascha Reedijk 177*42dcaf37SNiels Sascha Reedijk \return Undocumented 178*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 179*42dcaf37SNiels Sascha Reedijk 180*42dcaf37SNiels Sascha Reedijk \since Haiku R1 181*42dcaf37SNiels Sascha Reedijk*/ 182*42dcaf37SNiels Sascha Reedijk 183*42dcaf37SNiels Sascha Reedijk 184*42dcaf37SNiels Sascha Reedijk/*! 185*42dcaf37SNiels Sascha Reedijk \class BTextToolTip 186*42dcaf37SNiels Sascha Reedijk \ingroup interface 187*42dcaf37SNiels Sascha Reedijk \ingroup libbe 188*42dcaf37SNiels Sascha Reedijk \brief Undocumented class. 189*42dcaf37SNiels Sascha Reedijk 190*42dcaf37SNiels Sascha Reedijk \since Haiku R1 191*42dcaf37SNiels Sascha Reedijk*/ 192*42dcaf37SNiels Sascha Reedijk 193*42dcaf37SNiels Sascha Reedijk 194*42dcaf37SNiels Sascha Reedijk/*! 195*42dcaf37SNiels Sascha Reedijk \fn BTextToolTip::BTextToolTip(BMessage *archive) 196*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 197*42dcaf37SNiels Sascha Reedijk 198*42dcaf37SNiels Sascha Reedijk \param archive Undocumented 199*42dcaf37SNiels Sascha Reedijk 200*42dcaf37SNiels Sascha Reedijk \return Undocumented 201*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 202*42dcaf37SNiels Sascha Reedijk 203*42dcaf37SNiels Sascha Reedijk \since Haiku R1 204*42dcaf37SNiels Sascha Reedijk*/ 205*42dcaf37SNiels Sascha Reedijk 206*42dcaf37SNiels Sascha Reedijk 207*42dcaf37SNiels Sascha Reedijk/*! 208*42dcaf37SNiels Sascha Reedijk \fn BTextToolTip::BTextToolTip(const char *text) 209*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 210*42dcaf37SNiels Sascha Reedijk 211*42dcaf37SNiels Sascha Reedijk \param text Undocumented 212*42dcaf37SNiels Sascha Reedijk 213*42dcaf37SNiels Sascha Reedijk \return Undocumented 214*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 215*42dcaf37SNiels Sascha Reedijk 216*42dcaf37SNiels Sascha Reedijk \since Haiku R1 217*42dcaf37SNiels Sascha Reedijk*/ 218*42dcaf37SNiels Sascha Reedijk 219*42dcaf37SNiels Sascha Reedijk 220*42dcaf37SNiels Sascha Reedijk/*! 221*42dcaf37SNiels Sascha Reedijk \fn virtual BTextToolTip::~BTextToolTip() 222*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 223*42dcaf37SNiels Sascha Reedijk 224*42dcaf37SNiels Sascha Reedijk \return Undocumented 225*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 226*42dcaf37SNiels Sascha Reedijk 227*42dcaf37SNiels Sascha Reedijk \since Haiku R1 228*42dcaf37SNiels Sascha Reedijk*/ 229*42dcaf37SNiels Sascha Reedijk 230*42dcaf37SNiels Sascha Reedijk 231*42dcaf37SNiels Sascha Reedijk/*! 232*42dcaf37SNiels Sascha Reedijk \fn void BTextToolTip::SetText(const char *text) 233*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 234*42dcaf37SNiels Sascha Reedijk 235*42dcaf37SNiels Sascha Reedijk \param text Undocumented 236*42dcaf37SNiels Sascha Reedijk 237*42dcaf37SNiels Sascha Reedijk \since Haiku R1 238*42dcaf37SNiels Sascha Reedijk*/ 239*42dcaf37SNiels Sascha Reedijk 240*42dcaf37SNiels Sascha Reedijk 241*42dcaf37SNiels Sascha Reedijk/*! 242*42dcaf37SNiels Sascha Reedijk \fn const char* BTextToolTip::Text() const 243*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 244*42dcaf37SNiels Sascha Reedijk 245*42dcaf37SNiels Sascha Reedijk \return Undocumented 246*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 247*42dcaf37SNiels Sascha Reedijk 248*42dcaf37SNiels Sascha Reedijk \since Haiku R1 249*42dcaf37SNiels Sascha Reedijk*/ 250*42dcaf37SNiels Sascha Reedijk 251*42dcaf37SNiels Sascha Reedijk 252*42dcaf37SNiels Sascha Reedijk/*! 253*42dcaf37SNiels Sascha Reedijk \fn virtual BView* BTextToolTip::View() const 254*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 255*42dcaf37SNiels Sascha Reedijk 256*42dcaf37SNiels Sascha Reedijk \return Undocumented 257*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 258*42dcaf37SNiels Sascha Reedijk 259*42dcaf37SNiels Sascha Reedijk \since Haiku R1 260*42dcaf37SNiels Sascha Reedijk*/ 261*42dcaf37SNiels Sascha Reedijk 262*42dcaf37SNiels Sascha Reedijk 263*42dcaf37SNiels Sascha Reedijk/*! 264*42dcaf37SNiels Sascha Reedijk \fn static BTextToolTip* BTextToolTip::Instantiate(BMessage *archive) 265*42dcaf37SNiels Sascha Reedijk \brief Undocumented public method 266*42dcaf37SNiels Sascha Reedijk 267*42dcaf37SNiels Sascha Reedijk \param archive Undocumented 268*42dcaf37SNiels Sascha Reedijk 269*42dcaf37SNiels Sascha Reedijk \return Undocumented 270*42dcaf37SNiels Sascha Reedijk \retval <value> Undocumented 271*42dcaf37SNiels Sascha Reedijk 272*42dcaf37SNiels Sascha Reedijk \since Haiku R1 273*42dcaf37SNiels Sascha Reedijk*/ 274*42dcaf37SNiels Sascha Reedijk 275*42dcaf37SNiels Sascha Reedijk 276*42dcaf37SNiels Sascha Reedijk//! \endcond INTERNAL 277