src/thing.h

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: thing.h 7 2007-05-24 11:03:53Z eg1981 $
00005 
00006 #ifndef __THING_H
00007 #define __THING_H
00008 
00009 extern "C" {
00010 #include <X11/Xlib.h>
00011 #include <X11/Xutil.h>
00012 }
00013 
00014 #include <string>
00015 
00016 #include "rectangle.h"
00017 #include "ncwm.h"
00018 
00019 class Label;
00020 class Monitor;
00021 class Frame;
00022 class Group;
00023 class Theme;
00024 class Workspace;
00025 
00030 class Thing : public Rectangle {
00031 
00032 public:
00033 
00035     // model
00036 
00037     enum Type {CLIENT, FRAME};
00038 
00039     Thing(Monitor *monitor, Rectangle *rect, Type type_);
00040 
00041     virtual ~Thing();
00042 
00043     void initFrameWindow();
00044 
00045     Type type() const;
00046 
00047     Monitor *monitor() const;
00048 
00049     bool isVisible() const;
00050 
00052     // view
00053 
00054     enum InvertButton {NONE, MINCLIENT, DEMAX, CLOSE};
00055 
00056     void setTitleBarHeight(unsigned int titleBarHeight);
00057 
00058     unsigned int titleBarHeight() const;
00059 
00060     void setBorderWidth(unsigned int borderWidth);
00061 
00062     unsigned int borderWidth() const;
00063 
00064     Rectangle *prevRectangle() const;
00065 
00066     InvertButton buttonState() const;
00067 
00068     void setButtonState(InvertButton state);
00069 
00070     void handleMotionNotify(XMotionEvent *event);
00071 
00072     virtual Window window() = 0;
00073     virtual void illuminate() = 0;
00074     virtual void resize() = 0;
00075     virtual bool isFocused() = 0;
00076     virtual void handleButtonPress(XButtonEvent *event) = 0;
00077     virtual void handleButtonRelease(XButtonEvent *event) = 0;
00078     virtual Cursor cursorForXY(int pointerX, int pointerY) = 0;
00079 
00080     virtual void show();
00081     virtual void hide();
00082 
00083     void setName(string name);
00084     string name() const;
00085     bool hasDecoration() const;
00086 
00087 protected:
00088 
00089     void fitClientArea();
00090 
00091     // model
00092     bool isVisible_;
00093     string name_;
00094 
00095     // view
00096     void illuminateBorder();
00097 
00098     Rectangle clientAreaRect_;
00099     Theme *theme_;
00100     Label *label_;
00101     GC gc_;
00102     unsigned int titleBarHeight_;
00103     unsigned int borderWidth_;
00104     bool areButtonsVisible_;
00105 
00106     Cursor cursor_;
00107 
00108     InvertButton buttonState_;
00109 
00110     // model
00111     Window frameWindow_;
00112     bool hasDecoration_;
00113 
00114 private:
00115 
00116     // view
00117     void initGC();
00118 
00119     Monitor *monitor_;
00120     Type type_;
00121 
00122     Rectangle *prevRect_;
00123 };
00124 
00125 #endif // __THING_H

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