Search
lxdream.org :: lxdream/src/gtkui/gtkui.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/gtkui/gtkui.h
changeset 630:50addb748df5
prev618:3ade50e8603c
next669:ab344e42bca9
author nkeynes
date Tue Feb 12 08:36:29 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Bug #55: Fix relative path handling
Canonicalize paths before passing to the file dialog
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@435
    19
#ifndef __lxdream_gtkui_H
nkeynes@435
    20
#define __lxdream_gtkui_H
nkeynes@435
    21
nkeynes@508
    22
#include "lxdream.h"
nkeynes@435
    23
#include <gtk/gtk.h>
nkeynes@508
    24
#include <glib/gi18n.h>
nkeynes@435
    25
#include "gui.h"
nkeynes@435
    26
#include "cpu.h"
nkeynes@435
    27
nkeynes@435
    28
/********************* Top-level windows *********************/
nkeynes@435
    29
nkeynes@435
    30
typedef struct main_window_info *main_window_t;
nkeynes@435
    31
typedef struct debug_window_info *debug_window_t;
nkeynes@435
    32
typedef struct mmio_window_info *mmio_window_t;
nkeynes@457
    33
typedef struct dump_window_info *dump_window_t;
nkeynes@435
    34
nkeynes@435
    35
/**
nkeynes@435
    36
 * Construct and show the main window, returning an 
nkeynes@435
    37
 * opaque pointer to the window.
nkeynes@435
    38
 */
nkeynes@455
    39
main_window_t main_window_new( const gchar *title, GtkWidget *menubar, 
nkeynes@455
    40
			       GtkWidget *toolbar, GtkAccelGroup *accel );
nkeynes@447
    41
GtkWindow *main_window_get_frame( main_window_t win );
nkeynes@435
    42
GtkWidget *main_window_get_renderarea( main_window_t win );
nkeynes@435
    43
void main_window_set_running( main_window_t win, gboolean running );
nkeynes@435
    44
void main_window_set_framerate( main_window_t win, float rate );
nkeynes@437
    45
void main_window_set_speed( main_window_t win, double speed );
nkeynes@486
    46
void main_window_set_fullscreen( main_window_t win, gboolean fullscreen );
nkeynes@608
    47
void main_window_set_use_grab( main_window_t win, gboolean grab );
nkeynes@435
    48
nkeynes@455
    49
debug_window_t debug_window_new( const gchar *title, GtkWidget *menubar,
nkeynes@455
    50
				 GtkWidget *toolbar, GtkAccelGroup *accel );
nkeynes@435
    51
void debug_window_show( debug_window_t win, gboolean show );
nkeynes@435
    52
void debug_window_set_running( debug_window_t win, gboolean running );
nkeynes@435
    53
void debug_window_update(debug_window_t win);
nkeynes@455
    54
void debug_window_single_step( debug_window_t data );
nkeynes@455
    55
void debug_window_set_oneshot_breakpoint( debug_window_t data, int row );
nkeynes@455
    56
void debug_window_toggle_breakpoint( debug_window_t data, int row );
nkeynes@435
    57
nkeynes@455
    58
nkeynes@455
    59
mmio_window_t mmio_window_new( const gchar *title );
nkeynes@450
    60
void mmio_window_show( mmio_window_t win, gboolean show );
nkeynes@480
    61
void mmio_window_update(mmio_window_t win);
nkeynes@435
    62
nkeynes@457
    63
dump_window_t dump_window_new( const gchar *title );
nkeynes@480
    64
void dump_window_update_all();
nkeynes@455
    65
nkeynes@455
    66
void maple_dialog_run();
nkeynes@450
    67
void path_dialog_run();
nkeynes@450
    68
nkeynes@480
    69
void gtk_gui_update( void );
nkeynes@455
    70
main_window_t gtk_gui_get_main();
nkeynes@455
    71
debug_window_t gtk_gui_get_debugger();
nkeynes@455
    72
mmio_window_t gtk_gui_get_mmio();
nkeynes@480
    73
void gtk_gui_show_mmio();
nkeynes@464
    74
void gtk_gui_show_debugger();
nkeynes@455
    75
nkeynes@450
    76
/********************* Helper functions **********************/
nkeynes@450
    77
nkeynes@455
    78
typedef void (*gtk_dialog_done_fn)(GtkWidget *panel, gboolean isOK);
nkeynes@455
    79
void gtk_gui_enable_action( const gchar *action, gboolean enabled );
nkeynes@455
    80
gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel, gtk_dialog_done_fn fn );
nkeynes@435
    81
nkeynes@480
    82
nkeynes@480
    83
typedef gboolean (*file_callback_t)( const gchar *filename );
nkeynes@480
    84
void open_file_dialog( char *title, file_callback_t action, char *pattern, char *patname,
nkeynes@480
    85
		       gchar const *initial_dir );
nkeynes@608
    86
/**
nkeynes@608
    87
 * Extract the keyval of the key event if no modifier keys were pressed -
nkeynes@608
    88
 * in other words get the keyval of the key by itself. The other way around
nkeynes@608
    89
 * would be to use the hardware keysyms directly rather than the keyvals,
nkeynes@608
    90
 * but the mapping looks to be messier.
nkeynes@608
    91
 */
nkeynes@608
    92
uint16_t gtk_get_unmodified_keyval( GdkEventKey *event );
nkeynes@480
    93
nkeynes@477
    94
/**
nkeynes@618
    95
 * Map a hardware keycode (not keyval) to a modifier state mask.
nkeynes@618
    96
 * @param display The display (containing the modifier map)
nkeynes@618
    97
 * @param keycde The hardware keycode to map
nkeynes@618
    98
 * @return The modifier mask (eg GDK_CONTROL_MASK) or 0 if the keycode
nkeynes@618
    99
 * is not recognized as a modifier key.
nkeynes@618
   100
 */
nkeynes@618
   101
guint gdk_keycode_to_modifier( GdkDisplay *display, guint keycode );
nkeynes@618
   102
nkeynes@618
   103
/**
nkeynes@630
   104
 * Return an absolute path for the given input path, as a newly allocated
nkeynes@630
   105
 * string. If the input path is already absolute, the returned string will
nkeynes@630
   106
 * be identical to the input string.
nkeynes@630
   107
 */
nkeynes@630
   108
gchar *get_absolute_path( const gchar *path );
nkeynes@630
   109
nkeynes@630
   110
/**
nkeynes@477
   111
 * Construct a new pixbuf that takes ownership of the frame buffer
nkeynes@477
   112
 */
nkeynes@480
   113
GdkPixbuf *gdk_pixbuf_new_from_frame_buffer( frame_buffer_t buffer );
nkeynes@477
   114
nkeynes@470
   115
void gdrom_menu_init();
nkeynes@470
   116
GtkWidget *gdrom_menu_new();
nkeynes@470
   117
nkeynes@435
   118
/******************** Video driver hooks *********************/
nkeynes@435
   119
nkeynes@435
   120
GtkWidget *gtk_gui_get_renderarea();
nkeynes@435
   121
nkeynes@435
   122
/******************* Callback declarations *******************/
nkeynes@435
   123
nkeynes@543
   124
void load_binary_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   125
void mount_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   126
void reset_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   127
void pause_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   128
void resume_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   129
void load_state_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   130
void save_state_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   131
void about_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   132
void exit_action_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   133
nkeynes@447
   134
void path_settings_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   135
void audio_settings_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   136
void maple_settings_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   137
void network_settings_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   138
void video_settings_callback( GtkAction *action, gpointer user_data);
nkeynes@435
   139
void fullscreen_toggle_callback( GtkToggleAction *action, gpointer user_data);
nkeynes@435
   140
nkeynes@455
   141
void debugger_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   142
void debug_memory_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   143
void debug_mmio_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   144
void save_scene_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   145
void debug_step_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   146
void debug_runto_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   147
void debug_breakpoint_action_callback( GtkAction *action, gpointer user_data);
nkeynes@455
   148
nkeynes@464
   149
void gdrom_open_direct_callback( GtkWidget *widget, gpointer user_data );
nkeynes@464
   150
nkeynes@435
   151
/*************** Constant colour/font values *****************/
nkeynes@435
   152
extern PangoFontDescription *gui_fixed_font;
nkeynes@435
   153
extern GdkColor gui_colour_normal, gui_colour_changed, gui_colour_error;
nkeynes@435
   154
extern GdkColor gui_colour_warn, gui_colour_pc, gui_colour_debug;
nkeynes@435
   155
extern GdkColor gui_colour_trace, gui_colour_break, gui_colour_temp_break;
nkeynes@435
   156
extern GdkColor gui_colour_white;
nkeynes@435
   157
nkeynes@435
   158
#endif /* __lxdream_gtkui_H */
.