added remove/add workspace

This commit is contained in:
fluxgen 2002-02-27 23:43:41 +00:00
parent 0cba1e7dff
commit 188d53a879
2 changed files with 25 additions and 8 deletions

View file

@ -1,3 +1,5 @@
// Workspacemenu.cc for Fluxbox
// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
// Workspacemenu.cc for Blackbox - an X11 Window manager
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
@ -35,7 +37,8 @@
#include "Toolbar.hh"
#include "Workspacemenu.hh"
#include "Workspace.hh"
#include <iostream>
#include <cassert>
Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) {
screen = scrn;
@ -82,3 +85,19 @@ void Workspacemenu::itemSelected(int button, int index) {
hide();
}
}
void Workspacemenu::removeWorkspace(unsigned int id) {
if (id<getCount()) {
remove(id+2); // + 2 is where workspaces starts
#ifdef DEBUG
using namespace std;
cerr<<__FILE__<<"("<<__LINE__<<"): Removing "<<id<<endl;
#endif
}
}
void Workspacemenu::addWorkspace(Workspace *wkspc) {
assert(wkspc);
insert(wkspc->getName(), wkspc->getMenu(),
wkspc->getWorkspaceID() + 2);
}

View file

@ -1,3 +1,5 @@
// Workspacemenu.hh for Fluxbox
// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
// WorkspaceMenu.hh for Blackbox - an X11 Window manager
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
@ -22,24 +24,20 @@
#ifndef WORKSPACEMENU_HH
#define WORKSPACEMENU_HH
// forward declaration
class Workspacemenu;
class Toolbar;
#include "Basemenu.hh"
class Workspace;
class Workspacemenu : public Basemenu {
private:
BScreen *screen;
protected:
virtual void itemSelected(int, int);
public:
Workspacemenu(BScreen *);
void removeWorkspace(unsigned int id);
void addWorkspace(Workspace *wkspc);
};