mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 14:18:17 +02:00
declared TListItem.Position, TListItem.Top, TListItem.Left with implementation for win32 (0008426)
git-svn-id: trunk@10969 -
This commit is contained in:
parent
b3712f0b80
commit
7de0398b2a
@ -611,11 +611,14 @@ type
|
||||
FImageIndex: Integer;
|
||||
FStates: TListItemStates;
|
||||
function GetChecked: Boolean;
|
||||
function GetLeft: Integer;
|
||||
function GetListView: TCustomListView;
|
||||
function GetPosition: TPoint;
|
||||
function GetState(const ALisOrd: Integer): Boolean;
|
||||
function GetIndex: Integer;
|
||||
function GetSubItemImages(const AIndex: Integer): Integer;
|
||||
function GetSubItems: TStrings;
|
||||
function GetTop: Integer;
|
||||
|
||||
function WSUpdateAllowed: Boolean;
|
||||
procedure WSUpdateText;
|
||||
@ -625,9 +628,12 @@ type
|
||||
procedure SetState(const ALisOrd: Integer; const AIsSet: Boolean);
|
||||
procedure SetData(const AValue: Pointer);
|
||||
procedure SetImageIndex(const AValue: Integer);
|
||||
procedure SetLeft(Value: Integer);
|
||||
procedure SetCaption(const AValue : String);
|
||||
procedure SetPosition(const AValue: TPoint);
|
||||
procedure SetSubItemImages(const AIndex, AValue: Integer);
|
||||
procedure SetSubItems(const AValue: TStrings);
|
||||
procedure SetTop(Value: Integer);
|
||||
protected
|
||||
function IsEqual(const AItem: TListItem): Boolean;
|
||||
public
|
||||
@ -648,11 +654,14 @@ type
|
||||
property Focused: Boolean index Ord(lisFocused) read GetState write SetState;
|
||||
property Index: Integer read GetIndex;
|
||||
property ImageIndex: Integer read FImageIndex write SetImageIndex default -1;
|
||||
property Left: Integer read GetLeft write SetLeft;
|
||||
property ListView: TCustomListView read GetListView;
|
||||
property Owner: TListItems read FOwner;
|
||||
property Position: TPoint read GetPosition write SetPosition;
|
||||
property Selected: Boolean index Ord(lisSelected) read GetState write SetState;
|
||||
property SubItems: TStrings read GetSubItems write SetSubItems;
|
||||
property SubItemImages[const AIndex: Integer]: Integer read GetSubItemImages write SetSubItemImages;
|
||||
property Top: Integer read GetTop write SetTop;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -451,7 +451,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem GetChecked }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TListItem.GetChecked(): Boolean;
|
||||
function TListItem.GetChecked: Boolean;
|
||||
var
|
||||
LV: TCustomListView;
|
||||
begin
|
||||
@ -482,6 +482,11 @@ begin
|
||||
else Result := AState in FStates;
|
||||
end;
|
||||
|
||||
function TListItem.GetLeft: Integer;
|
||||
begin
|
||||
Result := Position.X;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ The ListView this ListItem belongs to }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -490,6 +495,14 @@ begin
|
||||
Result := Owner.Owner;
|
||||
end;
|
||||
|
||||
function TListItem.GetPosition: TPoint;
|
||||
var
|
||||
LV: TCustomListView;
|
||||
begin
|
||||
LV := FOwner.FOwner;
|
||||
Result := TWSCustomListViewClass(LV.WidgetSetClass).ItemGetPosition(LV, GetIndex);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem GetSubItemImages }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -508,6 +521,22 @@ begin
|
||||
Result := FSubItems;
|
||||
end;
|
||||
|
||||
function TListItem.GetTop: Integer;
|
||||
begin
|
||||
Result := Position.Y;
|
||||
end;
|
||||
|
||||
procedure TListItem.SetPosition(const AValue: TPoint);
|
||||
var
|
||||
LV: TCustomListView;
|
||||
CurPos: TPoint;
|
||||
begin
|
||||
LV := FOwner.FOwner;
|
||||
CurPos := Position;
|
||||
if (CurPos.X <> AValue.X) or (CurPos.Y <> AValue.Y) then
|
||||
TWSCustomListViewClass(LV.WidgetSetClass).ItemSetPosition(LV, GetIndex, AValue);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem MakeVisible }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -566,6 +595,11 @@ begin
|
||||
then TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemSetImage(FOwner.FOwner, GetIndex, Self, 0, FImageIndex);
|
||||
end;
|
||||
|
||||
procedure TListItem.SetLeft(Value: Integer);
|
||||
begin
|
||||
Position := Point(Value, Top);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem SetState }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -604,3 +638,9 @@ begin
|
||||
SubItems.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TListItem.SetTop(Value: Integer);
|
||||
begin
|
||||
Position := Point(Left, Value);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -103,10 +103,12 @@ type
|
||||
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 ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem): Boolean; override;
|
||||
class function ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; override;
|
||||
class function ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||
class procedure ItemInsert(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); override;
|
||||
class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); override;
|
||||
class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
|
||||
class function ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; override;
|
||||
class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
|
||||
class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
|
||||
|
@ -305,6 +305,14 @@ begin
|
||||
Result := SendMessage(ALV.Handle, LVM_GETITEMSTATE, AIndex, LVIS_STATEIMAGEMASK) shr 13 <> 0;
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListView.ItemGetPosition(
|
||||
const ALV: TCustomListView; const AIndex: Integer): TPoint;
|
||||
begin
|
||||
Result := Point(0, 0);
|
||||
if WSCheckHandleAllocated(ALV, 'ItemGetPosition') then
|
||||
SendMessage(ALV.Handle, LVM_GETITEMPOSITION, AIndex, LPARAM(@Result));
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListView.ItemGetState(const ALV: TCustomListView;
|
||||
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
||||
out AIsSet: Boolean): Boolean;
|
||||
@ -362,6 +370,15 @@ begin
|
||||
ListView_SetItem(ALV.Handle, lvi);
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListView.ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'ItemSetPosition') then
|
||||
Result := False
|
||||
else
|
||||
Result := SendMessage(ALV.Handle, LVM_SETITEMPOSITION,
|
||||
AIndex, MAKELPARAM(ANewPosition.X, ANewPosition.Y)) <> 0;
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomListView.ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean);
|
||||
const
|
||||
// lisCut, lisDropTarget, lisFocused, lisSelected
|
||||
|
@ -94,10 +94,12 @@ type
|
||||
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); virtual;
|
||||
class function ItemDisplayRect(const ALV: TCustomListView; const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; virtual;
|
||||
class function ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem): Boolean; virtual;
|
||||
class function ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; virtual;
|
||||
class function ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; virtual; // returns True if supported
|
||||
class procedure ItemInsert(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); virtual;
|
||||
class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); virtual;
|
||||
class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); virtual;
|
||||
class function ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; virtual;
|
||||
class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); virtual;
|
||||
class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); virtual;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); virtual;
|
||||
@ -286,6 +288,12 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
class function TWSCustomListView.ItemGetPosition(const ALV: TCustomListView;
|
||||
const AIndex: Integer): TPoint;
|
||||
begin
|
||||
Result := Point(0, 0);
|
||||
end;
|
||||
|
||||
class function TWSCustomListView.ItemGetState(const ALV: TCustomListView;
|
||||
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
||||
out AIsSet: Boolean): Boolean;
|
||||
@ -310,6 +318,12 @@ class procedure TWSCustomListView.ItemSetImage(const ALV: TCustomListView;
|
||||
begin
|
||||
end;
|
||||
|
||||
class function TWSCustomListView.ItemSetPosition(const ALV: TCustomListView;
|
||||
const AIndex: Integer; const ANewPosition: TPoint): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
class procedure TWSCustomListView.ItemSetState(const ALV: TCustomListView;
|
||||
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
||||
const AIsSet: Boolean);
|
||||
|
Loading…
Reference in New Issue
Block a user