fluxbox/src/IconBar.hh

94 lines
3 KiB
C++
Raw Normal View History

// IconBar.hh for Fluxbox Window Manager
2003-04-09 12:59:57 +00:00
// Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
2001-12-11 20:47:02 +00:00
//
// 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,
2003-04-09 12:59:57 +00:00
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2001-12-11 20:47:02 +00:00
// 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.
2003-04-14 15:01:55 +00:00
// $Id: IconBar.hh,v 1.13 2003/04/14 14:43:58 fluxgen Exp $
2002-02-17 19:00:24 +00:00
#ifndef ICONBAR_HH
#define ICONBAR_HH
2001-12-11 20:47:02 +00:00
2003-04-09 12:59:57 +00:00
#include <X11/Xlib.h>
#include <list>
2001-12-11 20:47:02 +00:00
2003-04-09 12:59:57 +00:00
class FluxboxWindow;
class BScreen;
namespace FbTk {
class Font;
};
2002-08-04 15:55:13 +00:00
/**
Icon object in IconBar
*/
2001-12-11 20:47:02 +00:00
class IconBarObj
{
public:
2002-12-01 13:42:15 +00:00
IconBarObj(FluxboxWindow *fluxboxwin, Window iconwin);
~IconBarObj();
Window getIconWin() const { return m_iconwin; }
FluxboxWindow *getFluxboxWin() { return m_fluxboxwin; }
const FluxboxWindow *getFluxboxWin() const { return m_fluxboxwin; }
unsigned int width() const;
2003-02-23 00:50:53 +00:00
unsigned int height() const;
2001-12-11 20:47:02 +00:00
private:
2002-12-01 13:42:15 +00:00
FluxboxWindow *m_fluxboxwin;
Window m_iconwin;
2001-12-11 20:47:02 +00:00
};
2002-08-04 15:55:13 +00:00
/**
Icon container
*/
2001-12-11 20:47:02 +00:00
class IconBar
{
public:
2003-03-03 21:51:13 +00:00
typedef std::list<Window> WindowList;
2003-02-23 00:50:53 +00:00
IconBar(BScreen *scrn, Window parent, FbTk::Font &font);
2002-12-01 13:42:15 +00:00
~IconBar();
void draw(); //TODO
void reconfigure();
Window addIcon(FluxboxWindow *fluxboxwin);
Window delIcon(FluxboxWindow *fluxboxwin);
2003-03-03 21:51:13 +00:00
WindowList *delAllIcons();
2002-12-01 13:42:15 +00:00
void buttonPressEvent(XButtonEvent *be);
FluxboxWindow *findWindow(Window w);
IconBarObj *findIcon(FluxboxWindow * const fluxboxwin);
const IconBarObj *findIcon(const FluxboxWindow * const fluxboxwin) const;
void exposeEvent(XExposeEvent *ee);
2002-01-04 21:21:43 +00:00
2002-12-01 13:42:15 +00:00
void draw(const IconBarObj * const obj, int width) const;
2003-02-23 00:50:53 +00:00
void setVertical(bool value) { m_vertical = value; }
2001-12-11 20:47:02 +00:00
private:
2002-12-01 13:42:15 +00:00
typedef std::list<IconBarObj *> IconList;
2001-12-17 19:26:26 +00:00
2002-12-01 13:42:15 +00:00
void loadTheme(unsigned int width, unsigned int height);
void decorate(Window win);
void repositionIcons();
Window createIconWindow(FluxboxWindow *fluxboxwin, Window parent);
BScreen *m_screen;
Display *m_display;
Window m_parent;
IconList m_iconlist;
Pixmap m_focus_pm;
unsigned long m_focus_pixel;
2003-02-23 00:50:53 +00:00
bool m_vertical;
FbTk::Font &m_font;
2001-12-11 20:47:02 +00:00
};
2002-08-04 15:55:13 +00:00
#endif // ICONBAR_HH