| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- unit BaseIDView;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, RealICQSkinFrm, InterfaceUI, superobject;
- type
- TBaseIDViewForm = class(TRealICQSkinForm, IUIIDForm)
- private
- { Private declarations }
- FAutoFree: Boolean;
- FFormID: string;
- procedure SetFormID(const Value: string);
- protected
- // procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
- // procedure DoShow; override;
- procedure DoClose(var Action: TCloseAction); override;
- procedure DoShow; override;
- public
- destructor Destroy; override;
- function GetIdentify: Cardinal;
- function GetFormID: string;
- procedure SetFormInfo(AJson: WideString); virtual;
- function GetAutoFree: Boolean;
- procedure SetAutoFree(const Value: Boolean);
- { Public declarations }
- property AutoFree: Boolean read GetAutoFree write SetAutoFree;
- property FormID: string read GetFormID write SetFormID;
- end;
- var
- BaseIDViewForm: TBaseIDViewForm;
- implementation
- uses
- ViewManager;
- { TBaseIDViewForm }
- destructor TBaseIDViewForm.Destroy;
- begin
- TViewManager.Current.FreeIDView(Self.ClassName, FormID);
- inherited;
- end;
- procedure TBaseIDViewForm.DoClose(var Action: TCloseAction);
- begin
- inherited;
- if FAutoFree then
- begin
- Action := caFree;
- end;
- end;
- procedure TBaseIDViewForm.DoShow;
- begin
- inherited;
- ChangeUIColor($EADEBA);
- end;
- function TBaseIDViewForm.GetAutoFree: Boolean;
- begin
- Result := FAutoFree;
- end;
- function TBaseIDViewForm.GetFormID: string;
- begin
- Result := FFormID;
- end;
- function TBaseIDViewForm.GetIdentify: Cardinal;
- begin
- Result := Handle;
- end;
- procedure TBaseIDViewForm.SetAutoFree(const Value: Boolean);
- begin
- FAutoFree := Value;
- end;
- procedure TBaseIDViewForm.SetFormID(const Value: string);
- begin
- FFormID := Value;
- end;
- procedure TBaseIDViewForm.SetFormInfo(AJson: WideString);
- var
- AJo: ISuperObject;
- begin
- AJo := SO(AJson);
- if AJo <> nil then
- begin
- // if AJo.S['url'] <> '' then
- // URL := AJo.S['url'];
- if AJo.S['caption'] <> '' then
- Caption := AJo.S['caption'];
- if AJo.I['width'] > 0 then
- Width := AJo.I['width'];
- if AJo.I['height'] > 0 then
- Height := AJo.I['height'];
- if AJo.B['center'] then
- begin
- Top := (Screen.Height - Height) div 2;
- Left := (Screen.Width - Width) div 2;
- end;
- if AJo.B['unsizeable'] then
- begin
- Constraints.MaxHeight := Height;
- Constraints.MaxWidth := Width;
- Constraints.MinHeight := Height;
- Constraints.MinWidth := Width;
- // BorderStyle := bsSingle;
- end;
- end;
- end;
- end.
|