mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-28 15:09:28 +02:00
- all event attaching code moved to TQtWidget.AttachEvents, TQtWidget.DetachEvents and descendants
- initial implementation of Qt Caret by *Andreas Hausladen* with changes. Compile with -dShowQtCaret to test - fixed bug caused memory corruption - other minor fixes git-svn-id: trunk@11465 -
This commit is contained in:
parent
0c7849de57
commit
e720286a68
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2697,6 +2697,7 @@ lcl/interfaces/qt/interfaces.pp svneol=native#text/pascal
|
|||||||
lcl/interfaces/qt/qt4.pas svneol=native#text/plain
|
lcl/interfaces/qt/qt4.pas svneol=native#text/plain
|
||||||
lcl/interfaces/qt/qt43.pas -text
|
lcl/interfaces/qt/qt43.pas -text
|
||||||
lcl/interfaces/qt/qtcallback.inc svneol=native#text/pascal
|
lcl/interfaces/qt/qtcallback.inc svneol=native#text/pascal
|
||||||
|
lcl/interfaces/qt/qtcaret.pas svneol=native#text/pascal
|
||||||
lcl/interfaces/qt/qtint.pp svneol=native#text/pascal
|
lcl/interfaces/qt/qtint.pp svneol=native#text/pascal
|
||||||
lcl/interfaces/qt/qtlclintf.inc svneol=native#text/pascal
|
lcl/interfaces/qt/qtlclintf.inc svneol=native#text/pascal
|
||||||
lcl/interfaces/qt/qtlclintfh.inc svneol=native#text/pascal
|
lcl/interfaces/qt/qtlclintfh.inc svneol=native#text/pascal
|
||||||
|
401
lcl/interfaces/qt/qtcaret.pas
Normal file
401
lcl/interfaces/qt/qtcaret.pas
Normal file
@ -0,0 +1,401 @@
|
|||||||
|
{
|
||||||
|
/***************************************************************************
|
||||||
|
QtCaret.pas - Qt Caret Emulation
|
||||||
|
-------------------------------------
|
||||||
|
|
||||||
|
copyright (c) Andreas Hausladen
|
||||||
|
|
||||||
|
adopted for Lazarus and Qt4 by Lazarus Team
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
*****************************************************************************
|
||||||
|
* *
|
||||||
|
* This file is part of the Lazarus Component Library (LCL) *
|
||||||
|
* *
|
||||||
|
* See the file COPYING.modifiedLGPL, 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. *
|
||||||
|
* *
|
||||||
|
*****************************************************************************
|
||||||
|
}
|
||||||
|
|
||||||
|
unit QtCaret;
|
||||||
|
{$mode delphi}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
// Bindings
|
||||||
|
{$ifdef USE_QT_4_3}
|
||||||
|
qt43,
|
||||||
|
{$else}
|
||||||
|
qt4,
|
||||||
|
{$endif}
|
||||||
|
// Free Pascal
|
||||||
|
Classes, SysUtils, Types,
|
||||||
|
// Widgetset
|
||||||
|
QtObjects, QtWidgets,
|
||||||
|
// LCL
|
||||||
|
LCLType, LCLIntf, Graphics, ExtCtrls;
|
||||||
|
|
||||||
|
// defines
|
||||||
|
{.$DEFINE ShowQtCaret}
|
||||||
|
|
||||||
|
type
|
||||||
|
TEmulatedCaret = class(TComponent)
|
||||||
|
private
|
||||||
|
FTimer: TTimer;
|
||||||
|
FWndId: Cardinal;
|
||||||
|
FWidget: TQtWidget;
|
||||||
|
FPixmap: QPixmapH;
|
||||||
|
FWidth, FHeight: Integer;
|
||||||
|
FPos: TQtPoint;
|
||||||
|
FVisible: Boolean;
|
||||||
|
FVisibleState: Boolean;
|
||||||
|
FCritSect: TCriticalSection;
|
||||||
|
procedure SetPos(const Value: TQtPoint);
|
||||||
|
protected
|
||||||
|
procedure DoTimer(Sender: TObject);
|
||||||
|
procedure DrawCaret; virtual;
|
||||||
|
function CreateColorPixmap(Color: Cardinal): QPixmapH;
|
||||||
|
procedure SetWidget(AWidget: TQtWidget);
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
procedure Lock;
|
||||||
|
procedure Unlock;
|
||||||
|
|
||||||
|
function CreateCaret(AWidget: TQtWidget; Pixmap: QPixmapH; Width, Height: Integer): Boolean;
|
||||||
|
function DestroyCaret: Boolean;
|
||||||
|
|
||||||
|
function IsValid: Boolean;
|
||||||
|
|
||||||
|
function Show(AWidget: TQtWidget): Boolean;
|
||||||
|
function Hide: Boolean;
|
||||||
|
|
||||||
|
property Timer: TTimer read FTimer;
|
||||||
|
property Pos: TQtPoint read FPos write SetPos;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateCaret(Widget: TQtWidget; Pixmap: QPixmapH; Width, Height: Integer): Boolean; overload;
|
||||||
|
function CreateCaret(Widget: TQtWidget; ColorCaret: Cardinal; Width, Height: Integer): Boolean; overload;
|
||||||
|
function HideCaret(Widget: TQtWidget): Boolean;
|
||||||
|
function ShowCaret(Widget: TQtWidget): Boolean;
|
||||||
|
function SetCaretPos(X, Y: Integer): Boolean;
|
||||||
|
function GetCaretPos(var Pt: TPoint): Boolean;
|
||||||
|
function DestroyCaret: Boolean;
|
||||||
|
procedure DrawCaret;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
GlobalCaret: TEmulatedCaret = nil;
|
||||||
|
|
||||||
|
procedure GlobalCaretNeeded;
|
||||||
|
begin
|
||||||
|
if GlobalCaret = nil then
|
||||||
|
GlobalCaret := TEmulatedCaret.Create(nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function QtPoint(X, Y: Integer): TQtPoint;
|
||||||
|
begin
|
||||||
|
Result.X := X;
|
||||||
|
Result.Y := Y;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawCaret;
|
||||||
|
begin
|
||||||
|
GlobalCaretNeeded;
|
||||||
|
if Assigned(GlobalCaret) then
|
||||||
|
begin
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
GlobalCaret.DrawCaret;
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateCaret(Widget: TQtWidget; Pixmap: QPixmapH; Width, Height: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
GlobalCaretNeeded;
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
Result := GlobalCaret.CreateCaret(Widget, Pixmap, Width, Height);
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateCaret(Widget: TQtWidget; ColorCaret: Cardinal; Width, Height: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := CreateCaret(Widget, QPixmapH(ColorCaret), Width, Height);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetCaretBlinkTime: Cardinal;
|
||||||
|
begin
|
||||||
|
Result := QApplication_cursorFlashTime;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SetCaretBlinkTime(uMSeconds: Cardinal): LongBool;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
try
|
||||||
|
QApplication_setCursorFlashTime(uMSeconds);
|
||||||
|
if assigned(GlobalCaret) then
|
||||||
|
begin
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
GlobalCaret.Timer.Interval := GetCaretBlinkTime;
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function HideCaret(Widget: TQtWidget): Boolean;
|
||||||
|
begin
|
||||||
|
GlobalCaretNeeded;
|
||||||
|
if Assigned(GlobalCaret) then
|
||||||
|
begin
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
Result := GlobalCaret.Hide;
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ShowCaret(Widget: TQtWidget): Boolean;
|
||||||
|
begin
|
||||||
|
GlobalCaretNeeded;
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
Result := GlobalCaret.Show(Widget);
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SetCaretPos(X, Y: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
GlobalCaretNeeded;
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
GlobalCaret.Pos := QtPoint(X, Y);
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetCaretPos(var Pt: TPoint): Boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
GlobalCaretNeeded;
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
with GlobalCaret.Pos do
|
||||||
|
begin
|
||||||
|
Pt.x := X;
|
||||||
|
Pt.y := Y;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function DestroyCaret: Boolean;
|
||||||
|
begin
|
||||||
|
if Assigned(GlobalCaret) then
|
||||||
|
begin
|
||||||
|
GlobalCaret.Lock;
|
||||||
|
try
|
||||||
|
Result := GlobalCaret.DestroyCaret;
|
||||||
|
finally
|
||||||
|
GlobalCaret.Unlock;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TEmulatedCaret }
|
||||||
|
|
||||||
|
constructor TEmulatedCaret.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
InitializeCriticalSection(FCritSect);
|
||||||
|
|
||||||
|
FTimer := TTimer.Create(self);
|
||||||
|
FTimer.Enabled := False;
|
||||||
|
FTimer.Interval := GetCaretBlinkTime;
|
||||||
|
FTimer.OnTimer := DoTimer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TEmulatedCaret.Destroy;
|
||||||
|
begin
|
||||||
|
DestroyCaret;
|
||||||
|
DeleteCriticalSection(FCritSect);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEmulatedCaret.CreateCaret(AWidget: TQtWidget; Pixmap: QPixmapH;
|
||||||
|
Width, Height: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
DestroyCaret;
|
||||||
|
SetWidget(AWidget);
|
||||||
|
FWidth := Width;
|
||||||
|
FHeight := Height;
|
||||||
|
if Cardinal(Pixmap) > $FFFF then
|
||||||
|
FPixmap := QPixmap_create(Pixmap)
|
||||||
|
else
|
||||||
|
FPixmap := CreateColorPixmap(Integer(Pixmap));
|
||||||
|
|
||||||
|
Result := IsValid;
|
||||||
|
{$IFDEF ShowQtCaret}
|
||||||
|
FTimer.Enabled := True;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEmulatedCaret.DestroyCaret: Boolean;
|
||||||
|
begin
|
||||||
|
FTimer.Enabled := False;
|
||||||
|
Hide;
|
||||||
|
if Assigned(FPixmap) then
|
||||||
|
QPixmap_destroy(FPixmap);
|
||||||
|
FWidget := nil;
|
||||||
|
FPixmap := nil;
|
||||||
|
FWidth := 0;
|
||||||
|
FHeight := 0;
|
||||||
|
Result := not IsValid;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEmulatedCaret.DrawCaret;
|
||||||
|
var
|
||||||
|
DestDev: QPaintDeviceH;
|
||||||
|
Painter: QPainterH;
|
||||||
|
R: TRect;
|
||||||
|
begin
|
||||||
|
if IsValid and FVisible and FVisibleState then
|
||||||
|
begin
|
||||||
|
{$IFDEF ShowQtCaret}
|
||||||
|
DestDev := QWidget_to_QPaintDevice(FWidget.Widget);
|
||||||
|
Painter := QPainter_create(DestDev);
|
||||||
|
R := Rect(0, 0, QPixmap_width(FPixmap), QPixmap_height(FPixmap));
|
||||||
|
QPainter_drawPixmap(Painter, PQtPoint(@FPos), FPixmap, PRect(@R));
|
||||||
|
QPainter_destroy(Painter);
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEmulatedCaret.Show(AWidget: TQtWidget): Boolean;
|
||||||
|
begin
|
||||||
|
if FWidget <> AWidget then
|
||||||
|
begin
|
||||||
|
Hide;
|
||||||
|
SetWidget(AWidget);
|
||||||
|
end;
|
||||||
|
Result := IsValid;
|
||||||
|
if Result then
|
||||||
|
FVisible := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEmulatedCaret.Hide: Boolean;
|
||||||
|
begin
|
||||||
|
Result := IsValid;
|
||||||
|
if Result and FVisible then
|
||||||
|
FVisible := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEmulatedCaret.SetPos(const Value: TQtPoint);
|
||||||
|
begin
|
||||||
|
if FVisible and ((FPos.x <> Value.x) or (FPos.y <> Value.y)) then
|
||||||
|
begin
|
||||||
|
Hide;
|
||||||
|
try
|
||||||
|
FPos := Value;
|
||||||
|
finally
|
||||||
|
Show(FWidget);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FPos := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEmulatedCaret.DoTimer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FVisibleState := not FVisibleState;
|
||||||
|
if FVisible and (FWidget <> nil) and not FWidget.InPaint then
|
||||||
|
FWidget.Repaint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEmulatedCaret.Lock;
|
||||||
|
begin
|
||||||
|
EnterCriticalSection(FCritSect);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEmulatedCaret.Unlock;
|
||||||
|
begin
|
||||||
|
LeaveCriticalSection(FCritSect);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEmulatedCaret.CreateColorPixmap(Color: Cardinal): QPixmapH;
|
||||||
|
var
|
||||||
|
QC: TQColor;
|
||||||
|
begin
|
||||||
|
if (FWidth <= 0) or (FHeight <= 0) then
|
||||||
|
Result := nil
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
case Color of
|
||||||
|
0: ColorRefToTQColor(clBlack, QC);
|
||||||
|
1: ColorRefToTQColor(clGray, QC);
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
Result := QPixmap_create(FWidth, FHeight);
|
||||||
|
try
|
||||||
|
QPixmap_fill(Result, @QC);
|
||||||
|
except
|
||||||
|
QPixmap_destroy(Result);
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEmulatedCaret.IsValid: Boolean;
|
||||||
|
begin
|
||||||
|
Result := (FWidget <> nil) and (FPixmap <> nil) and
|
||||||
|
(QWidget_find(FWndId) <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEmulatedCaret.SetWidget(AWidget: TQtWidget);
|
||||||
|
begin
|
||||||
|
if FWidget <> nil then
|
||||||
|
FWidget.HasCaret := False;
|
||||||
|
|
||||||
|
FWidget := AWidget;
|
||||||
|
if FWidget <> nil then
|
||||||
|
begin
|
||||||
|
FWndId := QWidget_winId(FWidget.Widget);
|
||||||
|
FWidget.HasCaret := True;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FWndId := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -147,6 +147,7 @@ uses
|
|||||||
QtWSSpin,
|
QtWSSpin,
|
||||||
QtWSStdCtrls,
|
QtWSStdCtrls,
|
||||||
// QtWSToolwin,
|
// QtWSToolwin,
|
||||||
|
QtCaret,
|
||||||
QtThemes,
|
QtThemes,
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
Graphics, buttons, Menus,
|
Graphics, buttons, Menus,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -335,6 +335,12 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.CreateCaret(Handle: HWND; Bitmap: hBitmap; Width, Height: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (Handle <> 0) and
|
||||||
|
QtCaret.CreateCaret(TQtWidget(Handle), Bitmap, Width, Height);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: CreateCompatibleDC
|
Function: CreateCompatibleDC
|
||||||
Params: DC - handle to memory device context
|
Params: DC - handle to memory device context
|
||||||
@ -647,6 +653,11 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.DestroyCaret(Handle: HWND): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (Handle <> 0) and QtCaret.DestroyCaret;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: DestroyCursor
|
Method: DestroyCursor
|
||||||
Params: Handle
|
Params: Handle
|
||||||
@ -951,6 +962,17 @@ begin
|
|||||||
// Desc^.LineEnd := rileDWordBoundary;
|
// Desc^.LineEnd := rileDWordBoundary;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.GetCaretPos(var lpPoint: TPoint): Boolean;
|
||||||
|
begin
|
||||||
|
Result := QtCaret.GetCaretPos(lpPoint);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean;
|
||||||
|
begin
|
||||||
|
{$note implement}
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: GetClientBounds
|
Function: GetClientBounds
|
||||||
Params: handle:
|
Params: handle:
|
||||||
@ -2229,6 +2251,11 @@ begin
|
|||||||
AdjustForBuddySize;}
|
AdjustForBuddySize;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.HideCaret(hWnd: HWND): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (hWnd <> 0) and QtCaret.HideCaret(TQtWidget(hWnd));
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Procedure: InitializeCriticalSection
|
Procedure: InitializeCriticalSection
|
||||||
Params: var CritSection: TCriticalSection
|
Params: var CritSection: TCriticalSection
|
||||||
@ -2670,6 +2697,23 @@ begin
|
|||||||
result := TQtDeviceContext(DC).SetBkMode(bkMode);
|
result := TQtDeviceContext(DC).SetBkMode(bkMode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.SetCaretPos(X, Y: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := QtCaret.SetCaretPos(X, Y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
Result := QtCaret.SetCaretPos(X, Y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.SetCaretRespondToFocus(handle: HWND;
|
||||||
|
ShowHideOnFocus: boolean): Boolean;
|
||||||
|
begin
|
||||||
|
{$note implement}
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: SetCursor
|
Function: SetCursor
|
||||||
Params: ACursor - HCursor (QCursorH)
|
Params: ACursor - HCursor (QCursorH)
|
||||||
@ -2759,6 +2803,11 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtWidgetSet.ShowCaret(hWnd: HWND): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (hWnd <> 0) and (QtCaret.ShowCaret(TQtWidget(hWnd)));
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: SetProp
|
Method: SetProp
|
||||||
Params: Handle -
|
Params: Handle -
|
||||||
|
@ -34,6 +34,7 @@ function CombineRgn(Dest, Src1, Src2: HRGN; fnCombineMode: Longint): Longint; o
|
|||||||
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; override;
|
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; override;
|
||||||
function CreateBitmapFromRawImage(const RawImage: TRawImage; var Bitmap, MaskBitmap: HBitmap; AlwaysCreateMask: boolean): boolean; override;
|
function CreateBitmapFromRawImage(const RawImage: TRawImage; var Bitmap, MaskBitmap: HBitmap; AlwaysCreateMask: boolean): boolean; override;
|
||||||
function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
|
function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
|
||||||
|
function CreateCaret(Handle : HWND; Bitmap : hBitmap; Width, Height : Integer) : Boolean; override;
|
||||||
function CreateCompatibleDC(DC: HDC): HDC; override;
|
function CreateCompatibleDC(DC: HDC): HDC; override;
|
||||||
function CreateCursor(ACursorInfo: PIconInfo): hCursor; override;
|
function CreateCursor(ACursorInfo: PIconInfo): hCursor; override;
|
||||||
function CreateFontIndirect(const LogFont: TLogFont): HFONT; override;
|
function CreateFontIndirect(const LogFont: TLogFont): HFONT; override;
|
||||||
@ -43,6 +44,7 @@ function CreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN; override;
|
|||||||
|
|
||||||
procedure DeleteCriticalSection(var CritSection: TCriticalSection); override;
|
procedure DeleteCriticalSection(var CritSection: TCriticalSection); override;
|
||||||
function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
|
function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
|
||||||
|
function DestroyCaret(Handle : HWND): Boolean; override;
|
||||||
function DestroyCursor(Handle: hCursor): Boolean; override;
|
function DestroyCursor(Handle: hCursor): Boolean; override;
|
||||||
function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer; override;
|
function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer; override;
|
||||||
|
|
||||||
@ -57,6 +59,8 @@ function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const St
|
|||||||
function FrameRect(DC: HDC; const ARect: TRect; hBr: HBRUSH): Integer; override;
|
function FrameRect(DC: HDC; const ARect: TRect; hBr: HBRUSH): Integer; override;
|
||||||
|
|
||||||
function GetBitmapRawImageDescription(Bitmap: HBITMAP; Desc: PRawImageDescription): Boolean; override;
|
function GetBitmapRawImageDescription(Bitmap: HBITMAP; Desc: PRawImageDescription): Boolean; 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 GetClientBounds(handle : HWND; var ARect : TRect) : Boolean; override;
|
||||||
function GetClientRect(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 GetClipBox(DC : hDC; lpRect : PRect) : Longint; override;
|
||||||
@ -81,6 +85,8 @@ function GetWindowRect(Handle: hwnd; var ARect: TRect): Integer; override;
|
|||||||
function GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean; override;
|
function GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean; override;
|
||||||
function GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean; override;
|
function GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean; override;
|
||||||
|
|
||||||
|
function HideCaret(hWnd: HWND): Boolean; override;
|
||||||
|
|
||||||
function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override;
|
function InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean) : Boolean; override;
|
||||||
procedure InitializeCriticalSection(var CritSection: TCriticalSection); override;
|
procedure InitializeCriticalSection(var CritSection: TCriticalSection); override;
|
||||||
|
|
||||||
@ -99,6 +105,9 @@ function SelectClipRGN(DC : hDC; RGN : HRGN) : Longint; override;
|
|||||||
function SelectObject(DC: HDC; GDIObj: HGDIOBJ): HGDIOBJ; override;
|
function SelectObject(DC: HDC; GDIObj: HGDIOBJ): HGDIOBJ; override;
|
||||||
function SetBKColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
function SetBKColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
||||||
function SetBkMode(DC: HDC; bkMode : Integer) : Integer; override;
|
function SetBkMode(DC: HDC; bkMode : Integer) : Integer; 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 SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
||||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||||
function SetFocus(hWnd: HWND): HWND; override;
|
function SetFocus(hWnd: HWND): HWND; override;
|
||||||
@ -106,6 +115,7 @@ function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override;
|
|||||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||||
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
||||||
function SetWindowOrgEx(DC : HDC; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
|
function SetWindowOrgEx(DC : HDC; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
|
||||||
|
function ShowCaret(hWnd: HWND): Boolean; override;
|
||||||
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override;
|
function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override;
|
||||||
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
||||||
SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override;
|
SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override;
|
||||||
|
@ -84,24 +84,9 @@ class function TQtWSBitBtn.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): TLCLIntfHandle;
|
const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
QtPushButton: TQtPushButton;
|
QtPushButton: TQtPushButton;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtPushButton := TQtPushButton.Create(AWinControl, AParams);
|
QtPushButton := TQtPushButton.Create(AWinControl, AParams);
|
||||||
|
QtPushButton.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QObject_hook_create(QtPushButton.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtPushButton.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// OnClick Event
|
|
||||||
|
|
||||||
QAbstractButton_clicked2_Event(Method) := QtPushButton.SlotClicked;
|
|
||||||
|
|
||||||
QAbstractButton_hook_hook_clicked2(QAbstractButton_hook_create(QtPushButton.Widget), Method);
|
|
||||||
|
|
||||||
// Focus
|
// Focus
|
||||||
|
|
||||||
|
@ -64,26 +64,11 @@ implementation
|
|||||||
class function TQtWSCustomCalendar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
|
class function TQtWSCustomCalendar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
QtCalendar: TQtCalendar;
|
QtCalendar: TQtCalendar;
|
||||||
Hook: QCalendarWidget_hookH;
|
|
||||||
Method: TMethod;
|
|
||||||
begin
|
begin
|
||||||
QtCalendar := TQtCalendar.Create(AWinControl, AParams);
|
QtCalendar := TQtCalendar.Create(AWinControl, AParams);
|
||||||
|
|
||||||
Hook := QCalendarWidget_hook_create(QtCalendar.Widget);
|
QtCalendar.AttachEvents;
|
||||||
TEventFilterMethod(Method) := QtCalendar.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QCalendarWidget_clicked_Event(Method) := QtCalendar.SignalClicked;
|
|
||||||
QCalendarWidget_hook_hook_clicked(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
|
|
||||||
|
|
||||||
QCalendarWidget_activated_Event(Method) := QtCalendar.SignalActivated;
|
|
||||||
QCalendarWidget_hook_hook_activated(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
|
|
||||||
|
|
||||||
QCalendarWidget_selectionChanged_Event(Method) := QtCalendar.SignalSelectionChanged;
|
|
||||||
QCalendarWidget_hook_hook_selectionChanged(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
|
|
||||||
|
|
||||||
QCalendarWidget_currentPageChanged_Event(Method) := QtCalendar.SignalCurrentPageChanged;
|
|
||||||
QCalendarWidget_hook_hook_currentPageChanged(QCalendarWidget_hook_create(QtCalendar.Widget), Method);
|
|
||||||
|
|
||||||
QWidget_setFocusPolicy(QtCalendar.Widget, QtTabFocus or QtClickFocus);
|
QWidget_setFocusPolicy(QtCalendar.Widget, QtTabFocus or QtClickFocus);
|
||||||
|
|
||||||
|
@ -253,16 +253,11 @@ implementation
|
|||||||
|
|
||||||
class function TQtWSToolButton.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSToolButton.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtToolButton: TQtToolButton;
|
QtToolButton: TQtToolButton;
|
||||||
Hook: QToolButton_hookH;
|
|
||||||
Method: TMethod;
|
|
||||||
begin
|
begin
|
||||||
QtToolButton := TQtToolButton.Create(AWinControl, AParams);
|
QtToolButton := TQtToolButton.Create(AWinControl, AParams);
|
||||||
|
QtToolButton.AttachEvents;
|
||||||
|
|
||||||
Hook := QToolButton_hook_create(QtToolButton.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtToolButton.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
Result := THandle(QtToolButton);
|
Result := THandle(QtToolButton);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -337,16 +332,11 @@ end;
|
|||||||
|
|
||||||
class function TQtWSToolBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSToolBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtToolBar: TQtToolBar;
|
QtToolBar: TQtToolBar;
|
||||||
Hook: QToolBar_hookH;
|
|
||||||
Method: TMethod;
|
|
||||||
begin
|
begin
|
||||||
QtToolBar := TQtToolBar.Create(AWinControl, AParams);
|
QtToolBar := TQtToolBar.Create(AWinControl, AParams);
|
||||||
|
QtToolBar.AttachEvents;
|
||||||
|
|
||||||
Hook := QToolBar_hook_create(QtToolBar.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtToolBar.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
Result := THandle(QtToolBar);
|
Result := THandle(QtToolBar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -392,29 +382,9 @@ end;
|
|||||||
class function TQtWSTrackBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSTrackBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtTrackBar: TQtTrackBar;
|
QtTrackBar: TQtTrackBar;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QSlider_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtTrackBar := TQtTrackBar.Create(AWinControl, AParams);
|
QtTrackBar := TQtTrackBar.Create(AWinControl, AParams);
|
||||||
|
QtTrackBar.AttachEvents;
|
||||||
Hook := QSlider_hook_create(QtTrackBar.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtTrackBar.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QAbstractSlider_rangeChanged_Event(Method) := QtTrackbar.SlotRangeChanged;
|
|
||||||
QAbstractSlider_hook_hook_rangeChanged(QAbstractSlider_hook_create(QtTrackBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_sliderMoved_Event(Method) := QtTrackBar.SlotSliderMoved;
|
|
||||||
QAbstractSlider_hook_hook_sliderMoved(QAbstractSlider_hook_create(QtTrackBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_sliderPressed_Event(Method) := QtTrackBar.SlotSliderPressed;
|
|
||||||
QAbstractSlider_hook_hook_sliderPressed(QAbstractSlider_hook_create(QtTrackBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_sliderReleased_Event(Method) := QtTrackBar.SlotSliderReleased;
|
|
||||||
QAbstractSlider_hook_hook_sliderReleased(QAbstractSlider_hook_create(QtTrackBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_valueChanged_Event(Method) := QtTrackBar.SlotValueChanged;
|
|
||||||
QAbstractSlider_hook_hook_valueChanged(QAbstractSlider_hook_create(QtTrackBar.Widget), Method);
|
|
||||||
|
|
||||||
Result := THandle(QtTrackBar);
|
Result := THandle(QtTrackBar);
|
||||||
end;
|
end;
|
||||||
@ -488,23 +458,9 @@ end;
|
|||||||
class function TQtWSProgressBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSProgressBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtProgressBar: TQtProgressBar;
|
QtProgressBar: TQtProgressBar;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QProgressBar_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtProgressBar := TQtProgressBar.Create(AWinControl, AParams);
|
QtProgressBar := TQtProgressBar.Create(AWinControl, AParams);
|
||||||
|
QtProgressBar.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QProgressBar_hook_create(QtProgressBar.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtProgressBar.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QProgressBar_valueChanged_Event(Method) := QtProgressBar.SignalValueChanged;
|
|
||||||
QProgressBar_hook_hook_valueChanged(QProgressBar_hook_create(QtProgressBar.Widget), Method);
|
|
||||||
|
|
||||||
|
|
||||||
Result := THandle(QtProgressBar);
|
Result := THandle(QtProgressBar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -573,21 +529,12 @@ end;
|
|||||||
class function TQtWSStatusBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSStatusBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtStatusBar: TQtStatusBar;
|
QtStatusBar: TQtStatusBar;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QStatusBar_hookH;
|
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
QtStatusBar := TQtStatusBar.Create(AWinControl, AParams);
|
QtStatusBar := TQtStatusBar.Create(AWinControl, AParams);
|
||||||
|
QtStatusBar.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QStatusBar_hook_create(QtStatusBar.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtStatusBar.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
if TStatusBar(AWinControl).SimplePanel then
|
if TStatusBar(AWinControl).SimplePanel then
|
||||||
begin
|
begin
|
||||||
@ -802,45 +749,9 @@ end;
|
|||||||
class function TQtWSCustomListView.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSCustomListView.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtTreeWidget: TQtTreeWidget;
|
QtTreeWidget: TQtTreeWidget;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QTreeWidget_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtTreeWidget := TQtTreeWidget.Create(AWinControl, AParams);
|
QtTreeWidget := TQtTreeWidget.Create(AWinControl, AParams);
|
||||||
|
QtTreeWidget.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QTreeWidget_hook_create(QtTreeWidget.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtTreeWidget.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QTreeWidget_currentItemChanged_Event(Method) := QtTreeWidget.SignalCurrentItemChanged;
|
|
||||||
QTreeWidget_hook_hook_currentItemChanged(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemDoubleClicked_Event(Method) := QtTreeWidget.SignalItemDoubleClicked;
|
|
||||||
QTreeWidget_hook_hook_ItemDoubleClicked(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemClicked_Event(Method) := QtTreeWidget.SignalItemClicked;
|
|
||||||
QTreeWidget_hook_hook_ItemClicked(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemActivated_Event(Method) := QtTreeWidget.SignalItemActivated;
|
|
||||||
QTreeWidget_hook_hook_ItemActivated(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemChanged_Event(Method) := QtTreeWidget.SignalItemChanged;
|
|
||||||
QTreeWidget_hook_hook_ItemChanged(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemSelectionChanged_Event(Method) := QtTreeWidget.SignalItemSelectionChanged;
|
|
||||||
QTreeWidget_hook_hook_ItemSelectionChanged(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemPressed_Event(Method) := QtTreeWidget.SignalItemPressed;
|
|
||||||
QTreeWidget_hook_hook_ItemPressed(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
QTreeWidget_itemEntered_Event(Method) := QtTreeWidget.SignalItemEntered;
|
|
||||||
QTreeWidget_hook_hook_ItemEntered(QTreeWidget_hook_create(QtTreeWidget.Widget), Method);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Result := THandle(QtTreeWidget);
|
Result := THandle(QtTreeWidget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -131,21 +131,13 @@ class function TQtWSCustomControl.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtAbstractScrollArea: TQtAbstractScrollArea;
|
QtAbstractScrollArea: TQtAbstractScrollArea;
|
||||||
Method: TMethod;
|
|
||||||
Hook: QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('> TQtWSCustomControl.CreateHandle for ',dbgsname(AWinControl));
|
WriteLn('> TQtWSCustomControl.CreateHandle for ',dbgsname(AWinControl));
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
QtAbstractScrollArea := TQtAbstractScrollArea.Create(AWinControl, AParams);
|
QtAbstractScrollArea := TQtAbstractScrollArea.Create(AWinControl, AParams);
|
||||||
|
QtAbstractScrollArea.AttachEvents;
|
||||||
Hook := QAbstractScrollArea_hook_create(QtAbstractScrollArea.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtAbstractScrollArea.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
Result := THandle(QtAbstractScrollArea);
|
Result := THandle(QtAbstractScrollArea);
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
@ -184,36 +176,41 @@ end;
|
|||||||
Shows or hides a widget.
|
Shows or hides a widget.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class procedure TQtWSCustomControl.ShowHide(const AWinControl: TWinControl);
|
class procedure TQtWSCustomControl.ShowHide(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
Widget: TQtWidget;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('Trace:> [TQtWSCustomControl.ShowHide]');
|
WriteLn('Trace:> [TQtWSCustomControl.ShowHide]');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
if AWinControl = nil then exit;
|
if (AWinControl = nil) or not AWinControl.HandleAllocated then
|
||||||
|
exit;
|
||||||
if not AWinControl.HandleAllocated then exit;
|
|
||||||
|
|
||||||
|
Widget := TQtWidget(AWinControl.Handle);
|
||||||
{ if the widget is a form, this is a place to set the Tab order }
|
{ if the widget is a form, this is a place to set the Tab order }
|
||||||
if (AWinControl is TForm) and AWinControl.HandleObjectShouldBeVisible then
|
if AWinControl.HandleObjectShouldBeVisible and (Widget is TQtMainWindow) then
|
||||||
TQtMainWindow(AWinControl.Handle).SetTabOrders;
|
TQtMainWindow(Widget).SetTabOrders;
|
||||||
|
|
||||||
if AWinControl.HandleObjectShouldBeVisible then
|
if AWinControl.HandleObjectShouldBeVisible then
|
||||||
QWidget_setVisible(TQtWidget(AWinControl.Handle).Widget, True)
|
QWidget_setVisible(Widget.Widget, True)
|
||||||
else QWidget_setVisible(TQtWidget(AWinControl.Handle).Widget, False);
|
else
|
||||||
|
QWidget_setVisible(Widget.Widget, False);
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
Write('Trace:< [TQtWSCustomControl.ShowHide] ');
|
Write('Trace:< [TQtWSCustomControl.ShowHide] ');
|
||||||
|
|
||||||
if AWinControl is TForm then Write('Is TForm, ');
|
if AWinControl is TForm then
|
||||||
|
Write('Is TForm, ');
|
||||||
|
|
||||||
if AWinControl.HandleObjectShouldBeVisible then WriteLn('Visible: True')
|
if AWinControl.HandleObjectShouldBeVisible then
|
||||||
else WriteLn('Visible: False');
|
WriteLn('Visible: True')
|
||||||
|
else
|
||||||
|
WriteLn('Visible: False');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
// showhide fires before invalidate, so we must create viewport right here
|
// showhide fires before invalidate, so we must create viewport right here
|
||||||
if not AWinControl.InheritsFrom(TCustomForm)
|
if Widget is TQtAbstractScrollArea then
|
||||||
then
|
TQtAbstractScrollArea(Widget).viewportNeeded;
|
||||||
TQtAbstractScrollArea(AWinControl.Handle).viewportNeeded;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -230,14 +227,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
Widget := TQtWidget(AWinControl.Handle);
|
Widget := TQtWidget(AWinControl.Handle);
|
||||||
if Assigned(Widget.LCLObject.Parent) then
|
if Assigned(Widget.LCLObject.Parent) then
|
||||||
FocusWidget := QWidget_focusWidget(TQtWidget(Widget.LCLObject.Parent.Handle).Widget)
|
FocusWidget := QWidget_focusWidget(TQtWidget(Widget.LCLObject.Parent.Handle).Widget)
|
||||||
else
|
else
|
||||||
FocusWidget := QWidget_focusWidget(Widget.Widget);
|
FocusWidget := QWidget_focusWidget(Widget.Widget);
|
||||||
|
|
||||||
Result := (FocusWidget <> nil)
|
Result := (FocusWidget <> nil) and
|
||||||
and QWidget_isEnabled(FocusWidget)
|
QWidget_isEnabled(FocusWidget) and
|
||||||
and QWidget_isVisible(FocusWidget)
|
QWidget_isVisible(FocusWidget) and
|
||||||
and (QWidget_focusPolicy(FocusWidget) <> QtNoFocus);
|
(QWidget_focusPolicy(FocusWidget) <> QtNoFocus);
|
||||||
end else
|
end else
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
@ -251,22 +248,14 @@ class function TQtWSWinControl.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtWidget: TQtWidget;
|
QtWidget: TQtWidget;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('> TQtWSWinControl.CreateHandle for ',dbgsname(AWinControl));
|
WriteLn('> TQtWSWinControl.CreateHandle for ',dbgsname(AWinControl));
|
||||||
{$endif}
|
{$endif}
|
||||||
QtWidget := TQtWidget.Create(AWinControl, AParams);
|
QtWidget := TQtWidget.Create(AWinControl, AParams);
|
||||||
|
|
||||||
// Various Events
|
QtWidget.AttachEvents;
|
||||||
|
|
||||||
Hook := QObject_hook_create(QtWidget.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtWidget.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// Finalization
|
// Finalization
|
||||||
|
|
||||||
Result := THandle(QtWidget);
|
Result := THandle(QtWidget);
|
||||||
@ -351,30 +340,36 @@ end;
|
|||||||
Shows or hides a widget.
|
Shows or hides a widget.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class procedure TQtWSWinControl.ShowHide(const AWinControl: TWinControl);
|
class procedure TQtWSWinControl.ShowHide(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
Widget: TQtWidget;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('Trace:> [TQtWSWinControl.ShowHide]');
|
WriteLn('Trace:> [TQtWSWinControl.ShowHide]');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
if AWinControl = nil then exit;
|
if (AWinControl = nil) or not AWinControl.HandleAllocated then
|
||||||
|
exit;
|
||||||
if not AWinControl.HandleAllocated then exit;
|
|
||||||
|
|
||||||
|
Widget := TQtWidget(AWinControl.Handle);
|
||||||
{ if the widget is a form, this is a place to set the Tab order }
|
{ if the widget is a form, this is a place to set the Tab order }
|
||||||
if (AWinControl is TForm) and AWinControl.HandleObjectShouldBeVisible then
|
if AWinControl.HandleObjectShouldBeVisible and (Widget is TQtMainWindow) then
|
||||||
TQtMainWindow(AWinControl.Handle).SetTabOrders;
|
TQtMainWindow(Widget).SetTabOrders;
|
||||||
|
|
||||||
if AWinControl.HandleObjectShouldBeVisible then
|
if AWinControl.HandleObjectShouldBeVisible then
|
||||||
QWidget_setVisible(TQtWidget(AWinControl.Handle).Widget, True)
|
QWidget_setVisible(Widget.Widget, True)
|
||||||
else QWidget_setVisible(TQtWidget(AWinControl.Handle).Widget, False);
|
else
|
||||||
|
QWidget_setVisible(Widget.Widget, False);
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
Write('Trace:< [TQtWSWinControl.ShowHide] ');
|
Write('Trace:< [TQtWSWinControl.ShowHide] ');
|
||||||
|
|
||||||
if AWinControl is TForm then Write('Is TForm, ');
|
if AWinControl is TForm then
|
||||||
|
Write('Is TForm, ');
|
||||||
|
|
||||||
if AWinControl.HandleObjectShouldBeVisible then WriteLn('Visible: True')
|
if AWinControl.HandleObjectShouldBeVisible then
|
||||||
else WriteLn('Visible: False');
|
WriteLn('Visible: True')
|
||||||
|
else
|
||||||
|
WriteLn('Visible: False');
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -253,18 +253,9 @@ class function TQtWSCustomPanel.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtFrame: TQtFrame;
|
QtFrame: TQtFrame;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtFrame := TQtFrame.Create(AWinControl, AParams);
|
QtFrame := TQtFrame.Create(AWinControl, AParams);
|
||||||
|
QtFrame.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QObject_hook_create(QtFrame.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtFrame.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// Set´s initial properties
|
// Set´s initial properties
|
||||||
|
|
||||||
@ -304,25 +295,15 @@ class function TQtWSCustomPage.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtWidget: TQtWidget;
|
QtWidget: TQtWidget;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QTabBar_hookH;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('Trace:> [TQtWSCustomPage.CreateHandle]');
|
WriteLn('Trace:> [TQtWSCustomPage.CreateHandle]');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
QtWidget := TQtWidget.CreatePage(AWinControl, AParams);
|
QtWidget := TQtWidget.CreatePage(AWinControl, AParams);
|
||||||
|
QtWidget.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QTabBar_hook_create(QtWidget.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtWidget.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// Returns the Handle
|
// Returns the Handle
|
||||||
|
|
||||||
Result := THandle(QtWidget);
|
Result := THandle(QtWidget);
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
@ -373,8 +354,6 @@ end;
|
|||||||
class function TQtWSCustomNotebook.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSCustomNotebook.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtTabWidget: TQtTabWidget;
|
QtTabWidget: TQtTabWidget;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QTabWidget_hookH;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('TQtWSCustomNotebook.CreateHandle');
|
WriteLn('TQtWSCustomNotebook.CreateHandle');
|
||||||
@ -382,18 +361,7 @@ begin
|
|||||||
|
|
||||||
QtTabWidget := TQtTabWidget.Create(AWinControl, AParams);
|
QtTabWidget := TQtTabWidget.Create(AWinControl, AParams);
|
||||||
QtTabWidget.SetTabPosition(QTabWidgetTabPositionMap[TCustomNoteBook(AWinControl).TabPosition]);
|
QtTabWidget.SetTabPosition(QTabWidgetTabPositionMap[TCustomNoteBook(AWinControl).TabPosition]);
|
||||||
|
QtTabWidget.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QTabWidget_hook_create(QtTabWidget.Widget);
|
|
||||||
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtTabWidget.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QTabWidget_currentChanged_Event(Method) := QtTabWidget.SignalCurrentChanged;
|
|
||||||
QTabWidget_hook_hook_currentChanged(QTabWidget_hook_create(QtTabWidget.Widget), Method);
|
|
||||||
|
|
||||||
// Returns the Handle
|
// Returns the Handle
|
||||||
|
|
||||||
@ -454,8 +422,6 @@ class function TQtWSCustomRadioGroup.CreateHandle(const AWinControl: TWinControl
|
|||||||
var
|
var
|
||||||
QtGroupBox: TQtGroupBox;
|
QtGroupBox: TQtGroupBox;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QGroupBox_hookH;
|
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@ -483,9 +449,7 @@ begin
|
|||||||
QGridLayout_setRowStretch(QtGroupBox.BoxLayout, i, 0);
|
QGridLayout_setRowStretch(QtGroupBox.BoxLayout, i, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Hook := QGroupBox_hook_create(QtGroupBox.Widget);
|
QtGroupBox.AttachEvents;
|
||||||
TEventFilterMethod(Method) := QtGroupBox.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
Result := THandle(QtGroupBox);
|
Result := THandle(QtGroupBox);
|
||||||
end;
|
end;
|
||||||
@ -560,8 +524,6 @@ class function TQtWSCustomCheckGroup.CreateHandle(const AWinControl: TWinControl
|
|||||||
var
|
var
|
||||||
QtGroupBox: TQtGroupBox;
|
QtGroupBox: TQtGroupBox;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QGroupBox_hookH;
|
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@ -588,9 +550,7 @@ begin
|
|||||||
QGridLayout_setRowStretch(QtGroupBox.BoxLayout, i, 0);
|
QGridLayout_setRowStretch(QtGroupBox.BoxLayout, i, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Hook := QGroupBox_hook_create(QtGroupBox.Widget);
|
QtGroupBox.AttachEvents;
|
||||||
TEventFilterMethod(Method) := QtGroupBox.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
Result := THandle(QtGroupBox);
|
Result := THandle(QtGroupBox);
|
||||||
end;
|
end;
|
||||||
|
@ -144,8 +144,6 @@ class function TQtWSCustomForm.CreateHandle(const AWinControl: TWinControl;
|
|||||||
var
|
var
|
||||||
QtMainWindow: TQtMainWindow;
|
QtMainWindow: TQtMainWindow;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('[TQtWSCustomForm.CreateHandle] Height: ', IntToStr(AWinControl.Height),
|
WriteLn('[TQtWSCustomForm.CreateHandle] Height: ', IntToStr(AWinControl.Height),
|
||||||
@ -174,15 +172,9 @@ begin
|
|||||||
SetQtBorderIcons(QtMainWindow, TCustomForm(AWinControl).BorderIcons);
|
SetQtBorderIcons(QtMainWindow, TCustomForm(AWinControl).BorderIcons);
|
||||||
|
|
||||||
// Sets Various Events
|
// Sets Various Events
|
||||||
|
QtMainWindow.AttachEvents;
|
||||||
|
|
||||||
Hook := QObject_hook_create(QtMainWindow.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtMainWindow.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// Return the handle
|
// Return the handle
|
||||||
|
|
||||||
Result := THandle(QtMainWindow);
|
Result := THandle(QtMainWindow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -113,8 +113,6 @@ var
|
|||||||
ParentMenu, Menu: TQtMenu;
|
ParentMenu, Menu: TQtMenu;
|
||||||
MenuBar: TQtMenuBar;
|
MenuBar: TQtMenuBar;
|
||||||
Text: WideString;
|
Text: WideString;
|
||||||
Method: TMethod;
|
|
||||||
Hook: QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('trace:> [TQtWSMenuItem.CreateHandle] Caption: ', AMenuItem.Caption,
|
WriteLn('trace:> [TQtWSMenuItem.CreateHandle] Caption: ', AMenuItem.Caption,
|
||||||
@ -223,19 +221,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if Menu <> nil then
|
if Menu <> nil then
|
||||||
begin
|
Menu.AttachEvents;
|
||||||
// Trigger event
|
|
||||||
|
|
||||||
QAction_triggered_Event(Method) := Menu.SlotTriggered;
|
|
||||||
|
|
||||||
QAction_hook_hook_triggered(QAction_hook_create(Menu.ActionHandle), Method);
|
|
||||||
|
|
||||||
Hook := QObject_hook_create(Menu.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := Menu.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn(' Result: ', dbghex(Result));
|
WriteLn(' Result: ', dbghex(Result));
|
||||||
@ -387,6 +373,8 @@ begin
|
|||||||
Parent := TQtMainWindow(TCustomForm(AMenu.Owner).Handle).Widget;
|
Parent := TQtMainWindow(TCustomForm(AMenu.Owner).Handle).Widget;
|
||||||
|
|
||||||
Menu := TQtMenu.Create(Parent);
|
Menu := TQtMenu.Create(Parent);
|
||||||
|
Menu.MenuItem := AMenu.Items;
|
||||||
|
Menu.AttachEvents;
|
||||||
|
|
||||||
Result := HMENU(Menu);
|
Result := HMENU(Menu);
|
||||||
end;
|
end;
|
||||||
|
@ -95,8 +95,6 @@ class function TQtWSCustomFloatSpinEdit.CreateHandle(const AWinControl: TWinCont
|
|||||||
var
|
var
|
||||||
QtSpinBox: TQtSpinBox;
|
QtSpinBox: TQtSpinBox;
|
||||||
QtFloatSpinBox: TQtFloatSpinBox;
|
QtFloatSpinBox: TQtFloatSpinBox;
|
||||||
Hook: QAbstractSpinBox_hookH;
|
|
||||||
Method: TMethod;
|
|
||||||
FIsFloat: Boolean;
|
FIsFloat: Boolean;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@ -105,41 +103,17 @@ begin
|
|||||||
FIsFloat := TCustomFloatSpinEdit(AWinControl).DecimalPlaces > 0;
|
FIsFloat := TCustomFloatSpinEdit(AWinControl).DecimalPlaces > 0;
|
||||||
|
|
||||||
if FIsFloat then
|
if FIsFloat then
|
||||||
QtFloatSpinBox := TQtFloatSpinBox.Create(AWinControl, AParams)
|
begin
|
||||||
|
QtFloatSpinBox := TQtFloatSpinBox.Create(AWinControl, AParams);
|
||||||
|
QtFloatSpinBox.AttachEvents;
|
||||||
|
Result := THandle(QtFloatSpinBox);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
QtSpinBox := TQtSpinBox.Create(AWinControl, AParams);
|
QtSpinBox := TQtSpinBox.Create(AWinControl, AParams);
|
||||||
|
QtSpinBox.AttachEvents;
|
||||||
if FIsFloat then
|
Result := THandle(QtSpinBox);
|
||||||
begin
|
|
||||||
Hook := QAbstractSpinBox_hook_create(QtFloatSpinBox.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtFloatSpinBox.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
{TODO: find out which TLMessage should be sended }
|
|
||||||
|
|
||||||
QAbstractSpinBox_editingFinished_Event(Method) := QtFloatSpinBox.SignalEditingFinished;
|
|
||||||
QAbstractSpinBox_hook_hook_editingFinished(QAbstractSpinBox_hook_create(QtFloatSpinBox.Widget), Method);
|
|
||||||
|
|
||||||
QDoubleSpinBox_valueChanged_Event(Method) := QtFloatSpinBox.SignalValueChanged;
|
|
||||||
QDoubleSpinBox_hook_hook_valueChanged(QDoubleSpinBox_hook_create(QtFloatSpinBox.Widget), Method);
|
|
||||||
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
Hook := QAbstractSpinBox_hook_create(QtSpinBox.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtSpinBox.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
{TODO: find out which TLMessage should be sended }
|
|
||||||
|
|
||||||
QAbstractSpinBox_editingFinished_Event(Method) := QtSpinBox.SignalEditingFinished;
|
|
||||||
QAbstractSpinBox_hook_hook_editingFinished(QAbstractSpinBox_hook_create(QtSpinBox.Widget), Method);
|
|
||||||
|
|
||||||
QSpinBox_valueChanged_Event(Method) := QtSpinBox.SignalValueChanged;
|
|
||||||
QSpinBox_hook_hook_valueChanged(QSpinBox_hook_create(QtSpinBox.Widget), Method);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FIsFloat then Result := THandle(QtFloatSpinBox)
|
|
||||||
else Result := THandle(QtSpinBox);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -150,9 +124,9 @@ end;
|
|||||||
class procedure TQtWSCustomFloatSpinEdit.DestroyHandle(const AWinControl: TWinControl);
|
class procedure TQtWSCustomFloatSpinEdit.DestroyHandle(const AWinControl: TWinControl);
|
||||||
begin
|
begin
|
||||||
if TCustomFloatSpinEdit(AWinControl).DecimalPlaces > 0 then
|
if TCustomFloatSpinEdit(AWinControl).DecimalPlaces > 0 then
|
||||||
TQtFloatSpinBox(AWinControl.Handle).Free
|
TQtFloatSpinBox(AWinControl.Handle).Free
|
||||||
else
|
else
|
||||||
TQtSpinBox(AWinControl.Handle).Free;
|
TQtSpinBox(AWinControl.Handle).Free;
|
||||||
|
|
||||||
AWinControl.Handle := 0;
|
AWinControl.Handle := 0;
|
||||||
end;
|
end;
|
||||||
@ -160,9 +134,9 @@ end;
|
|||||||
class function TQtWSCustomFloatSpinEdit.GetValue(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): single;
|
class function TQtWSCustomFloatSpinEdit.GetValue(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): single;
|
||||||
begin
|
begin
|
||||||
if ACustomFloatSpinEdit.DecimalPlaces > 0 then
|
if ACustomFloatSpinEdit.DecimalPlaces > 0 then
|
||||||
Result := QDoubleSpinBox_value(QDoubleSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget))
|
Result := QDoubleSpinBox_value(QDoubleSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget))
|
||||||
else
|
else
|
||||||
Result := QSpinBox_value(QSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget));
|
Result := QSpinBox_value(QSpinBoxH(TQtFloatSpinBox(ACustomFloatSpinEdit.Handle).Widget));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TQtWSCustomFloatSpinEdit.UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit);
|
class procedure TQtWSCustomFloatSpinEdit.UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit);
|
||||||
|
@ -337,10 +337,7 @@ uses LMessages;
|
|||||||
class function TQtWSScrollBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSScrollBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtScrollBar: TQtScrollBar;
|
QtScrollBar: TQtScrollBar;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QScrollBar_hookH;
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
QtScrollBar := TQtScrollBar.Create(AWinControl, AParams);
|
QtScrollBar := TQtScrollBar.Create(AWinControl, AParams);
|
||||||
|
|
||||||
case TScrollBar(AWinControl).Kind of
|
case TScrollBar(AWinControl).Kind of
|
||||||
@ -364,26 +361,7 @@ begin
|
|||||||
QtScrollBar.setRange(TScrollBar(AWinControl).Min, TScrollBar(AWinControl).Max);
|
QtScrollBar.setRange(TScrollBar(AWinControl).Min, TScrollBar(AWinControl).Max);
|
||||||
QtScrollbar.setValue(TScrollBar(AWinControl).Position);
|
QtScrollbar.setValue(TScrollBar(AWinControl).Position);
|
||||||
QtScrollBar.setPageStep(TScrollBar(AWinControl).PageSize);
|
QtScrollBar.setPageStep(TScrollBar(AWinControl).PageSize);
|
||||||
|
QtScrollBar.AttachEvents;
|
||||||
// Various Events
|
|
||||||
Hook := QScrollBar_hook_create(QtScrollBar.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtScrollBar.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QAbstractSlider_rangeChanged_Event(Method) := QtScrollBar.SlotRangeChanged;
|
|
||||||
QAbstractSlider_hook_hook_rangeChanged(QAbstractSlider_hook_create(QtScrollBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_sliderMoved_Event(Method) := QtScrollBar.SlotSliderMoved;
|
|
||||||
QAbstractSlider_hook_hook_sliderMoved(QAbstractSlider_hook_create(QtScrollBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_sliderPressed_Event(Method) := QtScrollBar.SlotSliderPressed;
|
|
||||||
QAbstractSlider_hook_hook_sliderPressed(QAbstractSlider_hook_create(QtScrollBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_sliderReleased_Event(Method) := QtScrollBar.SlotSliderReleased;
|
|
||||||
QAbstractSlider_hook_hook_sliderReleased(QAbstractSlider_hook_create(QtScrollBar.Widget), Method);
|
|
||||||
|
|
||||||
QAbstractSlider_valueChanged_Event(Method) := QtScrollBar.SlotValueChanged;
|
|
||||||
QAbstractSlider_hook_hook_valueChanged(QAbstractSlider_hook_create(QtScrollBar.Widget), Method);
|
|
||||||
|
|
||||||
Result := THandle(QtScrollbar);
|
Result := THandle(QtScrollbar);
|
||||||
end;
|
end;
|
||||||
@ -453,28 +431,10 @@ end;
|
|||||||
class function TQtWSCustomListBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
class function TQtWSCustomListBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtListWidget: TQtListWidget;
|
QtListWidget: TQtListWidget;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QListWidget_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtListWidget := TQtListWidGet.Create(AWinControl, AParams);
|
QtListWidget := TQtListWidGet.Create(AWinControl, AParams);
|
||||||
|
|
||||||
// Various Events
|
QtListWidget.AttachEvents;
|
||||||
|
|
||||||
Hook := QListWidget_hook_create(QtListWidget.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtListWidget.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// OnSelectionChange event
|
|
||||||
QListWidget_currentItemChanged_Event(Method) := QtListWidget.SlotSelectionChange;
|
|
||||||
QListWidget_hook_hook_currentItemChanged(QListWidget_hook_create(QtListWidget.Widget), Method);
|
|
||||||
|
|
||||||
QListWidget_itemDoubleClicked_Event(Method) := QtListWidget.SignalItemDoubleClicked;
|
|
||||||
QListWidget_hook_hook_ItemDoubleClicked(QListWidget_hook_create(QtListWidget.Widget), Method);
|
|
||||||
|
|
||||||
QListWidget_itemClicked_Event(Method) := QtListWidget.SignalItemClicked;
|
|
||||||
QListWidget_hook_hook_ItemClicked(QListWidget_hook_create(QtListWidget.Widget), Method);
|
|
||||||
|
|
||||||
// QListWidget_itemClicked_Event(Method;
|
// QListWidget_itemClicked_Event(Method;
|
||||||
|
|
||||||
@ -628,22 +588,10 @@ class function TQtWSCustomMemo.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtTextEdit: TQtTextEdit;
|
QtTextEdit: TQtTextEdit;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QTextEdit_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtTextEdit := TQtTextEdit.Create(AWinControl, AParams);
|
QtTextEdit := TQtTextEdit.Create(AWinControl, AParams);
|
||||||
|
QtTextEdit.AttachEvents;
|
||||||
|
|
||||||
Hook := QTextEdit_hook_create(QtTextEdit.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtTextEdit.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
{TODO: BUG CopyUnicodeToPWideString() segfaults while calling SetLength()
|
|
||||||
workaround: add try..except around SetLength() }
|
|
||||||
QTextEdit_textChanged_Event(Method) := QtTextEdit.SignalTextChanged;
|
|
||||||
QTextEdit_hook_hook_textChanged(QTextEdit_hook_create(QtTextEdit.Widget), Method);
|
|
||||||
|
|
||||||
Result := THandle(QtTextEdit);
|
Result := THandle(QtTextEdit);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -767,21 +715,9 @@ class function TQtWSCustomEdit.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
QtLineEdit: TQtLineEdit;
|
QtLineEdit: TQtLineEdit;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QLineEdit_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtLineEdit := TQtLineEdit.Create(AWinControl, AParams);
|
QtLineEdit := TQtLineEdit.Create(AWinControl, AParams);
|
||||||
|
QtLineEdit.AttachEvents;
|
||||||
Hook := QLineEdit_hook_create(QtLineEdit.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtLineEdit.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
{TODO: BUG CopyUnicodeToPWideString() segfaults while calling SetLength()
|
|
||||||
workaround: add try..except around SetLength() }
|
|
||||||
QLineEdit_textChanged_Event(Method) := QtLineEdit.SignalTextChanged;
|
|
||||||
QLineEdit_hook_hook_textChanged(QLineEdit_hook_create(QtLineEdit.Widget), Method);
|
|
||||||
|
|
||||||
Result := THandle(QtLineEdit);
|
Result := THandle(QtLineEdit);
|
||||||
end;
|
end;
|
||||||
@ -972,31 +908,14 @@ class function TQtWSButton.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): TLCLIntfHandle;
|
const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
QtPushButton: TQtPushButton;
|
QtPushButton: TQtPushButton;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtPushButton := TQtPushButton.Create(AWinControl, AParams);
|
QtPushButton := TQtPushButton.Create(AWinControl, AParams);
|
||||||
|
QtPushButton.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QObject_hook_create(QtPushButton.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtPushButton.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// OnClick Event
|
|
||||||
|
|
||||||
QAbstractButton_clicked2_Event(Method) := QtPushButton.SlotClicked;
|
|
||||||
|
|
||||||
QAbstractButton_hook_hook_clicked2(QAbstractButton_hook_create(QtPushButton.Widget), Method);
|
|
||||||
|
|
||||||
// Focus
|
// Focus
|
||||||
|
|
||||||
QWidget_setFocusPolicy(QtPushButton.Widget, QtStrongFocus);
|
QWidget_setFocusPolicy(QtPushButton.Widget, QtStrongFocus);
|
||||||
|
|
||||||
// Returns the Handle
|
// Returns the Handle
|
||||||
|
|
||||||
Result := THandle(QtPushButton);
|
Result := THandle(QtPushButton);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1160,29 +1079,18 @@ end;
|
|||||||
class function TQtWSCustomCheckBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
|
class function TQtWSCustomCheckBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
QtCheckBox: TQtCheckBox;
|
QtCheckBox: TQtCheckBox;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QAbstractButton_hookH;
|
|
||||||
ATextWidth: Integer;
|
ATextWidth: Integer;
|
||||||
FM: QFontMetricsH;
|
FM: QFontMetricsH;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
begin
|
begin
|
||||||
QtCheckBox := TQtCheckBox.Create(AWinControl, AParams);
|
QtCheckBox := TQtCheckBox.Create(AWinControl, AParams);
|
||||||
|
QtCheckBox.AttachEvents;
|
||||||
|
|
||||||
// Focus
|
// Focus
|
||||||
// QWidget_setFocusPolicy(QtCheckBox.Widget, QtStrongFocus);
|
// QWidget_setFocusPolicy(QtCheckBox.Widget, QtStrongFocus);
|
||||||
{we have a bug in LCL when parent is TCustomCheckGroup, it doesn't set sizes for items ?!? Width = 0 , Height = 0}
|
{we have a bug in LCL when parent is TCustomCheckGroup, it doesn't set sizes for items ?!? Width = 0 , Height = 0}
|
||||||
// writeln('WW=',QWidget_width(QtCheckBox.Widget),' WH=',QWidget_height(QtCheckBox.Widget),' WCW=',AWinControl.Width,' WCH=',AWinControl.Height,' CAPTION=',TCustomCheckBox(AWinControl).Caption);
|
// writeln('WW=',QWidget_width(QtCheckBox.Widget),' WH=',QWidget_height(QtCheckBox.Widget),' WCW=',AWinControl.Width,' WCH=',AWinControl.Height,' CAPTION=',TCustomCheckBox(AWinControl).Caption);
|
||||||
|
|
||||||
Hook := QCheckBox_hook_create(QtCheckBox.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtCheckBox.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
|
|
||||||
QCheckBox_stateChanged_Event(Method) := QtCheckBox.SignalStateChanged;
|
|
||||||
QCheckBox_hook_hook_stateChanged(QCheckBox_hook_create(QtCheckBox.Widget), Method);
|
|
||||||
|
|
||||||
{we must cheat TCustomCheckGroup here with some reasonable CheckBox size...}
|
{we must cheat TCustomCheckGroup here with some reasonable CheckBox size...}
|
||||||
if AWinControl.Height = 0 then
|
if AWinControl.Height = 0 then
|
||||||
begin
|
begin
|
||||||
@ -1301,23 +1209,13 @@ class function TQtWSRadioButton.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): TLCLIntfHandle;
|
const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
QtRadioButton: TQtRadioButton;
|
QtRadioButton: TQtRadioButton;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QAbstractButton_hookH;
|
|
||||||
ATextWidth: Integer;
|
ATextWidth: Integer;
|
||||||
FM: QFontMetricsH;
|
FM: QFontMetricsH;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
QtRadioButton := TQtRadioButton.Create(AWinControl, AParams);
|
QtRadioButton := TQtRadioButton.Create(AWinControl, AParams);
|
||||||
|
QtRadioButton.AttachEvents;
|
||||||
|
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QAbstractButton_hook_create(QtRadioButton.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtRadioButton.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
{we must cheat TCustomRadioGroup here with some reasonable RadioButton size...}
|
{we must cheat TCustomRadioGroup here with some reasonable RadioButton size...}
|
||||||
if AWinControl.Height = 0 then
|
if AWinControl.Height = 0 then
|
||||||
begin
|
begin
|
||||||
@ -1336,9 +1234,6 @@ begin
|
|||||||
AWinControl.SetInitialBounds(0, 0, ATextWidth + 22, 22);
|
AWinControl.SetInitialBounds(0, 0, ATextWidth + 22, 22);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
QAbstractButton_clicked_Event(Method) := QtRadioButton.SignalClicked;
|
|
||||||
QAbstractButton_hook_hook_clicked(QAbstractButton_hook_create(QtRadioButton.Widget), Method);
|
|
||||||
|
|
||||||
// Focus
|
// Focus
|
||||||
|
|
||||||
//QWidget_setFocusPolicy(QtRadioButton.Widget, QtStrongFocus);
|
//QWidget_setFocusPolicy(QtRadioButton.Widget, QtStrongFocus);
|
||||||
@ -1376,19 +1271,14 @@ class function TQtWSCustomGroupBox.CreateHandle(const AWinControl: TWinControl;
|
|||||||
var
|
var
|
||||||
QtGroupBox: TQtGroupBox;
|
QtGroupBox: TQtGroupBox;
|
||||||
Str: WideString;
|
Str: WideString;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QGroupBox_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
QtGroupBox := TQtGroupBox.Create(AWinControl, AParams);
|
||||||
|
QtGroupBox.AttachEvents;
|
||||||
|
|
||||||
// If SetSlots is uncommented, then TRadioGroup stops working
|
// If SetSlots is uncommented, then TRadioGroup stops working
|
||||||
// This needs further investigation --> Problem is with child controls sizes (zeljko@holobit.net)
|
// This needs further investigation --> Problem is with child controls sizes (zeljko@holobit.net)
|
||||||
// SetSlots(QtButtonGroup);
|
// SetSlots(QtButtonGroup);
|
||||||
|
|
||||||
Hook := QGroupBox_hook_create(QtGroupBox.Widget);
|
|
||||||
TEventFilterMethod(Method) := QtGroupBox.EventFilter;
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
Str := UTF8Decode(AWinControl.Caption);
|
Str := UTF8Decode(AWinControl.Caption);
|
||||||
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
|
QGroupBox_setTitle(QGroupBoxH(QtGroupBox.Widget), @Str);
|
||||||
|
|
||||||
@ -1427,32 +1317,9 @@ class function TQtWSCustomComboBox.CreateHandle(const AWinControl: TWinControl;
|
|||||||
const AParams: TCreateParams): TLCLIntfHandle;
|
const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
QtComboBox: TQtComboBox;
|
QtComboBox: TQtComboBox;
|
||||||
Method: TMethod;
|
|
||||||
Hook : QObject_hookH;
|
|
||||||
begin
|
begin
|
||||||
QtComboBox := TQtComboBox.Create(AWinControl, AParams);
|
QtComboBox := TQtComboBox.Create(AWinControl, AParams);
|
||||||
|
QtComboBox.AttachEvents;
|
||||||
// Various Events
|
|
||||||
|
|
||||||
Hook := QObject_hook_create(QtComboBox.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := QtComboBox.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
// OnChange event
|
|
||||||
|
|
||||||
QComboBox_editTextChanged_Event(Method) := QtComboBox.SlotChange;
|
|
||||||
|
|
||||||
QComboBox_hook_hook_editTextChanged(
|
|
||||||
QComboBox_hook_create(QtComboBox.Widget), Method);
|
|
||||||
|
|
||||||
// OnSelect event
|
|
||||||
|
|
||||||
QComboBox_currentIndexChanged_Event(Method) := QtComboBox.SlotSelect;
|
|
||||||
|
|
||||||
QComboBox_hook_hook_currentIndexChanged(
|
|
||||||
QComboBox_hook_create(QtComboBox.Widget), Method);
|
|
||||||
|
|
||||||
Result := THandle(QtComboBox);
|
Result := THandle(QtComboBox);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user