Skip to content

Commit 2b4b1d0

Browse files
sboxbotRumBugen
andauthored
Editor Widget API: Rename OnWheel to OnMouseWheel (#4505)
--------- Co-authored-by: RumBugen <vladislavwanner@gmail.com>
1 parent 2e40e76 commit 2b4b1d0

14 files changed

Lines changed: 34 additions & 23 deletions

File tree

engine/Sandbox.Tools/Qt/BaseScrollWidget.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ protected virtual void OnScrollChanged()
9999
/// </summary>
100100
float SmoothValue;
101101

102-
protected override void OnWheel( WheelEvent e )
102+
protected override void OnMouseWheel( WheelEvent e )
103103
{
104104
if ( !SmoothScrolling )
105105
{
106-
base.OnWheel( e );
106+
base.OnMouseWheel( e );
107107
return;
108108
}
109109

engine/Sandbox.Tools/Qt/Widget.Events.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,22 @@ internal static Widget CurrentlyPressedWidget
2626
/// </summary>
2727
public bool IsPressed => CurrentlyPressedWidget == this;
2828

29-
internal void InternalWheelEvent( QWheelEvent e ) => OnWheel( new WheelEvent( e ) );
29+
internal void InternalWheelEvent( QWheelEvent e ) => OnMouseWheel( new WheelEvent( e ) );
3030

3131
/// <summary>
3232
/// Mouse wheel was scrolled while the mouse cursor was over this widget.
3333
/// </summary>
34+
protected virtual void OnMouseWheel( WheelEvent e )
35+
{
36+
#pragma warning disable CS0618 // Type or member is obsolete
37+
OnWheel( e );
38+
#pragma warning restore CS0618 // Type or member is obsolete
39+
}
40+
41+
/// <summary>
42+
/// Mouse wheel was scrolled while the mouse cursor was over this widget.
43+
/// </summary>
44+
[Obsolete( $"Use {nameof( OnMouseWheel )}" )]
3445
protected virtual void OnWheel( WheelEvent e )
3546
{
3647

game/addons/tools/Code/Curves/CurveEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ public CurveEditor( Widget parent ) : base( parent )
202202
};
203203
}
204204

205-
protected override void OnWheel( WheelEvent e )
205+
protected override void OnMouseWheel( WheelEvent e )
206206
{
207-
base.OnWheel( e );
207+
base.OnMouseWheel( e );
208208

209209
if ( e.Delta != 0 )
210210
{

game/addons/tools/Code/Editor/AssetList/AssetList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public AssetListViewMode ViewMode
524524
get => _viewMode;
525525
}
526526

527-
protected override void OnWheel( WheelEvent e )
527+
protected override void OnMouseWheel( WheelEvent e )
528528
{
529529
if ( e.HasCtrl )
530530
{
@@ -543,7 +543,7 @@ protected override void OnWheel( WheelEvent e )
543543
return;
544544
}
545545

546-
base.OnWheel( e );
546+
base.OnMouseWheel( e );
547547
}
548548

549549
void BuildAllIcons()

game/addons/tools/Code/Editor/RectEditor/RectView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,9 @@ protected override void OnResize()
569569
UpdateScaledBackgroundImage();
570570
}
571571

572-
protected override void OnWheel( WheelEvent e )
572+
protected override void OnMouseWheel( WheelEvent e )
573573
{
574-
base.OnWheel( e );
574+
base.OnMouseWheel( e );
575575

576576
var mouseUV = PixelToUV( e.Position );
577577

game/addons/tools/Code/Editor/SoundEditor/Timeline.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ public void OnFrame()
219219
Scrubbing = false;
220220
}
221221

222-
protected override void OnWheel( WheelEvent e )
222+
protected override void OnMouseWheel( WheelEvent e )
223223
{
224-
base.OnWheel( e );
224+
base.OnMouseWheel( e );
225225

226226
e.Accept();
227227

game/addons/tools/Code/Editor/SpriteEditor/Timeline.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ private void UpdatePlayButton()
245245
PlayButton.StatusTip = SpriteEditor.IsPlaying ? "Pause" : "Play";
246246
}
247247

248-
protected override void OnWheel( WheelEvent e )
248+
protected override void OnMouseWheel( WheelEvent e )
249249
{
250-
base.OnWheel( e );
250+
base.OnMouseWheel( e );
251251

252252
var delta = e.Delta;
253253

game/addons/tools/Code/NodeGraph/GraphView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ internal void MoveableReleased()
177177
_moveablePressed = false;
178178
}
179179

180-
protected override void OnWheel( WheelEvent e )
180+
protected override void OnMouseWheel( WheelEvent e )
181181
{
182182
Zoom( e.Delta > 0 ? 1.1f : 0.90f, e.Position );
183183
if ( FadeOutBackground )

game/addons/tools/Code/Widgets/KeyBind.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public KeyBind( Widget parent ) : base( parent )
3939
FocusMode = FocusMode.Click;
4040
}
4141

42-
protected override void OnWheel( WheelEvent e )
42+
protected override void OnMouseWheel( WheelEvent e )
4343
{
44-
base.OnWheel( e );
44+
base.OnMouseWheel( e );
4545

4646
if ( IsTrapping )
4747
{

game/addons/tools/Code/Widgets/SoundPlayer/SoundPlayer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public void MoveScrubber( float position, bool centreOn = true )
281281
WaveForm.Update();
282282
}
283283

284-
protected override void OnWheel( WheelEvent e )
284+
protected override void OnMouseWheel( WheelEvent e )
285285
{
286286
ZoomLevel *= e.Delta > 0 ? 1.1f : 0.90f;
287287
ZoomLevel = ZoomLevel.Clamp( 1.0f, 20.0f );

0 commit comments

Comments
 (0)