diff --git a/headers/private/interface/BMCPrivate.h b/headers/private/interface/BMCPrivate.h index 609cdbd066..2c229be82b 100644 --- a/headers/private/interface/BMCPrivate.h +++ b/headers/private/interface/BMCPrivate.h @@ -45,6 +45,7 @@ public: virtual void AttachedToWindow(); virtual void Draw(BRect updateRect); + virtual void MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage); virtual void FrameResized(float width, float height); virtual void MakeFocus(bool focused = true); virtual void MessageReceived(BMessage* message); @@ -65,8 +66,9 @@ private: void _Init(); BMenuField* fMenuField; - bool fFixedSize; + bool fFixedSize; bool fShowPopUpMarker; + bool fIsInside; float fPreviousWidth; }; diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index 26209f1b7d..3ac4862f2b 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -99,7 +99,8 @@ _BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField) !fixedSize), fMenuField(menuField), fFixedSize(fixedSize), - fShowPopUpMarker(true) + fShowPopUpMarker(true), + fIsInside(false) { _Init(); } @@ -110,7 +111,8 @@ _BMCMenuBar_::_BMCMenuBar_(BMenuField* menuField) BMenuBar("_mc_mb_", B_ITEMS_IN_ROW), fMenuField(menuField), fFixedSize(true), - fShowPopUpMarker(true) + fShowPopUpMarker(true), + fIsInside(false) { _Init(); } @@ -121,7 +123,8 @@ _BMCMenuBar_::_BMCMenuBar_(BMessage* data) BMenuBar(data), fMenuField(NULL), fFixedSize(true), - fShowPopUpMarker(true) + fShowPopUpMarker(true), + fIsInside(false) { SetFlags(Flags() | B_FRAME_EVENTS); @@ -195,6 +198,8 @@ _BMCMenuBar_::Draw(BRect updateRect) flags |= BControlLook::B_DISABLED; if (IsFocus()) flags |= BControlLook::B_FOCUSED; + if (fIsInside) + flags |= BControlLook::B_HOVER; be_control_look->DrawMenuFieldBackground(this, rect, updateRect, LowColor(), fShowPopUpMarker, flags); @@ -203,6 +208,17 @@ _BMCMenuBar_::Draw(BRect updateRect) } +void +_BMCMenuBar_::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) +{ + bool inside = (code != B_EXITED_VIEW) && Bounds().Contains(where); + if (inside != fIsInside) { + fIsInside = inside; + Invalidate(); + } +} + + void _BMCMenuBar_::FrameResized(float width, float height) {