GTK3: Migrate TGdkScrollDirection to enumeration type.

In Gtk3 WS code, variables of type Integer were used instead of ones
of relevant enumeration type.
This leads to compilation error now that `TGdkScrollDirection` is
defined as an enumeration type. This commit fixes those errors.
This commit is contained in:
Abou Al Montacir 2023-06-01 20:01:25 +02:00 committed by Maxim Ganetsky
parent b119f95da9
commit 7eedf76e73
2 changed files with 15 additions and 16 deletions

View File

@ -2689,6 +2689,15 @@ type
GDK_TOUCH_CANCEL = 40, GDK_TOUCH_CANCEL = 40,
GDK_EVENT_LAST = 41 GDK_EVENT_LAST = 41
); );
TGdkScrollDirection = (
TGdkScrollDirectionMinValue = -$7FFFFFFF,
GDK_SCROLL_UP = 0,
GDK_SCROLL_DOWN = 1,
GDK_SCROLL_LEFT = 2,
GDK_SCROLL_RIGHT = 3,
GDK_SCROLL_SMOOTH = 4,
TGdkScrollDirectionMaxValue = $7FFFFFFF
);
TGdkVisualType = ( TGdkVisualType = (
TGdkVisualTypeMinValue = -$7FFFFFFF, TGdkVisualTypeMinValue = -$7FFFFFFF,
GDK_VISUAL_STATIC_GRAY = 0, GDK_VISUAL_STATIC_GRAY = 0,
@ -2708,16 +2717,6 @@ const
GDK_VISIBILITY_PARTIAL: TGdkVisibilityState = 1; GDK_VISIBILITY_PARTIAL: TGdkVisibilityState = 1;
GDK_VISIBILITY_FULLY_OBSCURED: TGdkVisibilityState = 2; GDK_VISIBILITY_FULLY_OBSCURED: TGdkVisibilityState = 2;
type
TGdkScrollDirection = Integer;
const
{ GdkScrollDirection }
GDK_SCROLL_UP: TGdkScrollDirection = 0;
GDK_SCROLL_DOWN: TGdkScrollDirection = 1;
GDK_SCROLL_LEFT: TGdkScrollDirection = 2;
GDK_SCROLL_RIGHT: TGdkScrollDirection = 3;
GDK_SCROLL_SMOOTH: TGdkScrollDirection = 4;
type type
TGdkNotifyType = Integer; TGdkNotifyType = Integer;
const const

View File

@ -1616,10 +1616,10 @@ begin
{$ENDIF} {$ENDIF}
Result := False; Result := False;
case AEvent^.scroll.direction of case AEvent^.scroll.direction of
0, 1{GDK_SCROLL_UP, GDK_SCROLL_UP, {0}
GDK_SCROLL_DOWN}: Msg.Msg := LM_VSCROLL; GDK_SCROLL_DOWN {1}: Msg.Msg := LM_VSCROLL;
2, 3{GDK_SCROLL_LEFT, GDK_SCROLL_LEFT, {2}
GDK_SCROLL_RIGHT}: Msg.Msg := LM_HSCROLL; GDK_SCROLL_RIGHT {3}: Msg.Msg := LM_HSCROLL;
else else
begin begin
if AEvent^.scroll.direction = GDK_SCROLL_SMOOTH then if AEvent^.scroll.direction = GDK_SCROLL_SMOOTH then
@ -1697,8 +1697,8 @@ begin
FillChar(MessE{%H-},SizeOf(MessE),0); FillChar(MessE{%H-},SizeOf(MessE),0);
MessE.Msg := LM_MOUSEWHEEL; MessE.Msg := LM_MOUSEWHEEL;
case AEvent^.scroll.direction of case AEvent^.scroll.direction of
0 {GDK_SCROLL_UP}: MessE.WheelDelta := 120; GDK_SCROLL_UP {0}: MessE.WheelDelta := 120;
1 {GDK_SCROLL_DOWN}: MessE.WheelDelta := -120; GDK_SCROLL_DOWN {1}: MessE.WheelDelta := -120;
else else
exit; exit;
end; end;