You've already forked lazarus-ccr
* Set default background colors
* Set default flags-value * Paint the title on a button * Added the StatusBar property git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2653 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -251,6 +251,7 @@ type
|
|||||||
procedure SetFlags(AIndex: Integer; AValue: boolean);
|
procedure SetFlags(AIndex: Integer; AValue: boolean);
|
||||||
procedure SetNSSuperView(AValue: UIView);
|
procedure SetNSSuperView(AValue: UIView);
|
||||||
protected
|
protected
|
||||||
|
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;
|
||||||
public
|
public
|
||||||
@ -311,8 +312,12 @@ type
|
|||||||
|
|
||||||
{ UIWindow }
|
{ UIWindow }
|
||||||
|
|
||||||
|
TiOSFakeStatusBarStyle = (sbsGrey=0, sbsBlackTranslucent=1, sbsBlack = 2, sbsNone=3);
|
||||||
|
|
||||||
UIWindow = class(UIView)
|
UIWindow = class(UIView)
|
||||||
private
|
private
|
||||||
|
function GetStatusBar: TiOSFakeStatusBarStyle;
|
||||||
|
procedure SetStatusBar(AValue: TiOSFakeStatusBarStyle);
|
||||||
protected
|
protected
|
||||||
function StoreSizeAsFrameSize: boolean; override;
|
function StoreSizeAsFrameSize: boolean; override;
|
||||||
procedure SetBounds(NewLeft, NewTop, NewWidth, NewHeight: integer); override;
|
procedure SetBounds(NewLeft, NewTop, NewWidth, NewHeight: integer); override;
|
||||||
@ -322,6 +327,7 @@ type
|
|||||||
procedure paint(ACanvas: TCanvas); override;
|
procedure paint(ACanvas: TCanvas); override;
|
||||||
class function GetIBClassName: string; override;
|
class function GetIBClassName: string; override;
|
||||||
published
|
published
|
||||||
|
property StatusBar: TiOSFakeStatusBarStyle read GetStatusBar write SetStatusBar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ UIViewController }
|
{ UIViewController }
|
||||||
@ -386,6 +392,8 @@ type
|
|||||||
FNSNextKeyView: UIView;
|
FNSNextKeyView: UIView;
|
||||||
function GetButtonType: TiOSFakeButtonType;
|
function GetButtonType: TiOSFakeButtonType;
|
||||||
procedure SetButtonType(AValue: TiOSFakeButtonType);
|
procedure SetButtonType(AValue: TiOSFakeButtonType);
|
||||||
|
protected
|
||||||
|
function GetPaintText: string; override;
|
||||||
public
|
public
|
||||||
procedure InitializeDefaults; override;
|
procedure InitializeDefaults; override;
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -394,7 +402,7 @@ type
|
|||||||
property NSNextKeyView: UIView read FNSNextKeyView write FNSNextKeyView;
|
property NSNextKeyView: UIView read FNSNextKeyView write FNSNextKeyView;
|
||||||
published
|
published
|
||||||
property NormalTitle: string index bvNormalTitle read GetXIBString write SetXIBString;
|
property NormalTitle: string index bvNormalTitle read GetXIBString write SetXIBString;
|
||||||
property NotmalTitleColor: TColor index bvNormalTitleColor read GetXIBColor write SetXIBColor;
|
property NormalTitleColor: TColor index bvNormalTitleColor read GetXIBColor write SetXIBColor;
|
||||||
property ButtonType: TiOSFakeButtonType read GetButtonType write SetButtonType;
|
property ButtonType: TiOSFakeButtonType read GetButtonType write SetButtonType;
|
||||||
property onTouchDown: TCocoaEvent index 1 read GetXIBEvent write SetXIBEvent;
|
property onTouchDown: TCocoaEvent index 1 read GetXIBEvent write SetXIBEvent;
|
||||||
end;
|
end;
|
||||||
@ -1531,6 +1539,57 @@ end;
|
|||||||
|
|
||||||
{ UIWindow }
|
{ UIWindow }
|
||||||
|
|
||||||
|
function UIWindow.GetStatusBar: TiOSFakeStatusBarStyle;
|
||||||
|
var
|
||||||
|
ANode: TDOMNode;
|
||||||
|
begin
|
||||||
|
if Assigned(XIBObjectElement) then
|
||||||
|
begin
|
||||||
|
ANode := FindKeyNode(XIBObjectElement, 'object', 'IBUISimulatedStatusBarMetrics');
|
||||||
|
if assigned(ANode) then
|
||||||
|
begin
|
||||||
|
ANode := FindKeyNode(ANode, 'int', 'IBUIStatusBarStyle');
|
||||||
|
if assigned(ANode) then
|
||||||
|
begin
|
||||||
|
result := TiOSFakeStatusBarStyle(StrToInt(ANode.TextContent));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result := sbsGrey;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result := sbsNone;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result := sbsNone;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure UIWindow.SetStatusBar(AValue: TiOSFakeStatusBarStyle);
|
||||||
|
var
|
||||||
|
ANode: TDOMNode;
|
||||||
|
begin
|
||||||
|
if AValue = sbsNone then
|
||||||
|
begin
|
||||||
|
ANode := FindKeyNode(XIBObjectElement, 'object', 'IBUISimulatedStatusBarMetrics');
|
||||||
|
if assigned(ANode) then
|
||||||
|
ANode.ParentNode.RemoveChild(ANode);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ANode := GetKeyNode(XIBObjectElement, 'object', 'IBUISimulatedStatusBarMetrics', 'IBUISimulatedStatusBarMetrics');
|
||||||
|
if AValue<>sbsGrey then
|
||||||
|
begin
|
||||||
|
ANode := GetKeyNode(ANode, 'int', 'IBUIStatusBarStyle');
|
||||||
|
anode.TextContent:=IntToStr(ord(AValue));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ANode := FindKeyNode(ANode, 'int', 'IBUIStatusBarStyle');
|
||||||
|
if assigned(ANode) then
|
||||||
|
ANode.ParentNode.RemoveChild(ANode);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function UIWindow.StoreSizeAsFrameSize: boolean;
|
function UIWindow.StoreSizeAsFrameSize: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
@ -1553,6 +1612,8 @@ procedure UIWindow.InitializeDefaults;
|
|||||||
begin
|
begin
|
||||||
inherited InitializeDefaults;
|
inherited InitializeDefaults;
|
||||||
Inherited SetBounds(left, top, 320, 480);
|
Inherited SetBounds(left, top, 320, 480);
|
||||||
|
BackgroundColor:=clWhite;
|
||||||
|
StatusBar:=sbsGrey;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor UIWindow.Create(AOwner: TComponent);
|
constructor UIWindow.Create(AOwner: TComponent);
|
||||||
@ -3137,6 +3198,11 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function UIView.GetPaintText: string;
|
||||||
|
begin
|
||||||
|
result := Caption;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure tiOSFakeComponent.SetXIBString(index: TXIBProperties; ANodeName, AValue: string);
|
procedure tiOSFakeComponent.SetXIBString(index: TXIBProperties; ANodeName, AValue: string);
|
||||||
var
|
var
|
||||||
ANode: TDOMNode;
|
ANode: TDOMNode;
|
||||||
@ -3253,8 +3319,9 @@ procedure UIView.InitializeDefaults;
|
|||||||
begin
|
begin
|
||||||
inherited InitializeDefaults;
|
inherited InitializeDefaults;
|
||||||
SetBounds(10,10,72,37);
|
SetBounds(10,10,72,37);
|
||||||
BackgroundColor:=clWhite;
|
|
||||||
Alpha:=1;
|
Alpha:=1;
|
||||||
|
Opaque:=False;
|
||||||
|
Flags := 292;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UIView.paint(ACanvas: TCanvas);
|
procedure UIView.paint(ACanvas: TCanvas);
|
||||||
@ -3272,7 +3339,7 @@ begin
|
|||||||
Font.Size:=12;
|
Font.Size:=12;
|
||||||
Font.Italic:=false;
|
Font.Italic:=false;
|
||||||
Font.Bold:=false;
|
Font.Bold:=false;
|
||||||
TextOut(5,2,Caption);
|
TextOut(5,2,GetPaintText);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3301,9 +3368,15 @@ begin
|
|||||||
SetXIBInteger(bvButtonType, Ord(AValue));
|
SetXIBInteger(bvButtonType, Ord(AValue));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function UIButton.GetPaintText: string;
|
||||||
|
begin
|
||||||
|
result := NormalTitle;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure UIButton.InitializeDefaults;
|
procedure UIButton.InitializeDefaults;
|
||||||
begin
|
begin
|
||||||
inherited InitializeDefaults;
|
inherited InitializeDefaults;
|
||||||
|
NormalTitleColor:=$00854F32;
|
||||||
ButtonType:=RoundedRect;
|
ButtonType:=RoundedRect;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user