git-svn-id: trunk@10481 -
This commit is contained in:
marc 2007-01-20 02:19:19 +00:00
parent 86f8e3af32
commit 466edbbd14
11 changed files with 200 additions and 240 deletions

View File

@ -850,13 +850,13 @@ type
FSortColumn: Integer;
FImageChangeLink : TChangeLink;
FScrollBars: TScrollStyle;
FScrolledLeft: integer; // horizontal scrolled pixels (hidden pixels at top)
FScrolledTop: integer; // vertical scrolled pixels (hidden pixels at top)
FSelected: TListItem; // temp copy of the selected item
FFocused: TListItem; // temp copy of the focused item
FHoverTime: Integer; // temp copy of the hover time (the time a mouse must be over a item to auto select)
FLastHorzScrollInfo: TScrollInfo;
FLastVertScrollInfo: TScrollInfo;
FViewOriginCache: TPoint; // scrolled originwhile handle is not created
FSelected: TListItem; // temp copy of the selected item
FFocused: TListItem; // temp copy of the focused item
FHoverTime: Integer; // temp copy of the hover time (the time a mouse must be over a item to auto select)
// MWE: not used: see updateScrollbars
// FLastHorzScrollInfo: TScrollInfo;
// FLastVertScrollInfo: TScrollInfo;
FUpdateCount: integer;
FOnChange: TLVChangeEvent;
FOnColumnClick: TLVColumnClickEvent;
@ -897,11 +897,10 @@ type
procedure SetOwnerData(const AValue: Boolean);
procedure SetProperty(const ALvpOrd: Integer; const AIsSet: Boolean);
procedure SetScrollBars(const AValue: TScrollStyle);
procedure SetScrolledLeft(AValue: Integer);
procedure SetScrolledTop(AValue: Integer);
procedure SetSelection(const AValue: TListItem);
procedure SetSortColumn(const AValue: Integer);
procedure SetSortType(const AValue: TSortType);
procedure SetViewOrigin(AValue: TPoint);
procedure SetViewStyle(const Avalue: TViewStyle);
procedure Sort;
procedure UpdateScrollbars;
@ -914,6 +913,8 @@ type
protected
procedure InitializeWnd; override;
procedure FinalizeWnd; override;
procedure DestroyWnd; override;
procedure Change(AItem: TListItem; AChange: Integer); dynamic;
procedure ColClick(AColumn: TListColumn); dynamic;
@ -923,8 +924,6 @@ type
procedure DoInsert(AItem: TListItem); dynamic;
procedure DoSelectItem(AItem: TListItem; ASelected: Boolean); dynamic;
procedure InsertItem(Item : TListItem);
function GetMaxScrolledLeft : Integer;
function GetMaxScrolledTop : Integer;
procedure ImageChanged(Sender : TObject);
procedure Loaded; override;
@ -933,9 +932,6 @@ type
function CustomDrawItem(AItem: TListItem; AState: TCustomDrawState; AStage: TCustomDrawStage): Boolean; virtual; //
function CustomDrawSubItem(AItem: TListItem; ASubItem: Integer; AState: TCustomDrawState; AStage: TCustomDrawStage): Boolean; virtual; //
function IntfCustomDraw(ATarget: TCustomDrawTarget; AStage: TCustomDrawStage; AItem, ASubItem: Integer; AState: TCustomDrawState; const ARect: PRect): TCustomDrawResult;
procedure WMHScroll(var Msg: TLMScroll); message LM_HSCROLL;
procedure WMVScroll(var Msg: TLMScroll); message LM_VSCROLL;
protected
property AllocBy: Integer read FAllocBy write SetAllocBy default 0;
property BorderStyle default bsSingle;
@ -950,8 +946,6 @@ type
property OwnerData: Boolean read FOwnerData write SetOwnerData default False;
property OwnerDraw: Boolean index Ord(lvpOwnerDraw) read GetProperty write SetProperty default False;
property ReadOnly: Boolean index Ord(lvpReadOnly) read GetProperty write SetProperty default False;
property ScrolledLeft: integer read FScrolledLeft write SetScrolledLeft;
property ScrolledTop: integer read FScrolledTop write SetScrolledTop;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssBoth;
property ShowColumnHeaders: Boolean index Ord(lvpShowColumnHeaders) read GetProperty write SetProperty default True;
property ShowWorkAreas: Boolean index Ord(lvpShowWorkAreas) read GetProperty write SetProperty default False;
@ -996,7 +990,7 @@ type
property Selected: TListItem read GetSelection write SetSelection;
property TabStop default true;
property TopItem: TListItem read GetTopItem;
property ViewOrigin: TPoint read GetViewOrigin;
property ViewOrigin: TPoint read GetViewOrigin write SetViewOrigin;
property VisibleRowCount: Integer read GetVisibleRowCount;
end;

View File

@ -28,21 +28,6 @@ begin
FViewStyle := vsList;
FSortType := stNone;
// MWE:
// A class is initalized to 0 when created
// so no need to initialize these here again
(*
FSortColumn := 0;
FOnCompare := nil;
FOnCustomDraw := nil;
FOnCustomDrawItem := nil;
FOnCustomDrawSubItem := nil;
FOnAdvancedCustomDraw := nil;
FOnAdvancedCustomDrawItem := nil;
FOnAdvancedCustomDrawSubItem := nil;
FSelected := nil;
FFocused := nil;
*)
FImageChangeLink := TChangeLink.Create;
FImageChangeLink.OnChange := @ImageChanged;
FHoverTime := -1;
@ -287,8 +272,7 @@ begin
then LVC.SetImageList(Self, lvil, FImages[lvil]);
end;
LVC.SetScrollBars(Self, FScrollBars);
LVC.SetScrolledLeft(Self, FScrolledLeft);
LVC.SetScrolledTop(Self, FScrolledTop);
LVC.SetViewOrigin(Self, FViewOriginCache) ;
LVC.SetSort(Self, FSortType, FSortColumn);
// add items
@ -453,6 +437,23 @@ begin
OwnerFormDesignerModified(Self);
end;
{------------------------------------------------------------------------------}
{ TCustomListView SetViewOrigin }
{------------------------------------------------------------------------------}
procedure TCustomListView.SetViewOrigin(AValue: TPoint);
begin
if AValue.X < 0 then AValue.X := 0;
if AValue.Y < 0 then AValue.Y := 0;
if HandleAllocated
then begin
TWSCustomListViewClass(WidgetSetClass).SetViewOrigin(Self, AValue);
end
else begin
FViewOriginCache := AValue;
end;
end;
{------------------------------------------------------------------------------}
{ TCustomListView SetViewStyle }
{------------------------------------------------------------------------------}
@ -464,7 +465,6 @@ begin
TWSCustomListViewClass(WidgetSetClass).SetViewStyle(Self, AValue);
end;
{------------------------------------------------------------------------------}
{ TCustomListView SetSortType }
{------------------------------------------------------------------------------}
@ -587,6 +587,16 @@ begin
then TWSCustomListViewClass(WidgetSetClass).EndUpdate(Self);
end;
procedure TCustomListView.FinalizeWnd;
var
LVC: TWSCustomListViewClass;
begin
LVC := TWSCustomListViewClass(WidgetSetClass);
// store origin
FViewOriginCache := LVC.GetViewOrigin(Self);
inherited FinalizeWnd;
end;
function TCustomListView.FindCaption(StartIndex: Integer; Value: string;
Partial, Inclusive, Wrap: Boolean; PartStart: Boolean = True): TListItem;
begin
@ -692,11 +702,21 @@ begin
else Result := FListItems[idx];
end;
{------------------------------------------------------------------------------}
{ TCustomListView GetViewOrigin }
{------------------------------------------------------------------------------}
function TCustomListView.GetViewOrigin: TPoint;
begin
Result := Point(FScrolledLeft, FScrolledTop);
if HandleAllocated
then begin
Result := TWSCustomListViewClass(WidgetSetClass).GetViewOrigin(Self);
end
else begin
Result := FViewOriginCache;
end;
end;
function TCustomListView.GetVisibleRowCount: Integer;
begin
if ViewStyle in [vsReport, vsList]
@ -839,51 +859,31 @@ begin
UpdateScrollBars;
end;
procedure TCustomListView.SetScrolledLeft(AValue: integer);
begin
if AValue<0 then AValue:=0;
if AValue=FScrolledLeft then exit;
// if AValue>GetMaxScrolledLeft then AValue:=GetMaxScrolledLeft;
// if AValue=FScrolledLeft then exit;
FScrolledLeft:=AValue;
if not HandleAllocated then Exit;
TWSCustomListViewClass(WidgetSetClass).SetScrolledLeft(Self, AValue);
end;
procedure TCustomListView.SetScrolledTop(AValue: integer);
begin
if AValue<0 then AValue:=0;
if FScrolledTop=AValue then Exit;
// if AValue>GetMaxScrolledTop then AValue:=GetMaxScrolledTop;
// if AValue=FScrolledTop then Exit;
FScrolledTop:=AValue;
if not HandleAllocated then Exit;
TWSCustomListViewClass(WidgetSetClass).SetScrolledTop(Self, AValue);
end;
procedure TCustomListView.UpdateScrollbars;
var
ScrollInfo: TScrollInfo;
begin
// this needs to be done in the widgetset
DebugLn('TODO: TCustomListView.UpdateScrollbars');
exit;
if not HandleAllocated then exit
else
begin
if not HandleAllocated then exit;
{
// Exclude(FStates,tvsScrollbarChanged);
if fScrollBars <> ssNone then begin
ScrollInfo.cbSize := SizeOf(ScrollInfo);
ScrollInfo.fMask := SIF_ALL or SIF_DISABLENOSCROLL;
ScrollInfo.nTrackPos := 0;
if fScrollBars in [ssBoth, ssHorizontal] then begin
// horizontal scrollbar
ScrollInfo.nMin := 0;
ScrollInfo.nPage := (ClientWidth-ScrollBarWidth)-2*BorderWidth;
if ScrollInfo.nPage<1 then ScrollInfo.nPage:=1;
ScrollInfo.nMax := {GetMaxScrollLeft+}ScrollInfo.nPage;
if ScrollInfo.nMax<1 then ScrollInfo.nMax:=1;
ScrollInfo.nPos := FScrolledLeft;
if fScrollBars = ssNone then Exit;
ScrollInfo.cbSize := SizeOf(ScrollInfo);
ScrollInfo.fMask := SIF_ALL or SIF_DISABLENOSCROLL;
ScrollInfo.nTrackPos := 0;
if fScrollBars in [ssBoth, ssHorizontal]
then begin
// horizontal scrollbar
ScrollInfo.nMin := 0;
ScrollInfo.nPage := (ClientWidth-ScrollBarWidth)-2*BorderWidth;
if ScrollInfo.nPage<1 then ScrollInfo.nPage:=1;
ScrollInfo.nMax := {GetMaxScrollLeft+}ScrollInfo.nPage;
if ScrollInfo.nMax<1 then ScrollInfo.nMax:=1;
ScrollInfo.nPos := FScrolledLeft;
if not CompareMem(@ScrollInfo,@FLastHorzScrollInfo,SizeOf(TScrollInfo))
then begin
FLastHorzScrollInfo:=ScrollInfo;
@ -909,63 +909,6 @@ begin
end;
end;
end;
}
end;
procedure TCustomListView.WMHScroll(var Msg: TLMScroll);
begin
case Msg.ScrollCode of
// Scrolls to start / end of the text
SB_LEFT: ScrolledLeft := 0;
SB_RIGHT: ScrolledLeft := width{GetMaxScrollLeft};
// Scrolls one line left / right
SB_LINERIGHT: ScrolledLeft := ScrolledLeft + FDefaultItemHeight div 2;
SB_LINELEFT: ScrolledLeft := ScrolledLeft - FDefaultItemHeight div 2;
// Scrolls one page of lines left / right
SB_PAGERIGHT: ScrolledLeft := ScrolledLeft + (ClientHeight-ScrollBarWidth)
- FDefaultItemHeight;
SB_PAGELEFT: ScrolledLeft := ScrolledLeft - (ClientHeight-ScrollBarWidth)
+ FDefaultItemHeight;
// Scrolls to the current scroll bar position
SB_THUMBPOSITION,
SB_THUMBTRACK: ScrolledLeft := Msg.Pos;
// Ends scrolling
SB_ENDSCROLL: ;
end;
end;
procedure TCustomListView.WMVScroll(var Msg: TLMScroll);
begin
case Msg.ScrollCode of
// Scrolls to start / end of the text
SB_TOP: ScrolledTop := 0;
SB_BOTTOM: ScrolledTop := Height{GetMaxScrollTop};
// Scrolls one line up / down
SB_LINEDOWN: ScrolledTop := ScrolledTop + FDefaultItemHeight div 2;
SB_LINEUP: ScrolledTop := ScrolledTop - FDefaultItemHeight div 2;
// Scrolls one page of lines up / down
SB_PAGEDOWN: ScrolledTop := ScrolledTop + (ClientHeight-ScrollBarWidth)
- FDefaultItemHeight;
SB_PAGEUP: ScrolledTop := ScrolledTop - (ClientHeight-ScrollBarWidth)
+ FDefaultItemHeight;
// Scrolls to the current scroll bar position
SB_THUMBPOSITION,
SB_THUMBTRACK: ScrolledTop := Msg.Pos;
// Ends scrolling
SB_ENDSCROLL: ;
end;
end;
Function TCustomListView.GetMaxScrolledLeft : Integer;
begin
Result := 0;
end;
Function TCustomListView.GetMaxScrolledTop : Integer;
begin
Result := 0;
end;
// included by comctrls.pp

View File

@ -117,6 +117,7 @@ type
class function GetSelCount(const ALV: TCustomListView): Integer; override;
class function GetSelection(const ALV: TCustomListView): Integer; override;
class function GetTopItem(const ALV: TCustomListView): Integer; override;
class function GetViewOrigin(const ALV: TCustomListView): TPoint; override;
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
@ -128,9 +129,8 @@ type
class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
class procedure SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetScrolledTop(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer); override;
class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); override;
class procedure SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle); override;
{$ENDIF}
end;

View File

@ -1068,6 +1068,22 @@ begin
Result := -CListWidget^.voffset div (CListWidget^.row_height + 1);
end;
class function TGtkWSCustomListView.GetViewOrigin(const ALV: TCustomListView): TPoint;
var
WidgetInfo: PWidgetInfo;
CListWidget: PGtkCList;
begin
if not WSCheckHandleAllocated(ALV, 'GetViewOrigin')
then Exit;
WidgetInfo := GetWidgetInfo(Pointer(ALV.Handle));
CListWidget := PGtkCList(WidgetInfo^.CoreWidget);
if CListWidget=nil then exit;
Result.X := Round(CListWidget^.hAdjustment^.value);
Result.Y := Round(CListWidget^.vAdjustment^.value);
end;
class function TGtkWSCustomListView.GetVisibleRowCount(const ALV: TCustomListView): Integer;
var
WidgetInfo: PWidgetInfo;
@ -1292,35 +1308,6 @@ begin
gtk_scrolled_window_set_policy(ScrollWidget, hPolicy, vPolicy);
end;
class procedure TGtkWSCustomListView.SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer);
var
WidgetInfo: PWidgetInfo;
CListWidget: PGtkCList;
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledLeft')
then Exit;
WidgetInfo := GetWidgetInfo(Pointer(ALV.Handle));
CListWidget := PGtkCList(WidgetInfo^.CoreWidget);
gtk_adjustment_set_value(CListWidget^.hAdjustment, AValue);
end;
class procedure TGtkWSCustomListView.SetScrolledTop(const ALV: TCustomListView; const AValue: Integer);
var
WidgetInfo: PWidgetInfo;
CListWidget: PGtkCList;
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledTop')
then Exit;
WidgetInfo := GetWidgetInfo(Pointer(ALV.Handle));
CListWidget := PGtkCList(WidgetInfo^.CoreWidget);
if CListWidget=nil then exit;
gtk_adjustment_set_value(CListWidget^.vAdjustment, AValue);
end;
class procedure TGtkWSCustomListView.SetSort(const ALV: TCustomListView;
const AType: TSortType; const AColumn: Integer);
var
@ -1337,6 +1324,22 @@ begin
// TODO implement
end;
class procedure TGtkWSCustomListView.SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint);
var
WidgetInfo: PWidgetInfo;
CListWidget: PGtkCList;
begin
if not WSCheckHandleAllocated(ALV, 'SetViewOrigin')
then Exit;
WidgetInfo := GetWidgetInfo(Pointer(ALV.Handle));
CListWidget := PGtkCList(WidgetInfo^.CoreWidget);
if CListWidget=nil then exit;
gtk_adjustment_set_value(CListWidget^.hAdjustment, AValue.X);
gtk_adjustment_set_value(CListWidget^.vAdjustment, AValue.Y);
end;
class procedure TGtkWSCustomListView.SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle);
var
WidgetInfo: PWidgetInfo;

View File

@ -129,6 +129,7 @@ type
class function GetSelCount(const ALV: TCustomListView): Integer; override;
class function GetSelection(const ALV: TCustomListView): Integer; override;
class function GetTopItem(const ALV: TCustomListView): Integer; override;
class function GetViewOrigin(const ALV: TCustomListView): TPoint; override;
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
@ -140,9 +141,8 @@ type
class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
class procedure SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetScrolledTop(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer); override;
class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); override;
class procedure SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle); override;
end;

View File

@ -1071,6 +1071,22 @@ begin
then Exit;
end;
class function TGtk2WSCustomListView.GetViewOrigin(const ALV: TCustomListView): TPoint;
var
Widgets: PTVWidgets;
begin
if not WSCheckHandleAllocated(ALV, 'GetViewOrigin')
then begin
Result := Point(0, 0);
Exit;
end;
GetCommonTreeViewWidgets(PGtkWidget(ALV.Handle), Widgets);
// not really needed to retrieve the adjustments, since the TVWidgets has this info also based on events
Result := Point(Widgets^.ScrollingData.HValue, Widgets^.ScrollingData.VValue);
end;
class function TGtk2WSCustomListView.GetVisibleRowCount(const ALV: TCustomListView
): Integer;
begin
@ -1171,36 +1187,6 @@ begin
gtk_scrolled_window_set_policy(ScrollWidget, hPolicy, vPolicy);
end;
class procedure TGtk2WSCustomListView.SetScrolledLeft(const ALV: TCustomListView;
const AValue: Integer);
var
Widgets: PTVWidgets;
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledLeft')
then Exit;
GetCommonTreeViewWidgets(PGtkWidget(ALV.Handle), Widgets);
with Widgets^ do begin
gtk_tree_view_scroll_to_point(PGtkTreeView(MainView), AValue, -1);
end;
end;
class procedure TGtk2WSCustomListView.SetScrolledTop(const ALV: TCustomListView;
const AValue: Integer);
var
Widgets: PTVWidgets;
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledTop')
then Exit;
GetCommonTreeViewWidgets(PGtkWidget(ALV.Handle), Widgets);
with Widgets^ do begin
gtk_tree_view_scroll_to_point(PGtkTreeView(MainView), -1, AValue);
end;
end;
class procedure TGtk2WSCustomListView.SetSort(const ALV: TCustomListView;
const AType: TSortType; const AColumn: Integer);
begin
@ -1209,6 +1195,17 @@ begin
// inherited SetSort(ALV, AType, AColumn);
end;
class procedure TGtk2WSCustomListView.SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint);
var
Widgets: PTVWidgets;
begin
if not WSCheckHandleAllocated(ALV, 'SetViewOrigin')
then Exit;
GetCommonTreeViewWidgets(PGtkWidget(ALV.Handle), Widgets);
gtk_tree_view_scroll_to_point(PGtkTreeView(Widgets^.MainView), AValue.X, AValue.Y);
end;
class procedure TGtk2WSCustomListView.SetViewStyle(const ALV: TCustomListView;
const Avalue: TViewStyle);

View File

@ -125,6 +125,7 @@ type
class function GetSelCount(const ALV: TCustomListView): Integer; override;
class function GetSelection(const ALV: TCustomListView): Integer; override;
class function GetTopItem(const ALV: TCustomListView): Integer; override;
class function GetViewOrigin(const ALV: TCustomListView): TPoint; override;
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
@ -136,9 +137,8 @@ type
class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
class procedure SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetScrolledTop(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer); override;
class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); override;
class procedure SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle); override;
end;

View File

@ -520,6 +520,17 @@ begin
end;
end;
class function TWin32WSCustomListView.GetViewOrigin(const ALV: TCustomListView): TPoint;
begin
if not WSCheckHandleAllocated(ALV, 'GetViewOrigin')
then begin
Result := Point(0, 0);
Exit;
end;
ListView_GetOrigin(ALV.Handle, Result);
end;
class function TWin32WSCustomListView.GetVisibleRowCount(const ALV: TCustomListView): Integer;
begin
Result := 0;
@ -715,22 +726,6 @@ begin
else UpdateStyle(ALV.Handle, LVS_NOSCROLL, 0);
end;
class procedure TWin32WSCustomListView.SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer);
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledLeft')
then Exit;
ListView_Scroll(ALV.Handle, AValue, 0);
end;
class procedure TWin32WSCustomListView.SetScrolledTop(const ALV: TCustomListView; const AValue: Integer);
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledTop')
then Exit;
ListView_Scroll(ALV.Handle, 0, AValue);
end;
class procedure TWin32WSCustomListView.SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer);
begin
if not WSCheckHandleAllocated(ALV, 'SetSort')
@ -739,6 +734,22 @@ begin
// TODO: implement
end;
class procedure TWin32WSCustomListView.SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint);
var
dx, dy: Integer;
Origin: TPoint;
begin
if not WSCheckHandleAllocated(ALV, 'SetViewOrigin')
then Exit;
ListView_GetOrigin(ALV.Handle, Origin);
dx := AValue.X - Origin.X;
dy := AValue.Y - Origin.Y;
if (dx <> 0) or (dy <> 0)
then ListView_Scroll(ALV.Handle, dx, dy);
end;
class procedure TWin32WSCustomListView.SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle);
const
//vsIcon, vsSmallIcon, vsList, vsReport

View File

@ -119,6 +119,7 @@ type
class function GetSelCount(const ALV: TCustomListView): Integer; override;
class function GetSelection(const ALV: TCustomListView): Integer; override;
class function GetTopItem(const ALV: TCustomListView): Integer; override;
class function GetViewOrigin(const ALV: TCustomListView): TPoint; override;
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override;
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override;
@ -130,9 +131,8 @@ type
class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
class procedure SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetScrolledTop(const ALV: TCustomListView; const AValue: Integer); override;
class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer); override;
class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); override;
class procedure SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle); override;
end;

View File

@ -463,6 +463,17 @@ begin
end;
end;
class function TWinCEWSCustomListView.GetViewOrigin(const ALV: TCustomListView): TPoint;
begin
if not WSCheckHandleAllocated(ALV, 'GetViewOrigin')
then begin
Result := Point(0, 0);
Exit;
end;
ListView_GetOrigin(ALV.Handle, Result);
end;
class function TWinCEWSCustomListView.GetVisibleRowCount(const ALV: TCustomListView): Integer;
begin
if not WSCheckHandleAllocated(ALV, 'GetVisibleRowCount')
@ -660,22 +671,6 @@ begin
else UpdateStyle(ALV.Handle, LVS_NOSCROLL, 0);
end;
class procedure TWinCEWSCustomListView.SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer);
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledLeft')
then Exit;
ListView_Scroll(ALV.Handle, AValue, 0);
end;
class procedure TWinCEWSCustomListView.SetScrolledTop(const ALV: TCustomListView; const AValue: Integer);
begin
if not WSCheckHandleAllocated(ALV, 'SetScrolledTop')
then Exit;
ListView_Scroll(ALV.Handle, 0, AValue);
end;
class procedure TWinCEWSCustomListView.SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer);
begin
if not WSCheckHandleAllocated(ALV, 'SetSort')
@ -684,6 +679,22 @@ begin
// TODO: implement
end;
class procedure TWinCEWSCustomListView.SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint);
var
dx, dy: Integer;
Origin: TPoint;
begin
if not WSCheckHandleAllocated(ALV, 'SetViewOrigin')
then Exit;
ListView_GetOrigin(ALV.Handle, Origin);
dx := AValue.X - Origin.X;
dy := AValue.Y - Origin.Y;
if (dx <> 0) or (dy <> 0)
then ListView_Scroll(ALV.Handle, dx, dy);
end;
class procedure TWinCEWSCustomListView.SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle);
const
//vsIcon, vsSmallIcon, vsList, vsReport

View File

@ -114,6 +114,7 @@ type
class function GetSelCount(const ALV: TCustomListView): Integer; virtual;
class function GetSelection(const ALV: TCustomListView): Integer; virtual;
class function GetTopItem(const ALV: TCustomListView): Integer; virtual;
class function GetViewOrigin(const ALV: TCustomListView): TPoint; virtual;
class function GetVisibleRowCount(const ALV: TCustomListView): Integer; virtual;
class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); virtual;
@ -125,9 +126,8 @@ type
class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); virtual;
class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); virtual;
class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); virtual;
class procedure SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer); virtual;
class procedure SetScrolledTop(const ALV: TCustomListView; const AValue: Integer); virtual;
class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer); virtual;
class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); virtual;
class procedure SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle); virtual;
end;
@ -375,6 +375,11 @@ begin
Result := -1;
end;
class function TWSCustomListView.GetViewOrigin(const ALV: TCustomListView): TPoint;
begin
Result := Point(0, 0);
end;
class function TWSCustomListView.GetVisibleRowCount(const ALV: TCustomListView): Integer;
begin
Result := 0;
@ -412,18 +417,14 @@ class procedure TWSCustomListView.SetScrollBars(const ALV: TCustomListView; cons
begin
end;
class procedure TWSCustomListView.SetScrolledLeft(const ALV: TCustomListView; const AValue: Integer);
begin
end;
class procedure TWSCustomListView.SetScrolledTop(const ALV: TCustomListView; const AValue: Integer);
begin
end;
class procedure TWSCustomListView.SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer);
begin
end;
class procedure TWSCustomListView.SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint);
begin
end;
class procedure TWSCustomListView.SetViewStyle(const ALV: TCustomListView; const Avalue: TViewStyle);
begin
end;