diff --git a/lcl/chart.pp b/lcl/chart.pp index c62f2f35a7..de907e937b 100644 --- a/lcl/chart.pp +++ b/lcl/chart.pp @@ -35,24 +35,48 @@ uses type TPosLabel=(plLeft, plCenter, plRight); - - { TCustomBarChart } + TCustomBarChart = class; + { TBar } TBar = class(TCollectionItem) private + FColor: TColor; FSName: String; FValue: integer; - FColor: TColor; - public + procedure SetColor(const AValue: TColor); + procedure SetSName(const AValue: String); + procedure SetValue(const AValue: integer); + procedure UpdateBarChart; + protected + function GetDisplayName: string; override; + published + property SName: String read FSName write SetSName; + property Value: integer read FValue write SetValue; + property Color: TColor read FColor write SetColor; end; + { TBarChartItems } + + TBarChartItems = class(TCollection) + private + FBarChart : TCustomBarChart; + public + constructor Create(BarChart: TCustomBarChart); + end; + + { TCustomBarChart } + TCustomBarChart = class(TPanel) private FUpdateCount: Integer; FBars: TCollection; FDepth: byte; FLabelPosition:TPosLabel; + function GetBars: TCollection; function NormalizeScaleUnits(OldScale: Integer): Integer; + procedure SetBars(const AValue: TCollection); + procedure SetDepth(const AValue: byte); + procedure SetLabelPosition(const AValue: TPosLabel); protected procedure Paint; override; public @@ -64,9 +88,11 @@ type function BarCount: Integer; procedure BeginUpdate; procedure EndUpdate; + procedure UpdateBarChart; published - property Depth: byte read FDepth write FDepth; - property LabelPosition: TPosLabel read FLabelPosition write FLabelPosition; + property Bars: TCollection read GetBars write SetBars; + property Depth: byte read FDepth write SetDepth; + property LabelPosition: TPosLabel read FLabelPosition write SetLabelPosition; end; @@ -128,7 +154,7 @@ end; constructor TCustomBarChart.Create(AOwner: TComponent); begin inherited Create(AOwner); - FBars:=TCollection.Create(TBar); + FBars:=TBarChartItems.Create(Self); FDepth:=5; FLabelPosition:=plLeft; SetInitialBounds(0,0,150,120); @@ -183,6 +209,30 @@ begin end; end; +function TCustomBarChart.GetBars: TCollection; +begin + Result:=FBars; +end; + +procedure TCustomBarChart.SetBars(const AValue: TCollection); +begin + FBars.Assign(AValue); +end; + +procedure TCustomBarChart.SetDepth(const AValue: byte); +begin + if FDepth=AValue then exit; + FDepth:=AValue; + UpdateBarChart; +end; + +procedure TCustomBarChart.SetLabelPosition(const AValue: TPosLabel); +begin + if FLabelPosition=AValue then exit; + FLabelPosition:=AValue; + UpdateBarChart; +end; + procedure TCustomBarChart.Paint; var @@ -335,10 +385,56 @@ begin Invalidate; end; +procedure TCustomBarChart.UpdateBarChart; +begin + if FUpdateCount = 0 then + Invalidate; +end; + function TCustomBarChart.BarCount: Integer; begin Result:=FBars.Count; end; +{ TBar } -end. \ No newline at end of file +procedure TBar.SetColor(const AValue: TColor); +begin + if FColor=AValue then exit; + FColor:=AValue; + UpdateBarChart; +end; + +procedure TBar.SetSName(const AValue: String); +begin + if FSName=AValue then exit; + FSName:=AValue; + UpdateBarChart; +end; + +procedure TBar.SetValue(const AValue: integer); +begin + if FValue=AValue then exit; + FValue:=AValue; + UpdateBarChart; +end; + +procedure TBar.UpdateBarChart; +begin + (Collection as TBarChartItems).FBarChart.UpdateBarChart; +end; + +function TBar.GetDisplayName: string; +begin + Result:=FSName; +end; + +{ TBarChartItems } + +constructor TBarChartItems.Create(BarChart: TCustomBarChart); +begin + inherited Create(TBar); + FBarChart:=BarChart; +end; + +end. diff --git a/lcl/dbctrls.pp b/lcl/dbctrls.pp index eb9c478fe4..021222e7c0 100644 --- a/lcl/dbctrls.pp +++ b/lcl/dbctrls.pp @@ -373,6 +373,7 @@ Type property OnMouseuP; property OnResize; property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False; + property TabOrder; property Values: TStrings read FValues write SetValues; property Visible; end; diff --git a/lcl/forms.pp b/lcl/forms.pp index 407eb904d2..1fe867c5c9 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -144,8 +144,7 @@ type procedure SetAutoScroll(Value: Boolean); procedure SetHorzScrollBar(Value: TControlScrollBar); procedure SetVertScrollBar(Value: TControlScrollBar); - //todo: rename to IsScrollbarsStored - Function StoreScrollBars : Boolean; + function StoreScrollBars : Boolean; protected procedure AlignControls(AControl: TControl; var ARect: TRect); override; procedure CreateWnd; override;