aboutsummaryrefslogtreecommitdiff
path: root/src/WorkspaceNameTool.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-04-15 16:41:11 (GMT)
committersimonb <simonb>2006-04-15 16:41:11 (GMT)
commit7c7908443302fc66929e19804f0fbd655d4c7f34 (patch)
tree6839a7379b4cc514a5a4ce20ebf0a53123d20ba2 /src/WorkspaceNameTool.cc
parent83a3429c395299b5acb85a3f372091037fe12603 (diff)
downloadfluxbox-7c7908443302fc66929e19804f0fbd655d4c7f34.zip
fluxbox-7c7908443302fc66929e19804f0fbd655d4c7f34.tar.bz2
implement vertical toolbar placement options
Diffstat (limited to 'src/WorkspaceNameTool.cc')
-rw-r--r--src/WorkspaceNameTool.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/WorkspaceNameTool.cc b/src/WorkspaceNameTool.cc
index 525c4a8..99d6854 100644
--- a/src/WorkspaceNameTool.cc
+++ b/src/WorkspaceNameTool.cc
@@ -82,7 +82,10 @@ void WorkspaceNameTool::update(FbTk::Subject *subj) {
82 82
83unsigned int WorkspaceNameTool::width() const { 83unsigned int WorkspaceNameTool::width() const {
84 // calculate largest size 84 // calculate largest size
85 if (orientation() == FbTk::ROT90 || orientation() == FbTk::ROT270)
86 return m_button.width();
85 unsigned int max_size = 0; 87 unsigned int max_size = 0;
88
86 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList(); 89 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList();
87 BScreen::Workspaces::const_iterator it; 90 BScreen::Workspaces::const_iterator it;
88 for (it = workspaces.begin(); it != workspaces.end(); it++) { 91 for (it = workspaces.begin(); it != workspaces.end(); it++) {
@@ -97,7 +100,21 @@ unsigned int WorkspaceNameTool::width() const {
97} 100}
98 101
99unsigned int WorkspaceNameTool::height() const { 102unsigned int WorkspaceNameTool::height() const {
100 return m_button.height(); 103 if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180)
104 return m_button.height();
105
106 unsigned int max_size = 0;
107 const BScreen::Workspaces& workspaces = m_screen.getWorkspacesList();
108 BScreen::Workspaces::const_iterator it;
109 for (it = workspaces.begin(); it != workspaces.end(); it++) {
110 const std::string &name = (*it)->name();
111 max_size = std::max(m_theme.font().textWidth(name.c_str(), name.size()),
112 max_size);
113 }
114 // so align text dont cut the last character
115 max_size += 2;
116
117 return max_size;
101} 118}
102 119
103unsigned int WorkspaceNameTool::borderWidth() const { 120unsigned int WorkspaceNameTool::borderWidth() const {
@@ -121,7 +138,7 @@ void WorkspaceNameTool::reRender() {
121 if (m_pixmap) 138 if (m_pixmap)
122 m_screen.imageControl().removeImage(m_pixmap); 139 m_screen.imageControl().removeImage(m_pixmap);
123 m_pixmap = m_screen.imageControl().renderImage(width(), height(), 140 m_pixmap = m_screen.imageControl().renderImage(width(), height(),
124 m_theme.texture()); 141 m_theme.texture(), orientation());
125 m_button.setBackgroundPixmap(m_pixmap); 142 m_button.setBackgroundPixmap(m_pixmap);
126 } 143 }
127} 144}
@@ -144,3 +161,8 @@ void WorkspaceNameTool::renderTheme(unsigned char alpha) {
144 161
145 m_button.clear(); 162 m_button.clear();
146} 163}
164
165void WorkspaceNameTool::setOrientation(FbTk::Orientation orient) {
166 m_button.setOrientation(orient);
167 ToolbarItem::setOrientation(orient);
168}