change default toolbar tools to:
prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock
This commit is contained in:
parent
5f9f2475b7
commit
9f59ce18a2
3 changed files with 8 additions and 28 deletions
|
@ -63,7 +63,7 @@ namespace StringUtil {
|
||||||
/**
|
/**
|
||||||
Tries to find a string in another and
|
Tries to find a string in another and
|
||||||
ignoring the case of the characters
|
ignoring the case of the characters
|
||||||
Returns 0 on success else pointer to str.
|
Returns 0 on failure else pointer to str.
|
||||||
*/
|
*/
|
||||||
const char *strcasestr(const char *str, const char *ptn) {
|
const char *strcasestr(const char *str, const char *ptn) {
|
||||||
const char *s2, *p2;
|
const char *s2, *p2;
|
||||||
|
|
|
@ -101,17 +101,16 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
|
||||||
item = new SystemTray(parent, dynamic_cast<ButtonTheme &>(*m_systray_theme), screen());
|
item = new SystemTray(parent, dynamic_cast<ButtonTheme &>(*m_systray_theme), screen());
|
||||||
} else if (name == "clock") {
|
} else if (name == "clock") {
|
||||||
item = new ClockTool(parent, m_clock_theme, screen(), tbar.menu());
|
item = new ClockTool(parent, m_clock_theme, screen(), tbar.menu());
|
||||||
} else if (name == "nextworkspace" ||
|
} else {
|
||||||
name == "prevworkspace") {
|
|
||||||
|
|
||||||
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
|
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
|
||||||
if (*cmd == 0) // we need a command
|
if (*cmd == 0) // we need a command
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// TODO maybe direction of arrows should depend on toolbar layout ?
|
// TODO maybe direction of arrows should depend on toolbar layout ?
|
||||||
FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::LEFT;
|
FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::RIGHT;
|
||||||
if (name == "nextworkspace")
|
const char *tmp = name.c_str();
|
||||||
arrow_type = FbTk::FbDrawable::RIGHT;
|
if (FbTk::StringUtil::strcasestr(tmp, "prev"))
|
||||||
|
arrow_type = FbTk::FbDrawable::LEFT;
|
||||||
|
|
||||||
ArrowButton *win = new ArrowButton(arrow_type, parent,
|
ArrowButton *win = new ArrowButton(arrow_type, parent,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -120,25 +119,6 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
|
||||||
item = new ButtonTool(win, ToolbarItem::SQUARE,
|
item = new ButtonTool(win, ToolbarItem::SQUARE,
|
||||||
dynamic_cast<ButtonTheme &>(*m_button_theme),
|
dynamic_cast<ButtonTheme &>(*m_button_theme),
|
||||||
screen().imageControl());
|
screen().imageControl());
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
|
|
||||||
if (*cmd == 0) // we need a command
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::LEFT;
|
|
||||||
if (name == "nextwindow")
|
|
||||||
arrow_type = FbTk::FbDrawable::RIGHT;
|
|
||||||
|
|
||||||
ArrowButton *win = new ArrowButton(arrow_type, parent,
|
|
||||||
0, 0,
|
|
||||||
button_size, button_size);
|
|
||||||
win->setOnClick(cmd);
|
|
||||||
item = new ButtonTool(win, ToolbarItem::SQUARE,
|
|
||||||
dynamic_cast<ButtonTheme &>(*m_button_theme),
|
|
||||||
screen().imageControl());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item)
|
if (item)
|
||||||
|
|
|
@ -243,7 +243,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
|
||||||
m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER,
|
m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER,
|
||||||
scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"),
|
scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"),
|
||||||
m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"),
|
m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"),
|
||||||
m_rc_tools(scrn.resourceManager(), "workspacename, prevworkspace, nextworkspace, iconbar, systemtray, prevwindow, nextwindow, clock",
|
m_rc_tools(scrn.resourceManager(), "prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock",
|
||||||
scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"),
|
scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"),
|
||||||
m_shape(new FbTk::Shape(frame.window, 0)),
|
m_shape(new FbTk::Shape(frame.window, 0)),
|
||||||
m_resize_lock(false) {
|
m_resize_lock(false) {
|
||||||
|
|
Loading…
Reference in a new issue