Search
lxdream.org :: lxdream/src/gui.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui.h
changeset 1036:af7b0c5905dd
prev1019:87f191f92f8f
next1041:5fcc39857c5c
author nkeynes
date Wed Jun 24 06:06:40 2009 +0000 (14 years ago)
permissions -rw-r--r--
last change Support shell substitutions in config paths
Keep track of last folder in file dialogs
Fix out-of-dateness in GTK path dialog
file annotate diff log raw
nkeynes@435
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@435
     3
 *
nkeynes@435
     4
 * Public GUI declarations (used from elsewhere in the system)
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_gui_H
nkeynes@736
    20
#define lxdream_gui_H
nkeynes@435
    21
nkeynes@435
    22
#include <glib/gtypes.h>
nkeynes@435
    23
nkeynes@736
    24
#ifdef __cplusplus
nkeynes@736
    25
extern "C" {
nkeynes@736
    26
#endif
nkeynes@736
    27
nkeynes@678
    28
/* Base GUI clock is 10ms */
nkeynes@678
    29
#define GUI_TICK_PERIOD 10000000
nkeynes@678
    30
nkeynes@435
    31
/**
nkeynes@435
    32
 * GUI-provided method to scan the command line for standard arguments,
nkeynes@435
    33
 * invoked prior to regular command line processing. The command line
nkeynes@435
    34
 * is modified to remove any arguments handled by the UI.
nkeynes@435
    35
 * @return TRUE on success, FALSE on failure.
nkeynes@435
    36
 */
nkeynes@435
    37
gboolean gui_parse_cmdline( int *argc, char **argv[] );
nkeynes@435
    38
nkeynes@435
    39
/**
nkeynes@435
    40
 * Initialize the GUI system and create any windows needed. This method
nkeynes@435
    41
 * should also register the GUI module with the module manager (if the
nkeynes@435
    42
 * GUI has one).
nkeynes@435
    43
 *
nkeynes@435
    44
 * @param debug TRUE if the system should start in debugging mode.
nkeynes@1015
    45
 * @param fullscreen TRUE if the system should start in fullscreen mode.
nkeynes@435
    46
 */
nkeynes@1015
    47
gboolean gui_init( gboolean debug, gboolean fullscreen );
nkeynes@435
    48
nkeynes@435
    49
/**
nkeynes@435
    50
 * Enter the GUI main loop. If this method ever returns, the system will
nkeynes@435
    51
 * exit normally.
nkeynes@681
    52
 * 
nkeynes@681
    53
 * @param run TRUE if the system should start running immediately, otherwise
nkeynes@435
    54
 */
nkeynes@681
    55
void gui_main_loop( gboolean run );
nkeynes@435
    56
nkeynes@447
    57
gboolean gui_error_dialog( const char *fmt, ... );
nkeynes@447
    58
nkeynes@435
    59
typedef enum { IO_IDE, IO_NETWORK } io_activity_type;
nkeynes@435
    60
nkeynes@435
    61
/**
nkeynes@545
    62
 * Notify the GUI of state changes (eg binary was loaded and PC changed)
nkeynes@545
    63
 */
nkeynes@545
    64
void gui_update_state();
nkeynes@545
    65
nkeynes@545
    66
/**
nkeynes@839
    67
 * Notify the GUI to enable/disable mouse grabs according to the flag value.
nkeynes@839
    68
 * If the parameter is FALSE and the grab is currently active, the GUI should
nkeynes@839
    69
 * immediately cancel the grab.
nkeynes@839
    70
 */
nkeynes@839
    71
void gui_set_use_grab( gboolean grab );
nkeynes@839
    72
nkeynes@839
    73
/**
nkeynes@435
    74
 * Notify the GUI of I/O activity. 
nkeynes@435
    75
 * @param activity the type of IO activity being reported.
nkeynes@435
    76
 * @param active TRUE if the I/O device is becoming active, FALSE if inactive.
nkeynes@435
    77
 */
nkeynes@435
    78
void gui_update_io_activity( io_activity_type activity, gboolean active );
nkeynes@435
    79
nkeynes@1019
    80
typedef void (*do_later_callback_t)(void);
nkeynes@1015
    81
/**
nkeynes@1019
    82
 * Queue an event to call a function at the next opportunity (used to
nkeynes@1019
    83
 * avoid invoking eg dreamcast_run directly from the middle of other processing). 
nkeynes@1015
    84
 */
nkeynes@1019
    85
void gui_do_later( do_later_callback_t func );
nkeynes@1015
    86
nkeynes@1036
    87
nkeynes@1036
    88
/******************* GUI helper functions *****************/
nkeynes@1036
    89
/* The following functions effectively track the current path for each of the
nkeynes@1036
    90
 * 3 main categories (save, vmu, and disc/binary loading) independently. They
nkeynes@1036
    91
 * default to the config values, but can be updated continuously without 
nkeynes@1036
    92
 * writing back to the config.
nkeynes@1036
    93
 */
nkeynes@1036
    94
const gchar *gui_get_configurable_path(int key);
nkeynes@1036
    95
void gui_set_configurable_path( int key, const gchar *path );
nkeynes@1036
    96
nkeynes@1036
    97
/**
nkeynes@1036
    98
 * Notify the helper functions that the config paths have changed, in which
nkeynes@1036
    99
 * event they will revert to the config-specified versions.
nkeynes@1036
   100
 */
nkeynes@1036
   101
void gui_config_paths_changed();
nkeynes@1036
   102
nkeynes@1036
   103
/**
nkeynes@1036
   104
 * Return an absolute path for the given input path, as a newly allocated
nkeynes@1036
   105
 * string. If the input path is already absolute, the returned string will
nkeynes@1036
   106
 * be identical to the input string.
nkeynes@1036
   107
 */
nkeynes@1036
   108
gchar *get_absolute_path( const gchar *path );
nkeynes@1036
   109
nkeynes@736
   110
#ifdef __cplusplus
nkeynes@736
   111
}
nkeynes@736
   112
#endif
nkeynes@736
   113
nkeynes@736
   114
#endif /* lxdream_gui_H */
.