summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2014-03-29 16:45:58 +0000
committerGraeme Geldenhuys <graemeg@gmail.com>2014-03-29 16:45:58 +0000
commit2d7d4565f4595e04e378709c15e897e3c1689301 (patch)
treeebeb4098ecaf94385b3a5806f7f07c6693a2547d /src
parent50a11724a9d524743ca30c7fe01950e662650da6 (diff)
downloadfpGUI-2d7d4565f4595e04e378709c15e897e3c1689301.tar.xz
ComboBox/EditCombo now uses the new fpgStyles API.
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_combobox.pas65
-rw-r--r--src/gui/fpg_editcombo.pas2
2 files changed, 5 insertions, 62 deletions
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);