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

libtdegames

  • libtdegames
  • highscore
kexthighscore_tab.h
1 /*
2  This file is part of the TDE games library
3  Copyright (C) 2002 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_TAB_H
21 #define KEXTHIGHSCORE_TAB_H
22 
23 #include <tqcombobox.h>
24 #include <tqmemarray.h>
25 
26 class TQLabel;
27 class TDEListView;
28 
29 
30 namespace KExtHighscore
31 {
32 
33 //-----------------------------------------------------------------------------
34 class PlayersCombo : public TQComboBox
35 {
36  TQ_OBJECT
37 
38  public:
39  PlayersCombo(TQWidget *parent = 0, const char *name = 0);
40 
41  void load();
42 
43  signals:
44  void playerSelected(uint i);
45  void allSelected();
46  void noneSelected();
47 
48  private slots:
49  void activatedSlot(int i);
50 };
51 
52 //-----------------------------------------------------------------------------
53 class AdditionalTab : public TQWidget
54 {
55  TQ_OBJECT
56 
57  public:
58  AdditionalTab(TQWidget *parent, const char *name);
59 
60  virtual void load();
61 
62  private slots:
63  void playerSelected(uint i) { display(i) ; }
64  void allSelected();
65 
66  protected:
67  void init();
68  static TQString percent(uint n, uint total, bool withBraces = false);
69  virtual void display(uint i) = 0;
70 
71  private:
72  PlayersCombo *_combo;
73 };
74 
75 //-----------------------------------------------------------------------------
76 class StatisticsTab : public AdditionalTab
77 {
78  TQ_OBJECT
79 
80  public:
81  StatisticsTab(TQWidget *parent);
82 
83  void load();
84 
85  private:
86  enum Count { Total = 0, Won, Lost, Draw, Nb_Counts };
87  static const char *COUNT_LABELS[Nb_Counts];
88  enum Trend { CurrentTrend = 0, WonTrend, LostTrend, Nb_Trends };
89  static const char *TREND_LABELS[Nb_Trends];
90  struct Data {
91  uint count[Nb_Counts];
92  double trend[Nb_Trends];
93  };
94  TQMemArray<Data> _data;
95  TQLabel *_nbs[Nb_Counts], *_percents[Nb_Counts], *_trends[Nb_Trends];
96 
97  TQString percent(const Data &, Count) const;
98  void display(uint i);
99 };
100 
101 //-----------------------------------------------------------------------------
102 class HistogramTab : public AdditionalTab
103 {
104  TQ_OBJECT
105 
106  public:
107  HistogramTab(TQWidget *parent);
108 
109  void load();
110 
111  private:
112  TQMemArray<uint> _counts;
113  TQMemArray<uint> _data;
114  TDEListView *_list;
115 
116  void display(uint i);
117 };
118 
119 } // namespace
120 
121 #endif
KExtHighscore
Definition: kexthighscore.cpp:30

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.8.13
This website is maintained by Timothy Pearson.