indicate iconified windows in iconbar
This commit is contained in:
parent
e99d940f40
commit
3058861f89
3 changed files with 33 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "IconbarTheme.hh"
|
||||
|
||||
#include "Screen.hh"
|
||||
#include "Window.hh"
|
||||
|
||||
#include "FbTk/App.hh"
|
||||
#include "FbTk/Command.hh"
|
||||
|
@ -58,6 +59,10 @@ IconButton::IconButton(const FbTk::FbWindow &parent,
|
|||
m_signals.join(m_win.titleSig(),
|
||||
MemFunIgnoreArgs(m_title_update_timer, &FbTk::Timer::start));
|
||||
|
||||
if (m_win.fbwindow())
|
||||
m_signals.join(m_win.fbwindow()->stateSig(),
|
||||
MemFunIgnoreArgs(*this, &IconButton::clientTitleChanged));
|
||||
|
||||
m_signals.join(m_win.focusSig(),
|
||||
MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear));
|
||||
|
||||
|
@ -250,7 +255,10 @@ void IconButton::clientTitleChanged() {
|
|||
|
||||
void IconButton::setupWindow() {
|
||||
m_icon_window.clear();
|
||||
setText(m_win.title());
|
||||
FbTk::FbString title = m_win.title().logical();
|
||||
if (m_win.fbwindow() && m_win.fbwindow()->isIconic())
|
||||
title = IconbarTool::iconifiedPrefix() + title + IconbarTool::iconifiedSuffix();
|
||||
setText(title);
|
||||
FbTk::TextButton::clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -225,6 +225,8 @@ private:
|
|||
|
||||
} // end anonymous namespace
|
||||
|
||||
std::string IconbarTool::s_iconifiedDecoration[2];
|
||||
|
||||
IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
||||
FbTk::ThemeProxy<IconbarTheme> &focused_theme,
|
||||
FbTk::ThemeProxy<IconbarTheme> &unfocused_theme,
|
||||
|
@ -252,6 +254,8 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
|||
*screen.layerManager().getLayer(ResourceLayer::MENU)),
|
||||
m_alpha(255) {
|
||||
|
||||
updateIconifiedPattern();
|
||||
|
||||
// setup mode menu
|
||||
setupModeMenu(m_menu, *this);
|
||||
_FB_USES_NLS;
|
||||
|
@ -279,6 +283,8 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
|||
FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
|
||||
m_tracker.join(unfocused_theme.reconfigSig(),
|
||||
FbTk::MemFun(*this, &IconbarTool::themeReconfigured));
|
||||
m_tracker.join(screen.reconfigureSig(),
|
||||
FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern));
|
||||
themeReconfigured();
|
||||
}
|
||||
|
||||
|
@ -439,6 +445,19 @@ void IconbarTool::update(UpdateReason reason, Focusable *win) {
|
|||
renderTheme();
|
||||
}
|
||||
|
||||
void IconbarTool::updateIconifiedPattern() {
|
||||
FbTk::Resource<std::string> p(m_screen.resourceManager(), "( %t )",
|
||||
m_screen.name() + ".iconbar.iconifiedPattern",
|
||||
m_screen.altName() + ".Iconbar.IconifiedPattern");
|
||||
size_t tidx = p->find("%t");
|
||||
s_iconifiedDecoration[0].clear();
|
||||
s_iconifiedDecoration[1].clear();
|
||||
if (tidx != std::string::npos) {
|
||||
s_iconifiedDecoration[0] = p->substr(0, tidx);
|
||||
s_iconifiedDecoration[1] = p->substr(tidx+2);
|
||||
}
|
||||
}
|
||||
|
||||
void IconbarTool::insertWindow(Focusable &win, int pos) {
|
||||
IconButton *button = 0;
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
|
||||
void setOrientation(FbTk::Orientation orient);
|
||||
FbTk::Container::Alignment alignment() const { return m_icon_container.alignment(); }
|
||||
static std::string &iconifiedPrefix() { return s_iconifiedDecoration[0]; }
|
||||
static std::string &iconifiedSuffix() { return s_iconifiedDecoration[1]; }
|
||||
|
||||
const BScreen &screen() const { return m_screen; }
|
||||
private:
|
||||
|
@ -98,6 +100,8 @@ private:
|
|||
/// called when the list emits a signal
|
||||
void update(UpdateReason reason, Focusable *win);
|
||||
|
||||
void updateIconifiedPattern();
|
||||
|
||||
void themeReconfigured();
|
||||
|
||||
BScreen &m_screen;
|
||||
|
@ -118,6 +122,7 @@ private:
|
|||
FbTk::Resource<bool> m_rc_use_pixmap; ///< if iconbar should use win pixmap or not
|
||||
FbMenu m_menu;
|
||||
int m_alpha;
|
||||
static std::string s_iconifiedDecoration[2];
|
||||
};
|
||||
|
||||
#endif // ICONBARTOOL_HH
|
||||
|
|
Loading…
Reference in a new issue