-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGVInfoView.cpp
More file actions
118 lines (101 loc) · 3.77 KB
/
Copy pathGVInfoView.cpp
File metadata and controls
118 lines (101 loc) · 3.77 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/// \file GVInfoView.cpp
/// \brief Base Class for the table view
// GVInfoView.cpp
//
// Copyright 2003, Quarterflash Design Group
//
// Licensed under GPL version 2 - see COPYING for details
//
// 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "GVInfoView.h"
GVInfoView::GVInfoView(wxWindow *parent)
: wxNotebook(parent, -1)
{
LoadImages();
SetImageList (m_imageList);
wxNotebook::AddPage(new wxPanel(this), _T("Groups"), false, 0);
wxNotebook::AddPage(new wxPanel(this), _T("Fleets"), false, 1);
wxNotebook::AddPage(new wxPanel(this), _T("Incoming Groups"), false, 2);
wxNotebook::AddPage(new wxPanel(this), _T("Ship Types"), false, 3);
wxNotebook::AddPage(m_planets = new GVInfoPlanets(this), _T("Planets"), false, 4);
wxNotebook::AddPage(new wxPanel(this), _T("Production"), false, 5);
wxNotebook::AddPage(new wxPanel(this), _T("Stockpiles"), false, 6);
wxNotebook::AddPage(new wxPanel(this), _T("Routes"), false, 7);
wxNotebook::AddPage(new wxPanel(this), _T("Races"), false, 8);
wxNotebook::AddPage(new wxPanel(this), _T("Battles"), false, 9);
wxNotebook::AddPage(new wxPanel(this), _T("Bombings"), false, 10);
UpdateChilds();
}
GVInfoView::~GVInfoView()
{
delete m_imageList;
}
void
GVInfoView::LoadImages()
{
m_imageList = new wxImageList(20, 20);
wxString resourceFile;
wxString resources;
wxFileConfig *cf = (wxFileConfig *) wxConfigBase::Get (false);
cf->Read (_T ("/GalaxyView/resources"), &resourceFile);
AddIcon(resourceFile, "resource/buttons/groups_tbl.png");
AddIcon(resourceFile, "resource/buttons/fleets_tbl.png");
AddIcon(resourceFile, "resource/buttons/groups_incoming.png");
AddIcon(resourceFile, "resource/buttons/ship_types_tbl.png");
AddIcon(resourceFile, "resource/buttons/planets_tbl.png");
AddIcon(resourceFile, "resource/buttons/production_tbl.png");
AddIcon(resourceFile, "resource/buttons/stockpiles_tbl.png");
AddIcon(resourceFile, "resource/buttons/routes_tbl.png");
AddIcon(resourceFile, "resource/buttons/races_tbl.png");
AddIcon(resourceFile, "resource/buttons/battles_tbl.png");
AddIcon(resourceFile, "resource/buttons/bombings_tbl.png");
}
void GVInfoView::AddIcon(const char* resFile, const char* file)
{
wxZipInputStream stream(resFile, file);
wxImage* img = new wxImage (stream);
if (img) {
wxBitmap bmp (img);
wxIcon icon;
icon.CopyFromBitmap (bmp);
m_imageList->Add (icon);
}
else {
wxLogMessage (_T ("could not load Groups icon"));
}
delete img;
}
void
GVInfoView::UpdateChilds()
{
m_planets->Update();
}
void
GVInfoView::SwitchView(GVInfoView_Tables t)
{
switch(t) {
case GVInfoView_TblGroups: SetSelection(0); break;
case GVInfoView_TblFleets: SetSelection(1); break;
case GVInfoView_TblIncoming: SetSelection(2); break;
case GVInfoView_TblShipTypes: SetSelection(3); break;
case GVInfoView_TblPlanets: SetSelection(4); break;
case GVInfoView_TblProduction: SetSelection(5); break;
case GVInfoView_TblStockpiles: SetSelection(6); break;
case GVInfoView_TblRoutes: SetSelection(7); break;
case GVInfoView_TblRaces: SetSelection(8); break;
case GVInfoView_TblBattles: SetSelection(9); break;
case GVInfoView_TblBombings: SetSelection(10); break;
};
}