blob: b0463caad82079ec28696f8a0a3213e65aa01b19 (
plain) (
blame)
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
|
#include "AppHdr.h"
#ifdef USE_TILE_LOCAL
#include "cio.h"
#include "menu.h"
#include "tilefont.h"
#include "tilereg-crt.h"
#include "viewgeom.h"
CRTRegion::CRTRegion(FontWrapper *font) : TextRegion(font), m_attached_menu(NULL)
{
}
CRTRegion::~CRTRegion()
{
clear();
}
int CRTRegion::handle_mouse(MouseEvent &event)
{
int ret_val = 0;
if (m_attached_menu == NULL)
{
if (event.event == MouseEvent::PRESS
&& event.button == MouseEvent::LEFT)
{
ret_val = CK_MOUSE_CLICK;
}
}
else
ret_val = m_attached_menu->handle_mouse(event);
return ret_val;
}
void CRTRegion::on_resize()
{
TextRegion::on_resize();
crawl_view.termsz.x = mx;
crawl_view.termsz.y = my;
// Todo: resize attached menu
}
void CRTRegion::clear()
{
// clear all the texts
TextRegion::clear();
detach_menu();
}
void CRTRegion::render()
{
set_transform(true);
// render all the inherited texts
TextRegion::render();
// render the attached menu if it exists
if (m_attached_menu != NULL)
m_attached_menu->draw_menu();
}
void CRTRegion::attach_menu(PrecisionMenu* menu)
{
detach_menu();
m_attached_menu = menu;
}
void CRTRegion::detach_menu()
{
// Tiles has no rights over the menu, thus the user must delete it
// Via other means
m_attached_menu = NULL;
}
#endif
|