not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kwin / clients / laptop / laptopclient.h
blob4f1196d31803b09a4163b48a85787870acf39157
1 /********************************************************************
2 Laptop KWin Client
4 Copyright (c) 2005 Sandro Giessl <sandro@giessl.com>
5 Ported to the kde3.2 API by Luciano Montanaro <mikelima@cirulla.net>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
21 #ifndef LAPTOPCLIENT_H
22 #define LAPTOPCLIENT_H
24 #include <QBitmap>
25 #include <QPixmap>
26 #include <kcommondecoration.h>
27 #include <kdecorationfactory.h>
29 namespace Laptop {
31 class LaptopClient;
33 class LaptopButton : public KCommonDecorationButton
35 public:
36 LaptopButton(ButtonType type, LaptopClient *parent, const char *name);
37 void setBitmap(const unsigned char *bitmap);
38 virtual void reset(unsigned long changed);
40 protected:
41 void paintEvent(QPaintEvent *);
42 virtual void drawButton(QPainter *p);
43 QBitmap deco;
46 class LaptopClient : public KCommonDecoration
48 public:
49 LaptopClient( KDecorationBridge* b, KDecorationFactory* f );
50 ~LaptopClient();
52 virtual QString visibleName() const;
53 virtual QString defaultButtonsLeft() const;
54 virtual QString defaultButtonsRight() const;
55 virtual bool decorationBehaviour(DecorationBehaviour behaviour) const;
56 virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
57 virtual KCommonDecorationButton *createButton(ButtonType type);
59 virtual QRegion cornerShape(WindowCorner corner);
61 void init();
62 protected:
63 void paintEvent( QPaintEvent* );
64 void reset( unsigned long );
65 void updateActiveBuffer();
66 void captionChange();
67 private:
68 bool mustDrawHandle() const;
69 bool isTransient() const;
70 private:
71 QPixmap activeBuffer;
72 int lastBufferWidth;
73 bool bufferDirty;
76 class LaptopClientFactory : public QObject, public KDecorationFactory
78 Q_OBJECT
80 public:
81 LaptopClientFactory();
82 virtual ~LaptopClientFactory();
83 virtual KDecoration* createDecoration( KDecorationBridge* );
84 virtual bool reset( unsigned long changed );
85 virtual bool supports( Ability ability ) const;
86 virtual QList< BorderSize > borderSizes() const;
87 private:
88 void findPreferredHandleSize();
93 #endif // LAPTOPCLIENT_H