mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 10:19:36 +02:00
draw dock header with rotated font (in case of vertical header)
git-svn-id: trunk@14007 -
This commit is contained in:
parent
0b69fd9a95
commit
6c623426f8
@ -31,11 +31,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Types, Classes, SysUtils, LCLProc, LCLType, LCLStrConsts,
|
Types, Classes, SysUtils, LCLProc, LCLType, LCLStrConsts,
|
||||||
Graphics, Controls, ExtCtrls, Forms, Menus, Themes
|
Graphics, Controls, ExtCtrls, Forms, Menus, Themes, LCLIntf;
|
||||||
{$IFDEF VER2_0}
|
|
||||||
// needed for 2.0.4
|
|
||||||
,LCLIntf
|
|
||||||
{$ENDIF};
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TLazDockPages = class;
|
TLazDockPages = class;
|
||||||
@ -648,10 +644,12 @@ var
|
|||||||
d: integer;
|
d: integer;
|
||||||
DockCaption: String;
|
DockCaption: String;
|
||||||
TextStyle: TTextStyle;
|
TextStyle: TTextStyle;
|
||||||
|
// LCL dont handle orientation in TFont
|
||||||
|
OldFont, RotatedFont: HFONT;
|
||||||
|
ALogFont: TLogFont;
|
||||||
begin
|
begin
|
||||||
DockCaption := DockSite.GetDockCaption(AControl);
|
DockCaption := DockSite.GetDockCaption(AControl);
|
||||||
TextStyle.Alignment := taLeftJustify;
|
TextStyle.Alignment := taLeftJustify;
|
||||||
TextStyle.Layout := tlCenter;
|
|
||||||
TextStyle.SingleLine := True;
|
TextStyle.SingleLine := True;
|
||||||
TextStyle.Clipping := True;
|
TextStyle.Clipping := True;
|
||||||
TextStyle.Opaque := False;
|
TextStyle.Opaque := False;
|
||||||
@ -667,6 +665,7 @@ begin
|
|||||||
case AControl.DockOrientation of
|
case AControl.DockOrientation of
|
||||||
doHorizontal:
|
doHorizontal:
|
||||||
begin
|
begin
|
||||||
|
TextStyle.Layout := tlCenter;
|
||||||
d := DrawRect.Bottom - DrawRect.Top;
|
d := DrawRect.Bottom - DrawRect.Top;
|
||||||
BtnRect := DrawRect;
|
BtnRect := DrawRect;
|
||||||
BtnRect.Left := BtnRect.Right - d;
|
BtnRect.Left := BtnRect.Right - d;
|
||||||
@ -687,6 +686,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
doVertical:
|
doVertical:
|
||||||
begin
|
begin
|
||||||
|
TextStyle.Layout := tlBottom;
|
||||||
d := DrawRect.Right - DrawRect.Left;
|
d := DrawRect.Right - DrawRect.Left;
|
||||||
BtnRect := DrawRect;
|
BtnRect := DrawRect;
|
||||||
BtnRect.Bottom := BtnRect.Top + d;
|
BtnRect.Bottom := BtnRect.Top + d;
|
||||||
@ -703,7 +703,17 @@ begin
|
|||||||
DrawRect.Top := BtnRect.Bottom;
|
DrawRect.Top := BtnRect.Bottom;
|
||||||
InflateRect(DrawRect, 0, -4);
|
InflateRect(DrawRect, 0, -4);
|
||||||
|
|
||||||
|
OldFont := 0;
|
||||||
|
if GetObject(ACanvas.Font.Reference.Handle, SizeOf(ALogFont), @ALogFont) <> 0 then
|
||||||
|
begin
|
||||||
|
ALogFont.lfEscapement := 900;
|
||||||
|
RotatedFont := CreateFontIndirect(ALogFont);
|
||||||
|
if RotatedFont <> 0 then
|
||||||
|
OldFont := SelectObject(ACanvas.Handle, RotatedFont);
|
||||||
|
end;
|
||||||
ACanvas.TextRect(DrawRect, DrawRect.Left, DrawRect.Bottom, DockCaption, TextStyle);
|
ACanvas.TextRect(DrawRect, DrawRect.Left, DrawRect.Bottom, DockCaption, TextStyle);
|
||||||
|
if OldFont <> 0 then
|
||||||
|
DeleteObject(SelectObject(ACanvas.Handle, OldFont));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user