diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-07-25 12:16:50 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-07-25 12:16:50 +0100 |
commit | b8851dc72a8d82e7b798fbbc9660cc5f9e8479ae (patch) | |
tree | 676639610c8a91a2769589352d93584215079b95 /src | |
parent | 34b3f0108f8aa053c1d011f8cbd56d19c86ea70d (diff) | |
download | fpGUI-b8851dc72a8d82e7b798fbbc9660cc5f9e8479ae.tar.xz |
tabs: Fixed the painting of tabs when positioned at tpBottom.
* The text was not at the correct position (to high)
* The tab height was not the same as when tpTop is used
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_tab.pas | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas index 3cd5d6bf..29addb12 100644 --- a/src/gui/fpg_tab.pas +++ b/src/gui/fpg_tab.pas @@ -183,6 +183,10 @@ implementation uses fpg_stringutils; + +const + DFL_TAB_HEIGHT = 21; + DFL_TAB_WIDTH = 0; // compare function used by FPages.Sort @@ -532,7 +536,7 @@ procedure TfpgPageControl.SetFixedTabWidth(const AValue: integer); begin if FFixedTabWidth = AValue then Exit; //==> - if AValue > 5 then + if AValue >= 5 then begin FFixedTabWidth := AValue; RePaint; @@ -543,7 +547,7 @@ procedure TfpgPageControl.SetFixedTabHeight(const AValue: integer); begin if FFixedTabHeight = AValue then Exit; //==> - if AValue > 5 then + if AValue >= 5 then begin FFixedTabHeight := AValue; RePaint; @@ -674,6 +678,8 @@ begin if Mode = 2 then begin r.Height -= 1; + if TabPosition = tpBottom then + r.Top += 1; Canvas.SetColor(ActiveTabColor); end else @@ -696,22 +702,27 @@ begin tpBottom: begin - Canvas.FillRectangle(r.Left, r.Top+1, r.Width-2, r.Height-3); // fill tab background + Canvas.FillRectangle(r.Left, r.Top, r.Width-1, r.Height-2); // fill tab background Canvas.SetColor(clHilite2); Canvas.DrawLine(r.Left, r.Top, r.Left, r.Bottom-1); // left edge Canvas.SetColor(clShadow2); Canvas.DrawLine(r.Left+2, r.Bottom, r.Right-1, r.Bottom); // bottom outer edge Canvas.SetColor(clShadow1); - Canvas.DrawLine(r.Right-1, r.Bottom-1, r.Right-1, r.Top+1); // right inner edge + Canvas.DrawLine(r.Right-1, r.Bottom-1, r.Right-1, r.Top-1); // right inner edge Canvas.DrawLine(r.Left+1, r.Bottom-1, r.Right-1, r.Bottom-1);// bottom inner edge Canvas.SetColor(clShadow2); Canvas.DrawLine(r.Right-1, r.Bottom-1, r.Right, r.Bottom-2); // right rounded edge (1px) - Canvas.DrawLine(r.Right, r.Bottom-2, r.Right, r.Top+1); // right outer edge + Canvas.DrawLine(r.Right, r.Bottom-2, r.Right, r.Top-1); // right outer edge + if Mode = 2 then { selected tab } + begin + Canvas.SetColor(ActiveTabColor); + Canvas.DrawLine(r.Left+1, r.Top-1, r.Right-1, r.Top-1); + end; end; tpLeft: begin - if Mode = 2 then + if Mode = 2 then { selected tab } begin r.Width := r.Width - 1; r.Height := r.Height + 2; @@ -918,17 +929,17 @@ begin begin lTxtFlags += TextFlagsDflt; lp := 0; - r2.SetRect(2, Height - ButtonHeight-3, 50, TabH); + r2.SetRect(2, Height - ButtonHeight, 50, TabH-2); while h <> nil do begin if h <> ActivePage then begin - toffset := 2; + toffset := 1; h.Visible := False; end else begin - toffset := 4; + toffset := 2; h.Visible := True; h.SetPosition(FMargin+2, FMargin+2 , Width - (FMargin*2) - 4, Height - TabH - (FMargin+2)*2); end; @@ -979,7 +990,6 @@ begin // paint tab button r2.Width := ButtonWidth(h.Text); 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, |