1 /*
2 * Copyright (c) 1997 - 2001 Hansj�rg Malthaner
3 *
4 * This file is part of the Simutrans project under the artistic licence.
5 * (see licence.txt)
6 */
7
8 #include "../simworld.h"
9 #include "../display/simgraph.h"
10
11 #include "../simskin.h"
12 #include "../descriptor/skin_desc.h"
13
14 #include "../dataobj/translator.h"
15 #include "messagebox.h"
16
17
news_window(const char * text,FLAGGED_PIXVAL title_color)18 news_window::news_window(const char* text, FLAGGED_PIXVAL title_color) :
19 base_infowin_t( translator::translate("Meldung" ) ),
20 color(title_color)
21 {
22 buf.clear();
23 buf.append(translator::translate(text));
24
25 // adjust positions, sizes, and window-size
26 recalc_size();
27 }
28
29
fatal_news(const char * text)30 fatal_news::fatal_news(const char* text) :
31 news_window(text, env_t::default_window_title_color)
32 {
33 textarea.set_width(display_get_width()/2);
34 recalc_size();
35 }
36
37
news_img(const char * text)38 news_img::news_img(const char* text) :
39 news_window(text, env_t::default_window_title_color),
40 image()
41 {
42 init(skinverwaltung_t::meldungsymbol->get_image_id(0));
43 }
44
45
news_img(const char * text,image_id id,FLAGGED_PIXVAL color)46 news_img::news_img(const char* text, image_id id, FLAGGED_PIXVAL color) :
47 news_window(text, color),
48 image()
49 {
50 init(id);
51 }
52
53
54 /**
55 * just puts the image in top-right corner
56 * only cembedded.d from constructor
57 * @param id id of image
58 */
init(image_id id)59 void news_img::init(image_id id)
60 {
61 if( id!=IMG_EMPTY ) {
62 image.set_image(id, true);
63 image.enable_offset_removal(true);
64 image.set_size(image.get_min_size());
65 set_embedded(&image);
66 }
67 }
68
69
news_loc(const char * text,koord k,FLAGGED_PIXVAL color)70 news_loc::news_loc(const char* text, koord k, FLAGGED_PIXVAL color) :
71 news_window(text, color),
72 view(welt->lookup_kartenboden(k)->get_pos(), scr_size( max(64, get_base_tile_raster_width()), max(56, (get_base_tile_raster_width()*7)/8) ))
73 {
74 set_embedded(&view);
75 }
76
77
78 // returns position of the location shown in the subwindow
get_weltpos(bool)79 koord3d news_loc::get_weltpos(bool)
80 {
81 return view.get_location();
82 }
83
84
map_rotate90(sint16 new_ysize)85 void news_loc::map_rotate90( sint16 new_ysize )
86 {
87 view.map_rotate90(new_ysize);
88 }
89