You've already forked lazarus-ccr
* When a child is added to a view, make the view the first responder of the child
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2683 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -41,6 +41,7 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
TXIBProperties = (
|
TXIBProperties = (
|
||||||
|
bvNextResponder,
|
||||||
bvOpaque,
|
bvOpaque,
|
||||||
bvHighlighted,
|
bvHighlighted,
|
||||||
bvAlpha,
|
bvAlpha,
|
||||||
@ -80,6 +81,7 @@ type
|
|||||||
|
|
||||||
const
|
const
|
||||||
XIBPropertiesStrings : array[TXIBProperties] of TXIBProperty = (
|
XIBPropertiesStrings : array[TXIBProperties] of TXIBProperty = (
|
||||||
|
(APropertyName: 'NSNextResponder'; ADefaultValue: ''),
|
||||||
(APropertyName: 'IBUIOpaque' ; ADefaultValue: 'YES'),
|
(APropertyName: 'IBUIOpaque' ; ADefaultValue: 'YES'),
|
||||||
(APropertyName: 'IBUIHighlighted'; ADefaultValue: 'NO'),
|
(APropertyName: 'IBUIHighlighted'; ADefaultValue: 'NO'),
|
||||||
(APropertyName: 'IBUIAlpha' ; ADefaultValue: '1'),
|
(APropertyName: 'IBUIAlpha' ; ADefaultValue: '1'),
|
||||||
@ -275,23 +277,23 @@ type
|
|||||||
|
|
||||||
UIView = class(tiOSFakeComponent)
|
UIView = class(tiOSFakeComponent)
|
||||||
private
|
private
|
||||||
FNSNextResponder: UIView;
|
|
||||||
function GetFlags(AIndex: Integer): boolean;
|
function GetFlags(AIndex: Integer): boolean;
|
||||||
function GetNSSuperview: UIView;
|
function GetXIBObject(AIndex: TXIBProperties): UIView;
|
||||||
function ObtainSuperview: UIView;
|
function ObtainSuperview: UIView;
|
||||||
procedure SetFlags(AIndex: Integer; AValue: boolean);
|
procedure SetFlags(AIndex: Integer; AValue: boolean);
|
||||||
procedure SetNSSuperView(AValue: UIView);
|
procedure SetXIBObject(AIndex: TXIBProperties; AValue: UIView);
|
||||||
protected
|
protected
|
||||||
function GetPaintText: string; virtual;
|
function GetPaintText: string; virtual;
|
||||||
procedure SetName(const NewName: TComponentName); override;
|
procedure SetName(const NewName: TComponentName); override;
|
||||||
property Caption: string index bvText read GetXIBString write SetXIBString;
|
property Caption: string index bvText read GetXIBString write SetXIBString;
|
||||||
|
procedure AddChild(const AValue: tiOSFakeComponent); override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure InitializeDefaults; override;
|
procedure InitializeDefaults; override;
|
||||||
procedure paint(ACanvas: TCanvas); override;
|
procedure paint(ACanvas: TCanvas); override;
|
||||||
class function GetIBClassName: string; override;
|
class function GetIBClassName: string; override;
|
||||||
property NSSuperview: UIView read GetNSSuperview write SetNSSuperView;
|
property NSSuperview: UIView index bvSuperview read GetXIBObject write SetXIBObject;
|
||||||
property NSNextResponder: UIView read FNSNextResponder write FNSNextResponder;
|
property NSNextResponder: UIView index bvNextResponder read GetXIBObject write SetXIBObject;
|
||||||
property Flags: Int64 index bvFlags read GetXIBInt64 write SetXIBInt64;
|
property Flags: Int64 index bvFlags read GetXIBInt64 write SetXIBInt64;
|
||||||
published
|
published
|
||||||
property Opaque: boolean index bvOpaque read GetXIBBoolean write SetXIBBoolean;
|
property Opaque: boolean index bvOpaque read GetXIBBoolean write SetXIBBoolean;
|
||||||
@ -1659,7 +1661,6 @@ end;
|
|||||||
constructor UIWindow.Create(AOwner: TComponent);
|
constructor UIWindow.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
NSNextResponder:=self;
|
|
||||||
FLeft := 10;
|
FLeft := 10;
|
||||||
FTop := 10;
|
FTop := 10;
|
||||||
BackgroundColor:=clWhite;
|
BackgroundColor:=clWhite;
|
||||||
@ -3441,7 +3442,7 @@ end;
|
|||||||
|
|
||||||
{ UIView }
|
{ UIView }
|
||||||
|
|
||||||
function UIView.GetNSSuperView: UIView;
|
function UIView.GetXIBObject(AIndex: TXIBProperties): UIView;
|
||||||
|
|
||||||
function FindComponentByRef(AComp: tiOSFakeComponent;const ARef: Int64): tiOSFakeComponent;
|
function FindComponentByRef(AComp: tiOSFakeComponent;const ARef: Int64): tiOSFakeComponent;
|
||||||
var
|
var
|
||||||
@ -3467,7 +3468,7 @@ var
|
|||||||
s: string;
|
s: string;
|
||||||
ANode: TDOMElement;
|
ANode: TDOMElement;
|
||||||
begin
|
begin
|
||||||
ANode := FindKeyNode(XIBObjectElement, 'reference', 'NSSuperview');
|
ANode := FindKeyNode(XIBObjectElement, 'reference', XIBPropertiesStrings[AIndex].APropertyName);
|
||||||
if assigned(ANode) then
|
if assigned(ANode) then
|
||||||
begin
|
begin
|
||||||
s := ANode.AttribStrings['ref'];
|
s := ANode.AttribStrings['ref'];
|
||||||
@ -3498,7 +3499,7 @@ begin
|
|||||||
Flags := flags and (not (1 shl AIndex));
|
Flags := flags and (not (1 shl AIndex));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UIView.SetNSSuperView(AValue: UIView);
|
procedure UIView.SetXIBObject(AIndex: TXIBProperties; AValue: UIView);
|
||||||
var
|
var
|
||||||
ANode: TDOMElement;
|
ANode: TDOMElement;
|
||||||
begin
|
begin
|
||||||
@ -3506,12 +3507,12 @@ begin
|
|||||||
raise exception.create('NoObjectElement');
|
raise exception.create('NoObjectElement');
|
||||||
if assigned(AValue) then
|
if assigned(AValue) then
|
||||||
begin
|
begin
|
||||||
ANode := GetKeyNode(XIBObjectElement, 'reference', 'NSSuperview');
|
ANode := GetKeyNode(XIBObjectElement, 'reference', XIBPropertiesStrings[AIndex].APropertyName);
|
||||||
ANode.AttribStrings['ref'] := IntToStr(AValue.Ref);
|
ANode.AttribStrings['ref'] := IntToStr(AValue.Ref);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ANode := FindKeyNode(XIBObjectElement, 'reference', 'NSSuperview');
|
ANode := FindKeyNode(XIBObjectElement, 'reference', XIBPropertiesStrings[AIndex].APropertyName);
|
||||||
if assigned(ANode) then
|
if assigned(ANode) then
|
||||||
ANode.ParentNode.RemoveChild(ANode);
|
ANode.ParentNode.RemoveChild(ANode);
|
||||||
end;
|
end;
|
||||||
@ -3562,6 +3563,17 @@ begin
|
|||||||
if Name=Caption then Caption:=NewName;
|
if Name=Caption then Caption:=NewName;
|
||||||
inherited SetName(NewName);
|
inherited SetName(NewName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure UIView.AddChild(const AValue: tiOSFakeComponent);
|
||||||
|
begin
|
||||||
|
inherited AddChild(AValue);
|
||||||
|
|
||||||
|
if (AValue is UIView) and not (csLoading in ComponentState) then
|
||||||
|
begin
|
||||||
|
UIView(AValue).NSNextResponder:=self;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
procedure UIView.WriteToDomElement(AnObjectDomElement: TDOMElement);
|
procedure UIView.WriteToDomElement(AnObjectDomElement: TDOMElement);
|
||||||
var
|
var
|
||||||
|
Reference in New Issue
Block a user