LCL Interface Redesign Idea

From Lazarus wiki
Revision as of 02:26, 4 April 2007 by AndrewH (talk | contribs) (Other possibilities)

This is current Idea for the structure of the interface and how it relates to handles


  • Fork a branch of lazarus/
  • Replace TWinControl.Handle with TWinControl.LCLHandle (there should exist no Handle yet)
  • Try to get the LCL compiled and maybe the IDE so it doesn't use the (inefficient) .Handle anymore
  • Introduce .Handle again, now as WSclass call
  • Merge the branches

The change to .Handle will not break existing code.

TWSxxWinControl.CreateHandle Returns a TLCLHandle

TLCLHandle = IInterface; // interfaces as com objects

TxxPrivate = class(TPrivate, TLCLHandle);

TGtkPrivateButton = class(TGtkBin, TLCLHandle);

All TWSxx. methods should be moved to the private class. for instance:

 class procedure TWSGtkWinControl.SetText(const AWinControl; const AText: String);
   PrivWinControl: TGtkPrivateWinControl;
   PrivWinControl := TGtkPrivateWinControl(AWinControl.LCLHandle);

Other possibilities

{$IFDEF X11} TGtkPrivateWidget = class(TGtkPrivate, ILCLHandle, IX11);


 (AWinControl.LCLHandle as IX11).XID

is possible