From ef8d6a825e5fdd7aa8cd57ac427892e116a7af25 Mon Sep 17 00:00:00 2001 From: ondrej Date: Tue, 26 May 2020 22:25:15 +0000 Subject: [PATCH] ComboBox: implement TComboBoxStyle.IsOwnerDrawn and .IsVariable and use them instead of the in [] syntax git-svn-id: trunk@63228 - --- lcl/include/customcombobox.inc | 48 ++++++++++++++----- lcl/include/dblookupcombobox.inc | 4 +- lcl/interfaces/cocoa/cocoawsstdctrls.pas | 5 +- .../customdrawn/customdrawnwsstdctrls.pas | 6 +-- lcl/interfaces/gtk/gtklistsl.inc | 2 +- lcl/interfaces/gtk/gtkwsstdctrls.pp | 28 +++++------ lcl/interfaces/gtk2/gtk2cellrenderer.pas | 6 +-- lcl/interfaces/gtk2/gtk2listsl.inc | 2 +- lcl/interfaces/gtk2/gtk2wsstdctrls.pp | 28 ++--------- lcl/interfaces/gtk3/gtk3cellrenderer.pas | 10 ++-- lcl/interfaces/gtk3/gtk3widgets.pas | 4 +- lcl/interfaces/qt/qtwsstdctrls.pp | 10 ++-- lcl/interfaces/qt5/qtwsstdctrls.pp | 10 ++-- lcl/interfaces/win32/win32callback.inc | 2 +- lcl/interfaces/wince/wincecallback.inc | 2 +- lcl/stdctrls.pp | 2 + 16 files changed, 80 insertions(+), 89 deletions(-) diff --git a/lcl/include/customcombobox.inc b/lcl/include/customcombobox.inc index c1dcddb222..02a79d56f3 100644 --- a/lcl/include/customcombobox.inc +++ b/lcl/include/customcombobox.inc @@ -92,8 +92,7 @@ begin if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then begin - if (Style in [csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable]) - and (FItemHeight > 0) then + if Style.IsOwnerDrawn and (FItemHeight > 0) then ItemHeight := Round(ItemHeight * AYProportion); end; end; @@ -126,7 +125,7 @@ procedure TCustomComboBox.DoEnter; begin inherited DoEnter; //AutoSelect when DoEnter is fired by keyboard - if (Style = csDropDownList) then Exit;//Non editable style + if not Style.HasEditBox then Exit;//Non editable style if (FAutoSelect and not (csLButtonDown in ControlState)) then begin SelectAll; @@ -543,7 +542,7 @@ begin //SelectAll when hitting return key for AutoSelect feature if (Key = VK_RETURN) then begin - if ((cbactEnabled in FAutoCompleteText) and (Style <> csDropDownList)) then + if ((cbactEnabled in FAutoCompleteText) and Style.HasEditBox) then begin // Only happens with alpha-numeric keys and return key and editable Style SelectAll; @@ -555,7 +554,7 @@ begin end; end else - if ((cbactEnabled in FAutoCompleteText) and (Style <> csDropDownList)) then + if ((cbactEnabled in FAutoCompleteText) and Style.HasEditBox) then begin //Only happens with alpha-numeric keys and return key and editable Style //DebugLn(['TCustomComboBox.KeyUp ',Key,' ',IsEditableTextKey(Key)]); @@ -670,9 +669,7 @@ function TCustomComboBox.GetItemHeight: Integer; begin // FItemHeight is not initialized at class creating. we can, but with what value? // so, if it still uninitialized (=0), then we ask widgetset - if (FStyle in [csOwnerDrawFixed, csOwnerDrawVariable, - csOwnerDrawEditableFixed, csOwnerDrawEditableVariable]) - and (FItemHeight > 0) or not HandleAllocated then + if FStyle.IsOwnerDrawn and (FItemHeight > 0) or not HandleAllocated then Result := FItemHeight else begin @@ -708,8 +705,7 @@ begin FItemHeight := AValue; if not HandleAllocated then exit; - if Style in [csOwnerDrawFixed, csOwnerDrawVariable, - csOwnerDrawEditableFixed, csOwnerDrawEditableVariable] then + if Style.IsOwnerDrawn then TWSCustomComboBoxClass(WidgetSetClass).SetItemHeight(Self, FItemHeight); end; @@ -1040,7 +1036,7 @@ begin AHeight := FItemHeight else AHeight := ItemHeight; - if FStyle in [csOwnerDrawVariable, csOwnerDrawEditableVariable] then + if FStyle.IsVariable then MeasureItem(Integer(ItemId), AHeight); if AHeight > 0 then ItemHeight := AHeight; @@ -1133,4 +1129,34 @@ begin Result := ArrHasEditBox[Self]; end; +function TComboBoxStyleHelper.IsOwnerDrawn: Boolean; +const + ArrIsOwnerDrawn: array[TComboBoxStyle] of Boolean = ( + False, // csDropDown, // like an TEdit plus a button to drop down the list, default + False, // csSimple, // like an TEdit plus a TListBox + False, // csDropDownList, // like TLabel plus a button to drop down the list + True, // csOwnerDrawFixed, // like csDropDownList, but custom drawn + True, // csOwnerDrawVariable,// like csDropDownList, but custom drawn and with each item can have another height + True, // csOwnerDrawEditableFixed,// like csOwnerDrawFixed, but with TEdit + True // csOwnerDrawEditableVariable// like csOwnerDrawVariable, but with TEdit + ); +begin + Result := ArrIsOwnerDrawn[Self]; +end; + +function TComboBoxStyleHelper.IsVariable: Boolean; +const + ArrIsVariable: array[TComboBoxStyle] of Boolean = ( + False, // csDropDown, // like an TEdit plus a button to drop down the list, default + False, // csSimple, // like an TEdit plus a TListBox + False, // csDropDownList, // like TLabel plus a button to drop down the list + False, // csOwnerDrawFixed, // like csDropDownList, but custom drawn + True, // csOwnerDrawVariable,// like csDropDownList, but custom drawn and with each item can have another height + False, // csOwnerDrawEditableFixed,// like csOwnerDrawFixed, but with TEdit + True // csOwnerDrawEditableVariable// like csOwnerDrawVariable, but with TEdit + ); +begin + Result := ArrIsVariable[Self]; +end; + // included by stdctrls.pp diff --git a/lcl/include/dblookupcombobox.inc b/lcl/include/dblookupcombobox.inc index 8d5e0ea0c3..d91112833f 100644 --- a/lcl/include/dblookupcombobox.inc +++ b/lcl/include/dblookupcombobox.inc @@ -31,7 +31,7 @@ var i: Integer; begin // combo that has edit control may have unreliable itemindex like bug 20950 - if Style <> csDropDownList then + if Style.HasEditBox then ItemIndex := Items.IndexOf(Text); i := ItemIndex; if i <> -1 then @@ -87,7 +87,7 @@ end; procedure TDBLookupComboBox.DoOnSelect; begin - if Style=csDropDownList then + if not Style.HasEditBox then UpdateRecord; inherited DoOnSelect; end; diff --git a/lcl/interfaces/cocoa/cocoawsstdctrls.pas b/lcl/interfaces/cocoa/cocoawsstdctrls.pas index 821a2a2fcb..ae59703c0f 100644 --- a/lcl/interfaces/cocoa/cocoawsstdctrls.pas +++ b/lcl/interfaces/cocoa/cocoawsstdctrls.pas @@ -496,13 +496,12 @@ end; function ComboBoxIsOwnerDrawn(AStyle: TComboBoxStyle): Boolean; begin - Result := AStyle in [csOwnerDrawFixed, csOwnerDrawVariable, - csOwnerDrawEditableFixed, csOwnerDrawEditableVariable]; + Result := AStyle.IsOwnerDrawn; end; function ComboBoxIsVariable(AStyle: TComboBoxStyle): Boolean; begin - Result := AStyle in [csOwnerDrawVariable, csOwnerDrawEditableVariable]; + Result := AStyle.IsVariable; end; procedure ComboBoxSetBorderStyle(box: NSComboBox; astyle: TBorderStyle); diff --git a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas index 50732eed39..795ca36d3e 100644 --- a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas +++ b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas @@ -796,10 +796,8 @@ end; class procedure TCDWSCustomComboBox.SetStyle( const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); begin - TQtComboBox(ACustomComboBox.Handle).setEditable(NewStyle = csDropDown); - TQtComboBox(ACustomComboBox.Handle).OwnerDrawn := NewStyle in - [csOwnerDrawFixed, - csOwnerDrawVariable]; + TQtComboBox(ACustomComboBox.Handle).setEditable(NewStyle.HasEditBox); + TQtComboBox(ACustomComboBox.Handle).OwnerDrawn := NewStyle.IsOwnerDrawn; // TODO: implement styles: csSimple inherited SetStyle(ACustomComboBox, NewStyle); end; diff --git a/lcl/interfaces/gtk/gtklistsl.inc b/lcl/interfaces/gtk/gtklistsl.inc index 0445240366..a49463b687 100644 --- a/lcl/interfaces/gtk/gtklistsl.inc +++ b/lcl/interfaces/gtk/gtklistsl.inc @@ -69,7 +69,7 @@ begin if TCustomListbox(LCLList.Owner).Style = lbStandard then exit; if LclList.Owner is TCustomCombobox then - if TCustomCombobox(LclList.Owner).Style < csOwnerDrawFixed then + if not TCustomCombobox(LclList.Owner).Style.IsOwnerDrawn then exit; // get itemindex and area diff --git a/lcl/interfaces/gtk/gtkwsstdctrls.pp b/lcl/interfaces/gtk/gtkwsstdctrls.pp index 34a6b90619..839463fcd6 100644 --- a/lcl/interfaces/gtk/gtkwsstdctrls.pp +++ b/lcl/interfaces/gtk/gtkwsstdctrls.pp @@ -1168,21 +1168,19 @@ var GtkCombo: PGtkCombo; begin GtkCombo := GTK_COMBO(Pointer(ACustomComboBox.Handle)); - case ACustomComboBox.Style of - csDropDownList : - begin - // do not set ok_if_empty = true, otherwise it can hang focus - gtk_combo_set_value_in_list(GtkCombo,GdkTrue,GdkTrue); - gtk_combo_set_use_arrows_always(GtkCombo,GdkTrue); - gtk_combo_set_case_sensitive(GtkCombo,GdkFalse); - end; - else - begin - // do not set ok_if_empty = true, otherwise it can hang focus - gtk_combo_set_value_in_list(GtkCombo,GdkFalse,GdkTrue); - gtk_combo_set_use_arrows_always(GtkCombo,GdkFalse); - gtk_combo_set_case_sensitive(GtkCombo,GdkTrue); - end; + if not ACustomComboBox.Style.HasEditBox then + begin + // do not set ok_if_empty = true, otherwise it can hang focus + gtk_combo_set_value_in_list(GtkCombo,GdkTrue,GdkTrue); + gtk_combo_set_use_arrows_always(GtkCombo,GdkTrue); + gtk_combo_set_case_sensitive(GtkCombo,GdkFalse); + end + else + begin + // do not set ok_if_empty = true, otherwise it can hang focus + gtk_combo_set_value_in_list(GtkCombo,GdkFalse,GdkTrue); + gtk_combo_set_use_arrows_always(GtkCombo,GdkFalse); + gtk_combo_set_case_sensitive(GtkCombo,GdkTrue); end; end; diff --git a/lcl/interfaces/gtk2/gtk2cellrenderer.pas b/lcl/interfaces/gtk2/gtk2cellrenderer.pas index 5c4233dfbd..b212405e7f 100644 --- a/lcl/interfaces/gtk2/gtk2cellrenderer.pas +++ b/lcl/interfaces/gtk2/gtk2cellrenderer.pas @@ -120,7 +120,7 @@ begin if TCustomListbox(AWinControl).Style < lbOwnerDrawFixed then exit; if AWinControl is TCustomCombobox then - if TCustomCombobox(AWinControl).Style < csOwnerDrawVariable then + if not TCustomCombobox(AWinControl).Style.IsVariable then exit; ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget); @@ -255,7 +255,7 @@ begin if TCustomListbox(AWinControl).Style = lbStandard then exit; if AWinControl is TCustomCombobox then - if TCustomCombobox(AWinControl).Style < csOwnerDrawFixed then + if not TCustomCombobox(AWinControl).Style.IsOwnerDrawn then exit; // get itemindex and area @@ -438,7 +438,7 @@ begin if (WidgetInfo <> nil) and (WidgetInfo^.LCLObject is TCustomComboBox) and - (TCustomComboBox(WidgetInfo^.LCLObject).Style = csDropDownList) and + not (TCustomComboBox(WidgetInfo^.LCLObject).Style.HasEditBox) and not (TCustomComboBox(WidgetInfo^.LCLObject).DroppedDown) then begin Value.g_type := G_TYPE_UINT; diff --git a/lcl/interfaces/gtk2/gtk2listsl.inc b/lcl/interfaces/gtk2/gtk2listsl.inc index 012359061b..acb5905473 100644 --- a/lcl/interfaces/gtk2/gtk2listsl.inc +++ b/lcl/interfaces/gtk2/gtk2listsl.inc @@ -69,7 +69,7 @@ begin if TCustomListbox(LCLList.Owner).Style = lbStandard then exit; if LclList.Owner is TCustomCombobox then - if TCustomCombobox(LclList.Owner).Style < csOwnerDrawFixed then + if not TCustomCombobox(LclList.Owner).Style.IsOwnerDrawn then exit; // get itemindex and area diff --git a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp index acce900483..4f38cc428b 100644 --- a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp +++ b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp @@ -1559,7 +1559,7 @@ begin g_object_set_data(G_OBJECT(renderer), 'widgetinfo', AWidgetInfo); gtk_cell_layout_clear(PGtkCellLayout(AWidget)); gtk_cell_layout_pack_start(PGtkCellLayout(AWidget), renderer, True); - if not (ACustomComboBox.Style in [csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable]) then + if not ACustomComboBox.Style.IsOwnerDrawn then gtk_cell_layout_set_attributes(PGtkCellLayout(AWidget), renderer, ['text', 0, nil]); gtk_cell_layout_set_cell_data_func(PGtkCellLayout(AWidget), renderer, @LCLIntfCellRenderer_CellDataFunc, AWidgetInfo, nil); @@ -2009,17 +2009,7 @@ var begin WidgetInfo := GetWidgetInfo({%H-}Pointer(ACustomComboBox.Handle)); p := WidgetInfo^.CoreWidget; - case NewStyle of - csDropDown, - csSimple, - csOwnerDrawEditableFixed, - csOwnerDrawEditableVariable: - NeedEntry := True; - csDropDownList, - csOwnerDrawFixed, - csOwnerDrawVariable: - NeedEntry := False; - end; + NeedEntry := NewStyle.HasEditBox; if gtk_is_combo_box_entry(p) = NeedEntry then Exit; ReCreateCombo(ACustomComboBox, NeedEntry, WidgetInfo); end; @@ -2141,7 +2131,6 @@ var ACustomComboBox: TCustomComboBox; ItemList: TGtkListStoreStringList; LCLIndex: PLongint; - NeedEntry: Boolean; begin ACustomComboBox := TCustomComboBox(AWinControl); @@ -2154,18 +2143,7 @@ begin ListStore := gtk_list_store_new (2, [G_TYPE_STRING, G_TYPE_POINTER, nil]); - case ACustomComboBox.Style of - csDropDown, - csSimple, - csOwnerDrawEditableFixed, - csOwnerDrawEditableVariable: - NeedEntry := True; - csDropDownList, - csOwnerDrawFixed, - csOwnerDrawVariable: - NeedEntry := False; - end; - if NeedEntry then + if ACustomComboBox.Style.HasEditBox then ComboWidget := gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL (ListStore), 0) else ComboWidget := gtk_combo_box_new_with_model(GTK_TREE_MODEL (ListStore)); diff --git a/lcl/interfaces/gtk3/gtk3cellrenderer.pas b/lcl/interfaces/gtk3/gtk3cellrenderer.pas index 8f5a44cc17..818535a105 100644 --- a/lcl/interfaces/gtk3/gtk3cellrenderer.pas +++ b/lcl/interfaces/gtk3/gtk3cellrenderer.pas @@ -168,7 +168,7 @@ begin if TCustomListbox(AWinControl).Style < lbOwnerDrawFixed then exit; if AWinControl is TCustomCombobox then - if TCustomCombobox(AWinControl).Style < csOwnerDrawVariable then + if not TCustomCombobox(AWinControl).Style.IsVariable then exit; ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget); @@ -272,7 +272,7 @@ begin if TCustomListbox(AWinControl).Style < lbOwnerDrawFixed then exit; if AWinControl is TCustomCombobox then - if TCustomCombobox(AWinControl).Style < csOwnerDrawVariable then + if not TCustomCombobox(AWinControl).Style.IsVariable then exit; ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget); @@ -322,7 +322,7 @@ begin if TCustomListbox(AWinControl).Style < lbOwnerDrawFixed then exit; if AWinControl is TCustomCombobox then - if TCustomCombobox(AWinControl).Style < csOwnerDrawVariable then + if not TCustomCombobox(AWinControl).Style.IsVariable then exit; ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget); @@ -487,7 +487,7 @@ begin if TCustomListbox(AWinControl).Style = lbStandard then exit; if AWinControl is TCustomCombobox then - if TCustomCombobox(AWinControl).Style < csOwnerDrawFixed then + if not TCustomCombobox(AWinControl).Style.IsOwnerDrawn then exit; ItemIndex := GetItemIndex(PLCLIntfCellRenderer(cell), Widget); @@ -673,7 +673,7 @@ begin // DebugLn(['LCLIntfCellRenderer_CellDataFunc stamp=',iter^.stamp,' tree_model=',dbgs(tree_model),' cell=',dbgs(cell),' WidgetInfo=',WidgetInfo <> nil,' Time=',TimeToStr(Now)]); if (wtComboBox in TGtk3Widget(Data).WidgetType) and - (TCustomComboBox(TGtk3Widget(Data).LCLObject).Style = csDropDownList) and + not (TCustomComboBox(TGtk3Widget(Data).LCLObject).Style.HasEditBox) and not (TCustomComboBox(TGtk3Widget(Data).LCLObject).DroppedDown) then begin Value.g_type := G_TYPE_UINT; diff --git a/lcl/interfaces/gtk3/gtk3widgets.pas b/lcl/interfaces/gtk3/gtk3widgets.pas index 526447e155..55af88c714 100644 --- a/lcl/interfaces/gtk3/gtk3widgets.pas +++ b/lcl/interfaces/gtk3/gtk3widgets.pas @@ -6221,8 +6221,6 @@ begin g_object_set_data(PGObject(Result), GtkListItemLCLListTag, ItemList); PGtkComboBox(Result)^.set_entry_text_column(0); - if ACombo.Style = csDropDownList then - PGtkEditable(PGtkComboBox(Result)^.get_child)^.set_editable(False); // do not allow combo button to get focus, entry should take focus if PGtkComboBox(Result)^.priv3^.button <> nil then PGtkComboBox(Result)^.priv3^.button^.set_can_focus(False); @@ -6250,7 +6248,7 @@ begin gtk_cell_layout_clear(PGtkCellLayout(FCentralWidget)); gtk_cell_layout_pack_start(PGtkCellLayout(FCentralWidget), renderer, True); - if not (ACombo.Style in [csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable]) then + if not ACombo.Style.IsOwnerDrawn then gtk_cell_layout_set_attributes(PGtkCellLayout(FCentralWidget), renderer, ['text', 0, nil]); gtk_cell_layout_set_cell_data_func(PGtkCellLayout(FCentralWidget), renderer, @LCLIntfCellRenderer_CellDataFunc, Self, nil); diff --git a/lcl/interfaces/qt/qtwsstdctrls.pp b/lcl/interfaces/qt/qtwsstdctrls.pp index 7bda5ac00d..c54f1a0507 100644 --- a/lcl/interfaces/qt/qtwsstdctrls.pp +++ b/lcl/interfaces/qt/qtwsstdctrls.pp @@ -1639,11 +1639,7 @@ class procedure TQtWSCustomComboBox.SetStyle( const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); begin TQtComboBox(ACustomComboBox.Handle).setEditable(NewStyle.HasEditBox); - TQtComboBox(ACustomComboBox.Handle).OwnerDrawn := NewStyle in - [csOwnerDrawFixed, - csOwnerDrawVariable, - csOwnerDrawEditableFixed, - csOwnerDrawEditableVariable]; + TQtComboBox(ACustomComboBox.Handle).OwnerDrawn := NewStyle.IsOwnerDrawn; // TODO: implement styles: csSimple inherited SetStyle(ACustomComboBox, NewStyle); end; @@ -1718,12 +1714,12 @@ var begin if not WSCheckHandleAllocated(ACustomComboBox, 'SetItemHeight') then Exit; - {only for csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable} + {only for OwnerDrawn} ComboBox := TQtComboBox(ACustomComboBox.Handle); if ComboBox.getDroppedDown then begin ComboBox.DropList.setUniformItemSizes(False); - ComboBox.DropList.setUniformItemSizes(ACustomComboBox.Style in [csOwnerDrawFixed, csOwnerDrawEditableFixed]); + ComboBox.DropList.setUniformItemSizes(ACustomComboBox.Style.IsOwnerDrawn); end else RecreateWnd(ACustomComboBox); end; diff --git a/lcl/interfaces/qt5/qtwsstdctrls.pp b/lcl/interfaces/qt5/qtwsstdctrls.pp index a14192e989..fb9e298974 100644 --- a/lcl/interfaces/qt5/qtwsstdctrls.pp +++ b/lcl/interfaces/qt5/qtwsstdctrls.pp @@ -1584,11 +1584,7 @@ class procedure TQtWSCustomComboBox.SetStyle( const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); begin TQtComboBox(ACustomComboBox.Handle).setEditable(NewStyle.HasEditBox); - TQtComboBox(ACustomComboBox.Handle).OwnerDrawn := NewStyle in - [csOwnerDrawFixed, - csOwnerDrawVariable, - csOwnerDrawEditableFixed, - csOwnerDrawEditableVariable]; + TQtComboBox(ACustomComboBox.Handle).OwnerDrawn := NewStyle.IsOwnerDrawn; // TODO: implement styles: csSimple inherited SetStyle(ACustomComboBox, NewStyle); end; @@ -1663,12 +1659,12 @@ var begin if not WSCheckHandleAllocated(ACustomComboBox, 'SetItemHeight') then Exit; - {only for csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable} + {only for OwnerDrawn} ComboBox := TQtComboBox(ACustomComboBox.Handle); if ComboBox.getDroppedDown then begin ComboBox.DropList.setUniformItemSizes(False); - ComboBox.DropList.setUniformItemSizes(ACustomComboBox.Style in [csOwnerDrawFixed, csOwnerDrawEditableFixed]); + ComboBox.DropList.setUniformItemSizes(ACustomComboBox.Style.IsOwnerDrawn); end else RecreateWnd(ACustomComboBox); end; diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index 212802f394..c40834797b 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -1464,7 +1464,7 @@ begin (((lWinControl is TCustomListbox) and (TCustomListBox(lWinControl).Style <> lbStandard)) or ((lWinControl is TCustomCombobox) and - (TCustomCombobox(lWinControl).Style in [csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable]))) + TCustomCombobox(lWinControl).Style.IsOwnerDrawn)) then UpdateDrawListItem(LM_DRAWLISTITEM) else if Assigned(WindowInfo^.DrawItemHandler) then begin diff --git a/lcl/interfaces/wince/wincecallback.inc b/lcl/interfaces/wince/wincecallback.inc index e646b3b4c2..6e0d0d627a 100644 --- a/lcl/interfaces/wince/wincecallback.inc +++ b/lcl/interfaces/wince/wincecallback.inc @@ -1372,7 +1372,7 @@ begin if ((lWinControl is TCustomListbox) and (TCustomListBox(lWinControl).Style <> lbStandard)) or ((lWinControl is TCustomCombobox) and - (TCustomCombobox(lWinControl).Style in [csOwnerDrawFixed, csOwnerDrawVariable, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable])) + TCustomCombobox(lWinControl).Style.IsOwnerDrawn) then begin if PDrawItemStruct(LParam)^.itemID <> dword(-1) then diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 820e6ac13c..3dca100503 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -261,6 +261,8 @@ type TComboBoxStyleHelper = type helper for TComboBoxStyle public function HasEditBox: Boolean; + function IsOwnerDrawn: Boolean; + function IsVariable: Boolean; end; TOwnerDrawState = LCLType.TOwnerDrawState;