Marc,

I can completely understand how it evolved, and early on the features of
both the Free Pascal language, and the way the LCL library were to be
adapted to multiple platforms became more clear. Thanks for your hard work.

I've thought about the way the LCL is structured to handle many platforms
for quite some time now, and if it were remade I'd strongly prefer it if
every platform and native control were implemented through a set of well
defined platform agnostic interfaces. Then each platform would adhere to
that interface in order to implement it in classes such as TGtk2Canvas,
TGtk2Window, and TGtk2WindowManager. Of course this would never happen, as
it would mean a complete rewrite of everything, but perhaps someday someone
might want to remake a new non Delphi compatible library from scratch for
FPC and carry forward with this idea.

For example:

ICanvas = interface
  function MoveTo(X, Y: Integer): Boolean;
  function LineTo(X, Y: Integer): Boolean;
  ...
end;

IWindow = interface
  function Show: Boolean;
  function Hide: Boolean;
  function GetBounds(out Rect: TRect): Boolean;
  function SetBounds(const Rect: TRect): Boolean;
  function GetText(out S: string): Boolean;
  function SetText(out S: string): Boolean;
  ...
end;

IWindowManager = interface
  function WindowCreate(const Params: TWindowParams; out W: IWindow):
Boolean;
  function WindowDestroy(W: IWindow): Boolean;
  function BringToFront(Window: IWindow): Boolean;
  function SendToBack(Window: IWindow): Boolean;
  function GetCursorPos(out P: TPoint): Boolean;
  function SetCursorPos(const P: TPoint): Boolean;
  ...
end;
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to