From 4ac5113a66733f5cee55ab4bbac3c5d4f0a39fdb Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 3 Jun 2008 12:02:34 +0000 Subject: [PATCH] gtk2 intf: implemented LM_SelChange event for TGtk2WSCustomListBox, bug #11229, #11356, #11337 git-svn-id: trunk@15298 - --- lcl/interfaces/gtk2/gtk2int.pas | 1 + lcl/interfaces/gtk2/gtk2wsstdctrls.pp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lcl/interfaces/gtk2/gtk2int.pas b/lcl/interfaces/gtk2/gtk2int.pas index ca4f7491f3..39be0de27f 100644 --- a/lcl/interfaces/gtk2/gtk2int.pas +++ b/lcl/interfaces/gtk2/gtk2int.pas @@ -626,6 +626,7 @@ begin gtk_list_store_insert(FGtkListStore, @li, Index); gtk_list_store_set(FGtkListStore, @li, [FColumnIndex, PChar(S), -1]); IncreaseChangeStamp; + // ToDo: connect callbacks if not (glsCountNeedsUpdate in FStates) then inc(FCachedCount); diff --git a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp index 1cd09520df..f34712b70c 100644 --- a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp +++ b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp @@ -575,6 +575,20 @@ begin Gtk2WidgetSet.SetWidgetFont(Widget, AFont); end; +function gtk2ListBoxSelectionChangedAfter(Widget: PGtkWidget; + AWinControl: TWinControl): gboolean; cdecl; +var + Mess: TLMessage; +begin + Result := CallBackDefaultReturn; + {$IFDEF EventTrace} + EventTrace('gtk2ListSelectionChangedAfter', dbgsName(AWinControl)); + {$ENDIF} + FillChar(Mess,SizeOf(Mess),0); + Mess.msg := LM_SelChange; + DeliverMessage(AWinControl, Mess); +end; + class function TGtk2WSCustomListBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; var @@ -630,6 +644,9 @@ begin True : gtk_tree_selection_set_mode(Selection, GTK_SELECTION_MULTIPLE); False: gtk_tree_selection_set_mode(Selection, GTK_SELECTION_SINGLE); end; + + g_signal_connect_after(Selection, 'changed', + G_CALLBACK(@gtk2ListBoxSelectionChangedAfter), AWinControl); // Sets the callbacks SetCallbacks(p, WidgetInfo);