moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / skyobjectname.h
blobf7eb95d6c6ef3365c30e766bf59436b8577e3d3f
1 /***************************************************************************
2 skyobjectname.h - description
3 -------------------
4 begin : Wed Aug 22 2001
5 copyright : (C) 2001 by Thomas Kabelmann
6 email : kstars@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 ***************************************************************************/
18 #ifndef SKYOBJECTNAME_H
19 #define SKYOBJECTNAME_H
21 #include <qstring.h>
22 #include <klistbox.h>
23 #include <klocale.h>
25 /**@class SkyObjectName
26 *Convenience class which contains a SkyObject's name and a pointer to the SkyObject
27 *itself. This class is used to construct the List of named objects that may be
28 *located with the FindDialog.
29 *@short convenience class for indexing SkyObjects by name.
30 *@author Thomas Kabelmann
31 *@version 1.0
34 class SkyObject;
36 class SkyObjectName {
38 public:
39 /**Constructor*/
40 SkyObjectName (const QString &str = QString::null, SkyObject *obj = 0);
42 /**Destructor (empty)*/
43 ~SkyObjectName() {}
45 /**@return the name of the SkyObject*/
46 QString text() { return Text; }
48 /**@return translated version of the SkyObject's name*/
49 QString translatedText() { return i18n( Text.local8Bit().data()); }
51 /**@return pointer to the SkyObject*/
52 SkyObject *skyObject() { return skyobject; }
54 /**Comparison operator, needed for sorting.
56 bool operator < (SkyObjectName &o) { return Text < o.Text; }
58 /**Equivalence operator, needed for sorting.
60 bool operator == (SkyObjectName &o) { return Text == o.Text; }
62 private:
64 SkyObject *skyobject;
65 QString Text;
69 /**Class for filling list of named objects in the Find Object dialog (FindDialog).
70 *The class is derived from QListBoxText, and adds a SkyObjectName* member variable,
71 *and a method to retrieve this variable (a pointer). This makes it very easy
72 *to add these items to the FindDialog's QListBox, and to sort and filter them.
73 *@short Derivative of QListBoxItem specifically for SkyObjects
74 *@author Thomas Kabelmann
75 *@version 0.9
78 class SkyObjectNameListItem : public QListBoxText {
80 public:
81 /**Constructor */
82 SkyObjectNameListItem (QListBox *parent, SkyObjectName *name );
84 /**Destructor (empty)*/
85 ~SkyObjectNameListItem() {}
87 /**@returns pointer to SkyObjectName associated with this SkyObjectNameListItem */
88 SkyObjectName * objName() { return object; }
90 private:
91 SkyObjectName *object;
94 #endif