From 2d7d4565f4595e04e378709c15e897e3c1689301 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 29 Mar 2014 16:45:58 +0000 Subject: ComboBox/EditCombo now uses the new fpgStyles API. --- src/gui/fpg_combobox.pas | 65 +++-------------------------------------------- src/gui/fpg_editcombo.pas | 2 +- 2 files changed, 5 insertions(+), 62 deletions(-) (limited to 'src/gui') diff --git a/src/gui/fpg_combobox.pas b/src/gui/fpg_combobox.pas index fcd1dbe0..bb26ada6 100644 --- a/src/gui/fpg_combobox.pas +++ b/src/gui/fpg_combobox.pas @@ -100,7 +100,6 @@ type procedure DoOnDropDown; virtual; procedure DoDropDown; virtual; abstract; procedure DoOnCloseUp; virtual; - procedure PaintInternalButton; virtual; function GetDropDownPos(AParent, AComboBox, ADropDown: TfpgWidget): TfpgRect; virtual; property AutoSize: Boolean read FAutoSize write SetAutoSize default False; property DropDownCount: integer read FDropDownCount write SetDropDownCount default 8; @@ -387,40 +386,6 @@ begin OnCloseUp(self); end; -procedure TfpgBaseComboBox.PaintInternalButton; -var - ar: TfpgRect; - btnflags: TfpgButtonFlags; -begin - btnflags := []; - ar := FInternalBtnRect; - - { The bounding rectangle for the arrow } - ar.Width := 8; - ar.Height := 6; - ar.Left := FInternalBtnRect.Left + ((FInternalBtnRect.Width-ar.Width) div 2); - ar.Top := FInternalBtnRect.Top + ((FInternalBtnRect.Height-ar.Height) div 2); - - if FBtnPressed then - begin - Include(btnflags, btfIsPressed); - OffsetRect(ar, 1, 1); - end; - // paint button face - fpgStyle.DrawButtonFace(Canvas, - FInternalBtnRect.Left, - FInternalBtnRect.Top, - FInternalBtnRect.Width, - FInternalBtnRect.Height, btnflags); - if Enabled then - Canvas.SetColor(clText1) - else - Canvas.SetColor(clShadow1); - - // paint arrow - fpgStyle.DrawDirectionArrow(Canvas, ar.Left, ar.Top, ar.Width, ar.Height, adDown); -end; - function TfpgBaseComboBox.GetDropDownPos(AParent, AComboBox, ADropDown: TfpgWidget): TfpgRect; var pt: TPoint; @@ -735,37 +700,15 @@ begin InflateRect(r, -rect.Left, -rect.Top); { assuming borders are even on opposite sides } Canvas.SetClipRect(r); - if Enabled then - begin - if ReadOnly then - Canvas.SetColor(clWindowBackground) - else - Canvas.SetColor(FBackgroundColor); - end - else - Canvas.SetColor(clWindowBackground); - - Canvas.FillRectangle(r); + fpgStyle.DrawStaticComboBox(Canvas, r, Enabled, Focused, ReadOnly, FBackgroundColor, FInternalBtnRect, FBtnPressed); - // paint the fake dropdown button - PaintInternalButton; - - Dec(r.Width, FInternalBtnRect.Width); - Canvas.SetClipRect(r); +// Dec(r.Width, FInternalBtnRect.Width); +// Canvas.SetClipRect(r); Canvas.SetFont(Font); - if Focused then - begin - Canvas.SetColor(clSelection); - Canvas.SetTextColor(clSelectionText); - InflateRect(r, -1, -1); - Canvas.FillRectangle(r); - end + Canvas.SetTextColor(clSelectionText) else - begin Canvas.SetTextColor(FTextColor); - end; - { adjust rectangle size smaller for text } r.Left := r.Left + Margin; r.Width := r.Width - (Margin*2); diff --git a/src/gui/fpg_editcombo.pas b/src/gui/fpg_editcombo.pas index 4ebe9a67..5b011b4d 100644 --- a/src/gui/fpg_editcombo.pas +++ b/src/gui/fpg_editcombo.pas @@ -793,7 +793,7 @@ begin Canvas.FillRectangle(r); // paint the fake dropdown button - PaintInternalButton; + fpgStyle.DrawInternalComboBoxButton(Canvas, FInternalBtnRect, Enabled, FBtnPressed); Dec(r.Width, FInternalBtnRect.Width); Canvas.SetClipRect(r); -- cgit v1.2.3-70-g09d2