diff options
author | fluxgen <fluxgen> | 2003-06-23 13:32:30 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-06-23 13:32:30 (GMT) |
commit | 19fcd63937ef2129f361ffe16d7e6fa74e4f4512 (patch) | |
tree | 7d4e2ab4848202adb3e41b901686961a1bef589e /src | |
parent | 3029aca7efe62ecee7b63fd8bbaf3d616c3cb0e7 (diff) | |
download | fluxbox_lack-19fcd63937ef2129f361ffe16d7e6fa74e4f4512.zip fluxbox_lack-19fcd63937ef2129f361ffe16d7e6fa74e4f4512.tar.bz2 |
moved slit resources from BScreen to Slit
Diffstat (limited to 'src')
-rw-r--r-- | src/Slit.cc | 100 |
1 files changed, 92 insertions, 8 deletions
diff --git a/src/Slit.cc b/src/Slit.cc index c349230..c91a7b5 100644 --- a/src/Slit.cc +++ b/src/Slit.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Slit.cc,v 1.64 2003/06/22 14:17:17 fluxgen Exp $ | 25 | // $Id: Slit.cc,v 1.65 2003/06/23 13:32:30 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Slit.hh" | 27 | #include "Slit.hh" |
28 | 28 | ||
@@ -72,6 +72,83 @@ | |||
72 | #include <algorithm> | 72 | #include <algorithm> |
73 | using namespace std; | 73 | using namespace std; |
74 | 74 | ||
75 | template<> | ||
76 | void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) { | ||
77 | if (strcasecmp(strval, "TopLeft")==0) | ||
78 | m_value = Slit::TOPLEFT; | ||
79 | else if (strcasecmp(strval, "CenterLeft")==0) | ||
80 | m_value = Slit::CENTERLEFT; | ||
81 | else if (strcasecmp(strval, "BottomLeft")==0) | ||
82 | m_value = Slit::BOTTOMLEFT; | ||
83 | else if (strcasecmp(strval, "TopCenter")==0) | ||
84 | m_value = Slit::TOPCENTER; | ||
85 | else if (strcasecmp(strval, "BottomCenter")==0) | ||
86 | m_value = Slit::BOTTOMCENTER; | ||
87 | else if (strcasecmp(strval, "TopRight")==0) | ||
88 | m_value = Slit::TOPRIGHT; | ||
89 | else if (strcasecmp(strval, "CenterRight")==0) | ||
90 | m_value = Slit::CENTERRIGHT; | ||
91 | else if (strcasecmp(strval, "BottomRight")==0) | ||
92 | m_value = Slit::BOTTOMRIGHT; | ||
93 | else | ||
94 | setDefaultValue(); | ||
95 | } | ||
96 | |||
97 | template<> | ||
98 | void FbTk::Resource<Slit::Direction>::setFromString(const char *strval) { | ||
99 | if (strcasecmp(strval, "Vertical") == 0) | ||
100 | m_value = Slit::VERTICAL; | ||
101 | else if (strcasecmp(strval, "Horizontal") == 0) | ||
102 | m_value = Slit::HORIZONTAL; | ||
103 | else | ||
104 | setDefaultValue(); | ||
105 | } | ||
106 | |||
107 | string FbTk::Resource<Slit::Placement>::getString() { | ||
108 | switch (m_value) { | ||
109 | case Slit::TOPLEFT: | ||
110 | return string("TopLeft"); | ||
111 | break; | ||
112 | case Slit::CENTERLEFT: | ||
113 | return string("CenterLeft"); | ||
114 | break; | ||
115 | case Slit::BOTTOMLEFT: | ||
116 | return string("BottomLeft"); | ||
117 | break; | ||
118 | case Slit::TOPCENTER: | ||
119 | return string("TopCenter"); | ||
120 | break; | ||
121 | case Slit::BOTTOMCENTER: | ||
122 | return string("BottomCenter"); | ||
123 | break; | ||
124 | case Slit::TOPRIGHT: | ||
125 | return string("TopRight"); | ||
126 | break; | ||
127 | case Slit::CENTERRIGHT: | ||
128 | return string("CenterRight"); | ||
129 | break; | ||
130 | case Slit::BOTTOMRIGHT: | ||
131 | return string("BottomRight"); | ||
132 | break; | ||
133 | } | ||
134 | //default string | ||
135 | return string("BottomRight"); | ||
136 | } | ||
137 | |||
138 | template<> | ||
139 | string FbTk::Resource<Slit::Direction>::getString() { | ||
140 | switch (m_value) { | ||
141 | case Slit::VERTICAL: | ||
142 | return string("Vertical"); | ||
143 | break; | ||
144 | case Slit::HORIZONTAL: | ||
145 | return string("Horizontal"); | ||
146 | break; | ||
147 | } | ||
148 | // default string | ||
149 | return string("Vertical"); | ||
150 | } | ||
151 | |||
75 | namespace { | 152 | namespace { |
76 | 153 | ||
77 | class SlitClientMenuItem: public FbTk::MenuItem { | 154 | class SlitClientMenuItem: public FbTk::MenuItem { |
@@ -275,19 +352,26 @@ void Slit::updateStrut() { | |||
275 | int left = 0, right = 0, top = 0, bottom = 0; | 352 | int left = 0, right = 0, top = 0, bottom = 0; |
276 | switch (placement()) { | 353 | switch (placement()) { |
277 | case TOPLEFT: | 354 | case TOPLEFT: |
278 | top = height(); | 355 | if (direction() == HORIZONTAL) |
279 | left = width(); | 356 | top = height(); |
357 | else | ||
358 | left = width(); | ||
280 | break; | 359 | break; |
281 | case TOPCENTER: | 360 | case TOPCENTER: |
282 | top = height(); | 361 | if (direction() == HORIZONTAL) |
362 | top = height(); | ||
283 | break; | 363 | break; |
284 | case TOPRIGHT: | 364 | case TOPRIGHT: |
285 | right = width(); | 365 | if (direction() == HORIZONTAL) |
286 | top = height(); | 366 | top = height(); |
367 | else | ||
368 | right = width(); | ||
287 | break; | 369 | break; |
288 | case BOTTOMLEFT: | 370 | case BOTTOMLEFT: |
289 | bottom = height(); | 371 | if (direction() == HORIZONTAL) |
290 | left = width(); | 372 | bottom = height(); |
373 | else | ||
374 | left = width(); | ||
291 | break; | 375 | break; |
292 | case BOTTOMCENTER: | 376 | case BOTTOMCENTER: |
293 | // would be strange to have it request size on vertical direction | 377 | // would be strange to have it request size on vertical direction |