mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 06:05:58 -06:00
43 lines
874 B
C++
43 lines
874 B
C++
#include <Map/Map.h>
|
|
|
|
class TestWindow : public TopWindow
|
|
{
|
|
typedef TestWindow CLASSNAME;
|
|
MapView View;
|
|
|
|
public:
|
|
TestWindow()
|
|
{
|
|
Sizeable().MinimizeBox().MaximizeBox();
|
|
Add(View.SizePos());
|
|
|
|
View.LoadMap(AppendFileName(AppendFileName(GetFileDirectory(GetExeFilePath()), "Mipmaps"),
|
|
"marcos.map"));
|
|
View.HighQuality(false);
|
|
View.ShowSearch();
|
|
|
|
// here link to callback
|
|
PolygonItem::WhenClick = THISBACK(OnRoomClick);
|
|
}
|
|
|
|
// your method or function to react on clicks
|
|
void OnRoomClick(Ptr<PolygonItem> room)
|
|
{
|
|
Point p = GetRect().TopLeft() + ViewToScene(~room, room->GetCenter());
|
|
|
|
TopWindow popup;
|
|
popup.NoCenter();
|
|
popup.SetRect(Rect(p, Size(150, 50)));
|
|
|
|
Label text;
|
|
popup.Add(text.SizePos());
|
|
text = "Name: " + room->GetName();
|
|
|
|
popup.Execute();
|
|
}
|
|
};
|
|
|
|
GUI_APP_MAIN
|
|
{
|
|
TestWindow().Run();
|
|
}
|