~ubuntu-branches/debian/lenny/italc/lenny

« back to all changes in this revision

Viewing changes to ima/src/tool_button.h

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Winnertz
  • Date: 2008-06-17 13:46:54 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080617134654-cl0gi4u524cv1ici
Tags: 1:1.0.9~rc3-1
* Package new upstream version
  - upstream ported the code to qt4.4 (Closes: #481974)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * tool_button.h - declaration of class toolButton 
 
3
 *
 
4
 * Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
5
 * 
 
6
 * This file is part of iTALC - http://italc.sourceforge.net
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public
 
19
 * License along with this program (see COPYING); if not, write to the
 
20
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
21
 * Boston, MA 02111-1307, USA.
 
22
 *
 
23
 */
 
24
 
 
25
 
 
26
#ifndef _TOOL_BUTTON_H
 
27
#define _TOOL_BUTTON_H 
 
28
 
 
29
#include <QtGui/QToolButton>
 
30
 
 
31
#include "fast_qimage.h"
 
32
 
 
33
 
 
34
class QToolBar;
 
35
 
 
36
 
 
37
class toolButton : public QToolButton
 
38
{
 
39
        Q_OBJECT
 
40
public:
 
41
        toolButton( const QPixmap & _pixmap, const QString & _label,
 
42
                                const QString & _alt_label,
 
43
                                const QString & _title, 
 
44
                                const QString & _desc, QObject * _receiver, 
 
45
                                const char * _slot, QWidget * _parent );
 
46
        toolButton( QAction * _a, const QString & _label,
 
47
                                const QString & _alt_label,
 
48
                                const QString & _desc, QObject * _receiver, 
 
49
                                const char * _slot, QWidget * _parent );
 
50
        virtual ~toolButton();
 
51
 
 
52
 
 
53
        static void setIconOnlyMode( bool _enabled );
 
54
 
 
55
        static bool iconOnlyMode( void )
 
56
        {
 
57
                return( s_iconOnlyMode );
 
58
        }
 
59
 
 
60
        static void setToolTipsDisabled( bool _disabled )
 
61
        {
 
62
                s_toolTipsDisabled = _disabled;
 
63
        }
 
64
 
 
65
        static bool toolTipsDisabled( void )
 
66
        {
 
67
                return( s_toolTipsDisabled );
 
68
        }
 
69
 
 
70
        void addTo( QToolBar * );
 
71
 
 
72
 
 
73
protected:
 
74
        virtual void enterEvent( QEvent * _e );
 
75
        virtual void leaveEvent( QEvent * _e );
 
76
        virtual void mousePressEvent( QMouseEvent * _me );
 
77
        virtual void paintEvent( QPaintEvent * _pe );
 
78
 
 
79
 
 
80
signals:
 
81
        void mouseLeftButton( void );
 
82
 
 
83
 
 
84
private slots:
 
85
        bool checkForLeaveEvent( void );
 
86
        void updateColorLevel( void );
 
87
 
 
88
 
 
89
private:
 
90
        void updateSize( void );
 
91
 
 
92
 
 
93
        static bool s_toolTipsDisabled;
 
94
        static bool s_iconOnlyMode;
 
95
 
 
96
        QPixmap m_pixmap;
 
97
        fastQImage m_img;
 
98
        unsigned char m_colorizeLevel;
 
99
        bool m_fadeBack;
 
100
 
 
101
        QString m_label;
 
102
        QString m_altLabel;
 
103
        QString m_title;
 
104
        QString m_descr;
 
105
 
 
106
} ;
 
107
 
 
108
 
 
109
 
 
110
 
 
111
class toolButtonTip : public QWidget
 
112
{
 
113
        Q_OBJECT
 
114
public:
 
115
        toolButtonTip( const QPixmap & _pixmap, const QString & _title,
 
116
                                const QString & _description,
 
117
                                QWidget * _parent, QWidget * _tool_btn = 0 );
 
118
 
 
119
        virtual QSize sizeHint( void ) const;
 
120
 
 
121
 
 
122
protected:
 
123
        virtual void paintEvent( QPaintEvent * _pe );
 
124
        virtual void resizeEvent( QResizeEvent * _re );
 
125
 
 
126
 
 
127
private slots:
 
128
        void updateMask( void );
 
129
 
 
130
 
 
131
private:
 
132
        QImage m_icon;
 
133
        QString m_title;
 
134
        QString m_description;
 
135
 
 
136
        QImage m_bg;
 
137
        int m_dissolveSize;
 
138
 
 
139
        QWidget * m_toolButton;
 
140
 
 
141
} ;
 
142
 
 
143
 
 
144
 
 
145
#endif
 
146