You've already forked lazarus-ccr
* Adapted SearchBar and TableView properties
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2669 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -52,6 +52,7 @@ type
|
|||||||
bvSuperview,
|
bvSuperview,
|
||||||
bvLines,
|
bvLines,
|
||||||
bvBackgroundColor,
|
bvBackgroundColor,
|
||||||
|
bvSeparatorColor,
|
||||||
bvFullScreen,
|
bvFullScreen,
|
||||||
bvClearContext,
|
bvClearContext,
|
||||||
bvFlags,
|
bvFlags,
|
||||||
@ -59,6 +60,14 @@ type
|
|||||||
bvLineBreak,
|
bvLineBreak,
|
||||||
bvPlaceHolder,
|
bvPlaceHolder,
|
||||||
bvFont,
|
bvFont,
|
||||||
|
bvPrompt,
|
||||||
|
bvRowHeight,
|
||||||
|
bvSectionHeaderHeigh,
|
||||||
|
bvSectionFooterHeight,
|
||||||
|
bvSeparatorStyle,
|
||||||
|
bvClipSubviews,
|
||||||
|
bvShowSelectionOnTouch,
|
||||||
|
bvBounceVertically,
|
||||||
bvEnabled);
|
bvEnabled);
|
||||||
|
|
||||||
TXIBProperty = record
|
TXIBProperty = record
|
||||||
@ -82,6 +91,7 @@ const
|
|||||||
(APropertyName: 'NSSuperview' ; ADefaultValue: ''),
|
(APropertyName: 'NSSuperview' ; ADefaultValue: ''),
|
||||||
(APropertyName: 'IBUINumberOfLines' ; ADefaultValue: '1'),
|
(APropertyName: 'IBUINumberOfLines' ; ADefaultValue: '1'),
|
||||||
(APropertyName: 'IBUIBackgroundColor' ; ADefaultValue: ''),
|
(APropertyName: 'IBUIBackgroundColor' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUISeparatorColor' ; ADefaultValue: ''),
|
||||||
(APropertyName: 'IBUIResizesToFullScreen' ; ADefaultValue: 'NO'),
|
(APropertyName: 'IBUIResizesToFullScreen' ; ADefaultValue: 'NO'),
|
||||||
(APropertyName: 'IBUIClearsContextBeforeDrawing' ; ADefaultValue: 'YES'),
|
(APropertyName: 'IBUIClearsContextBeforeDrawing' ; ADefaultValue: 'YES'),
|
||||||
(APropertyName: 'NSvFlags' ; ADefaultValue: '0'),
|
(APropertyName: 'NSvFlags' ; ADefaultValue: '0'),
|
||||||
@ -89,6 +99,14 @@ const
|
|||||||
(APropertyName: 'IBUILineBreakMode' ; ADefaultValue: '4'),
|
(APropertyName: 'IBUILineBreakMode' ; ADefaultValue: '4'),
|
||||||
(APropertyName: 'IBUIPlaceholder' ; ADefaultValue: ''),
|
(APropertyName: 'IBUIPlaceholder' ; ADefaultValue: ''),
|
||||||
(APropertyName: 'IBUIFontDescription' ; ADefaultValue: ''),
|
(APropertyName: 'IBUIFontDescription' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBPrompt' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUIRowHeight' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUISectionHeaderHeight' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUISectionFooterHeight' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUISeparatorStyle' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUIClipsSubviews' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUIShowsSelectionImmediatelyOnTouchBegin' ; ADefaultValue: ''),
|
||||||
|
(APropertyName: 'IBUIAlwaysBounceVertical' ; ADefaultValue: ''),
|
||||||
(APropertyName: 'IBUIEnabled' ; ADefaultValue: 'YES'));
|
(APropertyName: 'IBUIEnabled' ; ADefaultValue: 'YES'));
|
||||||
|
|
||||||
EventNames : array[1..1] of string = (
|
EventNames : array[1..1] of string = (
|
||||||
@ -258,7 +276,6 @@ type
|
|||||||
UIView = class(tiOSFakeComponent)
|
UIView = class(tiOSFakeComponent)
|
||||||
private
|
private
|
||||||
FNSNextResponder: UIView;
|
FNSNextResponder: UIView;
|
||||||
FBackgroundColor: TColor;
|
|
||||||
function GetFlags(AIndex: Integer): boolean;
|
function GetFlags(AIndex: Integer): boolean;
|
||||||
function GetNSSuperview: UIView;
|
function GetNSSuperview: UIView;
|
||||||
function ObtainSuperview: UIView;
|
function ObtainSuperview: UIView;
|
||||||
@ -474,40 +491,40 @@ type
|
|||||||
|
|
||||||
UITableView = class(UIView)
|
UITableView = class(UIView)
|
||||||
private
|
private
|
||||||
FClipSubviews: boolean;
|
function GetSeparatorStyle: TiOSFakeSeparatorStyle;
|
||||||
FRowHeight: float;
|
procedure SetSeparatorStyle(AValue: TiOSFakeSeparatorStyle);
|
||||||
FSectionFooterHeight: float;
|
|
||||||
FSectionHeaderHeight: float;
|
|
||||||
FSeparatorColor: TColor;
|
|
||||||
FSeparatorStyle: TiOSFakeSeparatorStyle;
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
procedure InitializeDefaults; override;
|
||||||
class function GetIBClassName: string; override;
|
class function GetIBClassName: string; override;
|
||||||
published
|
published
|
||||||
property RowHeight: float read FRowHeight write FRowHeight;
|
property RowHeight: double index bvRowHeight read GetXIBFloat write SetXIBFloat;
|
||||||
property SectionHeaderHeight: float read FSectionHeaderHeight write FSectionHeaderHeight;
|
property SectionHeaderHeight: double index bvSectionHeaderHeigh read GetXIBFloat write SetXIBFloat;
|
||||||
property SectionFooterHeight: float read FSectionFooterHeight write FSectionFooterHeight;
|
property SectionFooterHeight: double index bvSectionFooterHeight read GetXIBFloat write SetXIBFloat;
|
||||||
property SeparatorStyle: TiOSFakeSeparatorStyle read FSeparatorStyle write FSeparatorStyle;
|
property SeparatorStyle: TiOSFakeSeparatorStyle read GetSeparatorStyle write SetSeparatorStyle;
|
||||||
property SeparatorColor: TColor read FSeparatorColor write FSeparatorColor;
|
property SeparatorColor: TColor index bvSeparatorColor read GetXIBColor write SetXIBColor;
|
||||||
property ClipSubviews: boolean read FClipSubviews write FClipSubviews;
|
property BackgroundColor: TColor index bvBackgroundColor read GetXIBColor write SetXIBColor;
|
||||||
|
property ClipSubviews: boolean index bvClipSubviews read GetXIBBoolean write SetXIBBoolean;
|
||||||
|
property ShowSelectionOnTouch: boolean index bvShowSelectionOnTouch read GetXIBBoolean write SetXIBBoolean;
|
||||||
|
property BounceVertically: boolean index bvBounceVertically read GetXIBBoolean write SetXIBBoolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ UISearchBar }
|
{ UISearchBar }
|
||||||
|
|
||||||
UISearchBar = class(UIView)
|
UISearchBar = class(UIView)
|
||||||
private
|
private
|
||||||
FPlaceholder: string;
|
procedure SetPrompt(AIndex: TXIBProperties; AValue: string);
|
||||||
FPrompt: string;
|
protected
|
||||||
FText: string;
|
procedure SetBounds(NewLeft, NewTop, NewWidth, NewHeight: integer); override;
|
||||||
|
procedure paint(ACanvas: TCanvas); override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
procedure InitializeDefaults; override;
|
||||||
class function GetIBClassName: string; override;
|
class function GetIBClassName: string; override;
|
||||||
published
|
published
|
||||||
property Text: string read FText write FText;
|
property Caption;
|
||||||
property Placeholder: string read FPlaceholder write FPlaceholder;
|
property Placeholder: string index bvPlaceHolder read GetXIBString write SetXIBString;
|
||||||
property Prompt: string read FPrompt write FPrompt;
|
property Prompt: string index bvPrompt read GetXIBString write SetPrompt;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ UIProgressView }
|
{ UIProgressView }
|
||||||
@ -1654,11 +1671,11 @@ begin
|
|||||||
Brush.Style:=bsSolid;
|
Brush.Style:=bsSolid;
|
||||||
Brush.Color:=BackgroundColor;
|
Brush.Color:=BackgroundColor;
|
||||||
// outer frame
|
// outer frame
|
||||||
Pen.Color:=clRed;
|
Pen.Style:=psSolid;
|
||||||
|
Pen.Color:=clBlack;
|
||||||
Rectangle(0,0,self.Width,self.Height);
|
Rectangle(0,0,self.Width,self.Height);
|
||||||
if StatusBar<>sbsNone then
|
if StatusBar<>sbsNone then
|
||||||
begin
|
begin
|
||||||
Pen.Color:=clBlack;
|
|
||||||
if StatusBar = sbsBlack then
|
if StatusBar = sbsBlack then
|
||||||
Brush.Color:=clBlack
|
Brush.Color:=clBlack
|
||||||
else
|
else
|
||||||
@ -3028,27 +3045,76 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure UISearchBar.SetBounds(NewLeft, NewTop, NewWidth, NewHeight: integer);
|
||||||
|
begin
|
||||||
|
if Prompt<>'' then
|
||||||
|
NewHeight := 75
|
||||||
|
else
|
||||||
|
NewHeight := 44;
|
||||||
|
inherited SetBounds(NewLeft, NewTop, NewWidth, NewHeight);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure UISearchBar.paint(ACanvas: TCanvas);
|
||||||
|
var
|
||||||
|
ATop: integer;
|
||||||
|
ts: TTextStyle;
|
||||||
|
begin
|
||||||
|
with ACanvas do
|
||||||
|
begin
|
||||||
|
brush.Style := bsSolid;
|
||||||
|
pen.Color := $dfd5cd;
|
||||||
|
pen.style := psSolid;
|
||||||
|
if Prompt='' then
|
||||||
|
begin
|
||||||
|
ATop:=0;
|
||||||
|
Line(0,0,self.Width-1,0);
|
||||||
|
GradientFill(rect(0,ATop,self.Width, self.Height),$cdbcb0,$a2846d,gdVertical);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
brush.Color:=$cdbcb0;
|
||||||
|
pen.Color:=$cdbcb0;
|
||||||
|
ATop:=30;
|
||||||
|
Rectangle(0,0,self.Width-1,ATop);
|
||||||
|
Font.Size:=14;
|
||||||
|
Font.Italic:=false;
|
||||||
|
font.Bold:=false;
|
||||||
|
ts := TextStyle;
|
||||||
|
TS.Alignment:=taCenter;
|
||||||
|
TS.Layout:=tlCenter;
|
||||||
|
TextRect(rect(2,2,self.Width-3,ATop-2),2,2,Prompt,ts);
|
||||||
|
brush.Color:=$a2846d;
|
||||||
|
Rectangle(0,ATop,self.Width, self.Height);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Brush.Color:=clWhite;
|
||||||
|
pen.Style := psSolid;
|
||||||
|
pen.Color := $2d3642;
|
||||||
|
RoundRect(6,ATop+6,self.Width-7, self.Height-7,24,24);
|
||||||
|
Line(0,self.Height-1,self.Width-1,Self.Height-1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure UISearchBar.SetPrompt(AIndex: TXIBProperties; AValue: string);
|
||||||
|
begin
|
||||||
|
SetXIBString(AIndex,AValue);
|
||||||
|
SetHeight(-1);
|
||||||
|
end;
|
||||||
|
|
||||||
{ UISearchBar }
|
{ UISearchBar }
|
||||||
{
|
|
||||||
procedure UISearchBar.WriteToDomElement(AnObjectDomElement: TDOMElement);
|
|
||||||
begin
|
|
||||||
inherited WriteToDomElement(AnObjectDomElement);
|
|
||||||
AddIBString(AnObjectDomElement,'IBText',Text);
|
|
||||||
AddIBString(AnObjectDomElement,'IBPlaceholder',Placeholder);
|
|
||||||
AddIBString(AnObjectDomElement,'IBPrompt',Prompt);
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
constructor UISearchBar.Create(AOwner: TComponent);
|
constructor UISearchBar.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FAcceptChildsAtDesignTime:=false;
|
FAcceptChildsAtDesignTime:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor UISearchBar.Destroy;
|
procedure UISearchBar.InitializeDefaults;
|
||||||
begin
|
begin
|
||||||
inherited Destroy;
|
inherited InitializeDefaults;
|
||||||
|
Height:=44;
|
||||||
|
Width:=320;
|
||||||
|
Opaque:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function UISearchBar.GetIBClassName: string;
|
class function UISearchBar.GetIBClassName: string;
|
||||||
@ -3056,35 +3122,37 @@ begin
|
|||||||
Result:='IBUISearchBar';
|
Result:='IBUISearchBar';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ UITableView }
|
function UITableView.GetSeparatorStyle: TiOSFakeSeparatorStyle;
|
||||||
{
|
|
||||||
procedure UITableView.WriteToDomElement(AnObjectDomElement: TDOMElement);
|
|
||||||
begin
|
begin
|
||||||
inherited WriteToDomElement(AnObjectDomElement);
|
result := TiOSFakeSeparatorStyle(GetXIBInteger(bvSeparatorStyle));
|
||||||
AddIBFloat(AnObjectDomElement,'IBUIRowHeight',RowHeight);
|
|
||||||
AddIBFloat(AnObjectDomElement,'IBUISectionHeaderHeight',SectionHeaderHeight);
|
|
||||||
AddIBFloat(AnObjectDomElement,'IBUISectionFooterHeight',SectionFooterHeight);
|
|
||||||
AddIBInt(AnObjectDomElement,'IBUISeparatorStyle',ord(SeparatorStyle),0);
|
|
||||||
AddIBColor(AnObjectDomElement,'IBUISeparatorColor',SeparatorColor);
|
|
||||||
AddIBBoolean(AnObjectDomElement,'IBUIClipsSubviews',ClipSubviews);
|
|
||||||
end;
|
end;
|
||||||
}
|
|
||||||
|
procedure UITableView.SetSeparatorStyle(AValue: TiOSFakeSeparatorStyle);
|
||||||
|
begin
|
||||||
|
SetXIBInteger(bvSeparatorStyle, ord(AValue));
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ UITableView }
|
||||||
|
|
||||||
constructor UITableView.Create(AOwner: TComponent);
|
constructor UITableView.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FRowHeight:=44;
|
//FSeparatorColor:=clDefault;
|
||||||
FSectionFooterHeight:=22;
|
|
||||||
FSectionHeaderHeight:=22;
|
|
||||||
FSeparatorStyle:=ssSingleLine;
|
|
||||||
FSeparatorColor:=clDefault;
|
|
||||||
FClipSubviews:=true;
|
|
||||||
FAcceptChildsAtDesignTime:=false;
|
FAcceptChildsAtDesignTime:=false;
|
||||||
FBackgroundColor := clWhite;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor UITableView.Destroy;
|
procedure UITableView.InitializeDefaults;
|
||||||
begin
|
begin
|
||||||
inherited Destroy;
|
inherited InitializeDefaults;
|
||||||
|
RowHeight:=44;
|
||||||
|
SectionFooterHeight:=22;
|
||||||
|
SectionHeaderHeight:=22;
|
||||||
|
SeparatorStyle:=ssSingleLine;
|
||||||
|
Opaque:=true;
|
||||||
|
ClipSubviews:=true;
|
||||||
|
BackgroundColor:=clWhite;
|
||||||
|
ShowSelectionOnTouch:=true;
|
||||||
|
BounceVertically:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function UITableView.GetIBClassName: string;
|
class function UITableView.GetIBClassName: string;
|
||||||
@ -3513,7 +3581,6 @@ constructor UIView.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FAcceptChildsAtDesignTime:=true;
|
FAcceptChildsAtDesignTime:=true;
|
||||||
FBackgroundColor:=clDefault;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UIView.InitializeDefaults;
|
procedure UIView.InitializeDefaults;
|
||||||
|
Reference in New Issue
Block a user