From: André S. <asn...@us...> - 2004-08-18 14:25:57
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21163/JVCL3/run Modified Files: JvPanel.pas Log Message: clx fixes for transparency and sizegrip under Linux. Index: JvPanel.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvPanel.pas,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** JvPanel.pas 10 Aug 2004 10:33:13 -0000 1.44 --- JvPanel.pas 18 Aug 2004 14:25:47 -0000 1.45 *************** *** 37,40 **** --- 37,43 ---- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, + {$IFDEF VisualCLX} + Qt, + {$ENDIF VisualCLX} JvThemes, JvComponent, JvExControls; *************** *** 102,105 **** --- 105,109 ---- FArrangeHeight: Integer; FOnResizeParent: TJvPanelResizeParentEvent; + FOnPaint: TNotifyEvent; {$IFDEF VCL} FMovable: Boolean; *************** *** 108,112 **** FOnBeforeMove: TJvPanelMoveEvent; {$ENDIF VCL} ! FOnPaint: TNotifyEvent; function GetHeight: Integer; procedure SetHeight(Value: Integer); --- 112,119 ---- FOnBeforeMove: TJvPanelMoveEvent; {$ENDIF VCL} ! {$IFDEF VisualCLX} ! FGripBmp: TBitmap; ! procedure CreateSizeGrip; ! {$ENDIF VisualCLX} function GetHeight: Integer; procedure SetHeight(Value: Integer); *************** *** 131,137 **** procedure TextChanged; override; procedure Paint; override; - procedure AdjustSize; override; function DoPaintBackground(Canvas: TCanvas; Param: Integer): Boolean; override; {$IFDEF VCL} procedure CreateParams(var Params: TCreateParams); override; procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST; --- 138,144 ---- procedure TextChanged; override; procedure Paint; override; function DoPaintBackground(Canvas: TCanvas; Param: Integer): Boolean; override; {$IFDEF VCL} + procedure AdjustSize; override; procedure CreateParams(var Params: TCreateParams); override; procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST; *************** *** 140,143 **** --- 147,153 ---- procedure DoAfterMove; dynamic; {$ENDIF VCL} + {$IFDEF VisualCLX} + procedure DrawMask(ACanvas: TCanvas); override; + {$ENDIF VisualCLX} procedure Loaded; override; procedure Resize; override; *************** *** 403,406 **** --- 413,423 ---- begin FArrangeSettings.Free; + {$IFDEF VisualCLX} + if assigned(FGripBmp) then + begin + FGripBmp.Free; + FGripBmp := nil; + end; + {$ENDIF VisualCLX} inherited Destroy; end; *************** *** 462,471 **** FOnBeforeMove(Self, X, Y, Result); end; - {$ENDIF VCL} procedure TJvPanel.Paint; var X, Y: Integer; begin if Assigned(FOnPaint) then --- 479,525 ---- FOnBeforeMove(Self, X, Y, Result); end; {$ENDIF VCL} + {$IFDEF VisualCLX} + procedure TJvPanel.DrawMask(ACanvas: TCanvas); + var + R: TRect; + i, j, X, Y: integer; + begin + inherited DrawMask(ACanvas); + ACanvas.Brush.Style := bsClear; + ACanvas.Pen.Color := clDontMask; + i := 0 ; //BorderWidth; + if BevelOuter <> bvNone then + Inc(i, BevelWidth); + if BevelInner <> bvNone then + Inc(i, BevelWidth); + ACanvas.Pen.Width := i; + R := ClientRect; + ACanvas.Rectangle(R); + if Sizeable then + begin + X := ClientWidth - FGripBmp.Width - i; + Y := ClientHeight - FGripBmp.Height - i; + for i := 0 to 2 do + begin + for j := 0 to 2 do + begin + ACanvas.moveto(X + 4 * i + j, Y + FGripBmp.Height); + ACanvas.lineto(X + FGripBmp.Width, Y + 4 * i + j); + end + end; + end; + end; + {$ENDIF VisualCLX} + + + procedure TJvPanel.Paint; var X, Y: Integer; + {$IFDEF VisualCLX} + i: integer; + {$ENDIF VisualCLX} begin if Assigned(FOnPaint) then *************** *** 507,510 **** --- 561,575 ---- with Canvas do begin + {$IFDEF VisualCLX} + i := 0 ; //BorderWidth; + if BevelOuter <> bvNone then + Inc(i, BevelWidth); + if BevelInner <> bvNone then + Inc(i, BevelWidth); + X := ClientWidth - FGripBmp.Width - i; + Y := ClientHeight - FGripBmp.Height - i; + Draw(X, Y, FGripBmp); + {$ENDIF VisualCLX} + {$IFDEF VCL} // (rom) Marlett is not a standard Windows font Font.Name := 'Marlett'; *************** *** 519,525 **** SetBkMode(Handle, BkModeTransparent); TextOut(X, Y, 'o'); ! end; end; procedure TJvPanel.AdjustSize; begin --- 584,592 ---- SetBkMode(Handle, BkModeTransparent); TextOut(X, Y, 'o'); ! {$ENDIF VCL} ! end; // end with Canvas do end; + {$IFDEF VCL} procedure TJvPanel.AdjustSize; begin *************** *** 532,535 **** --- 599,603 ---- end; end; + {$ENDIF VCL} procedure TJvPanel.DrawBorders; *************** *** 737,740 **** --- 805,821 ---- begin FSizeable := Value; + {$IFDEF VisualCLX} + if Value then + begin + if not assigned(FGripBmp) then + CreateSizeGrip; + end + else + if assigned(FGripBmp) then + begin + FGripBmp.Destroy; + FGripBmp := nil; + end; + {$ENDIF VisualCLX} Invalidate; end; *************** *** 1022,1025 **** --- 1103,1139 ---- end; + {$IFDEF VisualCLX} + procedure TJvPanel.CreateSizeGrip; + var + i: integer; + begin + FGripBmp := TBitmap.Create; + FGripBmp.Width := 13; //GetSystemMetrics(SM_CXVSCROLL); + FGripBmp.Height := 13; //GetSystemMetrics(SM_CXYSCROLL); + with FGripBmp.Canvas do + begin + Brush.Color := clBackGround; + FillRect(Bounds(0, 0, Width, Height)); + Pen.Width := 1; + for i := 0 to 2 do + begin + Pen.Color := clLight; + moveto(3 * i, FGripBmp.Height); + lineto(FGripBmp.Width, 3 * i); + Pen.Color := clDark; + moveto(3 * i + 1, FGripBmp.Height); + lineto(FGripBmp.Width, 3 * i + 1); + // Pen.Color := clMid; + moveto(3 * i + 2, FGripBmp.Height); + lineto(FGripBmp.Width, 3 * i + 2); + end; + end; + FGripBmp.TransparentColor := clBackGround; + FGripBmp.TransparentMode := tmFixed; + FGripBmp.Transparent := true; + end; + {$ENDIF VisualCLX} + + end. |