summaryrefslogtreecommitdiff
path: root/src/gui/gui_radiobutton.pas
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-01-26 15:16:16 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-01-26 15:16:16 +0000
commitfa5ed724d54919d67fd30c724bf76bf95a10e8df (patch)
treefb07268e28009f0040f92af7876dd43e72512a07 /src/gui/gui_radiobutton.pas
parente65d5eb90ec9676aef1c9c0c07105dc0bf92c5ae (diff)
downloadfpGUI-fa5ed724d54919d67fd30c724bf76bf95a10e8df.tar.xz
* Added a new Color property to RadioButton, Button and CheckBox.
The text color can now be changed per component. * Fixed up the default values for Color and BackgroundColor for a few components. * Extended the EditTest project to show the Color property in action.
Diffstat (limited to 'src/gui/gui_radiobutton.pas')
-rw-r--r--src/gui/gui_radiobutton.pas23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/gui/gui_radiobutton.pas b/src/gui/gui_radiobutton.pas
index 443cde59..e091167a 100644
--- a/src/gui/gui_radiobutton.pas
+++ b/src/gui/gui_radiobutton.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -30,10 +30,13 @@ uses
type
+ { TfpgRadioButton }
+
TfpgRadioButton = class(TfpgWidget)
private
FBackgroundColor: TfpgColor;
FChecked: boolean;
+ FColor: TfpgColor;
FFont: TfpgFont;
FGroupIndex: integer;
FOnChange: TNotifyEvent;
@@ -43,6 +46,7 @@ type
function GetFontDesc: string;
procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetChecked(const AValue: boolean);
+ procedure SetColor(const AValue: TfpgColor);
procedure SetFontDesc(const AValue: string);
procedure SetText(const AValue: string);
protected
@@ -55,11 +59,12 @@ type
destructor Destroy; override;
property Font: TfpgFont read FFont;
published
- property Checked: boolean read FChecked write SetChecked;
- property Text: string read FText write SetText;
+ property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property Checked: boolean read FChecked write SetChecked default False;
+ property Color: TfpgColor read FColor write SetColor default clText1;
property FontDesc: string read GetFontDesc write SetFontDesc;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
property GroupIndex: integer read FGroupIndex write FGroupIndex;
+ property Text: string read FText write SetText;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
@@ -118,6 +123,14 @@ begin
RePaint;
end;
+procedure TfpgRadioButton.SetColor(const AValue: TfpgColor);
+begin
+ if FColor = AValue then
+ Exit;
+ FColor := AValue;
+ Repaint;
+end;
+
procedure TfpgRadioButton.SetFontDesc(const AValue: string);
begin
FFont.Free;
@@ -180,7 +193,7 @@ begin
ty := (Height div 2) - (Font.Height div 2);
if ty < 0 then
ty := 0;
- Canvas.SetTextColor(clText1);
+ Canvas.SetTextColor(FColor);
fpgStyle.DrawString(Canvas, tx, ty, FText, Enabled);
Canvas.EndDraw;