File: messagebox.cc

package info (click to toggle)
simutrans 100.0%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 9,776 kB
  • ctags: 9,485
  • sloc: cpp: 72,459; ansic: 5,646; makefile: 450
file content (48 lines) | stat: -rw-r--r-- 1,287 bytes parent folder | download
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
/*
 * Copyright (c) 1997 - 2001 Hansjrg Malthaner
 *
 * This file is part of the Simutrans project under the artistic licence.
 * (see licence.txt)
 */

#include "../simworld.h"
#include "../simgraph.h"

#include "../dataobj/translator.h"
#include "messagebox.h"



news_window::news_window(const char* text, PLAYER_COLOR_VAL title_color) :
	gui_frame_t("Meldung"),
	meldung(translator::translate(text)),
	color(title_color)
{
	sint16 height = max( meldung.gib_groesse().y+16+10+4, get_tile_raster_width()+30 );

	setze_fenstergroesse( koord(230, height) );

	meldung.setze_pos( koord(10, 10) );
	add_komponente( &meldung );
}


news_img::news_img(const char* text, image_id id, PLAYER_COLOR_VAL color) :
	news_window(text, color),
	bild(id)
{
	KOORD_VAL xoff, yoff, xw, yw;
	display_get_image_offset(id, &xoff, &yoff, &xw, &yw);
	bild.setze_pos(koord(220 - xw - xoff, 10 - yoff)); // aligned to upper right corner
	add_komponente(&bild);
}


news_loc::news_loc(karte_t* welt, const char* text, koord k, PLAYER_COLOR_VAL color) :
	news_window(text, color),
	view(welt, welt->lookup_kartenboden(k)->gib_pos())
{
	view.setze_pos(koord(230 - get_tile_raster_width() - 5, 10));
	view.setze_groesse(koord(get_tile_raster_width(), get_tile_raster_width() * 5 / 6));
	add_komponente(&view);
}