fix bug #0012850 OnGetItems event is not called, when TComboBox is empty

git-svn-id: trunk@18339 -
This commit is contained in:
paul 2009-01-19 09:47:29 +00:00
parent 22804ba42e
commit 9777610c5a

View File

@ -101,6 +101,7 @@ type
class procedure ReCreateCombo(const ACustomComboBox: TCustomComboBox; const AWithEntry: Boolean; const AWidgetInfo: PWidgetInfo); virtual;
class procedure SetRenderer(const ACustomComboBox: TCustomComboBox; AWidget: PGtkWidget; AWidgetInfo: PWidgetInfo); virtual;
class procedure SetCallbacks(const AWinControl: tWinControl; const AWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
class procedure SetSensetivity(AWinControl: TWinControl; AWidget: PGtkWidget);
published
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
@ -1002,6 +1003,7 @@ begin
True : ComboWidget := gtk_combo_box_entry_new_with_model(Model, 0);
False: ComboWidget := gtk_combo_box_new_with_model(Model);
end;
SetSensetivity(ACustomCombobox, ComboWidget);
// undone the above increase of the ref count
gtk_object_set_data(PGtkObject(ComboWidget),GtkListItemLCLListTag,ItemList);
g_object_unref (G_OBJECT(Model));
@ -1207,6 +1209,19 @@ begin
g_object_set_data(G_OBJECT(AWidget), 'Menu', APrivate^.popup_widget);
end;
class procedure TGtk2WSCustomComboBox.SetSensetivity(AWinControl: TWinControl; AWidget: PGtkWidget);
var
Value: TGValue;
begin
if ((gtk_major_version = 2) and (gtk_minor_version < 14)) or
(csDesigning in AWinControl.ComponentState) then
Exit;
Value.g_type := G_TYPE_BOOLEAN;
Value.data[0].v_int := gTRUE;
g_object_set_property(PGObject(AWidget), 'button-sensitivity', @Value);
end;
class procedure TGtk2WSCustomComboBox.GetPreferredSize(
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean);
@ -1535,6 +1550,8 @@ begin
ComboWidget := gtk_combo_box_new_with_model(GTK_TREE_MODEL (ListStore));
end;
SetSensetivity(AWinControl, ComboWidget);
g_object_unref (G_OBJECT (liststore));
gtk_container_add(PGtkContainer(Box), ComboWidget);