mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 04:37:15 +01:00
qt: retrieve more correct titlebar colors. use direct windows call under qt-windows
git-svn-id: trunk@17648 -
This commit is contained in:
parent
befdca0dbb
commit
3c5d2f3da3
@ -36,6 +36,9 @@ interface
|
||||
{$endif}
|
||||
|
||||
uses
|
||||
{$IFDEF MSWINDOWS}
|
||||
Windows, // used to retrieve correct caption color values
|
||||
{$ENDIF}
|
||||
// Bindings - qt4 must come first to avoid type redefinition problems
|
||||
qt4,
|
||||
// FPC
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* 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, *
|
||||
@ -81,9 +81,9 @@ begin
|
||||
DC := TQtDeviceContext.Create(Widget.PaintData.PaintWidget, True)
|
||||
else
|
||||
DC := TQtDeviceContext.Create(nil, True);
|
||||
|
||||
|
||||
PS.hdc := HDC(DC);
|
||||
|
||||
|
||||
if Handle<>0 then
|
||||
begin
|
||||
// if current handle has paintdata information,
|
||||
@ -102,7 +102,7 @@ begin
|
||||
DC.vClipRect^ := Widget.PaintData.ClipRect^;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
Result := PS.hdc;
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
@ -115,10 +115,10 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:> [TQtWidgetSet.BitBlt]');
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := StretchBlt(DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, Width,
|
||||
Height, ROP);
|
||||
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:< [TQtWidgetSet.BitBlt]');
|
||||
{$endif}
|
||||
@ -153,7 +153,7 @@ begin
|
||||
if Result then
|
||||
begin
|
||||
APoint := QtPoint(P.X, P.Y);
|
||||
|
||||
|
||||
QWidget_mapToGlobal(TQtWidget(Handle).GetContainerWidget, @APoint, @APoint);
|
||||
P := Point(APoint.x, APoint.y);
|
||||
end;
|
||||
@ -232,12 +232,12 @@ begin
|
||||
RDest := TQtRegion(Dest).Widget;
|
||||
RSrc1 := TQtRegion(Src1).Widget;
|
||||
end;
|
||||
|
||||
|
||||
if (fnCombineMode<>RGN_COPY) and not IsValidGDIObject(Src2) then
|
||||
exit
|
||||
else
|
||||
RSrc2 := TQtRegion(Src2).Widget;
|
||||
|
||||
|
||||
case fnCombineMode of
|
||||
RGN_AND:
|
||||
QRegion_Intersect(RSrc1, RDest, RSrc2);
|
||||
@ -255,7 +255,7 @@ begin
|
||||
RGN_XOR:
|
||||
QRegion_eor(RSrc1, RDest, RSrc2);
|
||||
end;
|
||||
|
||||
|
||||
if QRegion_isEmpty(RDest) then
|
||||
result := NULLREGION
|
||||
else begin
|
||||
@ -343,7 +343,7 @@ begin
|
||||
else
|
||||
Format := QImageFormat_ARGB32;
|
||||
end;
|
||||
|
||||
|
||||
RSS := GetBytesPerLine(Width, BitCount, rileWordBoundary);
|
||||
if BitmapBits <> nil then
|
||||
begin
|
||||
@ -445,7 +445,7 @@ begin
|
||||
QtRadialGradientPattern,
|
||||
QtConicalGradientPattern
|
||||
}
|
||||
|
||||
|
||||
// set brush color
|
||||
Color := QBrush_Color(QtBrush.Widget)^;
|
||||
ColorRefToTQColor(ColorToRGB(logBrush.lbColor), Color);
|
||||
@ -624,7 +624,7 @@ var
|
||||
begin
|
||||
Result := 0;
|
||||
QtPen := TQtPen.Create(True);
|
||||
|
||||
|
||||
with LogPen do
|
||||
begin
|
||||
case lopnStyle and PS_STYLE_MASK of
|
||||
@ -704,7 +704,7 @@ var
|
||||
QtRegion: TQtRegion;
|
||||
begin
|
||||
QtRegion := TQtRegion.Create(True, X1,Y1,X2,Y2);
|
||||
Result := HRGN(QtRegion);
|
||||
Result := HRGN(QtRegion);
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace: [WinAPI CreateRectRgn] Result: ', dbghex(Result),
|
||||
' QRegionH: ', dbghex(PtrInt(QtRegion.Widget)));
|
||||
@ -737,10 +737,10 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI DeleteDC] Handle: ', dbghex(hDC));
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := False;
|
||||
if not IsValidDC(hDC) then exit;
|
||||
|
||||
|
||||
TQtDeviceContext(hDC).Free;
|
||||
end;
|
||||
|
||||
@ -776,7 +776,7 @@ begin
|
||||
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
||||
if not IsValidGDIObject(GDIObject) then
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
@ -814,11 +814,11 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
ObjType := 'Image';
|
||||
{$endif}
|
||||
|
||||
|
||||
// we must stop paintdevice before destroying
|
||||
|
||||
APaintEngine := QImage_paintEngine(TQtImage(AObject).Handle);
|
||||
|
||||
|
||||
if (APaintEngine <> nil) and QPaintEngine_isActive(APaintEngine) then
|
||||
begin
|
||||
APainter := QPaintEngine_painter(APaintEngine);
|
||||
@ -835,7 +835,7 @@ begin
|
||||
ObjType := 'Region';
|
||||
{$endif}
|
||||
end
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Pen
|
||||
------------------------------------------------------------------------------}
|
||||
@ -853,7 +853,7 @@ begin
|
||||
DebugLn('WARNING: Trying to Free a default resource');
|
||||
AObject := nil;
|
||||
end;
|
||||
|
||||
|
||||
if AObject <> nil then
|
||||
begin
|
||||
//WriteLn('Delete object: ', PtrUInt(AObject));
|
||||
@ -1017,7 +1017,7 @@ var
|
||||
APen.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI DrawEdge] ');
|
||||
@ -1025,9 +1025,9 @@ begin
|
||||
|
||||
Result := False;
|
||||
if not IsValidDC(DC) then exit;
|
||||
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
|
||||
|
||||
ClientRect := Rect;
|
||||
Dec(ClientRect.Right, 1);
|
||||
Dec(ClientRect.Bottom, 1);
|
||||
@ -1101,11 +1101,11 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
|
||||
if not IsValidDC(DC)
|
||||
then
|
||||
exit;
|
||||
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
|
||||
Matrix := QMatrix_create;
|
||||
@ -1125,7 +1125,7 @@ begin
|
||||
P^.Y := QtPoint.Y;
|
||||
Inc(P);
|
||||
end;
|
||||
|
||||
|
||||
Result := True;
|
||||
finally
|
||||
QMatrix_destroy(MatrixInv);
|
||||
@ -1174,7 +1174,7 @@ begin
|
||||
|
||||
if not IsValidDC(DC) then
|
||||
Exit;
|
||||
|
||||
|
||||
QtDC :=TQtDeviceContext(DC);
|
||||
|
||||
if Count >= 0 then
|
||||
@ -1216,10 +1216,10 @@ begin
|
||||
|
||||
if Flags and DT_EXPANDTABS <> 0 then
|
||||
F := F or QtTextExpandTabs;
|
||||
|
||||
|
||||
QtDC.font.Metrics.BoundingRect(@R, @ARect, F, @WideStr);
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO: result should be different when DT_VCENTER or DT_BOTTOM is set
|
||||
Result := R.Bottom - R.Top;
|
||||
|
||||
@ -1329,7 +1329,7 @@ end;
|
||||
in each available typeface name. If set to a valid typeface
|
||||
name, the function enumerates all fonts with the
|
||||
specified name.
|
||||
|
||||
|
||||
lfPitchAndFamily Must be set to zero for all language versions of
|
||||
the operating system.
|
||||
|
||||
@ -1380,13 +1380,13 @@ var
|
||||
QStringList_destroy(StrLst);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI EnumFontFamiliesEx]');
|
||||
{$endif}
|
||||
Result := 0;
|
||||
|
||||
|
||||
if (lpLogFont^.lfCharSet = DEFAULT_CHARSET) and
|
||||
(lpLogFont^.lfFaceName= '') and
|
||||
(lpLogFont^.lfPitchAndFamily = 0) then
|
||||
@ -1429,9 +1429,9 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI ExcludeClipRect]');
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := ERROR;
|
||||
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
|
||||
ExRegion := QRegion_create(Left, Top, Right - Left, Bottom - Top, QRegionRectangle);
|
||||
@ -1441,7 +1441,7 @@ begin
|
||||
QRegion_subtract(Region, Region, ExRegion);
|
||||
QtDC.setClipRegion(Region);
|
||||
QtDC.setClipping(True);
|
||||
|
||||
|
||||
if QRegion_isEmpty(Region)
|
||||
then
|
||||
Result := NULLREGION
|
||||
@ -1526,12 +1526,12 @@ begin
|
||||
exit;
|
||||
end else
|
||||
Result := SIMPLEREGION;
|
||||
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
|
||||
|
||||
|
||||
QtWidget := QtObjectFromWidgetH(TQtDeviceContext(DC).Parent);
|
||||
|
||||
|
||||
if Assigned(QtWidget) and (QtWidget.PaintData.ClipRegion = nil) then
|
||||
begin
|
||||
// there is no clipping region in the DC
|
||||
@ -1558,7 +1558,7 @@ begin
|
||||
// GDK_Window_Get_Size(Drawable, @X, @Y);
|
||||
// DCOrigin := GetDCOffset(TQtDeviceContext(DC));
|
||||
GetDeviceSize(DC, DCOrigin);
|
||||
|
||||
|
||||
if (X = -1) and (Y = -1) then
|
||||
Clip := CreateRectRGN(-DCOrigin.X,-DCOrigin.Y,DCOrigin.X,DCOrigin.Y)
|
||||
else
|
||||
@ -1616,7 +1616,7 @@ begin
|
||||
|
||||
QtDC.drawText(X, Y, @WideStr);
|
||||
end;
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -1630,7 +1630,7 @@ end;
|
||||
function TQtWidgetSet.FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean;
|
||||
begin
|
||||
result:=false;
|
||||
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
DebugLn('[WinAPI FillRect Rect=', dbgs(Rect),' Brush=', dbghex(Brush));
|
||||
{$endif}
|
||||
@ -1663,11 +1663,11 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
|
||||
if not IsValidDC(DC) then exit;
|
||||
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
|
||||
|
||||
QtDC.save;
|
||||
OldRgn := TQtRegion.Create(True);
|
||||
try
|
||||
@ -1725,7 +1725,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
|
||||
if not IsValidDC(DC) then exit;
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
@ -1779,7 +1779,7 @@ end;
|
||||
Method: TQtWidgetSet.GetBitmapBits
|
||||
Params: none
|
||||
Returns:
|
||||
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.GetBitmapBits(Bitmap: HBITMAP; Count: Longint; Bits: Pointer): Longint;
|
||||
var
|
||||
@ -1788,9 +1788,9 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI GetBitmapBits]',' Bitmap=', dbghex(Bitmap),' Count=',Count);
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := 0;
|
||||
|
||||
|
||||
if (Bitmap = 0) or (Count <= 0) then
|
||||
Exit;
|
||||
|
||||
@ -1912,10 +1912,10 @@ begin
|
||||
Write('TQtWidgetSet.GetClipBox FastClip=',
|
||||
((vClipRect <> nil) and not vClipRectDirty) );
|
||||
{$endif}
|
||||
|
||||
|
||||
// the most correct way to get a clipbox if through
|
||||
// region.boundingrect, but it's slower.
|
||||
|
||||
|
||||
// TODO: remove "and false" below when vClipRectDirty is implemented
|
||||
// it should be "true" when user set a custom clip rect
|
||||
// and "false" on beginpaint
|
||||
@ -2012,20 +2012,20 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:> [WinAPI GetDC] hWnd: ', dbghex(hWnd));
|
||||
{$endif}
|
||||
|
||||
|
||||
Widget := TQtWidget(hWnd);
|
||||
|
||||
|
||||
if Widget <> nil then
|
||||
begin
|
||||
Result := Widget.Context;
|
||||
if Result = 0 then
|
||||
Result := HDC(QtDefaultContext);
|
||||
end
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := HDC(QtScreenContext);
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:< [WinAPI GetDC] Result: ', dbghex(Result));
|
||||
{$endif}
|
||||
@ -2070,17 +2070,17 @@ begin
|
||||
|
||||
Result := 0;
|
||||
if not IsValidDC(DC) then exit;
|
||||
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
|
||||
|
||||
if QtDC.Parent <> nil
|
||||
then
|
||||
w := QtDC.Parent
|
||||
else
|
||||
w := QApplication_desktop;
|
||||
|
||||
|
||||
PaintDevice := QWidget_to_QPaintDevice(w);
|
||||
|
||||
|
||||
case Index of
|
||||
HORZSIZE:
|
||||
Result := QPaintDevice_widthMM(PaintDevice);
|
||||
@ -2149,15 +2149,15 @@ const
|
||||
StateToggled = SmallInt($0001);
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
|
||||
case nVirtKey of
|
||||
VK_LSHIFT: nVirtKey := VK_SHIFT;
|
||||
VK_LCONTROL: nVirtKey := VK_CONTROL;
|
||||
VK_LMENU: nVirtKey := VK_MENU;
|
||||
end;
|
||||
|
||||
|
||||
// where to track toggle state?
|
||||
|
||||
|
||||
case nVirtKey of
|
||||
VK_LBUTTON:
|
||||
if (QApplication_mouseButtons and QtLeftButton) > 0 then
|
||||
@ -2209,7 +2209,7 @@ begin
|
||||
P.Y := 0;
|
||||
|
||||
if not IsValidDC(DC) then Exit;
|
||||
|
||||
|
||||
if (TObject(DC) is TQtDeviceContext) then
|
||||
P := TQtDeviceContext(DC).getDeviceSize;
|
||||
|
||||
@ -2253,9 +2253,9 @@ begin
|
||||
WriteLn('Trace:> [WinAPI GetObject] GDIObj: ' + dbghex(GDIObj));
|
||||
ObjType := '';
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := 0;
|
||||
|
||||
|
||||
if not IsValidGDIObject(GDIObj) then
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
@ -2430,7 +2430,7 @@ begin
|
||||
BitmapSection.dsBmih.biBitCount := BitmapSection.dsBm.bmBitsPixel;
|
||||
|
||||
BitmapSection.dsBmih.biCompression := 0;
|
||||
|
||||
|
||||
BitmapSection.dsBmih.biSizeImage := numBytes;
|
||||
BitmapSection.dsBmih.biXPelsPerMeter := dotsPerMeterX;
|
||||
BitmapSection.dsBmih.biYPelsPerMeter := dotsPerMeterY;
|
||||
@ -2465,13 +2465,13 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
writeln('Trace:> [WinAPI GetParent] Handle: ' + dbghex(Handle));
|
||||
{$endif}
|
||||
|
||||
|
||||
QtWidget := TQtWidget(Handle);
|
||||
|
||||
|
||||
w := QWidget_parentWidget(QtWidget.Widget);
|
||||
|
||||
|
||||
Result := HWND(QtObjectFromWidgetH(w));
|
||||
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
writeln('Trace:< [WinAPI GetParent] : ' + dbghex(Result));
|
||||
{$endif}
|
||||
@ -2503,7 +2503,7 @@ begin
|
||||
If lpRect <> nil then
|
||||
begin
|
||||
QRegion_boundingRect(TQtRegion(RGN).Widget, @R);
|
||||
|
||||
|
||||
with lpRect^ do
|
||||
begin
|
||||
Left := R.Left;
|
||||
@ -2533,9 +2533,9 @@ begin
|
||||
{$endif}
|
||||
Result := 0;
|
||||
if Handle = 0 then exit;
|
||||
|
||||
|
||||
w := TQtWidget(Handle);
|
||||
|
||||
|
||||
{TODO: find out what to do with TCustomForm descendants }
|
||||
if w is TQtAbstractScrollArea then
|
||||
begin
|
||||
@ -2582,7 +2582,7 @@ begin
|
||||
ScrollBar := TQtScrollBar(w)
|
||||
else
|
||||
ScrollBar := nil;
|
||||
|
||||
|
||||
if ScrollBar <> nil then
|
||||
Result := ScrollBar.getVisible;
|
||||
end;
|
||||
@ -2596,9 +2596,9 @@ end;
|
||||
scroll bar.
|
||||
SB_VERT Retrieves the parameters for the window's standard vertical
|
||||
scroll bar.
|
||||
|
||||
|
||||
ScrollInfo returns TScrollInfo structure.
|
||||
|
||||
|
||||
Returns: boolean
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
@ -2609,7 +2609,7 @@ begin
|
||||
Result := False;
|
||||
|
||||
if Handle = 0 then exit;
|
||||
|
||||
|
||||
if (csDestroying in TQtWidget(Handle).LCLObject.ComponentState) or
|
||||
(csFreeNotification in TQtWidget(Handle).LCLObject.ComponentState) then
|
||||
exit;
|
||||
@ -2635,7 +2635,7 @@ begin
|
||||
// POS
|
||||
if (ScrollInfo.fMask and SIF_POS) <> 0 then
|
||||
ScrollInfo.nPos := QtScrollBar.getValue;
|
||||
|
||||
|
||||
// RANGE
|
||||
if (ScrollInfo.fMask and SIF_RANGE) <> 0
|
||||
then begin
|
||||
@ -2645,7 +2645,7 @@ begin
|
||||
// PAGE
|
||||
if (ScrollInfo.fMask and SIF_PAGE) <> 0 then
|
||||
ScrollInfo.nPage := QtScrollBar.getPageStep;
|
||||
|
||||
|
||||
// TRACKPOS
|
||||
if (ScrollInfo.fMask and SIF_TRACKPOS) <> 0 then
|
||||
ScrollInfo.nTrackPos := QtScrollBar.getSliderPosition;
|
||||
@ -2661,7 +2661,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := 0;
|
||||
|
||||
|
||||
case Value of
|
||||
BLACK_BRUSH: // Black brush.
|
||||
Result := FStockBlackBrush;
|
||||
@ -2700,7 +2700,7 @@ begin
|
||||
FStockSystemFont := CreateDefaultFont;
|
||||
Result := FStockSystemFont;
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
else
|
||||
WriteLn('[WinAPI GetStockObject] UNHANDLED Value: ', Value);
|
||||
@ -2726,7 +2726,7 @@ function TQtWidgetSet.GetSysColor(nIndex: Integer): DWORD;
|
||||
QColor:=QPalette_color(Palette, Group, Role);
|
||||
Result:=(QColor^.r and $00FF) or ((QColor^.g and $00FF) shl 8) or ((QColor^.b and $00FF) shl 16);
|
||||
end;
|
||||
|
||||
|
||||
function GetClInfo(Bk: Boolean): TColor;
|
||||
var
|
||||
APalette: QPaletteH;
|
||||
@ -2766,7 +2766,7 @@ begin
|
||||
{$endif}
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
case nIndex of
|
||||
{$IFDEF USE_QT_44}
|
||||
COLOR_SCROLLBAR : Result:=GetColor(QPaletteActive, QPaletteButton);
|
||||
@ -2774,14 +2774,11 @@ begin
|
||||
COLOR_SCROLLBAR : Result:=GetColor(QPaletteActive, QPaletteMid);
|
||||
{$ENDIF}
|
||||
COLOR_BACKGROUND : Result:=GetColor(QPaletteActive, QPaletteWindow);
|
||||
COLOR_ACTIVECAPTION : Result:=GetColor(QPaletteActive, QPaletteHighlight);
|
||||
COLOR_INACTIVECAPTION : Result:=GetColor(QPaletteInActive, QPaletteBase);
|
||||
COLOR_MENU : Result:=GetColor(QPaletteActive, QPaletteWindow);
|
||||
COLOR_WINDOW : Result:=GetColor(QPaletteInActive, QPaletteBase);
|
||||
COLOR_WINDOWFRAME : Result:=GetColor(QPaletteActive, QPaletteShadow);
|
||||
COLOR_MENUTEXT : Result:=GetColor(QPaletteActive, QPaletteWindowText);
|
||||
COLOR_WINDOWTEXT : Result:=GetColor(QPaletteActive, QPaletteWindowText);
|
||||
COLOR_CAPTIONTEXT : Result:=GetColor(QPaletteActive, QPaletteHighlightedText);
|
||||
COLOR_ACTIVEBORDER : Result:=GetColor(QPaletteActive, QPaletteWindow);
|
||||
COLOR_INACTIVEBORDER : Result:=GetColor(QPaletteInactive, QPaletteWindow);
|
||||
COLOR_APPWORKSPACE : Result:=GetColor(QPaletteActive, QPaletteWindow);
|
||||
@ -2791,7 +2788,6 @@ begin
|
||||
COLOR_BTNSHADOW : Result:=GetColor(QPaletteActive, QPaletteDark);
|
||||
COLOR_GRAYTEXT : Result:=GetColor(QPaletteActive, QPaletteText);
|
||||
COLOR_BTNTEXT : Result:=GetColor(QPaletteActive, QPaletteButtonText);
|
||||
COLOR_INACTIVECAPTIONTEXT : Result:=GetColor(QPaletteInactive, QPaletteText);
|
||||
COLOR_BTNHIGHLIGHT : Result:=GetColor(QPaletteActive, QPaletteLight);
|
||||
COLOR_3DDKSHADOW : Result:=GetColor(QPaletteActive, QPaletteShadow);
|
||||
COLOR_3DLIGHT : Result:=GetColor(QPaletteActive, QPaletteMidlight);
|
||||
@ -2802,12 +2798,24 @@ begin
|
||||
COLOR_INFOTEXT : Result:=GetClInfo(False);
|
||||
COLOR_INFOBK : Result:=GetClInfo(True);
|
||||
{$ENDIF}
|
||||
// PBD: 25 is unassigned in all the docs I can find
|
||||
// if someone finds what this is supposed to be then fill it in
|
||||
// note defaults below, and cl[ColorConst] in graphics
|
||||
COLOR_HOTLIGHT : Result:=GetColor(QPaletteActive, QPaletteLight);
|
||||
COLOR_GRADIENTACTIVECAPTION : Result:=GetColor(QPaletteActive, QPaletteHighlight);
|
||||
|
||||
// qt does not provide any methods to retrieve titlebar colors
|
||||
{$IFNDEF MSWINDOWS}
|
||||
COLOR_ACTIVECAPTION : Result:=GetColor(QPaletteActive, QPaletteHighlight);
|
||||
COLOR_INACTIVECAPTION : Result:=GetColor(QPaletteInActive, QPaletteHighlight);
|
||||
COLOR_CAPTIONTEXT : Result:=GetColor(QPaletteActive, QPaletteHighlightedText);
|
||||
COLOR_INACTIVECAPTIONTEXT : Result:=GetColor(QPaletteInactive, QPaletteHighlightedText);
|
||||
COLOR_GRADIENTACTIVECAPTION : Result:=GetColor(QPaletteActive, QPaletteBase);
|
||||
COLOR_GRADIENTINACTIVECAPTION : Result:=GetColor(QPaletteInactive, QPaletteBase);
|
||||
{$ELSE}
|
||||
COLOR_ACTIVECAPTION : Result:=Windows.GetSysColor(COLOR_ACTIVECAPTION);
|
||||
COLOR_INACTIVECAPTION : Result:=Windows.GetSysColor(COLOR_INACTIVECAPTION);
|
||||
COLOR_CAPTIONTEXT : Result:=Windows.GetSysColor(COLOR_CAPTIONTEXT);
|
||||
COLOR_INACTIVECAPTIONTEXT : Result:=Windows.GetSysColor(COLOR_INACTIVECAPTIONTEXT);
|
||||
COLOR_GRADIENTACTIVECAPTION : Result:=Windows.GetSysColor(COLOR_GRADIENTACTIVECAPTION);
|
||||
COLOR_GRADIENTINACTIVECAPTION : Result:=Windows.GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
|
||||
{$ENDIF}
|
||||
COLOR_FORM : Result:=GetColor(QPaletteActive, QPaletteWindow);
|
||||
else
|
||||
Result:=0;
|
||||
@ -3124,7 +3132,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := 0;
|
||||
|
||||
|
||||
if IsValidDC(DC) then
|
||||
begin
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
@ -3217,7 +3225,7 @@ begin
|
||||
TM.tmStruckOut := Ord(QtDC.Font.getStrikeOut);
|
||||
|
||||
QtDC.font.family(@FontFamily);
|
||||
|
||||
|
||||
{ Defaults to a TrueType font.
|
||||
Note that the meaning of the FIXED_PITCH constant is the opposite of
|
||||
the name implies, according to MSDN docs. Just a small inconsistency
|
||||
@ -3259,7 +3267,7 @@ begin
|
||||
{$endif}
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
Matrix := QPainter_Matrix(TQtDeviceContext(DC).Widget);
|
||||
if Matrix <> nil then
|
||||
begin
|
||||
@ -3297,7 +3305,7 @@ begin
|
||||
{ // this code doesnot work sometimes - why? Maybe qt bug?
|
||||
// to test bug one can create 4 pannels with 0 sizes and aligned to differnt sides
|
||||
// then aligned to left and to right panel will return same value
|
||||
|
||||
|
||||
APos.x := 0;
|
||||
APos.y := 0;
|
||||
QWidget_mapToGlobal(TQtWidget(Handle).Widget, @APos, @APos);
|
||||
@ -3641,7 +3649,7 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI Invalidate Rect]');
|
||||
{$endif}
|
||||
|
||||
|
||||
if Rect <> nil then
|
||||
begin
|
||||
with TQtWidget(aHandle).getClientOffset do
|
||||
@ -3692,7 +3700,7 @@ begin
|
||||
LastPos := TQtDeviceContext(DC).GetLineLastPixelPos(PenPos, LastPos);
|
||||
TQtDeviceContext(DC).drawLine(PenPos.X, PenPos.Y, LastPos.X, LastPos.Y);
|
||||
MoveToEx(DC, X, Y, nil);
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -3732,7 +3740,7 @@ begin
|
||||
if (OldPoint <> nil) then TQtDeviceContext(DC).getPenPos(OldPoint);
|
||||
|
||||
TQtDeviceContext(DC).setPenPos(X, Y);
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -3841,7 +3849,7 @@ begin
|
||||
if not IsValidDC(DC) then Exit;
|
||||
|
||||
TQtDeviceContext(DC).drawRect(X1, Y1, X2 - X1 - 1, Y2 - Y1 - 1);
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -3901,7 +3909,7 @@ begin
|
||||
Result := 0;
|
||||
|
||||
if IsValidDC(DC) then Exit;
|
||||
|
||||
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
@ -3980,7 +3988,7 @@ begin
|
||||
{$Endif}
|
||||
|
||||
result:=0;
|
||||
|
||||
|
||||
if not IsValidDC(DC) then
|
||||
begin
|
||||
{$ifdef VerboseQTWinAPI}
|
||||
@ -3994,11 +4002,11 @@ begin
|
||||
SavedDCList := TList.Create;
|
||||
SavedDCList.Add(nil); // start at index 1, 0 is an invalid saved state
|
||||
end;
|
||||
|
||||
|
||||
DCData := TQtDeviceContext(DC).CreateDCData;
|
||||
Result := 1;
|
||||
SavedDCList.Insert(Result, DCData);
|
||||
|
||||
|
||||
{$ifdef VerboseQTWinAPI}
|
||||
WriteLn('Trace:< [WinAPI SaveDC] result=', Result);
|
||||
{$Endif}
|
||||
@ -4104,7 +4112,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := 0;
|
||||
|
||||
|
||||
if not IsValidDC(DC) then
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
@ -4113,7 +4121,7 @@ begin
|
||||
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
||||
if not IsValidGDIObject(GDIObj) then
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
@ -4124,15 +4132,15 @@ begin
|
||||
end;
|
||||
|
||||
aObject := TObject(GDIObj);
|
||||
|
||||
|
||||
if aObject is TQtFont then
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
ObjType := 'Font';
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := HGDIOBJ(TQtDeviceContext(DC).font);
|
||||
|
||||
|
||||
TQtDeviceContext(DC).setFont(TQtFont(aObject));
|
||||
end
|
||||
else if aObject is TQtPen then
|
||||
@ -4141,7 +4149,7 @@ begin
|
||||
ObjType := 'Pen' ;
|
||||
{$endif}
|
||||
result := HGDIOBJ(TQtDeviceContext(DC).pen);
|
||||
|
||||
|
||||
TQtDeviceContext(DC).setPen(TQtPen(aObject));
|
||||
end
|
||||
else if aObject is TQtBrush then
|
||||
@ -4149,9 +4157,9 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
ObjType := 'Brush';
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := HGDIOBJ(TQtDeviceContext(DC).brush);
|
||||
|
||||
|
||||
TQtDeviceContext(DC).setBrush(TQtBrush(aObject));
|
||||
end
|
||||
else if aObject is TQtImage then
|
||||
@ -4161,7 +4169,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := HGDIOBJ(TQtDeviceContext(DC).vImage);
|
||||
|
||||
|
||||
// TODO: is this also saved in qpainter_save?
|
||||
TQtDeviceContext(DC).setImage(TQtImage(aObject));
|
||||
end;
|
||||
@ -4193,7 +4201,7 @@ end;
|
||||
function TQtWidgetSet.SetActiveWindow(Handle: HWND): HWND;
|
||||
begin
|
||||
Result := GetActiveWindow;
|
||||
|
||||
|
||||
if Handle <> 0 then
|
||||
TQtWidget(Handle).Activate
|
||||
else
|
||||
@ -4225,7 +4233,7 @@ begin
|
||||
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
||||
result := TQtDeviceContext(DC).SetBkColor(Color);
|
||||
end;
|
||||
|
||||
@ -4308,7 +4316,7 @@ begin
|
||||
|
||||
if Result = ACursor then
|
||||
Exit;
|
||||
|
||||
|
||||
if Screen.Cursors[crDefault] = ACursor then
|
||||
OverrideCursor := nil
|
||||
else
|
||||
@ -4329,7 +4337,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
QCursor_setPos(X, Y);
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -4373,7 +4381,7 @@ end;
|
||||
function TQtWidgetSet.SetForegroundWindow(HWnd: HWND): boolean;
|
||||
begin
|
||||
TQtWidget(HWnd).Activate;
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -4498,11 +4506,11 @@ var
|
||||
|
||||
begin
|
||||
// bRedraw is useles with qt
|
||||
|
||||
|
||||
Result := 0;
|
||||
|
||||
|
||||
if (Handle = 0) then exit;
|
||||
|
||||
|
||||
ScrollBar := nil;
|
||||
case SBStyle of
|
||||
SB_BOTH:
|
||||
@ -4510,7 +4518,7 @@ begin
|
||||
{TODO: SB_BOTH fixme }
|
||||
//writeln('TODO: ############## SB_BOTH CALLED HERE .... #################');
|
||||
end; {SB_BOTH}
|
||||
|
||||
|
||||
SB_CTL:
|
||||
begin
|
||||
{HWND is always TScrollBar, but seem that Create ScrollBar should be called here }
|
||||
@ -4518,10 +4526,10 @@ begin
|
||||
(csDestroying in TQtWidget(Handle).LCLObject.ComponentState) then exit;
|
||||
|
||||
ScrollBar := TQtScrollBar(Handle);
|
||||
|
||||
|
||||
if not Assigned(ScrollBar) then exit;
|
||||
end; {SB_CTL}
|
||||
|
||||
|
||||
SB_HORZ:
|
||||
begin
|
||||
if (csReading in TQtWidget(Handle).LCLObject.ComponentState)
|
||||
@ -4540,7 +4548,7 @@ begin
|
||||
ScrollBar := TQtScrollBar(Control.Handle)
|
||||
end;
|
||||
end; {SB_HORZ}
|
||||
|
||||
|
||||
SB_VERT:
|
||||
begin
|
||||
if (csReading in TQtWidget(Handle).LCLObject.ComponentState)
|
||||
@ -4559,9 +4567,9 @@ begin
|
||||
ScrollBar := TQtScrollBar(Control.Handle)
|
||||
end;
|
||||
end; {SB_VERT}
|
||||
|
||||
|
||||
end;
|
||||
|
||||
|
||||
if Assigned(ScrollBar) then
|
||||
Result := UpdateScrollInfo;
|
||||
end;
|
||||
@ -4600,11 +4608,11 @@ begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[WinAPI ShowScrollBar] Handle: ', dbghex(Handle),' wBar: ',wBar);
|
||||
{$endif}
|
||||
|
||||
|
||||
Result := (Handle <> 0);
|
||||
|
||||
|
||||
if not Result then exit;
|
||||
|
||||
|
||||
w := TQtWidget(Handle);
|
||||
|
||||
if w is TQtAbstractScrollArea then
|
||||
@ -4618,7 +4626,7 @@ begin
|
||||
else
|
||||
ScrollArea.setScrollStyle(ssNone);
|
||||
end;
|
||||
|
||||
|
||||
SB_HORZ:
|
||||
begin
|
||||
if bShow then
|
||||
@ -4626,7 +4634,7 @@ begin
|
||||
else
|
||||
QAbstractScrollArea_setHorizontalScrollBarPolicy(QAbstractScrollAreaH(ScrollArea.Widget), QtScrollBarAlwaysOff);
|
||||
end;
|
||||
|
||||
|
||||
SB_VERT:
|
||||
begin
|
||||
if bShow then
|
||||
@ -4634,7 +4642,7 @@ begin
|
||||
else
|
||||
QAbstractScrollArea_setVerticalScrollBarPolicy(QAbstractScrollAreaH(ScrollArea.Widget), QtScrollBarAlwaysOff);
|
||||
end;
|
||||
|
||||
|
||||
SB_CTL:
|
||||
begin
|
||||
if bShow then
|
||||
@ -4663,7 +4671,7 @@ begin
|
||||
{$endif}
|
||||
|
||||
Result := False;
|
||||
|
||||
|
||||
Widget := TQTWidget(hWnd);
|
||||
|
||||
if Widget <> nil then
|
||||
@ -4794,7 +4802,7 @@ begin
|
||||
dec(Height, dy);
|
||||
dec(SrcHeight, dy);
|
||||
end;
|
||||
|
||||
|
||||
DstRect := Bounds(X, Y, Width, Height);
|
||||
SrcRect := Bounds(XSrc, YSrc, SrcWidth, SrcHeight);
|
||||
MaskRect := Bounds(XMask, YMask, SrcWidth, SrcHeight);
|
||||
@ -4857,7 +4865,7 @@ begin
|
||||
WideStr := GetUtf8String(Str);
|
||||
|
||||
TQtDeviceContext(DC).drawText(X, Y, @WideStr);
|
||||
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user