You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdevelop/lib/widgets/qcomboview.h

172 lines
5.0 KiB

/**********************************************************************
**
**
** Definition of QComboView class
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
** Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
**
** 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.
**
**********************************************************************/
#ifndef TQCOMBOVIEW_H
#define TQCOMBOVIEW_H
#include "tqwidget.h"
#ifndef TQT_NO_COMBOBOX
/**
@file qcomboview.h
QComboView class.
*/
class TQStrList;
class TQStringList;
class TQLineEdit;
class TQValidator;
class TQListView;
class TQListViewItem;
class QComboViewData;
/**
QComboView - a combo with a TQListView as a popup widget.
This means that you can have a treeview inside of a combo. Otherwise it works
in the same way as TQComboBox and have similar API.
*/
class TQ_EXPORT QComboView : public TQWidget
{
TQ_OBJECT
TQ_ENUMS( Policy )
TQ_PROPERTY( bool editable READ editable WRITE setEditable )
// TQ_PROPERTY( int count READ count )
TQ_PROPERTY( TQString currentText READ currentText WRITE setCurrentText DESIGNABLE false )
// TQ_PROPERTY( TQListView *currentItem READ currentItem WRITE setCurrentItem )
TQ_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false )
TQ_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit )
// TQ_PROPERTY( int maxCount READ maxCount WRITE setMaxCount )
TQ_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy )
TQ_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
TQ_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled )
TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true )
public:
// QComboView( TQWidget* parent=0, const char* name=0 );
QComboView( bool rw, TQWidget* parent=0, const char* name=0 );
~QComboView();
int childCount() const;
TQListViewItem *currentItem() const;
virtual void setCurrentItem( TQListViewItem * );
virtual void setCurrentActiveItem( TQListViewItem * );
bool autoResize() const;
virtual void setAutoResize( bool );
TQSize sizeHint() const;
void setPalette( const TQPalette & );
void setFont( const TQFont & );
void setEnabled( bool );
virtual void setSizeLimit( int );
int sizeLimit() const;
/* virtual void setMaxCount( int );
int maxCount() const;*/
enum Policy { NoInsertion, AtTop, AtCurrent, AtBottom,
AfterCurrent, BeforeCurrent };
virtual void setInsertionPolicy( Policy policy );
Policy insertionPolicy() const;
virtual void setValidator( const TQValidator * );
const TQValidator * validator() const;
virtual void setListView( TQListView * );
TQListView * listView() const;
virtual void setLineEdit( TQLineEdit *edit );
TQLineEdit* lineEdit() const;
virtual void setAutoCompletion( bool );
bool autoCompletion() const;
bool eventFilter( TQObject *object, TQEvent *event );
void setDuplicatesEnabled( bool enable );
bool duplicatesEnabled() const;
bool editable() const;
void setEditable( bool );
virtual void popup();
TQString currentText() const;
void setCurrentText( const TQString& );
public slots:
virtual void clear();
void clearValidator();
void clearEdit();
virtual void setEditText( const TQString &);
signals:
void activated( TQListViewItem * item );
void highlighted( TQListViewItem * item );
void activated( const TQString &);
void highlighted( const TQString &);
void textChanged( const TQString &);
void focusGranted();
void focusLost();
private slots:
void internalActivate( TQListViewItem * );
void internalHighlight( TQListViewItem * );
void internalClickTimeout();
void returnPressed();
void checkState(TQListViewItem*);
protected:
void paintEvent( TQPaintEvent * );
void resizeEvent( TQResizeEvent * );
void mousePressEvent( TQMouseEvent * );
void mouseMoveEvent( TQMouseEvent * );
void mouseReleaseEvent( TQMouseEvent * );
void mouseDoubleClickEvent( TQMouseEvent * );
void keyPressEvent( TQKeyEvent *e );
void focusInEvent( TQFocusEvent *e );
void focusOutEvent( TQFocusEvent *e );
void wheelEvent( TQWheelEvent *e );
void styleChange( TQStyle& );
void updateMask();
private:
virtual void setUpListView();
void setUpLineEdit();
void popDownListView();
void reIndex();
void currentChanged();
TQListViewItem *completionIndex( const TQString &, TQListViewItem * ) const;
QComboViewData *d;
private: // Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY)
QComboView( const QComboView & );
QComboView &operator=( const QComboView & );
#endif
};
#endif // TQT_NO_COMBOBOX
#endif // TQCOMBOVIEW_H