1 /***************************************************************************
2 skyobjectname.h - description
4 begin : Wed Aug 22 2001
5 copyright : (C) 2001 by Thomas Kabelmann
6 email : kstars@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
18 #ifndef SKYOBJECTNAME_H
19 #define SKYOBJECTNAME_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
40 SkyObjectName (const QString
&str
= QString::null
, SkyObject
*obj
= 0);
42 /**Destructor (empty)*/
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
; }
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
78 class SkyObjectNameListItem
: public QListBoxText
{
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
; }
91 SkyObjectName
*object
;