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