diff options
author | Colin Guthrie <cguthrie@mandriva.org> | 2009-06-13 19:15:02 +0100 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2009-06-17 08:54:14 +0100 |
commit | 02b316fcba8a112e528a0bddfcb93cf6f3179168 (patch) | |
tree | 96471135e9d83af7ebb275d77e71c9d0c0b6033d /src/sourceoutputwidget.h | |
parent | e71562619a67fa6823ba5d14c3df411b12fe192b (diff) |
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 <device>" or " from <device>"
where the <device> 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.
Diffstat (limited to 'src/sourceoutputwidget.h')
-rw-r--r-- | src/sourceoutputwidget.h | 25 |
1 files changed, 24 insertions, 1 deletions
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<Gnome::Glade::Xml>& 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<uint32_t, SourceMenuItem*> sourceMenuItems; }; #endif |