blob: 15d0bc32cdb21645c0aef9cd5c5823fc1b474912 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/***************************************************************************
skyobjectname.h - description
-------------------
begin : Wed Aug 22 2001
copyright : (C) 2001 by Thomas Kabelmann
email : kstars@30doradus.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SKYOBJECTNAME_H
#define SKYOBJECTNAME_H
#include <tqstring.h>
#include <klistbox.h>
#include <klocale.h>
/**@class SkyObjectName
*Convenience class which contains a SkyObject's name and a pointer to the SkyObject
*itself. This class is used to construct the List of named objects that may be
*located with the FindDialog.
*@short convenience class for indexing SkyObjects by name.
*@author Thomas Kabelmann
*@version 1.0
*/
class SkyObject;
class SkyObjectName {
public:
/**Constructor*/
SkyObjectName (const TQString &str = TQString(), SkyObject *obj = 0);
/**Destructor (empty)*/
~SkyObjectName() {}
/**@return the name of the SkyObject*/
TQString text() { return Text; }
/**@return translated version of the SkyObject's name*/
TQString translatedText() { return i18n( Text.local8Bit().data()); }
/**@return pointer to the SkyObject*/
SkyObject *skyObject() { return skyobject; }
/**Comparison operator, needed for sorting.
*/
bool operator < (SkyObjectName &o) { return Text < o.Text; }
/**Equivalence operator, needed for sorting.
*/
bool operator == (SkyObjectName &o) { return Text == o.Text; }
private:
SkyObject *skyobject;
TQString Text;
};
/**Class for filling list of named objects in the Find Object dialog (FindDialog).
*The class is derived from TQListBoxText, and adds a SkyObjectName* member variable,
*and a method to retrieve this variable (a pointer). This makes it very easy
*to add these items to the FindDialog's TQListBox, and to sort and filter them.
*@short Derivative of TQListBoxItem specifically for SkyObjects
*@author Thomas Kabelmann
*@version 0.9
*/
class SkyObjectNameListItem : public TQListBoxText {
public:
/**Constructor */
SkyObjectNameListItem (TQListBox *parent, SkyObjectName *name );
/**Destructor (empty)*/
~SkyObjectNameListItem() {}
/**@returns pointer to SkyObjectName associated with this SkyObjectNameListItem */
SkyObjectName * objName() { return object; }
private:
SkyObjectName *object;
};
#endif
|