summaryrefslogtreecommitdiff
path: root/siv.h
blob: 2e18a4f0aa205a16dff80b1acee626d4c218ca08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef SIV_H
#define SIV_H

#include <config.h>
#include <gtk/gtk.h>
#include <glade/glade.h>

#define APPLICATION_NAME "Simple Image Viewer"
#define GLADE_FILE       DATADIR"/siv.glade"

typedef struct SivWindow SivWindow;
typedef struct App App;
typedef struct MetaData MetaData;

typedef enum
{
    BG_FIRST,
    BG_NONE = BG_FIRST,
    BG_CHECKERBOARD,
    BG_WHITE,
    BG_BLACK,
    BG_LAST
} BackgroundType;

struct MetaData
{
    int			window_x;
    int			window_y;
    int			window_width;
    int			window_height;
    BackgroundType	background;
    gboolean		smooth_image;
    int			zoom_level;
    int			vadj;
    int			hadj;
    gboolean		show_toolbar;
    gboolean		show_status_bar;
};

/* App */
void      app_register_window   (App            *app,
				 SivWindow         *window);
void      app_unregister_window (App            *app,
				 SivWindow         *window);
gboolean  app_get_meta_data     (App            *app,
				 const char     *file,
				 MetaData       *data);
void      app_set_meta_data     (App            *data,
				 const char     *filename,
				 int             window_x,
				 int             window_y,
				 int             window_height,
				 int             window_width,
				 gboolean        smooth_image,
				 BackgroundType  background,
				 int             zoom_level,
				 int		 vadj,
				 int		 hadj,
				 gboolean        show_toolbar,
				 gboolean        show_status_bar);
GtkWidget *app_get_open_chooser (App *app);

/* Doesn't really belong in the app namespace */
void      app_show_warning      (GtkWidget *parent_window,
				 const gchar *secondary,
				 const gchar *format,
				 ...);
void	  app_show_could_not_open (GtkWidget *parent_window,
				   int	      n_files,
				   gchar     **files);

/* SivWindow */
SivWindow * window_new          (App         *app);
gboolean    window_load_file    (SivWindow   *window,
				 const char  *file,
				 GError     **err);
void	    window_reload	(SivWindow   *window);
void        window_present      (SivWindow   *window,
				 const char  *startup_id);
void        window_show         (SivWindow   *window,
				 const char  *startup_id);
gboolean    window_matches_file (SivWindow   *window,
				 const char  *filename);
gboolean    window_is_blank     (SivWindow   *window);
void        window_free         (SivWindow   *window);

#endif