src/box.cpp

Go to the documentation of this file.
00001 // Copyright (c) 2003 - 2004 Anselm R. Garbe <anselmg at t-online.de>
00002 // See ../LICENSE.txt for license details.
00003 //
00004 // $Id: box.cpp 2 2007-05-16 10:38:27Z eg $
00005 
00006 #include "box.h"
00007 
00008 #include "draw.h"
00009 #include "label.h"
00010 #include "monitor.h"
00011 #include "theme.h"
00012 #include "xcore.h"
00013 
00014 Box::Box(Monitor *monitor, Rectangle *rect, string text) :
00015     Widget(monitor, rect)
00016 {
00017     theme_ = this->monitor()->theme();
00018     label_ = new Label(this->monitor(), window(), Label::CENTER, gc());
00019     label_->setX(1);
00020     label_->setY(1);
00021     label_->setHeight(height() - 2);
00022     setText(text);
00023 }
00024 
00025 Box::~Box() {
00026     delete label_;
00027 }
00028 
00029 void Box::setText(string text) {
00030     label_->setText(text);
00031     label_->adjustWidth();
00032     setX(monitor()->width() / 2 - label_->width() / 2 - 1);
00033     setWidth(label_->width() + 2);
00034     resize();
00035 }
00036 
00037 void Box::illuminate() {
00038     if (!isVisible()) {
00039         return;
00040     }
00041     Rectangle borderRect(0, 0, width(), height());
00042     label_->update(theme_->TAB_BACKGROUND_ACTIVE_FOCUSSED,
00043                    theme_->TAB_TEXT_ACTIVE_FOCUSSED,
00044                    theme_->TAB_SHINE_ACTIVE_FOCUSSED,
00045                    theme_->TAB_SHADOW_ACTIVE_FOCUSSED,
00046                    true, true);
00047     Draw::drawRectBorder(window(), gc(), &borderRect,
00048                         theme_->BAR_SHINE, theme_->BAR_SHADOW);
00049     XCORE->sync();
00050 }

Generated on Thu May 24 15:19:31 2007 for ncwm by  doxygen 1.5.1