mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 10:59:29 +02:00
customdrawn-ws: Implements pixel setting, starts groupbox (not finished) and starts a new unit for customdrawncontrols descendents
git-svn-id: trunk@33988 -
This commit is contained in:
parent
f417352fd9
commit
19343e53bf
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5466,6 +5466,7 @@ lcl/interfaces/customdrawn/customdrawnobject_android.inc svneol=native#text/pasc
|
||||
lcl/interfaces/customdrawn/customdrawnobject_cocoa.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnobject_win.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnobject_x11.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnprivate.pas svneol=native#text/plain
|
||||
lcl/interfaces/customdrawn/customdrawnproc.pas svneol=native#text/plain
|
||||
lcl/interfaces/customdrawn/customdrawnwinapi.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnwinapi_android.inc svneol=native#text/pascal
|
||||
|
@ -181,12 +181,13 @@ type
|
||||
function AppRestoreStayOnTopFlags(const ASystemTopAlso: Boolean = False): Boolean; override;
|
||||
procedure AppSetMainFormOnTaskBar(const DoSet: Boolean); override;
|
||||
|
||||
(* function InitStockFont(AFont: TObject; AStockFont: TStockFont): Boolean; override;
|
||||
//function InitStockFont(AFont: TObject; AStockFont: TStockFont): Boolean; override;
|
||||
|
||||
procedure DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); override;
|
||||
function DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor; override;
|
||||
procedure DCRedraw(CanvasHandle: HDC); override;
|
||||
procedure SetDesigning(AComponent: TComponent); override; *)
|
||||
procedure DCSetAntialiasing(CanvasHandle: HDC; AEnabled: Boolean); override;
|
||||
procedure SetDesigning(AComponent: TComponent); override;
|
||||
|
||||
// create and destroy
|
||||
function CreateTimer(Interval: integer; TimerFunc: TWSTimerProc): THandle; override;
|
||||
|
@ -498,483 +498,51 @@ begin
|
||||
Result := inherited GetLCLCapability(ACapability);
|
||||
end;
|
||||
end;
|
||||
(*
|
||||
function TQtWidgetSet.DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor;
|
||||
|
||||
function TCDWidgetSet.DCGetPixel(CanvasHandle: HDC; X, Y: integer): TGraphicsColor;
|
||||
var
|
||||
Color: QColorH;
|
||||
LazCanvas: TLazCanvas;
|
||||
begin
|
||||
Result := clNone;
|
||||
|
||||
if not IsValidDC(CanvasHandle) then Exit;
|
||||
LazCanvas := TLazCanvas(CanvasHandle);
|
||||
|
||||
if (TQtDeviceContext(CanvasHandle).vImage <> nil) then
|
||||
begin
|
||||
Color := QColor_create(QImage_pixel(TQtDeviceContext(CanvasHandle).vImage.FHandle, X, Y));
|
||||
Result := RGBToColor(QColor_red(Color), QColor_green(Color), QColor_blue(Color));
|
||||
QColor_destroy(Color);
|
||||
end;
|
||||
Result := FPColorToTColor(LazCanvas.Colors[X, Y]);
|
||||
end;
|
||||
|
||||
procedure dbgcolor(msg: string; C:TQColor);
|
||||
begin
|
||||
debugLn(msg+' spec=%x alpha=%x r=%x g=%x b=%x pad=%x',[c.ColorSpec,c.Alpha,c.r,c.g,c.b,c.pad]);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor);
|
||||
procedure TCDWidgetSet.DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor);
|
||||
var
|
||||
ASavedColor: TQColor;
|
||||
Color: TQColor;
|
||||
Pen: QPenH;
|
||||
Painter: QPainterH;
|
||||
LazCanvas: TLazCanvas;
|
||||
begin
|
||||
if IsValidDC(CanvasHandle) then
|
||||
begin
|
||||
//WriteLn('TQtWidgetSet.DCSetPixel X=',X,' Y=',Y, ' AColor=',dbghex(AColor));
|
||||
Painter := TQtDeviceContext(CanvasHandle).Widget;
|
||||
Pen := QPainter_pen(Painter);
|
||||
QPen_color(Pen, @ASavedColor);
|
||||
QColor_fromRgb(@Color, ColorToRGB(AColor));
|
||||
QPainter_setPen(Painter, @Color);
|
||||
QPainter_drawPoint(Painter, X,Y);
|
||||
QPainter_setPen(Painter, @ASavedColor);
|
||||
end;
|
||||
if not IsValidDC(CanvasHandle) then Exit;
|
||||
LazCanvas := TLazCanvas(CanvasHandle);
|
||||
|
||||
LazCanvas.Colors[X, Y] := TColorToFPColor(AColor);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DCRedraw(CanvasHandle: HDC);
|
||||
procedure TCDWidgetSet.DCRedraw(CanvasHandle: HDC);
|
||||
begin
|
||||
// TODO: implement me
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DCSetAntialiasing(CanvasHandle: HDC; AEnabled: Boolean);
|
||||
var
|
||||
DC: TQtDeviceContext;
|
||||
procedure TCDWidgetSet.DCSetAntialiasing(CanvasHandle: HDC; AEnabled: Boolean);
|
||||
{var
|
||||
DC: TQtDeviceContext;}
|
||||
begin
|
||||
if IsValidDC(CanvasHandle) then
|
||||
{ if IsValidDC(CanvasHandle) then
|
||||
begin
|
||||
if CanvasHandle = 1 then
|
||||
DC := QtDefaultContext
|
||||
else
|
||||
DC := TQtDeviceContext(CanvasHandle);
|
||||
DC.setRenderHint(QPainterAntialiasing, AEnabled);
|
||||
end;
|
||||
end;}
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SetDesigning(AComponent: TComponent);
|
||||
procedure TCDWidgetSet.SetDesigning(AComponent: TComponent);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtWidgetSet.IsValidDC
|
||||
Params: DC - handle to a device context (TQtDeviceContext)
|
||||
Returns: True - if the DC is valid
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.IsValidDC(const DC: HDC): Boolean;
|
||||
begin
|
||||
Result := (DC <> 0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtWidgetSet.IsValidGDIObject
|
||||
Params: GDIObject - handle to a GDI Object (TQtFont, TQtBrush, etc)
|
||||
Returns: True - if the DC is valid
|
||||
|
||||
Remark: All handles for GDI objects must be pascal objects so we can
|
||||
distinguish between them
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.IsValidGDIObject(const GDIObject: HGDIOBJ): Boolean;
|
||||
var
|
||||
aObject: TObject;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if GDIObject = 0 then Exit;
|
||||
|
||||
aObject := TObject(GDIObject);
|
||||
try
|
||||
if aObject is TObject then
|
||||
begin
|
||||
Result :=
|
||||
(aObject is TQtFont) or
|
||||
(aObject is TQtBrush) or
|
||||
(aObject is TQtImage) or
|
||||
(aObject is TQtPen) or
|
||||
(aObject is TQtRegion);
|
||||
end;
|
||||
except
|
||||
DebugLn(['Gdi object: ', GDIObject, ' is not an object!']);
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.AddHandle(AHandle: TObject);
|
||||
begin
|
||||
System.EnterCriticalsection(CriticalSection);
|
||||
if not SavedHandlesList.HasId(AHandle) then
|
||||
SavedHandlesList.Add(AHandle, AHandle);
|
||||
System.LeaveCriticalsection(CriticalSection);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.RemoveHandle(AHandle: TObject);
|
||||
begin
|
||||
System.EnterCriticalsection(CriticalSection);
|
||||
if SavedHandlesList.HasId(AHandle) then
|
||||
SavedHandlesList.Delete(AHandle);
|
||||
System.LeaveCriticalsection(CriticalSection);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.IsValidHandle(AHandle: HWND): Boolean;
|
||||
begin
|
||||
if (AHandle = 0) then
|
||||
Exit(False);
|
||||
System.EnterCriticalsection(CriticalSection);
|
||||
Result := SavedHandlesList.HasId(TObject(AHandle));
|
||||
System.LeaveCriticalsection(CriticalSection);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.ClearGlobalActions;
|
||||
begin
|
||||
{$IFDEF QT_DEBUG_GLOBALACTIONS}
|
||||
writeln('TQtWidgetSet.ClearGlobalActions');
|
||||
{$ENDIF}
|
||||
FGlobalActions.Clear;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.AddGlobalAction(AnAction: QActionH);
|
||||
begin
|
||||
{$IFDEF QT_DEBUG_GLOBALACTIONS}
|
||||
writeln('TQtWidgetSet.AddGlobalAction() AnAction ',dbgHex(PtrUInt(AnAction)));
|
||||
{$ENDIF}
|
||||
FGlobalActions.Add(AnAction);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.ShortcutInGlobalActions(const AMnemonicText: WideString;
|
||||
out AGlobalActionIndex: Integer): Boolean;
|
||||
var
|
||||
NewKey: QKeySequenceH;
|
||||
NewStr: WideString;
|
||||
CurrentKey: QKeySequenceH;
|
||||
CurrentStr: WideString;
|
||||
Action: QActionH;
|
||||
i: Integer;
|
||||
begin
|
||||
{$IFDEF QT_DEBUG_GLOBALACTIONS}
|
||||
writeln('TQtWidgetSet.ShortcutInGlobalActions ',AMnemonicText);
|
||||
{$ENDIF}
|
||||
Result := False;
|
||||
AGlobalActionIndex := -1;
|
||||
NewKey := QKeySequence_create();
|
||||
try
|
||||
QKeySequence_fromString(NewKey, @AMnemonicText);
|
||||
NewStr := '';
|
||||
QKeySequence_toString(NewKey, @NewStr);
|
||||
|
||||
{$IFDEF QT_DEBUG_GLOBALACTIONS}
|
||||
writeln('TQtWidgetSet.ShortcutInGlobalActions new seq=',NewStr);
|
||||
{$ENDIF}
|
||||
|
||||
for i := 0 to FGlobalActions.Count - 1 do
|
||||
begin
|
||||
Action := QActionH(FGlobalActions.Items[i]);
|
||||
CurrentStr := '';
|
||||
QAction_text(Action, @CurrentStr);
|
||||
CurrentKey := QKeySequence_create();
|
||||
try
|
||||
QKeySequence_mnemonic(CurrentKey, @CurrentStr);
|
||||
if not QKeySequence_isEmpty(CurrentKey) then
|
||||
begin
|
||||
QKeySequence_toString(CurrentKey, @CurrentStr);
|
||||
{$IFDEF QT_DEBUG_GLOBALACTIONS}
|
||||
writeln('TQtWidgetSet.ShortcutInGlobalActions CurrentKey ',
|
||||
CurrentStr,' NewKey ',NewStr,' Result ? ',CurrentStr = NewStr);
|
||||
{$ENDIF}
|
||||
Result := CurrentStr = NewStr;
|
||||
AGlobalActionIndex := i;
|
||||
if Result then
|
||||
break;
|
||||
end;
|
||||
finally
|
||||
QKeySequence_destroy(CurrentKey);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
QKeySequence_destroy(NewKey);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.TriggerGlobalAction(const ActionIndex: Integer);
|
||||
var
|
||||
Action: QActionH;
|
||||
MainWin: TQtMainWindow;
|
||||
begin
|
||||
Action := QActionH(FGlobalActions[ActionIndex]);
|
||||
if (Action <> nil) and Assigned(Application.MainForm) and
|
||||
(Application.MainForm.HandleAllocated) then
|
||||
begin
|
||||
MainWin := TQtMainWindow(Application.MainForm.Handle);
|
||||
MainWin.Activate;
|
||||
QMenuBar_setActiveAction(QMenuBarH(MainWin.MenuBar.Widget), Action);
|
||||
end;
|
||||
end;
|
||||
|
||||
{Params: HWND
|
||||
This function is needed by cache used in TQtWidgetSet.WindowFromPoint().
|
||||
Returns: True if we are cached (FLastWFPResult).
|
||||
}
|
||||
function TQtWidgetSet.IsWidgetAtCache(AHandle: HWND): Boolean;
|
||||
begin
|
||||
Result := AHandle = FLastWFPResult;
|
||||
end;
|
||||
|
||||
{Params: none
|
||||
Invalidates TQtWidgetSet.WindowFromPoint() cache (FLastWFPResult).
|
||||
Returns: nothing
|
||||
}
|
||||
procedure TQtWidgetSet.InvalidateWidgetAtCache;
|
||||
begin
|
||||
FLastWFPResult := 0;
|
||||
end;
|
||||
|
||||
{Params: none
|
||||
Returns: True if last cached FLastWFPResult is valid otherwise False.
|
||||
}
|
||||
function TQtWidgetSet.IsValidWidgetAtCachePointer: Boolean;
|
||||
begin
|
||||
if FLastWFPResult = 0 then
|
||||
exit(False);
|
||||
Result := IsValidHandle(FLastWFPResult);
|
||||
end;
|
||||
|
||||
{Params: none
|
||||
Returns last cached FLastWFPMousePos
|
||||
Returns: TPoint
|
||||
}
|
||||
function TQtWidgetSet.GetWidgetAtCachePoint: TPoint;
|
||||
begin
|
||||
Result := FLastWFPMousePos;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.DragImageList_BeginDrag(AImage: QImageH;
|
||||
AHotSpot: TPoint): Boolean;
|
||||
var
|
||||
ASize: TSize;
|
||||
APixmap: QPixmapH;
|
||||
AMask: QBitmapH;
|
||||
ABrush: QBrushH;
|
||||
APalette: QPaletteH;
|
||||
begin
|
||||
if FDragImageList = nil then
|
||||
begin
|
||||
FDragImageList := QWidget_create(nil,
|
||||
QtSubWindow or QtFramelessWindowHint or QtWindowStaysOnTopHint);
|
||||
|
||||
// do not set focus and do not activate this widget
|
||||
QWidget_setFocusPolicy(FDragImageList, QtNoFocus);
|
||||
QWidget_setAttribute(FDragImageList, QtWA_ShowWithoutActivating, True);
|
||||
|
||||
QImage_size(AImage, @ASize);
|
||||
QWidget_setFixedSize(FDragImageList, @ASize);
|
||||
APixmap := QPixmap_create();
|
||||
QPixmap_fromImage(APixmap, AImage);
|
||||
AMask := QBitmap_create();
|
||||
QPixmap_mask(APixmap, AMask);
|
||||
QWidget_setMask(FDragImageList, AMask);
|
||||
ABrush := QBrush_create(AImage);
|
||||
APalette := QWidget_palette(FDragImageList);
|
||||
QPalette_setBrush(APalette, QPaletteWindow, ABrush);
|
||||
QBrush_destroy(ABrush);
|
||||
QBitmap_destroy(AMask);
|
||||
QPixmap_destroy(APixmap);
|
||||
|
||||
QWidget_setAutoFillBackground(FDragImageList, True);
|
||||
|
||||
FDragHotSpot := AHotSpot;
|
||||
end;
|
||||
Result := FDragImageList <> nil;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DragImageList_EndDrag;
|
||||
begin
|
||||
if FDragImageList <> nil then
|
||||
begin
|
||||
QObject_deleteLater(FDragImageList);
|
||||
FDragImageList := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.DragImageList_DragMove(X, Y: Integer): Boolean;
|
||||
begin
|
||||
Result := FDragImageList <> nil;
|
||||
if Result then
|
||||
begin
|
||||
QWidget_raise(FDragImageList);
|
||||
QWidget_move(FDragImageList, X - FDragHotSpot.X, Y - FDragHotSpot.Y);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.DragImageList_SetVisible(NewVisible: Boolean): Boolean;
|
||||
begin
|
||||
Result := FDragImageList <> nil;
|
||||
if Result then
|
||||
QWidget_setVisible(FDragImageList, NewVisible);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: CreateDefaultFont
|
||||
Params: none
|
||||
Returns: a TQtFont object
|
||||
|
||||
Creates an default font, used for initial values
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.CreateDefaultFont: HFONT;
|
||||
var
|
||||
QtFont: TQtFont;
|
||||
begin
|
||||
QtFont := TQtFont.Create(True);
|
||||
QtFont.FShared := True;
|
||||
QApplication_font(QtFont.FHandle);
|
||||
Result := HFONT(QtFont);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.GetDefaultAppFontName: WideString;
|
||||
begin
|
||||
Result := FDefaultAppFontName;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DeleteDefaultDC;
|
||||
begin
|
||||
if FStockDefaultDC <> 0 then
|
||||
TQtDeviceContext(FStockDefaultDC).Free;
|
||||
FStockDefaultDC := 0;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.FreeStockItems;
|
||||
|
||||
procedure DeleteAndNilObject(var h: HGDIOBJ);
|
||||
begin
|
||||
if h <> 0 then
|
||||
TQtResource(h).FShared := False;
|
||||
DeleteObject(h);
|
||||
h := 0;
|
||||
end;
|
||||
|
||||
begin
|
||||
DeleteAndNilObject(FStockNullBrush);
|
||||
DeleteAndNilObject(FStockBlackBrush);
|
||||
DeleteAndNilObject(FStockLtGrayBrush);
|
||||
DeleteAndNilObject(FStockGrayBrush);
|
||||
DeleteAndNilObject(FStockDkGrayBrush);
|
||||
DeleteAndNilObject(FStockWhiteBrush);
|
||||
|
||||
DeleteAndNilObject(FStockNullPen);
|
||||
DeleteAndNilObject(FStockBlackPen);
|
||||
DeleteAndNilObject(FStockWhitePen);
|
||||
|
||||
DeleteAndNilObject(FStockSystemFont);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.FreeSysColorBrushes(const AInvalidateHandlesOnly: Boolean = False);
|
||||
|
||||
procedure DeleteAndNilObject(var h: HGDIOBJ);
|
||||
begin
|
||||
if h <> 0 then
|
||||
begin
|
||||
TQtResource(h).FShared := False;
|
||||
DeleteObject(h);
|
||||
h := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure InvalidateHandleOnly(AIndex: Integer; h: HGDIOBJ);
|
||||
begin
|
||||
if (h <> 0) and (TQtBrush(h).FHandle <> nil) then
|
||||
begin
|
||||
QBrush_destroy(TQtBrush(h).FHandle);
|
||||
TQtBrush(h).FHandle := nil;
|
||||
getSysColorBrush(AIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := Low(FSysColorBrushes) to High(FSysColorBrushes) do
|
||||
if AInvalidateHandlesOnly then
|
||||
InvalidateHandleOnly(i, FSysColorBrushes[i])
|
||||
else
|
||||
DeleteAndNilObject(FSysColorBrushes[i]);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.GetQtDefaultDC: HDC;
|
||||
begin
|
||||
Result := FStockDefaultDC;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SetQtDefaultDC(Handle: HDC);
|
||||
begin
|
||||
FStockDefaultDC := Handle;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.InitStockItems;
|
||||
var
|
||||
LogBrush: TLogBrush;
|
||||
logPen : TLogPen;
|
||||
begin
|
||||
FillChar(LogBrush,SizeOf(TLogBrush),0);
|
||||
LogBrush.lbStyle := BS_NULL;
|
||||
FStockNullBrush := CreateBrushIndirect(LogBrush);
|
||||
TQtBrush(FStockNullBrush).FShared := True;
|
||||
|
||||
LogBrush.lbStyle := BS_SOLID;
|
||||
LogBrush.lbColor := $000000;
|
||||
FStockBlackBrush := CreateBrushIndirect(LogBrush);
|
||||
TQtBrush(FStockBlackBrush).FShared := True;
|
||||
|
||||
LogBrush.lbColor := $C0C0C0;
|
||||
FStockLtGrayBrush := CreateBrushIndirect(LogBrush);
|
||||
TQtBrush(FStockLtGrayBrush).FShared := True;
|
||||
|
||||
LogBrush.lbColor := $808080;
|
||||
FStockGrayBrush := CreateBrushIndirect(LogBrush);
|
||||
TQtBrush(FStockGrayBrush).FShared := True;
|
||||
|
||||
LogBrush.lbColor := $404040;
|
||||
FStockDkGrayBrush := CreateBrushIndirect(LogBrush);
|
||||
TQtBrush(FStockDkGrayBrush).FShared := True;
|
||||
|
||||
LogBrush.lbColor := $FFFFFF;
|
||||
FStockWhiteBrush := CreateBrushIndirect(LogBrush);
|
||||
TQtBrush(FStockWhiteBrush).FShared := True;
|
||||
|
||||
LogPen.lopnStyle := PS_NULL;
|
||||
LogPen.lopnWidth := Point(0, 0); // create cosmetic pens
|
||||
LogPen.lopnColor := $FFFFFF;
|
||||
FStockNullPen := CreatePenIndirect(LogPen);
|
||||
TQtPen(FStockNullPen).FShared := True;
|
||||
|
||||
LogPen.lopnStyle := PS_SOLID;
|
||||
FStockWhitePen := CreatePenIndirect(LogPen);
|
||||
TQtPen(FStockWhitePen).FShared := True;
|
||||
|
||||
LogPen.lopnColor := $000000;
|
||||
FStockBlackPen := CreatePenIndirect(LogPen);
|
||||
TQtPen(FStockBlackPen).FShared := True;
|
||||
|
||||
FStockSystemFont := 0; // styles aren't initialized yet
|
||||
|
||||
FStockDefaultDC := 0; // app must be initialized
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.ClearCachedColors;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to High(FCachedColors) do
|
||||
begin
|
||||
if FCachedColors[i] <> nil then
|
||||
FreeMem(FCachedColors[i]);
|
||||
FCachedColors[i] := nil;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
61
lcl/interfaces/customdrawn/customdrawnprivate.pas
Normal file
61
lcl/interfaces/customdrawn/customdrawnprivate.pas
Normal file
@ -0,0 +1,61 @@
|
||||
unit customdrawnprivate;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
// rtl+ftl
|
||||
Types, Classes, SysUtils,
|
||||
// LCL
|
||||
stdctrls, extctrls, comctrls, customdrawncontrols;
|
||||
|
||||
type
|
||||
{ TCDIntfButton }
|
||||
|
||||
TCDIntfButton = class(TCDButton)
|
||||
public
|
||||
LCLControl: TButton;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure HandleOnClick(Sender: TObject);
|
||||
end;
|
||||
|
||||
{ TCDIntfGroupBox }
|
||||
|
||||
TCDIntfGroupBox = class(TCDGroupBox)
|
||||
public
|
||||
LCLControl: TGroupBox;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure HandleOnClick(Sender: TObject);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TCDIntfButton }
|
||||
|
||||
constructor TCDIntfButton.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
OnClick := @HandleOnClick;
|
||||
end;
|
||||
|
||||
procedure TCDIntfButton.HandleOnClick(Sender: TObject);
|
||||
begin
|
||||
LCLControl.OnClick(LCLControl);
|
||||
end;
|
||||
|
||||
{ TCDIntfGroupBox }
|
||||
|
||||
constructor TCDIntfGroupBox.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
OnClick := @HandleOnClick;
|
||||
end;
|
||||
|
||||
procedure TCDIntfGroupBox.HandleOnClick(Sender: TObject);
|
||||
begin
|
||||
LCLControl.OnClick(LCLControl);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -261,8 +261,8 @@ end;
|
||||
|
||||
function RegisterCustomGroupBox: Boolean; alias : 'WSRegisterCustomGroupBox';
|
||||
begin
|
||||
// RegisterWSComponent(TCustomGroupBox, TWinCEWSCustomGroupBox);
|
||||
Result := False;
|
||||
RegisterWSComponent(TCustomGroupBox, TCDWSCustomGroupBox);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function RegisterCustomComboBox: Boolean; alias : 'WSRegisterCustomComboBox';
|
||||
|
@ -34,7 +34,8 @@ uses
|
||||
Classes, Types, StdCtrls, Controls, Forms, SysUtils, InterfaceBase, LCLType,
|
||||
customdrawncontrols,
|
||||
// Widgetset
|
||||
WSProc, WSStdCtrls, WSLCLClasses, CustomDrawnWsControls, customdrawnproc;
|
||||
WSProc, WSStdCtrls, WSLCLClasses, CustomDrawnWsControls, customdrawnproc,
|
||||
customdrawnprivate;
|
||||
|
||||
type
|
||||
|
||||
@ -52,12 +53,15 @@ type
|
||||
{ TCDWSCustomGroupBox }
|
||||
|
||||
TCDWSCustomGroupBox = class(TWSCustomGroupBox)
|
||||
public
|
||||
class procedure CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||
published
|
||||
{ class function CreateHandle(const AWinControl: TWinControl;
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function GetDefaultClientRect(const AWinControl: TWinControl;
|
||||
{ class function GetDefaultClientRect(const AWinControl: TWinControl;
|
||||
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
|
||||
): boolean; override;}
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
end;
|
||||
|
||||
{ TCDWSGroupBox }
|
||||
@ -192,15 +196,6 @@ type
|
||||
published
|
||||
end;
|
||||
|
||||
{ TCDIntfButton }
|
||||
|
||||
TCDIntfButton = class(TCDButton)
|
||||
public
|
||||
LCLButton: TButton;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure HandleOnClick(Sender: TObject);
|
||||
end;
|
||||
|
||||
{ TCDWSButton }
|
||||
|
||||
TCDWSButton = class(TWSButton)
|
||||
@ -280,19 +275,6 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{ TCDIntfButton }
|
||||
|
||||
constructor TCDIntfButton.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
OnClick := @HandleOnClick;
|
||||
end;
|
||||
|
||||
procedure TCDIntfButton.HandleOnClick(Sender: TObject);
|
||||
begin
|
||||
LCLButton.OnClick(LCLButton);
|
||||
end;
|
||||
|
||||
{ TCDWSScrollBar }
|
||||
|
||||
(*{------------------------------------------------------------------------------
|
||||
@ -1100,7 +1082,7 @@ end;*)
|
||||
class procedure TCDWSButton.CreateCDControl(const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||
begin
|
||||
ACDControlField := TCDIntfButton.Create(AWinControl);
|
||||
TCDIntfButton(ACDControlField).LCLButton := TButton(AWinControl);
|
||||
TCDIntfButton(ACDControlField).LCLControl := TButton(AWinControl);
|
||||
ACDControlField.Caption := AWinControl.Caption;
|
||||
ACDControlField.Parent := AWinControl;
|
||||
ACDControlField.Align := alClient;
|
||||
@ -1250,10 +1232,20 @@ begin
|
||||
QtRadioButton.AttachEvents;
|
||||
|
||||
Result := TLCLIntfHandle(QtRadioButton);
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{ TCDWSCustomGroupBox }
|
||||
|
||||
class procedure TCDWSCustomGroupBox.CreateCDControl(
|
||||
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||
begin
|
||||
ACDControlField := TCDIntfGroupBox.Create(AWinControl);
|
||||
TCDIntfButton(ACDControlField).LCLControl := TButton(AWinControl);
|
||||
ACDControlField.Caption := AWinControl.Caption;
|
||||
ACDControlField.Parent := AWinControl;
|
||||
ACDControlField.Align := alClient;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCDWSCustomGroupBox.CreateHandle
|
||||
Params: None
|
||||
@ -1264,15 +1256,13 @@ end;
|
||||
class function TCDWSCustomGroupBox.CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle;
|
||||
var
|
||||
QtGroupBox: TQtGroupBox;
|
||||
lCDWinControl: TCDWinControl;
|
||||
begin
|
||||
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
||||
QtGroupBox.AttachEvents;
|
||||
|
||||
Result := TLCLIntfHandle(QtGroupBox);
|
||||
Result := TCDWSWinControl.CreateHandle(AWinControl, AParams);
|
||||
lCDWinControl := TCDWinControl(Result);
|
||||
end;
|
||||
|
||||
class function TCDWSCustomGroupBox.GetDefaultClientRect(
|
||||
(*class function TCDWSCustomGroupBox.GetDefaultClientRect(
|
||||
const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer;
|
||||
var aClientRect: TRect): boolean;
|
||||
var
|
||||
@ -1293,9 +1283,21 @@ begin
|
||||
Max(0, aHeight - dy));
|
||||
Result:=true;
|
||||
end;
|
||||
end;*)
|
||||
|
||||
class procedure TCDWSCustomGroupBox.ShowHide(const AWinControl: TWinControl);
|
||||
var
|
||||
lCDWinControl: TCDWinControl;
|
||||
begin
|
||||
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
||||
|
||||
TCDWSWinControl.ShowHide(AWinControl);
|
||||
|
||||
if lCDWinControl.CDControl = nil then
|
||||
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
||||
end;
|
||||
|
||||
{ TCDWSCustomComboBox }
|
||||
(*{ TCDWSCustomComboBox }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCDWSCustomComboBox.CreateHandle
|
||||
|
@ -114,7 +114,7 @@ end;"/>
|
||||
<License Value="modified LGPL-2
|
||||
"/>
|
||||
<Version Major="1" Release="1"/>
|
||||
<Files Count="383">
|
||||
<Files Count="384">
|
||||
<Item1>
|
||||
<Filename Value="carbon/agl.pp"/>
|
||||
<AddToUsesPkgSection Value="False"/>
|
||||
@ -1903,6 +1903,11 @@ end;"/>
|
||||
<AddToUsesPkgSection Value="False"/>
|
||||
<UnitName Value="CustomDrawnWSExtCtrls"/>
|
||||
</Item383>
|
||||
<Item384>
|
||||
<Filename Value="customdrawn/customdrawnprivate.pas"/>
|
||||
<AddToUsesPkgSection Value="False"/>
|
||||
<UnitName Value="customdrawnprivate"/>
|
||||
</Item384>
|
||||
</Files>
|
||||
<LazDoc Paths="../../docs/xml/lcl"/>
|
||||
<i18n>
|
||||
|
Loading…
Reference in New Issue
Block a user