diff options
Diffstat (limited to 'src/Container.hh')
-rw-r--r-- | src/Container.hh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/Container.hh b/src/Container.hh index 6fa431e..7692bef 100644 --- a/src/Container.hh +++ b/src/Container.hh | |||
@@ -25,7 +25,7 @@ | |||
25 | #ifndef CONTAINER_HH | 25 | #ifndef CONTAINER_HH |
26 | #define CONTAINER_HH | 26 | #define CONTAINER_HH |
27 | 27 | ||
28 | #include "FbTk/FbWindow.hh" | 28 | #include "FbTk/Button.hh" |
29 | #include "FbTk/EventHandler.hh" | 29 | #include "FbTk/EventHandler.hh" |
30 | #include "FbTk/NotCopyable.hh" | 30 | #include "FbTk/NotCopyable.hh" |
31 | 31 | ||
@@ -34,7 +34,8 @@ | |||
34 | class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable { | 34 | class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable { |
35 | public: | 35 | public: |
36 | enum Alignment { LEFT, RELATIVE, RIGHT }; | 36 | enum Alignment { LEFT, RELATIVE, RIGHT }; |
37 | typedef FbTk::FbWindow * Item; | 37 | typedef FbTk::Button * Item; |
38 | typedef const FbTk::Button * ConstItem; | ||
38 | typedef std::list<Item> ItemList; | 39 | typedef std::list<Item> ItemList; |
39 | 40 | ||
40 | explicit Container(const FbTk::FbWindow &parent); | 41 | explicit Container(const FbTk::FbWindow &parent); |
@@ -48,9 +49,12 @@ public: | |||
48 | 49 | ||
49 | void insertItems(ItemList &list, int position=-1); | 50 | void insertItems(ItemList &list, int position=-1); |
50 | void insertItem(Item item, int pos = -1); | 51 | void insertItem(Item item, int pos = -1); |
51 | void removeItem(int item); | 52 | bool removeItem(int item); // return true if something was removed |
53 | bool removeItem(Item item); // return true if something was removed | ||
52 | void removeAll(); | 54 | void removeAll(); |
53 | int find(Item item); | 55 | void moveItem(Item item, int movement); // wraps around |
56 | bool moveItemTo(Item item, int x, int y); | ||
57 | int find(ConstItem item); | ||
54 | void setSelected(int index); | 58 | void setSelected(int index); |
55 | void setMaxSizePerClient(unsigned int size); | 59 | void setMaxSizePerClient(unsigned int size); |
56 | void setAlignment(Alignment a); | 60 | void setAlignment(Alignment a); |
@@ -64,6 +68,10 @@ public: | |||
64 | 68 | ||
65 | /// event handler | 69 | /// event handler |
66 | void exposeEvent(XExposeEvent &event); | 70 | void exposeEvent(XExposeEvent &event); |
71 | // for use when embedded in something that may passthrough | ||
72 | bool tryExposeEvent(XExposeEvent &event); | ||
73 | bool tryButtonPressEvent(XButtonEvent &event); | ||
74 | bool tryButtonReleaseEvent(XButtonEvent &event); | ||
67 | 75 | ||
68 | /// accessors | 76 | /// accessors |
69 | inline Alignment alignment() const { return m_align; } | 77 | inline Alignment alignment() const { return m_align; } |
@@ -75,6 +83,14 @@ public: | |||
75 | inline unsigned int maxHeightPerClient() const { return (empty() ? height() : height()/size()); } | 83 | inline unsigned int maxHeightPerClient() const { return (empty() ? height() : height()/size()); } |
76 | inline bool updateLock() const { return m_update_lock; } | 84 | inline bool updateLock() const { return m_update_lock; } |
77 | 85 | ||
86 | void for_each(std::mem_fun_t<void, FbWindow> function); | ||
87 | void setAlpha(unsigned char alpha); // set alpha on all windows | ||
88 | |||
89 | ItemList::iterator begin() { return m_item_list.begin(); } | ||
90 | ItemList::iterator end() { return m_item_list.end(); } | ||
91 | |||
92 | void clear(); // clear all windows | ||
93 | |||
78 | private: | 94 | private: |
79 | void repositionItems(); | 95 | void repositionItems(); |
80 | 96 | ||