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.
tdegames/kolf/kcomboboxdialog.h

116 lines
4.5 KiB

// Copyright (C) 2002 Jason Katz-Brown <jason@katzbrown.com>
// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Except as contained in this notice, the name(s) of the author(s) shall not be
// used in advertising or otherwise to promote the sale, use or other dealings
// in this Software without prior written authorization from the author(s).
#ifndef KCOMBOBOX_DIALOG_H
#define KCOMBOBOX_DIALOG_H
#include <tqstringlist.h>
#include <kdialogbase.h>
#include <kglobal.h>
class TQCheckBox;
class KHistoryCombo;
/**
* Dialog for user to choose an item from a TQStringList.
*/
class KComboBoxDialog : public KDialogBase
{
Q_OBJECT
TQ_OBJECT
public:
/**
* Create a dialog that asks for a single line of text. _value is
* the initial value of the line. _text appears as the current text
* of the combobox.
*
* @param _items Items in the combobox
* @param _text Text of the label
* @param _value Initial value of the combobox
*/
KComboBoxDialog( const TQString &_text, const TQStringList& _items, const TQString& _value = TQString(), bool showDontAskAgain = false, TQWidget *tqparent = 0 );
virtual ~KComboBoxDialog();
/**
* @return the value the user chose
*/
TQString text() const;
/**
* @return the line edit widget
*/
KHistoryCombo *comboBox() const { return combo; }
/**
* Static convenience function to get input from the user.
*
* @param _text Text of the label
* @param _items Items in the combobox
* @param _value Initial value of the inputline
* @param dontAskAgainName Name for saving whether the user doesn't want to be asked again; use TQString() to disable
*/
static TQString getItem( const TQString &_text, const TQStringList &_items, const TQString& _value = TQString(), const TQString &dontAskAgainName = TQString(), TQWidget *tqparent = 0 );
/**
* Static convenience function to get input from the user.
* This method includes a caption.
*
* @param _caption Caption of the dialog
* @param _text Text of the label
* @param _items Items in the combobox
* @param _value Initial value of the inputline
* @param dontAskAgainName Name for saving whether the user doesn't want to be asked again; use TQString() to disable
*/
static TQString getItem( const TQString &_text, const TQString &_caption, const TQStringList &_items, const TQString& _value = TQString(), const TQString &dontAskAgainName = TQString(), TQWidget *tqparent = 0 );
/**
* Static convenience method.
* This method is meant as a replacement for KLineEditDlg::getText() for cases
* when a history and autocompletion are desired.
*
* @param _caption Caption of the dialog
* @param _text Text of the label
* @param _value Initial value of the inputline
* @param ok Variable to store whether the user hit OK
* @param tqparent Parent widget for the dialog
* @param configName Name of the dialog for saving the completion and history
* @parma config KConfig for saving the completion and history
*/
static TQString getText(const TQString &_caption, const TQString &_text,
const TQString &_value = TQString(),
bool *ok = 0, TQWidget *tqparent = 0,
const TQString &configName = TQString(),
KConfig *config = KGlobal::config());
protected:
KHistoryCombo *combo;
TQCheckBox *dontAskAgainCheckBox;
bool dontAskAgainChecked();
};
#endif