From 1cd19c941cf8041bdba3efac5b4fca0ae73f0b77 Mon Sep 17 00:00:00 2001 From: akir Date: Mon, 6 Sep 2004 21:12:10 +0000 Subject: added button2-on-workspacename in workspacemenu jumps to workspacadded button2-on-workspacename in workspacemenu jumps to workspacee --- src/WorkspaceMenu.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/WorkspaceMenu.cc b/src/WorkspaceMenu.cc index 7e4f351..2719f97 100644 --- a/src/WorkspaceMenu.cc +++ b/src/WorkspaceMenu.cc @@ -19,19 +19,22 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WorkspaceMenu.cc,v 1.4 2004/06/08 13:15:30 rathnor Exp $ +// $Id: WorkspaceMenu.cc,v 1.5 2004/09/06 21:12:10 akir Exp $ #include "WorkspaceMenu.hh" #include "Screen.hh" #include "fluxbox.hh" #include "Workspace.hh" +#include "WorkspaceCmd.hh" #include "MenuCreator.hh" + #include "FbTk/I18n.hh" #include "FbTk/SimpleCommand.hh" #include "FbTk/RefCount.hh" #include "FbTk/MenuItem.hh" +#include "FbTk/MultiButtonMenuItem.hh" #include @@ -72,7 +75,12 @@ void WorkspaceMenu::update(FbTk::Subject *subj) { ++workspace) { Workspace *wkspc = screen.getWorkspace(workspace); wkspc->menu().setInternalMenu(); - insert(wkspc->name().c_str(), &wkspc->menu(), numberOfItems() - 1); + FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5, + wkspc->name().c_str(), + &wkspc->menu()); + FbTk::RefCount jump_cmd(new JumpToWorkspaceCmd(wkspc->workspaceID())); + mb_menu->setCommand(2, jump_cmd); + insert(mb_menu); } FbTk::Menu::update(-1); @@ -102,7 +110,12 @@ void WorkspaceMenu::init(BScreen &screen) { for (size_t workspace = 0; workspace < screen.getCount(); ++workspace) { Workspace *wkspc = screen.getWorkspace(workspace); wkspc->menu().setInternalMenu(); - insert(wkspc->name().c_str(), &wkspc->menu()); + FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5, + wkspc->name().c_str(), + &wkspc->menu()); + FbTk::RefCount jump_cmd(new JumpToWorkspaceCmd(wkspc->workspaceID())); + mb_menu->setCommand(2, jump_cmd); + insert(mb_menu); } setItemSelected(screen.currentWorkspace()->workspaceID() + 2, true); -- cgit v0.11.2