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:
sekelsenmat 2011-12-31 11:34:04 +00:00
parent ebfc7112a5
commit 2a92924d26
4 changed files with 64 additions and 15 deletions

View File

@ -639,6 +639,8 @@ begin
Context.ctx:=ControlContext;
lWidth := Round(bounds.size.width);
lHeight := Round(bounds.size.height);
WindowHandle.FormRealSize := Types.Size(lWidth, lHeight);
lHeight := WindowHandle.GetFormBufferHeight(lHeight);
if Context.InitDraw(lWidth, lHeight) then
begin
// Prepare the non-native image and canvas
@ -653,7 +655,7 @@ begin
// Now render it into the control
WindowHandle.Image.GetRawImage(lRawImage);
Cocoa_RawImage_CreateBitmaps(lRawImage, lBitmap, lMask, True);
Context.DrawBitmap(0, 0, TCocoaBitmap(lBitmap));
Context.DrawBitmap(0, WindowHandle.ScrollY, TCocoaBitmap(lBitmap));
end;
{$IFDEF VerboseCDPaintProfiler}
DebugLn(Format('[TCocoaCustomControl.Draw] Paint duration: %d ms', [DateTimeToMilliseconds(NowUTC() - lTimeStart)]));

View File

@ -9,7 +9,7 @@ uses
Types, Classes, SysUtils,
// LCL
Controls, Graphics, stdctrls, extctrls, comctrls,
customdrawnproc, customdrawncontrols, lcltype, lclproc;
customdrawnproc, customdrawncontrols, lcltype, lclproc, lclintf;
type
@ -95,6 +95,9 @@ begin
LCLSendMouseUpMsg(lTarget, lEventPos.x, lEventPos.y, Button, ShiftState);
if lEventEndsInsideTheControl then LCLSendClickedMsg(lTarget);
end;
// Form scrolling
AWindowHandle.IsScrolling := False;
end;
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
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;
procedure CallbackMouseMove(AWindowHandle: TCDForm; x, y: Integer; ShiftState: TShiftState = []);
var
lTarget: TWinControl;
lEventPos: TPoint;
lOldScrollY: Integer;
begin
if AWindowHandle.LastMouseDownControl = nil then
lTarget := FindControlWhichReceivedEvent(AWindowHandle.LCLForm, AWindowHandle.Children, x, y)
@ -160,6 +171,15 @@ begin
LCLSendMouseMoveMsg(lTarget, lEventPos.x, lEventPos.y, ShiftState);
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;
procedure CallbackKeyDown(AWindowHandle: TCDForm; AKey: Word);

View File

@ -61,9 +61,16 @@ type
// painting objects
Image: TLazIntfImage;
Canvas: TLazCanvas;
// For scrolling the form
ScrollX, ScrollY: Integer;
LastMousePos: TPoint;
IsScrolling: Boolean;
FormRealSize: TSize; // the size in the screen
constructor Create; virtual;
procedure IncInvalidateCount;
function GetFocusedControl: TWinControl;
function GetFormBufferHeight(AScreenHeight: Integer): Integer;
procedure SanityCheckScrollPos();
end;
TCDNonNativeForm = class(TCDForm)
@ -724,5 +731,25 @@ begin
else Result := LCLForm;
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.

View File

@ -107,20 +107,20 @@ type
TLazDeviceMessage = class
public
// The commends indicate in which message kind each field is available
// in this order: SMS MMS EMail
bccAddress: TStringList; // N N Y
Body: string; // Y Y Y
callbackNumber: string; // Y N N
ccAddress: TstringList; // N N Y
destinationAddress: TStringList; // Y Y Y
isRead: Boolean; // Y Y Y
messageId: string; // Y Y Y
// in this order: SMS MMS EMail
bccAddress: TStringList; // N N Y
Body: string; // Y Y Y
callbackNumber: string; // Y N N
ccAddress: TstringList; // N N Y
destinationAddress: TStringList; // Y Y Y
isRead: Boolean; // Y Y Y
messageId: string; // Y Y Y
//messagePriority Y Y Y
messageType: TLazDeviceMessageKind;//Y Y Y
sourceAddress: string; // Y Y Y
Subject: string; // N Y Y
Time: TDateTime; // Y Y Y
validityPeriod:TTime; // Y N N
messageType: TLazDeviceMessageKind;//Y Y Y
sourceAddress: string; // Y Y Y
Subject: string; // N Y Y
Time: TDateTime; // Y Y Y
validityPeriod:TTime; // Y N N
constructor Create; virtual;
destructor Destroy; override;
end;