mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:39:25 +02:00
customdrawn: Merges customdrawnwscontrols.inc into the main pas file and compilation fixes
git-svn-id: trunk@33871 -
This commit is contained in:
parent
5774ecec7d
commit
56461923d5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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/customdrawnwinapi_x11.inc svneol=native#text/pascal
|
||||||
lcl/interfaces/customdrawn/customdrawnwinapih.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/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.pp svneol=native#text/plain
|
||||||
lcl/interfaces/customdrawn/customdrawnwscontrols_win.inc svneol=native#text/pascal
|
lcl/interfaces/customdrawn/customdrawnwscontrols_win.inc svneol=native#text/pascal
|
||||||
lcl/interfaces/customdrawn/customdrawnwsfactory.pas svneol=native#text/pascal
|
lcl/interfaces/customdrawn/customdrawnwsfactory.pas svneol=native#text/pascal
|
||||||
|
@ -4658,14 +4658,6 @@ begin
|
|||||||
if AHandle = 0 then exit(False);
|
if AHandle = 0 then exit(False);
|
||||||
|
|
||||||
eventResult := eventResult or 1;
|
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;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
@ -525,7 +525,7 @@ begin
|
|||||||
Result:=False;
|
Result:=False;
|
||||||
end;*)
|
end;*)
|
||||||
|
|
||||||
function TCDWidgetSet.InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean): Boolean;
|
function TCDWidgetSet.BackendInvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
(* if aHandle<>0 then begin
|
(* if aHandle<>0 then begin
|
||||||
Result:=True;
|
Result:=True;
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
{%MainUnit win32int.pp}
|
{%MainUnit customdrawnint.pp}
|
||||||
{ $Id: win32winapi.inc 33552 2011-11-16 05:52:31Z paul $ }
|
|
||||||
|
|
||||||
{******************************************************************************
|
{******************************************************************************
|
||||||
All Windows API implementations.
|
All CustomDrawn API implementations.
|
||||||
Initial Revision : Sat Nov 13 12:53:53 1999
|
Initial Revision : Sat Nov 13 12:53:53 1999
|
||||||
|
|
||||||
|
|
||||||
!! Keep alphabetical !!
|
!! Keep alphabetical !!
|
||||||
|
|
||||||
Support routines go to win32proc.pp
|
|
||||||
|
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
Implementation
|
Implementation
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
@ -2379,7 +2375,7 @@ begin
|
|||||||
DebugLn('[HideCaret] for window ', IntToHex(HWnd, 8));
|
DebugLn('[HideCaret] for window ', IntToHex(HWnd, 8));
|
||||||
{$endif}
|
{$endif}
|
||||||
Result := Boolean(Windows.HideCaret(hWnd));
|
Result := Boolean(Windows.HideCaret(hWnd));
|
||||||
end;
|
end; *)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: InvalidateRect
|
Method: InvalidateRect
|
||||||
@ -2390,7 +2386,7 @@ end;
|
|||||||
|
|
||||||
Adds a rectangle to the specified window's update region.
|
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
|
var
|
||||||
Flags: UINT;
|
Flags: UINT;
|
||||||
ORect: TRect;
|
ORect: TRect;
|
||||||
@ -2406,7 +2402,7 @@ begin
|
|||||||
Result := Boolean(Windows.RedrawWindow(aHandle, Rect, 0, Flags));
|
Result := Boolean(Windows.RedrawWindow(aHandle, Rect, 0, Flags));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
(*{------------------------------------------------------------------------------
|
||||||
Method: InvalidateRgn
|
Method: InvalidateRgn
|
||||||
Params: Handle - handle of window with changed update region
|
Params: Handle - handle of window with changed update region
|
||||||
Rgn - handle to region to invalidate
|
Rgn - handle to region to invalidate
|
||||||
|
@ -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;
|
|
||||||
|
|
@ -162,16 +162,128 @@ uses customdrawnwsforms;
|
|||||||
|
|
||||||
{$ifdef CD_Windows}
|
{$ifdef CD_Windows}
|
||||||
{$include customdrawnwscontrols_win.inc}
|
{$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}
|
{$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.
|
end.
|
||||||
|
@ -41,6 +41,7 @@ uses
|
|||||||
// LCL
|
// LCL
|
||||||
Controls, LCLType, Forms, LCLProc, GraphType, IntfGraphics, lazcanvas,
|
Controls, LCLType, Forms, LCLProc, GraphType, IntfGraphics, lazcanvas,
|
||||||
lazregions, LCLIntf,
|
lazregions, LCLIntf,
|
||||||
|
customdrawncontrols,
|
||||||
// Widgetset
|
// Widgetset
|
||||||
InterfaceBase, WSForms, WSProc, WSLCLClasses, LCLMessageGlue,
|
InterfaceBase, WSForms, WSProc, WSLCLClasses, LCLMessageGlue,
|
||||||
customdrawnwscontrols, customdrawnint, customdrawnproc;
|
customdrawnwscontrols, customdrawnint, customdrawnproc;
|
||||||
|
Loading…
Reference in New Issue
Block a user