customdrawn: Merges customdrawnwscontrols.inc into the main pas file and compilation fixes

git-svn-id: trunk@33871 -
This commit is contained in:
sekelsenmat 2011-11-30 14:12:24 +00:00
parent 5774ecec7d
commit 56461923d5
7 changed files with 129 additions and 153 deletions

1
.gitattributes vendored
View File

@ -5471,7 +5471,6 @@ lcl/interfaces/customdrawn/customdrawnwinapi_win.inc svneol=native#text/pascal
lcl/interfaces/customdrawn/customdrawnwinapi_x11.inc svneol=native#text/pascal
lcl/interfaces/customdrawn/customdrawnwinapih.inc svneol=native#text/pascal
lcl/interfaces/customdrawn/customdrawnwsarrow.pas svneol=native#text/plain
lcl/interfaces/customdrawn/customdrawnwscontrols.inc svneol=native#text/pascal
lcl/interfaces/customdrawn/customdrawnwscontrols.pp svneol=native#text/plain
lcl/interfaces/customdrawn/customdrawnwscontrols_win.inc svneol=native#text/pascal
lcl/interfaces/customdrawn/customdrawnwsfactory.pas svneol=native#text/pascal

View File

@ -4658,14 +4658,6 @@ begin
if AHandle = 0 then exit(False);
eventResult := eventResult or 1;
(* if Rect <> nil then
begin
with TQtWidget(aHandle).getClientOffset do
OffsetRect(Rect^, x, y);
// no need to handle bErase. Qt automatically erase rect on paint event according to docs
TQtWidget(aHandle).Update(Rect);
end else
TQtWidget(aHandle).Update;*)
Result := True;
end;

View File

@ -525,7 +525,7 @@ begin
Result:=False;
end;*)
function TCDWidgetSet.InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean): Boolean;
function TCDWidgetSet.BackendInvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean): Boolean;
begin
(* if aHandle<>0 then begin
Result:=True;

View File

@ -1,15 +1,11 @@
{%MainUnit win32int.pp}
{ $Id: win32winapi.inc 33552 2011-11-16 05:52:31Z paul $ }
{%MainUnit customdrawnint.pp}
{******************************************************************************
All Windows API implementations.
All CustomDrawn API implementations.
Initial Revision : Sat Nov 13 12:53:53 1999
!! Keep alphabetical !!
Support routines go to win32proc.pp
******************************************************************************
Implementation
******************************************************************************
@ -2379,7 +2375,7 @@ begin
DebugLn('[HideCaret] for window ', IntToHex(HWnd, 8));
{$endif}
Result := Boolean(Windows.HideCaret(hWnd));
end;
end; *)
{------------------------------------------------------------------------------
Method: InvalidateRect
@ -2390,7 +2386,7 @@ end;
Adds a rectangle to the specified window's update region.
------------------------------------------------------------------------------}
function TWin32WidgetSet.InvalidateRect(aHandle: HWND; Rect: PRect; BErase: Boolean): Boolean;
function TCDWidgetSet.BackendInvalidateRect(aHandle: HWND; Rect: PRect; BErase: Boolean): Boolean;
var
Flags: UINT;
ORect: TRect;
@ -2406,7 +2402,7 @@ begin
Result := Boolean(Windows.RedrawWindow(aHandle, Rect, 0, Flags));
end;
{------------------------------------------------------------------------------
(*{------------------------------------------------------------------------------
Method: InvalidateRgn
Params: Handle - handle of window with changed update region
Rgn - handle to region to invalidate

View File

@ -1,124 +0,0 @@
{$MainUnit customdrawnwscontrols.pp}
class function TCDWSWinControl.GetText(const AWinControl: TWinControl; var AText: String): Boolean;
begin
AText := '';
Result := false;
end;
class procedure TCDWSWinControl.SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle);
begin
RecreateWnd(AWinControl);
end;
class procedure TCDWSWinControl.SetChildZPosition(
const AWinControl, AChild: TWinControl; const AOldPos, ANewPos: Integer;
const AChildren: TFPList);
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetChildZPosition')
then Exit;
if not WSCheckHandleAllocated(AChild, 'SetChildZPosition (child)')
then Exit;
{ if ANewPos = 0 // bottom
then AfterWnd := HWND_BOTTOM
else if ANewPos >= AChildren.Count - 1
then AfterWnd := HWND_TOP
else begin
// Search for the first child above us with a handle
// the child list is reversed form the windows order.
// So the first window is the top window and is the last child
// if we don't find a allocated handle then we are effectively not moved
AfterWnd := 0;
if AOldPos > ANewPos
then StopPos := AOldPos // The child is moved to the bottom, oldpos is on top of it
else StopPos := AChildren.Count - 1; // the child is moved to the top
for n := ANewPos + 1 to StopPos do
begin
Child := TWinControl(AChildren[n]);
if Child.HandleAllocated
then begin
AfterWnd := Child.Handle;
Break;
end;
end;
if AfterWnd = 0 then Exit; // nothing to do
end;
Windows.SetWindowPos(AChild.Handle, AfterWnd, 0, 0, 0, 0,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOOWNERZORDER or
SWP_NOSIZE or SWP_NOSENDCHANGING);}
end;
{------------------------------------------------------------------------------
Method: SetBounds
Params: AWinControl - the object which invoked this function
ALeft, ATop, AWidth, AHeight - new dimensions for the control
Pre: AWinControl.HandleAllocated
Returns: Nothing
Resize a window
------------------------------------------------------------------------------}
class procedure TCDWSWinControl.SetBounds(const AWinControl: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer);
begin
end;
class procedure TCDWSWinControl.SetColor(const AWinControl: TWinControl);
begin
end;
class procedure TCDWSWinControl.SetFont(const AWinControl: TWinControl; const AFont: TFont);
begin
end;
class procedure TCDWSWinControl.SetText(const AWinControl: TWinControl; const AText: string);
begin
end;
class procedure TCDWSWinControl.ConstraintsChange(const AWinControl: TWinControl);
begin
end;
class function TCDWSWinControl.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND;
var
lCDWinControl, lCDParent: TCDWinControl;
begin
lCDWinControl := TCDWinControl.Create;
lCDWinControl.WinControl := AWinControl;
lCDWinControl.Region := TLazRegionWithChilds.Create;
lCDWinControl.Region.UserData := AWinControl;
lCDWinControl.Region.SetAsSimpleRectRegion(Bounds(AWinControl.Left, AWinControl.Top, AParams.Width, AParams.Height));
Result := HWND(lCDWinControl);
// Adding on a form
if AWinControl.Parent is TCustomForm then
begin
TCDWSCustomForm.BackendAddCDWinControlToForm(TCustomForm(AWinControl.Parent), lCDWinControl);
end
// Adding on another control
else if AWinControl.Parent is TWinControl then
begin
lCDParent := TCDWinControl(AWinControl.Parent.Handle);
if lCDParent.Children = nil then lCDParent.Children := TFPList.Create;
lCDParent.Children.Add(lCDWinControl);
end;
end;
class procedure TCDWSWinControl.DestroyHandle(const AWinControl: TWinControl);
begin
end;
class procedure TCDWSWinControl.Invalidate(const AWinControl: TWinControl);
begin
// lpRect = nil updates entire client area of window
CDWidgetset.InvalidateRect(AWinControl.Handle, nil, true);
end;
class procedure TCDWSWinControl.ShowHide(const AWinControl: TWinControl);
begin
end;

View File

@ -162,16 +162,128 @@ uses customdrawnwsforms;
{$ifdef CD_Windows}
{$include customdrawnwscontrols_win.inc}
{$include customdrawnwscontrols.inc}
{$endif}
{$ifdef CD_Cocoa}
{$include customdrawnwscontrols.inc}
{$endif}
{$ifdef CD_X11}
{$include customdrawnwscontrols.inc}
{$endif}
{$ifdef CD_Android}
{$include customdrawnwscontrols.inc}
{$endif}
class function TCDWSWinControl.GetText(const AWinControl: TWinControl; var AText: String): Boolean;
begin
AText := '';
Result := false;
end;
class procedure TCDWSWinControl.SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle);
begin
RecreateWnd(AWinControl);
end;
class procedure TCDWSWinControl.SetChildZPosition(
const AWinControl, AChild: TWinControl; const AOldPos, ANewPos: Integer;
const AChildren: TFPList);
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetChildZPosition')
then Exit;
if not WSCheckHandleAllocated(AChild, 'SetChildZPosition (child)')
then Exit;
{ if ANewPos = 0 // bottom
then AfterWnd := HWND_BOTTOM
else if ANewPos >= AChildren.Count - 1
then AfterWnd := HWND_TOP
else begin
// Search for the first child above us with a handle
// the child list is reversed form the windows order.
// So the first window is the top window and is the last child
// if we don't find a allocated handle then we are effectively not moved
AfterWnd := 0;
if AOldPos > ANewPos
then StopPos := AOldPos // The child is moved to the bottom, oldpos is on top of it
else StopPos := AChildren.Count - 1; // the child is moved to the top
for n := ANewPos + 1 to StopPos do
begin
Child := TWinControl(AChildren[n]);
if Child.HandleAllocated
then begin
AfterWnd := Child.Handle;
Break;
end;
end;
if AfterWnd = 0 then Exit; // nothing to do
end;
Windows.SetWindowPos(AChild.Handle, AfterWnd, 0, 0, 0, 0,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOOWNERZORDER or
SWP_NOSIZE or SWP_NOSENDCHANGING);}
end;
{------------------------------------------------------------------------------
Method: SetBounds
Params: AWinControl - the object which invoked this function
ALeft, ATop, AWidth, AHeight - new dimensions for the control
Pre: AWinControl.HandleAllocated
Returns: Nothing
Resize a window
------------------------------------------------------------------------------}
class procedure TCDWSWinControl.SetBounds(const AWinControl: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer);
begin
end;
class procedure TCDWSWinControl.SetColor(const AWinControl: TWinControl);
begin
end;
class procedure TCDWSWinControl.SetFont(const AWinControl: TWinControl; const AFont: TFont);
begin
end;
class procedure TCDWSWinControl.SetText(const AWinControl: TWinControl; const AText: string);
begin
end;
class procedure TCDWSWinControl.ConstraintsChange(const AWinControl: TWinControl);
begin
end;
class function TCDWSWinControl.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND;
var
lCDWinControl, lCDParent: TCDWinControl;
begin
lCDWinControl := TCDWinControl.Create;
lCDWinControl.WinControl := AWinControl;
lCDWinControl.Region := TLazRegionWithChilds.Create;
lCDWinControl.Region.UserData := AWinControl;
lCDWinControl.Region.SetAsSimpleRectRegion(Bounds(AWinControl.Left, AWinControl.Top, AParams.Width, AParams.Height));
Result := HWND(lCDWinControl);
// Adding on a form
if AWinControl.Parent is TCustomForm then
begin
TCDWSCustomForm.BackendAddCDWinControlToForm(TCustomForm(AWinControl.Parent), lCDWinControl);
end
// Adding on another control
else if AWinControl.Parent is TWinControl then
begin
lCDParent := TCDWinControl(AWinControl.Parent.Handle);
if lCDParent.Children = nil then lCDParent.Children := TFPList.Create;
lCDParent.Children.Add(lCDWinControl);
end;
end;
class procedure TCDWSWinControl.DestroyHandle(const AWinControl: TWinControl);
begin
end;
class procedure TCDWSWinControl.Invalidate(const AWinControl: TWinControl);
begin
// lpRect = nil updates entire client area of window
CDWidgetset.InvalidateRect(AWinControl.Handle, nil, true);
end;
class procedure TCDWSWinControl.ShowHide(const AWinControl: TWinControl);
begin
end;
end.

View File

@ -41,6 +41,7 @@ uses
// LCL
Controls, LCLType, Forms, LCLProc, GraphType, IntfGraphics, lazcanvas,
lazregions, LCLIntf,
customdrawncontrols,
// Widgetset
InterfaceBase, WSForms, WSProc, WSLCLClasses, LCLMessageGlue,
customdrawnwscontrols, customdrawnint, customdrawnproc;