diff options
author | akir <akir> | 2004-10-22 00:35:29 (GMT) |
---|---|---|
committer | akir <akir> | 2004-10-22 00:35:29 (GMT) |
commit | f5d7833b32f77e936ce9f6e930f0b930519a28a2 (patch) | |
tree | 7e989a8baff2b268f5d1fd09bcb29f7485330aa7 /src/IconbarTool.cc | |
parent | 33b55697ab8c615badf195d5c54b0136fbe93c54 (diff) | |
download | fluxbox-f5d7833b32f77e936ce9f6e930f0b930519a28a2.zip fluxbox-f5d7833b32f77e936ce9f6e930f0b930519a28a2.tar.bz2 |
added iconbar.wheelMode and iconbar.deiconifyMode
Diffstat (limited to 'src/IconbarTool.cc')
-rw-r--r-- | src/IconbarTool.cc | 91 |
1 files changed, 89 insertions, 2 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 066b87d..e6cc22b 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: IconbarTool.cc,v 1.48 2004/10/10 16:11:25 akir Exp $ | 23 | // $Id: IconbarTool.cc,v 1.49 2004/10/22 00:35:28 akir Exp $ |
24 | 24 | ||
25 | #include "IconbarTool.hh" | 25 | #include "IconbarTool.hh" |
26 | 26 | ||
@@ -66,6 +66,68 @@ void FbTk::Resource<IconbarTool::Mode>::setFromString(const char *strval) { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | template<> | 68 | template<> |
69 | void FbTk::Resource<IconbarTool::DeiconifyMode>::setDefaultValue() { | ||
70 | m_value = IconbarTool::CURRENT; | ||
71 | } | ||
72 | |||
73 | template<> | ||
74 | void FbTk::Resource<IconbarTool::DeiconifyMode>::setFromString(const char* strval) { | ||
75 | if (strncasecmp(strval, "Current", strlen("Current")) == 0) | ||
76 | m_value = IconbarTool::CURRENT; | ||
77 | else if (strncasecmp(strval, "Follow", strlen("Follow")) == 0) | ||
78 | m_value = IconbarTool::FOLLOW; | ||
79 | else if (strncasecmp(strval, "SemiFollow", strlen("SemiFollow")) == 0) | ||
80 | m_value = IconbarTool::SEMIFOLLOW; | ||
81 | else | ||
82 | setDefaultValue(); | ||
83 | } | ||
84 | |||
85 | template<> | ||
86 | std::string FbTk::Resource<IconbarTool::DeiconifyMode>::getString() { | ||
87 | switch (m_value) { | ||
88 | case IconbarTool::SEMIFOLLOW: | ||
89 | return std::string("SemiFollow"); | ||
90 | break; | ||
91 | case IconbarTool::FOLLOW: | ||
92 | return std::string("Follow"); | ||
93 | break; | ||
94 | }; | ||
95 | return std::string("Current"); | ||
96 | } | ||
97 | |||
98 | template<> | ||
99 | void FbTk::Resource<IconbarTool::WheelMode>::setDefaultValue() { | ||
100 | m_value = IconbarTool::SCREEN; | ||
101 | } | ||
102 | |||
103 | |||
104 | template<> | ||
105 | void FbTk::Resource<IconbarTool::WheelMode>::setFromString(const char* strval) { | ||
106 | if (strncasecmp(strval, "off", strlen("off")) == 0) | ||
107 | m_value = IconbarTool::OFF; | ||
108 | else if (strncasecmp(strval, "on", strlen("on")) == 0) | ||
109 | m_value = IconbarTool::ON; | ||
110 | else if (strncasecmp(strval, "screen", strlen("screen")) == 0) | ||
111 | m_value = IconbarTool::SCREEN; | ||
112 | else | ||
113 | setDefaultValue(); | ||
114 | } | ||
115 | |||
116 | |||
117 | template<> | ||
118 | std::string FbTk::Resource<IconbarTool::WheelMode>::getString() { | ||
119 | switch(m_value) { | ||
120 | case IconbarTool::ON: | ||
121 | return std::string("On"); | ||
122 | break; | ||
123 | case IconbarTool::SCREEN: | ||
124 | return std::string("Screen"); | ||
125 | break; | ||
126 | }; | ||
127 | return std::string("Off"); | ||
128 | } | ||
129 | |||
130 | template<> | ||
69 | void FbTk::Resource<Container::Alignment>::setDefaultValue() { | 131 | void FbTk::Resource<Container::Alignment>::setDefaultValue() { |
70 | m_value = Container::RELATIVE; | 132 | m_value = Container::RELATIVE; |
71 | } | 133 | } |
@@ -275,6 +337,12 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr | |||
275 | m_empty_pm(0), | 337 | m_empty_pm(0), |
276 | m_rc_mode(screen.resourceManager(), WORKSPACE, | 338 | m_rc_mode(screen.resourceManager(), WORKSPACE, |
277 | screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), | 339 | screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), |
340 | m_deiconify_mode(screen.resourceManager(), CURRENT, | ||
341 | screen.name() + ".iconbar.deiconifyMode", | ||
342 | screen.name() + ".iconbar.DeiconifyMode"), | ||
343 | m_wheel_mode(screen.resourceManager(), OFF, | ||
344 | screen.name() + ".iconbar.wheelMode", | ||
345 | screen.name() + ".iconbar.WheelMode"), | ||
278 | m_rc_alignment(screen.resourceManager(), Container::LEFT, | 346 | m_rc_alignment(screen.resourceManager(), Container::LEFT, |
279 | screen.name() + ".iconbar.alignment", screen.altName() + ".Iconbar.Alignment"), | 347 | screen.name() + ".iconbar.alignment", screen.altName() + ".Iconbar.Alignment"), |
280 | m_rc_client_width(screen.resourceManager(), 70, | 348 | m_rc_client_width(screen.resourceManager(), 70, |
@@ -404,6 +472,20 @@ void IconbarTool::setMode(Mode mode) { | |||
404 | renderTheme(); | 472 | renderTheme(); |
405 | } | 473 | } |
406 | 474 | ||
475 | void IconbarTool::setDeiconifyMode(DeiconifyMode mode) { | ||
476 | if (mode == *m_deiconify_mode) | ||
477 | return; | ||
478 | |||
479 | *m_deiconify_mode = mode; | ||
480 | } | ||
481 | |||
482 | void IconbarTool::setWheelMode(WheelMode mode) { | ||
483 | if (mode == *m_wheel_mode) | ||
484 | return; | ||
485 | *m_wheel_mode = mode; | ||
486 | } | ||
487 | |||
488 | |||
407 | unsigned int IconbarTool::width() const { | 489 | unsigned int IconbarTool::width() const { |
408 | return m_icon_container.width(); | 490 | return m_icon_container.width(); |
409 | } | 491 | } |
@@ -735,7 +817,12 @@ void IconbarTool::addWindow(FluxboxWindow &win) { | |||
735 | #ifdef DEBUG | 817 | #ifdef DEBUG |
736 | cerr<<"IconbarTool::addWindow(0x"<<&win<<" title = "<<win.title()<<")"<<endl; | 818 | cerr<<"IconbarTool::addWindow(0x"<<&win<<" title = "<<win.title()<<")"<<endl; |
737 | #endif // DEBUG | 819 | #endif // DEBUG |
738 | IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win); | 820 | IconButton *button = new IconButton(*this, |
821 | m_icon_container, | ||
822 | m_theme.focusedText().font(), | ||
823 | win); | ||
824 | |||
825 | |||
739 | button->setTextPadding(*m_rc_client_padding); | 826 | button->setTextPadding(*m_rc_client_padding); |
740 | 827 | ||
741 | renderButton(*button, false); // update the attributes, but don't clear it | 828 | renderButton(*button, false); // update the attributes, but don't clear it |