1 #ifndef __HLWM_TAGMANAGER_H_
2 #define __HLWM_TAGMANAGER_H_
3 
4 #include "byname.h"
5 #include "commandio.h"
6 #include "indexingobject.h"
7 #include "link.h"
8 #include "signal.h"
9 #include "tag.h"
10 
11 class Client;
12 class CommandBinding;
13 class FrameTree;
14 class Monitor;
15 class MonitorManager;
16 class Settings;
17 
18 typedef std::function<int(FrameTree&,Input,Output)> FrameCommand;
19 typedef void (FrameTree::*FrameCompleter)(Completion&);
20 class TagManager : public IndexingObject<HSTag> {
21 public:
22     TagManager();
23     void injectDependencies(MonitorManager* m, Settings *s);
24 
25     int removeTag(Input input, Output output);
26     int tag_add_command(Input input, Output output);
27     int tag_rename_command(Input input, Output output);
28     int tag_move_window_command(Input argv, Output output);
29     int tag_move_window_by_index_command(Input argv, Output output);
30     int floatingCmd(Input input, Output output);
31     void floatingComplete(Completion& complete);
32     HSTag* add_tag(const std::string& name);
33     HSTag* find(const std::string& name);
34     void completeTag(Completion& complete);
35     HSTag* ensure_tags_are_available();
36     HSTag* byIndexStr(const std::string& index_str, bool skip_visible_tags);
37     HSTag* unusedTag();
38     void moveClient(Client* client, HSTag* target, std::string frameIndex = {}, bool focus = true);
39     void moveFocusedClient(HSTag* target);
40     std::function<int(Input, Output)> frameCommand(FrameCommand cmd);
41     CommandBinding frameCommand(FrameCommand cmd, FrameCompleter completer);
42     std::function<int()> frameCommand(std::function<int(FrameTree&)> cmd);
43     void updateFocusObject(Monitor* focusedMonitor);
44     std::string isValidTagName(std::string name);
45     Signal_<HSTag*> needsRelayout_;
46 private:
47     std::function<void(Completion&)> frameCompletion(FrameCompleter completer);
48     void onTagRename(HSTag* tag);
49     ByName by_name_;
50     MonitorManager* monitors_ = {}; // circular dependency
51     Settings* settings_;
52     Link_<HSTag> focus_;
53 };
54 
55 extern TagManager* global_tags; // temporary, set in Root constr.
56 
57 #endif
58