lcl: move combobox style from win32 to LCL createparams, override unsupported styles in wince

git-svn-id: trunk@25793 -
This commit is contained in:
paul 2010-05-31 06:22:37 +00:00
parent 946321d393
commit 9094e47382
5 changed files with 31 additions and 9 deletions

View File

@ -458,6 +458,23 @@ begin
RegisterCustomComboBox;
end;
procedure TCustomComboBox.CreateParams(var Params: TCreateParams);
const
ComboBoxStyles: array[TComboBoxStyle] of dword = (
CBS_DROPDOWN, CBS_SIMPLE, CBS_DROPDOWNLIST,
CBS_OWNERDRAWFIXED, CBS_OWNERDRAWVARIABLE);
ComboBoxReadOnlyStyles: array[boolean] of dword = (
CBS_DROPDOWN, CBS_DROPDOWNLIST);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or (WS_VSCROLL or CBS_AUTOHSCROLL or CBS_HASSTRINGS) or
ComboBoxStyles[Style];
if Style in [csOwnerDrawFixed, csOwnerDrawVariable] then
Params.Style := Params.Style or ComboBoxReadOnlyStyles[ReadOnly];
if Sorted then
Params.Style := Params.Style or CBS_SORT;
end;
procedure TCustomComboBox.KeyDown(var Key: Word; Shift: TShiftState);
var
skip : Boolean;

View File

@ -761,18 +761,14 @@ begin
// customization of Params
with Params do
begin
Flags := Flags or CalcComboBoxWinFlags(TCustomComboBox(AWinControl));
if TComboBox(AWinControl).Sorted Then
Flags:= Flags or CBS_SORT;
pClassName := ComboboxClsName;
pSubClassName := LCLComboboxClsName;
Flags := Flags or (WS_VSCROLL or CBS_AUTOHSCROLL or CBS_HASSTRINGS);
SubClassWndProc := @ComboBoxWindowProc;
end;
// create window
FinishCreateWindow(AWinControl, Params, False, True);
Info.cbSize:= SizeOf(Info);
Info.cbSize := SizeOf(Info);
Win32Extra.GetComboBoxInfo(Params.Window, @Info);
// get edit window within

View File

@ -640,11 +640,9 @@ begin
// customization of Params
with Params do
begin
Flags := Flags or CalcComboBoxWinFlags(TCustomComboBox(AWinControl));
If TComboBox(AWinControl).Sorted Then
Flags:= Flags or CBS_SORT;
// remove unsupported styles
Flags := Flags and not (CBS_SIMPLE or CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE);
pClassName := @ComboboxClsName;
Flags := Flags or (WS_VSCROLL or CBS_AUTOHSCROLL or CBS_HASSTRINGS);
SubClassWndProc := @ComboBoxWindowProc;
end;
// create window

View File

@ -924,6 +924,16 @@ const
ES_READONLY = $0800;
ES_WANTRETURN = $1000;
{ Combobox style }
CBS_SIMPLE = $0001;
CBS_DROPDOWN = $0002;
CBS_DROPDOWNLIST = $0003;
CBS_OWNERDRAWFIXED = $0010;
CBS_OWNERDRAWVARIABLE = $0020;
CBS_AUTOHSCROLL = $0040;
CBS_SORT = $0100;
CBS_HASSTRINGS = $0200;
const
//==============================================
// SetWindowPos Flags

View File

@ -302,6 +302,7 @@ type
procedure SetCharCase(eccCharCase: TEditCharCase);
protected
class procedure WSRegisterClass; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure InitializeWnd; override;
procedure DestroyWnd; override;
procedure DoEnter; override;