• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • libtdegames
  • highscore
kexthighscore_gui.h
1 /*
2  This file is part of the TDE games library
3  Copyright (C) 2001-02 Nicolas Hadacek (hadacek@kde.org)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KEXTHIGHSCORE_GUI_H
21 #define KEXTHIGHSCORE_GUI_H
22 
23 #include <tqcheckbox.h>
24 #include <tqlabel.h>
25 #include <tqvbox.h>
26 #include <tqtabwidget.h>
27 
28 #include <tdelistview.h>
29 #include <klineedit.h>
30 #include <kpushbutton.h>
31 #include <kdialogbase.h>
32 
33 #include "kexthighscore.h"
34 
35 
36 namespace KExtHighscore
37 {
38 
39 class ItemContainer;
40 class ItemArray;
41 class Score;
42 class AdditionalTab;
43 
44 //-----------------------------------------------------------------------------
45 class ShowItem : public TDEListViewItem
46 {
47  public:
48  ShowItem(TQListView *, bool highlight);
49 
50  protected:
51  virtual void paintCell(TQPainter *, const TQColorGroup &, int column,
52  int width, int align);
53 
54  private:
55  bool _highlight;
56 };
57 
58 class ScoresList : public TDEListView
59 {
60  TQ_OBJECT
61 
62  public:
63  ScoresList(TQWidget *parent);
64 
65  void addHeader(const ItemArray &);
66 
67  protected:
68  TQListViewItem *addLine(const ItemArray &, uint index, bool highlight);
69  virtual TQString itemText(const ItemContainer &, uint row) const = 0;
70 
71  private:
72  virtual void addLineItem(const ItemArray &, uint index,
73  TQListViewItem *item);
74 };
75 
76 //-----------------------------------------------------------------------------
77 class HighscoresList : public ScoresList
78 {
79  TQ_OBJECT
80 
81  public:
82  HighscoresList(TQWidget *parent);
83 
84  void load(const ItemArray &, int highlight);
85 
86  protected:
87  TQString itemText(const ItemContainer &, uint row) const;
88 };
89 
90 class HighscoresWidget : public TQWidget
91 {
92  TQ_OBJECT
93 
94  public:
95  HighscoresWidget(TQWidget *parent);
96 
97  void load(int rank);
98 
99  signals:
100  void tabChanged(int i);
101 
102  public slots:
103  void changeTab(int i);
104 
105  private slots:
106  void tabChanged() { emit tabChanged(_tw->currentPageIndex()); }
107 
108  private:
109  TQTabWidget *_tw;
110  HighscoresList *_scoresList, *_playersList;
111  AdditionalTab *_statsTab, *_histoTab;
112 };
113 
114 class HighscoresDialog : public KDialogBase
115 {
116  TQ_OBJECT
117 
118  public:
119  HighscoresDialog(int rank, TQWidget *parent);
120 
121  private slots:
122  void slotUser1();
123  void slotUser2();
124  void tabChanged(int i) { _tab = i; }
125  void createPage(TQWidget *);
126 
127  private:
128  int _rank, _tab;
129  TQWidget *_current;
130  TQValueVector<HighscoresWidget *> _widgets;
131 };
132 
133 //-----------------------------------------------------------------------------
134 class LastMultipleScoresList : public ScoresList
135 {
136  TQ_OBJECT
137 
138 public:
139  LastMultipleScoresList(const TQValueVector<Score> &, TQWidget *parent);
140 
141 private:
142  void addLineItem(const ItemArray &, uint index, TQListViewItem *line);
143  TQString itemText(const ItemContainer &, uint row) const;
144 
145 private:
146  const TQValueVector<Score> &_scores;
147 };
148 
149 class TotalMultipleScoresList : public ScoresList
150 {
151  TQ_OBJECT
152 
153 public:
154  TotalMultipleScoresList(const TQValueVector<Score> &, TQWidget *parent);
155 
156 private:
157  void addLineItem(const ItemArray &, uint index, TQListViewItem *line);
158  TQString itemText(const ItemContainer &, uint row) const;
159 
160 private:
161  const TQValueVector<Score> &_scores;
162 };
163 
164 //-----------------------------------------------------------------------------
165 class ConfigDialog : public KDialogBase
166 {
167  TQ_OBJECT
168 
169  public:
170  ConfigDialog(TQWidget *parent);
171 
172  bool hasBeenSaved() const { return _saved; }
173 
174  private slots:
175  void modifiedSlot();
176  void accept();
177  void slotApply() { save(); }
178  void nickNameChanged(const TQString &);
179 
180  private:
181  bool _saved;
182  TQLineEdit *_nickname, *_comment;
183 
184  void load();
185  bool save();
186 };
187 
188 //-----------------------------------------------------------------------------
189 class AskNameDialog : public KDialogBase
190 {
191  TQ_OBJECT
192 
193  public:
194  AskNameDialog(TQWidget *parent);
195 
196  TQString name() const { return _edit->text(); }
197  bool dontAskAgain() const { return _checkbox->isChecked(); }
198 
199  private slots:
200  void nameChanged();
201 
202  private:
203  TQLineEdit *_edit;
204  TQCheckBox *_checkbox;
205 };
206 
207 } // namespace
208 
209 #endif

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.1
This website is maintained by Timothy Pearson.