1
1
/* Groundhog -- a simple logic game
2
* Copyright (C) 1998-2001 Maurits Rijk
2
* Copyright (C) 1998-2002 Maurits Rijk
4
4
* This program is free software; you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License as published by
16
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#include <strstream.h>
21
23
#include "highscore_tab.h"
30
32
GtkWidget* label = gtk_label_new(_("Rank"));
31
gtk_widget_show(label);
32
33
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
34
35
label = gtk_label_new(_("Name"));
35
gtk_widget_show(label);
36
36
gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1);
38
38
label = gtk_label_new(_("Seconds"));
39
gtk_widget_show(label);
40
39
gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 3, 0, 1);
42
gtk_widget_show(table);
44
42
for (int i = 1; i <= 10; i++) {
46
std::ostrstream ost(scratch, sizeof(scratch));
48
ost << i << std::ends;
49
GtkWidget* index_label = gtk_label_new(scratch);
50
gtk_widget_show(index_label);
44
ost << i << ends; // format string
45
string temp = ost.str(); // retrieve formatted string
47
GtkWidget* index_label = gtk_label_new(temp.c_str());
51
49
gtk_table_attach_defaults(GTK_TABLE(table), index_label, 0, 1, i, i + 1);
53
51
_names[i] = gtk_label_new(N_(""));
54
gtk_widget_show(_names[i]);
55
52
gtk_table_attach_defaults(GTK_TABLE(table), _names[i], 1, 2, i, i + 1);
57
54
_seconds[i] = gtk_label_new(N_(""));
58
gtk_widget_show(_seconds[i]);
59
55
gtk_table_attach_defaults(GTK_TABLE(table), _seconds[i], 2, 3, i, i + 1);
62
label = gtk_label_new(tab_name);
58
label = gtk_label_new_with_mnemonic(tab_name);
63
59
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
74
70
HighScoreTab::Fill(const ScoreList& slist)
77
for (std::list<Score>::const_iterator i = slist.Begin();
73
for (list<Score>::const_iterator i = slist.Begin();
78
74
i != slist.End(); i++) {
80
std::ostrstream ost(scratch, sizeof(scratch));
82
ost << (*i).GetSeconds() << std::ends;
76
ost << (*i).GetSeconds() << ends; // format string
77
string temp = ost.str(); // retrieve string
84
FillOneScore(index++, (*i).GetName().c_str(), scratch);
79
FillOneScore(index++, (*i).GetName().c_str(), temp.c_str());
87
82
for (; index <= 10; index++)