1 /************************************************************************
3 * Copyright 2010 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
25 #include "../QcHelper.h"
26 #include "../layouts/classic_layouts.hpp"
29 #include <QListWidget>
31 #include <QPushButton>
36 class QcDefaultWidget
: public QWidget
40 QcDefaultWidget() { setLayout( new QcDefaultLayout() ); }
41 Q_INVOKABLE
void addChild( QWidget
* w
) { layout()->addWidget(w
); }
44 class QcHLayoutWidget
: public QWidget
48 QcHLayoutWidget() { setLayout( new QcHLayout() ); }
49 Q_INVOKABLE
void addChild( QWidget
* w
) { layout()->addWidget(w
); }
52 class QcVLayoutWidget
: public QWidget
56 QcVLayoutWidget() { setLayout( new QcVLayout() ); }
57 Q_INVOKABLE
void addChild( QWidget
* w
) { layout()->addWidget(w
); }
61 class QcListWidget
: public QListWidget
, public QcHelper
64 Q_PROPERTY( VariantList items READ dummyVariantList WRITE setItems
);
65 Q_PROPERTY( VariantList colors READ dummyVariantList WRITE setColors
);
66 Q_PROPERTY( int currentRow READ currentRow WRITE setCurrentRowWithoutAction
)
70 void setItems( const VariantList
& );
71 void setColors( const VariantList
& ) const;
72 void setCurrentRowWithoutAction( int );
77 void onCurrentItemChanged();
79 void keyPressEvent( QKeyEvent
* );
84 class QcPopUpMenu
: public QComboBox
, public QcHelper
87 Q_PROPERTY( VariantList items READ dummyVariantList WRITE setItems
);
88 Q_PROPERTY( bool signalReactivation READ signalReactivation WRITE setSignalReactivation
)
92 bool signalReactivation() const { return _reactivation
; }
93 void setSignalReactivation( bool b
) { _reactivation
= b
; }
99 void setItems( const VariantList
& );
104 class QcTextField
: public QLineEdit
110 connect( this, SIGNAL(returnPressed()), this, SIGNAL(action()) );
116 class QcButton
: public QPushButton
, public QcHelper
119 Q_PROPERTY( VariantList states READ dummyVariantList WRITE setStates
);
120 Q_PROPERTY( int value READ getValue WRITE setValue
);
127 bool hitButton( const QPoint
& ) const;
137 void setStates( const VariantList
& );
138 void setValue( int val
) { setState( val
); }
139 int getValue() const { return currentState
; }
140 void setState( int );
144 QPalette defaultPalette
;
147 class QcCustomPainted
: public QcCanvas
, QcHelper
152 setLayout( new QcDefaultLayout() );
154 Q_INVOKABLE
void addChild( QWidget
* w
) { layout()->addWidget(w
); }
156 // reimplement event handlers just so events don't propagate
157 void mousePressEvent( QMouseEvent
* ) {}
158 void mouseReleaseEvent( QMouseEvent
* ) {}
159 void mouseMoveEvent( QMouseEvent
* ) {}
162 class QcCheckBox
: public QCheckBox
165 Q_PROPERTY( bool value READ value WRITE setValue
);
169 connect( this, SIGNAL(clicked()), this, SIGNAL(action()) );
174 bool value() { return isChecked(); }
175 void setValue( bool val
) { setChecked(val
); }