Re: Filling a ComboBoxEntry "on demand"



Oops! Please accept my apologies, I'm not much experienced with the way these things works. Sorry also for the delay.
I hope this time I got it right.

diff -up cbe_example/examplewindow.cc cbe_mine/examplewindow.cc
--- cbe_example/examplewindow.cc	2006-12-15 22:22:54.000000000 +0100
+++ cbe_mine/examplewindow.cc	2006-12-15 22:27:22.000000000 +0100
@@ -34,6 +34,9 @@ ExampleWindow::ExampleWindow()
   //Connect signal handler:
   m_Combo.signal_changed().connect( sigc::mem_fun(*this, &ExampleWindow::on_combo_changed) );
 
+  m_Combo.get_entry()->signal_populate_popup().connect(sigc::mem_fun(*this, &ExampleWindow::on_populate_popup));
+  g_signal_connect(m_Combo.gobj(), "notify::popup-shown", G_CALLBACK(&ExampleWindow::on_populate_popup_gtk), &m_Combo);
+
   show_all_children();
 }
 
@@ -48,3 +51,12 @@ void ExampleWindow::on_combo_changed()
     std::cout << "Combo changed: " << text << std::endl;
 }
 
+void ExampleWindow::on_populate_popup(Gtk::Menu* menu)
+{
+  std::cout << "populate_popup called" << std::endl;
+}
+
+void ExampleWindow::on_populate_popup_gtk(gpointer instance, gpointer user_data)
+{
+  std::cout << "populate_popup_gtk called" << std::endl;
+}
diff -up cbe_example/examplewindow.h cbe_mine/examplewindow.h
--- cbe_example/examplewindow.h	2006-12-15 22:22:59.000000000 +0100
+++ cbe_mine/examplewindow.h	2006-12-15 22:27:56.000000000 +0100
@@ -31,6 +31,8 @@ public:
 protected:
   //Signal handlers:
   virtual void on_combo_changed();
+  void on_populate_popup(Gtk::Menu* menu);
+  static void on_populate_popup_gtk(gpointer instance, gpointer user_data);
 
   //Child widgets:
   Gtk::ComboBoxEntryText m_Combo;
Only in cbe_example/: test.patch


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]