1 /****************************************************************************
2 ** $Id$
3 **
4 ** Definition of some shared interal classes
5 **
6 ** Created : 010427
7 **
8 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9 **
10 ** This file is part of the kernel module of the TQt GUI Toolkit.
11 **
12 ** This file may be distributed under the terms of the Q Public License
13 ** as defined by Trolltech AS of Norway and appearing in the file
14 ** LICENSE.TQPL included in the packaging of this file.
15 **
16 ** This file may be distributed and/or modified under the terms of the
17 ** GNU General Public License version 2 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
20 **
21 ** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
22 ** licenses may use this file in accordance with the TQt Commercial License
23 ** Agreement provided with the Software.
24 **
25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27 **
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 ** information about TQt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for TQPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
32 **
PinEntryDialog(TQWidget * parent,const char * name,bool modal,bool enable_quality_bar)33 ** Contact info@trolltech.com if any conditions of this licensing are
34 ** not clear to you.
35 **
36 ** SPDX-License-Identifier: GPL-2.0 OR QPL-1.0
37 **
38 **********************************************************************/
39
40 #ifndef SECTQINTERNAL_P_H
41 #define SECTQINTERNAL_P_H
42
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the TQt API. It exists for the convenience
48 // of a number of TQt sources files. This header file may change from
49 // version to version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 //
54 #ifndef QT_H
55 #include "ntqnamespace.h"
56 #include "ntqrect.h"
57 #include "ntqptrlist.h"
58 #include "ntqcstring.h"
59 #include "ntqiodevice.h"
60 #endif // QT_H
61
62 class TQWidget;
63 class TQPainter;
64 class TQPixmap;
65
66 class Q_EXPORT SecTQSharedDoubleBuffer
67 {
68 public:
69 enum DoubleBufferFlags {
70 NoFlags = 0x00,
71 InitBG = 0x01,
72 Force = 0x02,
73 Default = InitBG | Force
74 };
75 typedef uint DBFlags;
76
77 SecTQSharedDoubleBuffer( DBFlags f = Default );
78 SecTQSharedDoubleBuffer( TQWidget* widget,
79 int x = 0, int y = 0, int w = -1, int h = -1,
80 DBFlags f = Default );
81 SecTQSharedDoubleBuffer( TQPainter* painter,
82 int x = 0, int y = 0, int w = -1, int h = -1,
83 DBFlags f = Default );
84 SecTQSharedDoubleBuffer( TQWidget *widget, const TQRect &r, DBFlags f = Default );
85 SecTQSharedDoubleBuffer( TQPainter *painter, const TQRect &r, DBFlags f = Default );
86 ~SecTQSharedDoubleBuffer();
87
88 bool begin( TQWidget* widget, int x = 0, int y = 0, int w = -1, int h = -1 );
89 bool begin( TQPainter* painter, int x = 0, int y = 0, int w = -1, int h = -1);
90 bool begin( TQWidget* widget, const TQRect &r );
91 bool begin( TQPainter* painter, const TQRect &r );
92 bool end();
93
94 TQPainter* painter() const;
95
96 bool isActive() const;
97 bool isBuffered() const;
98 void flush();
99
100 static bool isDisabled() { return !dblbufr; }
101 static void setDisabled( bool off ) { dblbufr = !off; }
paintEvent(TQPaintEvent * ev)102
103 static void cleanup();
104
105 private:
106 enum DoubleBufferState {
107 Active = 0x0100,
108 BufferActive = 0x0200,
109 ExternalPainter = 0x0400
110 };
111 typedef uint DBState;
112
hideEvent(TQHideEvent * ev)113 TQPixmap *getPixmap();
114 void releasePixmap();
115
116 TQWidget *wid;
117 int rx, ry, rw, rh;
118 DBFlags flags;
119 DBState state;
keyPressEvent(TQKeyEvent * e)120
121 TQPainter *p, *external_p;
122 TQPixmap *pix;
123
124 static bool dblbufr;
125 };
126
127 inline bool SecTQSharedDoubleBuffer::begin( TQWidget* widget, const TQRect &r )
128 { return begin( widget, r.x(), r.y(), r.width(), r.height() ); }
129
updateQuality(const SecTQString & txt)130 inline bool SecTQSharedDoubleBuffer::begin( TQPainter *painter, const TQRect &r )
131 { return begin( painter, r.x(), r.y(), r.width(), r.height() ); }
132
133 inline TQPainter* SecTQSharedDoubleBuffer::painter() const
134 { return p; }
135
136 inline bool SecTQSharedDoubleBuffer::isActive() const
137 { return ( state & Active ); }
138
139 inline bool SecTQSharedDoubleBuffer::isBuffered() const
140 { return ( state & BufferActive ); }
141
142 #endif // SECTQINTERNAL_P_H
143