#include <arstooltip.h>
Inheritance diagram for Ars::XToolTip:


Public Member Functions | |
| XToolTip (Window *pToolWindow, const int aNrMSec=1000) | |
| virtual | ~XToolTip (void) |
| Standard destructor. | |
| virtual const bool | SetupWindow (const Message &msg) |
| Deregister the setup_window message. | |
| virtual void | SetWndText (const std::string &sText) |
| void | ShowTip (const XPoint &DrawPoint) |
| void | HideTip (void) |
| Hides the tooltip. | |
| virtual const bool | SetParent (Window *pNewParent) |
| virtual Window * | GetParent (void) const |
Protected Member Functions | |
| virtual const bool | evMouseMove (const MouseMessage &msg) |
| virtual const bool | evTimer (const CtrlMessage &msg) |
Private Attributes | |
| Timer * | timer |
| A pointer to a timer so that tooltips only appear after the mouse has been motionless for a bit. | |
| XPoint | lastMousePosition |
| The last mouse position. | |
| Window * | target |
| const int | nrMSec |
Definition at line 9 of file arstooltip.h.
|
||||||||||||
|
Construct a new label
Definition at line 5 of file arstooltip.cpp. References SetParent(), and timer.
|
|
|
Standard destructor.
Definition at line 13 of file arstooltip.cpp. References timer.
|
|
|
Reimplemented from Ars::XLabel. Definition at line 70 of file arstooltip.cpp. References Ars::Window::FindWindow(), Ars::Window::GetParent(), GetParent(), HideTip(), Ars::Window::IsVisible(), lastMousePosition, nrMSec, Ars::MouseMessage::Point, Ars::Timer::StartTimer(), Ars::Timer::StopTimer(), and timer.
00071 {
00072 if( GetParent()->GetParent() )
00073 {
00074 lastMousePosition = msg.Point;
00075 timer->StopTimer();
00076 if( IsVisible() )
00077 HideTip();
00078
00079 if( GetParent()->FindWindow( &msg.Point ) == GetParent() )
00080 timer->StartTimer( nrMSec );
00081 }
00082 return XLabel::evMouseMove( msg );
00083 }
|
|
|
Reimplemented from Ars::MessageClient. Definition at line 58 of file arstooltip.cpp. References Ars::Message::Destination(), lastMousePosition, and ShowTip().
00059 {
00060 bool ans = XLabel::evTimer( msg );
00061
00062 if( msg.Destination() == this )
00063 {
00064 ShowTip( lastMousePosition + XPoint( -6 , 18 ) );
00065 ans = true;
00066 }
00067 return ans;
00068 }
|
|
|
Reimplemented from Ars::Window. Definition at line 41 of file arstooltip.h. References target. Referenced by evMouseMove(), and ShowTip().
00041 { return target; }
|
|
|
Hides the tooltip.
Definition at line 52 of file arstooltip.cpp. References Ars::Window::HideWindow(), and Ars::Window::UpdateWindow(). Referenced by evMouseMove(), and SetupWindow().
00053 {
00054 HideWindow();
00055 UpdateWindow( true );
00056 }
|
|
|
Transfer the ownership of the window, so it has a new parent
Reimplemented from Ars::Window. Definition at line 40 of file arstooltip.h. References target. Referenced by XToolTip().
00040 { target = pNewParent; return true; }
|
|
|
Deregister the setup_window message.
Reimplemented from Ars::XLabel. Definition at line 20 of file arstooltip.cpp. References HideTip(). Referenced by Ars::Window::SetupWindow().
00021 {
00022 XLabel::SetupWindow( msg );
00023
00024 MessageServer::Instance().RegisterMessageClient(this, Message::MOUSE_MOVE);
00025 MessageServer::Instance().RegisterMessageClient(this, Message::CTRL_TIMER);
00026
00027 HideTip();
00028
00029 return true;
00030 }
|
|
|
Set the WindowText of the control
Reimplemented from Ars::XLabel. Definition at line 32 of file arstooltip.cpp. References Ars::Window::clientRect, Ars::HPaint::GetFontSize(), Ars::HPaint::GetTextSize(), Ars::Window::GetWindowText(), Ars::XPoint::x, and Ars::XPoint::y.
00033 {
00034 XLabel::SetWndText( sText );
00035 XPoint p = GetTextSize( GetWindowText() );
00036 clientRect.w = w = p.x + 4;
00037 clientRect.h = h = p.y + GetFontSize();
00038 }
|
|
|
Displays the tooltip
Definition at line 40 of file arstooltip.cpp. References GetParent(), Ars::Window::IsVisible(), Ars::Window::ShowWindow(), Ars::Window::UpdateWindow(), Ars::XPoint::x, and Ars::XPoint::y. Referenced by evTimer().
00041 {
00042 if( GetParent()->IsVisible() )
00043 {
00044 x = p.x;
00045 y = p.y;
00046 ShowWindow();
00047 UpdateWindow( true );
00048 }
00049 }
|
|
|
The last mouse position.
Definition at line 13 of file arstooltip.h. Referenced by evMouseMove(), and evTimer(). |
|
|
Definition at line 15 of file arstooltip.h. Referenced by evMouseMove(). |
|
|
Definition at line 14 of file arstooltip.h. Referenced by GetParent(), and SetParent(). |
|
|
A pointer to a timer so that tooltips only appear after the mouse has been motionless for a bit.
Definition at line 12 of file arstooltip.h. Referenced by evMouseMove(), XToolTip(), and ~XToolTip(). |
1.3.3