mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-28 13:33:40 +02:00
remove usage of fcompstyle by split up of twin32wscustomlistbox.getstrings and twin32wscustomlistbox.getitemindex
git-svn-id: trunk@6197 -
This commit is contained in:
parent
a9e9dc9362
commit
2c5e67e274
@ -33,9 +33,9 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
CheckLst,
|
||||
Classes, CheckLst, StdCtrls,
|
||||
////////////////////////////////////////////////////
|
||||
WSCheckLst, WSLCLClasses, Win32Int, Windows;
|
||||
WSCheckLst, WSLCLClasses, Win32Int, Win32Proc, Windows;
|
||||
|
||||
type
|
||||
|
||||
@ -47,6 +47,7 @@ type
|
||||
public
|
||||
class function GetChecked(const ACheckListBox: TCustomCheckListBox;
|
||||
const AIndex: integer): boolean; override;
|
||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||
class procedure SetChecked(const ACheckListBox: TCustomCheckListBox;
|
||||
const AIndex: integer; const AChecked: boolean); override;
|
||||
end;
|
||||
@ -60,6 +61,15 @@ begin
|
||||
Result := TWin32CheckListBoxStrings(ACheckListBox.Items).Checked[AIndex];
|
||||
end;
|
||||
|
||||
function TWin32WSCustomCheckListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
|
||||
var
|
||||
Handle: HWND;
|
||||
begin
|
||||
Handle := ACustomListBox.Handle;
|
||||
Result := TWin32CheckListBoxStrings.Create(Handle, ACustomListBox);
|
||||
GetWindowInfo(Handle)^.List := Result;
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomCheckListBox.SetChecked(const ACheckListBox: TCustomCheckListBox;
|
||||
const AIndex: integer; const AChecked: boolean);
|
||||
var
|
||||
|
@ -47,6 +47,7 @@ type
|
||||
public
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -85,6 +86,15 @@ begin
|
||||
Result := Params.Window;
|
||||
end;
|
||||
|
||||
function TWin32WSCustomCListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
|
||||
var
|
||||
Handle: HWND;
|
||||
begin
|
||||
Handle := ACustomListBox.Handle;
|
||||
Result := TWin32CListStringList.Create(Handle, ACustomListBox)
|
||||
GetWindowInfo(Handle)^.List := Result;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
@ -439,24 +439,12 @@ begin
|
||||
end;
|
||||
|
||||
function TWin32WSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||
var
|
||||
Handle: HWND;
|
||||
begin
|
||||
Handle := ACustomListBox.Handle;
|
||||
case ACustomListBox.FCompStyle of
|
||||
csListBox, csCListBox:
|
||||
begin
|
||||
Result := SendMessage(Handle, LB_GETCURSEL, 0, 0);
|
||||
if Result = LB_ERR then
|
||||
begin
|
||||
Assert(False, 'Trace:[TWin32WidgetSet.IntSendMessage3] Could not retrieve item index via LM_GETITEMINDEX; try selecting an item first');
|
||||
Result := -1;
|
||||
end;
|
||||
end;
|
||||
csNotebook:
|
||||
begin
|
||||
Result := SendMessage(Handle, TCM_GETCURSEL, 0, 0);
|
||||
end;
|
||||
Result := SendMessage(ACustomListBox.Handle, LB_GETCURSEL, 0, 0);
|
||||
if Result = LB_ERR then
|
||||
begin
|
||||
Assert(false, 'Trace:[TWin32WSCustomListBox.GetItemIndex] could not retrieve itemindex, try selecting an item first');
|
||||
Result := -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -483,13 +471,7 @@ var
|
||||
Handle: HWND;
|
||||
begin
|
||||
Handle := ACustomListBox.Handle;
|
||||
if ACustomListBox.fCompStyle = csCListBox then
|
||||
Result := TWin32CListStringList.Create(Handle, ACustomListBox)
|
||||
else
|
||||
if ACustomListBox.fCompStyle = csCheckListBox then
|
||||
Result := TWin32CheckListBoxStrings.Create(Handle, ACustomListBox)
|
||||
else
|
||||
Result := TWin32ListStringList.Create(Handle, ACustomListBox);
|
||||
Result := TWin32ListStringList.Create(Handle, ACustomListBox);
|
||||
GetWindowInfo(Handle)^.List := Result;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user