MCPcopy Create free account
hub / github.com/audacity/audacity / OnMouseEvent

Method OnMouseEvent

src/widgets/ASlider.cpp:1186–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1184}
1185
1186void LWSlider::OnMouseEvent(wxMouseEvent & event)
1187{
1188 if (event.Entering())
1189 {
1190 // Display the tooltip in the status bar
1191 auto tip = GetTip(mCurrentValue);
1192 auto pProject = FindProjectFromWindow( mParent );
1193 if (pProject)
1194 ProjectStatus::Get( *pProject ).Set( tip );
1195 Refresh();
1196 }
1197 else if (event.Leaving())
1198 {
1199 if (!mIsDragging)
1200 {
1201 ShowTip(false);
1202 }
1203 auto pProject = FindProjectFromWindow( mParent );
1204 if (pProject)
1205 ProjectStatus::Get( *pProject ).Set({});
1206 Refresh();
1207 }
1208
1209 // Events other than mouse-overs are ignored when we are disabled
1210 if (!mEnabled)
1211 return;
1212
1213 // Windows sends a right button mouse event when you press the context menu
1214 // key, so ignore it.
1215 if ((event.RightDown() && !event.RightIsDown()) ||
1216 (event.RightUp() && event.GetPosition() == wxPoint(-1, -1)))
1217 {
1218 event.Skip(false);
1219 return;
1220 }
1221
1222 float prevValue = mCurrentValue;
1223
1224 // Figure out the thumb position
1225 wxRect r;
1226 if (mOrientation == wxHORIZONTAL)
1227 {
1228 r.x = mLeft + ValueToPosition(mCurrentValue);
1229 r.y = mTop + (mCenterY - (mThumbHeight / 2));
1230 }
1231 else
1232 {
1233 r.x = mLeft + (mCenterX - (mThumbWidth / 2));
1234 r.y = mTop + ValueToPosition(mCurrentValue);
1235 }
1236 r.width = mThumbWidth;
1237 r.height = mThumbHeight;
1238
1239 wxRect tolerantThumbRect = r;
1240 tolerantThumbRect.Inflate(3, 3);
1241
1242 // Should probably use a right click instead/also
1243 if( event.ButtonDClick() && mPopup )

Callers 6

ClickMethod · 0.45
DragMethod · 0.45
ReleaseMethod · 0.45
CancelMethod · 0.45
OnCaptureLostMethod · 0.45
OnMouseMethod · 0.45

Calls 8

FindProjectFromWindowFunction · 0.85
GetFunction · 0.85
SkipMethod · 0.80
wxPointClass · 0.70
SetMethod · 0.45
SetFocusMethod · 0.45
ContainsMethod · 0.45
StopMethod · 0.45

Tested by

no test coverage detected