Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit View.Components.ComboBox003;
- interface
- uses
- System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
- FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Layouts,
- View.Components.Interfaces, View.Components.Attributes.Interfaces,
- View.Components.Attributes, FMX.Edit, FMX.ComboEdit, FMX.Objects,
- FMX.Controls.Presentation, FMX.StdCtrls, View.Styles.States, FMX.Effects,
- FMX.Filter.Effects, View.Styles, View.Services.Utils;
- type
- TComponentComboBox003 = class(TForm, iComponents<TComponentComboBox003>)
- Layout1: TLayout;
- Layout2: TLayout;
- Layout3: TLayout;
- Layout4: TLayout;
- Layout5: TLayout;
- Layout6: TLayout;
- Label1: TLabel;
- Layout7: TLayout;
- Rectangle1: TRectangle;
- ComboEdit1: TComboEdit;
- Rectangle2: TRectangle;
- Rectangle3: TRectangle;
- Image1: TImage;
- Image2: TImage;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- FillRGBEffect1: TFillRGBEffect;
- FillRGBEffect2: TFillRGBEffect;
- BlurEffect1: TBlurEffect;
- procedure FormCreate(Sender: TObject);
- procedure SpeedButton2MouseEnter(Sender: TObject);
- procedure SpeedButton1MouseEnter(Sender: TObject);
- procedure SpeedButton1MouseLeave(Sender: TObject);
- procedure SpeedButton2MouseLeave(Sender: TObject);
- procedure ComboEdit1Enter(Sender: TObject);
- procedure ComboEdit1Exit(Sender: TObject);
- private
- { Private declarations }
- FAttributes : iComponentAttributes<TComponentComboBox003>;
- FFieldValue : ^String; //ponteiro endereço de memória
- FContainer : TFMXObject;
- FRequired : Boolean;
- FItens : TStringList;
- public
- { Public declarations }
- function Component : TFMXObject;
- function Attributes : iComponentAttributes<TComponentComboBox003>;
- function LoadAttributes (aValue : String) : TComponentComboBox003;
- function FieldValue(var aFieldValue : String) : TComponentComboBox003;
- function Container (aValue : TFMXObject) : iComponents<TComponentComboBox003>;
- function This : TComponentComboBox003;
- function Required (aValue : Boolean) : TComponentComboBox003;
- function AddItem (aName : String) : TComponentComboBox003;
- end;
- var
- ComponentComboBox003: TComponentComboBox003;
- implementation
- {$R *.fmx}
- function TComponentComboBox003.AddItem(aName: String): TComponentComboBox003;
- begin
- Result := Self;
- if not Assigned(FItens) then
- FItens := TStringList.Create;
- FItens.Add(aName);
- end;
- function TComponentComboBox003.Attributes: iComponentAttributes<TComponentComboBox003>;
- begin
- Result := FAttributes;
- end;
- procedure TComponentComboBox003.ComboEdit1Enter(Sender: TObject);
- begin
- BlurEffect1.Enabled:=True;
- Rectangle1.Stroke.Color := PRIMARY;
- Rectangle1.Stroke.Thickness:=2;
- end;
- procedure TComponentComboBox003.ComboEdit1Exit(Sender: TObject);
- begin
- BlurEffect1.Enabled:=False;
- Rectangle1.Stroke.Color := TAlphaColors.Lightgray;
- Rectangle1.Stroke.Thickness:=1;
- end;
- function TComponentComboBox003.Component: TFMXObject;
- var
- i : integer;
- begin
- Result := Layout1;
- if Assigned(FContainer) then FContainer.AddObject(Layout1);
- Label1.FontColor:=FAttributes.FontColor;
- Label1.Text := FAttributes.Title;
- Rectangle1.Fill.Color := FAttributes.BackGround;
- if FRequired then
- Rectangle1.Fill.Color := FAttributes.DestBackGround;
- BlurEffect1.Enabled:=True;
- if Assigned(FItens) then
- begin
- for i := 0 to Pred(FItens.Count) do
- ComboEdit1.Items.Add( FItens[i] );
- FItens.Free;
- end;
- Rectangle2.Fill.Color := FAttributes.BackGround;
- TServiceUtils.ResourceImage(FAttributes.Image, Image1);
- FillRGBEffect1.Color:= FAttributes.DestBackGround;
- Rectangle3.Fill.Color := FAttributes.BackGround;
- FillRGBEffect2.Color:= FAttributes.DestBackGround;
- TServiceUtils.ResourceImage(FAttributes.Image2, Image2);
- Layout1.Position.Y:=1000;
- ComboEdit1.TabOrder := FAttributes.TabOrder;
- ComboEdit1.Caret.Color := FAttributes.FontColor;
- ComboEdit1.FontColor := FAttributes.FontColor;
- ComboEdit1.Font.Size := FAttributes.FontSize;
- Layout1.Align := FAttributes.Align;
- end;
- function TComponentComboBox003.Container(
- aValue: TFMXObject): iComponents<TComponentComboBox003>;
- begin
- Result := Self;
- FContainer := aValue;
- end;
- function TComponentComboBox003.FieldValue(
- var aFieldValue: String): TComponentComboBox003;
- begin
- Result := Self;
- FFieldValue := @aFieldValue;
- end;
- procedure TComponentComboBox003.FormCreate(Sender: TObject);
- begin
- FAttributes := TComponentAttributes<TComponentComboBox003>.New(Self);
- end;
- function TComponentComboBox003.LoadAttributes(
- aValue: String): TComponentComboBox003;
- begin
- Result := Self;
- FAttributes := StylesStates.GetStyle(aValue) as iComponentAttributes<TComponentComboBox003>;
- FAttributes.Parent(Self);
- end;
- function TComponentComboBox003.Required(aValue: Boolean): TComponentComboBox003;
- begin
- Result := Self;
- FRequired := aValue;
- end;
- procedure TComponentComboBox003.SpeedButton1MouseEnter(Sender: TObject);
- begin
- FillRGBEffect1.Color := LIGHT;
- end;
- procedure TComponentComboBox003.SpeedButton1MouseLeave(Sender: TObject);
- begin
- FillRGBEffect1.Color := FAttributes.DestBackGround;
- end;
- procedure TComponentComboBox003.SpeedButton2MouseEnter(Sender: TObject);
- begin
- FillRGBEffect2.Color := LIGHT;
- end;
- procedure TComponentComboBox003.SpeedButton2MouseLeave(Sender: TObject);
- begin
- FillRGBEffect2.Color := FAttributes.DestBackGround;
- end;
- function TComponentComboBox003.This: TComponentComboBox003;
- begin
- Result := Self;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement