mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 00:19:32 +02:00
MG: added scrollbars for TListView
git-svn-id: trunk@1708 -
This commit is contained in:
parent
784fb02b29
commit
ee79b89293
@ -272,6 +272,8 @@ type
|
||||
FSelected: TListItem; // temp copy of the selected item
|
||||
FLastHorzScrollInfo: TScrollInfo;
|
||||
FLastVertScrollInfo: TScrollInfo;
|
||||
FUpdateCount: integer;
|
||||
FUpdateNeeded: boolean;
|
||||
FOnChange: TLVChangeEvent;
|
||||
FOnColumnClick: TLVColumnClickEvent;
|
||||
FOnSelectItem: TLVSelectItemEvent;
|
||||
@ -290,6 +292,7 @@ type
|
||||
procedure SetViewStyle (const Avalue: TViewStyle);
|
||||
procedure UpdateScrollbars;
|
||||
procedure CNNotify(var AMessage: TLMNotify); message CN_NOTIFY;
|
||||
procedure DoUpdate;
|
||||
protected
|
||||
ParentWindow : TScrolledWindow;
|
||||
procedure Change(AItem: TListItem; AChange: Integer); dynamic;
|
||||
@ -328,6 +331,8 @@ type
|
||||
public
|
||||
constructor Create(Aowner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
property Selected: TListItem read GetSelection write SetSelection;
|
||||
end;
|
||||
|
||||
@ -354,7 +359,7 @@ type
|
||||
property SortColumn;
|
||||
property Visible;
|
||||
property ViewStyle;
|
||||
property OnMOuseMOve;
|
||||
property OnMouseMove;
|
||||
property OnChange;
|
||||
property OnClick;
|
||||
property OnColumnClick;
|
||||
@ -1559,6 +1564,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.36 2002/05/28 14:58:29 lazarus
|
||||
MG: added scrollbars for TListView
|
||||
|
||||
Revision 1.35 2002/05/20 14:19:03 lazarus
|
||||
MG: activated the clientrect bugfixes
|
||||
|
||||
|
@ -40,13 +40,9 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
Procedure TCustomListView.ColumnsChanged;
|
||||
Begin
|
||||
if csDestroying in Componentstate Then Exit;
|
||||
//TODO: Optimize implementation by invoking individual upadates instead of
|
||||
// recreating window
|
||||
//notify the interface....
|
||||
RecreateWnd;
|
||||
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||
end;
|
||||
FUpdateNeeded:=true;
|
||||
DoUpdate;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView Change }
|
||||
@ -135,6 +131,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TCustomListView DoUpdate
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.DoUpdate;
|
||||
begin
|
||||
if FUpdateCount>0 then exit;
|
||||
if not FUpdateNeeded then exit;
|
||||
FUpdateNeeded:=false;
|
||||
if csDestroying in Componentstate Then Exit;
|
||||
//TODO: Optimize implementation by invoking individual upadates instead of
|
||||
// recreating window
|
||||
//notify the interface....
|
||||
RecreateWnd;
|
||||
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView DoSelectItem }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -149,8 +161,11 @@ end;
|
||||
Procedure TCustomListView.ItemChanged(Index : Integer); //called by TListItems
|
||||
Begin
|
||||
if csDestroying in Componentstate Then Exit;
|
||||
//notify the interface....
|
||||
CNSendMessage(LM_LV_CHANGEITEM,self,@Index);
|
||||
if FUpdateCount>0 then
|
||||
FUpdateNeeded:=true
|
||||
else
|
||||
//notify the interface....
|
||||
CNSendMessage(LM_LV_CHANGEITEM,self,@Index);
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -158,8 +173,12 @@ End;
|
||||
{------------------------------------------------------------------------------}
|
||||
Procedure TCustomListView.ItemDeleted(Index : Integer); //called by TListItems
|
||||
Begin
|
||||
//notify the interface....
|
||||
CNSendMessage(LM_LV_DELETEITEM,self,@Index);
|
||||
if csDestroying in Componentstate Then Exit;
|
||||
if FUpdateCount>0 then
|
||||
FUpdateNeeded:=true
|
||||
else
|
||||
//notify the interface....
|
||||
CNSendMessage(LM_LV_DELETEITEM,self,@Index);
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -167,8 +186,12 @@ End;
|
||||
{------------------------------------------------------------------------------}
|
||||
Procedure TCustomListView.ItemAdded;
|
||||
Begin
|
||||
//notify the interface....
|
||||
CNSendMessage(LM_LV_ADDITEM,self,nil);
|
||||
if csDestroying in Componentstate Then Exit;
|
||||
if FUpdateCount>0 then
|
||||
FUpdateNeeded:=true
|
||||
else
|
||||
//notify the interface....
|
||||
CNSendMessage(LM_LV_ADDITEM,self,nil);
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -242,6 +265,30 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TCustomListView BeginUpdate
|
||||
Params: None
|
||||
Result: none
|
||||
|
||||
Increases the update count. Use this procedure before any big change, so that
|
||||
the interface will not show any single step.
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.BeginUpdate;
|
||||
begin
|
||||
inc(FUpdateCount);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView GetSelection }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.EndUpdate;
|
||||
begin
|
||||
if FUpdateCount=0 then exit;
|
||||
dec(FUpdateCount);
|
||||
if FUpdateCount>0 then exit;
|
||||
DoUpdate;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView GetSelection }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -287,8 +334,12 @@ end;
|
||||
|
||||
Procedure TCustomListView.ImageChanged(Sender : TObject);
|
||||
begin
|
||||
//image changed so redraw it all....
|
||||
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||
if csDestroying in Componentstate Then Exit;
|
||||
if FUpdateCount>0 then
|
||||
FUpdateNeeded:=true
|
||||
else
|
||||
//image changed so redraw it all....
|
||||
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||
end;
|
||||
|
||||
procedure TCustomListView.SetScrollBars(const Value: TScrollStyle);
|
||||
@ -328,6 +379,9 @@ procedure TCustomListView.UpdateScrollbars;
|
||||
var
|
||||
ScrollInfo: TScrollInfo;
|
||||
begin
|
||||
writeln('TODO: TCustomListView.UpdateScrollbars');
|
||||
exit;
|
||||
|
||||
if not HandleAllocated then exit
|
||||
else
|
||||
begin
|
||||
@ -417,12 +471,12 @@ end;
|
||||
|
||||
Function TCustomListView.GetMaxScrolledLeft : Integer;
|
||||
begin
|
||||
result := 0;
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
Function TCustomListView.GetMaxScrolledTop : Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure TCustomListView.SetDefaultItemHeight(AValue: integer);
|
||||
@ -432,7 +486,6 @@ begin
|
||||
FDefItemHeight:=AValue;
|
||||
// Include(FStates,tvsTopsNeedsUpdate);
|
||||
Invalidate;
|
||||
|
||||
end;
|
||||
|
||||
// included by comctrls.pp
|
||||
@ -440,6 +493,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.19 2002/05/28 14:58:30 lazarus
|
||||
MG: added scrollbars for TListView
|
||||
|
||||
Revision 1.18 2002/05/10 06:05:52 lazarus
|
||||
MG: changed license to LGPL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user