1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
24 #include "YComboBox.h"
26 class YQWidgetCaption;
28 class QY2CharValidator;
31 class YQComboBox : public QFrame, public YComboBox
39 YQComboBox( YWidget * parent, const string & label, bool editable );
47 * Add one item. This widget assumes ownership of the item object and will
48 * delete it in its destructor.
50 * Reimplemented from YComboBox.
52 virtual void addItem( YItem * item );
57 * Reimplemented from YSelectionWidget.
59 virtual void deleteAllItems();
62 * Change the label text.
64 * Reimplemented from YSelectionWidget.
66 virtual void setLabel( const string & label );
69 * Change the valid input characters.
71 * Reimplemented from YComboBox.
73 virtual void setValidChars( const string & validChars );
76 * Specify the amount of characters which can be inserted.
78 * Reimplemented from YComboBox.
80 virtual void setInputMaxLength( int numberOfChars );
83 * Returns 'true' if the given text is valid according to the current
84 * setting of ValidChars.
86 bool isValidText( const QString & txt ) const;
89 * Set enabled / disabled state.
91 * Reimplemented from YWidget.
93 virtual void setEnabled( bool enabled );
96 * Preferred width of the widget.
98 * Reimplemented from YWidget.
100 virtual int preferredWidth();
103 * Preferred height of the widget.
105 * Reimplemented from YWidget.
107 virtual int preferredHeight();
110 * Set the new size of the widget.
112 * Reimplemented from YWidget.
114 virtual void setSize( int newWidth, int newHeight );
117 * Accept the keyboard focus.
119 virtual bool setKeyboardFocus();
125 * Tells the ui that an item has been selected. This is only
126 * interesting if the `notify option is set.
128 void slotSelected( int i );
131 * Tells the ui that the user has edited the text ( if the
132 * 'editable' option is set ).
133 * This is only interesting if the `notify option is set.
135 void textChanged( const QString &new_text );
141 * Return this ComboBox's current value as text.
143 * Called internally from value(), selectedItem() and related.
145 * Implemented from YComboBox.
147 virtual string text();
151 * Set this ComboBox's current value as text.
153 * Called internally whenever the content is to change
154 * programmatically. Don't call setValue() or selectItem() from here.
156 * Implemented from YComboBox.
158 virtual void setText( const string & newText );
165 YQWidgetCaption * _caption;
166 QComboBox * _qt_comboBox;
167 QY2CharValidator * _validator;