mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 01:09:14 +02:00
customdrawnws: Adds skeleton for winapi/lclintf
git-svn-id: trunk@33664 -
This commit is contained in:
parent
3eb98c1723
commit
e6a076911a
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -5420,10 +5420,14 @@ lcl/interfaces/customdrawn/cocoaprivate.pas svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/cocoautils.pas svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawndefines.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnint.pas svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnlclintf.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnlclintfh.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnobject.inc svneol=native#text/pascal
|
||||
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/customdrawnwinapi.inc svneol=native#text/pascal
|
||||
lcl/interfaces/customdrawn/customdrawnwinapih.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
|
||||
|
@ -170,8 +170,8 @@ type
|
||||
function CreateTimer(Interval: integer; TimerFunc: TWSTimerProc): THandle; override;
|
||||
function DestroyTimer(TimerHandle: THandle): boolean; override;
|
||||
|
||||
// {$I win32winapih.inc}
|
||||
// {$I win32lclintfh.inc}
|
||||
{$I customdrawnwinapih.inc}
|
||||
{$I customdrawnlclintfh.inc}
|
||||
end;
|
||||
|
||||
var
|
||||
@ -196,11 +196,11 @@ uses
|
||||
Win32Extra,} LCLMessageGlue;
|
||||
|
||||
|
||||
//{$I win32winapi.inc}
|
||||
//{$I win32lclintf.inc}
|
||||
|
||||
{$I customdrawnobject.inc}
|
||||
|
||||
{$I customdrawnwinapi.inc}
|
||||
{$I customdrawnlclintf.inc}
|
||||
|
||||
{$ifdef CD_Windows}
|
||||
{$include wincallback.inc}
|
||||
{$I customdrawnobject_win.inc}
|
||||
|
890
lcl/interfaces/customdrawn/customdrawnlclintf.inc
Normal file
890
lcl/interfaces/customdrawn/customdrawnlclintf.inc
Normal file
@ -0,0 +1,890 @@
|
||||
{%MainUnit qtint.pp}
|
||||
{ $Id: qtlclintf.inc 33289 2011-11-04 10:31:30Z zeljko $ }
|
||||
|
||||
{******************************************************************************
|
||||
All QT interface support routines
|
||||
Initial Revision : Sat Jan 17 19:00:00 2004
|
||||
|
||||
|
||||
!! Keep alphabetical !!
|
||||
|
||||
Support routines go to qtproc.pp
|
||||
|
||||
******************************************************************************
|
||||
Implementation
|
||||
******************************************************************************
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
|
||||
//##apiwiz##sps## // Do not remove
|
||||
|
||||
{
|
||||
This is the common cdecl callback function used for Qt4
|
||||
QSocketNotifier activated.
|
||||
}
|
||||
(*
|
||||
|
||||
procedure TQtWidgetSet.SocketNotifierRead_cb(aSocket: Integer); cdecl;
|
||||
var
|
||||
wheh: PWaitHandleEventHandler;
|
||||
begin
|
||||
if FSocketEventMap.GetData(aSocket, wheh) then
|
||||
wheh^.user_callback(wheh^.udata, EVE_IO_READ);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SocketNotifierWrite_cb(aSocket: Integer); cdecl;
|
||||
var
|
||||
wheh: PWaitHandleEventHandler;
|
||||
begin
|
||||
if FSocketEventMap.GetData(aSocket, wheh) then
|
||||
wheh^.user_callback(wheh^.udata, EVE_IO_WRITE);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SocketNotifierError_cb(aSocket: Integer); cdecl;
|
||||
var
|
||||
wheh: PWaitHandleEventHandler;
|
||||
begin
|
||||
if FSocketEventMap.GetData(aSocket, wheh) then
|
||||
wheh^.user_callback(wheh^.udata, EVE_IO_ERROR);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||
AEventHandler: TWaitHandleEvent; AData: PtrInt): PEventHandler;
|
||||
{
|
||||
QSocketNotifier requires 1 notifier per event type
|
||||
and doesn't provide userdata in the callback. We need to
|
||||
make a map of socket -> userdata to store userdata
|
||||
and also create 3 notifiers for each event. We also need to
|
||||
use our own constants for the event types in the userland callback.
|
||||
For simplicity same as GTK G_IO values are used here and
|
||||
their ORs will be emulated. The callback will always only get
|
||||
1 event tho.
|
||||
}
|
||||
|
||||
function CreateQt4NotifierRec(aNR: PWaitHandleEventHandler;
|
||||
const aType: QSocketNotifierType; aCallback: QSocketNotifier_activated_Event): PWaitHandleEventHandler;
|
||||
var
|
||||
qsn: QSocketNotifierH;
|
||||
qsn_hook: QSocketNotifier_hookH;
|
||||
i: QSocketNotifierType;
|
||||
begin
|
||||
if aNR = nil then begin
|
||||
Result := new(PWaitHandleEventHandler);
|
||||
for i := QSocketNotifierRead to QSocketNotifierException do begin
|
||||
Result^.qsn[i] := nil; // nil them so removeeventhandler can find out what to free
|
||||
Result^.qsn_hook[i] := nil;
|
||||
end;
|
||||
end else
|
||||
Result := aNR;
|
||||
|
||||
qsn := QSocketNotifier_create(aHandle, aType);
|
||||
qsn_hook := QSocketNotifier_hook_create(qsn);
|
||||
QSocketNotifier_hook_hook_activated(qsn_hook, aCallback); // todo: !!
|
||||
|
||||
Result^.qsn[aType] := qsn;
|
||||
Result^.qsn_hook[aType] := qsn_hook;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result := nil;
|
||||
|
||||
if AFlags and (EVE_IO_READ or EVE_IO_WRITE or EVE_IO_ERROR) = 0 then
|
||||
Exit; // no flag set, no dice
|
||||
|
||||
if AFlags and EVE_IO_READ = EVE_IO_READ then
|
||||
Result := CreateQt4NotifierRec(Result, QSocketNotifierRead, @SocketNotifierRead_cb);
|
||||
|
||||
if AFlags and EVE_IO_WRITE = EVE_IO_WRITE then
|
||||
Result := CreateQt4NotifierRec(Result, QSocketNotifierWrite, @SocketNotifierWrite_cb);
|
||||
|
||||
if AFlags and EVE_IO_ERROR = EVE_IO_ERROR then
|
||||
Result := CreateQt4NotifierRec(Result, QSocketNotifierException, @SocketNotifierError_cb);
|
||||
|
||||
PWaitHandleEventHandler(Result)^.user_callback := AEventHandler;
|
||||
PWaitHandleEventHandler(Result)^.udata := aData;
|
||||
PWaitHandleEventHandler(Result)^.socket := AHandle;
|
||||
|
||||
if FSocketEventMap.HasId(aHandle) then begin // if we encounter this (shouldn't happen)
|
||||
Debugln('TQtWidgetSet.AddEventHandler Duplicate handle: ' + IntToStr(aHandle));
|
||||
FSocketEventMap.Delete(aHandle); // delete the previous one, potentially losing it..
|
||||
end;
|
||||
FSocketEventMap.Add(AHandle, Result);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.AddPipeEventHandler(AHandle: THandle;
|
||||
AEventHandler: TPipeEvent; AData: PtrInt): PPipeEventHandler;
|
||||
begin
|
||||
// todo
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.AddProcessEventHandler(AHandle: THandle;
|
||||
AEventHandler: TChildExitEvent; AData: PtrInt): PProcessEventHandler;
|
||||
begin
|
||||
// todo
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.AskUser(const DialogCaption, DialogMessage: string;
|
||||
DialogType: LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
|
||||
const
|
||||
ButtonResults : array[mrNone..mrYesToAll] of Longint = (
|
||||
-1, idButtonOK, idButtonCancel, idButtonAbort, idButtonRetry,
|
||||
idButtonIgnore, idButtonYes,idButtonNo, idButtonAll, idButtonNoToAll,
|
||||
idButtonYesToAll);
|
||||
var
|
||||
BtnIdx, BtnID: LongInt;
|
||||
QtMessageBox: TQtMessageBox;
|
||||
begin
|
||||
ReleaseCapture;
|
||||
QtMessageBox := TQtMessageBox.Create(nil);
|
||||
QtMessageBox.AttachEvents;
|
||||
try
|
||||
{Convert LCL "id" button values to Qt values}
|
||||
for BtnIdx := 0 to Buttons.Count - 1 do
|
||||
begin
|
||||
with Buttons[BtnIdx] do
|
||||
begin
|
||||
if (ModalResult >= Low(ButtonResults)) and (ModalResult <= High(ButtonResults)) then
|
||||
BtnID := ButtonResults[ModalResult]
|
||||
else
|
||||
BtnID := -1;
|
||||
if (BtnID >= Low(IdButtonToQtStandardButton)) and
|
||||
(BtnID <= High(IdButtonToQtStandardButton)) and
|
||||
(IdButtonToQtStandardButton[BtnID] <> QMessageBoxNoButton) then
|
||||
QtMessageBox.AddButton(Caption, IdButtonToQtStandardButton[BtnID], ModalResult, Default, Cancel)
|
||||
else
|
||||
QtMessageBox.AddButton(Caption, ModalResult, Default, Cancel);
|
||||
end;
|
||||
end;
|
||||
|
||||
if DialogCaption <> '' then
|
||||
QtMessageBox.Title := DialogCaption
|
||||
else
|
||||
case DialogType of
|
||||
idDialogWarning: QtMessageBox.Title := rsMtWarning;
|
||||
idDialogError: QtMessageBox.Title := rsMtError;
|
||||
idDialogInfo : QtMessageBox.Title := rsMtInformation;
|
||||
idDialogConfirm : QtMessageBox.Title := rsMtConfirmation;
|
||||
end;
|
||||
|
||||
QtMessageBox.MessageStr := DialogMessage;
|
||||
|
||||
case DialogType of
|
||||
idDialogWarning: QtMessageBox.MsgBoxType := QMessageBoxWarning;
|
||||
idDialogError: QtMessageBox.MsgBoxType := QMessageBoxCritical;
|
||||
idDialogInfo : QtMessageBox.MsgBoxType := QMessageBoxInformation;
|
||||
idDialogConfirm : QtMessageBox.MsgBoxType := QMessageBoxQuestion;
|
||||
else
|
||||
QtMessageBox.MsgBoxType := QMessageBoxNoIcon;
|
||||
end;
|
||||
|
||||
Result := QtMessageBox.exec;
|
||||
finally
|
||||
QtMessageBox.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: CreateEmptyRegion
|
||||
Params:
|
||||
Returns: valid empty region
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.CreateEmptyRegion: hRGN;
|
||||
begin
|
||||
Result:= HRGN(TQtRegion.Create(True));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: CreateStandardCursor
|
||||
Params:
|
||||
Returns:
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.CreateStandardCursor(ACursor: SmallInt): HCURSOR;
|
||||
var
|
||||
CursorShape: QtCursorShape;
|
||||
begin
|
||||
Result := 0;
|
||||
if ACursor < crLow then Exit;
|
||||
if ACursor > crHigh then Exit;
|
||||
|
||||
// TODO: map is better
|
||||
case ACursor of
|
||||
crNone : CursorShape := QtBlankCursor;
|
||||
crArrow : CursorShape := QtArrowCursor;
|
||||
crCross : CursorShape := QtCrossCursor;
|
||||
crIBeam : CursorShape := QtIBeamCursor;
|
||||
crSizeAll : CursorShape := QtSizeAllCursor;
|
||||
crSizeNESW : CursorShape := QtSizeBDiagCursor;
|
||||
crSizeNS : CursorShape := QtSizeVerCursor;
|
||||
crSizeNWSE : CursorShape := QtSizeFDiagCursor;
|
||||
crSizeWE : CursorShape := QtSizeHorCursor;
|
||||
crSizeNW : CursorShape := QtSizeFDiagCursor;
|
||||
crSizeN : CursorShape := QtSizeVerCursor;
|
||||
crSizeNE : CursorShape := QtSizeBDiagCursor;
|
||||
crSizeW : CursorShape := QtSizeHorCursor;
|
||||
crSizeE : CursorShape := QtSizeHorCursor;
|
||||
crSizeSW : CursorShape := QtSizeBDiagCursor;
|
||||
crSizeS : CursorShape := QtSizeVerCursor;
|
||||
crSizeSE : CursorShape := QtSizeFDiagCursor;
|
||||
crUpArrow : CursorShape := QtUpArrowCursor;
|
||||
crHourGlass : CursorShape := QtWaitCursor;
|
||||
crHSplit : CursorShape := QtSplitHCursor;
|
||||
crVSplit : CursorShape := QtSplitVCursor;
|
||||
crNo : CursorShape := QtForbiddenCursor;
|
||||
crAppStart : CursorShape := QtBusyCursor;
|
||||
crHelp : CursorShape := QtWhatsThisCursor;
|
||||
crHandPoint : CursorShape := QtPointingHandCursor;
|
||||
else
|
||||
CursorShape := QtCursorShape(-1);
|
||||
end;
|
||||
if CursorShape <> QtCursorShape(-1) then
|
||||
Result := HCURSOR(TQtCursor.Create(CursorShape));
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.CreateRubberBand(const ARect: TRect; const ABrush: HBrush): HWND;
|
||||
begin
|
||||
// todo: think of ABrush
|
||||
Result := HWND(QRubberBand_create(QRubberBandRectangle));
|
||||
QRubberBand_setGeometry(QRubberBandH(Result), @ARect);
|
||||
QWidget_show(QRubberBandH(Result));
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation);
|
||||
begin
|
||||
if FDockImage = nil then
|
||||
FDockImage := QRubberBand_create(QRubberBandRectangle);
|
||||
|
||||
QRubberBand_setGeometry(FDockImage, @ANewRect);
|
||||
case AOperation of
|
||||
disShow: QWidget_show(FDockImage);
|
||||
disHide: QWidget_hide(FDockImage);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer);
|
||||
var
|
||||
QtDC: TQtDeviceContext absolute DC;
|
||||
X, Y: Integer;
|
||||
W, H: Integer;
|
||||
begin
|
||||
if not IsValidDC(DC) then
|
||||
exit;
|
||||
QtDC.save;
|
||||
try
|
||||
W := (R.Right - R.Left - 1) div DX;
|
||||
H := (R.Bottom - R.Top - 1) div DY;
|
||||
|
||||
for X := 0 to W do
|
||||
for Y := 0 to H do
|
||||
QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1);
|
||||
finally
|
||||
QtDC.restore;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.DestroyRubberBand(ARubberBand: HWND);
|
||||
begin
|
||||
QWidget_destroy(QRubberBandH(ARubberBand));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: FontCanUTF8
|
||||
Params:
|
||||
Returns:
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.FontCanUTF8(Font: HFont): Boolean;
|
||||
begin
|
||||
Result := IsValidGDIObject(Font);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: FontIsMonoSpace
|
||||
Params:
|
||||
Returns:
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.FontIsMonoSpace(Font: HFont): Boolean;
|
||||
var
|
||||
QtFontInfo: QFontInfoH;
|
||||
begin
|
||||
Result := IsValidGDIObject(Font);
|
||||
if Result then
|
||||
begin
|
||||
QtFontInfo := QFontInfo_create(TQtFont(Font).FHandle);
|
||||
try
|
||||
Result := QFontInfo_fixedPitch(QtFontInfo);
|
||||
finally
|
||||
QFontInfo_destroy(QtFontInfo);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TQtWidgetSet.GetDesignerDC(WindowHandle: HWND): HDC;
|
||||
var
|
||||
Widget: TQtWidget;
|
||||
begin
|
||||
Widget := TQtWidget(WindowHandle);
|
||||
|
||||
if (Widget <> nil) and (Widget is TQtDesignWidget) then
|
||||
Result := TQtDesignWidget(Widget).DesignContext
|
||||
else
|
||||
Result := 0;
|
||||
|
||||
if Result = 0 then
|
||||
Result := GetDC(WindowHandle);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: IntfSendsUTF8KeyPress
|
||||
Params:
|
||||
Returns:
|
||||
------------------------------------------------------------------------------}
|
||||
|
||||
function TQtWidgetSet.IntfSendsUTF8KeyPress: boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean;
|
||||
begin
|
||||
Result := (WindowHandle <> 0) and (TQtWidget(WindowHandle) is TQtDesignWidget);
|
||||
if Result then
|
||||
Result := TQtDesignWidget(WindowHandle).DesignContext = DC;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: PromptUser
|
||||
Params:
|
||||
Returns:
|
||||
|
||||
Note: Qt appears to map Esc key to Cancel button, so no need for EscapeResult.
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.PromptUser(const DialogCaption : string;
|
||||
const DialogMessage : string;
|
||||
DialogType : LongInt;
|
||||
Buttons : PLongInt;
|
||||
ButtonCount : LongInt;
|
||||
DefaultIndex : LongInt;
|
||||
EscapeResult : LongInt) : LongInt;
|
||||
var
|
||||
BtnIdx, BtnID: LongInt;
|
||||
QtMessageBox: TQtMessageBox;
|
||||
begin
|
||||
ReleaseCapture;
|
||||
QtMessageBox := TQtMessageBox.Create(nil);
|
||||
QtMessageBox.AttachEvents;
|
||||
try
|
||||
{Convert LCL "id" button values to Qt values}
|
||||
for BtnIdx := 0 to ButtonCount-1 do
|
||||
begin
|
||||
BtnID := Buttons[BtnIdx];
|
||||
if (BtnID >= Low(IdButtonToQtStandardButton)) and
|
||||
(BtnID <= High(IdButtonToQtStandardButton)) and
|
||||
(IdButtonToQtStandardButton[BtnID] <> QMessageBoxNoButton) then
|
||||
QtMessageBox.AddButton(GetButtonCaption(BtnID), IdButtonToQtStandardButton[BtnID], BtnID, BtnIdx = DefaultIndex, BtnId = EscapeResult)
|
||||
else
|
||||
QtMessageBox.AddButton(GetButtonCaption(BtnID), BtnID, BtnIdx = DefaultIndex, BtnId = EscapeResult);
|
||||
end;
|
||||
|
||||
if DialogCaption <> '' then
|
||||
QtMessageBox.Title := DialogCaption
|
||||
else
|
||||
case DialogType of
|
||||
idDialogWarning: QtMessageBox.Title := rsMtWarning;
|
||||
idDialogError: QtMessageBox.Title := rsMtError;
|
||||
idDialogInfo : QtMessageBox.Title := rsMtInformation;
|
||||
idDialogConfirm : QtMessageBox.Title := rsMtConfirmation;
|
||||
end;
|
||||
|
||||
QtMessageBox.MessageStr := DialogMessage;
|
||||
|
||||
case DialogType of
|
||||
idDialogWarning: QtMessageBox.MsgBoxType := QMessageBoxWarning;
|
||||
idDialogError: QtMessageBox.MsgBoxType := QMessageBoxCritical;
|
||||
idDialogInfo : QtMessageBox.MsgBoxType := QMessageBoxInformation;
|
||||
idDialogConfirm : QtMessageBox.MsgBoxType := QMessageBoxQuestion;
|
||||
else
|
||||
QtMessageBox.MsgBoxType := QMessageBoxNoIcon;
|
||||
end;
|
||||
|
||||
Result := QtMessageBox.exec;
|
||||
finally
|
||||
QtMessageBox.Free;
|
||||
end;
|
||||
end; {TQtWidgetSet.PromptUser}
|
||||
|
||||
function TQtWidgetSet.RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer
|
||||
): Boolean;
|
||||
begin
|
||||
Result := IsValidDC(DC);
|
||||
if Result then
|
||||
QPainter_drawPie(TQtDeviceContext(DC).Widget, x1, y1, x2, y2, Angle1, Angle2);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: RawImage_CreateBitmaps
|
||||
Params: ARawImage:
|
||||
ABitmap:
|
||||
AMask:
|
||||
ASkipMask: When set, no mask is created
|
||||
Returns:
|
||||
|
||||
This functions is for TBitmap support
|
||||
|
||||
The memory allocation code was added because it is necessary for
|
||||
TBitmap.LoadFromDevice support. For other operations it isnt needed
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.RawImage_CreateBitmaps(const ARawImage: TRawImage; out ABitmap, AMask: HBitmap; ASkipMask: Boolean): Boolean;
|
||||
var
|
||||
Desc: TRawImageDescription absolute ARawImage.Description;
|
||||
NewData: PByte;
|
||||
ImageFormat: QImageFormat;
|
||||
begin
|
||||
Result := False;
|
||||
ABitmap := 0;
|
||||
AMask := 0;
|
||||
|
||||
//MWE: shouldn't the memory get copied at the place where it is needed,
|
||||
// its not really oo if the bitmap (or thisr party) needs this to do it here.
|
||||
if ARawImage.DataSize > 0 then
|
||||
begin
|
||||
NewData := GetMem(ARawImage.DataSize);
|
||||
Move(ARawImage.Data^, NewData^, ARawImage.DataSize);
|
||||
end
|
||||
else
|
||||
NewData := nil;
|
||||
|
||||
// this is only a rough implementation, there is no check against bitsperpixel
|
||||
case Desc.Depth of
|
||||
1: ImageFormat := QImageFormat_Mono;
|
||||
//2..14: ;
|
||||
15, 16: ImageFormat := QImageFormat_RGB16;
|
||||
24: ImageFormat := QImageFormat_RGB32;
|
||||
32: ImageFormat := QImageFormat_ARGB32;
|
||||
else
|
||||
ImageFormat := QImageFormat_ARGB32;
|
||||
end;
|
||||
ABitmap := HBitmap(TQtImage.Create(NewData, Desc.Width, Desc.Height, ImageFormat, True));
|
||||
Result := ABitmap <> 0;
|
||||
|
||||
if ASkipMask then Exit;
|
||||
|
||||
if (ARawImage.Mask <> nil) and (ARawImage.MaskSize > 0) then
|
||||
begin
|
||||
NewData := GetMem(ARawImage.MaskSize);
|
||||
Move(ARawImage.Mask^, NewData^, ARawImage.MaskSize);
|
||||
end
|
||||
else
|
||||
NewData := nil;
|
||||
|
||||
AMask := HBitmap(TQtImage.Create(NewData, Desc.Width, Desc.Height, QImageFormat_Mono, True));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: RawImage_DescriptionFromBitmap
|
||||
Params: ABitmap:
|
||||
ADesc:
|
||||
Returns:
|
||||
|
||||
Describes the inner format utilized by Qt + the specific information for this image
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.RawImage_DescriptionFromBitmap(ABitmap: HBITMAP; out ADesc: TRawImageDescription): Boolean;
|
||||
const
|
||||
QImageFormatToDepth: array[QImageFormat] of integer =
|
||||
(
|
||||
{ QImageFormat_Invalid } 0,
|
||||
{ QImageFormat_Mono } 1,
|
||||
{ QImageFormat_MonoLSB } 1,
|
||||
{ QImageFormat_Indexed8 } 8,
|
||||
{ QImageFormat_RGB32 } 24,
|
||||
{ QImageFormat_ARGB32 } 32,
|
||||
{ QImageFormat_ARGB32_Premultiplied } 32,
|
||||
{ QImageFormat_RGB16 } 16,
|
||||
{ QImageFormat_ARGB8565_Premultiplied } 24,
|
||||
{ QImageFormat_RGB666 } 24,
|
||||
{ QImageFormat_ARGB6666_Premultiplied } 24,
|
||||
{ QImageFormat_RGB555 } 16,
|
||||
{ QImageFormat_ARGB8555_Premultiplied } 24,
|
||||
{ QImageFormat_RGB888 } 24,
|
||||
{ QImageFormat_RGB444 } 16,
|
||||
{ QImageFormat_ARGB4444_Premultiplied } 16,
|
||||
{ QImageNImageFormats } 0
|
||||
);
|
||||
var
|
||||
Image: TQtImage absolute ABitmap;
|
||||
begin
|
||||
Result := CheckBitmap(ABitmap, 'RawImage_DescriptionFromBitmap');
|
||||
if not Result then Exit;
|
||||
|
||||
//FillStandardDescription(ADesc);
|
||||
ADesc.Init;
|
||||
ADesc.Width := Image.Width;
|
||||
ADesc.Height := Image.Height;
|
||||
|
||||
ADesc.BitOrder := riboReversedBits;
|
||||
ADesc.ByteOrder := riboLSBFirst;
|
||||
ADesc.LineOrder := riloTopToBottom;
|
||||
ADesc.LineEnd := rileDWordBoundary;
|
||||
|
||||
ADesc.Depth := QImageFormatToDepth[Image.getFormat];
|
||||
ADesc.BitsPerPixel := ADesc.Depth;
|
||||
if ADesc.BitsPerPixel = 24 then
|
||||
ADesc.BitsPerPixel := 32;
|
||||
|
||||
ADesc.Format := ricfRGBA;
|
||||
case ADesc.Depth of
|
||||
1, 8:
|
||||
begin
|
||||
ADesc.Format := ricfGray;
|
||||
|
||||
ADesc.RedPrec := ADesc.BitsPerPixel;
|
||||
end;
|
||||
16:
|
||||
begin
|
||||
ADesc.Depth := 15;
|
||||
|
||||
ADesc.RedPrec := 5;
|
||||
ADesc.GreenPrec := 5;
|
||||
ADesc.BluePrec := 5;
|
||||
|
||||
ADesc.RedShift := 10;
|
||||
ADesc.GreenShift := 5;
|
||||
ADesc.BlueShift := 0;
|
||||
end;
|
||||
24:
|
||||
begin
|
||||
ADesc.RedPrec := 8;
|
||||
ADesc.GreenPrec := 8;
|
||||
ADesc.BluePrec := 8;
|
||||
|
||||
ADesc.RedShift := 16;
|
||||
ADesc.GreenShift := 8;
|
||||
ADesc.BlueShift := 0;
|
||||
end;
|
||||
32:
|
||||
begin
|
||||
ADesc.AlphaPrec := 8;
|
||||
ADesc.RedPrec := 8;
|
||||
ADesc.GreenPrec := 8;
|
||||
ADesc.BluePrec := 8;
|
||||
|
||||
ADesc.AlphaShift := 24;
|
||||
ADesc.RedShift := 16;
|
||||
ADesc.GreenShift := 8;
|
||||
ADesc.BlueShift := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: RawImage_DescriptionFromDevice
|
||||
Params: ADC:
|
||||
ADesc:
|
||||
Returns:
|
||||
|
||||
Describes the standard format utilized by Qt
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.RawImage_DescriptionFromDevice(ADC: HDC; out ADesc: TRawImageDescription): Boolean;
|
||||
begin
|
||||
Result := true;
|
||||
|
||||
FillStandardDescription(ADesc);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: RawImage_FromBitmap
|
||||
Params: ABitmap:
|
||||
AMask:
|
||||
ARect:
|
||||
ARawImage:
|
||||
Returns:
|
||||
|
||||
Creates a raw image from a bitmap
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.RawImage_FromBitmap(out ARawImage: TRawImage; ABitmap, AMask: HBITMAP; ARect: PRect = nil): Boolean;
|
||||
var
|
||||
Desc: TRawImageDescription absolute ARawImage.Description;
|
||||
Image: TQtImage absolute ABitmap;
|
||||
Mask: TQtImage absolute AMask;
|
||||
|
||||
WorkImage, WorkMask: TQtImage;
|
||||
R: TRect;
|
||||
Width, Height: Integer;
|
||||
InvertPixels: Boolean;
|
||||
Px: QRgb;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not CheckBitmap(ABitmap, 'RawImage_FromBitmap') then Exit;
|
||||
if (AMask <> 0) and not CheckBitmap(AMask, 'RawImage_FromBitmap (mask)') then Exit;
|
||||
|
||||
ARawImage.Init;
|
||||
RawImage_DescriptionFromBitmap(ABitmap, Desc);
|
||||
|
||||
if ARect = nil
|
||||
then begin
|
||||
Width := Image.Width;
|
||||
Height := Image.Height;
|
||||
R := Rect(0, 0, Width, Height)
|
||||
end
|
||||
else begin
|
||||
R := ARect^;
|
||||
Width := R.Right - R.Left;
|
||||
Height := R.Bottom - R.Top;
|
||||
end;
|
||||
|
||||
if (Width = Image.Width) and (Height = Image.Height)
|
||||
then begin
|
||||
WorkImage := Image;
|
||||
WorkMask := Mask;
|
||||
end
|
||||
else begin
|
||||
WorkImage := TQtImage.Create;
|
||||
WorkImage.CopyFrom(Image.FHandle, R.Left, R.Top, Width, Height);
|
||||
if Mask <> nil then
|
||||
begin
|
||||
WorkMask := TQtImage.Create;
|
||||
WorkMask.CopyFrom(Mask.FHandle, R.Left, R.Top, Width, Height);
|
||||
end
|
||||
else
|
||||
WorkMask := nil;
|
||||
end;
|
||||
|
||||
Desc.Width := WorkImage.width;
|
||||
Desc.Height := WorkImage.height;
|
||||
|
||||
// copy data
|
||||
ARawImage.DataSize := WorkImage.numBytes;
|
||||
ReAllocMem(ARawImage.Data, ARawImage.DataSize);
|
||||
if ARawImage.DataSize > 0 then
|
||||
Move(WorkImage.bits^, ARawImage.Data^, ARawImage.DataSize);
|
||||
|
||||
if WorkMask <> nil then
|
||||
begin
|
||||
Desc.MaskLineEnd := rileDWordBoundary;
|
||||
Desc.MaskBitOrder := riboReversedBits;
|
||||
Desc.MaskBitsPerPixel := 1;
|
||||
ARawImage.MaskSize := WorkMask.numBytes;
|
||||
ReAllocMem(ARawImage.Mask, ARawImage.MaskSize);
|
||||
if ARawImage.MaskSize > 0 then
|
||||
begin
|
||||
InvertPixels := False;
|
||||
if WorkImage <> nil then
|
||||
begin
|
||||
Px := QImage_pixel(WorkImage.FHandle, 0, 0);
|
||||
InvertPixels :=
|
||||
not QImage_hasAlphaChannel(WorkMask.FHandle) and
|
||||
not QImage_hasAlphaChannel(WorkImage.FHandle) and
|
||||
// invert only if WorkImage is RGB32 fmt and allGray
|
||||
(WorkImage.getFormat = QImageFormat_RGB32) and
|
||||
QImage_allGray(WorkImage.FHandle) and
|
||||
((Px = 0) or (Px = $FF))
|
||||
end;
|
||||
if InvertPixels then
|
||||
WorkMask.invertPixels(QImageInvertRGB);
|
||||
Move(WorkMask.bits^, ARawImage.Mask^, ARawImage.MaskSize);
|
||||
if InvertPixels then
|
||||
WorkMask.invertPixels(QImageInvertRGB);
|
||||
end;
|
||||
end;
|
||||
|
||||
if WorkImage <> Image then
|
||||
WorkImage.Free;
|
||||
if WorkMask <> Mask then
|
||||
WorkMask.Free;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: RawImage_FromDevice
|
||||
Params: ADC:
|
||||
ARect:
|
||||
ARawImage:
|
||||
Returns:
|
||||
|
||||
This function is utilized when the function TBitmap.LoadFromDevice is called
|
||||
|
||||
The main use for this function is to get a screenshot. It may have other uses,
|
||||
but this is the only one implemented here.
|
||||
|
||||
MWE: exept for the desktop, there is always a bitmep selected in the DC.
|
||||
So get this internal bitmap and pass it to RawImage_FromBitmap
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.RawImage_FromDevice(out ARawImage: TRawImage; ADC: HDC; const ARect: TRect): Boolean;
|
||||
var
|
||||
Desc: TRawImageDescription absolute ARawImage.Description;
|
||||
|
||||
//SrcWidth, SrcHeight: Integer;
|
||||
WinID: Cardinal;
|
||||
DCSize: TSize;
|
||||
Pixmap: TQtPixmap;
|
||||
Image: QImageH;
|
||||
Context: TQtDeviceContext;
|
||||
|
||||
procedure RawImage_FromImage(AImage: QImageH);
|
||||
begin
|
||||
ARawImage.DataSize := QImage_numBytes(AImage);
|
||||
ARawImage.Data := GetMem(ARawImage.DataSize);
|
||||
Move(QImage_bits(AImage)^, ARawImage.Data^, ARawImage.DataSize);
|
||||
ARawImage.Mask := nil;
|
||||
end;
|
||||
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:> [WinAPI GetRawImageFromDevice] SrcDC: ', dbghex(ADC),
|
||||
' SrcWidth: ', dbgs(ARect.Right - ARect.Left),
|
||||
' SrcHeight: ', dbgs(ARect.Bottom - ARect.Top));
|
||||
{$endif}
|
||||
|
||||
// todo: copy only passed rectangle
|
||||
|
||||
Result := True;
|
||||
|
||||
ARawImage.Init;
|
||||
FillStandardDescription(ARawImage.Description);
|
||||
Context := TQtDeviceContext(ADC);
|
||||
|
||||
with DCSize, Context.getDeviceSize do
|
||||
begin
|
||||
cx := x;
|
||||
cy := y;
|
||||
end;
|
||||
|
||||
if Context.Parent <> nil then
|
||||
begin
|
||||
Pixmap := TQtPixmap.Create(@DCSize);
|
||||
WinID := QWidget_winId(Context.Parent);
|
||||
try
|
||||
// if you have dual monitors then getDeviceSize return
|
||||
// more width than screen width, but grabWindow will only grab one
|
||||
// screen, so its width will be less
|
||||
// Solution: we can either pass prefered size to grabWindow or
|
||||
// correct Description size after. I see the first solution as more correct.
|
||||
Pixmap.grabWindow(WinID, 0, 0, DCSize.cx, DCSize.cy);
|
||||
Image := QImage_Create;
|
||||
Pixmap.toImage(Image);
|
||||
RawImage_FromImage(Image);
|
||||
QImage_destroy(Image);
|
||||
finally
|
||||
Pixmap.Free;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if Context.vImage <> nil then
|
||||
RawImage_FromImage(Context.vImage.FHandle)
|
||||
else
|
||||
if Context.ParentPixmap <> nil then
|
||||
begin
|
||||
Image := QImage_create();
|
||||
QPixmap_toImage(Context.ParentPixmap, Image);
|
||||
RawImage_FromImage(Image);
|
||||
QImage_destroy(Image);
|
||||
end else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
// In this case we use the size of the context
|
||||
Desc.Width := DCSize.cx;
|
||||
Desc.Height := DCSize.cy;
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:< [WinAPI GetRawImageFromDevice]');
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: RawImage_QueryDescription
|
||||
Params: AFlags:
|
||||
ADesc:
|
||||
Returns:
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.RawImage_QueryDescription(AFlags: TRawImageQueryFlags; var ADesc: TRawImageDescription): Boolean;
|
||||
begin
|
||||
Result := inherited RawImage_QueryDescription(AFlags, ADesc);
|
||||
if ADesc.BitsPerPixel > 8 then
|
||||
ADesc.BitsPerPixel := 32
|
||||
else
|
||||
if ADesc.BitsPerPixel > 1 then
|
||||
ADesc.BitsPerPixel := 8;
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.ReleaseDesignerDC(Window: HWND; DC: HDC): Integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.RemoveEventHandler(var AHandler: PEventHandler);
|
||||
var
|
||||
wheh: PWaitHandleEventHandler;
|
||||
i: QSocketNotifierType;
|
||||
begin
|
||||
wheh := PWaitHandleEventHandler(aHandler);
|
||||
FSocketEventMap.Delete(wheh^.socket); // delete from the map
|
||||
|
||||
for i := QSocketNotifierRead to QSocketNotifierException do
|
||||
if Assigned(wheh^.qsn[i]) then begin
|
||||
QSocketNotifier_destroy(wheh^.qsn[i]);
|
||||
QSocketNotifier_hook_destroy(wheh^.qsn_hook[i]);
|
||||
end;
|
||||
dispose(wheh);
|
||||
aHandler := nil;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.RemovePipeEventHandler(var AHandler: PPipeEventHandler);
|
||||
begin
|
||||
// todo
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.RemoveProcessEventHandler(var AHandler: PProcessEventHandler);
|
||||
begin
|
||||
// todo
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SetEventHandlerFlags(AHandler: PEventHandler;
|
||||
NewFlags: dword);
|
||||
var
|
||||
wheh: PWaitHandleEventHandler;
|
||||
do_read: boolean;
|
||||
do_write: boolean;
|
||||
do_error: boolean;
|
||||
begin
|
||||
wheh := PWaitHandleEventHandler(aHandler);
|
||||
|
||||
do_read := NewFlags and EVE_IO_READ = EVE_IO_READ;
|
||||
do_write := NewFlags and EVE_IO_WRITE = EVE_IO_WRITE;
|
||||
do_error := NewFlags and EVE_IO_ERROR = EVE_IO_ERROR;
|
||||
|
||||
QSocketNotifier_setEnabled(wheh^.qsn[QSocketNotifierRead], do_read);
|
||||
QSocketNotifier_setEnabled(wheh^.qsn[QSocketNotifierWrite], do_write);
|
||||
QSocketNotifier_setEnabled(wheh^.qsn[QSocketNotifierException], do_error);
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect);
|
||||
begin
|
||||
QRubberBand_setGeometry(QRubberBandH(ARubberBand), @ARect);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if IsValidDC(DC) then
|
||||
Result := TextOut(DC, X, Y, Str, Count);
|
||||
end;*)
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
88
lcl/interfaces/customdrawn/customdrawnlclintfh.inc
Normal file
88
lcl/interfaces/customdrawn/customdrawnlclintfh.inc
Normal file
@ -0,0 +1,88 @@
|
||||
{%MainUnit qtint.pp}
|
||||
{ $Id: qtlclintfh.inc 32264 2011-09-10 20:33:57Z zeljko $ }
|
||||
|
||||
{******************************************************************************
|
||||
All QT interface communication implementations.
|
||||
Initial Revision : Sat Jan 17 19:00:00 2004
|
||||
|
||||
|
||||
!! Keep alphabetical !!
|
||||
|
||||
Support routines go to qtproc.pp
|
||||
|
||||
******************************************************************************
|
||||
Interface
|
||||
******************************************************************************
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
|
||||
//##apiwiz##sps## // Do not remove
|
||||
(*
|
||||
procedure SocketNotifierRead_cb(aSocket: Integer); cdecl; // internal callback, don't use!
|
||||
procedure SocketNotifierWrite_cb(aSocket: Integer); cdecl; // internal callback, don't use!
|
||||
procedure SocketNotifierError_cb(aSocket: Integer); cdecl; // internal callback, don't use!
|
||||
function AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||
AEventHandler: TWaitHandleEvent; AData: PtrInt): PEventHandler; override;
|
||||
function AddPipeEventHandler(AHandle: THandle;
|
||||
AEventHandler: TPipeEvent; AData: PtrInt): PPipeEventHandler; override;
|
||||
function AddProcessEventHandler(AHandle: THandle;
|
||||
AEventHandler: TChildExitEvent; AData: PtrInt): PProcessEventHandler; override;
|
||||
function AskUser(const DialogCaption, DialogMessage: string; DialogType:
|
||||
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt; override;
|
||||
|
||||
function CreateEmptyRegion: hRGN; override;
|
||||
function CreateStandardCursor(ACursor: SmallInt): HCURSOR; override;
|
||||
function CreateRubberBand(const ARect: TRect; const ABrush: HBrush = 0): HWND; override;
|
||||
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); override;
|
||||
procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
|
||||
procedure DestroyRubberBand(ARubberBand: HWND); override;
|
||||
|
||||
function FontCanUTF8(Font: HFont): boolean; override;
|
||||
function FontIsMonoSpace(Font: HFont): boolean; override;
|
||||
|
||||
function GetDesignerDC(WindowHandle: HWND): HDC; override;
|
||||
|
||||
function IntfSendsUTF8KeyPress: boolean; override;
|
||||
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;
|
||||
|
||||
function PromptUser(const DialogCaption : string;
|
||||
const DialogMessage : string;
|
||||
DialogType : LongInt;
|
||||
Buttons : PLongInt;
|
||||
ButtonCount : LongInt;
|
||||
DefaultIndex : LongInt;
|
||||
EscapeResult : LongInt) : LongInt; override;
|
||||
|
||||
function RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean; override;
|
||||
function RawImage_CreateBitmaps(const ARawImage: TRawImage; out ABitmap, AMask: HBitmap; ASkipMask: Boolean = False): Boolean; override;
|
||||
|
||||
function RawImage_DescriptionFromBitmap(ABitmap: HBITMAP; out ADesc: TRawImageDescription): Boolean; override;
|
||||
function RawImage_DescriptionFromDevice(ADC: HDC; out ADesc: TRawImageDescription): Boolean; override;
|
||||
|
||||
function RawImage_FromBitmap(out ARawImage: TRawImage; ABitmap, AMask: HBITMAP; ARect: PRect = nil): Boolean; override;
|
||||
function RawImage_FromDevice(out ARawImage: TRawImage; ADC: HDC; const ARect: TRect): Boolean; override;
|
||||
function RawImage_QueryDescription(AFlags: TRawImageQueryFlags; var ADesc: TRawImageDescription): Boolean; override;
|
||||
function ReleaseDesignerDC(Window: HWND; DC: HDC): Integer; override;
|
||||
|
||||
procedure RemoveEventHandler(var AHandler: PEventHandler); override;
|
||||
procedure RemovePipeEventHandler(var AHandler: PPipeEventHandler); override;
|
||||
procedure RemoveProcessEventHandler(var AHandler: PProcessEventHandler); override;
|
||||
|
||||
procedure SetEventHandlerFlags(AHandler: PEventHandler; NewFlags: dword); override;
|
||||
procedure SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect); override;
|
||||
|
||||
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; override;*)
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
6539
lcl/interfaces/customdrawn/customdrawnwinapi.inc
Normal file
6539
lcl/interfaces/customdrawn/customdrawnwinapi.inc
Normal file
File diff suppressed because it is too large
Load Diff
233
lcl/interfaces/customdrawn/customdrawnwinapih.inc
Normal file
233
lcl/interfaces/customdrawn/customdrawnwinapih.inc
Normal file
@ -0,0 +1,233 @@
|
||||
{%MainUnit qtint.pas}
|
||||
|
||||
{******************************************************************************
|
||||
All QT Winapi related stuff goes here.
|
||||
This are the overrides of the QT Interface for the methods defined in the
|
||||
lcl/include/winapih.inc
|
||||
|
||||
!! Keep this alphabetical !!
|
||||
|
||||
******************************************************************************
|
||||
Interface
|
||||
******************************************************************************
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
|
||||
//##apiwiz##sps## // Do not remove, no wizard declaration before this line
|
||||
(*
|
||||
function Arc(DC: HDC; Left,Top,Right,Bottom,angle1,angle2 : Integer): Boolean; override;
|
||||
function AngleChord(DC: HDC; x1, y1, x2, y2, angle1, angle2: Integer): Boolean; override;
|
||||
|
||||
function BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc; override;
|
||||
function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): Boolean; override;
|
||||
|
||||
function CallNextHookEx(hHk: HHOOK; ncode : Integer; wParam: WParam; lParam : LParam) : Integer; override;
|
||||
function CallWindowProc(lpPrevWndFunc : TFarProc; Handle : HWND; Msg : UINT; wParam: WParam; lParam : lParam) : Integer; override;
|
||||
function ClientToScreen(Handle: HWND; var P: TPoint) : Boolean; override;
|
||||
|
||||
function ClipboardFormatToMimeType(FormatID: TClipboardFormat): string; override;
|
||||
function ClipboardGetData(ClipboardType: TClipboardType;
|
||||
FormatID: TClipboardFormat; Stream: TStream): boolean; override;
|
||||
// ! List will be created. You must free it yourself with FreeMem(List) !
|
||||
function ClipboardGetFormats(ClipboardType: TClipboardType;
|
||||
var Count: integer; var List: PClipboardFormat): boolean; override;
|
||||
function ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
||||
OnRequestProc: TClipboardRequestEvent; FormatCount: integer;
|
||||
Formats: PClipboardFormat): boolean; override;
|
||||
function ClipboardRegisterFormat(const AMimeType: string): TClipboardFormat; override;
|
||||
|
||||
function CombineRgn(Dest, Src1, Src2: HRGN; fnCombineMode: Longint): Longint; override;
|
||||
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; override;
|
||||
function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
|
||||
function CreateCaret(Handle : HWND; Bitmap : hBitmap; Width, Height : Integer) : Boolean; override;
|
||||
function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; override;
|
||||
function CreateCompatibleDC(DC: HDC): HDC; override;
|
||||
function CreateEllipticRgn(p1, p2, p3, p4: Integer): HRGN; override;
|
||||
function CreateFontIndirect(const LogFont: TLogFont): HFONT; override;
|
||||
function CreateFontIndirectEx(const LogFont: TLogFont; const LongFontName: string): HFONT; override;
|
||||
function CreateIconIndirect(IconInfo: PIconInfo): HICON; override;
|
||||
function CreatePatternBrush(ABitmap: HBITMAP): HBRUSH; override;
|
||||
function CreatePenIndirect(const LogPen: TLogPen): HPEN; override;
|
||||
function CreatePolygonRgn(Points: PPoint; NumPts: Integer; FillMode: integer): HRGN; override;
|
||||
function CreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN; override;
|
||||
|
||||
procedure DeleteCriticalSection(var CritSection: TCriticalSection); override;
|
||||
function DeleteDC(hDC: HDC): Boolean; override;
|
||||
function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
|
||||
function DestroyCaret(Handle : HWND): Boolean; override;
|
||||
function DestroyIcon(Handle: HICON): Boolean; override;
|
||||
function DPtoLP(DC: HDC; var Points; Count: Integer): BOOL; override;
|
||||
function DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal; grfFlags: Cardinal): Boolean; override;
|
||||
function DrawFocusRect(DC: HDC; const Rect: TRect): boolean; override;
|
||||
function DrawFrameControl(DC: HDC; const Rect : TRect; uType, uState : Cardinal) : Boolean; override;
|
||||
function DrawText(DC: HDC; Str: PChar; Count: Integer; var ARect: TRect; Flags: Cardinal): Integer; override;
|
||||
|
||||
function Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean; override;
|
||||
function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; override;
|
||||
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
|
||||
function EndPaint(Handle: hwnd; var PS: TPaintStruct): Integer; override;
|
||||
procedure EnterCriticalSection(var CritSection: TCriticalSection); override;
|
||||
function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; override;
|
||||
function EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; Flags: dword): longint; override;
|
||||
function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
|
||||
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; override;
|
||||
function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override;
|
||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
|
||||
|
||||
function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override;
|
||||
function FillRgn(DC: HDC; RegionHnd: HRGN; hbr: HBRUSH): Bool; override;
|
||||
function Frame(DC: HDC; const ARect: TRect): Integer; override;
|
||||
function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const Style : TBevelCut): Boolean; override;
|
||||
function FrameRect(DC: HDC; const ARect: TRect; hBr: HBRUSH): Integer; override;
|
||||
|
||||
function GetActiveWindow : HWND; override;
|
||||
function GetBitmapBits(Bitmap: HBITMAP; Count: Longint; Bits: Pointer): Longint; override;
|
||||
function GetBkColor(DC: HDC): TColorRef; override;
|
||||
function GetCapture: HWND; override;
|
||||
function GetCaretPos(var lpPoint: TPoint): Boolean; override;
|
||||
function GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean; override;
|
||||
function GetClientBounds(handle : HWND; var ARect : TRect) : Boolean; override;
|
||||
function GetClientRect(handle : HWND; var ARect : TRect) : Boolean; override;
|
||||
function GetClipBox(DC : hDC; lpRect : PRect) : Longint; override;
|
||||
function GetClipRGN(DC: hDC; RGN: hRGN): Longint; override;
|
||||
function GetCmdLineParamDescForInterface: string; override;
|
||||
function GetCurrentObject(DC: HDC; uObjectType: UINT): HGDIOBJ; override;
|
||||
function GetCursorPos(var lpPoint: TPoint ): Boolean; override;
|
||||
function GetDC(hWnd: HWND): HDC; override;
|
||||
function GetDCOriginRelativeToWindow(PaintDC: HDC; WindowHandle: HWND; var OriginDiff: TPoint): boolean; override;
|
||||
function GetDeviceCaps(DC: HDC; Index: Integer): Integer; override;
|
||||
function GetDeviceSize(DC: HDC; var P: TPoint): Boolean; Override;
|
||||
function GetDIBits(DC: HDC; Bitmap: HBitmap; StartScan, NumScans: UINT; Bits: Pointer; var BitInfo: BitmapInfo; Usage: UINT): Integer; Override;
|
||||
function GetDoubleClickTime: UINT; override;
|
||||
function GetFocus: HWND; override;
|
||||
function GetForegroundWindow: HWND; override;
|
||||
function GetKeyState(nVirtKey: Integer): Smallint; override;
|
||||
function GetMapMode(DC: HDC): Integer; override;
|
||||
function GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean; override;
|
||||
function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;
|
||||
function GetParent(Handle : HWND): HWND; override;
|
||||
function GetProp(Handle : hwnd; Str : PChar): Pointer; override;
|
||||
function GetRgnBox(RGN : HRGN; lpRect : PRect) : Longint; override;
|
||||
function GetROP2(DC: HDC): Integer; override;
|
||||
function GetScrollBarSize(Handle: HWND; BarKind: Integer): integer; override;
|
||||
function GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean; override;
|
||||
function GetScrollInfo(Handle: HWND; BarFlag: Integer; Var ScrollInfo: TScrollInfo): Boolean; override;
|
||||
function GetStockObject(Value: Integer): THandle; override;
|
||||
function GetSysColor(nIndex: Integer): DWORD; override;
|
||||
function GetSysColorBrush(nIndex: Integer): HBrush; override;
|
||||
function GetSystemMetrics(nIndex: Integer): Integer; override;
|
||||
function GetTextColor(DC: HDC) : TColorRef; Override;
|
||||
function GetTextExtentExPoint(DC: HDC; Str: PChar; Count, MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize): Boolean; override;
|
||||
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override;
|
||||
function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override;
|
||||
function GetViewPortExtEx(DC: HDC; Size: PSize): Integer; override;
|
||||
function GetViewPortOrgEx(DC: HDC; P: PPoint): Integer; override;
|
||||
function GetWindowExtEx(DC: HDC; Size: PSize): Integer; override;
|
||||
function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;
|
||||
function GetWindowOrgEx(dc : hdc; P : PPoint): Integer; override;
|
||||
function GetWindowRect(Handle: hwnd; var ARect: TRect): Integer; override;
|
||||
function GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean; override;
|
||||
function GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean; override;
|
||||
function GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices : Longint;
|
||||
Meshes: Pointer; NumMeshes : Longint; Mode : Longint): Boolean; override;
|
||||
|
||||
function HideCaret(hWnd: HWND): Boolean; override;
|
||||
|
||||
function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override;
|
||||
function InvalidateRgn(aHandle: HWND; Rgn: HRGN; Erase: Boolean): Boolean; override;
|
||||
procedure InitializeCriticalSection(var CritSection: TCriticalSection); override;
|
||||
function IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer; override;
|
||||
function IsIconic(Handle: HWND): boolean; override;
|
||||
function IsWindow(handle: HWND): boolean; override;
|
||||
function IsWindowEnabled(Handle: HWND): boolean; override;
|
||||
function IsWindowVisible(Handle: HWND): boolean; override;
|
||||
function IsZoomed(Handle: HWND): boolean; override;
|
||||
|
||||
procedure LeaveCriticalSection(var CritSection: TCriticalSection); override;
|
||||
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
|
||||
function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; override;
|
||||
|
||||
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
|
||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||
|
||||
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
|
||||
|
||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
|
||||
function PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer; Filled, Continuous: boolean): boolean; override;
|
||||
function Polygon(DC: HDC; Points: PPoint; NumPts: Integer; Winding: boolean): boolean; override;
|
||||
function Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean; override;
|
||||
function PostMessage(Handle: HWND; Msg: Cardinal; wParam: WParam; lParam: LParam): Boolean; override;
|
||||
function PtInRegion(RGN: HRGN; X, Y: Integer) : Boolean; override;
|
||||
|
||||
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; override;
|
||||
function RectVisible(dc : hdc; const ARect: TRect) : Boolean; override;
|
||||
function RedrawWindow(Wnd: HWND; lprcUpdate: PRECT; hrgnUpdate: HRGN; flags: UINT): Boolean; override;
|
||||
function ReleaseCapture : Boolean; override;
|
||||
function ReleaseDC(hWnd: HWND; DC: HDC): Integer; override;
|
||||
function RestoreDC(DC: HDC; SavedDC: Integer): Boolean; override;
|
||||
function RoundRect(DC : hDC; X1, Y1, X2, Y2: Integer; RX,RY : Integer): Boolean; override;
|
||||
|
||||
function SaveDC(DC: HDC): Integer; override;
|
||||
function ScreenToClient(Handle : HWND; var P : TPoint) : Integer; override;
|
||||
function ScrollWindowEx(HWnd: HWND; DX, DY: Integer; PRcScroll, PRcClip: PRect; HRgnUpdate: HRGN; PRcUpdate: PRect; Flags: UINT): Boolean; override;
|
||||
function SelectClipRGN(DC : hDC; RGN : HRGN) : Longint; override;
|
||||
function SelectObject(DC: HDC; GDIObj: HGDIOBJ): HGDIOBJ; override;
|
||||
function SendMessage(HandleWnd: HWND; Msg: Cardinal; WParam: WParam; LParam: LParam): LResult; override;
|
||||
function SetActiveWindow(Handle: HWND): HWND; override;
|
||||
function SetBKColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
||||
function SetBkMode(DC: HDC; bkMode : Integer) : Integer; override;
|
||||
function SetCapture(AHandle: HWND): HWND; override;
|
||||
function SetCaretPos(X, Y: Integer): Boolean; override;
|
||||
function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; override;
|
||||
function SetCaretRespondToFocus(handle: HWND; ShowHideOnFocus: boolean): Boolean; override;
|
||||
function SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||
function SetFocus(hWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetMapMode(DC: HDC; fnMapMode : Integer): Integer; override;
|
||||
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
|
||||
function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override;
|
||||
function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
||||
function SetViewPortExtEx(DC: HDC; XExtent, YExtent : Integer; OldSize: PSize): Boolean; override;
|
||||
function SetViewPortOrgEx(DC: HDC; NewX, NewY: Integer; OldPoint: PPoint): Boolean; override;
|
||||
function SetWindowExtEx(DC: HDC; XExtent, YExtent: Integer; OldSize: PSize): Boolean; override;
|
||||
function SetWindowOrgEx(DC : HDC; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
|
||||
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
|
||||
X, Y, cx, cy: Integer; uFlags: UINT): Boolean; override;
|
||||
function SetWindowRgn(hWnd: HWND; hRgn: HRGN; bRedraw: Boolean):longint; override;
|
||||
function ShowCaret(hWnd: HWND): Boolean; override;
|
||||
function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; override;
|
||||
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override;
|
||||
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
||||
SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override;
|
||||
function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
||||
SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Mask: HBITMAP;
|
||||
XMask, YMask: Integer; Rop: DWORD): Boolean; override;
|
||||
function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override;
|
||||
|
||||
function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override;
|
||||
function UpdateWindow(Handle: HWND): Boolean; override;
|
||||
function WindowFromPoint(APoint: TPoint): HWND; override;
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||
|
||||
*)
|
||||
|
||||
|
||||
|
||||
|
@ -85,10 +85,6 @@ begin
|
||||
{$ifdef MSG_DEBUG}
|
||||
DebugLn('Trace:CallDefaultWindowProc - B ' + IntToHex(PtrInt(PrevWndProc), 8));
|
||||
{$endif}
|
||||
// combobox child edit weirdness: combobox handling WM_SIZE will compare text
|
||||
// to list of strings, and if appears in there, will set the text, and select it
|
||||
// WM_GETTEXTLENGTH, WM_GETTEXT, WM_SETTEXT, EM_SETSEL
|
||||
// combobox sends WM_SIZE to itself indirectly, check recursion
|
||||
Result := Windows.CallWindowProc(PrevWndProc, Window, Msg, WParam, LParam);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user