Refactor ToolTipManager a bit.
* Change ShowTip() point parameter name to where. * Add a parameterless ResetWindowFrame() overload that get's the current where and calls ResetWindowFrame(BPoint where) which does the actual work. FrameResized() calls this parameterless ResetWindowFrame() method instead of doing the work in that method. This is functionaly the same but allows me to call the parameterless ResetWindowFrame() elsewhere.
This commit is contained in:
@@ -18,7 +18,7 @@ class BToolTipManager {
|
|||||||
public:
|
public:
|
||||||
static BToolTipManager* Manager();
|
static BToolTipManager* Manager();
|
||||||
|
|
||||||
void ShowTip(BToolTip* tip, BPoint point,
|
void ShowTip(BToolTip* tip, BPoint where,
|
||||||
void* owner);
|
void* owner);
|
||||||
void HideTip();
|
void HideTip();
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ public:
|
|||||||
|
|
||||||
void HideTip();
|
void HideTip();
|
||||||
void ShowTip();
|
void ShowTip();
|
||||||
|
|
||||||
|
void ResetWindowFrame();
|
||||||
void ResetWindowFrame(BPoint where);
|
void ResetWindowFrame(BPoint where);
|
||||||
|
|
||||||
BToolTip* Tip() const { return fToolTip; }
|
BToolTip* Tip() const { return fToolTip; }
|
||||||
@@ -105,10 +107,7 @@ ToolTipView::DetachedFromWindow()
|
|||||||
void
|
void
|
||||||
ToolTipView::FrameResized(float width, float height)
|
ToolTipView::FrameResized(float width, float height)
|
||||||
{
|
{
|
||||||
BPoint where;
|
ResetWindowFrame();
|
||||||
GetMouse(&where, NULL, false);
|
|
||||||
|
|
||||||
ResetWindowFrame(ConvertToScreen(where));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -156,6 +155,16 @@ ToolTipView::ShowTip()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ToolTipView::ResetWindowFrame()
|
||||||
|
{
|
||||||
|
BPoint where;
|
||||||
|
GetMouse(&where, NULL, false);
|
||||||
|
|
||||||
|
ResetWindowFrame(ConvertToScreen(where));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Tries to find the right frame to show the tool tip in, trying to use the
|
/*! Tries to find the right frame to show the tool tip in, trying to use the
|
||||||
alignment that the tool tip specifies.
|
alignment that the tool tip specifies.
|
||||||
Makes sure the tool tip can be shown on screen in its entirety, ie. it will
|
Makes sure the tool tip can be shown on screen in its entirety, ie. it will
|
||||||
@@ -366,7 +375,7 @@ BToolTipManager::Manager()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BToolTipManager::ShowTip(BToolTip* tip, BPoint point, void* owner)
|
BToolTipManager::ShowTip(BToolTip* tip, BPoint where, void* owner)
|
||||||
{
|
{
|
||||||
BToolTip* current = NULL;
|
BToolTip* current = NULL;
|
||||||
void* currentOwner = NULL;
|
void* currentOwner = NULL;
|
||||||
@@ -388,7 +397,7 @@ BToolTipManager::ShowTip(BToolTip* tip, BPoint point, void* owner)
|
|||||||
fWindow.SendMessage(kMsgHideToolTip);
|
fWindow.SendMessage(kMsgHideToolTip);
|
||||||
|
|
||||||
if (tip != NULL) {
|
if (tip != NULL) {
|
||||||
BWindow* window = new BPrivate::ToolTipWindow(tip, point, owner);
|
BWindow* window = new BPrivate::ToolTipWindow(tip, where, owner);
|
||||||
window->Show();
|
window->Show();
|
||||||
|
|
||||||
fWindow = BMessenger(window);
|
fWindow = BMessenger(window);
|
||||||
|
|||||||
Reference in New Issue
Block a user