mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 02:58:16 +02:00
Changed code for TListView
Added a generic Breakpoints dialog Shane git-svn-id: trunk@523 -
This commit is contained in:
parent
8c514a5ded
commit
fa60cf7e2d
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -101,6 +101,7 @@ examples/testallform.pp svneol=native#text/pascal
|
|||||||
examples/testtools.inc svneol=native#text/pascal
|
examples/testtools.inc svneol=native#text/pascal
|
||||||
examples/toolbar.pp svneol=native#text/pascal
|
examples/toolbar.pp svneol=native#text/pascal
|
||||||
examples/trackbar.pp svneol=native#text/pascal
|
examples/trackbar.pp svneol=native#text/pascal
|
||||||
|
ide/breakpointsdlg.pp svneol=native#text/pascal
|
||||||
ide/codetemplatedialog.pp svneol=native#text/pascal
|
ide/codetemplatedialog.pp svneol=native#text/pascal
|
||||||
ide/compiler.pp svneol=native#text/pascal
|
ide/compiler.pp svneol=native#text/pascal
|
||||||
ide/compileroptions.pp svneol=native#text/pascal
|
ide/compileroptions.pp svneol=native#text/pascal
|
||||||
@ -410,6 +411,7 @@ lcl/include/toolbar.inc svneol=native#text/pascal
|
|||||||
lcl/include/toolbutton.inc svneol=native#text/pascal
|
lcl/include/toolbutton.inc svneol=native#text/pascal
|
||||||
lcl/include/toolwindow.inc svneol=native#text/pascal
|
lcl/include/toolwindow.inc svneol=native#text/pascal
|
||||||
lcl/include/trackbar.inc svneol=native#text/pascal
|
lcl/include/trackbar.inc svneol=native#text/pascal
|
||||||
|
lcl/include/viewcolumns.inc svneol=native#text/pascal
|
||||||
lcl/include/winapi.inc svneol=native#text/pascal
|
lcl/include/winapi.inc svneol=native#text/pascal
|
||||||
lcl/include/winapih.inc svneol=native#text/pascal
|
lcl/include/winapih.inc svneol=native#text/pascal
|
||||||
lcl/include/wincontrol.inc svneol=native#text/pascal
|
lcl/include/wincontrol.inc svneol=native#text/pascal
|
||||||
|
92
ide/breakpointsdlg.pp
Normal file
92
ide/breakpointsdlg.pp
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
unit breakpointsdlg;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,Buttons,Extctrls,ComCtrls;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TBreakPointAddedEvent = procedure (sender : TObject; Expression : String) of Object;
|
||||||
|
TBreakPointsdlg = class(TForm)
|
||||||
|
ListView1: TListView;
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
FOnBreakpointAddedEvent : TBreakPointAddedEvent;
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
constructor Create(AOwner : TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
property OnBreakpointAddedEvent : TBreakPointAddedEvent read FOnBreakPointAddedEvent write FOnBreakPointAddedEvent;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TInsertWatch = class(TForm)
|
||||||
|
lblExpression : TLabel;
|
||||||
|
lblRepCount : TLabel;
|
||||||
|
lblDigits : TLabel;
|
||||||
|
cbEnabled : TCHeckbox;
|
||||||
|
cbAllowFunc : TCheckbox;
|
||||||
|
Style : TRadioGroup;
|
||||||
|
btnOK : TButton;
|
||||||
|
btnCancel : TButton;
|
||||||
|
btnHelp : TButton;
|
||||||
|
edtExpression: TEdit;
|
||||||
|
edtRepCount : TEdit;
|
||||||
|
edtDigits : TEdit;
|
||||||
|
private
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(AOWner : TCOmponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
}
|
||||||
|
var
|
||||||
|
Breakpoints_Dlg : TBreakPointsDlg;
|
||||||
|
// InsertWatch : TInsertWatch;
|
||||||
|
implementation
|
||||||
|
|
||||||
|
constructor TBreakPointsdlg.Create(AOwner : TComponent);
|
||||||
|
Begin
|
||||||
|
inherited;
|
||||||
|
if LazarusResources.Find(Classname)=nil then
|
||||||
|
begin
|
||||||
|
ListView1 := TListView.Create(self);
|
||||||
|
with ListView1 do
|
||||||
|
Begin
|
||||||
|
Parent := self;
|
||||||
|
Align := alClient;
|
||||||
|
Visible := True;
|
||||||
|
Name := 'ListView1';
|
||||||
|
Columns.Clear;
|
||||||
|
Columns.Add('Filename/Address');
|
||||||
|
Columns.Add('Line/Length');
|
||||||
|
Columns.Add('Condition');
|
||||||
|
Columns.Add('Action');
|
||||||
|
Columns.Add('Pass Count');
|
||||||
|
Columns.Add('Group');
|
||||||
|
ViewStyle := vsReport;
|
||||||
|
end;
|
||||||
|
Caption := 'Breakpoints';
|
||||||
|
Name := 'BreakPointsDlg';
|
||||||
|
Width := 350;
|
||||||
|
Height := 100;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
End;
|
||||||
|
|
||||||
|
destructor TBreakPointsDlg.Destroy;
|
||||||
|
Begin
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
initialization
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
26
ide/main.pp
26
ide/main.pp
@ -40,7 +40,7 @@ uses
|
|||||||
PropEdits, ControlSelection, UnitEditor, CompilerOptions, EditorOptions,
|
PropEdits, ControlSelection, UnitEditor, CompilerOptions, EditorOptions,
|
||||||
EnvironmentOpts, TransferMacros, KeyMapping, ProjectOpts, IDEProcs, Process,
|
EnvironmentOpts, TransferMacros, KeyMapping, ProjectOpts, IDEProcs, Process,
|
||||||
UnitInfoDlg, Debugger, DBGWatch,RunParamsOpts, ExtToolDialog, MacroPromptDlg,
|
UnitInfoDlg, Debugger, DBGWatch,RunParamsOpts, ExtToolDialog, MacroPromptDlg,
|
||||||
LMessages, ProjectDefs, Watchesdlg;
|
LMessages, ProjectDefs, Watchesdlg,BreakPointsdlg;
|
||||||
|
|
||||||
const
|
const
|
||||||
Version_String = '0.8.1 alpha';
|
Version_String = '0.8.1 alpha';
|
||||||
@ -122,6 +122,7 @@ type
|
|||||||
itmViewFile : TMenuItem;
|
itmViewFile : TMenuItem;
|
||||||
itmViewMessage : TMenuItem;
|
itmViewMessage : TMenuItem;
|
||||||
itmViewwatches : TMenuItem;
|
itmViewwatches : TMenuItem;
|
||||||
|
itmViewBreakpoints : TMenuItem;
|
||||||
|
|
||||||
itmProjectNew: TMenuItem;
|
itmProjectNew: TMenuItem;
|
||||||
itmProjectOpen: TMenuItem;
|
itmProjectOpen: TMenuItem;
|
||||||
@ -178,6 +179,7 @@ type
|
|||||||
procedure mnuViewCodeExplorerClick(Sender : TObject);
|
procedure mnuViewCodeExplorerClick(Sender : TObject);
|
||||||
procedure mnuViewMessagesClick(Sender : TObject);
|
procedure mnuViewMessagesClick(Sender : TObject);
|
||||||
procedure mnuViewWatchesClick(Sender : TObject);
|
procedure mnuViewWatchesClick(Sender : TObject);
|
||||||
|
procedure mnuViewBreakPointsClick(Sender : TObject);
|
||||||
procedure MessageViewDblClick(Sender : TObject);
|
procedure MessageViewDblClick(Sender : TObject);
|
||||||
|
|
||||||
procedure mnuToggleFormUnitClicked(Sender : TObject);
|
procedure mnuToggleFormUnitClicked(Sender : TObject);
|
||||||
@ -700,6 +702,10 @@ begin
|
|||||||
Watches_Dlg := TWatchesDlg.Create(Self);
|
Watches_Dlg := TWatchesDlg.Create(Self);
|
||||||
Watches_Dlg.OnWatchAddedEvent := @OnWatchAdded;
|
Watches_Dlg.OnWatchAddedEvent := @OnWatchAdded;
|
||||||
|
|
||||||
|
|
||||||
|
//TBreakPointsDlg
|
||||||
|
BreakPoints_Dlg := TBreakPointsDlg.Create(Self);
|
||||||
|
|
||||||
TheDebugger := TDebugger.Create;
|
TheDebugger := TDebugger.Create;
|
||||||
// control selection (selected components on edited form)
|
// control selection (selected components on edited form)
|
||||||
TheControlSelection:=TControlSelection.Create;
|
TheControlSelection:=TControlSelection.Create;
|
||||||
@ -1208,6 +1214,12 @@ begin
|
|||||||
itmViewWatches.Caption := 'Watches';
|
itmViewWatches.Caption := 'Watches';
|
||||||
itmViewWatches.OnClick := @mnuViewWatchesClick;
|
itmViewWatches.OnClick := @mnuViewWatchesClick;
|
||||||
mnuView.Add(itmViewWatches);
|
mnuView.Add(itmViewWatches);
|
||||||
|
|
||||||
|
itmViewBreakPoints := TMenuItem.Create(Self);
|
||||||
|
itmViewBreakPoints.Name:='itmViewBreakPoints';
|
||||||
|
itmViewBreakPoints.Caption := 'BreakPoints';
|
||||||
|
itmViewBreakPoints.OnClick := @mnuViewBreakPointsClick;
|
||||||
|
mnuView.Add(itmViewBreakPoints);
|
||||||
//--------------
|
//--------------
|
||||||
// Project
|
// Project
|
||||||
//--------------
|
//--------------
|
||||||
@ -5205,6 +5217,13 @@ begin
|
|||||||
// CreateLFM(Insertwatch);
|
// CreateLFM(Insertwatch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.mnuViewBreakPointsClick(Sender : TObject);
|
||||||
|
begin
|
||||||
|
BreakPoints_dlg.Show;
|
||||||
|
// CreateLFM(Watches_Dlg);
|
||||||
|
// CreateLFM(Insertwatch);
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TMainIDE.OnDebuggerWatchChanged(Sender : TObject);
|
Procedure TMainIDE.OnDebuggerWatchChanged(Sender : TObject);
|
||||||
begin
|
begin
|
||||||
Writeln('OnDebuggerWatchChanged');
|
Writeln('OnDebuggerWatchChanged');
|
||||||
@ -5277,6 +5296,11 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.180 2001/12/14 18:38:55 lazarus
|
||||||
|
Changed code for TListView
|
||||||
|
Added a generic Breakpoints dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.179 2001/12/13 23:09:57 lazarus
|
Revision 1.179 2001/12/13 23:09:57 lazarus
|
||||||
MG: enhanced code caching, fixed CursorToCleanPos and beautify statement
|
MG: enhanced code caching, fixed CursorToCleanPos and beautify statement
|
||||||
|
|
||||||
|
@ -1392,6 +1392,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceEditor.EditorMouseMoved(Sender : TObject; Shift : TShiftState; X,Y : Integer);
|
Procedure TSourceEditor.EditorMouseMoved(Sender : TObject; Shift : TShiftState; X,Y : Integer);
|
||||||
|
var a:integer;
|
||||||
begin
|
begin
|
||||||
// Writeln('MOuseMove in Editor',X,',',Y);
|
// Writeln('MOuseMove in Editor',X,',',Y);
|
||||||
if Assigned(OnMouseMove) then
|
if Assigned(OnMouseMove) then
|
||||||
|
@ -398,41 +398,81 @@ type
|
|||||||
TListItems = class(TPersistent)
|
TListItems = class(TPersistent)
|
||||||
private
|
private
|
||||||
FOwner : TCustomListView;
|
FOwner : TCustomListView;
|
||||||
|
FItems : TList;
|
||||||
Function GetCount : Integer;
|
Function GetCount : Integer;
|
||||||
protected
|
protected
|
||||||
Function GetItem(Index : Integer): TListItem;
|
Function GetItem(Index : Integer): TListItem;
|
||||||
procedure SetCount(Value : Integer);
|
|
||||||
procedure SetITem(Index : Integer; Value : TListItem);
|
procedure SetITem(Index : Integer; Value : TListItem);
|
||||||
|
Procedure ItemChanged(sender : TObject); //called by the onchange of the tstringlist in TListItem
|
||||||
public
|
public
|
||||||
constructor Create(AOwner : TCustomListView);
|
constructor Create(AOwner : TCustomListView);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function Add:TListItem;
|
function Add:TListItem;
|
||||||
Procedure Delete(Index : Integer);
|
Procedure Delete(Index : Integer);
|
||||||
function Insert(Index : Integer) : TListItem;
|
function Insert(Index : Integer) : TListItem;
|
||||||
property Count : Integer read GetCount write SetCount;
|
property Count : Integer read GetCount;
|
||||||
property Item[Index : Integer]: TListItem read GetItem write SetItem; default;
|
property Item[Index : Integer]: TListItem read GetItem write SetItem; default;
|
||||||
property Owner : TCustomListView read FOwner;
|
property Owner : TCustomListView read FOwner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TViewColumns = class(TStringList)
|
||||||
|
private
|
||||||
|
Listview : TCustomListView;
|
||||||
|
public
|
||||||
|
constructor Create(Aowner : TCustomListView);
|
||||||
|
Function Add(const S : String): Integer; override;
|
||||||
|
Procedure Assign(source : TPersistent); override;
|
||||||
|
Procedure Delete(Index : Integer); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TViewStyle = (vsList,vsReport);
|
||||||
|
|
||||||
TCustomListView = class(TWinControl)
|
TCustomListView = class(TWinControl)
|
||||||
private
|
private
|
||||||
//FReadOnly : Boolean;
|
//FReadOnly : Boolean;
|
||||||
FListItems : TListItems;
|
FListItems : TListItems;
|
||||||
|
FColumns : TViewColumns;
|
||||||
|
FViewStyle : TViewStyle;
|
||||||
|
FSorted : Boolean;
|
||||||
|
FSortColumn : Integer;
|
||||||
procedure SetItems(Value : TListItems);
|
procedure SetItems(Value : TListItems);
|
||||||
protected
|
protected
|
||||||
ParentWindow : TScrolledWindow;
|
ParentWindow : TScrolledWindow;
|
||||||
procedure Delete(Item : TListItem);
|
procedure Delete(Item : TListItem);
|
||||||
procedure InsertItem(Item : TListItem);
|
procedure InsertItem(Item : TListItem);
|
||||||
|
Procedure SetViewStyle (value : TViewStyle);
|
||||||
|
Procedure SetSortColumn(Value : Integer);
|
||||||
|
Procedure SetSorted(Value : Boolean);
|
||||||
|
Procedure ItemChanged(Index : Integer); //called by TListItems
|
||||||
|
Procedure ItemDeleted(Index : Integer); //called by TListItems
|
||||||
|
Procedure ColumnsChanged; //called by TListItems
|
||||||
|
Procedure ItemAdded; //called by TListItems
|
||||||
property Items : TListItems read FListItems write SetItems;
|
property Items : TListItems read FListItems write SetItems;
|
||||||
public
|
public
|
||||||
constructor Create(Aowner: TComponent); override;
|
constructor Create(Aowner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property Columns : TViewColumns read FColumns write FColumns;
|
||||||
|
property ViewStyle : TViewStyle read FViewStyle write SetViewStyle;
|
||||||
|
property Sorted : Boolean read FSorted write SetSorted;
|
||||||
|
property SortColumn : Integer read FSortColumn write SetSortColumn;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TListView = class(TCustomListView)
|
TListView = class(TCustomListView)
|
||||||
published
|
published
|
||||||
|
property Columns;
|
||||||
property Items;
|
property Items;
|
||||||
|
property Visible;
|
||||||
|
property ViewStyle;
|
||||||
|
property OnMOuseMOve;
|
||||||
|
property OnClick;
|
||||||
|
property OnDblClick;
|
||||||
|
property OnMouseDown;
|
||||||
|
property OnMOuseUp;
|
||||||
|
property OnKeyPress;
|
||||||
|
property OnKeyUp;
|
||||||
|
property OnKeyDown;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TProgressBarOrientation = (pbHorizontal, pbVertical, pbRightToLeft, pbTopDown);
|
TProgressBarOrientation = (pbHorizontal, pbVertical, pbRightToLeft, pbTopDown);
|
||||||
@ -929,12 +969,18 @@ end;
|
|||||||
{$I toolbutton.inc}
|
{$I toolbutton.inc}
|
||||||
{$I toolbar.inc}
|
{$I toolbar.inc}
|
||||||
{$I trackbar.inc}
|
{$I trackbar.inc}
|
||||||
|
{$I viewcolumns.inc}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.6 2001/12/14 18:38:55 lazarus
|
||||||
|
Changed code for TListView
|
||||||
|
Added a generic Breakpoints dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.5 2001/09/30 08:34:49 lazarus
|
Revision 1.5 2001/09/30 08:34:49 lazarus
|
||||||
MG: fixed mem leaks and fixed range check errors
|
MG: fixed mem leaks and fixed range check errors
|
||||||
|
|
||||||
|
@ -10,21 +10,56 @@ begin
|
|||||||
{fix this call it is a hack}
|
{fix this call it is a hack}
|
||||||
|
|
||||||
fCompStyle := csListView;
|
fCompStyle := csListView;
|
||||||
CreateComponent(AOwner);
|
fViewStyle := vsList;
|
||||||
|
fSorted := False;
|
||||||
Left := 2;
|
fSortColumn := 0;
|
||||||
Top := 2;
|
Setbounds(2,2,300,300);
|
||||||
Width := 300;
|
Columns := TViewColumns.Create(self);
|
||||||
Height := 300;
|
FListItems := TListITems.Create(self);
|
||||||
|
// Columns.Add('Column1');
|
||||||
// ******************************
|
// Columns.Add('Column2');
|
||||||
// the following line has been commented out so that gtk dependency can be
|
|
||||||
// removed from all files. The following function needs to be moved. MAH
|
|
||||||
//
|
|
||||||
// gtk_container_add(PgtkContainer(ParentWindow.fComponent),fComponent);
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView ColumnsChanged }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
Procedure TCustomListView.ColumnsChanged;
|
||||||
|
Begin
|
||||||
|
//notify the interface....
|
||||||
|
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||||
|
End;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView ItemChanged }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
Procedure TCustomListView.ItemChanged(Index : Integer); //called by TListItems
|
||||||
|
Begin
|
||||||
|
//notify the interface....
|
||||||
|
CNSendMessage(LM_LV_CHANGEITEM,self,@Index);
|
||||||
|
End;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView ItemChanged }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
Procedure TCustomListView.ItemDeleted(Index : Integer); //called by TListItems
|
||||||
|
Begin
|
||||||
|
//notify the interface....
|
||||||
|
CNSendMessage(LM_LV_DELETEITEM,self,@Index);
|
||||||
|
End;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView ItemAdded }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
Procedure TCustomListView.ItemAdded;
|
||||||
|
Begin
|
||||||
|
//notify the interface....
|
||||||
|
CNSendMessage(LM_LV_ADDITEM,self,nil);
|
||||||
|
End;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TCustomListView SetItems }
|
{ TCustomListView SetItems }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -46,11 +81,45 @@ procedure TCustomListView.InsertItem(Item : TListItem);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView SetViewStyle }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
procedure TCustomListView.SetViewStyle(Value : TViewStyle);
|
||||||
|
begin
|
||||||
|
if FViewStyle = Value then Exit;
|
||||||
|
FViewStyle := Value;
|
||||||
|
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView SetSorted }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
procedure TCustomListView.SetSorted(Value : Boolean);
|
||||||
|
begin
|
||||||
|
if FSorted = Value then Exit;
|
||||||
|
FSorted := Value;
|
||||||
|
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TCustomListView SetSortColumn }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
procedure TCustomListView.SetSortColumn(Value : Integer);
|
||||||
|
begin
|
||||||
|
if FSortColumn = Value then Exit;
|
||||||
|
FSortColumn := Value;
|
||||||
|
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TCustomListView Destructor }
|
{ TCustomListView Destructor }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
destructor TCustomListView.Destroy;
|
destructor TCustomListView.Destroy;
|
||||||
begin
|
begin
|
||||||
|
Columns.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
constructor TListItem.Create(AOwner : TListItems);
|
constructor TListItem.Create(AOwner : TListItems);
|
||||||
begin
|
begin
|
||||||
|
FOwner := AOwner;
|
||||||
|
SubItems := TStringList.Create;
|
||||||
|
TStringList(SubItems).OnChange := @FOwner.ItemChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -10,6 +13,8 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TListItem.SetCaption(const Value : String);
|
procedure TListItem.SetCaption(const Value : String);
|
||||||
begin
|
begin
|
||||||
|
FCaption := Value;
|
||||||
|
FOwner.ItemChanged(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -17,7 +22,10 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TListItem.GetIndex : Integer;
|
function TListItem.GetIndex : Integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
if Assigned(FOwner) then
|
||||||
|
Result := FOwner.FItems.IndexOf(self)
|
||||||
|
else
|
||||||
|
Result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -25,6 +33,8 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TListItem.SetSubItems(Value : TStrings);
|
procedure TListItem.SetSubItems(Value : TStrings);
|
||||||
begin
|
begin
|
||||||
|
SubItems.Assign(Value);
|
||||||
|
//call itemchanged here r does the onchange event fire for each?
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -32,6 +42,7 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TListItem.Delete;
|
procedure TListItem.Delete;
|
||||||
begin
|
begin
|
||||||
|
free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -39,5 +50,8 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
destructor TListItem.Destroy;
|
destructor TListItem.Destroy;
|
||||||
begin
|
begin
|
||||||
|
SubItems.Free;
|
||||||
Inherited Destroy;
|
Inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
constructor TListItems.Create(AOwner : TCustomListView);
|
constructor TListItems.Create(AOwner : TCustomListView);
|
||||||
begin
|
begin
|
||||||
|
FItems := TList.Create;
|
||||||
|
FOwner := AOwner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -10,8 +12,7 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TListItems.GetCount : Integer;
|
function TListItems.GetCount : Integer;
|
||||||
begin
|
begin
|
||||||
// ToDo:
|
Result:=FItems.Count;
|
||||||
Result:=0;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -19,15 +20,9 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TListItems.GetItem(Index : Integer): TListItem;
|
function TListItems.GetItem(Index : Integer): TListItem;
|
||||||
begin
|
begin
|
||||||
// ToDo
|
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
if (FItems.Count-1 <Index) then Exit;
|
||||||
|
Result := TListItem(FItems.Items[Index]);
|
||||||
{------------------------------------------------------------------------------}
|
|
||||||
{ TListItems SetCount }
|
|
||||||
{------------------------------------------------------------------------------}
|
|
||||||
procedure TListItems.SetCount(Value : Integer);
|
|
||||||
begin
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -35,15 +30,22 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TListItems.SetItem(Index : Integer; Value : TListItem);
|
procedure TListItems.SetItem(Index : Integer; Value : TListItem);
|
||||||
begin
|
begin
|
||||||
|
if FItems.Count-1 < Index then Exit;
|
||||||
|
FItems.Items[Index] := Value;
|
||||||
|
FOwner.ItemChanged(Index);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TListItems Add }
|
{ TListItems Add }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TListItems.Add:TListItem;
|
function TListItems.Add:TListItem;
|
||||||
|
var
|
||||||
|
I : Integer;
|
||||||
begin
|
begin
|
||||||
// ToDo
|
Result := TListItem.Create(self);
|
||||||
Result:=nil;
|
FItems.Add(Result);
|
||||||
|
//Notify parent TListView that something was added.
|
||||||
|
FOwner.ItemAdded;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -51,6 +53,9 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TListItems.Delete(Index : Integer);
|
procedure TListItems.Delete(Index : Integer);
|
||||||
begin
|
begin
|
||||||
|
if (FItems.Items[index] <> nil) then
|
||||||
|
TListItem(FItems.Items[Index]).Delete;
|
||||||
|
FOwner.ItemDeleted(Index);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -68,3 +73,16 @@ end;
|
|||||||
destructor TListItems.Destroy;
|
destructor TListItems.Destroy;
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
{ TListItems ItemChanged }
|
||||||
|
{------------------------------------------------------------------------------}
|
||||||
|
Procedure TListItems.ItemChanged(Sender : TObject); //called by the onchange of the tstringlist in TListItem
|
||||||
|
var
|
||||||
|
Index : Integer;
|
||||||
|
begin
|
||||||
|
Index := FItems.IndexOf(TListItem(sender));
|
||||||
|
if Index > -1 then
|
||||||
|
FOwner.ItemChanged(Index);
|
||||||
|
end;
|
||||||
|
|
||||||
|
29
lcl/include/viewcolumns.inc
Normal file
29
lcl/include/viewcolumns.inc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
constructor TViewColumns.Create(Aowner : TCustomListView);
|
||||||
|
Begin
|
||||||
|
inherited Create;
|
||||||
|
ListView := AOwner;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function TViewColumns.Add(const S : String): Integer;
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Writeln('1');
|
||||||
|
Result := inherited;
|
||||||
|
ListView.ColumnsChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TViewColumns.Delete(Index : Integer);
|
||||||
|
Begin
|
||||||
|
Writeln('2');
|
||||||
|
inherited;
|
||||||
|
ListView.ColumnsChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TViewColumns.Assign(source : TPersistent);
|
||||||
|
Begin
|
||||||
|
Writeln('3');
|
||||||
|
inherited;
|
||||||
|
ListView.ColumnsChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
@ -369,15 +369,17 @@ var
|
|||||||
box1 : pgtkWidget; // currently only used for TBitBtn
|
box1 : pgtkWidget; // currently only used for TBitBtn
|
||||||
pixmapwid : pGtkWidget; // currently only used for TBitBtn, possibly replace with pixmap!!!!
|
pixmapwid : pGtkWidget; // currently only used for TBitBtn, possibly replace with pixmap!!!!
|
||||||
pLabel : PgtkWidget; // currently only used as extra label-widget for TBitBtn
|
pLabel : PgtkWidget; // currently only used as extra label-widget for TBitBtn
|
||||||
Num : Integer; // currently only used for LM_INSERTTOOLBUTTON
|
Num : Integer; // currently only used for LM_INSERTTOOLBUTTON and LM_ADDITEM
|
||||||
pStr2 : PChar; // currently only used for LM_INSERTTOOLBUTTON
|
pStr2 : PChar; // currently only used for LM_INSERTTOOLBUTTON
|
||||||
GList : pGList; // Only used for listboxes, replace with widget!!!!!
|
GList : pGList; // Only used for listboxes, replace with widget!!!!!
|
||||||
SelectionMode : TGtkSelectionMode; // currently only used for listboxes
|
SelectionMode : TGtkSelectionMode; // currently only used for listboxes
|
||||||
ListItem : PGtkListItem; // currently only used for listboxes
|
ListItem : PGtkListItem; // currently only used for listboxes
|
||||||
|
AddItemListItem : TListItem;
|
||||||
Rect : TRect;
|
Rect : TRect;
|
||||||
FormIconGdiObject: PGdiObject; // currently only used by LM_SETFORMICON
|
FormIconGdiObject: PGdiObject; // currently only used by LM_SETFORMICON
|
||||||
QueueItem, OldQueueItem: PLazQueueItem; // currently only used by LM_DESTROY
|
QueueItem, OldQueueItem: PLazQueueItem; // currently only used by LM_DESTROY
|
||||||
MsgPtr : PMsg; // currently only used by LM_DESTROY
|
MsgPtr : PMsg; // currently only used by LM_DESTROY
|
||||||
|
Count : Integer; //Used in TListView LM_LV_CHANGEITEM
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := 0; //default value just in case nothing sets it
|
Result := 0; //default value just in case nothing sets it
|
||||||
@ -462,7 +464,59 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{Used by:
|
||||||
|
TListView
|
||||||
|
|
||||||
|
}
|
||||||
|
LM_LV_DELETEITEM :
|
||||||
|
begin
|
||||||
|
if (Sender is TListView) then
|
||||||
|
begin
|
||||||
|
Num := Integer(data^);
|
||||||
|
gtk_clist_remove(PgtkCList(handle),Num);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
LM_LV_CHANGEITEM :
|
||||||
|
begin
|
||||||
|
if (Sender is TListView) then
|
||||||
|
begin
|
||||||
|
Num := Integer(data^);
|
||||||
|
if Num <= PGTKCList(Handle)^.rows-1 then
|
||||||
|
Begin
|
||||||
|
AddItemListItem := TListView(sender).Items[Num];
|
||||||
|
gtk_clist_set_text(PgtkCList(handle),num,0,@AddItemListItem.Caption);
|
||||||
|
//redo every column text
|
||||||
|
for Count := 1 to PgtkCList(Handle)^.Columns-1 do
|
||||||
|
begin
|
||||||
|
//if there aren't anymore subitems then get out.
|
||||||
|
if AddItemListItem.SubItems.Count < Count then Break;
|
||||||
|
pStr := StrAlloc(length(AddItemListItem.SubItems.Strings[Count-1]) + 1);
|
||||||
|
StrPCopy(pStr, AddItemListItem.SubItems.Strings[Count-1]);
|
||||||
|
gtk_clist_set_text(PgtkCList(handle),num,Count,pStr);
|
||||||
|
StrDispose(pStr);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
LM_LV_ADDITEM :
|
||||||
|
begin
|
||||||
|
if (Sender is TListView) then
|
||||||
|
begin
|
||||||
|
//get last item and add it..
|
||||||
|
Num := gtk_clist_append(PgtkCList(handle),nil);
|
||||||
|
AddItemListItem := TListView(sender).Items[TListView(sender).Items.Count];
|
||||||
|
if AddItemListItem <> nil then
|
||||||
|
Begin
|
||||||
|
gtk_clist_set_text(PgtkCList(handle),num,0,@AddItemListItem.Caption);
|
||||||
|
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
LM_BRINGTOFRONT:
|
LM_BRINGTOFRONT:
|
||||||
begin
|
begin
|
||||||
{ Assert(False, 'Trace:TODO:bringtofront');
|
{ Assert(False, 'Trace:TODO:bringtofront');
|
||||||
@ -2068,6 +2122,17 @@ begin
|
|||||||
GetWidgetInfo(p, True)^.ImplementationWidget := TempWidget;
|
GetWidgetInfo(p, True)^.ImplementationWidget := TempWidget;
|
||||||
SetMainWidget(p, TempWidget);
|
SetMainWidget(p, TempWidget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
csListView :
|
||||||
|
Begin
|
||||||
|
P := PgtkWidget(gtk_clist_new(6));
|
||||||
|
|
||||||
|
gtk_clist_set_column_title(PgtkCList(P),0,'Column1');
|
||||||
|
gtk_clist_set_column_title(PgtkCList(P),1,'Column2');
|
||||||
|
gtk_clist_column_titles_show(PgtkCList(P));
|
||||||
|
gtk_widget_show(P);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
csEdit :
|
csEdit :
|
||||||
begin
|
begin
|
||||||
@ -2927,6 +2992,9 @@ var
|
|||||||
Widget : PGtkWidget;
|
Widget : PGtkWidget;
|
||||||
xAlign : gfloat;
|
xAlign : gfloat;
|
||||||
yAlign : gfloat;
|
yAlign : gfloat;
|
||||||
|
I : Integer;
|
||||||
|
ColName : String;
|
||||||
|
pColName : PChar;
|
||||||
begin
|
begin
|
||||||
result := 0; // default if nobody sets it
|
result := 0; // default if nobody sets it
|
||||||
|
|
||||||
@ -3032,6 +3100,42 @@ begin
|
|||||||
gtk_misc_set_alignment(PGTKMISC(Handle), xAlign, yAlign);
|
gtk_misc_set_alignment(PGTKMISC(Handle), xAlign, yAlign);
|
||||||
gtk_label_set_line_wrap(PGTKLABEL(Handle),WordWrap);
|
gtk_label_set_line_wrap(PGTKLABEL(Handle),WordWrap);
|
||||||
end;
|
end;
|
||||||
|
csListView :
|
||||||
|
With TCustomListView(sender) do
|
||||||
|
Begin
|
||||||
|
//set up columns..
|
||||||
|
//
|
||||||
|
Writeln('in SetPRoperties for ListView. Columns is ',PgtkcList(handle)^.columns);
|
||||||
|
gtk_clist_freeze(PgtkCList(handle));
|
||||||
|
for I := 0 to Columns.Count-1 do
|
||||||
|
Begin
|
||||||
|
ColName := Columns.Strings[i];
|
||||||
|
GetMem(pColName,Length(colname)+1);
|
||||||
|
pColName := StrPcopy(pColName,ColName);
|
||||||
|
gtk_clist_set_column_title(Pgtkclist(handle),I,pColName);
|
||||||
|
// if (i+1) > PgtkcList(handle)^.Columns-1 then
|
||||||
|
// gtk_clist_append(PgtkCList(handle),@pColName)
|
||||||
|
// else
|
||||||
|
// gtk_clist_Set_Column_title(PgtkcList(handle),I,pColName);
|
||||||
|
freemem(pColName);
|
||||||
|
end;
|
||||||
|
while I <= PgtkcList(handle)^.Columns-1 do
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
//delete a column...
|
||||||
|
end;
|
||||||
|
if (TCustomListView(sender).ViewStyle = vsReport) then
|
||||||
|
gtk_clist_column_titles_show(PgtkCList(handle))
|
||||||
|
else
|
||||||
|
gtk_clist_column_titles_Hide(PgtkCList(handle));
|
||||||
|
|
||||||
|
gtk_clist_set_sort_column(PgtkCList(handle),TCustomListView(sender).SortColumn);
|
||||||
|
gtk_clist_set_auto_sort(PgtkCList(handle),TCustomListView(sender).Sorted);
|
||||||
|
//
|
||||||
|
//do items...
|
||||||
|
//
|
||||||
|
gtk_clist_thaw(PgtkCList(handle));
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
Assert (true, Format ('WARNING:[TgtkObject.SetProperties] failed for %s', [Sender.ClassName]));
|
Assert (true, Format ('WARNING:[TgtkObject.SetProperties] failed for %s', [Sender.ClassName]));
|
||||||
end;
|
end;
|
||||||
@ -3486,7 +3590,13 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.88 2001/12/14 18:38:56 lazarus
|
||||||
|
Changed code for TListView
|
||||||
|
Added a generic Breakpoints dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.87 2001/12/12 20:19:19 lazarus
|
Revision 1.87 2001/12/12 20:19:19 lazarus
|
||||||
|
|
||||||
Modified the the GTKFileSelection so that it will handle and use
|
Modified the the GTKFileSelection so that it will handle and use
|
||||||
CTRL and SHIFT keys in a fashion similar to Windows.
|
CTRL and SHIFT keys in a fashion similar to Windows.
|
||||||
|
|
||||||
|
@ -280,6 +280,11 @@ LM_MONTHCHANGED = LM_USER+65;
|
|||||||
LM_YEARCHANGED = LM_USER+66;
|
LM_YEARCHANGED = LM_USER+66;
|
||||||
LM_DAYCHANGED = LM_USER+67;
|
LM_DAYCHANGED = LM_USER+67;
|
||||||
|
|
||||||
|
//TListView
|
||||||
|
LM_LV_ADDITEM = LM_USER+68;
|
||||||
|
LM_LV_CHANGEITEM = LM_USER + 69;
|
||||||
|
LM_LV_DELETEITEM = LM_USER + 70;
|
||||||
|
|
||||||
LM_CB_FIRST = LM_USER+100;
|
LM_CB_FIRST = LM_USER+100;
|
||||||
LM_CB_GETCOUNT = LM_CB_FIRST+1;
|
LM_CB_GETCOUNT = LM_CB_FIRST+1;
|
||||||
LM_CB_GETTEXT = LM_CB_FIRST+2;
|
LM_CB_GETTEXT = LM_CB_FIRST+2;
|
||||||
@ -288,6 +293,7 @@ LM_CB_ADDTEXT = LM_CB_FIRST+3;
|
|||||||
LM_CB_LAST = LM_CB_FIRST+10; //LM_USER+110
|
LM_CB_LAST = LM_CB_FIRST+10; //LM_USER+110
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LM_UNKNOWN = LM_User+99;
|
LM_UNKNOWN = LM_User+99;
|
||||||
|
|
||||||
LM_SYSCOMMAND = $0112;
|
LM_SYSCOMMAND = $0112;
|
||||||
@ -781,6 +787,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.16 2001/12/14 18:38:55 lazarus
|
||||||
|
Changed code for TListView
|
||||||
|
Added a generic Breakpoints dialog
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.15 2001/12/10 07:47:58 lazarus
|
Revision 1.15 2001/12/10 07:47:58 lazarus
|
||||||
MG: fixed typo
|
MG: fixed typo
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user