news download themes documentation links










IconbarTool.hh

00001 // IconbarTool.hh
00002 // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 //                and Simon Bowden    (rathnor at users.sourceforge.net)
00004 //
00005 // Permission is hereby granted, free of charge, to any person obtaining a
00006 // copy of this software and associated documentation files (the "Software"),
00007 // to deal in the Software without restriction, including without limitation
00008 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009 // and/or sell copies of the Software, and to permit persons to whom the
00010 // Software is furnished to do so, subject to the following conditions:
00011 //
00012 // The above copyright notice and this permission notice shall be included in
00013 // all copies or substantial portions of the Software.
00014 //
00015 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00018 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00020 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00021 // DEALINGS IN THE SOFTWARE.
00022 
00023 // $Id: IconbarTool.hh,v 1.13 2003/12/23 01:55:07 rathnor Exp $
00024 
00025 #ifndef ICONBARTOOL_HH
00026 #define ICONBARTOOL_HH
00027 
00028 #include "ToolbarItem.hh"
00029 #include "Container.hh"
00030 #include "FbMenu.hh"
00031 
00032 #include "FbTk/Observer.hh"
00033 #include "FbTk/Resource.hh"
00034 #include "FbTk/Menu.hh"
00035 
00036 #include <X11/Xlib.h>
00037 
00038 #include <list>
00039 
00040 class IconbarTheme;
00041 class BScreen;
00042 class IconButton;
00043 class FluxboxWindow;
00044 
00045 class IconbarTool: public ToolbarItem, public FbTk::Observer {
00046 public:
00047     typedef std::list<IconButton *> IconList;
00049     enum Mode {
00050         NONE, 
00051         ICONS,  
00052         WORKSPACEICONS,  
00053         WORKSPACE, 
00054         ALLWINDOWS 
00055     };
00056 
00057     IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, 
00058                 BScreen &screen, FbTk::Menu &menu);
00059     ~IconbarTool();
00060 
00061     void move(int x, int y);
00062     void resize(unsigned int width, unsigned int height);
00063     void moveResize(int x, int y,
00064                     unsigned int width, unsigned int height);
00065 
00066     void update(FbTk::Subject *subj);
00067     void show();
00068     void hide();
00069     void setAlignment(Container::Alignment a);
00070     void setMode(Mode mode);
00071 
00072     unsigned int width() const;
00073     unsigned int height() const;
00074     unsigned int borderWidth() const;
00075 
00076     Mode mode() const { return *m_rc_mode; }
00077     Container::Alignment alignment() const { return m_icon_container.alignment(); }
00078 private:
00080     IconButton *findButton(FluxboxWindow &win);
00081 
00083     void renderWindow(FluxboxWindow &win);
00085     void renderButton(IconButton &button);
00087     void renderTheme();
00089     void deleteIcons();
00091     void removeWindow(FluxboxWindow &win);
00093     void addWindow(FluxboxWindow &win);
00095     void updateIcons();
00097     void updateWorkspace();
00099     void updateAllWindows();
00101     void addList(std::list<FluxboxWindow *> &winlist);
00103     void timedRender();
00104 
00105     BScreen &m_screen;
00106     Container m_icon_container;
00107     const IconbarTheme &m_theme;
00108     // cached pixmaps
00109     Pixmap m_focused_pm, m_unfocused_pm;
00110     // some are a fraction bigger due to rounding
00111     Pixmap m_focused_err_pm, m_unfocused_err_pm;
00112     Pixmap m_empty_pm; 
00113 
00114 
00115     IconList m_icon_list;
00116     FbTk::Resource<Mode> m_rc_mode;
00117     FbTk::Resource<Container::Alignment> m_rc_alignment; 
00118     FbTk::Resource<int> m_rc_client_width; 
00119     FbTk::Resource<bool> m_rc_use_pixmap; 
00120     FbTk::Timer m_focus_timer; 
00121     FbMenu m_menu;
00122 };
00123 
00124 #endif // ICONBARTOOL_HH

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA