2018-11-15 23:42:29 +00:00
|
|
|
/*****************************************************************************\
|
|
|
|
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
|
|
|
This file is licensed under the Snes9x License.
|
|
|
|
For further information, consult the LICENSE file in the root directory.
|
|
|
|
\*****************************************************************************/
|
|
|
|
|
2010-09-25 15:46:12 +00:00
|
|
|
#ifndef __GTK_S9XWINDOW_H
|
|
|
|
#define __GTK_S9XWINDOW_H
|
|
|
|
|
2018-11-07 00:46:44 +00:00
|
|
|
#include "gtk_2_3_compat.h"
|
2010-09-25 15:46:12 +00:00
|
|
|
|
2018-11-02 20:47:31 +00:00
|
|
|
#include "port.h"
|
2010-09-26 09:19:15 +00:00
|
|
|
#include "gtk_builder_window.h"
|
2018-11-02 20:47:31 +00:00
|
|
|
#include "gtk_config.h"
|
2010-09-25 15:46:12 +00:00
|
|
|
|
2010-09-26 09:19:15 +00:00
|
|
|
class Snes9xWindow : public GtkBuilderWindow
|
2010-09-25 15:46:12 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Snes9xWindow (Snes9xConfig *config);
|
|
|
|
|
|
|
|
/* Pause related functions */
|
2018-11-02 20:52:26 +00:00
|
|
|
void pause_from_focus_change ();
|
|
|
|
void unpause_from_focus_change ();
|
2018-12-28 22:32:32 +00:00
|
|
|
void focus_notify (bool state);
|
2018-11-02 20:52:26 +00:00
|
|
|
void pause_from_user ();
|
|
|
|
void unpause_from_user ();
|
2018-12-28 22:32:32 +00:00
|
|
|
bool is_paused ();
|
2018-11-02 20:52:26 +00:00
|
|
|
void propagate_pause_state ();
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
/* Fullscreen functions */
|
2018-11-02 20:52:26 +00:00
|
|
|
void enter_fullscreen_mode ();
|
|
|
|
void leave_fullscreen_mode ();
|
|
|
|
void toggle_fullscreen_mode ();
|
|
|
|
void finish_fullscreen ();
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
/* Cursor modifying functions */
|
2018-11-02 20:52:26 +00:00
|
|
|
void show_mouse_cursor ();
|
|
|
|
void hide_mouse_cursor ();
|
2018-11-08 20:23:37 +00:00
|
|
|
void toggle_grab_mouse ();
|
|
|
|
void center_mouse ();
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
/* Rom-related functions */
|
2018-11-02 20:52:26 +00:00
|
|
|
void open_rom_dialog ();
|
|
|
|
void save_state_dialog ();
|
|
|
|
void load_state_dialog ();
|
|
|
|
void configure_widgets ();
|
|
|
|
void save_spc_dialog ();
|
2018-12-28 22:32:32 +00:00
|
|
|
bool try_open_rom (const char *filename);
|
2010-09-25 15:46:12 +00:00
|
|
|
const char *open_movie_dialog (bool readonly);
|
2018-11-02 20:52:26 +00:00
|
|
|
void movie_seek_dialog ();
|
|
|
|
void open_multicart_dialog ();
|
|
|
|
void show_rom_info ();
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
/* GTK-base-related functions */
|
2018-11-02 20:52:26 +00:00
|
|
|
void show ();
|
2010-09-25 15:46:12 +00:00
|
|
|
void set_menu_item_selected (const char *name);
|
|
|
|
void set_mouseable_area (int x, int y, int width, int height);
|
|
|
|
void set_menu_item_accel_to_binding (const char *name,
|
|
|
|
const char *binding);
|
2018-11-02 20:52:26 +00:00
|
|
|
void reset_screensaver ();
|
|
|
|
void update_accels ();
|
|
|
|
void toggle_ui ();
|
2014-03-29 10:48:35 +00:00
|
|
|
void resize_to_multiple (int factor);
|
2010-09-25 15:46:12 +00:00
|
|
|
void resize_viewport (int width, int height);
|
2018-11-02 20:52:26 +00:00
|
|
|
void expose ();
|
2019-03-21 21:37:00 +00:00
|
|
|
void setup_splash();
|
2018-11-02 20:52:26 +00:00
|
|
|
double get_refresh_rate ();
|
|
|
|
int get_auto_input_rate ();
|
2010-09-25 15:46:12 +00:00
|
|
|
|
2018-11-02 20:52:26 +00:00
|
|
|
cairo_t *get_cairo ();
|
|
|
|
void release_cairo ();
|
2017-12-07 18:24:29 +00:00
|
|
|
|
2010-09-25 15:46:12 +00:00
|
|
|
Snes9xConfig *config;
|
2010-10-30 14:21:26 +00:00
|
|
|
int user_pause, sys_pause;
|
2010-09-25 15:46:12 +00:00
|
|
|
int last_width, last_height;
|
|
|
|
int mouse_region_x, mouse_region_y;
|
|
|
|
int mouse_region_width, mouse_region_height;
|
|
|
|
int nfs_width, nfs_height, nfs_x, nfs_y;
|
|
|
|
int fullscreen_state;
|
|
|
|
int maximized_state;
|
2018-12-28 22:32:32 +00:00
|
|
|
bool focused;
|
|
|
|
bool paused_from_focus_loss;
|
2019-03-02 22:10:00 +00:00
|
|
|
double snes_mouse_x, snes_mouse_y;
|
|
|
|
double gdk_mouse_x, gdk_mouse_y;
|
2018-12-28 22:32:32 +00:00
|
|
|
bool mouse_grabbed;
|
2010-09-25 15:46:12 +00:00
|
|
|
GdkPixbuf *icon, *splash;
|
2010-09-26 09:19:15 +00:00
|
|
|
GdkCursor *default_cursor, *empty_cursor;
|
2010-09-25 15:46:12 +00:00
|
|
|
GtkDrawingArea *drawing_area;
|
|
|
|
GtkWidget *recent_menu;
|
2017-12-07 18:24:29 +00:00
|
|
|
cairo_t *cr;
|
2018-12-28 22:32:32 +00:00
|
|
|
bool cairo_owned;
|
2018-04-28 16:59:17 +00:00
|
|
|
#if GTK_MAJOR_VERSION >= 3
|
2017-12-07 18:24:29 +00:00
|
|
|
GdkDrawingContext *gdk_drawing_context;
|
|
|
|
cairo_region_t *cairo_region;
|
|
|
|
#endif
|
2010-09-25 15:46:12 +00:00
|
|
|
};
|
|
|
|
|
2015-08-16 10:36:56 +00:00
|
|
|
typedef struct gtk_splash_t {
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
|
|
|
|
unsigned char pixel_data[256 * 224 * 3 + 1];
|
|
|
|
} gtk_splash_t;
|
|
|
|
|
2010-09-25 15:46:12 +00:00
|
|
|
#endif /* __GTK_S9XWINDOW_H */
|