wmi

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

widget.h (785B)


      1 // Copyright (c) 2003 - 2009 Anselm R Garbe <anselm@garbe.us>
      2 // See LICENSE for license details.
      3 
      4 #ifndef __WIDGET_H
      5 #define __WIDGET_H
      6 
      7 extern "C" {
      8 #include <X11/Xlib.h>
      9 }
     10 
     11 #include "rectangle.h"
     12 
     13 class Monitor;
     14 
     15 /** Base class for widgets, such as menu, bar, slot, thing. */
     16 class Widget : public Rectangle {
     17 
     18 public:
     19 
     20     Widget(Monitor *monitor, Rectangle *rect,
     21            bool initWindowAndGC = true);
     22     virtual ~Widget();
     23 
     24     Monitor *monitor() const;
     25     GC gc() const;
     26 
     27     Window window() const;
     28 
     29     virtual void resize();
     30     virtual void show();
     31     virtual void hide();
     32 
     33     bool isVisible() const;
     34 
     35 protected:
     36     bool isVisible_;
     37 
     38 private:
     39 
     40     void initWindow();
     41     void initGC();
     42 
     43     GC gc_;
     44     Monitor *monitor_;
     45     Window window_;
     46 };
     47 
     48 #endif // __WIDGET_H