mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
git-svn-id: trunk@14810 -
This commit is contained in:
parent
87798ed1c2
commit
7ed219b411
@ -75,6 +75,7 @@ type
|
|||||||
procedure CreateWidget(const AParams: TCreateParams); virtual; abstract;
|
procedure CreateWidget(const AParams: TCreateParams); virtual; abstract;
|
||||||
procedure DestroyWidget; virtual; abstract;
|
procedure DestroyWidget; virtual; abstract;
|
||||||
function GetContent: ControlRef; virtual; abstract;
|
function GetContent: ControlRef; virtual; abstract;
|
||||||
|
procedure UpdateLCLClientRect;
|
||||||
public
|
public
|
||||||
LCLObject: TWinControl; // LCL control which created this widget
|
LCLObject: TWinControl; // LCL control which created this widget
|
||||||
Context: TCarbonContext; // Carbon content area context
|
Context: TCarbonContext; // Carbon content area context
|
||||||
@ -430,6 +431,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TCarbonWidget.UpdateLCLClientRect
|
||||||
|
|
||||||
|
Updates client rect of LCL object
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TCarbonWidget.UpdateLCLClientRect;
|
||||||
|
begin
|
||||||
|
LCLObject.InvalidateClientRectCache(False);
|
||||||
|
LCLSendSizeMsg(LCLObject, LCLObject.Width,
|
||||||
|
LCLObject.Height, Size_SourceIsInterface);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCarbonWidget.FocusSet
|
Method: TCarbonWidget.FocusSet
|
||||||
|
|
||||||
|
@ -197,7 +197,9 @@ type
|
|||||||
FScrollView: HIViewRef;
|
FScrollView: HIViewRef;
|
||||||
FScrollOrigin: HIPoint;
|
FScrollOrigin: HIPoint;
|
||||||
FScrollSize: TPoint;
|
FScrollSize: TPoint;
|
||||||
|
FScrollMin: TPoint;
|
||||||
FScrollPageSize: TPoint;
|
FScrollPageSize: TPoint;
|
||||||
|
|
||||||
FMulX: Single; // multiply x coords to fit real page size
|
FMulX: Single; // multiply x coords to fit real page size
|
||||||
FMulY: Single; // multiply y coords to fit real page size
|
FMulY: Single; // multiply y coords to fit real page size
|
||||||
FTextFractional: Boolean;
|
FTextFractional: Boolean;
|
||||||
@ -662,6 +664,7 @@ begin
|
|||||||
|
|
||||||
FScrollView := EmbedInScrollView(AParams);
|
FScrollView := EmbedInScrollView(AParams);
|
||||||
FScrollSize := Classes.Point(0, 0);
|
FScrollSize := Classes.Point(0, 0);
|
||||||
|
FScrollMin := Classes.Point(0, 0);
|
||||||
FScrollPageSize := Classes.Point(0, 0);
|
FScrollPageSize := Classes.Point(0, 0);
|
||||||
FScrollOrigin := GetHIPoint(0, 0);
|
FScrollOrigin := GetHIPoint(0, 0);
|
||||||
FMulX := 1;
|
FMulX := 1;
|
||||||
@ -673,6 +676,8 @@ begin
|
|||||||
FTextFractional := True;
|
FTextFractional := True;
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
|
UpdateLCLClientRect; // force update client rect
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -800,7 +805,7 @@ begin
|
|||||||
with ScrollMsg do
|
with ScrollMsg do
|
||||||
begin
|
begin
|
||||||
Msg := LM_VSCROLL;
|
Msg := LM_VSCROLL;
|
||||||
Pos := Round(FScrollOrigin.Y);
|
Pos := Round(FScrollOrigin.Y) + FScrollMin.Y;
|
||||||
ScrollCode := SB_THUMBPOSITION;
|
ScrollCode := SB_THUMBPOSITION;
|
||||||
end;
|
end;
|
||||||
DeliverMessage(LCLObject, ScrollMsg);
|
DeliverMessage(LCLObject, ScrollMsg);
|
||||||
@ -810,7 +815,7 @@ begin
|
|||||||
with ScrollMsg do
|
with ScrollMsg do
|
||||||
begin
|
begin
|
||||||
Msg := LM_HSCROLL;
|
Msg := LM_HSCROLL;
|
||||||
Pos := Round(FScrollOrigin.X);
|
Pos := Round(FScrollOrigin.X) + FScrollMin.X;
|
||||||
ScrollCode := SB_THUMBPOSITION;
|
ScrollCode := SB_THUMBPOSITION;
|
||||||
end;
|
end;
|
||||||
DeliverMessage(LCLObject, ScrollMsg);
|
DeliverMessage(LCLObject, ScrollMsg);
|
||||||
@ -869,17 +874,23 @@ begin
|
|||||||
if (SIF_RANGE and ScrollInfo.fMask) > 0 then
|
if (SIF_RANGE and ScrollInfo.fMask) > 0 then
|
||||||
begin
|
begin
|
||||||
if SBStyle = SB_HORZ then
|
if SBStyle = SB_HORZ then
|
||||||
FScrollSize.X := (ScrollInfo.nMax - ScrollInfo.nMin);
|
begin
|
||||||
|
FScrollSize.X := (ScrollInfo.nMax - ScrollInfo.nMin + 1);
|
||||||
|
FScrollMin.X := ScrollInfo.nMin;
|
||||||
|
end;
|
||||||
if SBStyle = SB_VERT then
|
if SBStyle = SB_VERT then
|
||||||
FScrollSize.Y := (ScrollInfo.nMax - ScrollInfo.nMin);
|
begin
|
||||||
|
FScrollSize.Y := (ScrollInfo.nMax - ScrollInfo.nMin + 1);
|
||||||
|
FScrollMin.Y := ScrollInfo.nMin;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (SIF_POS and ScrollInfo.fMask) > 0 then
|
if (SIF_POS and ScrollInfo.fMask) > 0 then
|
||||||
begin
|
begin
|
||||||
if SBStyle = SB_HORZ then
|
if SBStyle = SB_HORZ then
|
||||||
FScrollOrigin.X := ScrollInfo.nPos;
|
FScrollOrigin.X := ScrollInfo.nPos - FScrollMin.X;
|
||||||
if SBStyle = SB_VERT then
|
if SBStyle = SB_VERT then
|
||||||
FScrollOrigin.Y := ScrollInfo.nPos;
|
FScrollOrigin.Y := ScrollInfo.nPos - FScrollMin.Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (SIF_PAGE and ScrollInfo.fMask) > 0 then
|
if (SIF_PAGE and ScrollInfo.fMask) > 0 then
|
||||||
@ -929,17 +940,17 @@ begin
|
|||||||
ScrollInfo.nMin := 0;
|
ScrollInfo.nMin := 0;
|
||||||
|
|
||||||
if SBStyle = SB_HORZ then
|
if SBStyle = SB_HORZ then
|
||||||
ScrollInfo.nMax := FScrollSize.X;
|
ScrollInfo.nMax := FScrollSize.X - FScrollMin.X - 1;
|
||||||
if SBStyle = SB_VERT then
|
if SBStyle = SB_VERT then
|
||||||
ScrollInfo.nMax := FScrollSize.Y;
|
ScrollInfo.nMax := FScrollSize.Y - FScrollMin.Y - 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (SIF_POS and ScrollInfo.fMask) > 0 then
|
if (SIF_POS and ScrollInfo.fMask) > 0 then
|
||||||
begin
|
begin
|
||||||
if SBStyle = SB_HORZ then
|
if SBStyle = SB_HORZ then
|
||||||
ScrollInfo.nPos := Round(FScrollOrigin.X);
|
ScrollInfo.nPos := Trunc(FScrollOrigin.X) + FScrollMin.X;
|
||||||
if SBStyle = SB_VERT then
|
if SBStyle = SB_VERT then
|
||||||
ScrollInfo.nPos := Round(FScrollOrigin.Y);
|
ScrollInfo.nPos := Trunc(FScrollOrigin.Y) + FScrollMin.Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (SIF_PAGE and ScrollInfo.fMask) > 0 then
|
if (SIF_PAGE and ScrollInfo.fMask) > 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user