stencilbarbutton.h
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19#ifndef STENCILBARBUTTON_H
20#define STENCILBARBUTTON_H
21
22#include <tqpushbutton.h>
23
24class TQPixmap;
25namespace Kivio {
26
27class DragBarButton : public TQPushButton
28{
29 TQ_OBJECT
30
31 public:
32 DragBarButton( const TQString&, TQWidget* parent, const char* name = 0 );
33 ~DragBarButton();
34
35 void setIcon( const TQString& );
36 void setPixmap( const TQPixmap& );
37
38 TQSize sizeHint() const;
39
40 TQt::Orientation orientation() const { return m_orientation; }
41
42 signals:
43 void beginDrag();
44 void finishDrag();
45 void closeRequired(DragBarButton *);
46
47 public slots:
48 void setOrientation(TQt::Orientation orientation);
49
50 protected:
51 void drawButton( TQPainter* );
52 void mousePressEvent( TQMouseEvent* );
53 void mouseReleaseEvent( TQMouseEvent* );
54 void mouseMoveEvent( TQMouseEvent* );
55
56 void enterEvent( TQEvent* );
57 void leaveEvent( TQEvent* );
58
59 private:
60 TQPixmap* m_pClosePix;
61 TQPixmap* m_pIcon;
62 bool m_bPressed;
63 bool m_bDragged;
64 bool m_bMouseOn;
65 bool m_bClose;
66 TQPoint m_ppoint;
67 TQt::Orientation m_orientation;
68};
69
70}
71
72#endif
73