wmi

git clone git://oldgit.suckless.org/wmi/
Log | Files | Refs | LICENSE

bar.cpp (941B)


      1 // Copyright (c) 2003 - 2009 Anselm R Garbe <anselm@garbe.us>
      2 // See LICENSE for license details.
      3 
      4 #include "bar.h"
      5 
      6 #include <map>
      7 
      8 #include "draw.h"
      9 #include "kernel.h"
     10 #include "label.h"
     11 #include "monitor.h"
     12 #include "theme.h"
     13 #include "util.h"
     14 #include "xcore.h"
     15 
     16 Bar::Bar(Monitor *monitor, Rectangle *rect) :
     17     Widget(monitor, rect)
     18 {
     19     theme_ = this->monitor()->theme();
     20     isButtonVisible_ = (Util::get(KERNEL->commonSettings(), ("bar.buttons"))
     21                         == "yes");
     22     borderRect_ = Rectangle(0, 0, width(), height());
     23 
     24     label_ = new Label(this->monitor(), window(), Label::CENTER, gc());
     25     label_->setX(1);
     26     label_->setY(1);
     27     label_->setWidth(width() - 2);
     28     label_->setHeight(height() - 2);
     29 }
     30 
     31 Bar::~Bar() {
     32     delete label_;
     33 }
     34 
     35 
     36 void Bar::drawBorder() {
     37 
     38     Draw::drawRectBorder(window(), gc(), &borderRect_,
     39                         theme_->BAR_SHINE, theme_->BAR_SHADOW);
     40 
     41     XCORE->sync();
     42 }