Vultraz

Untitled

Feb 24th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #ifndef GUI_WIDGETS_GROUP_HPP_INCLUDED
  2. #define GUI_WIDGETS_GROUP_HPP_INCLUDED
  3.  
  4. #include "gui/widgets/widget.hpp"
  5. #include <vector>
  6.  
  7. namespace gui2
  8. {
  9.  
  10. template <class T = twidget>
  11. class tgroup
  12. {
  13. public:
  14.     tgroup(const std::string& id = "");
  15.  
  16.     const std::string& id() const { return id_; }
  17.  
  18.     typedef typename std::vector<T*>            group_list;
  19.     typedef typename group_list::iterator       group_iterator;
  20.     typedef typename group_list::const_iterator group_iterator_const;
  21.  
  22.     void add_member(T* widget);
  23.  
  24.     void remove_member(T* widget);
  25.  
  26.     group_list get_members() { return members_; }
  27.  
  28.     /**
  29.      * General function to operate on the members in a group.
  30.      *
  31.      * @param group_operator   Operator function to be called on each
  32.      *                         member of the group.
  33.      */
  34.     // void execute_group_actions(boost::function<void(tselectable_*)> group_operator);
  35.  
  36.     std::pair<group_iterator, group_iterator> widgets()
  37.     {
  38.         return std::make_pair(members_.begin(), members_.end());
  39.     }
  40.  
  41.     std::pair<group_iterator_const, group_iterator_const> widgets() const
  42.     {
  43.         return std::make_pair(members_.begin(), members_.end());
  44.     }
  45.  
  46. private:
  47.     std::string id_;
  48.  
  49.     group_list members_;
  50. };
  51.  
  52. } // namespace gui2
  53.  
  54. #endif
Advertisement
Add Comment
Please, Sign In to add comment