mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 14:39:06 +02:00
lcl, win32: move ListBox, CheckListBox styles into CreateParams of LCL classes
git-svn-id: trunk@29914 -
This commit is contained in:
parent
c011106ea9
commit
dfc3dc15df
@ -57,6 +57,7 @@ type
|
|||||||
class procedure WSRegisterClass; override;
|
class procedure WSRegisterClass; override;
|
||||||
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); override;
|
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); override;
|
||||||
procedure AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); override;
|
procedure AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); override;
|
||||||
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
function GetCachedDataSize: Integer; override;
|
function GetCachedDataSize: Integer; override;
|
||||||
procedure DefineProperties(Filer: TFiler); override;
|
procedure DefineProperties(Filer: TFiler); override;
|
||||||
procedure ReadData(Stream: TStream);
|
procedure ReadData(Stream: TStream);
|
||||||
@ -172,6 +173,12 @@ begin
|
|||||||
SendItemEnabled(AIndex, not PCachedItemData(AData + FItemDataOffset)^.Disabled);
|
SendItemEnabled(AIndex, not PCachedItemData(AData + FItemDataOffset)^.Disabled);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCheckListBox.CreateParams(var Params: TCreateParams);
|
||||||
|
begin
|
||||||
|
inherited CreateParams(Params);
|
||||||
|
Params.Style := (Params.Style and not LBS_OWNERDRAWVARIABLE) or LBS_OWNERDRAWFIXED;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomCheckListBox.AssignItemDataToCache(const AIndex: Integer;
|
procedure TCustomCheckListBox.AssignItemDataToCache(const AIndex: Integer;
|
||||||
const AData: Pointer);
|
const AData: Pointer);
|
||||||
begin
|
begin
|
||||||
|
@ -72,6 +72,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomListBox.CreateParams(var Params: TCreateParams);
|
||||||
|
const
|
||||||
|
MultiSelectStyle: array[Boolean] of DWord = (LBS_MULTIPLESEL, LBS_EXTENDEDSEL);
|
||||||
|
begin
|
||||||
|
inherited CreateParams(Params);
|
||||||
|
if Sorted then
|
||||||
|
Params.Style := Params.Style or LBS_SORT;
|
||||||
|
if MultiSelect then
|
||||||
|
Params.Style := Params.Style or MultiSelectStyle[ExtendedSelect];
|
||||||
|
if Columns > 1 then
|
||||||
|
Params.Style := Params.Style or LBS_MULTICOLUMN;
|
||||||
|
|
||||||
|
case Style of
|
||||||
|
lbOwnerDrawFixed: Params.Style := Params.Style or LBS_OWNERDRAWFIXED;
|
||||||
|
lbOwnerDrawVariable: Params.Style := Params.Style or LBS_OWNERDRAWVARIABLE;
|
||||||
|
end;
|
||||||
|
Params.Style := Params.Style or
|
||||||
|
(WS_HSCROLL or WS_VSCROLL or LBS_NOINTEGRALHEIGHT or LBS_HASSTRINGS or LBS_NOTIFY);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
procedure TCustomListBox.AssignItemDataToCache
|
procedure TCustomListBox.AssignItemDataToCache
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
@ -216,6 +216,7 @@ const
|
|||||||
EditClsName: array[0..4] of char = 'Edit'#0;
|
EditClsName: array[0..4] of char = 'Edit'#0;
|
||||||
ButtonClsName: array[0..6] of char = 'Button'#0;
|
ButtonClsName: array[0..6] of char = 'Button'#0;
|
||||||
ComboboxClsName: array[0..8] of char = 'ComboBox'#0;
|
ComboboxClsName: array[0..8] of char = 'ComboBox'#0;
|
||||||
|
ListboxClsName: array[0..8] of char = 'LISTBOX'#0;
|
||||||
TabControlClsName: array[0..15] of char = 'SysTabControl32'#0;
|
TabControlClsName: array[0..15] of char = 'SysTabControl32'#0;
|
||||||
ListViewClsName: array[0..13] of char = 'SysListView32'#0;
|
ListViewClsName: array[0..13] of char = 'SysListView32'#0;
|
||||||
|
|
||||||
|
@ -156,8 +156,13 @@ class function TWin32WSCustomCheckListBox.CreateHandle(
|
|||||||
var
|
var
|
||||||
Params: TCreateWindowExParams;
|
Params: TCreateWindowExParams;
|
||||||
begin
|
begin
|
||||||
Params := GetListBoxParams(TCustomListBox(AWinControl), AParams, True);
|
// general initialization of Params
|
||||||
Params.SubClassWndProc := @CheckListBoxWndProc;
|
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||||
|
with Params do
|
||||||
|
begin
|
||||||
|
pClassName := ListBoxClsName;
|
||||||
|
SubClassWndProc := @CheckListBoxWndProc;
|
||||||
|
end;
|
||||||
// create window
|
// create window
|
||||||
FinishCreateWindow(AWinControl, Params, False);
|
FinishCreateWindow(AWinControl, Params, False);
|
||||||
// listbox is not a transparent control -> no need for parentpainting
|
// listbox is not a transparent control -> no need for parentpainting
|
||||||
|
@ -296,9 +296,6 @@ function EditGetSelLength(WinHandle: HWND): integer;
|
|||||||
procedure EditSetSelStart(WinHandle: HWND; NewStart: integer);
|
procedure EditSetSelStart(WinHandle: HWND; NewStart: integer);
|
||||||
procedure EditSetSelLength(WinHandle: HWND; NewLength: integer);
|
procedure EditSetSelLength(WinHandle: HWND; NewLength: integer);
|
||||||
|
|
||||||
function GetListBoxParams(AListBox: TCustomListBox;
|
|
||||||
const AParams: TCreateParams; IsCheckList: Boolean): TCreateWindowExParams;
|
|
||||||
|
|
||||||
{$DEFINE MEMOHEADER}
|
{$DEFINE MEMOHEADER}
|
||||||
{$I win32memostrings.inc}
|
{$I win32memostrings.inc}
|
||||||
{$UNDEF MEMOHEADER}
|
{$UNDEF MEMOHEADER}
|
||||||
@ -581,46 +578,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetListBoxParams(AListBox: TCustomListBox;
|
|
||||||
const AParams: TCreateParams; IsCheckList: Boolean): TCreateWindowExParams;
|
|
||||||
begin
|
|
||||||
// general initialization of Params
|
|
||||||
PrepareCreateWindow(AListBox, AParams, Result);
|
|
||||||
// customization of Params
|
|
||||||
with Result do
|
|
||||||
begin
|
|
||||||
with AListBox do
|
|
||||||
begin
|
|
||||||
if Sorted then
|
|
||||||
Flags := Flags or LBS_SORT;
|
|
||||||
if MultiSelect then
|
|
||||||
if ExtendedSelect then
|
|
||||||
Flags := Flags or LBS_EXTENDEDSEL
|
|
||||||
else
|
|
||||||
Flags := Flags or LBS_MULTIPLESEL;
|
|
||||||
if Columns > 1 then
|
|
||||||
Flags := Flags or LBS_MULTICOLUMN;
|
|
||||||
|
|
||||||
if IsCheckList and (Style = lbStandard) then
|
|
||||||
Flags := Flags or LBS_OWNERDRAWFIXED
|
|
||||||
else
|
|
||||||
case Style of
|
|
||||||
lbOwnerDrawFixed: Flags := Flags or LBS_OWNERDRAWFIXED;
|
|
||||||
lbOwnerDrawVariable: Flags := Flags or LBS_OWNERDRAWVARIABLE;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
pClassName := 'LISTBOX';
|
|
||||||
Flags := Flags or (WS_HSCROLL or WS_VSCROLL or LBS_NOINTEGRALHEIGHT or LBS_HASSTRINGS or
|
|
||||||
LBS_NOTIFY);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
class function TWin32WSCustomListBox.CreateHandle(const AWinControl: TWinControl;
|
class function TWin32WSCustomListBox.CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): HWND;
|
const AParams: TCreateParams): HWND;
|
||||||
var
|
var
|
||||||
Params: TCreateWindowExParams;
|
Params: TCreateWindowExParams;
|
||||||
begin
|
begin
|
||||||
Params := GetListBoxParams(TCustomListBox(AWinControl), AParams, False);
|
// general initialization of Params
|
||||||
|
PrepareCreateWindow(AWinControl, AParams, Params);
|
||||||
|
with Params do
|
||||||
|
pClassName := ListBoxClsName;
|
||||||
// create window
|
// create window
|
||||||
FinishCreateWindow(AWinControl, Params, False);
|
FinishCreateWindow(AWinControl, Params, False);
|
||||||
// listbox is not a transparent control -> no need for parentpainting
|
// listbox is not a transparent control -> no need for parentpainting
|
||||||
|
@ -931,6 +931,24 @@ const
|
|||||||
CBS_SORT = $0100;
|
CBS_SORT = $0100;
|
||||||
CBS_HASSTRINGS = $0200;
|
CBS_HASSTRINGS = $0200;
|
||||||
|
|
||||||
|
{ Listbox style }
|
||||||
|
LBS_NOTIFY = $0001;
|
||||||
|
LBS_SORT = $0002;
|
||||||
|
LBS_NOREDRAW = $0004;
|
||||||
|
LBS_MULTIPLESEL = $0008;
|
||||||
|
LBS_OWNERDRAWFIXED = $0010;
|
||||||
|
LBS_OWNERDRAWVARIABLE = $0020;
|
||||||
|
LBS_HASSTRINGS = $0040;
|
||||||
|
LBS_USETABSTOPS = $0080;
|
||||||
|
LBS_NOINTEGRALHEIGHT = $0100;
|
||||||
|
LBS_MULTICOLUMN = $0200;
|
||||||
|
LBS_WANTKEYBOARDINPUT = $0400;
|
||||||
|
LBS_EXTENDEDSEL = $0800;
|
||||||
|
LBS_DISABLENOSCROLL = $1000;
|
||||||
|
LBS_NODATA = $2000;
|
||||||
|
LBS_NOSEL = $4000;
|
||||||
|
LBS_STANDARD = $A00003;
|
||||||
|
|
||||||
const
|
const
|
||||||
//==============================================
|
//==============================================
|
||||||
// SetWindowPos Flags
|
// SetWindowPos Flags
|
||||||
|
@ -519,6 +519,7 @@ type
|
|||||||
procedure BeginAutoDrag; override;
|
procedure BeginAutoDrag; override;
|
||||||
function CalculateStandardItemHeight: Integer;
|
function CalculateStandardItemHeight: Integer;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
procedure InitializeWnd; override;
|
procedure InitializeWnd; override;
|
||||||
procedure FinalizeWnd; override;
|
procedure FinalizeWnd; override;
|
||||||
class function GetControlClassDefaultSize: TSize; override;
|
class function GetControlClassDefaultSize: TSize; override;
|
||||||
|
Loading…
Reference in New Issue
Block a user