kivio

stencilbarbutton.h

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 #ifndef STENCILBARBUTTON_H
00020 #define STENCILBARBUTTON_H
00021 
00022 #include <qpushbutton.h>
00023 
00024 class QPixmap;
00025 namespace Kivio {
00026 
00027 class DragBarButton : public QPushButton
00028 {
00029   Q_OBJECT
00030   public:
00031     DragBarButton( const QString&, QWidget* parent, const char* name = 0 );
00032     ~DragBarButton();
00033   
00034     void setIcon( const QString& );
00035     void setPixmap( const QPixmap& );
00036   
00037     QSize sizeHint() const;
00038     
00039     Qt::Orientation orientation() const { return m_orientation; }
00040   
00041   signals:
00042     void beginDrag();
00043     void finishDrag();
00044     void closeRequired(DragBarButton *);
00045   
00046   public slots:
00047     void setOrientation(Orientation orientation);
00048   
00049   protected:
00050     void drawButton( QPainter* );
00051     void mousePressEvent( QMouseEvent* );
00052     void mouseReleaseEvent( QMouseEvent* );
00053     void mouseMoveEvent( QMouseEvent* );
00054   
00055     void enterEvent( QEvent* );
00056     void leaveEvent( QEvent* );
00057   
00058   private:
00059     QPixmap* m_pClosePix;
00060     QPixmap* m_pIcon;
00061     bool m_bPressed;
00062     bool m_bDragged;
00063     bool m_bMouseOn;
00064     bool m_bClose;
00065     QPoint m_ppoint;
00066     Qt::Orientation m_orientation;
00067 };
00068 
00069 }
00070 
00071 #endif
00072 
KDE Home | KDE Accessibility Home | Description of Access Keys