diff --git a/lcl/interfaces/win32/win32listsl.inc b/lcl/interfaces/win32/win32listsl.inc index 9b9edfce8b..6e41850646 100644 --- a/lcl/interfaces/win32/win32listsl.inc +++ b/lcl/interfaces/win32/win32listsl.inc @@ -515,165 +515,6 @@ begin then Dispose(ItemRecord); end; -{*************************************************************} -{ TWin32CListStringList methods } -{*************************************************************} - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Create - Params: - Returns: - - ------------------------------------------------------------------------------} -Constructor TWin32CListStringList.Create(List : HWND; TheOwner: TWinControl); -Begin - Inherited Create; - If List = HWND(Nil) Then - Raise Exception.Create('Unspecified list widget'); - FWin32CList := List; - FSorted := (GetWindowLong(FWin32CList, GWL_STYLE) and LBS_SORT <> 0); - FSender:=TheOwner; -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.SetSorted - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWin32CListStringList.SetSorted(Val: Boolean); -Begin - If Val <> FSorted Then - Begin - FSorted := Val; - Sort; - End; -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Sort - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWin32CListStringList.Sort; -Begin - // The win api doesn't allow to change the sort on the fly, - // so is needed to recreate the window - RecreateWnd(FSender); -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Assign - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWin32CListStringList.Assign(Source: TPersistent); -Var - Counter: Integer; -Begin - { Do not call inherited Assign as it does things we do not want to happen } - If Source Is TStrings Then - Begin - Clear; - For Counter := 0 To (TStrings(Source).Count - 1) Do - InsertObject(0, TStrings(Source)[Counter], TStrings(Source).Objects[Counter]); - End - Else - Inherited Assign(Source); -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Clear - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWin32CListStringList.Clear; -Begin - Windows.SendMessage(FWin32CList, LB_RESETCONTENT, 0, 0); -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Delete - Params: - Returns: - - ------------------------------------------------------------------------------} -procedure TWin32CListStringList.Delete(Index: Integer); -begin - Windows.SendMessage(FWin32CList, LB_DELETESTRING, Index, 0); -end; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Get - Params: - Returns: - - ------------------------------------------------------------------------------} -Function TWin32CListStringList.Get(Index: Integer): String; -Var - Item: PChar; -Begin - If (Index < 0) Or (Index >= Count) Then - Raise Exception.Create('Out of bounds.') - Else - Begin - Getmem(Item,Windows.SendMessage(FWin32CList,LB_GETTEXTLEN,Index,0)+1); - Windows.SendMessage(FWin32CList, LB_GETTEXT, Index, LPARAM(Item)); - Result := StrPas(Item); - Dispose(Item); - End; -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.GetCount - Params: - Returns: - - ------------------------------------------------------------------------------} -Function TWin32CListStringList.GetCount: Integer; -Begin - Result := Windows.SendMessage(FWin32CList, LB_GETCOUNT, 0, 0); -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.GetObject - Params: - Returns: - - ------------------------------------------------------------------------------} -Function TWin32CListStringList.GetObject(Index: Integer): TObject; -Begin - HWND(Result) := Windows.SendMessage(FWin32CList, LB_GETITEMDATA, Index, 0); -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.Insert - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWin32CListStringList.Insert(Index: Integer; Const S: String); -Begin - If FSorted Then - Windows.SendMessage(FWin32CList,LB_ADDSTRING, 0, LPARAM(PChar(S))) - Else - Windows.SendMessage(FWin32CList,LB_INSERTSTRING, Index, LPARAM(PChar(S))); -End; - -{------------------------------------------------------------------------------ - Method: TWin32CListStringList.PutObject - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWin32CListStringList.PutObject(Index: Integer; AObject: TObject); -Begin - Windows.SendMessage(FWin32CList, LB_SETITEMDATA, Index, LPARAM(AObject)); -End; - {$IFDEF H_PLUS} {$UNDEF H_PLUS} {$ELSE} diff --git a/lcl/interfaces/win32/win32listslh.inc b/lcl/interfaces/win32/win32listslh.inc index ae39c805ca..8165b620ff 100644 --- a/lcl/interfaces/win32/win32listslh.inc +++ b/lcl/interfaces/win32/win32listslh.inc @@ -122,27 +122,6 @@ Type property State[Index: Integer]: TCheckBoxState read GetState write SetState; end; - TWin32CListStringList = Class(TStrings) - Private - FWin32CList: HWND; - FSender: TWinControl; // Needed to recreate the window - FSorted: Boolean; - Protected - Function Get(Index: Integer): String; Override; - Function GetCount: Integer; Override; - Function GetObject(Index: Integer): TObject; Override; - Procedure PutObject(Index: Integer; AObject: TObject); Override; - Procedure SetSorted(Val: Boolean); Virtual; - Public - Constructor Create(List : HWND; TheOwner: TWinControl); - Procedure Assign(Source: TPersistent); Override; - Procedure Clear; Override; - Procedure Delete(Index: Integer); Override; - Procedure Insert(Index: Integer; Const S: String); Override; - Procedure Sort; Virtual; - Property Sorted: Boolean Read FSorted Write SetSorted; - End; - {$IFDEF H_PLUS} {$UNDEF H_PLUS} {$ELSE} diff --git a/lcl/interfaces/wince/wincelistsl.inc b/lcl/interfaces/wince/wincelistsl.inc index 8bcee63de2..33c3e3350c 100644 --- a/lcl/interfaces/wince/wincelistsl.inc +++ b/lcl/interfaces/wince/wincelistsl.inc @@ -471,166 +471,6 @@ begin then Dispose(ItemRecord); end; -{*************************************************************} -{ TWinCECListStringList methods } -{*************************************************************} - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Create - Params: - Returns: - - ------------------------------------------------------------------------------} -Constructor TWinCECListStringList.Create(List : HWND; TheOwner: TWinControl); -Begin - Inherited Create; - If List = HWND(Nil) Then - Raise Exception.Create('Unspecified list widget'); - FWinCECList := List; - FSorted := (GetWindowLong(FWinCECList, GWL_STYLE) and LBS_SORT <> 0); - FSender:=TheOwner; -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.SetSorted - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWinCECListStringList.SetSorted(Val: Boolean); -Begin - If Val <> FSorted Then - Begin - FSorted := Val; - Sort; - End; -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Sort - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWinCECListStringList.Sort; -Begin - // The win api doesn't allow to change the sort on the fly, - // so is needed to recreate the window - RecreateWnd(FSender); -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Assign - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWinCECListStringList.Assign(Source: TPersistent); -Var - Counter: Integer; -Begin - { Do not call inherited Assign as it does things we do not want to happen } - If Source Is TStrings Then - Begin - Clear; - For Counter := 0 To (TStrings(Source).Count - 1) Do - InsertObject(0, TStrings(Source)[Counter], TStrings(Source).Objects[Counter]); - End - Else - Inherited Assign(Source); -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Clear - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWinCECListStringList.Clear; -Begin - Windows.SendMessage(FWinCECList, LB_RESETCONTENT, 0, 0); -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Delete - Params: - Returns: - - ------------------------------------------------------------------------------} -procedure TWinCECListStringList.Delete(Index: Integer); -begin - Windows.SendMessage(FWinCECList, LB_DELETESTRING, Index, 0); -end; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Get - Params: - Returns: - - ------------------------------------------------------------------------------} -Function TWinCECListStringList.Get(Index: Integer): String; -Var - Item: PWideChar; -Begin - If (Index < 0) Or (Index >= Count) Then - Raise Exception.Create('Out of bounds.') - Else - Begin - Item := PWideChar(SysAllocStringLen(nil,Windows.SendMessage(FWinCECList,LB_GETTEXTLEN,Index,0))); - Windows.SendMessage(FWinCECList, LB_GETTEXT, Index, LPARAM(Item)); - Result := String(WideString(Item));//roozbeh maybe Widestringtostring later - SysFreeString(Item); - End; -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.GetCount - Params: - Returns: - - ------------------------------------------------------------------------------} -Function TWinCECListStringList.GetCount: Integer; -Begin - Result := Windows.SendMessage(FWinCECList, LB_GETCOUNT, 0, 0); -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.GetObject - Params: - Returns: - - ------------------------------------------------------------------------------} -Function TWinCECListStringList.GetObject(Index: Integer): TObject; -Begin - HWND(Result) := Windows.SendMessage(FWinCECList, LB_GETITEMDATA, Index, 0); -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.Insert - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWinCECListStringList.Insert(Index: Integer; Const S: String); -Begin - FLastInsertedIndex := Index; - if FSorted then - FLastInsertedIndex := Windows.SendMessageW(FWinCECList, LB_ADDSTRING, 0, LPARAM(PWideChar(Utf8Decode(S)))) - else - Windows.SendMessageW(FWinCECList, LB_INSERTSTRING, Index, LPARAM(PWideChar(Utf8Decode(S)))); -End; - -{------------------------------------------------------------------------------ - Method: TWinCECListStringList.PutObject - Params: - Returns: - - ------------------------------------------------------------------------------} -Procedure TWinCECListStringList.PutObject(Index: Integer; AObject: TObject); -Begin - Windows.SendMessage(FWinCECList, LB_SETITEMDATA, Index, LPARAM(AObject)); -End; - {$IFDEF H_PLUS} {$UNDEF H_PLUS} {$ELSE} diff --git a/lcl/interfaces/wince/wincelistslh.inc b/lcl/interfaces/wince/wincelistslh.inc index 48c01b8a25..bb208386f2 100644 --- a/lcl/interfaces/wince/wincelistslh.inc +++ b/lcl/interfaces/wince/wincelistslh.inc @@ -113,28 +113,6 @@ Type property State[AIndex: Integer]: TCheckBoxState read GetState write SetState; end; - TWinCECListStringList = Class(TStrings) - Private - FWinCECList: HWND; - FSender: TWinControl; // Needed to recreate the window - FSorted: Boolean; - FlastInsertedIndex: Integer; - Protected - Function Get(Index: Integer): String; Override; - Function GetCount: Integer; Override; - Function GetObject(Index: Integer): TObject; Override; - Procedure PutObject(Index: Integer; AObject: TObject); Override; - Procedure SetSorted(Val: Boolean); Virtual; - Public - Constructor Create(List : HWND; TheOwner: TWinControl); - Procedure Assign(Source: TPersistent); Override; - Procedure Clear; Override; - Procedure Delete(Index: Integer); Override; - Procedure Insert(Index: Integer; Const S: String); Override; - Procedure Sort; Virtual; - Property Sorted: Boolean Read FSorted Write SetSorted; - End; - {$IFDEF H_PLUS} {$UNDEF H_PLUS} {$ELSE}