filename | src/gtkui/gtkui.h |
changeset | 1124:aacaae9812ea |
prev | 1109:700c5ab26a63 |
author | nkeynes |
date | Mon Jan 30 20:11:08 2012 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Replace wordexp() with a hand-coded env-var substitution. More portable, and avoids bugs with some wordexp() implementations |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * Core GTK-based user interface
5 *
6 * Copyright (c) 2005 Nathan Keynes.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
19 #ifndef lxdream_gtkui_H
20 #define lxdream_gtkui_H 1
22 #include "lxdream.h"
23 #include <gtk/gtk.h>
24 #include "gettext.h"
25 #include "gui.h"
26 #include "cpu.h"
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 /********************* Top-level windows *********************/
34 typedef struct main_window_info *main_window_t;
35 typedef struct debug_window_info *debug_window_t;
36 typedef struct mmio_window_info *mmio_window_t;
37 typedef struct dump_window_info *dump_window_t;
39 struct lxdream_config_group; /* Forward declaration */
41 /**
42 * Construct and show the main window, returning an
43 * opaque pointer to the window.
44 */
45 main_window_t main_window_new( const gchar *title, GtkWidget *menubar,
46 GtkWidget *toolbar, GtkAccelGroup *accel );
47 GtkWindow *main_window_get_frame( main_window_t win );
48 GtkWidget *main_window_get_renderarea( main_window_t win );
49 void main_window_set_running( main_window_t win, gboolean running );
50 void main_window_set_framerate( main_window_t win, float rate );
51 void main_window_set_speed( main_window_t win, double speed );
52 void main_window_set_fullscreen( main_window_t win, gboolean fullscreen );
53 void main_window_set_use_grab( main_window_t win, gboolean grab );
54 void main_window_update_title( main_window_t win );
55 void main_window_show_gui( main_window_t win, gboolean fullscreen );
57 debug_window_t debug_window_new( const gchar *title, GtkWidget *menubar,
58 GtkWidget *toolbar, GtkAccelGroup *accel );
59 void debug_window_show( debug_window_t win, gboolean show );
60 void debug_window_set_running( debug_window_t win, gboolean running );
61 void debug_window_update(debug_window_t win);
62 void debug_window_single_step( debug_window_t data );
63 void debug_window_set_oneshot_breakpoint( debug_window_t data, int row );
64 void debug_window_toggle_breakpoint( debug_window_t data, int row );
67 mmio_window_t mmio_window_new( const gchar *title );
68 void mmio_window_show( mmio_window_t win, gboolean show );
69 void mmio_window_update(mmio_window_t win);
71 dump_window_t dump_window_new( const gchar *title );
72 void dump_window_update_all();
74 void maple_dialog_run();
75 void path_dialog_run();
76 void hotkeys_dialog_run();
78 void gtk_gui_update( void );
79 main_window_t gtk_gui_get_main();
80 debug_window_t gtk_gui_get_debugger();
81 mmio_window_t gtk_gui_get_mmio();
82 void gtk_gui_show_mmio();
83 void gtk_gui_show_debugger();
85 /********************* Helper functions **********************/
87 typedef void (*gtk_dialog_done_fn)(GtkWidget *panel, gboolean isOK);
88 void gtk_gui_enable_action( const gchar *action, gboolean enabled );
89 gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel, gtk_dialog_done_fn fn );
90 int gtk_configuration_panel_run( const gchar *title, struct lxdream_config_group *group );
92 typedef gboolean (*file_callback_t)( const gchar *filename );
93 gchar *open_file_dialog( const char *title, const char *pattern, const char *patname,
94 int initial_dir_key );
95 gchar *save_file_dialog( const char *title, const char *pattern, const char *patname,
96 const char *mandatory_ext, int initial_dir_key );
97 void open_file_dialog_cb( const char *title, file_callback_t action, const char *pattern, const char *patname,
98 int initial_dir_key );
99 void save_file_dialog_cb( const char *title, file_callback_t action, const char *pattern, const char *patname,
100 const char *mandatory_ext, int initial_dir_key );
101 gboolean gtk_gui_gdrom_mount_image( const char *filename );
102 /**
103 * Extract the keyval of the key event if no modifier keys were pressed -
104 * in other words get the keyval of the key by itself. The other way around
105 * would be to use the hardware keysyms directly rather than the keyvals,
106 * but the mapping looks to be messier.
107 */
108 uint16_t gtk_get_unmodified_keyval( GdkEventKey *event );
110 /**
111 * Map a hardware keycode (not keyval) to a modifier state mask.
112 * @param display The display (containing the modifier map)
113 * @param keycde The hardware keycode to map
114 * @return The modifier mask (eg GDK_CONTROL_MASK) or 0 if the keycode
115 * is not recognized as a modifier key.
116 */
117 guint gdk_keycode_to_modifier( GdkDisplay *display, guint keycode );
119 /**
120 * Construct a new pixbuf that takes ownership of the frame buffer
121 */
122 GdkPixbuf *gdk_pixbuf_new_from_frame_buffer( frame_buffer_t buffer );
124 void gdrom_menu_init();
125 GtkWidget *gdrom_menu_new();
127 /******************** Video driver hook *********************/
129 GtkWidget *video_gtk_create_drawable();
131 /******************* Callback declarations *******************/
133 void load_binary_action_callback( GtkAction *action, gpointer user_data);
134 void mount_action_callback( GtkAction *action, gpointer user_data);
135 void reset_action_callback( GtkAction *action, gpointer user_data);
136 void pause_action_callback( GtkAction *action, gpointer user_data);
137 void resume_action_callback( GtkAction *action, gpointer user_data);
138 void load_state_action_callback( GtkAction *action, gpointer user_data);
139 void save_state_action_callback( GtkAction *action, gpointer user_data);
140 void quick_load_action_callback( GtkAction *action, gpointer user_data);
141 void quick_save_action_callback( GtkAction *action, gpointer user_data);
142 void quick_state_action_callback( GtkRadioAction *action, GtkRadioAction *current, gpointer user_data);
143 void about_action_callback( GtkAction *action, gpointer user_data);
144 void exit_action_callback( GtkAction *action, gpointer user_data);
146 void path_settings_callback( GtkAction *action, gpointer user_data);
147 void audio_settings_callback( GtkAction *action, gpointer user_data);
148 void maple_settings_callback( GtkAction *action, gpointer user_data);
149 void network_settings_callback( GtkAction *action, gpointer user_data);
150 void video_settings_callback( GtkAction *action, gpointer user_data);
151 void hotkey_settings_callback( GtkAction *action, gpointer user_data);
152 void fullscreen_toggle_callback( GtkToggleAction *action, gpointer user_data);
154 void debugger_action_callback( GtkAction *action, gpointer user_data);
155 void debug_memory_action_callback( GtkAction *action, gpointer user_data);
156 void debug_mmio_action_callback( GtkAction *action, gpointer user_data);
157 void save_scene_action_callback( GtkAction *action, gpointer user_data);
158 void debug_step_action_callback( GtkAction *action, gpointer user_data);
159 void debug_runto_action_callback( GtkAction *action, gpointer user_data);
160 void debug_breakpoint_action_callback( GtkAction *action, gpointer user_data);
162 void gdrom_open_direct_callback( GtkWidget *widget, gpointer user_data );
164 /*************** Constant colour/font values *****************/
165 extern PangoFontDescription *gui_fixed_font;
166 extern GdkColor gui_colour_normal, gui_colour_changed, gui_colour_error;
167 extern GdkColor gui_colour_warn, gui_colour_pc, gui_colour_debug;
168 extern GdkColor gui_colour_trace, gui_colour_break, gui_colour_temp_break;
169 extern GdkColor gui_colour_white;
171 #ifdef __cplusplus
172 }
173 #endif
175 #endif /* lxdream_gtkui_H */
.