Просмотр исходного кода

Added Default size and properties for some controls

lainz 9 лет назад
Родитель
Сommit
93b1fbe8bc
4 измененных файлов с 59 добавлено и 4 удалено
  1. 7 1
      bcgamegrid.pas
  2. 48 3
      bcimagebutton.pas
  3. 2 0
      bctrackbarupdown.pas
  4. 2 0
      bgragraphiccontrol.pas

+ 7 - 1
bcgamegrid.pas

@@ -41,7 +41,7 @@ interface
 
 uses
   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
-  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, LCLProc;
+  BCBaseCtrls, BGRABitmap, BGRABitmapTypes, LCLProc, Types;
 
 type
 
@@ -262,6 +262,12 @@ end;
 constructor TBCCustomGrid.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+  with GetControlClassDefaultSize do
+    SetInitialBounds(0, 0, CX, CY);
+  BlockHeight := 30;
+  BlockWidth := 30;
+  GridHeight := 5;
+  GridWidth := 5;
 end;
 
 destructor TBCCustomGrid.Destroy;

+ 48 - 3
bcimagebutton.pas

@@ -41,6 +41,7 @@ interface
 
 uses
   Classes, SysUtils, Forms, Controls, Graphics, LResources, LMessages, ExtCtrls,
+  Types,
   { BGRAControls }
   BCBaseCtrls, BCEffect,
   { BGRABitmap }
@@ -88,10 +89,11 @@ type
 
   { TBCXButton }
   TBCXButton = class(TBCGraphicButton)
-  private
+  protected
     FOnRenderControl: TOnRenderControl;
     FBGRANormal, FBGRAHover, FBGRAActive, FBGRADisabled: TBGRABitmap;
   protected
+    class function GetControlClassDefaultSize: TSize; override;
     procedure DrawControl; override;
     procedure RenderControl; override;
   public
@@ -101,8 +103,43 @@ type
     property OnRenderControl: TOnRenderControl
       read FOnRenderControl write FOnRenderControl;
   published
+    property Action;
+    property Align;
+    property Anchors;
+    property AutoSize;
+    property BidiMode;
+    property BorderSpacing;
     property Caption;
+    property Color;
+    property Constraints;
+    property DragCursor;
+    property DragKind;
+    property DragMode;
     property Enabled;
+    property Font;
+    property ParentBidiMode;
+    property ModalResult;
+    property OnChangeBounds;
+    property OnClick;
+    property OnContextPopup;
+    property OnDragDrop;
+    property OnDragOver;
+    property OnEndDrag;
+    property OnMouseDown;
+    property OnMouseEnter;
+    property OnMouseLeave;
+    property OnMouseMove;
+    property OnMouseUp;
+    property OnMouseWheel;
+    property OnMouseWheelDown;
+    property OnMouseWheelUp;
+    property OnResize;
+    property OnStartDrag;
+    property ParentFont;
+    property ParentShowHint;
+    property PopupMenu;
+    property ShowHint;
+    property Visible;
   end;
 
   { TBCSliceScalingOptions }
@@ -384,6 +421,11 @@ end;
 
 { TBCXButton }
 
+class function TBCXButton.GetControlClassDefaultSize: TSize;
+begin
+  Result := inherited GetControlClassDefaultSize;
+end;
+
 procedure TBCXButton.DrawControl;
 begin
   if Enabled then
@@ -426,6 +468,8 @@ end;
 constructor TBCXButton.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+  with GetControlClassDefaultSize do
+    SetInitialBounds(0, 0, CX, CY);
 end;
 
 destructor TBCXButton.Destroy;
@@ -1057,7 +1101,7 @@ end;
 
 procedure TBCCustomImageButton.DoMouseUp;
 var
-  Ctrl : TControl;
+  Ctrl: TControl;
 begin
   FFade.Mode := fmFadeIn;
 
@@ -1153,7 +1197,8 @@ begin
   inherited Destroy;
 end;
 
-procedure TBCCustomImageButton.LoadFromBitmapResource(Resource: string; ResourceType: PChar);
+procedure TBCCustomImageButton.LoadFromBitmapResource(Resource: string;
+  ResourceType: PChar);
 var
   res: TResourceStream;
 begin

+ 2 - 0
bctrackbarupdown.pas

@@ -642,6 +642,8 @@ end;
 constructor TCustomBCTrackbarUpdown.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+  with GetControlClassDefaultSize do
+    SetInitialBounds(0, 0, CX, CY);
   FMinValue:= 0;
   FMaxValue := 100;
   FValue := 50;

+ 2 - 0
bgragraphiccontrol.pas

@@ -256,6 +256,8 @@ end;
 constructor TBGRAGraphicControl.Create(TheOwner: TComponent);
 begin
   inherited Create(TheOwner);
+  with GetControlClassDefaultSize do
+    SetInitialBounds(0, 0, CX, CY);
   FBGRA := TBGRABitmap.Create;
   FBevelWidth := 1;
   FAlignment := taCenter;