mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 21:10:42 +02:00
Cocoa: move CocoaTables.TCocoaStringList to CocoaListControl.TCocoaListControlStringList
This commit is contained in:
parent
cfcda960d2
commit
00f0bda2b1
@ -82,6 +82,19 @@ type
|
||||
function isCustomDrawSupported: Boolean; virtual; abstract;
|
||||
end;
|
||||
|
||||
{ TCocoaListControlStringList }
|
||||
|
||||
TCocoaListControlStringList = class(TStringList)
|
||||
protected
|
||||
procedure Changed; override;
|
||||
public
|
||||
Owner: NSTableView;
|
||||
// some notificaitons (i.e. selection change)
|
||||
// should not be passed to LCL while clearing
|
||||
isClearing: Boolean;
|
||||
constructor Create(AOwner: NSTableView);
|
||||
procedure Clear; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -112,5 +125,29 @@ begin
|
||||
Result:= _checkedIndexSet;
|
||||
end;
|
||||
|
||||
{ TCocoaListControlStringList }
|
||||
|
||||
procedure TCocoaListControlStringList.Changed;
|
||||
begin
|
||||
inherited Changed;
|
||||
Owner.reloadData;
|
||||
end;
|
||||
|
||||
constructor TCocoaListControlStringList.Create(AOwner: NSTableView);
|
||||
begin
|
||||
Owner:=AOwner;
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
procedure TCocoaListControlStringList.Clear;
|
||||
begin
|
||||
isClearing := true;
|
||||
try
|
||||
inherited Clear;
|
||||
finally
|
||||
isClearing := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -33,20 +33,6 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{ TCocoaStringList }
|
||||
|
||||
TCocoaStringList = class(TStringList)
|
||||
protected
|
||||
procedure Changed; override;
|
||||
public
|
||||
Owner: NSTableView;
|
||||
// some notificaitons (i.e. selection change)
|
||||
// should not be passed to LCL while clearing
|
||||
isClearing: Boolean;
|
||||
constructor Create(AOwner: NSTableView);
|
||||
procedure Clear; override;
|
||||
end;
|
||||
|
||||
{ TCocoaTableListItem }
|
||||
|
||||
TCocoaTableListItem = objcclass(NSTableCellView)
|
||||
@ -1051,30 +1037,6 @@ begin
|
||||
self.reloadData;
|
||||
end;
|
||||
|
||||
{ TCocoaStringList }
|
||||
|
||||
procedure TCocoaStringList.Changed;
|
||||
begin
|
||||
inherited Changed;
|
||||
Owner.reloadData;
|
||||
end;
|
||||
|
||||
constructor TCocoaStringList.Create(AOwner: NSTableView);
|
||||
begin
|
||||
Owner:=AOwner;
|
||||
inherited Create;
|
||||
end;
|
||||
|
||||
procedure TCocoaStringList.Clear;
|
||||
begin
|
||||
isClearing := true;
|
||||
try
|
||||
inherited Clear;
|
||||
finally
|
||||
isClearing := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TCocoaTableListItem }
|
||||
|
||||
function TCocoaTableListItem.checkBox: NSButton;
|
||||
|
@ -30,13 +30,13 @@ uses
|
||||
WSCheckLst, WSLCLClasses,
|
||||
// LCL Cocoa
|
||||
CocoaWSCommon, CocoaPrivate, CocoaCallback, CocoaWSStdCtrls,
|
||||
CocoaTables, CocoaScrollers, CocoaWSScrollers;
|
||||
CocoaListControl, CocoaTables, CocoaScrollers, CocoaWSScrollers;
|
||||
|
||||
type
|
||||
|
||||
{ TCocoaCheckStringList }
|
||||
|
||||
TCocoaCheckStringList = class(TCocoaStringList)
|
||||
TCocoaCheckStringList = class(TCocoaListControlStringList)
|
||||
protected
|
||||
procedure ExchangeItems(Index1, Index2: Integer); override;
|
||||
public
|
||||
@ -50,7 +50,7 @@ type
|
||||
|
||||
TLCLCheckboxListCallback = class(TLCLListBoxCallback)
|
||||
protected
|
||||
function AllocStrings(ATable: NSTableView): TCocoaStringList; override;
|
||||
function AllocStrings(ATable: NSTableView): TCocoaListControlStringList; override;
|
||||
public
|
||||
checklist: TCustomCheckListBox;
|
||||
constructor Create(AOwner: NSObject; ATarget: TWinControl; AHandleView: NSView); override;
|
||||
@ -71,8 +71,6 @@ type
|
||||
class procedure SetState(const ACheckListBox: TCustomCheckListBox; const AIndex: integer; const AState: TCheckBoxState); override;
|
||||
end;
|
||||
|
||||
function CtrlToCheckList(ctrl: TWinControl; out tbl: TCocoaTableListView; out cb: TLCLCheckboxListCallback): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
function CtrlToCheckList(ctrl: TWinControl; out tbl: TCocoaTableListView; out cb: TLCLCheckboxListCallback): Boolean;
|
||||
@ -139,7 +137,7 @@ end;
|
||||
|
||||
{ TLCLCheckboxListCallback }
|
||||
|
||||
function TLCLCheckboxListCallback.AllocStrings(ATable: NSTableView): TCocoaStringList;
|
||||
function TLCLCheckboxListCallback.AllocStrings(ATable: NSTableView): TCocoaListControlStringList;
|
||||
begin
|
||||
Result:=TCocoaCheckStringList.Create(ATable);
|
||||
end;
|
||||
|
@ -272,10 +272,10 @@ type
|
||||
|
||||
TLCLListBoxCallback = class(TLCLListControlCallback)
|
||||
protected
|
||||
function AllocStrings(ATable: NSTableView): TCocoaStringList; virtual;
|
||||
function AllocStrings(ATable: NSTableView): TCocoaListControlStringList; virtual;
|
||||
public
|
||||
listview : TCocoaTableListView;
|
||||
strings : TCocoaStringList;
|
||||
strings : TCocoaListControlStringList;
|
||||
constructor CreateWithView(AOwner: TCocoaTableListView; ATarget: TWinControl);
|
||||
destructor Destroy; override;
|
||||
function ItemsCount: Integer; override;
|
||||
@ -601,9 +601,9 @@ end;
|
||||
{ TLCLListBoxCallback }
|
||||
|
||||
function TLCLListBoxCallback.AllocStrings(ATable: NSTableView
|
||||
): TCocoaStringList;
|
||||
): TCocoaListControlStringList;
|
||||
begin
|
||||
Result := TCocoaStringList.Create(ATable);
|
||||
Result := TCocoaListControlStringList.Create(ATable);
|
||||
end;
|
||||
|
||||
constructor TLCLListBoxCallback.CreateWithView(AOwner: TCocoaTableListView;
|
||||
|
Loading…
Reference in New Issue
Block a user