LCL: Extend horizontal mouse wheel messages for Grid and TreeView. Issue #32753, patch from AlexeyT.

git-svn-id: trunk@56654 -
This commit is contained in:
juha 2017-12-06 11:25:07 +00:00
parent bd004732eb
commit d171170bb6
3 changed files with 45 additions and 0 deletions

View File

@ -3462,6 +3462,8 @@ type
procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
MousePos: TPoint): Boolean; override;
function DoMouseWheelHorz(Shift: TShiftState; WheelDelta: Integer;
MousePos: TPoint): Boolean; override;
procedure DoPaint; virtual;
procedure DoPaintNode(Node: TTreeNode); virtual;
procedure DoStartDrag(var DragObject: TDragObject); override;

View File

@ -982,6 +982,8 @@ type
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelLeft(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelRight(Shift: TShiftState; MousePos: TPoint): Boolean; override;
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
procedure DoOnChangeBounds; override;
@ -7150,6 +7152,30 @@ begin
{$ifdef dbgScroll}DebugLn('doMouseWheelUP END');{$endif}
end;
function TCustomGrid.DoMouseWheelLeft(Shift: TShiftState; MousePos: TPoint
): Boolean;
begin
{$ifdef dbgScroll}DebugLn('doMouseWheelLEFT INIT');{$endif}
Result:=inherited DoMouseWheelLeft(Shift, MousePos);
if not Result then begin
GridMouseWheel([ssCtrl], -1);
Result := True; // handled, no further scrolling by the widgetset
end;
{$ifdef dbgScroll}DebugLn('doMouseWheelLEFT END');{$endif}
end;
function TCustomGrid.DoMouseWheelRight(Shift: TShiftState; MousePos: TPoint
): Boolean;
begin
{$ifdef dbgScroll}DebugLn('doMouseWheelRIGHT INIT');{$endif}
Result:=inherited DoMouseWheelRight(Shift, MousePos);
if not Result then begin
GridMouseWheel([ssCtrl], 1);
Result := True; // handled, no further scrolling by the widgetset
end;
{$ifdef dbgScroll}DebugLn('doMouseWheelRIGHT END');{$endif}
end;
procedure TCustomGrid.DoOnChangeBounds;
var
OldTopLeft: TPoint;

View File

@ -4698,6 +4698,23 @@ begin
UpdateTooltip(MousePos.X, MousePos.Y);
end;
function TCustomTreeView.DoMouseWheelHorz(Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint): Boolean;
var
NDelta: integer;
const
cScrollStep = 50;
begin
Result:=inherited DoMouseWheelHorz(Shift, WheelDelta, MousePos);
if not Result then
begin
NDelta := (WheelDelta * cScrollStep) div 120;
ScrolledLeft := ScrolledLeft + NDelta;
Result := true;
end;
UpdateTooltip(MousePos.X, MousePos.Y);
end;
function TCustomTreeView.DoDragMsg(ADragMessage: TDragMessage; APosition: TPoint; ADragObject: TDragObject; ATarget: TControl; ADocking: Boolean):LRESULT;
begin
Result:=inherited;