mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 12:59:14 +02:00
Starts Y form scrolling in LCL-CustomDrawn and converts tabs to space in the messaging fields table
git-svn-id: trunk@34523 -
This commit is contained in:
parent
ebfc7112a5
commit
2a92924d26
@ -639,6 +639,8 @@ begin
|
|||||||
Context.ctx:=ControlContext;
|
Context.ctx:=ControlContext;
|
||||||
lWidth := Round(bounds.size.width);
|
lWidth := Round(bounds.size.width);
|
||||||
lHeight := Round(bounds.size.height);
|
lHeight := Round(bounds.size.height);
|
||||||
|
WindowHandle.FormRealSize := Types.Size(lWidth, lHeight);
|
||||||
|
lHeight := WindowHandle.GetFormBufferHeight(lHeight);
|
||||||
if Context.InitDraw(lWidth, lHeight) then
|
if Context.InitDraw(lWidth, lHeight) then
|
||||||
begin
|
begin
|
||||||
// Prepare the non-native image and canvas
|
// Prepare the non-native image and canvas
|
||||||
@ -653,7 +655,7 @@ begin
|
|||||||
// Now render it into the control
|
// Now render it into the control
|
||||||
WindowHandle.Image.GetRawImage(lRawImage);
|
WindowHandle.Image.GetRawImage(lRawImage);
|
||||||
Cocoa_RawImage_CreateBitmaps(lRawImage, lBitmap, lMask, True);
|
Cocoa_RawImage_CreateBitmaps(lRawImage, lBitmap, lMask, True);
|
||||||
Context.DrawBitmap(0, 0, TCocoaBitmap(lBitmap));
|
Context.DrawBitmap(0, WindowHandle.ScrollY, TCocoaBitmap(lBitmap));
|
||||||
end;
|
end;
|
||||||
{$IFDEF VerboseCDPaintProfiler}
|
{$IFDEF VerboseCDPaintProfiler}
|
||||||
DebugLn(Format('[TCocoaCustomControl.Draw] Paint duration: %d ms', [DateTimeToMilliseconds(NowUTC() - lTimeStart)]));
|
DebugLn(Format('[TCocoaCustomControl.Draw] Paint duration: %d ms', [DateTimeToMilliseconds(NowUTC() - lTimeStart)]));
|
||||||
|
@ -9,7 +9,7 @@ uses
|
|||||||
Types, Classes, SysUtils,
|
Types, Classes, SysUtils,
|
||||||
// LCL
|
// LCL
|
||||||
Controls, Graphics, stdctrls, extctrls, comctrls,
|
Controls, Graphics, stdctrls, extctrls, comctrls,
|
||||||
customdrawnproc, customdrawncontrols, lcltype, lclproc;
|
customdrawnproc, customdrawncontrols, lcltype, lclproc, lclintf;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -95,6 +95,9 @@ begin
|
|||||||
LCLSendMouseUpMsg(lTarget, lEventPos.x, lEventPos.y, Button, ShiftState);
|
LCLSendMouseUpMsg(lTarget, lEventPos.x, lEventPos.y, Button, ShiftState);
|
||||||
if lEventEndsInsideTheControl then LCLSendClickedMsg(lTarget);
|
if lEventEndsInsideTheControl then LCLSendClickedMsg(lTarget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Form scrolling
|
||||||
|
AWindowHandle.IsScrolling := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CallbackMouseDown(AWindowHandle: TCDForm; x, y: Integer; Button: TMouseButton; ShiftState: TShiftState = []);
|
procedure CallbackMouseDown(AWindowHandle: TCDForm; x, y: Integer; Button: TMouseButton; ShiftState: TShiftState = []);
|
||||||
@ -138,12 +141,20 @@ begin
|
|||||||
|
|
||||||
// If the target is focusable, a mouse down will give it focus
|
// If the target is focusable, a mouse down will give it focus
|
||||||
CDWidgetset.CDSetFocusToControl(lTarget, lIntfTarget);
|
CDWidgetset.CDSetFocusToControl(lTarget, lIntfTarget);
|
||||||
|
|
||||||
|
// Check if we are scrolling the form
|
||||||
|
if lTarget = AWindowHandle.LCLForm then
|
||||||
|
begin
|
||||||
|
AWindowHandle.IsScrolling := True;
|
||||||
|
AWindowHandle.LastMousePos := lEventPos;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CallbackMouseMove(AWindowHandle: TCDForm; x, y: Integer; ShiftState: TShiftState = []);
|
procedure CallbackMouseMove(AWindowHandle: TCDForm; x, y: Integer; ShiftState: TShiftState = []);
|
||||||
var
|
var
|
||||||
lTarget: TWinControl;
|
lTarget: TWinControl;
|
||||||
lEventPos: TPoint;
|
lEventPos: TPoint;
|
||||||
|
lOldScrollY: Integer;
|
||||||
begin
|
begin
|
||||||
if AWindowHandle.LastMouseDownControl = nil then
|
if AWindowHandle.LastMouseDownControl = nil then
|
||||||
lTarget := FindControlWhichReceivedEvent(AWindowHandle.LCLForm, AWindowHandle.Children, x, y)
|
lTarget := FindControlWhichReceivedEvent(AWindowHandle.LCLForm, AWindowHandle.Children, x, y)
|
||||||
@ -160,6 +171,15 @@ begin
|
|||||||
|
|
||||||
LCLSendMouseMoveMsg(lTarget, lEventPos.x, lEventPos.y, ShiftState);
|
LCLSendMouseMoveMsg(lTarget, lEventPos.x, lEventPos.y, ShiftState);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// form scrolling
|
||||||
|
if AWindowHandle.IsScrolling then
|
||||||
|
begin
|
||||||
|
lOldScrollY := AWindowHandle.ScrollY;
|
||||||
|
AWindowHandle.ScrollY := lEventPos.Y - AWindowHandle.LastMousePos.Y;
|
||||||
|
AWindowHandle.SanityCheckScrollPos();
|
||||||
|
if AWindowHandle.ScrollY <> lOldScrollY then LCLIntf.InvalidateRect(HWND(AWindowHandle), nil, False);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CallbackKeyDown(AWindowHandle: TCDForm; AKey: Word);
|
procedure CallbackKeyDown(AWindowHandle: TCDForm; AKey: Word);
|
||||||
|
@ -61,9 +61,16 @@ type
|
|||||||
// painting objects
|
// painting objects
|
||||||
Image: TLazIntfImage;
|
Image: TLazIntfImage;
|
||||||
Canvas: TLazCanvas;
|
Canvas: TLazCanvas;
|
||||||
|
// For scrolling the form
|
||||||
|
ScrollX, ScrollY: Integer;
|
||||||
|
LastMousePos: TPoint;
|
||||||
|
IsScrolling: Boolean;
|
||||||
|
FormRealSize: TSize; // the size in the screen
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
procedure IncInvalidateCount;
|
procedure IncInvalidateCount;
|
||||||
function GetFocusedControl: TWinControl;
|
function GetFocusedControl: TWinControl;
|
||||||
|
function GetFormBufferHeight(AScreenHeight: Integer): Integer;
|
||||||
|
procedure SanityCheckScrollPos();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCDNonNativeForm = class(TCDForm)
|
TCDNonNativeForm = class(TCDForm)
|
||||||
@ -724,5 +731,25 @@ begin
|
|||||||
else Result := LCLForm;
|
else Result := LCLForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDForm.GetFormBufferHeight(AScreenHeight: Integer): Integer;
|
||||||
|
var
|
||||||
|
i, lControlRequiredHeight: Integer;
|
||||||
|
lControl: TControl;
|
||||||
|
begin
|
||||||
|
Result := AScreenHeight;
|
||||||
|
for i := 0 to LCLForm.ControlCount-1 do
|
||||||
|
begin
|
||||||
|
lControl := LCLForm.Controls[i];
|
||||||
|
lControlRequiredHeight := lControl.Top + lControl.Height;
|
||||||
|
Result := Max(lControlRequiredHeight, Result);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCDForm.SanityCheckScrollPos;
|
||||||
|
begin
|
||||||
|
ScrollY := Max(ScrollY, 0);
|
||||||
|
ScrollY := Min(ScrollY, Image.Height - FormRealSize.cy);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -107,20 +107,20 @@ type
|
|||||||
TLazDeviceMessage = class
|
TLazDeviceMessage = class
|
||||||
public
|
public
|
||||||
// The commends indicate in which message kind each field is available
|
// The commends indicate in which message kind each field is available
|
||||||
// in this order: SMS MMS EMail
|
// in this order: SMS MMS EMail
|
||||||
bccAddress: TStringList; // N N Y
|
bccAddress: TStringList; // N N Y
|
||||||
Body: string; // Y Y Y
|
Body: string; // Y Y Y
|
||||||
callbackNumber: string; // Y N N
|
callbackNumber: string; // Y N N
|
||||||
ccAddress: TstringList; // N N Y
|
ccAddress: TstringList; // N N Y
|
||||||
destinationAddress: TStringList; // Y Y Y
|
destinationAddress: TStringList; // Y Y Y
|
||||||
isRead: Boolean; // Y Y Y
|
isRead: Boolean; // Y Y Y
|
||||||
messageId: string; // Y Y Y
|
messageId: string; // Y Y Y
|
||||||
//messagePriority Y Y Y
|
//messagePriority Y Y Y
|
||||||
messageType: TLazDeviceMessageKind;//Y Y Y
|
messageType: TLazDeviceMessageKind;//Y Y Y
|
||||||
sourceAddress: string; // Y Y Y
|
sourceAddress: string; // Y Y Y
|
||||||
Subject: string; // N Y Y
|
Subject: string; // N Y Y
|
||||||
Time: TDateTime; // Y Y Y
|
Time: TDateTime; // Y Y Y
|
||||||
validityPeriod:TTime; // Y N N
|
validityPeriod:TTime; // Y N N
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user