summaryrefslogtreecommitdiffstats
path: root/src/MachBunt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/MachBunt.h')
-rw-r--r--src/MachBunt.h173
1 files changed, 173 insertions, 0 deletions
diff --git a/src/MachBunt.h b/src/MachBunt.h
new file mode 100644
index 0000000..fa60f54
--- /dev/null
+++ b/src/MachBunt.h
@@ -0,0 +1,173 @@
+/*
+ * $Id: MachBunt.h,v 1.23 2004/03/23 15:34:45 llunak Exp $
+ *
+ */
+
+#ifndef __KDE_SuSE_H
+#define __KDE_SuSE_H
+
+#include <qvariant.h>
+#include <qlayout.h>
+#include <qbutton.h>
+#include <qbitmap.h>
+#include <qimage.h>
+#include <kpixmap.h>
+#include <kdecoration.h>
+#include <kdecorationfactory.h>
+class QLabel;
+class QSpacerItem;
+class QHBoxLayout;
+
+#define USE_BUT 1
+#define PIX_HEIGHT 24
+#define PIX_SIDE 8
+#define PIX_CORNER_RADIUS 7
+#define TOP_RESIZE_HEIGHT 6
+#define BUTTON_RESIZE_SIZE 5
+#define BORDER_LEFT 2
+#define BORDER_RIGHT 2
+#define BORDER_BOTTOM 6
+#define TEXT_BORDER 3
+
+namespace SuSEMachBunt
+{
+
+enum Buttons{ BtnMenu=0, BtnSticky, BtnHelp, BtnIconify, BtnMax,
+ BtnClose, BtnCount };
+
+enum ButtonPos { ButtonLeft, ButtonMiddle, ButtonRight };
+
+// [button number][inactive/active][std/mouseOver/buttonPressed][miniIcon]
+extern KPixmap buttonPixmap[BtnCount][2][3][2];
+extern bool titlebarResize, titlebarPlain, titlebarLogo, titlebarSidebar, titlebarNoPlainButtons;
+extern double titlebarLenseButtonFlare;
+
+KPixmap create_buttonPixmap( int x, int y, QPixmap pix, QPixmap bg, int active, int mouse );
+
+class MachBunt;
+
+class MachBuntButton : public QButton
+{
+ Q_OBJECT
+
+ public:
+ MachBuntButton(MachBunt *client, const char *name,
+ int button, QPixmap bgI, QPixmap bgA, bool isMini=false,
+ const QString& tip=NULL);
+ virtual ~MachBuntButton();
+ virtual void reset( unsigned long changed );
+ void setBitmap(const unsigned char *bitmap);
+ void setPixmap(const QPixmap &p);
+ void setTipText(const QString &tip);
+ void setPosition(ButtonPos pos);
+
+ virtual QSize sizeHint() const;
+ int last_button;
+ KPixmap menuButtonPixmap[BtnCount][2][3][2];
+
+ signals:
+ void shapeMe(int);
+ void mousePressedMove(QMouseEvent*);
+
+ protected:
+ void mousePressEvent(QMouseEvent* e);
+ void mouseReleaseEvent(QMouseEvent* e);
+ virtual void drawButton(QPainter *p);
+ void drawButtonLabel(QPainter *){;}
+ void enterEvent(QEvent *);
+ void leaveEvent(QEvent *);
+ void mouseMoveEvent( QMouseEvent *e );
+
+ bool resizePosition( QPoint pos );
+
+ QBitmap deco;
+ QPixmap pix;
+ QPixmap menuPixmap;
+ QPixmap bg[2];
+ bool menuBtn;
+ bool miniBtn;
+ bool pressed;
+ int button;
+ int state;
+ ButtonPos position;
+
+ private:
+ KDecoration *client;
+};
+
+class MachBunt : public KDecoration
+{
+ Q_OBJECT
+
+ public:
+ MachBunt(KDecorationBridge* bridge, KDecorationFactory* factory);
+ virtual ~MachBunt();
+ virtual void init();
+ virtual void resize(const QSize&);
+ virtual bool eventFilter( QObject* o, QEvent* e );
+
+ protected:
+ virtual void reset( unsigned long changed );
+ virtual void resizeEvent( QResizeEvent* );
+ virtual void paintEvent( QPaintEvent* );
+ virtual void showEvent( QShowEvent* );
+ virtual void mouseDoubleClickEvent( QMouseEvent * );
+ virtual Position mousePosition( const QPoint& ) const;
+ virtual void captionChange();
+ virtual void desktopChange();
+ virtual void shadeChange() {};
+ virtual void maximizeChange();
+ virtual void activeChange();
+ virtual void iconChange();
+ virtual void calcHiddenButtons();
+ virtual void borders(int&, int&, int&, int&) const;
+ virtual QSize minimumSize() const;
+ virtual int mapButton( const QChar &c );
+ virtual void doLayout();
+ virtual void createButtons();
+
+ signals:
+ void oadChange(bool);
+ void maxChange(bool);
+
+ protected slots:
+ void buttonPressed();
+ void buttonReleased();
+ void slotMaximize();
+ void menuButtonPressed();
+ void doShape(int x=0);
+ void mouseMoveOnButtonPressed(QMouseEvent*);
+
+ private:
+ bool isTool();
+
+ MachBuntButton* button[ BtnCount ];
+ QPoint buttonPressedPosition;
+ int lastButtonWidth;
+ int titleHeight;
+ QSpacerItem* titlebar;
+ bool hiddenItems;
+ QVBoxLayout* windowLayout;
+ QBoxLayout* topLayout;
+ bool smallButtons;
+ bool mouseOverButton;
+};
+
+
+class BuntFactory : public QObject, public KDecorationFactory
+{
+ Q_OBJECT
+
+ public:
+
+ BuntFactory() {};
+ virtual ~BuntFactory() {};
+ virtual KDecoration* createDecoration( KDecorationBridge* );
+ virtual bool reset( unsigned long changed );
+ virtual QValueList< BorderSize > borderSizes() const;
+};
+
+};
+
+#endif
+// vim: ts=4