aboutsummaryrefslogtreecommitdiff
path: root/src/Layer.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Layer.hh')
-rw-r--r--src/Layer.hh49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Layer.hh b/src/Layer.hh
index 2b15539..e86c090 100644
--- a/src/Layer.hh
+++ b/src/Layer.hh
@@ -22,6 +22,9 @@
22#ifndef LAYER_HH 22#ifndef LAYER_HH
23#define LAYER_HH 23#define LAYER_HH
24 24
25#include <string>
26using std::string;
27
25/** 28/**
26 * (This is not the layer->raise/lower handling stuff, @see FbTk::Layer) 29 * (This is not the layer->raise/lower handling stuff, @see FbTk::Layer)
27 * Class to store layer numbers (special Resource type) 30 * Class to store layer numbers (special Resource type)
@@ -42,7 +45,53 @@ public:
42 }; 45 };
43 46
44 explicit Layer(int i) : m_num(i) {}; 47 explicit Layer(int i) : m_num(i) {};
48
49 static int getNumFromString(string &str) {
50 int tempnum = 0;
51 if (sscanf(str.c_str(), "%d", &tempnum) == 1)
52 return tempnum;
53 if (strcasecmp(str.c_str(), "Menu") == 0)
54 return ::Layer::MENU;
55 if (strcasecmp(str.c_str(), "AboveDock") == 0)
56 return ::Layer::ABOVE_DOCK;
57 if (strcasecmp(str.c_str(), "Dock") == 0)
58 return ::Layer::DOCK;
59 if (strcasecmp(str.c_str(), "Top") == 0)
60 return ::Layer::TOP;
61 if (strcasecmp(str.c_str(), "Normal") == 0)
62 return ::Layer::NORMAL;
63 if (strcasecmp(str.c_str(), "Bottom") == 0)
64 return ::Layer::BOTTOM;
65 if (strcasecmp(str.c_str(), "Desktop") == 0)
66 return ::Layer::DESKTOP;
67 return -1;
68 }
69
70 static string getString(int num) {
71 switch (num) {
72 case ::Layer::MENU:
73 return string("Menu");
74 case ::Layer::ABOVE_DOCK:
75 return string("AboveDock");
76 case ::Layer::DOCK:
77 return string("Dock");
78 case ::Layer::TOP:
79 return string("Top");
80 case ::Layer::NORMAL:
81 return string("Normal");
82 case ::Layer::BOTTOM:
83 return string("Bottom");
84 case ::Layer::DESKTOP:
85 return string("Desktop");
86 default:
87 char tmpstr[128];
88 sprintf(tmpstr, "%d", num);
89 return string(tmpstr);
90 }
91 }
92
45 int getNum() const { return m_num; } 93 int getNum() const { return m_num; }
94 string getString() const { return getString(m_num); }
46 95
47 Layer &operator=(int num) { m_num = num; return *this; } 96 Layer &operator=(int num) { m_num = num; return *this; }
48 97