aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-26 16:46:05 (GMT)
committerfluxgen <fluxgen>2002-11-26 16:46:05 (GMT)
commit558aa0f9f970b95bdd14582da7690a8208fe7bb9 (patch)
tree09d948b979f4c803f8ca154d5d1bd6d3a731db81 /src/Window.cc
parent75eb138d4e07d6f1024963f4ac9561dfd7a34b54 (diff)
downloadfluxbox_pavel-558aa0f9f970b95bdd14582da7690a8208fe7bb9.zip
fluxbox_pavel-558aa0f9f970b95bdd14582da7690a8208fe7bb9.tar.bz2
using drawutil's doAlignment function
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc56
1 files changed, 24 insertions, 32 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 24e4e45..3ec9543 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.101 2002/11/23 16:07:19 rathnor Exp $ 25// $Id: Window.cc,v 1.102 2002/11/26 16:44:48 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -2426,44 +2426,36 @@ void FluxboxWindow::redrawLabel() {
2426 XClearWindow(display, frame.label); 2426 XClearWindow(display, frame.label);
2427 2427
2428 //no need to draw the title if we don't have any 2428 //no need to draw the title if we don't have any
2429 if (getTitle().size() != 0) { 2429 if (getTitle().size() == 0)
2430 GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc : 2430 return;
2431 screen->getWindowStyle()->l_text_unfocus_gc);
2432 unsigned int l = client.title_text_w;
2433 int dlen = getTitle().size();
2434 int dx = frame.bevel_w;
2435 FbTk::Font &font = screen->getWindowStyle()->font;
2436 if (l > frame.label_w) {
2437 for (; dlen >= 0; dlen--) {
2438 l = font.textWidth(getTitle().c_str(), dlen) + frame.bevel_w*4;
2439 if (l < frame.label_w)
2440 break;
2441 }
2442 }
2443 switch (screen->getWindowStyle()->justify) {
2444 case DrawUtil::Font::RIGHT:
2445 dx += frame.label_w - l;
2446 break;
2447 case DrawUtil::Font::CENTER:
2448 dx += (frame.label_w - l)/2;
2449 break;
2450 }
2451 2431
2452 font.drawText( 2432 GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc :
2453 frame.label, 2433 screen->getWindowStyle()->l_text_unfocus_gc);
2454 screen->getScreenNumber(), 2434
2455 gc, 2435 size_t newlen = getTitle().size();
2456 getTitle().c_str(), getTitle().size(), 2436 const char *labeltext = getTitle().c_str();
2457 dx, screen->getWindowStyle()->font.ascent() + 1); 2437 FbTk::Font &font = screen->getWindowStyle()->font;
2458 } 2438
2439 int align_x = DrawUtil::doAlignment(
2440 frame.label_w, frame.bevel_w*2,
2441 screen->getWindowStyle()->justify,
2442 font,
2443 labeltext, newlen, newlen);
2444
2445 font.drawText(
2446 frame.label,
2447 screen->getScreenNumber(),
2448 gc,
2449 labeltext, newlen,
2450 align_x, font.ascent() + 1);
2459} 2451}
2460 2452
2461 2453
2462void FluxboxWindow::redrawAllButtons() { 2454void FluxboxWindow::redrawAllButtons() {
2463 for (unsigned int i=0; i<buttonlist.size(); i++) 2455 for (unsigned int i=0; i<buttonlist.size(); i++) {
2464 if (buttonlist[i].draw) 2456 if (buttonlist[i].draw)
2465 buttonlist[i].draw(this, buttonlist[i].win, false); 2457 buttonlist[i].draw(this, buttonlist[i].win, false);
2466 2458 }
2467} 2459}
2468 2460
2469void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) { 2461void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) {