moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / finddialog.h
blobdc18441c66d0250a0061fd52ed3bf674d46e5094
1 /***************************************************************************
2 finddialog.h - K Desktop Planetarium
3 -------------------
4 begin : Wed Jul 4 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
21 #ifndef FINDDIALOG_H
22 #define FINDDIALOG_H
24 #include <kdialogbase.h>
26 class QVBoxLayout;
27 class QHBoxLayout;
28 class QGridLayout;
29 class QLabel;
30 class QLineEdit;
31 class QComboBox;
32 class QListBox;
33 class QListBoxItem;
34 //class QStringList;
35 class SkyObjectNameListItem;
37 /**@class FindDialog
38 *Dialog window for finding SkyObjects by name. The dialog contains
39 *a QListBox showing the list of named objects, a QLineEdit for filtering
40 *the list by name, and a QCombobox for filtering the list by object type.
42 *@short Find Object Dialog
43 *@author Jason Harris
44 *@version 1.0
47 class FindDialog : public KDialogBase {
48 Q_OBJECT
50 public:
51 /**Constructor. Creates all widgets and packs them in QLayouts. Connects
52 *Signals and Slots. Runs initObjectList().
54 FindDialog( QWidget* parent = 0 );
56 /**Destructor
58 ~FindDialog();
60 /**@return the currently-selected item from the listbox of named objects
62 SkyObjectNameListItem * currentItem() const { return currentitem; }
64 public slots:
65 /**When Text is entered in the QLineEdit, filter the List of objects
66 *so that only objects which start with the filter text are shown.
68 void filter();
70 /**When the selection of the object type QComboBox is changed, filter
71 *the List of objects so that only objects of the selected Type are shown.
73 void filterByType();
75 /**Overloading the Standard KDialogBase slotOk() to show a "sorry" message
76 *box if no object is selected when the user presses Ok. The window is
77 *not closed in this case.
79 void slotOk();
81 private slots:
82 /**Init object list after opening dialog.
84 void init();
86 /**Set the selected item in the list to the item specified.
88 void updateSelection (QListBoxItem *);
90 /**Change current filter options.
92 void setFilter( int f );
94 protected:
95 /**Process Keystrokes. The Up and Down arrow keys are used to select the
96 *Previous/Next item in the listbox of named objects.
97 *@param e The QKeyEvent pointer
99 void keyPressEvent( QKeyEvent *e );
101 private:
103 *Automatically select the first item in the list
105 void setListItemEnabled();
107 QVBoxLayout *vlay;
108 QHBoxLayout *hlay;
109 QListBox *SearchList;
110 QLineEdit *SearchBox;
111 QLabel *filterTypeLabel;
112 QComboBox *filterType;
114 SkyObjectNameListItem *currentitem;
116 int Filter;
119 #endif