news download themes documentation links










Container.hh

00001 // Container.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: Container.hh,v 1.5 2003/12/23 01:55:07 rathnor Exp $
00024 
00025 #ifndef CONTAINER_HH
00026 #define CONTAINER_HH
00027 
00028 #include "FbTk/FbWindow.hh"
00029 #include "FbTk/EventHandler.hh"
00030 #include "FbTk/NotCopyable.hh"
00031 
00032 #include <list>
00033 
00034 class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable {
00035 public:
00036     enum Alignment { LEFT, RELATIVE, RIGHT };
00037     typedef FbTk::FbWindow * Item;
00038     typedef std::list<Item> ItemList;
00039 
00040     explicit Container(const FbTk::FbWindow &parent);
00041     virtual ~Container();
00042     
00043     // manipulators
00044 
00045     void resize(unsigned int width, unsigned int height);
00046     void moveResize(int x, int y,
00047                     unsigned int width, unsigned int height);
00048 
00049     void insertItems(ItemList &list, int position=-1);
00050     void insertItem(Item item, int pos = -1);
00051     void removeItem(int item);
00052     void removeAll();
00053     int find(Item item);
00054     void setSelected(int index);
00055     void setMaxSizePerClient(unsigned int size);
00056     void setAlignment(Alignment a);
00057 
00058     Item back() { return m_item_list.back(); }
00059 
00061     inline void update() { repositionItems(); }
00063     inline void setUpdateLock(bool value) { m_update_lock = value; }
00064 
00066     void exposeEvent(XExposeEvent &event);
00067 
00069     inline Alignment alignment() const { return m_align; }
00070     inline int size() const { return m_item_list.size(); }
00071     inline const Item selected() const { return m_selected; }
00072     inline Item selected() { return m_selected; }
00073     unsigned int maxWidthPerClient() const;
00074     inline unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); }    
00075     inline bool updateLock() const { return m_update_lock; }
00076 
00077 private:
00078     void repositionItems();
00079 
00080     Alignment m_align;
00081     unsigned int m_max_size_per_client;
00082     ItemList m_item_list;
00083     Item m_selected;
00084     bool m_update_lock;
00085 };
00086 
00087 #endif // CONTAINER_HH
00088 

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