summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-02-15 13:58:18 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-02-15 13:58:18 +0000
commit831cb67e19cfe06c390cc632d1d6e8446acfa57c (patch)
tree6aca91bff4114393585fac87911e08866d6a1abc
parent0bfd76ac0c585efcdbf4ee8574c8c844e7142108 (diff)
downloadfpGUI-831cb67e19cfe06c390cc632d1d6e8446acfa57c.tar.xz
* Applied Jean-Marc's TextColor and BackgroundColor patch.
* Made many more modifications based on Jean-Marc's patch and fixed a few things missed.
-rw-r--r--examples/apps/uidesigner/vfddesigner.pas1
-rw-r--r--examples/apps/uidesigner/vfdresizer.pas1
-rw-r--r--prototypes/fpgui2/tests/edittest.lpi9
-rw-r--r--prototypes/fpgui2/tests/edittest.lpr10
-rw-r--r--src/corelib/gfx_popupwindow.pas13
-rw-r--r--src/corelib/gfx_widget.pas26
-rw-r--r--src/gui/gui_basegrid.pas10
-rw-r--r--src/gui/gui_bevel.pas17
-rw-r--r--src/gui/gui_button.pas28
-rw-r--r--src/gui/gui_checkbox.pas29
-rw-r--r--src/gui/gui_combobox.pas28
-rw-r--r--src/gui/gui_edit.pas28
-rw-r--r--src/gui/gui_editcombo.pas24
-rw-r--r--src/gui/gui_form.pas14
-rw-r--r--src/gui/gui_label.pas39
-rw-r--r--src/gui/gui_listbox.pas28
-rw-r--r--src/gui/gui_listview.pas6
-rw-r--r--src/gui/gui_memo.pas38
-rw-r--r--src/gui/gui_menu.pas25
-rw-r--r--src/gui/gui_progressbar.pas19
-rw-r--r--src/gui/gui_radiobutton.pas29
-rw-r--r--src/gui/gui_scrollbar.pas2
-rw-r--r--src/gui/gui_tab.pas36
-rw-r--r--src/gui/gui_trackbar.pas32
-rw-r--r--src/gui/gui_tree.pas2
25 files changed, 117 insertions, 377 deletions
diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas
index e070e0a5..c310439a 100644
--- a/examples/apps/uidesigner/vfddesigner.pas
+++ b/examples/apps/uidesigner/vfddesigner.pas
@@ -49,7 +49,6 @@ type
TOtherWidget = class(TfpgWidget)
protected
FFont: TfpgFont;
- FBackgroundColor: TfpgColor;
procedure HandlePaint; override;
public
wgClassName: string;
diff --git a/examples/apps/uidesigner/vfdresizer.pas b/examples/apps/uidesigner/vfdresizer.pas
index 6ca06683..882f43ab 100644
--- a/examples/apps/uidesigner/vfdresizer.pas
+++ b/examples/apps/uidesigner/vfdresizer.pas
@@ -31,7 +31,6 @@ type
TwgResizer = class(TfpgWidget)
protected
wgdesigner: TObject;
- FBackgroundColor: TfpgColor;
procedure HandlePaint; override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi
index 8b8c2d24..2879bbde 100644
--- a/prototypes/fpgui2/tests/edittest.lpi
+++ b/prototypes/fpgui2/tests/edittest.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
@@ -23,7 +23,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -47,7 +47,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/prototypes/fpgui2/tests/edittest.lpr b/prototypes/fpgui2/tests/edittest.lpr
index d9f860bd..aa0dddbf 100644
--- a/prototypes/fpgui2/tests/edittest.lpr
+++ b/prototypes/fpgui2/tests/edittest.lpr
@@ -67,6 +67,7 @@ type
procedure btn3Click(Sender: TObject);
procedure checkbox1Changed(Sender: TObject);
procedure TrackBarChanged(Sender: TObject; APosition: integer);
+ procedure xpsilverClick(Sender: TObject);
public
label1: TfpgLabel;
label2: TfpgLabel;
@@ -302,6 +303,14 @@ end;
{ TMainForm }
+procedure TMainForm.xpsilverClick(Sender: TObject);
+begin
+ if BackgroundColor = clWindowBackground then
+ BackgroundColor := clGreen
+ else
+ BackgroundColor := clWindowBackground;
+end;
+
procedure TMainForm.Trackbar1Changed(Sender: TObject; APosition: integer);
begin
progress.Position := APosition;
@@ -469,6 +478,7 @@ begin
bmp.CreateMaskFromSample(0, 0);
bmp.UpdateImage;
xpsilver.ThemeImage := bmp;
+ xpsilver.OnClick := @xpsilverClick;
checkbox1 := CreateCheckBox(self, 10, 265, 'Disable components');
checkbox1.OnChange := @checkbox1Changed;
diff --git a/src/corelib/gfx_popupwindow.pas b/src/corelib/gfx_popupwindow.pas
index 6c42d171..27a144be 100644
--- a/src/corelib/gfx_popupwindow.pas
+++ b/src/corelib/gfx_popupwindow.pas
@@ -198,10 +198,11 @@ end;
procedure TfpgPopupWindow.SetPopupFrame(const AValue: boolean);
begin
- if FPopupFrame = AValue then
- Exit; //==>
- FPopupFrame := AValue;
- ProcessPopupFrame;
+ if FPopupFrame <> AValue then
+ begin
+ FPopupFrame := AValue;
+ ProcessPopupFrame;
+ end;
end;
procedure TfpgPopupWindow.MsgClose(var msg: TfpgMessageRec);
@@ -266,10 +267,14 @@ begin
end;
procedure TfpgPopupWindow.DoPaintPopupFrame;
+var
+ lColor: TfpgColor;
begin
+ lColor := fpgColorToRGB(BackgroundColor);
Canvas.SetLineStyle(1, lsSolid);
Canvas.SetColor(clWidgetFrame);
Canvas.DrawRectangle(0, 0, Width, Height);
+ Canvas.SetColor(lColor);
end;
constructor TfpgPopupWindow.Create(AOwner: TComponent);
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index a4776467..61a4db8d 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -54,6 +54,10 @@ type
FActiveWidget: TfpgWidget;
FAlign: TAlign;
FHint: string;
+ FBackgroundColor: TfpgColor;
+ FTextColor: TfpgColor;
+ procedure SetBackgroundColor(const AValue: TfpgColor); virtual;
+ procedure SetTextColor(const AValue: TfpgColor); virtual;
function GetParent: TfpgWidget; reintroduce;
procedure SetParent(const AValue: TfpgWidget); reintroduce;
procedure SetEnabled(const AValue: boolean); virtual;
@@ -114,6 +118,8 @@ type
property Anchors: TAnchors read FAnchors write FAnchors;
property Align: TAlign read FAlign write FAlign;
property Hint: string read FHint write FHint;
+ property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
end;
@@ -190,6 +196,24 @@ begin
end;
end;
+procedure TfpgWidget.SetBackgroundColor(const AValue: TfpgColor);
+begin
+ if FBackgroundColor <> AValue then
+ begin
+ FBackgroundColor := AValue;
+ RePaint;
+ end;
+end;
+
+procedure TfpgWidget.SetTextColor(const AValue: TfpgColor);
+begin
+ if FBackgroundColor <> AValue then
+ begin
+ FTextColor := AValue;
+ Repaint;
+ end;
+end;
+
function TfpgWidget.GetParent: TfpgWidget;
begin
Result := TfpgWidget(inherited GetParent);
@@ -215,6 +239,8 @@ begin
FAnchors := [anLeft, anTop];
FAlign := alNone;
FHint := '';
+ FBackgroundColor := clWindowBackground;
+ FTextColor := clText1;
if (AOwner <> nil) and (AOwner is TfpgWidget) then
Parent := TfpgWidget(AOwner)
diff --git a/src/gui/gui_basegrid.pas b/src/gui/gui_basegrid.pas
index 19d0a032..3b00ce7c 100644
--- a/src/gui/gui_basegrid.pas
+++ b/src/gui/gui_basegrid.pas
@@ -47,7 +47,6 @@ type
// override that special behavior anyway.
TfpgBaseGrid = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FColResizing: boolean;
FDragPos: integer; // used for column resizing
FResizedCol: integer; // used for column resizing
@@ -81,7 +80,6 @@ type
procedure SetRowSelect(const AValue: boolean);
procedure SetScrollBarStyle(const AValue: TfpgScrollStyle);
procedure VScrollBarMove(Sender: TObject; position: integer);
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetDefaultColWidth(const AValue: integer);
procedure SetDefaultRowHeight(const AValue: integer);
procedure SetFocusCol(const AValue: integer);
@@ -201,14 +199,6 @@ begin
end;
end;
-procedure TfpgBaseGrid.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgBaseGrid.SetDefaultColWidth(const AValue: integer);
begin
if FDefaultColWidth = AValue then
diff --git a/src/gui/gui_bevel.pas b/src/gui/gui_bevel.pas
index ee773819..68aa05f2 100644
--- a/src/gui/gui_bevel.pas
+++ b/src/gui/gui_bevel.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,7 +30,8 @@ uses
type
- TBevelShape = (bsBox, bsFrame, bsTopLine, bsBottomLine, bsLeftLine, bsRightLine, bsSpacer);
+ TBevelShape = (bsBox, bsFrame, bsTopLine, bsBottomLine, bsLeftLine,
+ bsRightLine, bsSpacer);
TBevelStyle = (bsLowered, bsRaised);
@@ -39,8 +40,6 @@ type
private
FBevelShape: TBevelShape;
FBevelStyle: TBevelStyle;
- FBackgroundColor: TfpgColor;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetBevelShape(const AValue: TBevelShape);
procedure SetBevelStyle(const AValue: TBevelStyle);
protected
@@ -48,9 +47,9 @@ type
public
constructor Create(AOwner: TComponent); override;
published
+ property BackgroundColor;
property Shape: TBevelShape read FBevelShape write SetBevelShape default bsBox;
property Style: TBevelStyle read FBevelStyle write SetBevelStyle default bsRaised;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
property OnClick;
property OnDoubleClick;
end;
@@ -85,12 +84,6 @@ begin
Repaint;
end;
-procedure TfpgBevel.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor=AValue then exit;
- FBackgroundColor:=AValue;
-end;
-
procedure TfpgBevel.SetBevelStyle(const AValue: TBevelStyle);
begin
if FBevelStyle = AValue then
@@ -149,7 +142,7 @@ begin
FWidth := 80;
FHeight := 80;
FFocusable := True; // otherwise children can't get focus
- FBackgroundColor := clWindowBackground;
+ FBackgroundColor := Parent.BackgroundColor;
end;
end.
diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas
index 85de9f8e..21bc8b73 100644
--- a/src/gui/gui_button.pas
+++ b/src/gui/gui_button.pas
@@ -35,8 +35,6 @@ type
TfpgButton = class(TfpgWidget, ICommandHolder)
private
- FTextColor: TfpgColor;
- FBackgroundColor: TfpgColor;
FCommand: ICommand;
FImageName: string;
FClicked: Boolean;
@@ -46,8 +44,6 @@ type
FAllowAllUp: boolean;
FModalResult: integer;
function GetFontDesc: string;
- procedure SetTextColor(const AValue: TfpgColor);
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetDefault(const AValue: boolean);
procedure SetEmbedded(const AValue: Boolean);
procedure SetFontDesc(const AValue: string);
@@ -89,7 +85,7 @@ type
property AllowDown: Boolean read GetAllowDown write SetAllowDown;
published
property AllowAllUp: boolean read FAllowAllUp write SetAllowAllUp default False;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clButtonFace;
+ property BackgroundColor default clButtonFace;
property Default: boolean read FDefault write SetDefault default False;
property Embedded: Boolean read FEmbedded write SetEmbedded default False;
property FontDesc: string read GetFontDesc write SetFontDesc;
@@ -100,7 +96,7 @@ type
property ModalResult: integer read FModalResult write FModalResult default 0;
property ShowImage: Boolean read FShowImage write SetShowImage default True;
property Text: string read FText write SetText;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
+ property TextColor;
property OnMouseExit;
property OnMouseEnter;
property OnClick;
@@ -167,24 +163,6 @@ begin
Result := FFont.FontDesc;
end;
-procedure TfpgButton.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- Repaint;
- end;
-end;
-
-procedure TfpgButton.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor <> AValue then
- begin
- FBackgroundColor := AValue;
- Repaint;
- end;
-end;
-
procedure TfpgButton.SetDefault(const AValue: boolean);
var
i: integer;
@@ -232,7 +210,7 @@ begin
FHeight := FFont.Height + 8;
FWidth := 75;
FFocusable := True;
- FTextColor := clText1;
+ FTextColor := Parent.TextColor;
FBackgroundColor := clButtonFace;
OnClick := nil;
FDown := False;
diff --git a/src/gui/gui_checkbox.pas b/src/gui/gui_checkbox.pas
index fa4fd853..33a14fa0 100644
--- a/src/gui/gui_checkbox.pas
+++ b/src/gui/gui_checkbox.pas
@@ -34,18 +34,14 @@ type
TfpgCheckBox = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FChecked: boolean;
- FTextColor: TfpgColor;
FOnChange: TNotifyEvent;
FText: string;
FFont: TfpgFont;
FBoxSize: integer;
FIsPressed: boolean;
function GetFontDesc: string;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetChecked(const AValue: boolean);
- procedure SetTextColor(const AValue: TfpgColor);
procedure SetFontDesc(const AValue: string);
procedure SetText(const AValue: string);
protected
@@ -58,11 +54,11 @@ type
destructor Destroy; override;
property Font: TfpgFont read FFont;
published
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property BackgroundColor;
property Checked: boolean read FChecked write SetChecked default False;
property FontDesc: string read GetFontDesc write SetFontDesc;
property Text: string read FText write SetText;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
+ property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
@@ -90,28 +86,11 @@ begin
RePaint;
end;
-procedure TfpgCheckBox.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- Repaint;
- end;
-end;
-
function TfpgCheckBox.GetFontDesc: string;
begin
Result := FFont.FontDesc;
end;
-procedure TfpgCheckBox.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgCheckBox.SetFontDesc(const AValue: string);
begin
FFont.Free;
@@ -220,8 +199,8 @@ begin
FFont := fpgGetFont('#Label1');
FHeight := FFont.Height + 4;
FWidth := 120;
- FTextColor := clText1;
- FBackgroundColor := clWindowBackground;
+ FTextColor := Parent.TextColor;
+ FBackgroundColor := Parent.BackgroundColor;
FFocusable := True;
FBoxSize := 14;
FChecked := False;
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index 66d21fd8..82cf7ba1 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -61,16 +61,12 @@ type
TfpgAbstractComboBox = class(TfpgWidget)
private
FDropDownCount: integer;
- FBackgroundColor: TfpgColor;
- FTextColor: TfpgColor;
FFocusItem: integer;
FFont: TfpgFont;
FInternalBtnRect: TfpgRect;
FItems: TStringList;
FOnChange: TNotifyEvent;
function GetFontDesc: string;
- procedure SetBackgroundColor(const AValue: TfpgColor);
- procedure SetTextColor(const AValue: TfpgColor);
procedure SetDropDownCount(const AValue: integer);
procedure InternalBtnClick(Sender: TObject);
procedure InternalListBoxSelect(Sender: TObject);
@@ -97,8 +93,6 @@ type
property Items: TStringList read FItems; {$Note Make this read/write }
// property is 1-based
property FocusItem: integer read FFocusItem write SetFocusItem;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clBoxColor;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
property FontDesc: string read GetFontDesc write SetFontDesc;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property Text: string read GetText write SetText;
@@ -112,7 +106,7 @@ type
TfpgComboBox = class(TfpgAbstractComboBox)
published
- property BackgroundColor;
+ property BackgroundColor default clBoxColor;
property DropDownCount;
property FocusItem;
property FontDesc;
@@ -225,24 +219,6 @@ begin
FDropDownCount := AValue;
end;
-procedure TfpgAbstractComboBox.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor <> AValue then
- begin
- FBackgroundColor := AValue;
- Repaint;
- end;
-end;
-
-procedure TfpgAbstractComboBox.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- Repaint;
- end;
-end;
-
function TfpgAbstractComboBox.GetFontDesc: string;
begin
Result := FFont.FontDesc;
@@ -498,7 +474,7 @@ begin
inherited Create(AOwner);
FFont := fpgGetFont('#List');
FBackgroundColor := clBoxColor;
- FTextColor := clText1;
+ FTextColor := Parent.TextColor;
FDropDownCount := 8;
FWidth := 120;
FHeight := FFont.Height + 6;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index 3a1b5aa2..01386b5e 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -40,20 +40,17 @@ type
FPopupMenu: TfpgPopupMenu;
FDefaultPopupMenu: TfpgPopupMenu;
FText: string;
- FBackgroundColor: TfpgColor;
FFont: TfpgFont;
FPasswordMode: Boolean;
FBorderStyle: TfpgEditBorderStyle;
FOnChange: TNotifyEvent;
FMaxLength: integer;
FSelecting: Boolean;
- FTextColor: TfpgColor;
procedure AdjustCursor;
procedure DeleteSelection;
procedure DoCopy;
procedure DoPaste;
procedure SetAutoSelect(const AValue: Boolean);
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetBorderStyle(const AValue: TfpgEditBorderStyle);
procedure SetHideSelection(const AValue: Boolean);
procedure SetPasswordMode(const AValue: boolean);
@@ -65,7 +62,6 @@ type
procedure DefaultPopupPaste(Sender: TObject);
procedure DefaultPopupClearAll(Sender: TObject);
procedure SetDefaultPopupMenuItemsState;
- procedure SetTextColor(const AValue: TfpgColor);
protected
FMouseDragPos: integer;
FDrawOffset: integer;
@@ -87,7 +83,6 @@ type
procedure HandleKillFocus; override;
function GetDrawText: String;
property AutoSelect: Boolean read FAutoSelect write SetAutoSelect default True;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clBoxColor;
property BorderStyle: TfpgEditBorderStyle read FBorderStyle write SetBorderStyle default bsDefault;
property Font: TfpgFont read FFont;
property FontDesc: String read GetFontDesc write SetFontDesc;
@@ -96,7 +91,6 @@ type
property PasswordMode: Boolean read FPasswordMode write SetPasswordMode default False;
property PopupMenu: TfpgPopupMenu read FPopupMenu write FPopupMenu;
property Text: String read FText write SetText;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
constructor Create(AOwner: TComponent); override;
@@ -116,7 +110,7 @@ type
property PopupMenu; // UI Designer doesn't fully support it yet
published
property AutoSelect;
- property BackgroundColor;
+ property BackgroundColor default clBoxColor;
property BorderStyle;
property FontDesc;
property HideSelection;
@@ -183,15 +177,6 @@ begin
end;
end;
-procedure TfpgCustomEdit.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor <> AValue then
- begin
- FBackgroundColor := AValue;
- Repaint;
- end;
-end;
-
procedure TfpgCustomEdit.SetBorderStyle(const AValue: TfpgEditBorderStyle);
begin
if FBorderStyle = AValue then
@@ -207,15 +192,6 @@ begin
FHideSelection := AValue;
end;
-procedure TfpgCustomEdit.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- RePaint;
- end;
-end;
-
procedure TfpgCustomEdit.HandlePaint;
var
r: TfpgRect;
@@ -631,7 +607,7 @@ begin
Focusable := True;
FHeight := FFont.Height + 6;
FWidth := 120;
- FTextColor := clText1;
+ FTextColor := Parent.TextColor;
FBackgroundColor := clBoxColor;
FAutoSelect := True;
FSelecting := False;
diff --git a/src/gui/gui_editcombo.pas b/src/gui/gui_editcombo.pas
index 1d08fe6b..7e8ffc85 100644
--- a/src/gui/gui_editcombo.pas
+++ b/src/gui/gui_editcombo.pas
@@ -69,8 +69,6 @@ type
FAutoDropDown: Boolean;
FAllowNew: TAllowNew;
FDropDownCount: integer;
- FBackgroundColor: TfpgColor;
- FTextColor: TfpgColor;
FText: string;
FSelectedItem: integer;
FMaxLength: integer;
@@ -82,8 +80,6 @@ type
FNewItem: boolean;
function GetFontDesc: string;
procedure SetAllowNew(const AValue: TAllowNew);
- procedure SetBackgroundColor(const AValue: TfpgColor);
- procedure SetTextColor(const AValue: TfpgColor);
procedure SetDropDownCount(const AValue: integer);
procedure InternalBtnClick(Sender: TObject);
procedure InternalListBoxSelect(Sender: TObject);
@@ -275,24 +271,6 @@ begin
FAllowNew:= AValue;
end;
-procedure TfpgAbstractEditCombo.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor <> AValue then
- begin
- FBackgroundColor := AValue;
- Repaint;
- end;
-end;
-
-procedure TfpgAbstractEditCombo.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- Repaint;
- end;
-end;
-
function TfpgAbstractEditCombo.GetFontDesc: string;
begin
Result := FFont.FontDesc;
@@ -791,7 +769,7 @@ begin
inherited Create(AOwner);
FFont := fpgGetFont('#List');
FBackgroundColor := clBoxColor;
- FTextColor := clText1;
+ FTextColor := Parent.TextColor;
FDropDownCount := 8;
FWidth := 120;
FHeight := FFont.Height + 6;
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index ea465088..173ea714 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -41,14 +41,12 @@ type
FOnDestroy: TNotifyEvent;
FOnHide: TNotifyEvent;
FOnShow: TNotifyEvent;
- procedure SetBackgroundColor(const AValue: TfpgColor);
protected
FModalResult: integer;
FParentForm: TfpgForm;
FWindowPosition: TWindowPosition;
FWindowTitle: string;
FSizeable: boolean;
- FBackgroundColor: TfpgColor;
procedure AdjustWindowStyle; override;
procedure SetWindowParameters; override;
procedure SetWindowTitle(const ATitle: string); override;
@@ -73,7 +71,8 @@ type
property ModalResult: integer read FModalResult write FModalResult;
published
{$Note Refactor this to a TfpgCustomForm and only surface it here }
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property BackgroundColor;
+ property TextColor;
property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition default wpAuto;
property WindowTitle: string read FWindowTitle write SetWindowTitle;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
@@ -164,14 +163,6 @@ begin
Canvas.EndDraw(0, 0, FWidth, FHeight);
end;
-procedure TfpgForm.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgForm.AdjustWindowStyle;
begin
if fpgApplication.MainForm = nil then
@@ -207,6 +198,7 @@ begin
FSizeable := True;
FParentForm := nil;
FBackgroundColor := clWindowBackground;
+ FTextColor := clText1;
FMinWidth := 32;
FMinHeight := 32;
FModalResult := 0;
diff --git a/src/gui/gui_label.pas b/src/gui/gui_label.pas
index dcea8aa2..3dde3a32 100644
--- a/src/gui/gui_label.pas
+++ b/src/gui/gui_label.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,
@@ -33,13 +33,9 @@ type
TfpgCustomLabel = class(TfpgWidget)
private
FAutoSize: boolean;
- FBackgroundColor: TfpgColor;
- FTextColor: TfpgColor;
function GetFontDesc: string;
procedure SetAutoSize(const AValue: boolean);
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetFontDesc(const AValue: string);
- procedure SetTextColor(const AValue: TfpgColor);
procedure SetText(const AValue: string);
procedure ResizeLabel;
protected
@@ -47,10 +43,8 @@ type
FFont: TfpgFont;
procedure HandlePaint; override;
property AutoSize: boolean read FAutoSize write SetAutoSize default False;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
property FontDesc: string read GetFontDesc write SetFontDesc;
property Text: string read FText write SetText;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -111,14 +105,6 @@ begin
end;
end;
-procedure TfpgCustomLabel.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgCustomLabel.SetFontDesc(const AValue: string);
begin
FFont.Free;
@@ -128,15 +114,6 @@ begin
RePaint;
end;
-procedure TfpgCustomLabel.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- RePaint;
- end;
-end;
-
procedure TfpgCustomLabel.SetText(const AValue: string);
begin
if FText = AValue then
@@ -157,13 +134,13 @@ end;
constructor TfpgCustomLabel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
- FText := 'Label';
- FFont := fpgGetFont('#Label1');
- FHeight := FFont.Height;
- FWidth := 80;
- FTextColor := clText1;
- FBackgroundColor := clWindowBackground;
- FAutoSize := False;
+ FText := 'Label';
+ FFont := fpgGetFont('#Label1');
+ FHeight := FFont.Height;
+ FWidth := 80;
+ FTextColor := Parent.TextColor;
+ FBackgroundColor := Parent.BackgroundColor;
+ FAutoSize := False;
end;
destructor TfpgCustomLabel.Destroy;
diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas
index c4c21277..97dd59d9 100644
--- a/src/gui/gui_listbox.pas
+++ b/src/gui/gui_listbox.pas
@@ -50,15 +50,11 @@ type
FOnScroll: TNotifyEvent;
FOnSelect: TNotifyEvent;
FPopupFrame: boolean;
- FTextColor: TfpgColor;
- FBackgroundColor: TfpgColor; // This should move to TfpgWidget
FAutoHeight: boolean;
function GetFontDesc: string;
procedure SetFocusItem(const AValue: integer);
procedure SetFontDesc(const AValue: string);
procedure SetPopupFrame(const AValue: boolean);
- procedure SetTextColor(const AValue: TfpgColor);
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure UpdateScrollbarCoords;
procedure SetAutoHeight(const AValue: boolean);
protected
@@ -85,12 +81,10 @@ type
procedure HandleShow; override;
procedure HandlePaint; override;
property AutoHeight: boolean read FAutoHeight write SetAutoHeight default False;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clBoxColor;
property FocusItem: integer read FFocusItem write SetFocusItem;
property FontDesc: string read GetFontDesc write SetFontDesc;
property HotTrack: boolean read FHotTrack write FHotTrack;
property PopupFrame: boolean read FPopupFrame write SetPopupFrame;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -124,7 +118,7 @@ type
TfpgListBox = class(TfpgTextListBox)
published
property AutoHeight;
- property BackgroundColor;
+ property BackgroundColor default clListBox;
property FocusItem;
property FontDesc;
property HotTrack;
@@ -233,24 +227,6 @@ begin
RePaint;
end;
-procedure TfpgBaseListBox.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- RePaint;
- end;
-end;
-
-procedure TfpgBaseListBox.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor <> AValue then
- begin
- FBackgroundColor := AValue;
- Repaint;
- end;
-end;
-
procedure TfpgBaseListBox.UpdateScrollbarCoords;
var
HWidth: integer;
@@ -635,7 +611,7 @@ begin
inherited Create(AOwner);
FFont := fpgGetFont('#List');
FBackgroundColor := clListBox;
- FTextColor := clText1;
+ FTextColor := Parent.TextColor;
FScrollBar := TfpgScrollBar.Create(self);
FScrollBar.OnScroll := @ScrollBarMove;
diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas
index 1ff923a0..68b73d80 100644
--- a/src/gui/gui_listview.pas
+++ b/src/gui/gui_listview.pas
@@ -1313,7 +1313,7 @@ var
ItemState: TfpgLVItemState;
Item: TfpgLVItem;
TheText: String;
- TextColor: TfpgColor;
+ TheTextColor: TfpgColor;
oClipRect: TfpgRect;
iColumnClipRect: TfpgRect;
ColumnIndex: Integer;
@@ -1367,7 +1367,7 @@ begin
Canvas.FillRectangle(ItemRect);
Exclude(PaintPart, lvppBackground);
- TextColor := Canvas.TextColor;
+ TheTextColor := Canvas.TextColor;
if Assigned(FOnPaintItem) then
FOnPaintItem(Self, Canvas, Item, I, ItemRect, PaintPart);
@@ -1424,7 +1424,7 @@ begin
Canvas.SetClipRect(oClipRect);
- Canvas.TextColor := TextColor;
+ Canvas.TextColor := TheTextColor;
end;
vBottom := Height - 2;
diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas
index beebb5af..ec484d5b 100644
--- a/src/gui/gui_memo.pas
+++ b/src/gui/gui_memo.pas
@@ -55,8 +55,6 @@ type
FMouseDragging: boolean;
FMouseDragPos: integer;
FFont: TfpgFont;
- FBackgroundColor: TfpgColor;
- FTextColor: TfpgColor;
FDrawOffset: integer;
FLineHeight: integer;
FFirstLine: integer;
@@ -68,8 +66,6 @@ type
FLongestLineWidth: TfpgCoord;
function GetFontDesc: string;
procedure SetFontDesc(const AValue: string);
- procedure SetTextColor(const AValue: TfpgColor);
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure RecalcLongestLine;
procedure DeleteSelection;
procedure DoCopy;
@@ -113,10 +109,10 @@ type
property Text: string read GetText write SetText;
property UseTabs: boolean read FUseTabs write FUseTabs default False;
published
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clBoxColor;
+ property BackgroundColor default clBoxColor;
property FontDesc: string read GetFontDesc write SetFontDesc;
property Lines: TStringList read FLines;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
+ property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
@@ -225,7 +221,7 @@ begin
FMaxLength := 0;
FWrapping := False;
FOnChange := nil;
- FTextColor := clText1;
+ FTextColor := Parent.TextColor;
FBackgroundColor := clBoxColor;
FUseTabs := False;
FTabWidth := 4;
@@ -496,7 +492,7 @@ end;
procedure TfpgMemo.UpdateScrollBars;
var
vlines: integer;
- vsbw, x: integer;
+ vsbw: integer;
hsbwas: boolean;
vsbwas: boolean;
vsbvis: boolean;
@@ -580,24 +576,6 @@ begin
RePaint;
end;
-procedure TfpgMemo.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- RePaint;
- end;
-end;
-
-procedure TfpgMemo.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor <> AValue then
- begin
- FBackgroundColor := AValue;
- Repaint;
- end;
-end;
-
procedure TfpgMemo.SetLineText(linenum: integer; Value: string);
begin
FLines.Strings[linenum - 1] := Value;
@@ -611,7 +589,6 @@ end;
// Set cursor position by X
procedure TfpgMemo.SetCPByX(x: integer);
var
- s: string;
n: integer;
cpx: integer;
cp: integer;
@@ -625,8 +602,6 @@ begin
if cp > UTF8Length(ls) then
cp := UTF8Length(ls);
- s := '';
-
for n := 0 to UTF8Length(ls) do
begin
cx := FFont.TextWidth(UTF8Copy(ls, 1, n)); // + FDrawOffset + FSideMargin;
@@ -1118,7 +1093,6 @@ end;
procedure TfpgMemo.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
var
- s: string;
n: integer;
cpx: integer;
cp: integer;
@@ -1137,8 +1111,6 @@ begin
cpx := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)) - FDrawOffset + FSideMargin;
cp := FCursorPos;
- s := '';
-
for n := 0 to UTF8Length(ls) do
begin
cx := FFont.TextWidth(UTF8Copy(ls, 1, n)) - FDrawOffset + FSideMargin;
@@ -1170,7 +1142,6 @@ end;
procedure TfpgMemo.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState);
var
- s: string;
n: integer;
cpx: integer;
cp: integer;
@@ -1192,7 +1163,6 @@ begin
ls := GetLineText(lnum);
cpx := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)) - FDrawOffset + FSideMargin;
cp := FCursorPos;
- s := '';
for n := 0 to UTF8Length(ls) do
begin
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index adc642c7..f6f4cc54 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -84,11 +84,9 @@ type
TfpgPopupMenu = class(TfpgPopupWindow)
private
- FBackgroundColor: TfpgColor;
FBeforeShow: TNotifyEvent;
FMargin: TfpgCoord;
FTextMargin: TfpgCoord;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure DoSelect;
procedure CloseSubmenus;
function GetItemPosY(index: integer): integer;
@@ -123,7 +121,6 @@ type
procedure Close; override;
function AddMenuItem(const AMenuName: string; const hotkeydef: string; HandlerProc: TNotifyEvent): TfpgMenuItem;
function MenuItemByName(const AMenuName: string): TfpgMenuItem;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
property BeforeShow: TNotifyEvent read FBeforeShow write FBeforeShow;
end;
@@ -132,13 +129,11 @@ type
// Visible only items are stored in FItems just before a paint
TfpgMenuBar = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FBeforeShow: TNotifyEvent;
FLightColor: TfpgColor;
FDarkColor: TfpgColor;
FPrevFocusItem: integer;
FFocusItem: integer;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetFocusItem(const AValue: integer);
procedure DoSelect;
procedure CloseSubmenus;
@@ -165,7 +160,6 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AddMenuItem(const AMenuTitle: string; OnClickProc: TNotifyEvent): TfpgMenuItem;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
property BeforeShow: TNotifyEvent read FBeforeShow write FBeforeShow;
end;
@@ -315,12 +309,6 @@ end;
{ TfpgMenuBar }
-procedure TfpgMenuBar.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor=AValue then exit;
- FBackgroundColor:=AValue;
-end;
-
procedure TfpgMenuBar.SetFocusItem(const AValue: integer);
begin
if FFocusItem = AValue then
@@ -477,7 +465,8 @@ begin
FFocusItem := 0;
FPrevFocusItem := 0;
FFocusable := False;
- FBackgroundColor := clWindowBackground;
+ FBackgroundColor := Parent.BackgroundColor;
+ FTextColor := Parent.TextColor;
// calculate the best height based on font
FHeight := fpgStyle.MenuFont.Height + 6; // 3px margin top and bottom
@@ -674,12 +663,6 @@ end;
{ TfpgPopupMenu }
-procedure TfpgPopupMenu.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then Exit; //==>
- FBackgroundColor := AValue;
-end;
-
procedure TfpgPopupMenu.DoSelect;
var
mi: TfpgMenuItem;
@@ -917,7 +900,7 @@ var
begin
Canvas.BeginDraw;
// inherited HandlePaint;
- Canvas.Clear(FBackgroundColor);
+ Canvas.Clear(BackgroundColor);
Canvas.SetColor(clWidgetFrame);
Canvas.DrawRectangle(0, 0, Width, Height); // black rectangle border
Canvas.DrawButtonFace(1, 1, Width-1, Height-1, []); // 3d rectangle inside black border
@@ -1164,7 +1147,7 @@ begin
FMargin := 3;
FTextMargin := 3;
FItems := TList.Create;
- FBackgroundColor := clWindowBackground;
+
// fonts
FMenuFont := fpgStyle.MenuFont;
FMenuAccelFont := fpgStyle.MenuAccelFont;
diff --git a/src/gui/gui_progressbar.pas b/src/gui/gui_progressbar.pas
index 2177f4ed..ca987bad 100644
--- a/src/gui/gui_progressbar.pas
+++ b/src/gui/gui_progressbar.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,
@@ -31,14 +31,12 @@ uses
type
TfpgCustomProgressBar = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FMax: longint;
FMin: longint;
FPosition: longint;
FShowCaption: boolean;
FStep: longint;
FFont: TfpgFont;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetMax(const AValue: longint);
procedure SetMin(const AValue: longint);
procedure SetPosition(const AValue: longint);
@@ -51,7 +49,6 @@ type
property Position: longint read FPosition write SetPosition default 0;
property Step: longint read FStep write SetStep;
// property FontName: string read GetFontName write SetFontName;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
property ShowCaption: boolean read FShowCaption write SetShowCaption;
public
constructor Create(AOwner: TComponent); override;
@@ -64,12 +61,13 @@ type
TfpgProgressBar = class(TfpgCustomProgressBar)
published
- property BackgroundColor;
+ property BackgroundColor default $c4c4c4;
property ShowCaption;
property Max;
property Min;
property Position;
property Step;
+ property TextColor;
end;
implementation
@@ -91,14 +89,6 @@ begin
RePaint;
end;
-procedure TfpgCustomProgressBar.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgCustomProgressBar.SetMin(const AValue: longint);
begin
if FMin = AValue then
@@ -199,7 +189,7 @@ begin
begin
x := (Width - FFont.TextWidth(txt)) div 2;
y := (Height - FFont.Height) div 2;
- Canvas.SetTextColor(clText1);
+ Canvas.SetTextColor(TextColor);
Canvas.Font := FFont;
Canvas.DrawString(x, y, txt);
end;
@@ -217,6 +207,7 @@ begin
FStep := 1;
FPosition := 0;
FBackgroundColor := TfpgColor($c4c4c4); // clListBox;
+ FTextColor := Parent.TextColor;
FShowCaption := False;
FFont := fpgStyle.DefaultFont;
end;
diff --git a/src/gui/gui_radiobutton.pas b/src/gui/gui_radiobutton.pas
index 2b847e14..8596530c 100644
--- a/src/gui/gui_radiobutton.pas
+++ b/src/gui/gui_radiobutton.pas
@@ -34,9 +34,7 @@ type
TfpgRadioButton = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FChecked: boolean;
- FTextColor: TfpgColor;
FFont: TfpgFont;
FGroupIndex: integer;
FOnChange: TNotifyEvent;
@@ -44,9 +42,7 @@ type
FBoxSize: integer;
FIsPressed: boolean;
function GetFontDesc: string;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetChecked(const AValue: boolean);
- procedure SetTextColor(const AValue: TfpgColor);
procedure SetFontDesc(const AValue: string);
procedure SetText(const AValue: string);
protected
@@ -59,12 +55,12 @@ type
destructor Destroy; override;
property Font: TfpgFont read FFont;
published
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property BackgroundColor;
property Checked: boolean read FChecked write SetChecked default False;
property FontDesc: string read GetFontDesc write SetFontDesc;
property GroupIndex: integer read FGroupIndex write FGroupIndex;
property Text: string read FText write SetText;
- property TextColor: TfpgColor read FTextColor write SetTextColor default clText1;
+ property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
@@ -89,14 +85,6 @@ begin
Result := FFont.FontDesc;
end;
-procedure TfpgRadioButton.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgRadioButton.SetChecked(const AValue: boolean);
var
i: integer;
@@ -123,15 +111,6 @@ begin
RePaint;
end;
-procedure TfpgRadioButton.SetTextColor(const AValue: TfpgColor);
-begin
- if FTextColor <> AValue then
- begin
- FTextColor := AValue;
- Repaint;
- end;
-end;
-
procedure TfpgRadioButton.SetFontDesc(const AValue: string);
begin
FFont.Free;
@@ -246,8 +225,8 @@ begin
FFont := fpgGetFont('#Label1');
FHeight := FFont.Height + 4;
FWidth := 120;
- FTextColor := clText1;
- FBackgroundColor := clWindowBackground;
+ FTextColor := Parent.TextColor;
+ FBackgroundColor := Parent.BackgroundColor;
FFocusable := True;
FBoxSize := 12;
FChecked := False;
diff --git a/src/gui/gui_scrollbar.pas b/src/gui/gui_scrollbar.pas
index 17413e21..aa4ffdc9 100644
--- a/src/gui/gui_scrollbar.pas
+++ b/src/gui/gui_scrollbar.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,
diff --git a/src/gui/gui_tab.pas b/src/gui/gui_tab.pas
index e33e0e97..aab78db8 100644
--- a/src/gui/gui_tab.pas
+++ b/src/gui/gui_tab.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,
@@ -48,12 +48,10 @@ type
TfpgTabSheet = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FText: string;
function GetPageControl: TfpgPageControl;
function GetPageIndex: Integer;
function GetText: string;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetPageIndex(const AValue: Integer);
procedure SetText(const AValue: string);
protected
@@ -65,7 +63,6 @@ type
property Text: string read GetText write SetText;
property PageIndex: Integer read GetPageIndex write SetPageIndex;
property PageControl: TfpgPageControl read GetPageControl;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
end;
@@ -74,7 +71,6 @@ type
TfpgPageControl = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FFont: TfpgFont;
FActivePage: TfpgTabSheet;
FMargin: integer;
@@ -100,7 +96,6 @@ type
function MaxButtonWidth: integer;
function ButtonHeight: integer;
function ButtonWidth(AText: string): integer;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetFixedTabWidth(const AValue: integer);
function GetTabText(AText: string): string;
procedure LeftButtonClick(Sender: TObject);
@@ -126,11 +121,12 @@ type
property OnChange: TTabSheetChange read FOnChange write FOnChange;
published
property ActivePageIndex: integer read GetActivePageIndex write SetActivePageIndex;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property BackgroundColor;
property FixedTabWidth: integer read FFixedTabWidth write SetFixedTabWidth default 0;
property SortPages: boolean read FSortPages write SetSortPages default False;
property Style: TfpgTabStyle read FStyle write SetStyle default tsTabs;
property TabPosition: TfpgTabPosition read FTabPosition write SetTabPosition default tpTop;
+ property TextColor;
end;
@@ -170,14 +166,6 @@ begin
Result := FText;
end;
-procedure TfpgTabSheet.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgTabSheet.SetPageIndex(const AValue: Integer);
begin
if PageControl <> nil then
@@ -209,7 +197,8 @@ begin
inherited Create(AOwner);
FText := '';
FFocusable := True;
- FBackgroundColor := clWindowBackground;
+ FBackgroundColor := Parent.BackgroundColor;
+ FTextColor := Parent.TextColor;
end;
destructor TfpgTabSheet.Destroy;
@@ -330,14 +319,6 @@ begin
result := FFont.TextWidth(AText) + 10;
end;
-procedure TfpgPageControl.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgPageControl.SetFixedTabWidth(const AValue: integer);
begin
if FFixedTabWidth = AValue then
@@ -462,8 +443,8 @@ begin
if h = nil then
Exit;
Canvas.BeginDraw;
- Canvas.SetTextColor(clText1);
-
+ Canvas.SetTextColor(TextColor);
+
case TabPosition of
tpTop:
begin
@@ -692,7 +673,8 @@ begin
FWidth := 150;
FHeight := 100;
- FBackgroundColor := clWindowBackground;
+ FTextColor := Parent.TextColor;
+ FBackgroundColor := Parent.BackgroundColor;
FFocusable := True;
FOnChange := nil;
FFixedTabWidth := 0;
diff --git a/src/gui/gui_trackbar.pas b/src/gui/gui_trackbar.pas
index dc47ee00..962c4c8a 100644
--- a/src/gui/gui_trackbar.pas
+++ b/src/gui/gui_trackbar.pas
@@ -47,7 +47,6 @@ type
TfpgTrackBarExtra = class(TfpgWidget)
private
- FBackgroundColor: TfpgColor;
FMax: integer;
FMin: integer;
FOnChange: TTrackBarChange;
@@ -55,7 +54,6 @@ type
FPosition: integer;
FSliderSize: integer;
procedure DoChange;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetMax(const AValue: integer);
procedure SetMin(const AValue: integer);
procedure SetPosition(const AValue: integer);
@@ -70,7 +68,7 @@ type
public
constructor Create(AOwner: TComponent); override;
published
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property BackgroundColor;
property Min: integer read FMin write SetMin default 0;
property Max: integer read FMax write SetMax default 10;
property Position: integer read FPosition write SetPosition default 0;
@@ -96,8 +94,6 @@ type
FMousePosition: TPoint;
FOnChange: TTrackBarChange;
FFont: TfpgFont;
- FBackgroundColor: TfpgColor;
- procedure SetBackgroundColor(const AValue: TfpgColor);
procedure SetMax(const AValue: integer);
procedure SetMin(const AValue: integer);
procedure SetPosition(const AValue: integer);
@@ -115,13 +111,14 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property BackgroundColor;
property Position: integer read FPosition write SetPosition default 0;
property ScrollStep: integer read FScrollStep write FScrollStep default 1;
property Min: integer read FMin write SetMin default 0;
property Max: integer read FMax write SetMax default 100;
property ShowPosition: boolean read FShowPosition write SetShowPosition default False;
property Orientation: TOrientation read FOrientation write FOrientation default orHorizontal;
+ property TextColor;
property OnChange: TTrackBarChange read FOnChange write FOnChange;
end;
@@ -136,14 +133,6 @@ begin
FOnChange(self, FPosition);
end;
-procedure TfpgTrackBarExtra.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgTrackBarExtra.SetMax(const AValue: integer);
begin
if FMax = AValue then
@@ -364,7 +353,6 @@ end;
constructor TfpgTrackBarExtra.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
- FBackgroundColor := clWindowBackground;
FFocusable := True;
FMin := 0;
FMax := 10;
@@ -372,6 +360,8 @@ begin
FSliderSize := 11;
FOrientation := orHorizontal;
FOnChange := nil;
+ FTextColor := Parent.TextColor;
+ FBackgroundColor := Parent.BackgroundColor;
end;
{ TfpgTrackBar }
@@ -388,14 +378,6 @@ begin
SetPosition(FMax);
end;
-procedure TfpgTrackBar.SetBackgroundColor(const AValue: TfpgColor);
-begin
- if FBackgroundColor = AValue then
- Exit; //==>
- FBackgroundColor := AValue;
- RePaint;
-end;
-
procedure TfpgTrackBar.SetMin(const AValue: integer);
begin
if AValue = FMin then
@@ -595,6 +577,7 @@ begin
Canvas.DrawButtonFace(r, []);
if FShowPosition then
begin
+ Canvas.SetTextColor(TextColor);
fpgStyle.DrawString(Canvas, Width - tw, (Height - FFont.Height) div 2, IntToStr(Position), Enabled);
end;
end;
@@ -639,7 +622,8 @@ begin
FScrollStep := 1;
FShowPosition := False;
FFont := fpgGetFont('#Grid');
- FBackgroundColor := clWindowBackground;
+ FTextColor := Parent.TextColor;
+ FBackgroundColor := Parent.BackgroundColor;
FOnChange := nil;
end;
diff --git a/src/gui/gui_tree.pas b/src/gui/gui_tree.pas
index c9a9a2b4..656116ed 100644
--- a/src/gui/gui_tree.pas
+++ b/src/gui/gui_tree.pas
@@ -126,7 +126,6 @@ type
TfpgTreeView = class(TfpgWidget)
private
FImageList: TfpgImageList;
- FBackgroundColor: TfpgColor;
FColumnHeight: integer; // height of the column header
FDefaultColumnWidth: word;
FIndentNodeWithNoImage: boolean;
@@ -1021,7 +1020,6 @@ end;
procedure TfpgTreeView.FreeAllTreeNodes;
var
n: TfpgTreeNode;
- i: integer;
list: TList;
begin
list := TList.Create;