~ubuntu-branches/ubuntu/precise/fluxbox/precise

« back to all changes in this revision

Viewing changes to src/Workspace.hh

  • Committer: Bazaar Package Importer
  • Author(s): Dmitry E. Oboukhov
  • Date: 2008-07-01 10:38:14 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080701103814-khx2b6il152x9p93
Tags: 1.0.0+deb1-8
* x-dev has been removed from build-depends (out-of-date package).
* Standards-Version bumped to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Workspace.hh for Fluxbox
2
 
// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
3
 
//
4
 
// Workspace.hh for Blackbox - an X11 Window manager
5
 
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
6
 
//
7
 
// Permission is hereby granted, free of charge, to any person obtaining a
8
 
// copy of this software and associated documentation files (the "Software"),
9
 
// to deal in the Software without restriction, including without limitation
10
 
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 
// and/or sell copies of the Software, and to permit persons to whom the
12
 
// Software is furnished to do so, subject to the following conditions:
13
 
//
14
 
// The above copyright notice and this permission notice shall be included in
15
 
// all copies or substantial portions of the Software.
16
 
//
17
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
 
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
 
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
 
// DEALINGS IN THE SOFTWARE.
24
 
 
25
 
#ifndef  WORKSPACE_HH
26
 
#define  WORKSPACE_HH
27
 
 
28
 
 
29
 
 
30
 
#include "FbMenu.hh"
31
 
 
32
 
#include "FbTk/MultLayers.hh"
33
 
#include "FbTk/Observer.hh"
34
 
#include "FbTk/NotCopyable.hh"
35
 
 
36
 
#include <string>
37
 
#include <vector>
38
 
#include <list>
39
 
 
40
 
class BScreen;
41
 
class FluxboxWindow;
42
 
class WinClient;
43
 
 
44
 
/**
45
 
        Handles a single workspace
46
 
*/
47
 
class Workspace:private FbTk::NotCopyable, private FbTk::Observer {
48
 
public:
49
 
    typedef std::vector<FluxboxWindow *> Windows;
50
 
 
51
 
    Workspace(BScreen &screen, FbTk::MultLayers &layermanager, const std::string &name,
52
 
              unsigned int workspaceid = 0);
53
 
    ~Workspace();
54
 
        
55
 
    void setLastFocusedWindow(FluxboxWindow *w);
56
 
 
57
 
    ///   Set workspace name
58
 
    void setName(const std::string &name);
59
 
    void showAll();
60
 
    void hideAll(bool interrupt_moving);
61
 
    void removeAll();
62
 
    void reconfigure();
63
 
    void shutdown();
64
 
    void addWindow(FluxboxWindow &win, bool place = false);
65
 
    int removeWindow(FluxboxWindow *win, bool still_alive);
66
 
    void updateClientmenu();
67
 
 
68
 
    BScreen &screen() { return m_screen; }
69
 
    const BScreen &screen() const { return m_screen; }  
70
 
 
71
 
    FluxboxWindow *lastFocusedWindow() { return m_lastfocus; }
72
 
    const FluxboxWindow *lastFocusedWindow() const { return m_lastfocus; }      
73
 
 
74
 
    inline FbTk::Menu &menu() { return m_clientmenu; }
75
 
    inline const FbTk::Menu &menu() const { return m_clientmenu; }
76
 
    /// name of this workspace
77
 
    inline const std::string &name() const { return m_name; }
78
 
    /**
79
 
       @return the number of this workspace, note: obsolete, should be in BScreen
80
 
    */
81
 
    inline unsigned int workspaceID() const { return m_id; }    
82
 
 
83
 
    const Windows &windowList() const { return m_windowlist; }
84
 
    Windows &windowList() { return m_windowlist; }
85
 
 
86
 
    int numberOfWindows() const;
87
 
    bool checkGrouping(FluxboxWindow &win);
88
 
 
89
 
    static bool loadGroups(const std::string &filename);
90
 
 
91
 
private:
92
 
    void update(FbTk::Subject *subj);
93
 
    void placeWindow(FluxboxWindow &win);
94
 
 
95
 
    BScreen &m_screen;
96
 
    FluxboxWindow *m_lastfocus;
97
 
    FbMenu m_clientmenu;
98
 
 
99
 
    typedef std::vector<std::string> Group;
100
 
    typedef std::vector<Group> GroupList;
101
 
        
102
 
    static GroupList m_groups; ///< handle auto groupings
103
 
 
104
 
    FbTk::MultLayers &m_layermanager;
105
 
    Windows m_windowlist;
106
 
 
107
 
    std::string m_name;  ///< name of this workspace
108
 
    unsigned int m_id;  ///< id, obsolete, this should be in BScreen
109
 
    int *m_cascade_x; ///< need a cascade for each head (Xinerama)
110
 
    int *m_cascade_y; ///< need a cascade for each head (Xinerama)
111
 
};
112
 
 
113
 
 
114
 
#endif // WORKSPACE_HH
115