summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/qcolordialog.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libqtaux/qcolordialog.cpp b/libqtaux/qcolordialog.cpp
index 907c2aa..ccef0ad 100644
--- a/libqtaux/qcolordialog.cpp
+++ b/libqtaux/qcolordialog.cpp
@@ -1,246 +1,250 @@
/****************************************************************************
** $Id$
**
** Implementation of QColorDialog class
**
** Created : 990222
**
** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
**
** This file is part of the dialogs module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "qcolordialog.h"
#include "qpainter.h"
#include "qlayout.h"
#include "qlabel.h"
#include "qpushbutton.h"
#include "qlineedit.h"
#include "qimage.h"
#include "qpixmap.h"
#include "qdrawutil.h"
#include "qvalidator.h"
#include "qapplication.h"
//////////// QWellArray BEGIN
#include "qobjectdict.h"
+#ifndef QT_NO_DRAGANDDROP
+#include "qdragobject.h"
+#endif
+
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of qwellarray.cpp and qcolordialog.cpp.
// This header file may change from version to version without notice,
// or even be removed.
//
//
#include "qtableview.h"
struct QWellArrayData;
class QWellArray : public QTableView
{
Q_OBJECT
Q_PROPERTY( int numCols READ numCols )
Q_PROPERTY( int numRows READ numRows )
Q_PROPERTY( int selectedColumn READ selectedColumn )
Q_PROPERTY( int selectedRow READ selectedRow )
public:
QWellArray( QWidget *parent=0, const char *name=0, bool popup = FALSE );
~QWellArray() {}
QString cellContent( int row, int col ) const;
// ### Paul !!! virtual void setCellContent( int row, int col, const QString &);
// ##### Obsolete since not const
int numCols() { return nCols; }
int numRows() { return nRows; }
int numCols() const { return nCols; }
int numRows() const { return nRows; }
// ##### Obsolete since not const
int selectedColumn() { return selCol; }
int selectedRow() { return selRow; }
int selectedColumn() const { return selCol; }
int selectedRow() const { return selRow; }
virtual void setSelected( int row, int col );
void setCellSize( int w, int h ) { setCellWidth(w);setCellHeight( h ); }
QSize sizeHint() const;
virtual void setDimension( int rows, int cols );
virtual void setCellBrush( int row, int col, const QBrush & );
QBrush cellBrush( int row, int col );
signals:
void selected( int row, int col );
protected:
virtual void setCurrent( int row, int col );
virtual void drawContents( QPainter *, int row, int col, const QRect& );
void drawContents( QPainter * );
void paintCell( QPainter*, int row, int col );
void mousePressEvent( QMouseEvent* );
void mouseReleaseEvent( QMouseEvent* );
void mouseMoveEvent( QMouseEvent* );
void keyPressEvent( QKeyEvent* );
void focusInEvent( QFocusEvent* );
void focusOutEvent( QFocusEvent* );
private:
int curRow;
int curCol;
int selRow;
int selCol;
int nCols;
int nRows;
bool smallStyle;
QWellArrayData *d;
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
QWellArray( const QWellArray & );
QWellArray& operator=( const QWellArray & );
#endif
};
// non-interface ...
struct QWellArrayData {
QBrush *brush;
};
// NOT REVISED
/* WARNING, NOT
\class QWellArray qwellarray_p.h
\brief ....
....
\ingroup advanced
*/
QWellArray::QWellArray( QWidget *parent, const char * name, bool popup )
: QTableView( parent, name,
popup ? (WStyle_Customize|WStyle_Tool|WStyle_NoBorder) : 0 )
{
d = 0;
setFocusPolicy( StrongFocus );
setBackgroundMode( PaletteButton );
nCols = 7;
nRows = 7;
int w = 24; // cell width
int h = 21; // cell height
smallStyle = popup;
if ( popup ) {
w = h = 18;
if ( style() == WindowsStyle )
setFrameStyle( QFrame::WinPanel | QFrame::Raised );
else
setFrameStyle( QFrame::Panel | QFrame::Raised );
setMargin( 1 );
setLineWidth( 2 );
}
setNumCols( nCols );
setNumRows( nRows );
setCellWidth( w );
setCellHeight( h );
curCol = 0;
curRow = 0;
selCol = -1;
selRow = -1;
if ( smallStyle )
setMouseTracking( TRUE );
setOffset( 5 , 10 );
resize( sizeHint() );
}
QSize QWellArray::sizeHint() const
{
constPolish();
int f = frameWidth() * 2;
int w = nCols * cellWidth() + f;
int h = nRows * cellHeight() + f;
return QSize( w, h );
}
void QWellArray::paintCell( QPainter* p, int row, int col )
{
int w = cellWidth( col ); // width of cell in pixels
int h = cellHeight( row ); // height of cell in pixels
int b = 1;
if ( !smallStyle )
b = 3;
const QColorGroup & g = colorGroup();
p->setPen( QPen( black, 0, SolidLine ) );
if ( !smallStyle && row ==selRow && col == selCol &&
style() != MotifStyle ) {
int n = 2;
p->drawRect( n, n, w-2*n, h-2*n );
}
if ( style() == WindowsStyle ) {
qDrawWinPanel( p, b, b , w - 2*b, h - 2*b,
g, TRUE );
b += 2;
} else {
if ( smallStyle ) {
qDrawShadePanel( p, b, b , w - 2*b, h - 2*b,
g, TRUE, 2 );
b += 2;
} else {
int t = ( row == selRow && col == selCol ) ? 2 : 0;
b -= t;
qDrawShadePanel( p, b, b , w - 2*b, h - 2*b,
g, TRUE, 2 );