diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/MenuTheme.cc | 56 | ||||
-rw-r--r-- | src/MenuTheme.hh | 40 |
2 files changed, 96 insertions, 0 deletions
diff --git a/src/MenuTheme.cc b/src/MenuTheme.cc new file mode 100644 index 0000000..ff9b639 --- /dev/null +++ b/src/MenuTheme.cc | |||
@@ -0,0 +1,56 @@ | |||
1 | // MenuTheme.cc | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: MenuTheme.cc,v 1.1 2003/07/10 11:52:47 fluxgen Exp $ | ||
23 | |||
24 | #include "MenuTheme.hh" | ||
25 | #include "StringUtil.hh" | ||
26 | #include <iostream> | ||
27 | using namespace std; | ||
28 | |||
29 | template <> | ||
30 | void FbTk::ThemeItem<Shape::ShapePlace>::load() { } | ||
31 | |||
32 | template <> | ||
33 | void FbTk::ThemeItem<Shape::ShapePlace>::setDefaultValue() { | ||
34 | *(*this) = Shape::NONE; | ||
35 | } | ||
36 | |||
37 | template <> | ||
38 | void FbTk::ThemeItem<Shape::ShapePlace>::setFromString(const char *str) { | ||
39 | int places = 0; | ||
40 | |||
41 | if (StringUtil::strcasestr(str, "topleft") != 0) | ||
42 | places |= Shape::TOPLEFT; | ||
43 | if (StringUtil::strcasestr(str, "topright") != 0) | ||
44 | places |= Shape::TOPRIGHT; | ||
45 | if (StringUtil::strcasestr(str, "bottomleft") != 0) | ||
46 | places |= Shape::BOTTOMLEFT; | ||
47 | if (StringUtil::strcasestr(str, "bottomright") != 0) | ||
48 | places |= Shape::BOTTOMRIGHT; | ||
49 | |||
50 | *(*this) = static_cast<Shape::ShapePlace>(places); | ||
51 | } | ||
52 | |||
53 | MenuTheme::MenuTheme(int screen_num):FbTk::MenuTheme(screen_num), | ||
54 | m_shapeplace(*this, "menu.shape", "Menu.Shape") { | ||
55 | *m_shapeplace = Shape::NONE; | ||
56 | } | ||
diff --git a/src/MenuTheme.hh b/src/MenuTheme.hh new file mode 100644 index 0000000..3d522a6 --- /dev/null +++ b/src/MenuTheme.hh | |||
@@ -0,0 +1,40 @@ | |||
1 | // MenuTheme.hh | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: MenuTheme.hh,v 1.1 2003/07/10 11:52:47 fluxgen Exp $ | ||
23 | |||
24 | #ifndef MENUTHEME_HH | ||
25 | #define MENUTHEME_HH | ||
26 | |||
27 | #include "FbTk/MenuTheme.hh" | ||
28 | #include "Shape.hh" | ||
29 | |||
30 | /// this class extends FbTk MenuTheme and adds shape item | ||
31 | class MenuTheme:public FbTk::MenuTheme { | ||
32 | public: | ||
33 | explicit MenuTheme(int screen_num); | ||
34 | Shape::ShapePlace shapePlaces() const { return *m_shapeplace; } | ||
35 | private: | ||
36 | FbTk::ThemeItem<Shape::ShapePlace> m_shapeplace; | ||
37 | }; | ||
38 | |||
39 | #endif // MENUTHEME_HH | ||
40 | |||