aboutsummaryrefslogtreecommitdiff
path: root/src/ToolFactory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToolFactory.cc')
-rw-r--r--src/ToolFactory.cc32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc
index c5cb895..be83616 100644
--- a/src/ToolFactory.cc
+++ b/src/ToolFactory.cc
@@ -101,36 +101,17 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
101 item = new SystemTray(parent, dynamic_cast<ButtonTheme &>(*m_systray_theme), screen()); 101 item = new SystemTray(parent, dynamic_cast<ButtonTheme &>(*m_systray_theme), screen());
102 } else if (name == "clock") { 102 } else if (name == "clock") {
103 item = new ClockTool(parent, m_clock_theme, screen(), tbar.menu()); 103 item = new ClockTool(parent, m_clock_theme, screen(), tbar.menu());
104 } else if (name == "nextworkspace" ||
105 name == "prevworkspace") {
106
107 FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
108 if (*cmd == 0) // we need a command
109 return 0;
110
111 // TODO maybe direction of arrows should depend on toolbar layout ?
112 FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::LEFT;
113 if (name == "nextworkspace")
114 arrow_type = FbTk::FbDrawable::RIGHT;
115
116 ArrowButton *win = new ArrowButton(arrow_type, parent,
117 0, 0,
118 button_size, button_size);
119 win->setOnClick(cmd);
120 item = new ButtonTool(win, ToolbarItem::SQUARE,
121 dynamic_cast<ButtonTheme &>(*m_button_theme),
122 screen().imageControl());
123
124 } else { 104 } else {
125
126 FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name)); 105 FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
127 if (*cmd == 0) // we need a command 106 if (*cmd == 0) // we need a command
128 return 0; 107 return 0;
129 108
130 FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::LEFT; 109 // TODO maybe direction of arrows should depend on toolbar layout ?
131 if (name == "nextwindow") 110 FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::RIGHT;
132 arrow_type = FbTk::FbDrawable::RIGHT; 111 const char *tmp = name.c_str();
133 112 if (FbTk::StringUtil::strcasestr(tmp, "prev"))
113 arrow_type = FbTk::FbDrawable::LEFT;
114
134 ArrowButton *win = new ArrowButton(arrow_type, parent, 115 ArrowButton *win = new ArrowButton(arrow_type, parent,
135 0, 0, 116 0, 0,
136 button_size, button_size); 117 button_size, button_size);
@@ -138,7 +119,6 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
138 item = new ButtonTool(win, ToolbarItem::SQUARE, 119 item = new ButtonTool(win, ToolbarItem::SQUARE,
139 dynamic_cast<ButtonTheme &>(*m_button_theme), 120 dynamic_cast<ButtonTheme &>(*m_button_theme),
140 screen().imageControl()); 121 screen().imageControl());
141
142 } 122 }
143 123
144 if (item) 124 if (item)