taskbar snippet
Code: Select all
MyTaskBarIcon::MyTaskBarIcon (MyFrame *_parent)
: wxTaskBarIcon(wxTBI_DEFAULT_TYPE), parent(_parent), m_IsTimerOn(false)
{
Bind (wxEVT_MENU, &MyFrame::on_exit_item, parent, wxID_EXIT);
Bind (wxEVT_MENU, &MyFrame::on_pref_item, parent, wxID_PREFERENCES);
Bind (wxEVT_MENU, &MyFrame::on_play_item, parent, IDM_PLAY);
Bind (wxEVT_TASKBAR_LEFT_DOWN, &MyTaskBarIcon::on_tray_clicked, this);
}
wxMenu* MyTaskBarIcon::CreatePopupMenu () {
tmp = new wxMenu ();
wxFileName f(DATA_DIR, m_IsTimerOn ? wxT("stop.png") : wxT("play.png"));
wxBitmap bitmap (f.GetFullPath(), wxBITMAP_TYPE_PNG);
wxMenuItem *m_menuItem1 = new wxMenuItem (tmp, IDM_PLAY, m_IsTimerOn ? _("&Stop") : _("&Start"));
m_menuItem1->SetBitmap (bitmap);
tmp->Append (m_menuItem1);
tmp->AppendSeparator();
wxMenuItem* m_menuItem2 = new wxMenuItem (tmp, wxID_PREFERENCES);
tmp->Append (m_menuItem2);
tmp->AppendSeparator();
wxMenuItem* m_menuItem3 = new wxMenuItem (tmp, wxID_EXIT);
tmp->Append (m_menuItem3);
return tmp;
}
Code: Select all
wxMenuBar *m_menubar1 = new wxMenuBar( 0 );
m_menu1 = m_tbIcon->CreatePopupMenu ();
m_menubar1->Append (m_menu1, _("&Application"));
1.- Somehow when IDM_PLAY is activated from frame or context menu, send the state to the other one.
2.- In my frame's menubar trap/catch the event the popups the menu and I can "manually" change its state to emulate the one in the context.
any ideas for this one?