mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Changes from 4.5 to support new tooltips that don't go away when you move between two areas that desire a tooltip.
This commit is contained in:
parent
de51048b30
commit
eb3235d924
@ -84,8 +84,25 @@ void CMouseDispatcher::ExecuteSelf(
|
||||
SMouseTrackParms theMouseParms;
|
||||
theMouseParms.portMouse = thePortMouse;
|
||||
theMouseParms.macEvent = *theEvent;
|
||||
theMouseParms.paneOfAttachment = nil; // will be changed by an attachment to show it's there.
|
||||
|
||||
if (theCurrentPane != theLastPane)
|
||||
// At this point, even if theCurrentPane and theLastPane are different, it
|
||||
// might be because theCurrentPane is a tooltip pane, put there by the
|
||||
// attachment. This is no reason for doing "mouse left" processing.
|
||||
// Use theLastPane instead.
|
||||
if (theCurrentPane != theLastPane
|
||||
&& theLastPane && theLastPane->Contains(thePortMouse.h, thePortMouse.v))
|
||||
{
|
||||
if (theLastPane->ExecuteAttachments(msg_MouseWithin, &theMouseParms)
|
||||
&& theMouseParms.paneOfAttachment == theCurrentPane)
|
||||
{
|
||||
theLastPane->MouseWithin(thePortMouse, *theEvent);
|
||||
if (theCurrentPane != nil) // see explanation below.
|
||||
theCurrentPane = FindPaneHitBy(theEvent->where);
|
||||
}
|
||||
}
|
||||
if ((!theCurrentPane || theMouseParms.paneOfAttachment != theCurrentPane)
|
||||
&& theCurrentPane != theLastPane)
|
||||
{
|
||||
if (theLastPane != nil)
|
||||
{
|
||||
@ -126,7 +143,8 @@ void CMouseDispatcher::ExecuteSelf(
|
||||
CMouseTrackAttachment::CMouseTrackAttachment()
|
||||
: LAttachment(msg_AnyMessage)
|
||||
, mOwningPane(nil)
|
||||
, mMustBeActive(true)
|
||||
, mPaneMustBeActive(true)
|
||||
, mWindowMustBeActive(true)
|
||||
, mMustBeEnabled(true)
|
||||
{
|
||||
SetExecuteHost(true);
|
||||
@ -139,7 +157,8 @@ CMouseTrackAttachment::CMouseTrackAttachment()
|
||||
CMouseTrackAttachment::CMouseTrackAttachment(LStream* inStream)
|
||||
: LAttachment(inStream)
|
||||
, mOwningPane(nil)
|
||||
, mMustBeActive(true)
|
||||
, mPaneMustBeActive(true)
|
||||
, mWindowMustBeActive(true)
|
||||
, mMustBeEnabled(true)
|
||||
{
|
||||
}
|
||||
@ -154,7 +173,19 @@ Boolean CMouseTrackAttachment::EnsureOwningPane()
|
||||
{
|
||||
mOwningPane = dynamic_cast<LPane*>(GetOwnerHost());
|
||||
Assert_(mOwningPane); // you didn't attach to an LPane* derivative
|
||||
if (!mOwningPane)
|
||||
}
|
||||
if (!mOwningPane)
|
||||
return false;
|
||||
if (mMustBeEnabled && !mOwningPane->IsEnabled())
|
||||
return false;
|
||||
if (mPaneMustBeActive && !mOwningPane->IsActive())
|
||||
return false;
|
||||
if (mWindowMustBeActive)
|
||||
{
|
||||
LWindow* win
|
||||
= dynamic_cast<LWindow*>(
|
||||
LWindow::FetchWindowObject(mOwningPane->GetMacPort()));
|
||||
if (!win || !win->IsActive())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -172,23 +203,19 @@ void CMouseTrackAttachment::ExecuteSelf(
|
||||
|
||||
if (!EnsureOwningPane())
|
||||
return;
|
||||
|
||||
if (mMustBeEnabled && !mOwningPane->IsEnabled())
|
||||
return;
|
||||
|
||||
if (mMustBeActive && !mOwningPane->IsActive())
|
||||
return;
|
||||
|
||||
switch (inMessage)
|
||||
{
|
||||
case msg_MouseEntered:
|
||||
Assert_(theTrackParms != nil);
|
||||
MouseEnter(theTrackParms->portMouse, theTrackParms->macEvent);
|
||||
if ( theTrackParms )
|
||||
MouseEnter(theTrackParms->portMouse, theTrackParms->macEvent);
|
||||
break;
|
||||
|
||||
case msg_MouseWithin:
|
||||
Assert_(theTrackParms != nil);
|
||||
MouseWithin(theTrackParms->portMouse, theTrackParms->macEvent);
|
||||
if ( theTrackParms )
|
||||
MouseWithin(theTrackParms->portMouse, theTrackParms->macEvent);
|
||||
break;
|
||||
|
||||
case msg_MouseLeft:
|
||||
@ -197,4 +224,3 @@ void CMouseTrackAttachment::ExecuteSelf(
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ const MessageT msg_MouseLeft = 'MsLt';
|
||||
typedef struct SMouseTrackParms {
|
||||
Point portMouse;
|
||||
EventRecord macEvent;
|
||||
LPane* paneOfAttachment;
|
||||
} SMouseTrackParms;
|
||||
|
||||
|
||||
@ -76,12 +77,14 @@ class CMouseTrackAttachment : public LAttachment
|
||||
Point inPortPt,
|
||||
const EventRecord& inMacEvent) = 0;
|
||||
|
||||
virtual void MouseLeave(void) = 0;
|
||||
virtual void MouseLeave() = 0;
|
||||
|
||||
Boolean EnsureOwningPane();
|
||||
|
||||
public:
|
||||
LPane* mOwningPane;
|
||||
Boolean mMustBeActive;
|
||||
Boolean mPaneMustBeActive;
|
||||
Boolean mWindowMustBeActive;
|
||||
Boolean mMustBeEnabled;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user