namespace GUITutorials {
class WorldMap
{
protected:
virtual void InitMap();
virtual void InitRU();
virtual void InitUS();
virtual void InitAU();
virtual void InitFR();
virtual void InitUK();
public:
enum ECountryCode {
kRU = 7, kUS = 1, kFR = 33, kDE = 49, kCH = 41, kCN = 86, kAU = 61,
kUK = 44, kUA = 380, kBR = 55
};
WorldMap(const char *picName = "worldmap.jpg");
virtual ~WorldMap() {}
TGImageMap* GetImageMap()
const {
return fImageMap; }
void PrintCode(
Int_t code);
};
WorldMap::WorldMap(const char* picName)
{
InitMap();
fImageMap->
Connect(
"RegionClicked(Int_t)",
"WorldMap",
this,
"PrintCode(Int_t)");
}
{
return "Country Code (left button). City/Area Codes (right button)";
}
void WorldMap::InitRU()
{
int x[12] = { 403, 406, 427, 444, 438, 470, 508, 568, 599, 632, 645, 493 };
int y[12] = { 68, 90, 120, 125, 109, 94, 109, 101, 122, 107, 74, 46 };
fImageMap->AddRegion(reg, kRU);
fImageMap->SetToolTipText(kRU, "Russia");
pm->
AddEntry(
"St.Petersburg = 812", 812);
}
void WorldMap::InitUS()
{
int x[5] = { 136, 122, 165, 194, 232 };
int y[5] = { 110, 141, 158, 160, 118 };
fImageMap->AddRegion(reg, kUS);
int alaskaX[4] = { 86, 131, 154, 117 };
int alaskaY[4] = { 90, 82, 64, 63 };
fImageMap->AddRegion(alaska, kUS);
fImageMap->SetToolTipText(kUS, "USA");
}
void WorldMap::InitFR()
{
int x[5] = { 349, 353, 368, 368, 358 };
int y[5] = { 112, 123, 119, 108, 107 };
fImageMap->AddRegion(reg, kFR);
fImageMap->SetToolTipText(kFR, "France");
}
void WorldMap::InitUK()
{
int x[4] = { 346, 348, 359, 352 };
int y[4] = { 93, 104, 103, 87 };
fImageMap->AddRegion(reg, kUK);
fImageMap->SetToolTipText(kUK, "United Kingdom");
}
void WorldMap::InitAU()
{
int x[6] = { 582, 576, 634, 658, 641, 607 };
int y[6] = { 271, 300, 310, 283, 251, 253 };
fImageMap->AddRegion(reg, kAU);
fImageMap->SetToolTipText(kAU, "Australia");
}
void WorldMap::InitMap()
{
InitRU();
InitUS();
InitFR();
InitAU();
InitUK();
fImageMap->SetToolTipText(GetTitle().
Data(), 300);
}
void WorldMap::PrintCode(
Int_t code)
{
"Country Code",
Form(
"Country Code=%d",code),
icontype, buttons, &retval);
}
}
}
void WorldMap()
{
namespace GUI = ROOT::GUITutorials;
GUI::WorldMap *map = new GUI::WorldMap;
map->Show();
}