1 /*
2  * TilEm II
3  *
4  * Copyright (c) 2010-2011 Thibault Duponchelle
5  * Copyright (c) 2010-2012 Benjamin Moody
6  *
7  * This program is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 /* Root window view (widgets and flags) */
22 typedef struct _TilemEmulatorWindow {
23 	TilemCalcEmulator *emu;
24 
25 	GtkWidget *window; /* The top level window */
26 	GtkWidget *layout; /* Layout */
27 	GtkWidget *lcd;
28 	GtkWidget *background;
29 	GtkWidget *popup_menu;
30 
31 	GtkActionGroup *actions;
32 
33 	GdkGeometry geomhints;
34 	GdkWindowHints geomhintmask;
35 
36 	byte* lcd_image_buf;
37 	int lcd_image_width;
38 	int lcd_image_height;
39 	GdkRgbCmap* lcd_cmap;
40 	gboolean lcd_smooth_scale;
41 
42 	char *skin_file_name;
43 	SKIN_INFOS *skin;
44 	gboolean skin_disabled; /* A flag to know if skinless or not */
45 	gdouble base_zoom;
46 	gdouble zoom_factor;
47 	GdkWindowState window_state;
48 
49 	int mouse_key;		/* Key currently pressed by mouse button */
50 
51 	/* Host keycode used to activate each key, if any */
52 	int keypress_keycodes[64];
53 	int sequence_keycode;
54 
55 } TilemEmulatorWindow;
56 
57 /* Create a new TilemEmulatorWindow. */
58 TilemEmulatorWindow *tilem_emulator_window_new(TilemCalcEmulator *emu);
59 
60 /* Free a TilemEmulatorWindow. */
61 void tilem_emulator_window_free(TilemEmulatorWindow *ewin);
62 
63 /* Load a skin file. */
64 void tilem_emulator_window_set_skin(TilemEmulatorWindow *ewin,
65                                     const char *filename);
66 
67 /* Enable or disable skin. */
68 void tilem_emulator_window_set_skin_disabled(TilemEmulatorWindow *ewin,
69                                              gboolean disabled);
70 
71 /* New calculator loaded. */
72 void tilem_emulator_window_calc_changed(TilemEmulatorWindow *ewin);
73 
74 /* Redraw LCD contents. */
75 void tilem_emulator_window_refresh_lcd(TilemEmulatorWindow *ewin);
76 
77 /* Prompt for a ROM file to open */
78 gboolean tilem_emulator_window_prompt_open_rom(TilemEmulatorWindow *ewin);
79