mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 21:00:43 +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;
|
FImageIndex: Integer;
|
||||||
FStates: TListItemStates;
|
FStates: TListItemStates;
|
||||||
function GetChecked: Boolean;
|
function GetChecked: Boolean;
|
||||||
|
function GetLeft: Integer;
|
||||||
function GetListView: TCustomListView;
|
function GetListView: TCustomListView;
|
||||||
|
function GetPosition: TPoint;
|
||||||
function GetState(const ALisOrd: Integer): Boolean;
|
function GetState(const ALisOrd: Integer): Boolean;
|
||||||
function GetIndex: Integer;
|
function GetIndex: Integer;
|
||||||
function GetSubItemImages(const AIndex: Integer): Integer;
|
function GetSubItemImages(const AIndex: Integer): Integer;
|
||||||
function GetSubItems: TStrings;
|
function GetSubItems: TStrings;
|
||||||
|
function GetTop: Integer;
|
||||||
|
|
||||||
function WSUpdateAllowed: Boolean;
|
function WSUpdateAllowed: Boolean;
|
||||||
procedure WSUpdateText;
|
procedure WSUpdateText;
|
||||||
@ -625,9 +628,12 @@ type
|
|||||||
procedure SetState(const ALisOrd: Integer; const AIsSet: Boolean);
|
procedure SetState(const ALisOrd: Integer; const AIsSet: Boolean);
|
||||||
procedure SetData(const AValue: Pointer);
|
procedure SetData(const AValue: Pointer);
|
||||||
procedure SetImageIndex(const AValue: Integer);
|
procedure SetImageIndex(const AValue: Integer);
|
||||||
|
procedure SetLeft(Value: Integer);
|
||||||
procedure SetCaption(const AValue : String);
|
procedure SetCaption(const AValue : String);
|
||||||
|
procedure SetPosition(const AValue: TPoint);
|
||||||
procedure SetSubItemImages(const AIndex, AValue: Integer);
|
procedure SetSubItemImages(const AIndex, AValue: Integer);
|
||||||
procedure SetSubItems(const AValue: TStrings);
|
procedure SetSubItems(const AValue: TStrings);
|
||||||
|
procedure SetTop(Value: Integer);
|
||||||
protected
|
protected
|
||||||
function IsEqual(const AItem: TListItem): Boolean;
|
function IsEqual(const AItem: TListItem): Boolean;
|
||||||
public
|
public
|
||||||
@ -648,11 +654,14 @@ type
|
|||||||
property Focused: Boolean index Ord(lisFocused) read GetState write SetState;
|
property Focused: Boolean index Ord(lisFocused) read GetState write SetState;
|
||||||
property Index: Integer read GetIndex;
|
property Index: Integer read GetIndex;
|
||||||
property ImageIndex: Integer read FImageIndex write SetImageIndex default -1;
|
property ImageIndex: Integer read FImageIndex write SetImageIndex default -1;
|
||||||
|
property Left: Integer read GetLeft write SetLeft;
|
||||||
property ListView: TCustomListView read GetListView;
|
property ListView: TCustomListView read GetListView;
|
||||||
property Owner: TListItems read FOwner;
|
property Owner: TListItems read FOwner;
|
||||||
|
property Position: TPoint read GetPosition write SetPosition;
|
||||||
property Selected: Boolean index Ord(lisSelected) read GetState write SetState;
|
property Selected: Boolean index Ord(lisSelected) read GetState write SetState;
|
||||||
property SubItems: TStrings read GetSubItems write SetSubItems;
|
property SubItems: TStrings read GetSubItems write SetSubItems;
|
||||||
property SubItemImages[const AIndex: Integer]: Integer read GetSubItemImages write SetSubItemImages;
|
property SubItemImages[const AIndex: Integer]: Integer read GetSubItemImages write SetSubItemImages;
|
||||||
|
property Top: Integer read GetTop write SetTop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TListItem GetChecked }
|
{ TListItem GetChecked }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TListItem.GetChecked(): Boolean;
|
function TListItem.GetChecked: Boolean;
|
||||||
var
|
var
|
||||||
LV: TCustomListView;
|
LV: TCustomListView;
|
||||||
begin
|
begin
|
||||||
@ -482,6 +482,11 @@ begin
|
|||||||
else Result := AState in FStates;
|
else Result := AState in FStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TListItem.GetLeft: Integer;
|
||||||
|
begin
|
||||||
|
Result := Position.X;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ The ListView this ListItem belongs to }
|
{ The ListView this ListItem belongs to }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -490,6 +495,14 @@ begin
|
|||||||
Result := Owner.Owner;
|
Result := Owner.Owner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TListItem.GetPosition: TPoint;
|
||||||
|
var
|
||||||
|
LV: TCustomListView;
|
||||||
|
begin
|
||||||
|
LV := FOwner.FOwner;
|
||||||
|
Result := TWSCustomListViewClass(LV.WidgetSetClass).ItemGetPosition(LV, GetIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TListItem GetSubItemImages }
|
{ TListItem GetSubItemImages }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -508,6 +521,22 @@ begin
|
|||||||
Result := FSubItems;
|
Result := FSubItems;
|
||||||
end;
|
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 }
|
{ TListItem MakeVisible }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -566,6 +595,11 @@ begin
|
|||||||
then TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemSetImage(FOwner.FOwner, GetIndex, Self, 0, FImageIndex);
|
then TWSCustomListViewClass(FOwner.FOwner.WidgetSetClass).ItemSetImage(FOwner.FOwner, GetIndex, Self, 0, FImageIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TListItem.SetLeft(Value: Integer);
|
||||||
|
begin
|
||||||
|
Position := Point(Value, Top);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TListItem SetState }
|
{ TListItem SetState }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -604,3 +638,9 @@ begin
|
|||||||
SubItems.Assign(AValue);
|
SubItems.Assign(AValue);
|
||||||
end;
|
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 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 function ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem): Boolean; 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 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 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 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 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 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 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;
|
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;
|
Result := SendMessage(ALV.Handle, LVM_GETITEMSTATE, AIndex, LVIS_STATEIMAGEMASK) shr 13 <> 0;
|
||||||
end;
|
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;
|
class function TWin32WSCustomListView.ItemGetState(const ALV: TCustomListView;
|
||||||
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;
|
||||||
@ -362,6 +370,15 @@ begin
|
|||||||
ListView_SetItem(ALV.Handle, lvi);
|
ListView_SetItem(ALV.Handle, lvi);
|
||||||
end;
|
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);
|
class procedure TWin32WSCustomListView.ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean);
|
||||||
const
|
const
|
||||||
// lisCut, lisDropTarget, lisFocused, lisSelected
|
// lisCut, lisDropTarget, lisFocused, lisSelected
|
||||||
|
@ -94,10 +94,12 @@ type
|
|||||||
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); virtual;
|
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 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 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 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 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 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 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 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 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;
|
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); virtual;
|
||||||
@ -286,6 +288,12 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
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;
|
class function TWSCustomListView.ItemGetState(const ALV: TCustomListView;
|
||||||
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;
|
||||||
@ -310,6 +318,12 @@ class procedure TWSCustomListView.ItemSetImage(const ALV: TCustomListView;
|
|||||||
begin
|
begin
|
||||||
end;
|
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;
|
class procedure TWSCustomListView.ItemSetState(const ALV: TCustomListView;
|
||||||
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
||||||
const AIsSet: Boolean);
|
const AIsSet: Boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user