spktoolbar: Make toolbar dpi aware (patch by "regs" with modifications, issue #0030446).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5073 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-08-05 21:11:23 +00:00
parent 1b87b7dfb8
commit ba0f25142c
8 changed files with 692 additions and 416 deletions

View File

@ -9,7 +9,7 @@
interface
{$MESSAGE HINT 'W tym module konsekwentnie ka¿dy rect opisuje dok³adny prostok¹t (a nie, jak w przypadku WINAPI - bez dolnej i prawej krawêdzi)'}
{$MESSAGE HINT 'Every rect in this module are exact rectanges (not like in WINAPI without right and bottom)'}
uses
LCLType, Graphics, SysUtils, Classes, Controls, StdCtrls, SpkGraphTools, SpkMath;
@ -1905,9 +1905,11 @@ class procedure TGUITools.DrawImage(ACanvas: TCanvas; Imagelist: TImageList;
var UseOrgClipRgn: Boolean;
OrgRgn: HRGN;
ClipRgn: HRGN;
ImageIcon: TIcon;
ImageBitmap: TBitmap;
begin
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
// Storing original ClipRgn and applying a new one
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
ClipRgn:=CreateRectRgn(ClipRect.left, ClipRect.Top, ClipRect.Right+1, ClipRect.Bottom+1);
@ -1916,7 +1918,19 @@ if UseOrgClipRgn then
SelectClipRgn(ACanvas.Handle, ClipRgn);
ImageList.Draw(ACanvas, Point.x, Point.y, ImageIndex);
// avoid exclusive draw. draw with local canvas itself.
//ImageList.Draw(ACanvas, Point.x, Point.y, ImageIndex);
{$IfDef LCLWin32}
ImageIcon := TIcon.Create;
ImageList.GetIcon(ImageIndex, ImageIcon);
ACanvas.Draw(Point.x, Point.y, ImageIcon);
ImageIcon.Free;
{$Else}
ImageBitmap := TBitmap.Create;
ImageList.GetBitmap(ImageIndex, ImageBitmap);
ACanvas.Draw(Point.x, Point.y, ImageBitmap);
ImageBitmap.Free;
{$EndIf}
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
DeleteObject(ClipRgn);

View File

@ -19,7 +19,7 @@ interface
uses
LCLType, LMessages, Graphics, SysUtils, Controls, Classes, Math, Dialogs,
Types, SpkGraphTools, SpkGUITools, SpkMath, ExtCtrls,
Forms, Types, SpkGraphTools, SpkGUITools, SpkMath, ExtCtrls,
spkt_Appearance, spkt_BaseItem, spkt_Const, spkt_Dispatch, spkt_Tab,
spkt_Pane, spkt_Types;
@ -453,6 +453,8 @@ begin
end;
constructor TSpkToolbar.Create(AOwner: TComponent);
var
DesignDPI: Integer;
begin
inherited Create(AOwner);
@ -460,7 +462,15 @@ begin
inherited Align := alTop;
//todo: not found in lcl
//inherited AlignWithMargins:=true;
inherited Height := TOOLBAR_HEIGHT;
if AOwner is TForm then
DesignDPI := TForm(AOwner).DesignTimeDPI
else
DesignDPI := ScreenInfo.PixelsPerInchX;
SpkInitLayoutConsts(DesignDPI);
inherited Height := ToolbarHeight;
//inherited Doublebuffered:=true;
// Inicjacja wewnêtrznych pól danych
@ -990,7 +1000,7 @@ end;
procedure TSpkToolbar.DoOnResize;
begin
inherited Height := TOOLBAR_HEIGHT;
inherited Height := ToolbarHeight;
{$IFDEF DELAYRUNTIMER}
FDelayRunTimer.Enabled := False;
@ -1252,74 +1262,64 @@ procedure TSpkToolbar.ValidateBuffer;
TGuiTools.DrawRoundRect(FBuffer.Canvas,
{$IFDEF EnhancedRecordSupport}
T2DIntRect.Create(0,
TOOLBAR_TAB_CAPTIONS_HEIGHT,
self.Width - 1,
self.Height - 1),
T2DIntRect.Create(0, ToolbarTabCaptionsHeight, self.Width - 1, self.Height - 1),
{$ELSE}
Create2DIntRect(0,
TOOLBAR_TAB_CAPTIONS_HEIGHT,
self.Width - 1,
self.Height - 1),
Create2DIntRect(0, ToolbarTabCaptionsHeight, self.Width - 1, self.Height - 1),
{$ENDIF}
TOOLBAR_CORNER_RADIUS,
ToolbarCornerRadius,
FocusedAppearance.Tab.GradientFromColor,
FocusedAppearance.Tab.GradientToColor,
FocusedAppearance.Tab.GradientType);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(0, TOOLBAR_TAB_CAPTIONS_HEIGHT),
T2DIntPoint.Create(0, ToolbarTabCaptionsHeight),
{$ELSE}
Create2DIntPoint(0, TOOLBAR_TAB_CAPTIONS_HEIGHT),
Create2DIntPoint(0, ToolbarTabCaptionsHeight),
{$ENDIF}
TOOLBAR_CORNER_RADIUS,
ToolbarCornerRadius,
cpLeftTop,
FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(self.Width -
TOOLBAR_CORNER_RADIUS, TOOLBAR_TAB_CAPTIONS_HEIGHT),
T2DIntPoint.Create(self.Width - ToolbarCornerRadius, ToolbarTabCaptionsHeight),
{$ELSE}
Create2DIntPoint(self.Width -
TOOLBAR_CORNER_RADIUS, TOOLBAR_TAB_CAPTIONS_HEIGHT),
Create2DIntPoint(self.Width - ToolbarCornerRadius, ToolbarTabCaptionsHeight),
{$ENDIF}
TOOLBAR_CORNER_RADIUS,
ToolbarCornerRadius,
cpRightTop,
FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(0, self.Height - TOOLBAR_CORNER_RADIUS),
T2DIntPoint.Create(0, self.Height - ToolbarCornerRadius),
{$ELSE}
Create2DIntPoint(0, self.Height - TOOLBAR_CORNER_RADIUS),
Create2DIntPoint(0, self.Height - ToolbarCornerRadius),
{$ENDIF}
TOOLBAR_CORNER_RADIUS,
ToolbarCornerRadius,
cpLeftBottom,
FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(self.Width -
TOOLBAR_CORNER_RADIUS, self.Height - TOOLBAR_CORNER_RADIUS),
T2DIntPoint.Create(self.Width - ToolbarCornerRadius, self.Height - ToolbarCornerRadius),
{$ELSE}
Create2DIntPoint(self.Width -
TOOLBAR_CORNER_RADIUS, self.Height - TOOLBAR_CORNER_RADIUS),
Create2DIntPoint(self.Width - ToolbarCornerRadius, self.Height - ToolbarCornerRadius),
{$ENDIF}
TOOLBAR_CORNER_RADIUS,
ToolbarCornerRadius,
cpRightBottom,
FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawVLine(FBuffer, 0, TOOLBAR_TAB_CAPTIONS_HEIGHT +
TOOLBAR_CORNER_RADIUS, self.Height - TOOLBAR_CORNER_RADIUS,
TGuiTools.DrawVLine(FBuffer, 0, ToolbarTabCaptionsHeight +
ToolbarCornerRadius, self.Height - ToolbarCornerRadius,
FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawHLine(FBuffer, TOOLBAR_CORNER_RADIUS, self.Width - TOOLBAR_CORNER_RADIUS,
TGuiTools.DrawHLine(FBuffer, ToolbarCornerRadius, self.Width - ToolbarCornerRadius,
self.Height - 1, FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawVLine(FBuffer, self.Width - 1, TOOLBAR_TAB_CAPTIONS_HEIGHT +
TOOLBAR_CORNER_RADIUS, self.Height - TOOLBAR_CORNER_RADIUS,
TGuiTools.DrawVLine(FBuffer, self.Width - 1, ToolbarTabCaptionsHeight +
ToolbarCornerRadius, self.Height - ToolbarCornerRadius,
FocusedAppearance.Tab.BorderColor);
if not (AtLeastOneTabVisible) then
begin
// Jeœli nie ma zak³adek, rysujemy poziom¹ liniê
TGuiTools.DrawHLine(FBuffer, TOOLBAR_CORNER_RADIUS, self.Width -
TOOLBAR_CORNER_RADIUS, TOOLBAR_TAB_CAPTIONS_HEIGHT, FocusedAppearance.Tab.BorderColor);
TGuiTools.DrawHLine(FBuffer, ToolbarCornerRadius, self.Width -
ToolbarCornerRadius, ToolbarTabCaptionsHeight, FocusedAppearance.Tab.BorderColor);
end
else
begin
@ -1330,9 +1330,9 @@ procedure TSpkToolbar.ValidateBuffer;
Dec(i);
// Tylko prawa czêœæ, reszta bêdzie narysowana wraz z zak³adkami
if FTabRects[i].Right < self.Width - TOOLBAR_CORNER_RADIUS - 1 then
if FTabRects[i].Right < self.Width - ToolbarCornerRadius - 1 then
TGuiTools.DrawHLine(FBuffer, FTabRects[i].Right + 1, self.Width -
TOOLBAR_CORNER_RADIUS, TOOLBAR_TAB_CAPTIONS_HEIGHT, FocusedAppearance.Tab.BorderColor);
ToolbarCornerRadius, ToolbarTabCaptionsHeight, FocusedAppearance.Tab.BorderColor);
end;
end;
@ -1380,49 +1380,49 @@ procedure TSpkToolbar.ValidateBuffer;
TabRect := FTabRects[index];
// Œrodkowy prostok¹t
TabRegion := CreateRectRgn(TabRect.Left + TAB_CORNER_RADIUS - 1,
TabRect.Top + TAB_CORNER_RADIUS,
TabRect.Right - TAB_CORNER_RADIUS + 1 +
TabRegion := CreateRectRgn(TabRect.Left + TabCornerRadius - 1,
TabRect.Top + TabCornerRadius,
TabRect.Right - TabCornerRadius + 1 +
1, TabRect.Bottom + 1);
// Górna czêœæ z górnymi zaokr¹gleniami wypuk³ymi
TmpRegion := CreateRectRgn(TabRect.Left + 2 * TAB_CORNER_RADIUS - 1,
TmpRegion := CreateRectRgn(TabRect.Left + 2 * TabCornerRadius - 1,
TabRect.Top, TabRect.Right -
2 * TAB_CORNER_RADIUS + 1 + 1, TabRect.Top +
TAB_CORNER_RADIUS);
2 * TabCornerRadius + 1 + 1, TabRect.Top +
TabCornerRadius);
CombineRgn(TabRegion, TabRegion, TmpRegion, RGN_OR);
DeleteObject(TmpRegion);
TmpRegion := CreateEllipticRgn(TabRect.Left + TAB_CORNER_RADIUS -
TmpRegion := CreateEllipticRgn(TabRect.Left + TabCornerRadius -
1, TabRect.Top,
TabRect.Left + 3 * TAB_CORNER_RADIUS,
TabRect.Top + 2 * TAB_CORNER_RADIUS + 1);
TabRect.Left + 3 * TabCornerRadius,
TabRect.Top + 2 * TabCornerRadius + 1);
CombineRgn(TabRegion, TabRegion, TmpRegion, RGN_OR);
DeleteObject(TmpRegion);
TmpRegion := CreateEllipticRgn(TabRect.Right - 3 * TAB_CORNER_RADIUS + 2,
TmpRegion := CreateEllipticRgn(TabRect.Right - 3 * TabCornerRadius + 2,
TabRect.Top,
TabRect.Right - TAB_CORNER_RADIUS +
3, TabRect.Top + 2 * TAB_CORNER_RADIUS + 1);
TabRect.Right - TabCornerRadius +
3, TabRect.Top + 2 * TabCornerRadius + 1);
CombineRgn(TabRegion, TabRegion, TmpRegion, RGN_OR);
DeleteObject(TmpRegion);
// Dolna czêœæ z dolnymi zaokr¹gleniami wklês³ymi
TmpRegion := CreateRectRgn(TabRect.Left, TabRect.Bottom -
TAB_CORNER_RADIUS, TabRect.Right + 1,
TabCornerRadius, TabRect.Right + 1,
TabRect.Bottom + 1);
TmpRegion2 := CreateEllipticRgn(TabRect.Left - TAB_CORNER_RADIUS,
TabRect.Bottom - 2 * TAB_CORNER_RADIUS + 1,
TabRect.Left + TAB_CORNER_RADIUS +
TmpRegion2 := CreateEllipticRgn(TabRect.Left - TabCornerRadius,
TabRect.Bottom - 2 * TabCornerRadius + 1,
TabRect.Left + TabCornerRadius +
1, TabRect.Bottom + 2);
CombineRgn(TmpRegion, TmpRegion, TmpRegion2, RGN_DIFF);
DeleteObject(TmpRegion2);
TmpRegion2 := CreateEllipticRgn(TabRect.Right - TAB_CORNER_RADIUS +
1, TabRect.Bottom - 2 * TAB_CORNER_RADIUS +
1, TabRect.Right + TAB_CORNER_RADIUS + 2,
TmpRegion2 := CreateEllipticRgn(TabRect.Right - TabCornerRadius +
1, TabRect.Bottom - 2 * TabCornerRadius +
1, TabRect.Right + TabCornerRadius + 2,
TabRect.Bottom + 2);
CombineRgn(TmpRegion, TmpRegion, TmpRegion2, RGN_DIFF);
DeleteObject(TmpRegion2);
@ -1442,70 +1442,62 @@ procedure TSpkToolbar.ValidateBuffer;
// Ramka
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(TabRect.left,
TabRect.bottom - TAB_CORNER_RADIUS + 1),
T2DIntPoint.Create(TabRect.left, TabRect.bottom - TabCornerRadius + 1),
{$ELSE}
Create2DIntPoint(TabRect.left,
TabRect.bottom - TAB_CORNER_RADIUS + 1),
Create2DIntPoint(TabRect.left, TabRect.bottom - TabCornerRadius + 1),
{$ENDIF}
TAB_CORNER_RADIUS,
TabCornerRadius,
cpRightBottom,
Border,
FTabClipRect);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(TabRect.right -
TAB_CORNER_RADIUS + 1, TabRect.bottom - TAB_CORNER_RADIUS + 1),
T2DIntPoint.Create(TabRect.right - TabCornerRadius + 1, TabRect.bottom - TabCornerRadius + 1),
{$ELSE}
Create2DIntPoint(TabRect.right -
TAB_CORNER_RADIUS + 1, TabRect.bottom - TAB_CORNER_RADIUS + 1),
Create2DIntPoint(TabRect.right - TabCornerRadius + 1, TabRect.bottom - TabCornerRadius + 1),
{$ENDIF}
TAB_CORNER_RADIUS,
TabCornerRadius,
cpLeftBottom,
Border,
FTabClipRect);
TGuiTools.DrawVLine(FBuffer,
TabRect.left + TAB_CORNER_RADIUS - 1,
TabRect.top + TAB_CORNER_RADIUS,
TabRect.Bottom - TAB_CORNER_RADIUS + 1,
TabRect.left + TabCornerRadius - 1,
TabRect.top + TabCornerRadius,
TabRect.Bottom - TabCornerRadius + 1,
Border,
FTabClipRect);
TGuiTools.DrawVLine(FBuffer,
TabRect.Right - TAB_CORNER_RADIUS + 1,
TabRect.top + TAB_CORNER_RADIUS,
TabRect.Bottom - TAB_CORNER_RADIUS + 1,
TabRect.Right - TabCornerRadius + 1,
TabRect.top + TabCornerRadius,
TabRect.Bottom - TabCornerRadius + 1,
Border,
FTabClipRect);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(TabRect.left +
TAB_CORNER_RADIUS - 1, 0),
T2DIntPoint.Create(TabRect.left + TabCornerRadius - 1, 0),
{$ELSE}
Create2DIntPoint(TabRect.left +
TAB_CORNER_RADIUS - 1, 0),
Create2DIntPoint(TabRect.left + TabCornerRadius - 1, 0),
{$ENDIF}
TAB_CORNER_RADIUS,
TabCornerRadius,
cpLeftTop,
Border,
FTabClipRect);
TGuiTools.DrawAARoundCorner(FBuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(TabRect.right -
2 * TAB_CORNER_RADIUS + 2, 0),
T2DIntPoint.Create(TabRect.right - 2 * TabCornerRadius + 2, 0),
{$ELSE}
Create2DIntPoint(TabRect.right -
2 * TAB_CORNER_RADIUS + 2, 0),
Create2DIntPoint(TabRect.right - 2 * TabCornerRadius + 2, 0),
{$ENDIF}
TAB_CORNER_RADIUS,
TabCornerRadius,
cpRightTop,
Border,
FTabClipRect);
TGuiTools.DrawHLine(FBuffer,
TabRect.left + 2 * TAB_CORNER_RADIUS - 1,
TabRect.right - 2 * TAB_CORNER_RADIUS + 2,
TabRect.left + 2 * TabCornerRadius - 1,
TabRect.right - 2 * TabCornerRadius + 2,
0,
Border,
FTabClipRect);
@ -1660,21 +1652,24 @@ begin
// Cliprect zak³adek (zawgórn¹ ramkê komponentu)
{$IFDEF EnhancedRecordSupport}
FTabClipRect := T2DIntRect.Create(TOOLBAR_CORNER_RADIUS,
0, self.Width -
TOOLBAR_CORNER_RADIUS - 1, TOOLBAR_TAB_CAPTIONS_HEIGHT);
{$ELSE}
FTabClipRect.Create(TOOLBAR_CORNER_RADIUS,
FTabClipRect := T2DIntRect.Create(
ToolbarCornerRadius,
0,
self.Width - TOOLBAR_CORNER_RADIUS - 1,
TOOLBAR_TAB_CAPTIONS_HEIGHT);
self.Width - ToolbarCornerRadius - 1,
ToolbarTabCaptionsHeight);
{$ELSE}
FTabClipRect.Create(
ToolbarCornerRadius,
0,
self.Width - ToolbarCornerRadius - 1,
ToolbarTabCaptionsHeight);
{$ENDIF}
// Recty nag³ówków zak³adek (zawieraj¹ górn¹ ramkê komponentu)
setlength(FTabRects, FTabs.Count);
if FTabs.Count > 0 then
begin
x := TOOLBAR_CORNER_RADIUS;
x := ToolbarCornerRadius;
for i := 0 to FTabs.Count - 1 do
if FTabs[i].Visible then
begin
@ -1686,18 +1681,18 @@ begin
FBuffer.Canvas.font.Assign(TabAppearance.Tab.TabHeaderFont);
TabWidth := 2 + // Ramka
2 * TAB_CORNER_RADIUS +
2 * TabCornerRadius +
// Zaokr¹glenia
2 * TOOLBAR_TAB_CAPTIONS_TEXT_HPADDING +
2 * ToolbarTabCaptionsTextHPadding +
// Wewnêtrzne marginesy
max(TOOLBAR_MIN_TAB_CAPTION_WIDTH,
max(ToolbarMinTabCaptionWidth,
FBuffer.Canvas.TextWidth(FTabs.Items[i].Caption));
// SzerokoϾ tekstu
FTabRects[i].Left := x;
FTabRects[i].Right := x + TabWidth - 1;
FTabRects[i].Top := 0;
FTabRects[i].Bottom := TOOLBAR_TAB_CAPTIONS_HEIGHT;
FTabRects[i].Bottom := ToolbarTabCaptionsHeight;
x := FTabRects[i].right + 1;
end
@ -1717,20 +1712,15 @@ begin
begin
// Rect obszaru zak³adki
{$IFDEF EnhancedRecordSupport}
FTabContentsClipRect := T2DIntRect.Create(TOOLBAR_BORDER_WIDTH +
TAB_PANE_LEFTPADDING, TOOLBAR_TAB_CAPTIONS_HEIGHT +
TOOLBAR_BORDER_WIDTH + TAB_PANE_TOPPADDING,
self.Width - 1 - TOOLBAR_BORDER_WIDTH -
TAB_PANE_RIGHTPADDING, self.Height -
1 - TOOLBAR_BORDER_WIDTH - TAB_PANE_BOTTOMPADDING);
FTabContentsClipRect := T2DIntRect.Create(ToolbarBorderWidth + TabPaneLeftPadding,
ToolbarTabCaptionsHeight + ToolbarBorderWidth + TabPaneTopPadding,
self.Width - 1 - ToolbarBorderWidth - TabPaneRightPadding,
self.Height - 1 - ToolbarBorderWidth - TabPaneBottomPadding);
{$ELSE}
FTabContentsClipRect.Create(TOOLBAR_BORDER_WIDTH + TAB_PANE_LEFTPADDING,
TOOLBAR_TAB_CAPTIONS_HEIGHT +
TOOLBAR_BORDER_WIDTH + TAB_PANE_TOPPADDING,
self.Width - 1 - TOOLBAR_BORDER_WIDTH -
TAB_PANE_RIGHTPADDING,
self.Height - 1 - TOOLBAR_BORDER_WIDTH -
TAB_PANE_BOTTOMPADDING);
FTabContentsClipRect.Create(ToolbarBorderWidth + TabPaneLeftPadding,
ToolbarTabCaptionsHeight + ToolbarBorderWidth + TabPaneTopPadding,
self.Width - 1 - ToolbarBorderWidth - TabPaneRightPadding,
self.Height - 1 - ToolbarBorderWidth - TabPaneBottomPadding);
{$ENDIF}
FTabs[FTabIndex].Rect := FTabContentsClipRect;

View File

@ -16,7 +16,7 @@ interface
uses Graphics, Classes, Forms, SysUtils,
SpkGUITools, SpkXMLParser, SpkXMLTools,
spkt_Dispatch, spkt_Exceptions;
spkt_Dispatch, spkt_Exceptions, spkt_Const;
type TSpkTabAppearance = class(TPersistent)
private
@ -31,6 +31,7 @@ type TSpkTabAppearance = class(TPersistent)
// *** Gettery i settery ***
procedure SetHeaderFont(const Value: TFont);
function GetTabHeaderFont: TFont;
procedure SetBorderColor(const Value: TColor);
procedure SetGradientFromColor(const Value: TColor);
procedure SetGradientToColor(const Value: TColor);
@ -46,7 +47,7 @@ type TSpkTabAppearance = class(TPersistent)
destructor Destroy; override;
procedure Reset;
published
property TabHeaderFont : TFont read FTabHeaderFont write SetHeaderFont;
property TabHeaderFont : TFont read GetTabHeaderFont write SetHeaderFont;
property BorderColor : TColor read FBorderColor write SetBorderColor;
property GradientFromColor : TColor read FGradientFromColor write SetGradientFromColor;
property GradientToColor : TColor read FGradientToColor write SetGradientToColor;
@ -66,6 +67,7 @@ type TSpkPaneAppearance = class(TPersistent)
FGradientType : TBackgroundKind;
procedure SetCaptionFont(const Value: TFont);
function GetCaptionFont: TFont;
procedure SetBorderDarkColor(const Value: TColor);
procedure SetBorderLightColor(const Value: TColor);
procedure SetGradientFromColor(const Value: TColor);
@ -80,7 +82,7 @@ type TSpkPaneAppearance = class(TPersistent)
destructor Destroy; override;
procedure Reset;
published
property CaptionFont : TFont read FCaptionFont write SetCaptionFont;
property CaptionFont : TFont read GetCaptionFont write SetCaptionFont;
property BorderDarkColor : TColor read FBorderDarkColor write SetBorderDarkColor;
property BorderLightColor : TColor read FBorderLightColor write SetBorderLightColor;
property GradientFromColor : TColor read FGradientFromColor write SetGradientFromColor;
@ -124,6 +126,7 @@ type TSpkElementAppearance = class(TPersistent)
procedure SetActiveInnerDarkColor(const Value: TColor);
procedure SetActiveInnerLightColor(const Value: TColor);
procedure SetCaptionFont(const Value: TFont);
function GetCaptionFont: TFont;
procedure SetHotTrackCaptionColor(const Value: TColor);
procedure SetHotTrackFrameColor(const Value: TColor);
procedure SetHotTrackGradientFromColor(const Value: TColor);
@ -146,7 +149,7 @@ type TSpkElementAppearance = class(TPersistent)
destructor Destroy; override;
procedure Reset;
published
property CaptionFont : TFont read FCaptionFont write SetCaptionFont;
property CaptionFont : TFont read GetCaptionFont write SetCaptionFont;
property IdleFrameColor : TColor read FIdleFrameColor write SetIdleFrameColor;
property IdleGradientFromColor : TColor read FIdleGradientFromColor write SetIdleGradientFromColor;
property IdleGradientToColor : TColor read FIdleGradientToColor write SetIdleGradientToColor;
@ -380,6 +383,23 @@ begin
FDispatch.NotifyAppearanceChanged;
end;
function TSpkTabAppearance.GetTabHeaderFont: TFont;
var
ScaledFont: TFont;
begin
if DPI_AWARE then
begin
ScaledFont := TFont.Create;
ScaledFont.Assign(FTabHeaderFont);
//ScaledFont.Height := SpkScaleY(ScaledFont.Height, 96); // leave it to uscaledpi
Result := ScaledFont;
end
else
Result := FTabHeaderFont;
end;
{ TSpkPaneAppearance }
procedure TSpkPaneAppearance.Assign(Source: TPersistent);
@ -578,6 +598,23 @@ begin
FDispatch.NotifyAppearanceChanged;
end;
function TSpkPaneAppearance.GetCaptionFont: TFont;
var
ScaledFont: TFont;
begin
if DPI_AWARE then
begin
ScaledFont := TFont.Create;
ScaledFont.Assign(FCaptionFont);
//ScaledFont.Height := SpkScaleY(ScaledFont.Height, 96); // leave it to uscaledpi
Result := ScaledFont;
end
else
Result := FCaptionFont;
end;
{ TSpkElementAppearance }
procedure TSpkElementAppearance.Assign(Source: TPersistent);
@ -937,6 +974,21 @@ begin
FDispatch.NotifyAppearanceChanged;
end;
function TSpkElementAppearance.GetCaptionFont: TFont;
var
ScaledFont: TFont;
begin
if DPI_AWARE then
begin
ScaledFont := TFont.Create;
ScaledFont.Assign(FCaptionFont);
//ScaledFont.Height := SpkScaleY(ScaledFont.Height, 96); // leave it to uscaledpi
Result := ScaledFont;
end
else
Result := FCaptionFont;
end;
procedure TSpkElementAppearance.SetHotTrackCaptionColor(
const Value: TColor);
begin

View File

@ -727,8 +727,8 @@ begin
{$IFDEF EnhancedRecordSupport}
if FButtonKind = bkButtonDropdown then
begin
FButtonRect:=T2DIntRect.Create(FRect.Left, FRect.Top, FRect.Right, FRect.Bottom - LARGEBUTTON_DROPDOWN_FIELD_SIZE);
FDropdownRect:=T2DIntRect.Create(FRect.Left, FRect.Bottom - LARGEBUTTON_DROPDOWN_FIELD_SIZE + 1, FRect.Right, FRect.Bottom);
FButtonRect:=T2DIntRect.Create(FRect.Left, FRect.Top, FRect.Right, FRect.Bottom - SpkLayoutSizes.LARGEBUTTON_DROPDOWN_FIELD_SIZE);
FDropdownRect:=T2DIntRect.Create(FRect.Left, FRect.Bottom - SpkLayoutSizes.LARGEBUTTON_DROPDOWN_FIELD_SIZE + 1, FRect.Right, FRect.Bottom);
end
else
begin
@ -738,8 +738,8 @@ else
{$ELSE}
if FButtonKind = bkButtonDropdown then
begin
FButtonRect.Create(FRect.Left, FRect.Top, FRect.Right, FRect.Bottom - LARGEBUTTON_DROPDOWN_FIELD_SIZE);
FDropdownRect.Create(FRect.Left, FRect.Bottom - LARGEBUTTON_DROPDOWN_FIELD_SIZE + 1, FRect.Right, FRect.Bottom);
FButtonRect.Create(FRect.Left, FRect.Top, FRect.Right, FRect.Bottom - LargeButtonDropdownFieldSize);
FDropdownRect.Create(FRect.Left, FRect.Bottom - LargeButtonDropdownFieldSize + 1, FRect.Right, FRect.Bottom);
end
else
begin
@ -779,7 +779,7 @@ if FToolbarDispatch=nil then
if FAppearance=nil then
exit;
if (FRect.width<2*LARGEBUTTON_RADIUS) or (FRect.Height<2*LARGEBUTTON_RADIUS) then
if (FRect.width<2*LargeButtonRadius) or (FRect.Height<2*LargeButtonRadius) then
exit;
if FButtonKind in [bkButton, bkDropdown] then
@ -813,7 +813,7 @@ if FButtonKind in [bkButton, bkDropdown] then
FButtonRect.Right,
FButtonRect.Bottom),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
FAppearance.Element.HotTrackGradientFromColor,
FAppearance.Element.HotTrackGradientToColor,
FAppearance.Element.HotTrackGradientType,
@ -831,12 +831,12 @@ if FButtonKind in [bkButton, bkDropdown] then
FButtonRect.right-1,
FButtonRect.Bottom-1),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
FAppearance.Element.HotTrackInnerLightColor,
ClipRect);
TGuiTools.DrawAARoundFrame(ABuffer,
FButtonRect,
LARGEBUTTON_RADIUS,
LargeButtonRadius,
FAppearance.Element.HotTrackFrameColor,
ClipRect);
{$ENDREGION}
@ -856,7 +856,7 @@ if FButtonKind in [bkButton, bkDropdown] then
FButtonRect.Right,
FButtonRect.Bottom),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
FAppearance.Element.ActiveGradientFromColor,
FAppearance.Element.ActiveGradientToColor,
FAppearance.Element.ActiveGradientType,
@ -875,12 +875,12 @@ if FButtonKind in [bkButton, bkDropdown] then
FButtonRect.right-1,
FButtonRect.Bottom-1),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
FAppearance.Element.ActiveInnerLightColor,
ClipRect);
TGuiTools.DrawAARoundFrame(ABuffer,
FButtonRect,
LARGEBUTTON_RADIUS,
LargeButtonRadius,
FAppearance.Element.ActiveFrameColor,
ClipRect);
{$ENDREGION}
@ -896,7 +896,7 @@ if FButtonKind in [bkButton, bkDropdown] then
(FLargeImageIndex<FDisabledLargeImages.Count) then
begin
x:=FRect.left + (FRect.Width - FLargeImages.Width) div 2;
y:=FRect.top + LARGEBUTTON_BORDER_SIZE + LARGEBUTTON_GLYPH_MARGIN;
y:=FRect.top + LargeButtonBorderSize + LargeButtonGlyphMargin;
TGuiTools.DrawImage(ABuffer.Canvas,
FDisabledLargeImages,
@ -913,7 +913,7 @@ if FButtonKind in [bkButton, bkDropdown] then
(FLargeImageIndex<FLargeImages.Count) then
begin
x:=FRect.left + (FRect.Width - FLargeImages.Width) div 2;
y:=FRect.top + LARGEBUTTON_BORDER_SIZE + LARGEBUTTON_GLYPH_MARGIN;
y:=FRect.top + LargeButtonBorderSize + LargeButtonGlyphMargin;
TGuiTools.DrawDisabledImage(ABuffer.Canvas,
FLargeImages,
@ -935,7 +935,7 @@ if FButtonKind in [bkButton, bkDropdown] then
(FLargeImageIndex<FLargeImages.Count) then
begin
x:=FRect.left + (FRect.Width - FLargeImages.Width) div 2;
y:=FRect.top + LARGEBUTTON_BORDER_SIZE + LARGEBUTTON_GLYPH_MARGIN;
y:=FRect.top + LargeButtonBorderSize + LargeButtonGlyphMargin;
TGUITools.DrawImage(ABuffer.Canvas,
FLargeImages,
@ -989,12 +989,12 @@ if FButtonKind in [bkButton, bkDropdown] then
s:=copy(FCaption, 1, BreakPos-1);
x:=FRect.Left + (FRect.width - ABuffer.Canvas.Textwidth(s)) div 2;
y:=FRect.Top + LARGEBUTTON_CAPTION_TOP_RAIL - TextHeight div 2;
y:=FRect.Top + LargeButtonCaptionTopRail - TextHeight div 2;
TGUITools.DrawText(ABuffer.Canvas, x, y, s, FontColor, ClipRect);
s:=copy(FCaption, BreakPos+1, length(FCaption) - BreakPos);
x:=FRect.Left + (FRect.width - ABuffer.Canvas.Textwidth(s)) div 2;
y:=FRect.Top + LARGEBUTTON_CAPTION_BOTTOM_RAIL - TextHeight div 2;
y:=FRect.Top + LargeButtonCaptionButtomRail - TextHeight div 2;
TGUITools.DrawText(ABuffer.Canvas, x, y, s, FontColor, ClipRect);
end
else
@ -1003,7 +1003,7 @@ if FButtonKind in [bkButton, bkDropdown] then
TextHeight:=ABuffer.Canvas.Textheight('Wy');
x:=FButtonRect.Left + (FButtonRect.width - ABuffer.Canvas.Textwidth(FCaption)) div 2;
y:=FRect.Top + LARGEBUTTON_CAPTION_TOP_RAIL - TextHeight div 2;
y:=FRect.Top + LargeButtonCaptionTopRail - TextHeight div 2;
TGUITools.DrawText(ABuffer.Canvas, x, y, FCaption, FontColor, ClipRect);
end;
@ -1039,7 +1039,7 @@ if FButtonKind in [bkButton, bkDropdown] then
ABuffer.Canvas.Font.Orientation:=0;
x:=FButtonRect.Left + (FButtonRect.width - ABuffer.Canvas.Textwidth('u')) div 2;
y:=FButtonRect.bottom - ABuffer.Canvas.Textheight('u') - LARGEBUTTON_CHEVRON_HMARGIN;
y:=FButtonRect.bottom - ABuffer.Canvas.Textheight('u') - LargeButtonChevronHMargin;
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', FontColor, ClipRect);
end;
@ -1097,28 +1097,28 @@ else
{$REGION 'T³o przycisku'}
DrawRgn:=CreateRectRgn(FButtonRect.Left,
FButtonRect.Top + LARGEBUTTON_RADIUS,
FButtonRect.Top + LargeButtonRadius,
FButtonRect.Right + 1,
FButtonRect.Bottom);
TmpRgn:=CreateRectRgn(FButtonRect.left + LARGEBUTTON_RADIUS,
TmpRgn:=CreateRectRgn(FButtonRect.left + LargeButtonRadius,
FButtonRect.Top,
FButtonRect.right - LARGEBUTTON_RADIUS + 1,
FButtonRect.Top + LARGEBUTTON_RADIUS);
FButtonRect.right - LargeButtonRadius + 1,
FButtonRect.Top + LargeButtonRadius);
CombineRgn(DrawRgn, DrawRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn:=CreateEllipticRgn(FButtonRect.Left,
FButtonRect.Top,
FButtonRect.Left + 2 * LARGEBUTTON_RADIUS + 1,
FButtonRect.Top + 2 * LARGEBUTTON_RADIUS + 1);
FButtonRect.Left + 2 * LargeButtonRadius + 1,
FButtonRect.Top + 2 * LargeButtonRadius + 1);
CombineRgn(DrawRgn, DrawRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn:=CreateEllipticRgn(FButtonRect.Right - 2 * LARGEBUTTON_RADIUS + 1,
TmpRgn:=CreateEllipticRgn(FButtonRect.Right - 2 * LargeButtonRadius + 1,
FButtonRect.Top,
FButtonRect.Right + 2,
FButtonRect.Top + 2 * LARGEBUTTON_RADIUS + 1);
FButtonRect.Top + 2 * LargeButtonRadius + 1);
CombineRgn(DrawRgn, DrawRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
@ -1140,35 +1140,35 @@ else
{$ELSE}
Create2DIntPoint(FButtonRect.Left + 1, FButtonRect.Top + 1),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpLeftTop,
InnerLightColor,
ClipRect);
TGuiTools.DrawAARoundCorner(ABuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(FButtonRect.Right - LARGEBUTTON_RADIUS, FButtonRect.Top + 1),
T2DIntPoint.Create(FButtonRect.Right - SpkLayoutSizes.LARGEBUTTON_RADIUS, FButtonRect.Top + 1),
{$ELSE}
Create2DIntPoint(FButtonRect.Right - LARGEBUTTON_RADIUS, FButtonRect.Top + 1),
Create2DIntPoint(FButtonRect.Right - LargeButtonRadius, FButtonRect.Top + 1),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpRightTop,
InnerLightColor,
ClipRect);
TGuiTools.DrawHLine(ABuffer,
FButtonRect.Left + LARGEBUTTON_RADIUS + 1,
FButtonRect.Right - LARGEBUTTON_RADIUS - 1,
FButtonRect.Left + LargeButtonRadius + 1,
FButtonRect.Right - LargeButtonRadius - 1,
FButtonRect.Top + 1,
InnerLightColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FButtonRect.Left + 1,
FButtonRect.Top + LARGEBUTTON_RADIUS + 1,
FButtonRect.Top + LargeButtonRadius + 1,
FButtonRect.Bottom,
InnerLightColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FButtonRect.Right - 1,
FButtonRect.Top + LARGEBUTTON_RADIUS + 1,
FButtonRect.Top + LargeButtonRadius + 1,
FButtonRect.Bottom,
InnerLightColor,
ClipRect);
@ -1194,35 +1194,35 @@ else
{$ELSE}
Create2DIntPoint(FButtonRect.Left, FButtonRect.Top),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpLeftTop,
FrameColor,
ClipRect);
TGuiTools.DrawAARoundCorner(ABuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(FButtonRect.Right - LARGEBUTTON_RADIUS + 1, FButtonRect.Top),
T2DIntPoint.Create(FButtonRect.Right - LargeButtonRadius + 1, FButtonRect.Top),
{$ELSE}
Create2DIntPoint(FButtonRect.Right - LARGEBUTTON_RADIUS + 1, FButtonRect.Top),
Create2DIntPoint(FButtonRect.Right - LargeButtonRadius + 1, FButtonRect.Top),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpRightTop,
FrameColor,
ClipRect);
TGuiTools.DrawHLine(ABuffer,
FButtonRect.Left + LARGEBUTTON_RADIUS,
FButtonRect.Right - LARGEBUTTON_RADIUS,
FButtonRect.Left + LargeButtonRadius,
FButtonRect.Right - LargeButtonRadius,
FButtonRect.Top,
FrameColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FButtonRect.Left,
FButtonRect.Top + LARGEBUTTON_RADIUS,
FButtonRect.Top + LargeButtonRadius,
FButtonRect.Bottom,
FrameColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FButtonRect.Right,
FButtonRect.Top + LARGEBUTTON_RADIUS,
FButtonRect.Top + LargeButtonRadius,
FButtonRect.Bottom,
FrameColor,
ClipRect);
@ -1264,24 +1264,24 @@ else
DrawRgn:=CreateRectRgn(FDropdownRect.left,
FDropdownRect.Top,
FDropdownRect.Right + 1,
FDropdownRect.Bottom - LARGEBUTTON_RADIUS + 1);
FDropdownRect.Bottom - LargeButtonRadius + 1);
TmpRgn:=CreateRectRgn(FDropdownRect.left + LARGEBUTTON_RADIUS,
FDropdownRect.Bottom - LARGEBUTTON_RADIUS + 1,
FDropdownRect.Right - LARGEBUTTON_RADIUS + 1,
TmpRgn:=CreateRectRgn(FDropdownRect.left + LargeButtonRadius,
FDropdownRect.Bottom - LargeButtonRadius + 1,
FDropdownRect.Right - LargeButtonRadius + 1,
FDropdownRect.Bottom + 1);
CombineRgn(DrawRgn, DrawRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn:=CreateEllipticRgn(FDropdownRect.Left,
FDropdownRect.bottom - 2 * LARGEBUTTON_RADIUS + 1,
FDropdownRect.left + 2 * LARGEBUTTON_RADIUS + 1,
FDropdownRect.bottom - 2 * LargeButtonRadius + 1,
FDropdownRect.left + 2 * LargeButtonRadius + 1,
FDropdownRect.Bottom + 2);
CombineRgn(DrawRgn, DrawRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn:=CreateEllipticRgn(FDropdownRect.Right - 2 * LARGEBUTTON_RADIUS + 1,
FDropdownRect.Bottom - 2 * LARGEBUTTON_RADIUS + 1,
TmpRgn:=CreateEllipticRgn(FDropdownRect.Right - 2 * LargeButtonRadius + 1,
FDropdownRect.Bottom - 2 * LargeButtonRadius + 1,
FDropdownRect.Right + 2,
FDropdownRect.Bottom + 2);
CombineRgn(DrawRgn, DrawRgn, TmpRgn, RGN_OR);
@ -1302,38 +1302,38 @@ else
TGuiTools.DrawAARoundCorner(ABuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(FDropdownRect.Left + 1, FDropdownRect.Bottom - LARGEBUTTON_RADIUS),
T2DIntPoint.Create(FDropdownRect.Left + 1, FDropdownRect.Bottom - SpkLayoutSizes.LARGEBUTTON_RADIUS),
{$ELSE}
Create2DIntPoint(FDropdownRect.Left + 1, FDropdownRect.Bottom - LARGEBUTTON_RADIUS),
Create2DIntPoint(FDropdownRect.Left + 1, FDropdownRect.Bottom - LargeButtonRadius),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpLeftBottom,
InnerLightColor);
TGuiTools.DrawAARoundCorner(ABuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(FDropdownRect.right - LARGEBUTTON_RADIUS, FDropdownRect.Bottom - LARGEBUTTON_RADIUS),
T2DIntPoint.Create(FDropdownRect.right - LargeButtonRadius, FDropdownRect.Bottom - LargeButtonRadius),
{$ELSE}
Create2DIntPoint(FDropdownRect.right - LARGEBUTTON_RADIUS, FDropdownRect.Bottom - LARGEBUTTON_RADIUS),
Create2DIntPoint(FDropdownRect.right - LargeButtonRadius, FDropdownRect.Bottom - LargeButtonRadius),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpRightBottom,
InnerLightColor);
TGuiTools.DrawHLine(ABuffer,
FDropdownRect.Left + LARGEBUTTON_RADIUS + 1,
FDropdownRect.Right - LARGEBUTTON_RADIUS - 1,
FDropdownRect.Left + LargeButtonRadius + 1,
FDropdownRect.Right - LargeButtonRadius - 1,
FDropdownRect.Bottom - 1,
InnerLightColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FDropdownRect.Left + 1,
FDropDownRect.Top + 1,
FDropDownRect.Bottom - LARGEBUTTON_RADIUS - 1,
FDropDownRect.Bottom - LargeButtonRadius - 1,
InnerLightColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FDropdownRect.Right - 1,
FDropDownRect.Top + 1,
FDropDownRect.Bottom - LARGEBUTTON_RADIUS - 1,
FDropDownRect.Bottom - LargeButtonRadius - 1,
InnerLightColor,
ClipRect);
@ -1356,38 +1356,38 @@ else
// Zewnêtrzna ramka
TGuiTools.DrawAARoundCorner(ABuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(FDropdownRect.Left, FDropdownRect.Bottom - LARGEBUTTON_RADIUS + 1),
T2DIntPoint.Create(FDropdownRect.Left, FDropdownRect.Bottom - LargeButtonRadius + 1),
{$ELSE}
Create2DIntPoint(FDropdownRect.Left, FDropdownRect.Bottom - LARGEBUTTON_RADIUS + 1),
Create2DIntPoint(FDropdownRect.Left, FDropdownRect.Bottom - LargeButtonRadius + 1),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpLeftBottom,
FrameColor);
TGuiTools.DrawAARoundCorner(ABuffer,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(FDropdownRect.right - LARGEBUTTON_RADIUS + 1, FDropdownRect.Bottom - LARGEBUTTON_RADIUS + 1),
T2DIntPoint.Create(FDropdownRect.right - LargeButtonRadius + 1, FDropdownRect.Bottom - LargeButtonRadius + 1),
{$ELSE}
Create2DIntPoint(FDropdownRect.right - LARGEBUTTON_RADIUS + 1, FDropdownRect.Bottom - LARGEBUTTON_RADIUS + 1),
Create2DIntPoint(FDropdownRect.right - LargeButtonRadius + 1, FDropdownRect.Bottom - LargeButtonRadius + 1),
{$ENDIF}
LARGEBUTTON_RADIUS,
LargeButtonRadius,
cpRightBottom,
FrameColor);
TGuiTools.DrawHLine(ABuffer,
FDropdownRect.Left + LARGEBUTTON_RADIUS,
FDropdownRect.Right - LARGEBUTTON_RADIUS,
FDropdownRect.Left + LargeButtonRadius,
FDropdownRect.Right - LargeButtonRadius,
FDropdownRect.Bottom,
FrameColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FDropdownRect.Left,
FDropDownRect.Top,
FDropDownRect.Bottom - LARGEBUTTON_RADIUS,
FDropDownRect.Bottom - LargeButtonRadius,
FrameColor,
ClipRect);
TGuiTools.DrawVLine(ABuffer,
FDropdownRect.Right,
FDropDownRect.Top,
FDropDownRect.Bottom - LARGEBUTTON_RADIUS,
FDropDownRect.Bottom - LargeButtonRadius,
FrameColor,
ClipRect);
{$ENDREGION}
@ -1405,7 +1405,7 @@ else
(FLargeImageIndex<FDisabledLargeImages.Count) then
begin
x:=FRect.left + (FRect.Width - FLargeImages.Width) div 2;
y:=FRect.top + LARGEBUTTON_BORDER_SIZE + LARGEBUTTON_GLYPH_MARGIN;
y:=FRect.top + LargeButtonBorderSize + LargeButtonGlyphMargin;
TGuiTools.DrawImage(ABuffer.Canvas,
FDisabledLargeImages,
@ -1422,7 +1422,7 @@ else
(FLargeImageIndex<FLargeImages.Count) then
begin
x:=FRect.left + (FRect.Width - FLargeImages.Width) div 2;
y:=FRect.top + LARGEBUTTON_BORDER_SIZE + LARGEBUTTON_GLYPH_MARGIN;
y:=FRect.top + LargeButtonBorderSize + LargeButtonGlyphMargin;
TGuiTools.DrawDisabledImage(ABuffer.Canvas,
FLargeImages,
@ -1444,7 +1444,7 @@ else
(FLargeImageIndex<FLargeImages.Count) then
begin
x:=FRect.left + (FRect.Width - FLargeImages.Width) div 2;
y:=FRect.top + LARGEBUTTON_BORDER_SIZE + LARGEBUTTON_GLYPH_MARGIN;
y:=FRect.top + LargeButtonBorderSize + LargeButtonGlyphMargin;
TGUITools.DrawImage(ABuffer.Canvas,
FLargeImages,
@ -1489,7 +1489,7 @@ else
TextHeight:=ABuffer.Canvas.Textheight('Wy');
x:=FRect.Left + (FRect.width - ABuffer.Canvas.Textwidth(FCaption)) div 2;
y:=FRect.Top + LARGEBUTTON_CAPTION_TOP_RAIL - TextHeight div 2;
y:=FRect.Top + LargeButtonCaptionTopRail - TextHeight div 2;
TGUITools.DrawText(ABuffer.Canvas, x, y, FCaption, FontColor, ClipRect);
// *** Chevron dropdown ***
@ -1522,7 +1522,7 @@ else
ABuffer.Canvas.Font.Orientation:=0;
x:=FDropdownRect.Left + (FDropdownRect.width - ABuffer.Canvas.Textwidth('u')) div 2;
y:=FDropdownRect.bottom - ABuffer.Canvas.Textheight('u') - LARGEBUTTON_CHEVRON_HMARGIN;
y:=FDropdownRect.bottom - ABuffer.Canvas.Textheight('u') - LargeButtonChevronHMargin;
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', FontColor, ClipRect);
{$ENDREGION}
@ -1627,7 +1627,7 @@ if Bitmap=nil then
// *** Glyph ***
if FLargeImages<>nil then
GlyphWidth:=2 * LARGEBUTTON_GLYPH_MARGIN + FLargeImages.Width else
GlyphWidth:=2 * LargeButtonGlyphMargin + FLargeImages.Width else
GlyphWidth:=0;
// *** Tekst ***
@ -1635,16 +1635,16 @@ if FButtonKind = bkButton then
begin
// £amiemy etykietê
FindBreakPlace(FCaption,BreakPos,RowWidth);
TextWidth:=2 * LARGEBUTTON_CAPTION_HMARGIN + RowWidth;
TextWidth:=2 * LargeButtonCaptionHMargin + RowWidth;
end
else
begin
// Nie ³amiemy etykiety
Bitmap.canvas.font.assign(FAppearance.Element.CaptionFont);
TextWidth:=2 * LARGEBUTTON_CAPTION_HMARGIN + Bitmap.Canvas.TextWidth(FCaption);
TextWidth:=2 * LargeButtonCaptionHMargin + Bitmap.Canvas.TextWidth(FCaption);
end;
result:=max(LARGEBUTTON_MIN_WIDTH, max(GlyphWidth, TextWidth));
result := Max(LargeButtonMinWidth, max(GlyphWidth, TextWidth));
end;
procedure TSpkLargeButton.SetLargeImageIndex(const Value: TImageIndex);
@ -1706,7 +1706,7 @@ AdditionalPadding:=false;
// Ikona
if FImageIndex<>-1 then
begin
BtnWidth:=BtnWidth + SMALLBUTTON_PADDING + SMALLBUTTON_GLYPH_WIDTH;
BtnWidth:=BtnWidth + SmallButtonPadding + SmallButtonGlyphWidth;
AdditionalPadding:=true;
end;
@ -1716,87 +1716,87 @@ if FShowCaption then
Bitmap.Canvas.Font.assign(FAppearance.Element.CaptionFont);
TextWidth:=Bitmap.Canvas.TextWidth(FCaption);
BtnWidth:=BtnWidth + SMALLBUTTON_PADDING + TextWidth;
BtnWidth:=BtnWidth + SmallButtonPadding + TextWidth;
AdditionalPadding:=true;
end;
// Padding za tekstem lub ikon¹
if AdditionalPadding then
BtnWidth:=BtnWidth + SMALLBUTTON_PADDING;
BtnWidth:=BtnWidth + SmallButtonPadding;
// Szerokoœæ zawartoœci przycisku musi wynosiæ co najmniej SMALLBUTTON_MIN_WIDTH
BtnWidth:=max(SMALLBUTTON_MIN_WIDTH, BtnWidth);
BtnWidth := Max(SmallButtonMinWidth, BtnWidth);
// *** Dropdown ***
case FButtonKind of
bkButton: begin
// Lewa krawêdŸ przycisku
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
BtnWidth:=BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH else
BtnWidth:=BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
BtnWidth:=BtnWidth + SmallButtonBorderWidth;
// Prawa krawêdŸ przycisku
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
BtnWidth:=BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH else
BtnWidth:=BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
BtnWidth:=BtnWidth + SmallButtonBorderWidth;
{$IFDEF EnhancedRecordSupport}
BtnRect:=T2DIntRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect:=T2DIntRect.Create(0, 0, BtnWidth - 1, SpkLayoutSizes.PANE_ROW_HEIGHT - 1);
DropRect:=T2DIntRect.Create(0, 0, 0, 0);
{$ELSE}
BtnRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
DropRect.Create(0, 0, 0, 0);
{$ENDIF}
end;
bkButtonDropdown: begin
// Lewa krawêdŸ przycisku
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
BtnWidth:=BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH else
BtnWidth:=BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
BtnWidth:=BtnWidth + SmallButtonBorderWidth;
// Prawa krawêdŸ przycisku
BtnWidth:=BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH;
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth;
// Lewa krawêdŸ i zawartoœæ pola dropdown
DropdownWidth:=SMALLBUTTON_HALF_BORDER_WIDTH + SMALLBUTTON_DROPDOWN_WIDTH;
DropdownWidth := SmallButtonHalfBorderWidth + SmallButtonDropdownWidth;
// Prawa krawêdŸ pola dropdown
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
DropdownWidth:=DropdownWidth + SMALLBUTTON_HALF_BORDER_WIDTH else
DropdownWidth:=DropdownWidth + SMALLBUTTON_BORDER_WIDTH;
DropdownWidth:=DropdownWidth + SmallButtonHalfBorderWidth else
DropdownWidth:=DropdownWidth + SmallButtonBorderWidth;
{$IFDEF EnhancedRecordSupport}
BtnRect:=T2DIntRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect:=T2DIntRect.Create(0, 0, BtnWidth - 1, PaneRowHeightT - 1);
DropRect:=T2DIntRect.Create(BtnRect.right+1,
0,
BtnRect.right+DropdownWidth,
PANE_ROW_HEIGHT - 1);
PaneRowHeight - 1);
{$ELSE}
BtnRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
DropRect.Create(BtnRect.right+1, 0,
BtnRect.right+DropdownWidth, PANE_ROW_HEIGHT - 1);
BtnRect.right+DropdownWidth, PaneRowHeight - 1);
{$ENDIF}
end;
bkDropdown: begin
// Lewa krawêdŸ przycisku
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
BtnWidth:=BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH else
BtnWidth:=BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
BtnWidth:=BtnWidth + SmallButtonBorderWidth;
// Prawa krawêdŸ przycisku
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
BtnWidth:=BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH else
BtnWidth:=BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth:=BtnWidth + SmallButtonHalfBorderWidth else
BtnWidth:=BtnWidth + SmallButtonBorderWidth;
// Dodatkowy obszar na dropdown + miejsce na œrodkow¹ krawêdŸ,
// dla kompatybilnoœci wymiarów z dkButtonDropdown
BtnWidth:=BtnWidth + SMALLBUTTON_BORDER_WIDTH + SMALLBUTTON_DROPDOWN_WIDTH;
BtnWidth:=BtnWidth + SmallButtonBorderWidth + SmallButtonDropdownWidth;
{$IFDEF EnhancedRecordSupport}
BtnRect:=T2DIntRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect:=T2DIntRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
DropRect:=T2DIntRect.Create(0, 0, 0, 0);
{$ELSE}
BtnRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
DropRect.Create(0, 0, 0, 0);
{$ENDIF}
end;
@ -1824,7 +1824,7 @@ if FToolbarDispatch=nil then
if FAppearance=nil then
exit;
if (FRect.width<2*LARGEBUTTON_RADIUS) or (FRect.Height<2*LARGEBUTTON_RADIUS) then
if (FRect.width < 2*LargeButtonRadius) or (FRect.Height < 2*LargeButtonRadius) then
exit;
// *** Przycisk ***
@ -1846,7 +1846,7 @@ if (FButtonState = bsIdle) and (not(FHideFrameWhenIdle)) then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end else
if (FButtonState=bsBtnHottrack) then
@ -1864,7 +1864,7 @@ if (FButtonState=bsBtnHottrack) then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end else
if (FButtonState = bsBtnPressed) then
@ -1882,7 +1882,7 @@ if (FButtonState = bsBtnPressed) then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end else
if (FButtonState in [bsDropdownHottrack, bsDropdownPressed]) then
@ -1900,7 +1900,7 @@ if (FButtonState in [bsDropdownHottrack, bsDropdownPressed]) then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end;
{$ENDREGION}
@ -1914,8 +1914,8 @@ if not(FEnabled) then
(FImageIndex<FDisabledImages.Count) then
begin
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
x:=FButtonRect.Left + SMALLBUTTON_HALF_BORDER_WIDTH + SMALLBUTTON_PADDING else
x:=FButtonRect.Left + SMALLBUTTON_BORDER_WIDTH + SMALLBUTTON_PADDING;
x:=FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding else
x:=FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding;
y:=FButtonRect.top + (FButtonRect.height - FDisabledImages.Height) div 2;
TGuiTools.DrawImage(ABuffer.Canvas,
@ -1933,8 +1933,8 @@ if not(FEnabled) then
(FImageIndex<FImages.Count) then
begin
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
x:=FButtonRect.Left + SMALLBUTTON_HALF_BORDER_WIDTH + SMALLBUTTON_PADDING else
x:=FButtonRect.Left + SMALLBUTTON_BORDER_WIDTH + SMALLBUTTON_PADDING;
x:=FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding else
x:=FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding;
y:=FButtonRect.top + (FButtonRect.height - FImages.Height) div 2;
TGuiTools.DrawDisabledImage(ABuffer.Canvas,
@ -1957,8 +1957,8 @@ else
(FImageIndex<FImages.Count) then
begin
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
x:=FButtonRect.Left + SMALLBUTTON_HALF_BORDER_WIDTH + SMALLBUTTON_PADDING else
x:=FButtonRect.Left + SMALLBUTTON_BORDER_WIDTH + SMALLBUTTON_PADDING;
x:=FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding else
x:=FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding;
y:=FButtonRect.top + (FButtonRect.height - FImages.Height) div 2;
TGUITools.DrawImage(ABuffer.Canvas,
@ -2003,12 +2003,12 @@ if FShowCaption then
end;
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
x:=FButtonRect.Left + SMALLBUTTON_HALF_BORDER_WIDTH else
x:=FButtonRect.Left + SMALLBUTTON_BORDER_WIDTH;
x:=FButtonRect.Left + SmallButtonHalfBorderWidth else
x:=FButtonRect.Left + SmallButtonBorderWidth;
if FImageIndex<>-1 then
x:=x + 2 * SMALLBUTTON_PADDING + SMALLBUTTON_GLYPH_WIDTH else
x:=x + SMALLBUTTON_PADDING;
x:=x + 2 * SmallButtonPadding + SmallButtonGlyphWidth else
x:=x + SmallButtonPadding;
y:=FButtonRect.Top + (FButtonRect.Height - ABuffer.Canvas.TextHeight('Wy')) div 2;
TGUITools.DrawText(ABuffer.Canvas,
@ -2043,7 +2043,7 @@ if FButtonKind = bkButtonDropdown then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end else
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
@ -2061,7 +2061,7 @@ if FButtonKind = bkButtonDropdown then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end else
@ -2080,7 +2080,7 @@ if FButtonKind = bkButtonDropdown then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end else
if (FButtonState = bsDropdownPressed) then
@ -2098,7 +2098,7 @@ if FButtonKind = bkButtonDropdown then
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect);
end;
@ -2133,8 +2133,8 @@ if FButtonKind = bkButtonDropdown then
ABuffer.Canvas.Font.Orientation:=0;
if FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup] then
x:=FDropdownRect.Right - SMALLBUTTON_HALF_BORDER_WIDTH - (SMALLBUTTON_DROPDOWN_WIDTH + ABuffer.Canvas.Textwidth('u')) div 2 + 1 else
x:=FDropdownRect.Right - SMALLBUTTON_BORDER_WIDTH - (SMALLBUTTON_DROPDOWN_WIDTH + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
x:=FDropdownRect.Right - SmallButtonHalfBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1 else
x:=FDropdownRect.Right - SmallButtonBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
y:=FDropdownRect.top + (FDropdownRect.height - ABuffer.Canvas.Textheight('u')) div 2;
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', FontColor, ClipRect);
{$ENDREGION}
@ -2173,8 +2173,8 @@ if FButtonKind = bkDropdown then
ABuffer.Canvas.Font.Orientation:=0;
if FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup] then
x:=FButtonRect.Right - SMALLBUTTON_HALF_BORDER_WIDTH - (SMALLBUTTON_DROPDOWN_WIDTH + ABuffer.Canvas.Textwidth('u')) div 2 + 1 else
x:=FButtonRect.Right - SMALLBUTTON_BORDER_WIDTH - (SMALLBUTTON_DROPDOWN_WIDTH + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
x:=FButtonRect.Right - SmallButtonHalfBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1 else
x:=FButtonRect.Right - SmallButtonBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
y:=FButtonRect.top + (FButtonRect.height - ABuffer.Canvas.Textheight('u')) div 2;
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', FontColor, ClipRect);
end;

View File

@ -201,25 +201,25 @@ begin
Bitmap.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
TextWidth := Bitmap.Canvas.TextWidth(FCaption);
BtnWidth := SMALLBUTTON_PADDING + SMALLBUTTON_GLYPH_WIDTH +
SMALLBUTTON_PADDING + TextWidth + SMALLBUTTON_PADDING;
BtnWidth := Max(SMALLBUTTON_MIN_WIDTH, BtnWidth);
BtnWidth := SmallButtonPadding + SmallButtonGlyphWidth +
SmallButtonPadding + TextWidth + SmallButtonPadding;
BtnWidth := Max(SmallButtonMinWidth, BtnWidth);
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
BtnWidth := BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
else
BtnWidth := BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth := BtnWidth + SmallButtonBorderWidth;
// Prawa krawêdŸ przycisku
if (FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) then
BtnWidth := BtnWidth + SMALLBUTTON_HALF_BORDER_WIDTH
BtnWidth := BtnWidth + SmallButtonHalfBorderWidth
else
BtnWidth := BtnWidth + SMALLBUTTON_BORDER_WIDTH;
BtnWidth := BtnWidth + SmallButtonBorderWidth;
{$IFDEF EnhancedRecordSupport}
BtnRect := T2DIntRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect := T2DIntRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
{$ELSE}
BtnRect.Create(0, 0, BtnWidth - 1, PANE_ROW_HEIGHT - 1);
BtnRect.Create(0, 0, BtnWidth - 1, PaneRowHeight - 1);
{$ENDIF}
end;
@ -234,7 +234,7 @@ begin
exit;
if FAppearance = nil then
exit;
if (FRect.Width < 2*LARGEBUTTON_RADIUS) or (FRect.Height < 2*LARGEBUTTON_RADIUS) then
if (FRect.Width < 2*LargeButtonRadius) or (FRect.Height < 2*LargeButtonRadius) then
exit;
// Border
@ -253,7 +253,7 @@ begin
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect
);
end else
@ -272,7 +272,7 @@ begin
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect
);
end else
@ -291,7 +291,7 @@ begin
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
false,
false,
SMALLBUTTON_RADIUS,
SmallButtonRadius,
ClipRect
);
end;
@ -303,9 +303,9 @@ begin
end else
h := GetSystemMetrics(SM_CYMENUCHECK);
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
x := FButtonRect.Left + SMALLBUTTON_HALF_BORDER_WIDTH + SMALLBUTTON_PADDING
x := FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding
else
x := FButtonRect.Left + SMALLBUTTON_BORDER_WIDTH + SMALLBUTTON_PADDING;
x := FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding;
y := FButtonRect.Top + (FButtonRect.Height - h) div 2;
TGUITools.DrawCheckbox(
@ -339,10 +339,10 @@ begin
end;
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
x := FButtonRect.Left + SMALLBUTTON_HALF_BORDER_WIDTH
x := FButtonRect.Left + SmallButtonHalfBorderWidth
else
x := FButtonRect.Left + SMALLBUTTON_BORDER_WIDTH;
x := x + 2 * SMALLBUTTON_PADDING + SMALLBUTTON_GLYPH_WIDTH;
x := FButtonRect.Left + SmallButtonBorderWidth;
x := x + 2 * SmallButtonPadding + SmallButtonGlyphWidth;
y := FButtonRect.Top + (FButtonRect.Height - ABuffer.Canvas.TextHeight('Wy')) div 2;
TGUITools.DrawText(

View File

@ -14,8 +14,13 @@ unit spkt_Const;
interface
const // ****************
// *** Elementy ***
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
function SpkScaleX(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer;
function SpkScaleY(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer;
const
// ****************
// *** Elements ***
// ****************
LARGEBUTTON_DROPDOWN_FIELD_SIZE = 29;
@ -28,141 +33,358 @@ const // ****************
LARGEBUTTON_CAPTION_TOP_RAIL = 45;
LARGEBUTTON_CAPTION_BOTTOM_RAIL = 58;
SMALLBUTTON_GLYPH_WIDTH = 20; //16;
SMALLBUTTON_GLYPH_WIDTH = 16; //was: 20; //16;
SMALLBUTTON_BORDER_WIDTH = 2;
SMALLBUTTON_HALF_BORDER_WIDTH = 1;
SMALLBUTTON_PADDING = 2;
SMALLBUTTON_DROPDOWN_WIDTH = 11;
SMALLBUTTON_RADIUS = 4;
SMALLBUTTON_MIN_WIDTH = 2 * SMALLBUTTON_PADDING + SMALLBUTTON_GLYPH_WIDTH;
// ********************
// *** Obszar tafli ***
// ********************
// ***********************
// *** Tab page layout ***
// ***********************
/// <summary>Maksymalna wysokoœæ obszaru, który mo¿e zaj¹æ zawartoœæ
/// tafli z elementami</summary>
/// <summary>Maximum area height that can be used by an element</summary>
MAX_ELEMENT_HEIGHT = 67;
/// <summary>Wysokoœæ pojedynczego wiersza elementów tafli</summary>
/// <summary>Maximum row height</summary>
PANE_ROW_HEIGHT = 22;
PANE_FULL_ROW_HEIGHT = 3 * PANE_ROW_HEIGHT;
/// <summary>Wewnêtrzny pionowy margines pomiêdzy pierwszym elementem a
/// tafl¹ w przypadku wersji jednowierszowej</summary>
/// <summary>Single row top margin</summary>
PANE_ONE_ROW_TOPPADDING = 22;
/// <summary>Wewnêtrzny pionowy margines pomiêdzy ostatnim elementem
/// a tafl¹ w przypadku wersji jednowierszowej</summary>
/// <summary>Single row bottom margin</summary>
PANE_ONE_ROW_BOTTOMPADDING = 23;
/// <summary>Odleg³oœæ pomiêdzy wierszami w przypadku wersji dwuwierszowej
/// </summary>
/// <summary>Space between rows in a double row layout</summary>
PANE_TWO_ROWS_VSPACER = 7;
/// <summary>Wewnêtrzny pionowy margines pomiêdzy pierwszym elementem a
/// tafl¹ w przypadku wersji dwuwierszowej</summary>
/// <summary>Double row layout top margin</summary>
PANE_TWO_ROWS_TOPPADDING = 8;
/// <summary>Wewnêtrzny pionowy margines pomiêdzy ostatnim elementem
/// a tafl¹ w przypadku wersji dwuwierszowej</summary>
/// <summary>Double row layout bottom margin</summary>
PANE_TWO_ROWS_BOTTOMPADDING = 8;
/// <summary>Odleg³oœæ pomiêdzy wierszami w przypadku wersji
/// trzywierszowej</summary>
/// <summary>Space between rows in triple row layout</summary>
PANE_THREE_ROWS_VSPACER = 0;
/// <summary>Wewnêtrzny pionowy margines pomiêdzy pierwszym elementem a
/// tafl¹ w przypadku wersji trzywierszowej</summary>
/// <summary>Triple row layout top margin</summary>
PANE_THREE_ROWS_TOPPADDING = 0;
/// <summary>Wewnêtrzny pionowy margines pomiêdzy ostatnim elementem
/// a tafl¹ w przypadku wersji trzywierszowej</summary>
/// <summary>Triple row layout bottom margin</summary>
PANE_THREE_ROWS_BOTTOMPADDING = 1;
PANE_FULL_ROW_TOPPADDING = PANE_THREE_ROWS_TOPPADDING;
PANE_FULL_ROW_BOTTOMPADDING = PANE_THREE_ROWS_BOTTOMPADDING;
/// <summary>Odleg³oœæ pomiêdzy lew¹ krawêdzi¹ a pierwszym elementem
/// tafli</summary>
/// <summary>Pane left padding, space between left pane border and left element border</summary>
PANE_LEFT_PADDING = 2;
/// <summary>Odleg³oœæ pomiêdzy ostatnim elementem tafli a praw¹ krawêdzi¹
/// </summary>
/// <summary>Pane right padding, space between right pane border and right element border</summary>
PANE_RIGHT_PADDING = 2;
/// <summary>Odleg³oœæ pomiêdzy dwoma kolumnami wewn¹trz tafli</summary>
/// <summary>Space between two columns inside the pane</summary>
PANE_COLUMN_SPACER = 4;
/// <summary>Odleg³oœæ pomiêdzy dwoma osobnymi grupami wewnêtrz wiersza
/// w tafli</summary>
/// <summary>Space between groups on a row in pane</summary>
PANE_GROUP_SPACER = 4;
// *************
// *** Tafla ***
// *************
/// <summary>Wysokoœæ obszaru tytu³u tafli</summary>
// *******************
// *** Pane layout ***
// *******************
/// <summary>Pane caption height</summary>
PANE_CAPTION_HEIGHT = 15;
/// <summary>Pane corner radius</summary>
PANE_CORNER_RADIUS = 3;
/// <summary>SzerokoϾ/wysokoϾ ramki tafli</summary>
/// <remarks>Nie nale¿y zmieniaæ tej sta³ej!</remarks>
/// <summary>Pane border size.</summary>
/// <remarks>Do not change?</remarks>
PANE_BORDER_SIZE = 2;
/// <summary>Po³owa szerokoœci ramki tafli</summary>
/// <remarks>Nie nale¿y zmieniaæ tej sta³ej!</remarks>
/// <summary>Half width of pane border?</summary>
/// <remarks>Do not change?</remarks>
PANE_BORDER_HALF_SIZE = 1;
/// <summary>Wysokoœæ ca³ej tafli (uwzglêdniaj¹c ramkê)</summary>
PANE_HEIGHT = MAX_ELEMENT_HEIGHT + PANE_CAPTION_HEIGHT + 2 * PANE_BORDER_SIZE;
/// <summary>Poziomy margines etykiety zak³adki</summary>
/// <summary>Pane caption horizontal padding</summary>
PANE_CAPTION_HMARGIN = 6;
// ***********************
// *** Obszar zak³adki ***
// ***********************
/// <summary>Promieñ zaokr¹glenia zak³adki</summary>
// ************
// *** Tabs ***
// ************
/// <summary>Tab corner radius</summary>
TAB_CORNER_RADIUS = 4;
/// <summary>Lewy wewnêtrzny margines zak³adki</summary>
/// <summary>Tab page left margin</summary>
TAB_PANE_LEFTPADDING = 2;
/// <summary>Prawy wewnêtrzny margines zak³adki</summary>
/// <summary>Tab page right margin</summary>
TAB_PANE_RIGHTPADDING = 2;
/// <summary>Górny wewnêtrzny margines zak³adki</summary>
/// <summary>Tab page top margin</summary>
TAB_PANE_TOPPADDING = 2;
/// <summary>Dolny wewnêtrzny margines zak³adki</summary>
/// <summary>Tab page bottom margin</summary>
TAB_PANE_BOTTOMPADDING = 1;
/// <summary>Odleg³oœæ pomiêdzy taflami</summary>
/// <summary>Space between panes</summary>
TAB_PANE_HSPACING = 3;
/// <summary>Szerokoœæ/wysokoœæ ramki zak³adki (nie nale¿y zmieniaæ!)
/// </summary>
/// <summary>Tab border size</summary>
TAB_BORDER_SIZE = 1;
/// <summary>Wysokoœæ zak³adki</summary>
TAB_HEIGHT = PANE_HEIGHT + TAB_PANE_TOPPADDING + TAB_PANE_BOTTOMPADDING + TAB_BORDER_SIZE;
// ***************
// *** Toolbar ***
// ***************
/// <summary>Pane padding?</summary>
TOOLBAR_BORDER_WIDTH = 1;
TOOLBAR_CORNER_RADIUS = 3;
/// <summary>Wysokoœæ etykiet z nazwami zak³adek</summary>
/// <summary>Tab caption height</summary>
TOOLBAR_TAB_CAPTIONS_HEIGHT = 22;
/// <summary>Poziomy margines wewnêtrznego tytu³u zak³adki</summary>
/// <summary>Tab caption horizontal padding</summary>
TOOLBAR_TAB_CAPTIONS_TEXT_HPADDING = 4;
/// <summary>Min tab caption width</summary>
TOOLBAR_MIN_TAB_CAPTION_WIDTH = 32;
/// <summary>Sumaryczna wysokoϾ toolbara</summary>
TOOLBAR_HEIGHT = TOOLBAR_TAB_CAPTIONS_HEIGHT +
TAB_HEIGHT;
var
// ****************
// *** Elements ***
// ****************
LargeButtonDropdownFieldSize: Integer;
LargeButtonGlyphMargin: Integer;
LargeButtonCaptionHMargin: Integer;
LargeButtonMinWidth: Integer;
LargeButtonRadius: Integer;
LargeButtonBorderSize: Integer;
LargeButtonChevronHMargin: Integer;
LargeButtonCaptionTopRail: Integer;
LargeButtonCaptionButtomRail: Integer;
SmallButtonGlyphWidth: Integer;
SmallButtonBorderWidth: Integer;
SmallButtonHalfBorderWidth: Integer;
SmallButtonPadding: Integer;
SmallButtonDropdownWidth: Integer;
SmallButtonRadius: Integer;
SmallButtonMinWidth: Integer;
// ***********************
// *** Tab page layout ***
// ***********************
/// <summary>Maximum area height that can be used by an element</summary>
MaxElementHeight: Integer;
/// <summary>Maximum row height</summary>
PaneRowHeight: Integer;
PaneFullRowHeight: Integer;
/// <summary>Single row top margin</summary>
PaneOneRowTopPadding: Integer;
/// <summary>Single row bottom margin</summary>
PaneOneRowBottomPadding: Integer;
/// <summary>Space between rows in a double row layout</summary>
PaneTwoRowsVSpacer: Integer;
/// <summary>Double row layout top margin</summary>
PaneTwoRowsTopPadding: Integer;
/// <summary>Double row layout bottom margin</summary>
PaneTwoRowsBottomPadding: Integer;
/// <summary>Space between rows in triple row layout</summary>
PaneThreeRowsVSpacer: Integer;
/// <summary>Triple row layout top margin</summary>
PaneThreeRowsTopPadding: Integer;
/// <summary>Triple row layout bottom margin</summary>
PaneThreeRowsBottomPadding: Integer;
PaneFullRowTopPadding: Integer;
PaneFullRowBottomPadding: Integer;
/// <summary>Pane left padding, space between left pane border and left element border</summary>
PaneLeftPadding: Integer;
/// <summary>Pane right padding, space between right pane border and right element border</summary>
PaneRightPadding: Integer;
/// <summary>Space between two columns inside the pane</summary>
PaneColumnSpacer: Integer;
/// <summary>Space between groups on a row in pane</summary>
PaneGroupSpacer: Integer;
// *******************
// *** Pane layout ***
// *******************
/// <summary>Pane caption height</summary>
PaneCaptionHeight: Integer;
/// <summary>Pane corner radius</summary>
PaneCornerRadius: Integer;
/// <summary>Pane border size</summary>
/// <remarks>Do not change?</remarks>
PaneBorderSize: Integer;
/// <summary>Half width of pane border?</summary>
/// <remarks>Do not change?</remarks>
PaneBorderHalfSize: Integer;
/// <summary>Height of pane</summary>
PaneHeight: Integer;
/// <summary>Pane caption horizontal padding</summary>
PaneCaptionHMargin: Integer;
// ************
// *** Tabs ***
// ************
/// <summary>Tab corner radius</summary>
TabCornerRadius: Integer;
/// <summary>Tab page left margin</summary>
TabPaneLeftPadding: Integer;
/// <summary>Tab page right margin/summary>
TabPaneRightPadding: Integer;
/// <summary>Tab page top margin</summary>
TabPaneTopPadding: Integer;
/// <summary>Tab page bottom margin</summary>
TabPaneBottomPadding: Integer;
/// <summary>Space between panes</summary>
TabPaneHSpacing: Integer;
/// <summary>Tab border size</summary>
TabBorderSize: Integer;
/// <summary>Tab height</summary>
TabHeight: Integer;
// ***************
// *** Toolbar ***
// ***************
/// <summary>Pane padding?</summary>
ToolbarBorderWidth: Integer;
ToolbarCornerRadius: Integer;
/// <summary>Tab caption height</summary>
ToolbarTabCaptionsHeight: Integer;
/// <summary>Tab caption horizontal padding</summary>
ToolbarTabCaptionsTextHPadding: Integer;
ToolbarMinTabCaptionWidth: Integer;
/// <summary>Toolbar total height</summary>
ToolbarHeight: Integer;
const
DPI_AWARE = true;
implementation
uses
Graphics, LCLType;
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
begin
if not(DPI_AWARE) then
ToDPI := FromDPI;
{$IfDef Darwin}
ToDPI := FromDPI; //macOS raster scales by itself
{$EndIf}
LargeButtonDropdownFieldSize := SpkScaleX(LARGEBUTTON_DROPDOWN_FIELD_SIZE, FromDPI, ToDPI);
LargeButtonGlyphMargin := SpkScaleX(LARGEBUTTON_GLYPH_MARGIN, FromDPI, ToDPI);
LargeButtonCaptionHMargin := SpkScaleX(LARGEBUTTON_CAPTION_HMARGIN, FromDPI, ToDPI);
LargeButtonMinWidth := SpkScaleX(LARGEBUTTON_MIN_WIDTH, FromDPI, ToDPI);
LargeButtonRadius := LARGEBUTTON_RADIUS;
LargeButtonBorderSize := SpkScaleX(LARGEBUTTON_BORDER_SIZE, FromDPI, ToDPI);
LargeButtonChevronHMargin := SpkScaleX(LARGEBUTTON_CHEVRON_HMARGIN, FromDPI, ToDPI);
LargeButtonCaptionTopRail := SpkScaleY(LARGEBUTTON_CAPTION_TOP_RAIL, FromDPI, ToDPI);
LargeButtonCaptionButtomRail := SpkScaleY(LARGEBUTTON_CAPTION_BOTTOM_RAIL, FromDPI, ToDPI);
SmallButtonGlyphWidth := SpkScaleX(SMALLBUTTON_GLYPH_WIDTH, FromDPI, ToDPI);
SmallButtonBorderWidth := SpkScaleX(SMALLBUTTON_BORDER_WIDTH, FromDPI, ToDPI);
SmallButtonHalfBorderWidth := SpkScaleX(SMALLBUTTON_HALF_BORDER_WIDTH, FromDPI, ToDPI);
SmallButtonPadding := SpkScaleX(SMALLBUTTON_PADDING, FromDPI, ToDPI);
SmallButtonDropdownWidth := SpkScaleX(SMALLBUTTON_DROPDOWN_WIDTH, FromDPI, ToDPI);
SmallButtonRadius := SMALLBUTTON_RADIUS;
SmallButtonMinWidth := 2 * SmallButtonPadding + SmallButtonGlyphWidth;
MaxElementHeight := SpkScaleY(MAX_ELEMENT_HEIGHT, FromDPI, ToDPI);
PaneRowHeight := SpkScaleY(PANE_ROW_HEIGHT, FromDPI, ToDPI);
PaneFullRowHeight := 3 * PaneRowHeight;
PaneOneRowTopPadding := SpkScaleY(PANE_ONE_ROW_TOPPADDING, FromDPI, ToDPI);
PaneOneRowBottomPadding := SpkScaleY(PANE_ONE_ROW_BOTTOMPADDING, FromDPI, ToDPI);
PaneTwoRowsVSpacer := SpkScaleY(PANE_TWO_ROWS_VSPACER, FromDPI, ToDPI);
PaneTwoRowsTopPadding := SpkScaleY(PANE_TWO_ROWS_TOPPADDING, FromDPI, ToDPI);
PaneTwoRowsBottomPadding := SpkScaleY(PANE_TWO_ROWS_BOTTOMPADDING, FromDPI, ToDPI);
PaneThreeRowsVSpacer := SpkScaleY(PANE_THREE_ROWS_VSPACER, FromDPI, ToDPI);
PaneThreeRowsTopPadding := SpkScaleY(PANE_THREE_ROWS_TOPPADDING, FromDPI, ToDPI);
PaneThreeRowsBottomPadding := SpkScaleY(PANE_THREE_ROWS_BOTTOMPADDING, FromDPI, ToDPI);
PaneFullRowTopPadding := PaneThreeRowsTopPadding;
PaneFullRowBottomPadding := PaneThreeRowsBottomPadding;
PaneLeftPadding := SpkScaleX(PANE_LEFT_PADDING, FromDPI, ToDPI);
PaneRightPadding := SpkScaleX(PANE_RIGHT_PADDING, FromDPI, ToDPI);
PaneColumnSpacer := SpkScaleX(PANE_COLUMN_SPACER, FromDPI, ToDPI);
PaneGroupSpacer := SpkScaleX(PANE_GROUP_SPACER, FromDPI, ToDPI);
PaneCaptionHeight := SpkScaleY(PANE_CAPTION_HEIGHT, FromDPI, ToDPI);
PaneCornerRadius := PANE_CORNER_RADIUS;
PaneBorderSize := SpkScaleX(PANE_BORDER_SIZE, FromDPI, ToDPI);
PaneBorderHalfSize := SpkScaleX(PANE_BORDER_HALF_SIZE, FromDPI, ToDPI);
PaneHeight := MaxElementHeight + PaneCaptionHeight + 2 * PaneBorderSize;
PaneCaptionHMargin := SpkScaleX(PANE_CAPTION_HMARGIN, FromDPI, ToDPI);
TabCornerRadius := TAB_CORNER_RADIUS;
TabPaneLeftPadding := SpkScaleX(TAB_PANE_LEFTPADDING, FromDPI, ToDPI);
TabPaneRightPadding := SpkScaleX(TAB_PANE_RIGHTPADDING, FromDPI, ToDPI);
TabPaneTopPadding := SpkScaleY(TAB_PANE_TOPPADDING, FromDPI, ToDPI);
TabPaneBottomPadding := SpkScaleY(TAB_PANE_BOTTOMPADDING, FromDPI, ToDPI);
TabPaneHSpacing := SpkScaleX(TAB_PANE_HSPACING, FromDPI, ToDPI);
TabBorderSize := SpkScaleX(TAB_BORDER_SIZE, FromDPI, ToDPI);
TabHeight := PaneHeight + TabPaneTopPadding + TabPaneBottomPadding + TabBorderSize;
ToolbarBorderWidth := SpkScaleX(TOOLBAR_BORDER_WIDTH, FromDPI, ToDPI);
ToolbarCornerRadius := TOOLBAR_CORNER_RADIUS;
ToolbarTabCaptionsHeight := SpkScaleY(TOOLBAR_TAB_CAPTIONS_HEIGHT, FromDPI, ToDPI);
ToolbarTabCaptionsTextHPadding := SpkScaleX(TOOLBAR_TAB_CAPTIONS_TEXT_HPADDING, FromDPI, ToDPI);
ToolbarMinTabCaptionWidth := SpkScaleX(TOOLBAR_MIN_TAB_CAPTION_WIDTH, FromDPI, ToDPI);
ToolbarHeight := ToolbarTabCaptionsHeight + TabHeight;
// scaling radius if not square
if LargeButtonRadius > 1 then
LargeButtonRadius := SpkScaleX(LargeButtonRadius, FromDPI, ToDPI);
if SmallButtonRadius > 1 then
SmallButtonRadius := SpkScaleX(SmallButtonRadius, FromDPI, ToDPI);
if PaneCornerRadius > 1 then
PaneCornerRadius := SpkScaleX(PaneCornerRadius, FromDPI, ToDPI);
if TabCornerRadius > 1 then
TabCornerRadius := SpkScaleX(TabCornerRadius, FromDPI, ToDPI);
if ToolbarCornerRadius > 1 then
ToolbarCornerRadius := SpkScaleX(ToolbarCornerRadius, FromDPI, ToDPI);
end;
function SpkScaleX(Size: Integer; FromDPI: Integer; ToDPI: Integer): integer;
begin
if ToDPI = 0 then
ToDPI := ScreenInfo.PixelsPerInchX;
if not(DPI_AWARE) or (ToDPI = FromDPI) then
Result := Size
else
begin
if (ToDPI/FromDPI <= 1.5) and (Size = 1) then
Result := 1 //maintaining 1px on 150% scale for crispness
else
Result := MulDiv(Size, ToDPI, FromDPI);
end;
end;
function SpkScaleY(Size: Integer; FromDPI: Integer; ToDPI: Integer): integer;
begin
if ToDPI = 0 then
ToDPI := ScreenInfo.PixelsPerInchY;
if not(DPI_AWARE) or (ToDPI = FromDPI) then
Result := Size
else
begin
if (ToDPI/FromDPI <= 1.5) and (Size = 1) then
Result := 1 //maintaining 1px on 150% scale for crispness
else
Result := MulDiv(Size, ToDPI, FromDPI);
end;
end;
initialization
{$IFDEF DEBUG}

View File

@ -160,9 +160,9 @@ FRect:=ARect;
Layout:=GenerateLayout;
{$IFDEF EnhancedRecordSupport}
Pt:=T2DIntPoint.create(ARect.left + PANE_BORDER_SIZE + PANE_LEFT_PADDING, ARect.top + PANE_BORDER_SIZE);
Pt:=T2DIntPoint.create(ARect.left + SpkLayoutSizes.PANE_BORDER_SIZE + SpkLayoutSizes.PANE_LEFT_PADDING, ARect.top + SpkLayoutSizes.PANE_BORDER_SIZE);
{$ELSE}
Pt.create(ARect.left + PANE_BORDER_SIZE + PANE_LEFT_PADDING, ARect.top + PANE_BORDER_SIZE);
Pt.create(ARect.left + PaneBorderSize + PaneLeftPadding, ARect.top + PaneBorderSize);
{$ENDIF}
if length(Layout.Rects)>0 then
@ -265,15 +265,15 @@ TGuiTools.DrawRoundRect(ABuffer.Canvas,
{$IFDEF EnhancedRecordSupport}
T2DIntRect.Create(FRect.left,
FRect.top,
FRect.right - PANE_BORDER_HALF_SIZE,
FRect.Bottom - PANE_BORDER_HALF_SIZE),
FRect.right - PaneBorderHalfSize,
FRect.Bottom - PaneBorderHalfSize),
{$ELSE}
Create2DIntRect(FRect.left,
FRect.top,
FRect.right - PANE_BORDER_HALF_SIZE,
FRect.Bottom - PANE_BORDER_HALF_SIZE),
FRect.right - PaneBorderHalfSize,
FRect.Bottom - PaneBorderHalfSize),
{$ENDIF}
PANE_CORNER_RADIUS,
PaneCornerRadius,
BgFromColor,
BgToColor,
FAppearance.Pane.GradientType,
@ -283,16 +283,16 @@ TGuiTools.DrawRoundRect(ABuffer.Canvas,
TGuiTools.DrawRoundRect(ABuffer.Canvas,
{$IFDEF EnhancedRecordSupport}
T2DIntRect.Create(FRect.Left,
FRect.Bottom - PANE_CAPTION_HEIGHT - PANE_BORDER_HALF_SIZE,
FRect.right - PANE_BORDER_HALF_SIZE,
FRect.bottom - PANE_BORDER_HALF_SIZE),
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
FRect.right - PaneBorderHalfSize,
FRect.bottom - PaneBorderHalfSize),
{$ELSE}
Create2DIntRect(FRect.Left,
FRect.Bottom - PANE_CAPTION_HEIGHT - PANE_BORDER_HALF_SIZE,
FRect.right - PANE_BORDER_HALF_SIZE,
FRect.bottom - PANE_BORDER_HALF_SIZE),
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
FRect.Right - PaneBorderHalfSize,
FRect.Bottom - PaneBorderHalfSize),
{$ENDIF}
PANE_CORNER_RADIUS,
PaneCornerRadius,
CaptionColor,
clNone,
bkSolid,
@ -305,8 +305,8 @@ TGuiTools.DrawRoundRect(ABuffer.Canvas,
// Etykieta tafli
ABuffer.Canvas.Font.assign(FAppearance.Pane.CaptionFont);
x:=FRect.left + (FRect.width - ABuffer.Canvas.TextWidth(FCaption)) div 2;
y:=FRect.Bottom - PANE_BORDER_SIZE - PANE_CAPTION_HEIGHT + 1 +
(PANE_CAPTION_HEIGHT - ABuffer.Canvas.TextHeight('Wy')) div 2;
y:=FRect.Bottom - PaneBorderSize - PaneCaptionHeight + 1 +
(PaneCaptionHeight - ABuffer.Canvas.TextHeight('Wy')) div 2;
TGUITools.DrawText(ABuffer.Canvas,
x,
@ -328,7 +328,7 @@ TGUITools.DrawAARoundFrame(ABuffer,
FRect.Right,
FRect.bottom),
{$ENDIF}
PANE_CORNER_RADIUS,
PaneCornerRadius,
BorderLightColor,
ClipRect);
TGUITools.DrawAARoundFrame(ABuffer,
@ -343,7 +343,7 @@ TGUITools.DrawAARoundFrame(ABuffer,
FRect.Right-1,
FRect.bottom-1),
{$ENDIF}
PANE_CORNER_RADIUS,
PaneCornerRadius,
BorderDarkColor,
ClipRect);
@ -498,7 +498,7 @@ if length(Layout)>0 then
begin
if c>0 then
begin
LastX:=MaxRowX + PANE_COLUMN_SPACER;
LastX:=MaxRowX + PaneColumnSpacer;
MaxRowX:=LastX;
end
else
@ -523,8 +523,8 @@ if length(Layout)>0 then
if ItemSize = isLarge then
begin
tmpRect.top:=PANE_FULL_ROW_TOPPADDING;
tmpRect.bottom:=tmpRect.top + PANE_FULL_ROW_HEIGHT - 1;
tmpRect.top:=PaneFullRowTopPadding;
tmpRect.bottom:=tmpRect.top + PaneFullRowHeight - 1;
tmpRect.left:=LastX;
tmpRect.right:=LastX + ItemWidth - 1;
@ -544,7 +544,7 @@ if length(Layout)>0 then
// Jeœli element nie jest pierwszy, musi zostaæ
// odsuniêty marginesem od poprzedniego
if i>0 then
tmpRect.Left:=LastX + PANE_GROUP_SPACER else
tmpRect.Left:=LastX + PaneGroupSpacer else
tmpRect.Left:=LastX;
tmpRect.right:=tmpRect.Left + ItemWidth - 1;
end;
@ -552,34 +552,34 @@ if length(Layout)>0 then
{$REGION 'Obliczanie tmpRect.top i bottom'}
case rows of
1 : begin
tmpRect.top:=PANE_ONE_ROW_TOPPADDING;
tmpRect.bottom:=tmpRect.top + PANE_ROW_HEIGHT - 1;
tmpRect.top:=PaneOneRowTopPadding;
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
end;
2 : begin
case r of
0 : begin
tmpRect.top:=PANE_TWO_ROWS_TOPPADDING;
tmpRect.bottom:=tmpRect.top + PANE_ROW_HEIGHT - 1;
tmpRect.top:=PaneTwoRowsTopPadding;
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
end;
1 : begin
tmpRect.top:=PANE_TWO_ROWS_TOPPADDING + PANE_ROW_HEIGHT + PANE_TWO_ROWS_VSPACER;
tmpRect.bottom:=tmpRect.top + PANE_ROW_HEIGHT - 1;
tmpRect.top:=PaneTwoRowsTopPadding + PaneRowHeight + PaneTwoRowsVSpacer;
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
end;
end;
end;
3 : begin
case r of
0 : begin
tmpRect.top:=PANE_THREE_ROWS_TOPPADDING;
tmpRect.bottom:=tmpRect.top + PANE_ROW_HEIGHT - 1;
tmpRect.top:=PaneThreeRowsTopPadding;
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
end;
1 : begin
tmpRect.top:=PANE_THREE_ROWS_TOPPADDING + PANE_ROW_HEIGHT + PANE_THREE_ROWS_VSPACER;
tmpRect.bottom:=tmpRect.top + PANE_ROW_HEIGHT - 1;
tmpRect.top:=PaneThreeRowsTopPadding + PaneRowHeight + PaneThreeRowsVSpacer;
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
end;
2 : begin
tmpRect.top:=PANE_THREE_ROWS_TOPPADDING + 2 * PANE_ROW_HEIGHT + 2 * PANE_THREE_ROWS_VSPACER;
tmpRect.bottom:=tmpRect.top + PANE_ROW_HEIGHT - 1;
tmpRect.top:=PaneThreeRowsTopPadding + 2 * PaneRowHeight + 2 * PaneThreeRowsVSpacer;
tmpRect.bottom:=tmpRect.top + PaneRowHeight - 1;
end;
end;
end;
@ -634,14 +634,12 @@ tmpBitmap.Canvas.font.assign(FAppearance.Pane.CaptionFont);
// *** Minimalna szerokoϾ tafli (tekstu) ***
TextW:=tmpBitmap.Canvas.TextWidth(FCaption);
PaneCaptionWidth:=2*PANE_BORDER_SIZE +
2*PANE_CAPTION_HMARGIN +
TextW;
PaneCaptionWidth := 2*PaneBorderSize + 2*PaneCaptionHMargin + TextW;
// *** Szerokoœæ elementów tafli ***
Layout:=GenerateLayout;
ElementsW:=Layout.Width;
PaneElementsWidth:=PANE_BORDER_SIZE + PANE_LEFT_PADDING + ElementsW + PANE_RIGHT_PADDING + PANE_BORDER_SIZE;
PaneElementsWidth:=PaneBorderSize + PaneLeftPadding + ElementsW + PaneRightPadding + PaneBorderSize;
// *** Ustawianie szerokoœci tafli ***
result:=max(PaneCaptionWidth, PaneElementsWidth);

View File

@ -226,7 +226,7 @@ if AtLeastOnePaneVisible then
FPanes[i].Rect:=tmpRect;
x:=x + tw + TAB_PANE_HSPACING;
x:=x + tw + TabPaneHSpacing;
end
else
begin