summaryrefslogtreecommitdiff
path: root/src/desktop/view/Group.hpp
blob: 8a7bb840292489a16b3ea543152be262761818df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once

#include "../DesktopTypes.hpp"

#include <vector>

namespace Layout {
    class CWindowGroupTarget;
};

namespace Desktop::View {
    class CGroup {
      public:
        static SP<CGroup> create(std::vector<PHLWINDOWREF>&& windows);
        ~CGroup();

        bool                             has(PHLWINDOW w) const;

        void                             add(PHLWINDOW w);
        void                             remove(PHLWINDOW w);
        void                             moveCurrent(bool next);
        void                             setCurrent(size_t idx);
        void                             setCurrent(PHLWINDOW w);
        size_t                           getCurrentIdx() const;
        size_t                           size() const;
        void                             destroy();
        void                             updateWorkspace(PHLWORKSPACE);

        void                             swapWithNext();
        void                             swapWithLast();

        PHLWINDOW                        head() const;
        PHLWINDOW                        tail() const;
        PHLWINDOW                        current() const;
        PHLWINDOW                        next() const;

        PHLWINDOW                        fromIndex(size_t idx) const;

        bool                             locked() const;
        void                             setLocked(bool x);

        bool                             denied() const;
        void                             setDenied(bool x);

        const std::vector<PHLWINDOWREF>& windows() const;

        SP<Layout::CWindowGroupTarget>   m_target;

      private:
        CGroup(std::vector<PHLWINDOWREF>&& windows);

        void                      applyWindowDecosAndUpdates(PHLWINDOW x);
        void                      removeWindowDecos(PHLWINDOW x);
        void                      init();
        void                      updateWindowVisibility();

        WP<CGroup>                m_self;

        std::vector<PHLWINDOWREF> m_windows;

        bool                      m_locked = false;
        bool                      m_deny   = false;

        size_t                    m_current = 0;
    };

    std::vector<WP<CGroup>>& groups();
};