aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2009-06-28 17:54:55 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2009-06-28 17:54:55 (GMT)
commit9f59ce18a21c8544d996235787ff1d7a6557153d (patch)
tree6776329ae5a33e757a2e31df89d2aac3da82d772
parent5f9f2475b72e977fa96214e368c34c588b265888 (diff)
downloadfluxbox-9f59ce18a21c8544d996235787ff1d7a6557153d.zip
fluxbox-9f59ce18a21c8544d996235787ff1d7a6557153d.tar.bz2
change default toolbar tools to:
prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock
-rw-r--r--src/FbTk/StringUtil.cc2
-rw-r--r--src/ToolFactory.cc32
-rw-r--r--src/Toolbar.cc2
3 files changed, 8 insertions, 28 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc
index 7c8f91c..18e000e 100644
--- a/src/FbTk/StringUtil.cc
+++ b/src/FbTk/StringUtil.cc
@@ -63,7 +63,7 @@ namespace StringUtil {
63/** 63/**
64 Tries to find a string in another and 64 Tries to find a string in another and
65 ignoring the case of the characters 65 ignoring the case of the characters
66 Returns 0 on success else pointer to str. 66 Returns 0 on failure else pointer to str.
67*/ 67*/
68const char *strcasestr(const char *str, const char *ptn) { 68const char *strcasestr(const char *str, const char *ptn) {
69 const char *s2, *p2; 69 const char *s2, *p2;
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)
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 63157b3..2552de9 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -243,7 +243,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
243 m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, 243 m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER,
244 scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"), 244 scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"),
245 m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"), 245 m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"),
246 m_rc_tools(scrn.resourceManager(), "workspacename, prevworkspace, nextworkspace, iconbar, systemtray, prevwindow, nextwindow, clock", 246 m_rc_tools(scrn.resourceManager(), "prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock",
247 scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"), 247 scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"),
248 m_shape(new FbTk::Shape(frame.window, 0)), 248 m_shape(new FbTk::Shape(frame.window, 0)),
249 m_resize_lock(false) { 249 m_resize_lock(false) {