- qDrawWinPanel: temporary use own implementation
- complete Frame3D

git-svn-id: trunk@13678 -
This commit is contained in:
paul 2008-01-09 04:40:54 +00:00
parent d7db50ece5
commit d76c114093
2 changed files with 46 additions and 6 deletions

View File

@ -200,6 +200,7 @@ type
public
function Width: Integer;
function Style: QtPenStyle;
function getColor: TQColor;
procedure setStyle(AStyle: QtPenStyle);
procedure setBrush(brush: QBrushH);
procedure setWidth(p1: Integer);
@ -282,6 +283,8 @@ type
lineWidth: Integer = 1; FillBrush: QBrushH = nil);
procedure qDrawShadeRect(x, y, w, h: integer; Palette: QPaletteH = nil; Sunken: Boolean = False;
lineWidth: Integer = 1; midLineWidth: Integer = 0; FillBrush: QBrushH = nil);
procedure qDrawWinPanel(x, y, w, h: integer; Palette: QPaletteH = nil; Sunken: Boolean = False;
lineWidth: Integer = 1; FillBrush: QBrushH = nil);
procedure drawPoint(x1: Integer; y1: Integer);
procedure drawRect(x1: Integer; y1: Integer; w: Integer; h: Integer);
@ -1222,6 +1225,11 @@ begin
Result := QPen_Style(Widget);
end;
function TQtPen.getColor: TQColor;
begin
QPen_color(Widget, @Result);
end;
{------------------------------------------------------------------------------
Function: TQtPen.Width
@ -1540,6 +1548,41 @@ begin
q_DrawShadeRect(Widget, x, y, w, h, Palette, Sunken, lineWidth, midLineWidth, FillBrush);
end;
procedure TQtDeviceContext.qDrawWinPanel(x, y, w, h: integer;
Palette: QPaletteH; Sunken: Boolean; lineWidth: Integer; FillBrush: QBrushH);
var
Color1, Color2: TQColor;
OldPen: QPenH;
begin
// todo: use q_DrawWinPanel()
if Palette = nil then
Palette := QWidget_palette(Parent);
if Sunken then
begin
Color1 := QBrush_color(QPalette_shadow(Palette))^;
Color2 := QBrush_color(QPalette_light(Palette))^;
end
else
begin
Color1 := QBrush_color(QPalette_light(Palette))^;
Color2 := QBrush_color(QPalette_shadow(Palette))^;
end;
dec(w);
dec(h);
OldPen := QPainter_pen(Widget);
QPainter_setPen(Widget, @Color1);
if lineWidth > 1 then
QPen_setWidth(QPainter_pen(Widget), lineWidth);
drawLine(x, y, x + w, y);
drawLine(x, y, x, y + h);
QPainter_setPen(Widget, @Color2);
if lineWidth > 1 then
QPen_setWidth(QPainter_pen(Widget), lineWidth);
drawLine(x + w, y, x + w, y + h);
drawLine(x, y + h, x + w, y + h);
QPainter_setPen(Widget, oldPen);
end;
{------------------------------------------------------------------------------
Function: TQtDeviceContext.CreateDCData
Params: None

View File

@ -1660,7 +1660,6 @@ function TQtWidgetSet.Frame3d(DC : HDC; var ARect : TRect;
var
QtDC: TQtDeviceContext;
begin
{$ifdef VerboseQtWinAPI}
DebugLn('[TQtWidgetSet.Frame3d Rect=', dbgs(ARect));
{$endif}
@ -1671,14 +1670,12 @@ begin
QtDC := TQtDeviceContext(DC);
// todo: use qDrawWinPanel
case Style of
bvNone: ;
bvLowered: QtDC.qDrawShadeRect(ARect.Left, ARect.Top,
ARect.Right - ARect.Left, ARect.Bottom - ARect.Top, nil, False, FrameWidth);
bvRaised: QtDC.qDrawShadeRect(ARect.Left, ARect.Top,
bvLowered: QtDC.qDrawWinPanel(ARect.Left, ARect.Top,
ARect.Right - ARect.Left, ARect.Bottom - ARect.Top, nil, True, FrameWidth);
bvRaised: QtDC.qDrawWinPanel(ARect.Left, ARect.Top,
ARect.Right - ARect.Left, ARect.Bottom - ARect.Top, nil, False, FrameWidth);
bvSpace: QtDC.qDrawPlainRect(ARect.Left, ARect.Top,
ARect.Right - ARect.Left, ARect.Bottom - ARect.Top, nil, FrameWidth);
end;