diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-06-29 15:27:28 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-08-26 06:18:48 (GMT) |
commit | fbb2d16639491fdb0c49e388278fabcc4b0800f3 (patch) | |
tree | b216515b1265dd6164722ebd77ff580738dfc9a0 /src/Screen.cc | |
parent | 393ba45f91480bb10f510248837c6051b7ff6a03 (diff) | |
download | fluxbox-fbb2d16639491fdb0c49e388278fabcc4b0800f3.zip fluxbox-fbb2d16639491fdb0c49e388278fabcc4b0800f3.tar.bz2 |
allow to alter button labels via fluxbox-remote
Command is "RelabelButton button.foo $LABEL"
This is useful to eg. hint the amount of unread mails in a
button to start your MUA, reflect the $USER in a session menu button
etc.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 24e0607..83a864b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -392,6 +392,7 @@ BScreen::~BScreen() { | |||
392 | return; | 392 | return; |
393 | 393 | ||
394 | m_toolbar.reset(0); | 394 | m_toolbar.reset(0); |
395 | m_toolButtonMap.reset(0); | ||
395 | 396 | ||
396 | FbTk::EventManager *evm = FbTk::EventManager::instance(); | 397 | FbTk::EventManager *evm = FbTk::EventManager::instance(); |
397 | evm->remove(rootWindow()); | 398 | evm->remove(rootWindow()); |
@@ -454,6 +455,7 @@ void BScreen::initWindows() { | |||
454 | 455 | ||
455 | #ifdef USE_TOOLBAR | 456 | #ifdef USE_TOOLBAR |
456 | if (m_opts & Fluxbox::OPT_TOOLBAR) { | 457 | if (m_opts & Fluxbox::OPT_TOOLBAR) { |
458 | m_toolButtonMap.reset(new ToolButtonMap()); | ||
457 | Toolbar* tb = new Toolbar(*this, *layerManager().getLayer(::ResourceLayer::NORMAL)); | 459 | Toolbar* tb = new Toolbar(*this, *layerManager().getLayer(::ResourceLayer::NORMAL)); |
458 | m_toolbar.reset(tb); | 460 | m_toolbar.reset(tb); |
459 | } | 461 | } |
@@ -1293,6 +1295,28 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, | |||
1293 | } | 1295 | } |
1294 | } | 1296 | } |
1295 | 1297 | ||
1298 | #if USE_TOOLBAR | ||
1299 | |||
1300 | void BScreen::clearToolButtonMap() { | ||
1301 | m_toolButtonMap->clear(); | ||
1302 | } | ||
1303 | |||
1304 | void BScreen::mapToolButton(std::string name, FbTk::TextButton *button) { | ||
1305 | m_toolButtonMap->insert(std::pair<std::string, FbTk::TextButton*>(name, button)); | ||
1306 | } | ||
1307 | |||
1308 | bool BScreen::relabelToolButton(std::string button, std::string label) { | ||
1309 | ToolButtonMap::const_iterator it = m_toolButtonMap->find(button); | ||
1310 | if (it != m_toolButtonMap->end() && it->second) { | ||
1311 | it->second->setText(label); | ||
1312 | m_toolbar->relayout(); | ||
1313 | return true; | ||
1314 | } | ||
1315 | return false; | ||
1316 | } | ||
1317 | |||
1318 | #endif | ||
1319 | |||
1296 | void BScreen::initMenus() { | 1320 | void BScreen::initMenus() { |
1297 | m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber())); | 1321 | m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber())); |
1298 | m_rootmenu->reloadHelper()->setMainFile(Fluxbox::instance()->getMenuFilename()); | 1322 | m_rootmenu->reloadHelper()->setMainFile(Fluxbox::instance()->getMenuFilename()); |