X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fcontextbar.cpp;h=a538d64ac4caed2f68a44298b8cb6f4220b93a1e;hb=b1264f5650d4bd6cb801585ed5d1dc61226a21db;hp=8e92676a5137c897557e968d67424b72b3df60a7;hpb=1e256e16a17271fab3c9c57de3558b3b1c8184f4;p=pulseview.git diff --git a/pv/toolbars/contextbar.cpp b/pv/toolbars/contextbar.cpp index 8e92676..a538d64 100644 --- a/pv/toolbars/contextbar.cpp +++ b/pv/toolbars/contextbar.cpp @@ -18,8 +18,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + +#include +#include + #include "contextbar.h" +#include + +using namespace boost; using namespace std; namespace pv { @@ -30,5 +38,27 @@ ContextBar::ContextBar(QWidget *parent) : { } +void ContextBar::set_selected_items(const list< + weak_ptr > &items) +{ + clear(); + + if (items.empty()) + return; + + if (shared_ptr item = + items.front().lock()) { + + assert(item); + + const list actions( + item->get_context_bar_actions()); + BOOST_FOREACH(QAction *action, actions) { + assert(action); + addAction(action); + } + } +} + } // namespace toolbars } // namespace pv