From 02b316fcba8a112e528a0bddfcb93cf6f3179168 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sat, 13 Jun 2009 19:15:02 +0100 Subject: More changes in the UI to try and make things neater. This abandons the combo box approach an instead partially reverts to the popup. We now display a suffix after the stream title saying " on " or " from " where the part looks like a hyperlink and, when clicked, shows the popup to change the device. If there is only one device available, we suppress the whole thing and thus avoid confusion. --- src/sourceoutputwidget.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/sourceoutputwidget.h') diff --git a/src/sourceoutputwidget.h b/src/sourceoutputwidget.h index 0d43cc9..ecf937f 100644 --- a/src/sourceoutputwidget.h +++ b/src/sourceoutputwidget.h @@ -31,6 +31,7 @@ class SourceOutputWidget : public StreamWidget { public: SourceOutputWidget(BaseObjectType* cobject, const Glib::RefPtr& x); static SourceOutputWidget* create(MainWindow* mainWindow); + ~SourceOutputWidget(void); void init(MainWindow* mainWindow); @@ -39,13 +40,35 @@ public: uint32_t index, clientIndex; void setSourceIndex(uint32_t idx); uint32_t sourceIndex(); - virtual void onDeviceChange(); + virtual bool onDeviceChangePopup(GdkEventButton*); virtual void onKill(); private: MainWindow *mpMainWindow; uint32_t mSourceIndex; + void clearMenu(); + void buildMenu(); + + Gtk::Menu menu; + + struct SourceMenuItem { + SourceMenuItem(SourceOutputWidget *w, const char *label, uint32_t i, bool active) : + widget(w), + menuItem(label), + index(i) { + menuItem.set_active(active); + menuItem.set_draw_as_radio(true); + menuItem.signal_toggled().connect(sigc::mem_fun(*this, &SourceMenuItem::onToggle)); + } + + SourceOutputWidget *widget; + Gtk::CheckMenuItem menuItem; + uint32_t index; + void onToggle(); + }; + + std::map sourceMenuItems; }; #endif -- cgit