My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
#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();
}

Change log

r4180 by Sc0rch on Nov 17, 2011   Diff
MapRender: First release
(FormEditorCommon, FormEditorProperties,
Map, MapBG, MapCommon, MapEditor,
MapRenderTest.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 874 bytes, 43 lines
Powered by Google Project Hosting