replaced by FbTk Menu
This commit is contained in:
parent
6c7f8c4d15
commit
55b9d5ffb0
6 changed files with 0 additions and 1800 deletions
1083
src/Basemenu.cc
1083
src/Basemenu.cc
File diff suppressed because it is too large
Load diff
216
src/Basemenu.hh
216
src/Basemenu.hh
|
@ -1,216 +0,0 @@
|
||||||
// Basemenu.hh for Fluxbox Window manager
|
|
||||||
// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
|
|
||||||
//
|
|
||||||
// Basemenu.hh for Blackbox - an X11 Window manager
|
|
||||||
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
// $Id: Basemenu.hh,v 1.23 2003/01/09 21:57:46 fluxgen Exp $
|
|
||||||
|
|
||||||
#ifndef BASEMENU_HH
|
|
||||||
#define BASEMENU_HH
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "FbWindow.hh"
|
|
||||||
#include "EventHandler.hh"
|
|
||||||
|
|
||||||
class BasemenuItem;
|
|
||||||
class BScreen;
|
|
||||||
|
|
||||||
namespace FbTk {
|
|
||||||
class ImageControl;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
Base class for menus
|
|
||||||
*/
|
|
||||||
class Basemenu: public FbTk::EventHandler {
|
|
||||||
public:
|
|
||||||
enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM };
|
|
||||||
enum { RIGHT = 1, LEFT };
|
|
||||||
|
|
||||||
/**
|
|
||||||
Bullet type
|
|
||||||
*/
|
|
||||||
enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND };
|
|
||||||
|
|
||||||
explicit Basemenu(BScreen *screen);
|
|
||||||
virtual ~Basemenu();
|
|
||||||
|
|
||||||
/**
|
|
||||||
@name manipulators
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
int insert(const char *label, int function= 0, const char *exec = 0, int pos = -1);
|
|
||||||
int insert(const char *label, Basemenu *submenu, int pos= -1);
|
|
||||||
int remove(unsigned int item);
|
|
||||||
inline void setInternalMenu() { internal_menu = true; }
|
|
||||||
inline void setAlignment(Alignment a) { m_alignment = a; }
|
|
||||||
inline void setTorn() { torn = true; }
|
|
||||||
inline void removeParent() { if (internal_menu) m_parent = 0; }
|
|
||||||
void raise();
|
|
||||||
void lower();
|
|
||||||
/**
|
|
||||||
@name event handlers
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
void buttonPressEvent(XButtonEvent &bp);
|
|
||||||
void buttonReleaseEvent(XButtonEvent &br);
|
|
||||||
void motionNotifyEvent(XMotionEvent &mn);
|
|
||||||
void enterNotifyEvent(XCrossingEvent &en);
|
|
||||||
void leaveNotifyEvent(XCrossingEvent &ce);
|
|
||||||
void exposeEvent(XExposeEvent &ee);
|
|
||||||
//@}
|
|
||||||
|
|
||||||
void reconfigure();
|
|
||||||
/// set label string
|
|
||||||
void setLabel(const char *labelstr);
|
|
||||||
/// move menu to x,y
|
|
||||||
void move(int x, int y);
|
|
||||||
void update();
|
|
||||||
void setItemSelected(unsigned int index, bool val);
|
|
||||||
void setItemEnabled(unsigned int index, bool val);
|
|
||||||
virtual void drawSubmenu(unsigned int index);
|
|
||||||
virtual void show();
|
|
||||||
virtual void hide();
|
|
||||||
/*@}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
@name accessors
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
bool isTorn() const { return torn; }
|
|
||||||
bool isVisible() const { return visible; }
|
|
||||||
const BScreen *screen() const { return m_screen; }
|
|
||||||
BScreen *screen() { return m_screen; }
|
|
||||||
Window windowID() const { return menu.window.window(); }
|
|
||||||
const std::string &label() const { return menu.label; }
|
|
||||||
int x() const { return menu.x; }
|
|
||||||
int y() const { return menu.y; }
|
|
||||||
unsigned int width() const { return menu.width; }
|
|
||||||
unsigned int height() const { return menu.height; }
|
|
||||||
unsigned int numberOfItems() const { return menuitems.size(); }
|
|
||||||
int currentSubmenu() const { return which_sub; }
|
|
||||||
unsigned int titleHeight() const { return menu.title_h; }
|
|
||||||
bool hasSubmenu(unsigned int index) const;
|
|
||||||
bool isItemSelected(unsigned int index) const;
|
|
||||||
bool isItemEnabled(unsigned int index) const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; }
|
|
||||||
inline void setTitleVisibility(bool b) { title_vis = b; }
|
|
||||||
inline void setMovable(bool b) { movable = b; }
|
|
||||||
inline void setHideTree(bool h) { hide_tree = h; }
|
|
||||||
inline void setMinimumSublevels(int m) { menu.minsub = m; }
|
|
||||||
|
|
||||||
virtual void itemSelected(int button, unsigned int index) = 0;
|
|
||||||
virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false,
|
|
||||||
int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0);
|
|
||||||
virtual void redrawTitle();
|
|
||||||
virtual void internal_hide();
|
|
||||||
inline Basemenu *parent() { return m_parent; }
|
|
||||||
inline const Basemenu *parent() const { return m_parent; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
typedef std::vector<BasemenuItem *> Menuitems;
|
|
||||||
BScreen *m_screen;
|
|
||||||
Display *m_display;
|
|
||||||
Basemenu *m_parent;
|
|
||||||
FbTk::ImageControl *m_image_ctrl;
|
|
||||||
Menuitems menuitems;
|
|
||||||
|
|
||||||
bool moving, visible, movable, torn, internal_menu, title_vis, shifted,
|
|
||||||
hide_tree;
|
|
||||||
|
|
||||||
int which_sub, which_press, which_sbl;
|
|
||||||
Alignment m_alignment;
|
|
||||||
|
|
||||||
struct _menu {
|
|
||||||
Pixmap frame_pixmap, title_pixmap, hilite_pixmap, sel_pixmap;
|
|
||||||
FbTk::FbWindow window, frame, title;
|
|
||||||
|
|
||||||
std::string label;
|
|
||||||
int x, y, x_move, y_move, x_shift, y_shift, sublevels, persub, minsub,
|
|
||||||
grab_x, grab_y;
|
|
||||||
unsigned int width, height, title_h, frame_h, item_w, item_h, bevel_w,
|
|
||||||
bevel_h;
|
|
||||||
} menu;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
A menu item in Basemenu
|
|
||||||
*/
|
|
||||||
class BasemenuItem {
|
|
||||||
public:
|
|
||||||
BasemenuItem(
|
|
||||||
const char *label,
|
|
||||||
int function,
|
|
||||||
const char *exec = (const char *) 0)
|
|
||||||
: m_label(label ? label : "")
|
|
||||||
, m_exec(exec ? exec : "")
|
|
||||||
, m_submenu(0)
|
|
||||||
, m_function(function)
|
|
||||||
, m_enabled(true)
|
|
||||||
, m_selected(false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
BasemenuItem(const char *label, Basemenu *submenu)
|
|
||||||
: m_label(label ? label : "")
|
|
||||||
, m_exec("")
|
|
||||||
, m_submenu(submenu)
|
|
||||||
, m_function(0)
|
|
||||||
, m_enabled(true)
|
|
||||||
, m_selected(false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void setSelected(bool selected) { m_selected = selected; }
|
|
||||||
void setEnabled(bool enabled) { m_enabled = enabled; }
|
|
||||||
Basemenu *submenu() { return m_submenu; }
|
|
||||||
/**
|
|
||||||
@name accessors
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
const std::string &exec() const { return m_exec; }
|
|
||||||
const std::string &label() const { return m_label; }
|
|
||||||
int function() const { return m_function; }
|
|
||||||
const Basemenu *submenu() const { return m_submenu; }
|
|
||||||
bool isEnabled() const { return m_enabled; }
|
|
||||||
bool isSelected() const { return m_selected; }
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string m_label; ///< label of this item
|
|
||||||
std::string m_exec; ///< command string to execute
|
|
||||||
Basemenu *m_submenu; ///< a submenu, 0 if we don't have one
|
|
||||||
int m_function;
|
|
||||||
bool m_enabled, m_selected;
|
|
||||||
|
|
||||||
friend class Basemenu;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BASEMENU_HH
|
|
|
@ -1,303 +0,0 @@
|
||||||
// Windowmenu.cc for Fluxbox
|
|
||||||
// Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org)
|
|
||||||
// Windowmenu.cc for Blackbox - an X11 Window manager
|
|
||||||
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
// $Id: Windowmenu.cc,v 1.23 2003/01/05 22:31:36 fluxgen Exp $
|
|
||||||
|
|
||||||
//use GNU extensions
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif // _GNU_SOURCE
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#include "i18n.hh"
|
|
||||||
#include "fluxbox.hh"
|
|
||||||
#include "Screen.hh"
|
|
||||||
#include "Window.hh"
|
|
||||||
#include "Windowmenu.hh"
|
|
||||||
#include "Workspace.hh"
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
Windowmenu::Windowmenu(FluxboxWindow &win) : Basemenu(win.getScreen()),
|
|
||||||
window(win),
|
|
||||||
screen(win.getScreen()),
|
|
||||||
sendToMenu(win),
|
|
||||||
sendGroupToMenu(win) {
|
|
||||||
|
|
||||||
setTitleVisibility(False);
|
|
||||||
setMovable(False);
|
|
||||||
setInternalMenu();
|
|
||||||
|
|
||||||
I18n *i18n = I18n::instance();
|
|
||||||
|
|
||||||
using namespace FBNLS;
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuSendTo,
|
|
||||||
"Send To ..."),
|
|
||||||
&sendToMenu);
|
|
||||||
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuSendGroupTo,
|
|
||||||
"Send Group To ..."),
|
|
||||||
&sendGroupToMenu);
|
|
||||||
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuShade,
|
|
||||||
"Shade"),
|
|
||||||
BScreen::WINDOWSHADE);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuIconify,
|
|
||||||
"Iconify"),
|
|
||||||
BScreen::WINDOWICONIFY);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuMaximize,
|
|
||||||
"Maximize"),
|
|
||||||
BScreen::WINDOWMAXIMIZE);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuRaise,
|
|
||||||
"Raise"),
|
|
||||||
BScreen::WINDOWRAISE);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuLower,
|
|
||||||
"Lower"),
|
|
||||||
BScreen::WINDOWLOWER);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuStick,
|
|
||||||
"Stick"),
|
|
||||||
BScreen::WINDOWSTICK);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuKillClient,
|
|
||||||
"Kill Client"),
|
|
||||||
BScreen::WINDOWKILL);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuClose,
|
|
||||||
"Close"),
|
|
||||||
BScreen::WINDOWCLOSE);
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WindowmenuSet, WindowmenuTab,
|
|
||||||
"Tab"),
|
|
||||||
BScreen::WINDOWTAB);
|
|
||||||
|
|
||||||
update();
|
|
||||||
|
|
||||||
setItemEnabled(2, window.hasTitlebar());
|
|
||||||
setItemEnabled(3, window.isIconifiable());
|
|
||||||
setItemEnabled(4, window.isMaximizable());
|
|
||||||
setItemEnabled(9, window.isClosable());
|
|
||||||
setItemEnabled(10, window.isGroupable()); // tab option
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Windowmenu::~Windowmenu() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Windowmenu::show() {
|
|
||||||
if (isItemEnabled(2))
|
|
||||||
setItemSelected(2, window.isShaded());
|
|
||||||
if (isItemEnabled(4))
|
|
||||||
setItemSelected(4, window.isMaximized());
|
|
||||||
if (isItemEnabled(7))
|
|
||||||
setItemSelected(7, window.isStuck());
|
|
||||||
|
|
||||||
Basemenu::show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Windowmenu::itemSelected(int button, unsigned int index) {
|
|
||||||
BasemenuItem *item = find(index);
|
|
||||||
hide();
|
|
||||||
switch (item->function()) {
|
|
||||||
case BScreen::WINDOWSHADE:
|
|
||||||
if (window.isIconic())
|
|
||||||
break;
|
|
||||||
|
|
||||||
window.shade();
|
|
||||||
if (window.hasTab())
|
|
||||||
window.getTab()->shade();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWICONIFY:
|
|
||||||
if (!window.isIconic())
|
|
||||||
window.iconify();
|
|
||||||
else
|
|
||||||
window.deiconify(); // restore window
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWMAXIMIZE:
|
|
||||||
window.maximize();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWCLOSE:
|
|
||||||
window.close();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWRAISE:
|
|
||||||
if (window.isIconic())
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (window.hasTab())
|
|
||||||
window.getTab()->raise(); //raise tabs
|
|
||||||
screen->getWorkspace(window.getWorkspaceNumber())->raiseWindow(&window);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWLOWER:
|
|
||||||
if (window.isIconic())
|
|
||||||
break;
|
|
||||||
|
|
||||||
screen->getWorkspace(window.getWorkspaceNumber())->lowerWindow(&window);
|
|
||||||
if (window.hasTab())
|
|
||||||
window.getTab()->lower(); //lower tabs AND all it's windows
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWSTICK:
|
|
||||||
window.stick();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BScreen::WINDOWKILL:
|
|
||||||
XKillClient(BaseDisplay::getXDisplay(),
|
|
||||||
window.getClientWindow());
|
|
||||||
break;
|
|
||||||
case BScreen::WINDOWTAB:
|
|
||||||
window.setTab(!window.hasTab());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Windowmenu::reconfigure() {
|
|
||||||
setItemEnabled(1, window.hasTitlebar());
|
|
||||||
setItemEnabled(2, window.isIconifiable());
|
|
||||||
setItemEnabled(3, window.isMaximizable());
|
|
||||||
setItemEnabled(8, window.isClosable());
|
|
||||||
setItemEnabled(10, window.isResizable()); // tab option only enabled if resizable
|
|
||||||
|
|
||||||
sendToMenu.reconfigure();
|
|
||||||
sendGroupToMenu.reconfigure();
|
|
||||||
|
|
||||||
Basemenu::reconfigure();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(FluxboxWindow &win): Basemenu(win.getScreen()),
|
|
||||||
m_fbwindow(win)
|
|
||||||
{
|
|
||||||
setTitleVisibility(false);
|
|
||||||
setMovable(false);
|
|
||||||
setInternalMenu();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, unsigned int index) {
|
|
||||||
if (button > 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (index <= screen()->getCount()) {
|
|
||||||
|
|
||||||
// no need to send it to a workspace it already exist on
|
|
||||||
if (index == screen()->getCurrentWorkspaceID())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (button == 1) { // send to workspace without changing workspace
|
|
||||||
screen()->sendToWorkspace(index, &m_fbwindow, false);
|
|
||||||
} else if (button == 2) { // send to workspace and change workspace
|
|
||||||
screen()->sendToWorkspace(index, &m_fbwindow, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Windowmenu::SendtoWorkspacemenu::update() {
|
|
||||||
unsigned int i, r = numberOfItems();
|
|
||||||
|
|
||||||
if (numberOfItems() != 0) {
|
|
||||||
for (i = 0; i < r; ++i)
|
|
||||||
remove(0);
|
|
||||||
}
|
|
||||||
for (i = 0; i < screen()->getCount(); ++i)
|
|
||||||
insert(screen()->getWorkspace(i)->name().c_str());
|
|
||||||
|
|
||||||
Basemenu::update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Windowmenu::SendtoWorkspacemenu::show() {
|
|
||||||
update();
|
|
||||||
|
|
||||||
Basemenu::show();
|
|
||||||
}
|
|
||||||
|
|
||||||
Windowmenu::SendGroupToWorkspacemenu::
|
|
||||||
SendGroupToWorkspacemenu(FluxboxWindow &win):SendtoWorkspacemenu(win)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, unsigned int index) {
|
|
||||||
if (button > 2)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (index <= screen()->getCount()) {
|
|
||||||
if (index == screen()->getCurrentWorkspaceID())
|
|
||||||
return;
|
|
||||||
if (fbwin().isStuck())
|
|
||||||
fbwin().stick();
|
|
||||||
|
|
||||||
// if the window is iconic, deiconify it
|
|
||||||
if (fbwin().isIconic())
|
|
||||||
fbwin().deiconify();
|
|
||||||
|
|
||||||
if (button == 1) {
|
|
||||||
// TODO: use reassociateGroup from BScreen instead
|
|
||||||
if (fbwin().hasTab()) {
|
|
||||||
for (Tab *first = Tab::getFirst(fbwin().getTab());
|
|
||||||
first!=0; first=first->next()) {
|
|
||||||
first->withdraw();
|
|
||||||
first->getWindow()->withdraw();
|
|
||||||
screen()->reassociateWindow(first->getWindow(), index, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fbwin().withdraw();
|
|
||||||
screen()->reassociateWindow(&fbwin(), index, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button == 2)
|
|
||||||
screen()->changeWorkspaceID(index);
|
|
||||||
}
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
// Windowmenu.hh for Blackbox - an X11 Window manager
|
|
||||||
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
#ifndef WINDOWMENU_HH
|
|
||||||
#define WINDOWMENU_HH
|
|
||||||
|
|
||||||
#include "Basemenu.hh"
|
|
||||||
|
|
||||||
class FluxboxWindow;
|
|
||||||
|
|
||||||
|
|
||||||
class Windowmenu : public Basemenu {
|
|
||||||
public:
|
|
||||||
explicit Windowmenu(FluxboxWindow &fbwin);
|
|
||||||
virtual ~Windowmenu();
|
|
||||||
|
|
||||||
const Basemenu &getSendToMenu() const { return sendToMenu; }
|
|
||||||
Basemenu &getSendToMenu() { return sendToMenu; }
|
|
||||||
const Basemenu &getSendGroupToMenu() const { return sendGroupToMenu; }
|
|
||||||
Basemenu &getSendGroupToMenu() { return sendGroupToMenu; }
|
|
||||||
|
|
||||||
void reconfigure();
|
|
||||||
void setClosable();
|
|
||||||
|
|
||||||
virtual void show();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void itemSelected(int button, unsigned int index);
|
|
||||||
|
|
||||||
private:
|
|
||||||
FluxboxWindow &window;
|
|
||||||
BScreen *screen;
|
|
||||||
|
|
||||||
|
|
||||||
class SendtoWorkspacemenu : public Basemenu {
|
|
||||||
public:
|
|
||||||
SendtoWorkspacemenu(FluxboxWindow &win);
|
|
||||||
void update();
|
|
||||||
|
|
||||||
virtual void show();
|
|
||||||
FluxboxWindow &fbwin() { return m_fbwindow; }
|
|
||||||
protected:
|
|
||||||
virtual void itemSelected(int button, unsigned int index);
|
|
||||||
private:
|
|
||||||
FluxboxWindow &m_fbwindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SendGroupToWorkspacemenu : public SendtoWorkspacemenu {
|
|
||||||
public:
|
|
||||||
SendGroupToWorkspacemenu(FluxboxWindow &win);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void itemSelected(int button, unsigned int index);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
SendtoWorkspacemenu sendToMenu;
|
|
||||||
SendGroupToWorkspacemenu sendGroupToMenu;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // WINDOWMENU_HH
|
|
|
@ -1,79 +0,0 @@
|
||||||
// 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)
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
// $Id: Workspacemenu.cc,v 1.11 2002/12/01 13:42:06 rathnor Exp $
|
|
||||||
|
|
||||||
#include "Workspacemenu.hh"
|
|
||||||
|
|
||||||
#include "i18n.hh"
|
|
||||||
#include "Screen.hh"
|
|
||||||
#include "Workspace.hh"
|
|
||||||
#include "fluxbox.hh"
|
|
||||||
|
|
||||||
//use GNU extension
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif // _GNU_SOURCE
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "../config.h"
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) {
|
|
||||||
|
|
||||||
setInternalMenu();
|
|
||||||
I18n *i18n = I18n::instance();
|
|
||||||
using namespace FBNLS;
|
|
||||||
setLabel(i18n->getMessage(
|
|
||||||
WorkspacemenuSet, WorkspacemenuWorkspacesTitle,
|
|
||||||
"Workspaces"));
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WorkspacemenuSet, WorkspacemenuNewWorkspace,
|
|
||||||
"New Workspace"));
|
|
||||||
insert(i18n->getMessage(
|
|
||||||
WorkspacemenuSet, WorkspacemenuRemoveLast,
|
|
||||||
"Remove Last"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Workspacemenu::itemSelected(int button, unsigned int index) {
|
|
||||||
if (button == 1) {
|
|
||||||
if (index == 0) {
|
|
||||||
screen()->addWorkspace();
|
|
||||||
Fluxbox::instance()->save_rc();
|
|
||||||
} else if (index == 1) {
|
|
||||||
screen()->removeLastWorkspace();
|
|
||||||
Fluxbox::instance()->save_rc();
|
|
||||||
} else if ((screen()->getCurrentWorkspace()->workspaceID() !=
|
|
||||||
(index - 2)) && ((index - 2) < screen()->getCount())) {
|
|
||||||
screen()->changeWorkspaceID(index - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! (screen()->getWorkspacemenu()->isTorn() || isTorn()))
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
// 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)
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
#ifndef WORKSPACEMENU_HH
|
|
||||||
#define WORKSPACEMENU_HH
|
|
||||||
|
|
||||||
#include "Basemenu.hh"
|
|
||||||
|
|
||||||
class Workspacemenu : public Basemenu {
|
|
||||||
public:
|
|
||||||
Workspacemenu(BScreen *screen);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void itemSelected(int button, unsigned int index);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // WORKSPACEMENU_HH
|
|
Loading…
Reference in a new issue