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 #ifndef gui_loadsave_frame_h
9 #define gui_loadsave_frame_h
10 
11 #ifdef USE_FREETYPE
12 #include "gui_theme.h"
13 #include "../simsys.h"
14 
15 #include <ft2build.h>
16 #include FT_FREETYPE_H
17 #include FT_GLYPH_H
18 #include FT_TRUETYPE_TABLES_H
19 #endif
20 
21 #include "simwin.h"
22 #include "savegame_frame.h"
23 
24 #include "components/action_listener.h"
25 #include "components/gui_button.h"
26 #include "components/gui_numberinput.h"
27 
28 #include "../tpl/stringhashtable_tpl.h"
29 #include <string>
30 
31 
32 class loadfont_frame_t : public savegame_frame_t
33 {
34 private:
35 #ifdef USE_FREETYPE
36 	FT_Library ft_library;
37 #endif
38 	static bool use_unicode;
39 
40 protected:
41 	static std::string old_fontname;
42 	static uint8 old_linespace;
43 
44 	button_t unicode_only;
45 	gui_numberinput_t fontsize;
46 
47 	/**
48 	 * Action that's started with a button click
49 	 * @author Hansj�rg Malthaner
50 	 */
51 	bool item_action (const char *filename) OVERRIDE;
52 	bool ok_action   (const char *fullpath) OVERRIDE;
53 	bool cancel_action(const char *) OVERRIDE;
54 
55 	// returns extra file info
56 	const char *get_info(const char *fname) OVERRIDE;
57 
58 	// sort with respect to info, which is date
59 	bool compare_items ( const dir_entry_t & entry, const char *info, const char *) OVERRIDE;
60 
61 	bool check_file( const char *filename, const char *suffix ) OVERRIDE;
62 
63 	void fill_list() OVERRIDE;
64 
65 public:
66 	/**
67 	* Set the window associated helptext
68 	* @return the filename for the helptext, or NULL
69 	* @author Hj. Malthaner
70 	*/
get_help_filename()71 	const char *get_help_filename() const OVERRIDE { return "load_font.txt"; }
72 
73 	loadfont_frame_t();
74 
75 	void draw(scr_coord pos, scr_size size) OVERRIDE;
76 
get_rdwr_id(void)77 	uint32 get_rdwr_id( void ) OVERRIDE { return magic_font; }
78 	void rdwr( loadsave_t *file ) OVERRIDE;
79 
80 	bool action_triggered(gui_action_creator_t *, value_t v) OVERRIDE;
81 };
82 
83 #endif
84