gtk2: support for combobox readonly

git-svn-id: branches/comboboxreadonly@63239 -
This commit is contained in:
dmitry 2020-05-28 13:35:12 +00:00
parent dbeeed9c09
commit 02b7d44d7d

View File

@ -129,6 +129,7 @@ type
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); override;
class procedure SetReadOnly(const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean); override;
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
class procedure Sort(const ACustomComboBox: TCustomComboBox; {%H-}AList: TStrings; IsSorted: boolean); override;
@ -2014,6 +2015,19 @@ begin
ReCreateCombo(ACustomComboBox, NeedEntry, WidgetInfo);
end;
class procedure TGtk2WSCustomComboBox.SetReadOnly(
const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean);
var
WidgetInfo: PWidgetInfo;
Entry: PGtkEntry;
begin
WidgetInfo := GetWidgetInfo({%H-}Pointer(ACustomComboBox.Handle));
Entry := GetComboBoxEntry(WidgetInfo^.CoreWidget);
if (Entry<>nil) and (ACustomComboBox.Style in [csDropDown, csOwnerDrawEditableFixed, csOwnerDrawEditableVariable, csSimple]) then
gtk_entry_set_editable(PGtkEditable(Entry), not NewReadOnly);
end;
class function TGtk2WSCustomComboBox.GetItems(
const ACustomComboBox: TCustomComboBox): TStrings;
var