summaryrefslogtreecommitdiff
path: root/src/gui/fpg_tab.pas
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/fpg_tab.pas')
-rw-r--r--src/gui/fpg_tab.pas25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas
index be5dea76..414c89a2 100644
--- a/src/gui/fpg_tab.pas
+++ b/src/gui/fpg_tab.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -86,7 +86,6 @@ type
TfpgPageControl = class(TfpgWidget)
private
- FFont: TfpgFont;
FActivePage: TfpgTabSheet;
FMargin: integer;
FFixedTabWidth: integer;
@@ -515,7 +514,7 @@ begin
if FFixedTabHeight > 0 then
result := FFixedTabHeight
else
- result := FFont.Height + 10; { TODO: correct this }
+ result := fpgStyle.DefaultFont.Height + 10; { TODO: correct this }
end;
function TfpgPageControl.ButtonWidth(AText: string): integer;
@@ -523,7 +522,7 @@ begin
if FFixedTabWidth > 0 then
result := FFixedTabWidth
else
- result := FFont.TextWidth(AText) + 10;
+ result := fpgStyle.DefaultFont.TextWidth(AText) + 10;
end;
procedure TfpgPageControl.SetFixedTabWidth(const AValue: integer);
@@ -560,14 +559,14 @@ begin
i := 1;
if FFixedTabWidth > 0 then
begin
- while FFont.TextWidth(s1) < (FFixedTabWidth-10) do
+ while fpgStyle.DefaultFont.TextWidth(s1) < (FFixedTabWidth-10) do
begin
if Length(s1) = Length(s) then
Break;
s1 := UTF8Copy(s, 1, i);
inc(i);
end;
- if FFont.TextWidth(s1) > (FFixedTabWidth-10) then
+ if fpgStyle.DefaultFont.TextWidth(s1) > (FFixedTabWidth-10) then
UTF8Delete(s1, UTF8Length(s1), 1);
if Length(s1) > 0 then
s1 := Trim(s1);
@@ -940,7 +939,7 @@ begin
r3 := DrawTab(r2, h = ActivePage);
// paint text on non-active tabs
if h <> ActivePage then
- Canvas.DrawText(lp + (ButtonWidth(h.Text) div 2) - FFont.TextWidth(GetTabText(h.Text)) div 2,
+ Canvas.DrawText(lp + (ButtonWidth(h.Text) div 2) - fpgStyle.DefaultFont.TextWidth(GetTabText(h.Text)) div 2,
Height-TabH+toffset, GetTabText(h.Text), lTxtFlags);
r2.Left := r2.Left + r2.Width;
@@ -984,7 +983,7 @@ begin
r3 := DrawTab(r2, h = ActivePage);
// paint text on non-active tabs
if h <> ActivePage then
- Canvas.DrawText(lp + (ButtonWidth(h.Text) div 2) - FFont.TextWidth(GetTabText(h.Text)) div 2,
+ Canvas.DrawText(lp + (ButtonWidth(h.Text) div 2) - fpgStyle.DefaultFont.TextWidth(GetTabText(h.Text)) div 2,
FMargin+toffset, GetTabText(h.Text), lTxtFlags);
r2.Left := r2.Left + r2.Width;
lp := lp + ButtonWidth(h.Text);
@@ -1215,7 +1214,6 @@ end;
constructor TfpgPageControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
- FFont := fpgStyle.DefaultFont;
FPages := TList.Create;
Width := 150;
Height := 100;
@@ -1283,10 +1281,7 @@ var
begin
Result := nil;
h := TfpgTabSheet(FPages.First);
-
lp := FMargin;
- if MaxButtonWidthSum > (Width-(FMargin*2)) then
- h := FFirstTabButton;
case TabPosition of
tpTop:
@@ -1316,6 +1311,8 @@ begin
if TabPosition in [tpTop, tpBottom] then
begin
+ if MaxButtonWidthSum > (Width-(FMargin*2)) then
+ h := FFirstTabButton;
if (y > p1) and (y < p2) then
begin
while h <> nil do
@@ -1338,11 +1335,13 @@ begin
if TabPosition in [tpLeft, tpRight] then
begin
+ bh := ButtonHeight; // initialize button height
+ if MaxButtonHeightSum > (Height-(FMargin*2)) then
+ h := FFirstTabButton;
if (x > p1) and (x < p2) then
begin
while h <> nil do
begin
- bh := ButtonHeight; // initialize button height
if (y > lp) and (y < lp + bh) then
begin
if h <> ActivePage then