mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 16:49:12 +02:00
Cocoa/ListView: implement ItemExchange() #41124, patch by David Jenkins with modification
This commit is contained in:
parent
72f42b17e1
commit
d713e3b541
@ -171,6 +171,7 @@ type
|
|||||||
// Item
|
// Item
|
||||||
procedure ItemDelete( const AIndex: Integer); override;
|
procedure ItemDelete( const AIndex: Integer); override;
|
||||||
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
||||||
|
procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
|
||||||
function ItemGetPosition( const AIndex: Integer): TPoint; override;
|
function ItemGetPosition( const AIndex: Integer): TPoint; override;
|
||||||
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||||
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); override;
|
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); override;
|
||||||
@ -1142,6 +1143,13 @@ begin
|
|||||||
Result:= NSRectToRect( frame );
|
Result:= NSRectToRect( frame );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCocoaWSListView_CollectionViewHandler.ItemExchange(
|
||||||
|
const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
// not supported yet
|
||||||
|
end;
|
||||||
|
|
||||||
function TCocoaWSListView_CollectionViewHandler.ItemGetPosition(
|
function TCocoaWSListView_CollectionViewHandler.ItemGetPosition(
|
||||||
const AIndex: Integer): TPoint;
|
const AIndex: Integer): TPoint;
|
||||||
var
|
var
|
||||||
|
@ -133,6 +133,7 @@ type
|
|||||||
// Item
|
// Item
|
||||||
procedure ItemDelete( const AIndex: Integer); virtual; abstract;
|
procedure ItemDelete( const AIndex: Integer); virtual; abstract;
|
||||||
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; virtual; abstract;
|
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; virtual; abstract;
|
||||||
|
procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); virtual; abstract;
|
||||||
function ItemGetPosition( const AIndex: Integer): TPoint; virtual; abstract;
|
function ItemGetPosition( const AIndex: Integer): TPoint; virtual; abstract;
|
||||||
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; virtual; abstract; // returns True if supported
|
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; virtual; abstract; // returns True if supported
|
||||||
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); virtual; abstract;
|
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); virtual; abstract;
|
||||||
|
@ -212,6 +212,7 @@ type
|
|||||||
// Item
|
// Item
|
||||||
procedure ItemDelete( const AIndex: Integer); override;
|
procedure ItemDelete( const AIndex: Integer); override;
|
||||||
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
||||||
|
procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
|
||||||
function ItemGetPosition( const AIndex: Integer): TPoint; override;
|
function ItemGetPosition( const AIndex: Integer): TPoint; override;
|
||||||
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||||
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); override;
|
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); override;
|
||||||
@ -1744,6 +1745,12 @@ begin
|
|||||||
Result:= NSRectToRect( frame );
|
Result:= NSRectToRect( frame );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCocoaWSListView_TableViewHandler.ItemExchange(
|
||||||
|
const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer);
|
||||||
|
begin
|
||||||
|
_tableView.lclExchangeItem( AIndex1, AIndex2 );
|
||||||
|
end;
|
||||||
|
|
||||||
function TCocoaWSListView_TableViewHandler.ItemGetPosition(
|
function TCocoaWSListView_TableViewHandler.ItemGetPosition(
|
||||||
const AIndex: Integer): TPoint;
|
const AIndex: Integer): TPoint;
|
||||||
var
|
var
|
||||||
@ -1757,12 +1764,18 @@ end;
|
|||||||
function TCocoaWSListView_TableViewHandler.ItemGetState(
|
function TCocoaWSListView_TableViewHandler.ItemGetState(
|
||||||
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
||||||
out AIsSet: Boolean): Boolean;
|
out AIsSet: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
lclcb : TLCLListViewCallback;
|
||||||
begin
|
begin
|
||||||
Result:= false;
|
Result:= false;
|
||||||
|
lclcb:= getCallback;
|
||||||
|
if NOT Assigned(lclcb) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
case AState of
|
case AState of
|
||||||
lisSelected: begin
|
lisSelected: begin
|
||||||
Result:= (AIndex>=0) and (AIndex <= _tableView.numberOfRows);
|
Result:= (AIndex>=0) and (AIndex <= _tableView.numberOfRows);
|
||||||
AIsSet:= _tableView.isRowSelected(AIndex);
|
AIsSet:= lclcb.getItemStableSelection( AIndex );
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -44,6 +44,7 @@ type
|
|||||||
// Item
|
// Item
|
||||||
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override;
|
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override;
|
||||||
class function ItemDisplayRect(const ALV: TCustomListView; const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
class function ItemDisplayRect(const ALV: TCustomListView; const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
||||||
|
class procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
|
||||||
class function ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem): Boolean; override;
|
class function ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem): Boolean; override;
|
||||||
class function ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; override;
|
class function ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; override;
|
||||||
class function ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
class function ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||||
@ -317,6 +318,16 @@ begin
|
|||||||
Result:= WSHandler.ItemDisplayRect( AIndex, ASubItem, ACode );
|
Result:= WSHandler.ItemDisplayRect( AIndex, ASubItem, ACode );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TCocoaWSCustomListView.ItemExchange(const ALV: TCustomListView;
|
||||||
|
AItem: TListItem; const AIndex1, AIndex2: Integer);
|
||||||
|
var
|
||||||
|
WSHandler: TCocoaWSListViewHandler;
|
||||||
|
begin
|
||||||
|
WSHandler:= getWSHandler( ALV );
|
||||||
|
if Assigned(WSHandler) then
|
||||||
|
WSHandler.ItemExchange(ALV, AItem, AIndex1, AIndex2);
|
||||||
|
end;
|
||||||
|
|
||||||
class function TCocoaWSCustomListView.ItemGetChecked(
|
class function TCocoaWSCustomListView.ItemGetChecked(
|
||||||
const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem
|
const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem
|
||||||
): Boolean;
|
): Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user