1 /* $Id$ */
2 /* Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org> */
3 /* This file is part of DeforaOS Desktop Browser */
4 /* Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  *    this list of conditions and the following disclaimer in the documentation
13  *    and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the authors nor the names of the contributors may be
16  *    used to endorse or promote products derived from this software without
17  *    specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
20  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 
30 
31 
32 #ifndef BROWSER_DESKTOP_H
33 # define BROWSER_DESKTOP_H
34 
35 # include <gtk/gtk.h>
36 # include <Desktop.h>
37 # include "../include/Desktop.h"
38 # include "desktopicon.h"
39 
40 
41 /* Desktop */
42 /* types */
43 # ifndef DesktopIcon
44 #  define DesktopIcon DesktopIcon
45 typedef struct _DesktopIcon DesktopIcon;
46 # endif
47 
48 # ifndef Desktop
49 #  define Desktop Desktop
50 typedef struct _Desktop Desktop;
51 # endif
52 
53 typedef struct _DesktopPrefs
54 {
55 	int alignment;
56 	int icons;
57 	int monitor;
58 	int popup;
59 	int window;
60 } DesktopPrefs;
61 
62 
63 /* functions */
64 Desktop * desktop_new(DesktopPrefs * prefs);
65 void desktop_delete(Desktop * desktop);
66 
67 /* accessors */
68 /* XXX most of these accessors expose internal structures somehow */
69 int desktop_get_drag_data(Desktop * desktop, GtkSelectionData * seldata);
70 GdkPixbuf * desktop_get_file(Desktop * desktop);
71 GdkPixbuf * desktop_get_folder(Desktop * desktop);
72 Mime * desktop_get_mime(Desktop * desktop);
73 GtkIconTheme * desktop_get_theme(Desktop * desktop);
74 
75 void desktop_set_alignment(Desktop * desktop, DesktopAlignment alignment);
76 void desktop_set_icons(Desktop * desktop, DesktopIcons icons);
77 int desktop_set_layout(Desktop * desktop, DesktopLayout layout);
78 
79 /* useful */
80 int desktop_error(Desktop * desktop, char const * message, int ret);
81 
82 void desktop_refresh(Desktop * desktop);
83 void desktop_reset(Desktop * desktop);
84 
85 void desktop_icon_add(Desktop * desktop, DesktopIcon * icon);
86 void desktop_icon_remove(Desktop * desktop, DesktopIcon * icon);
87 
88 void desktop_icons_align(Desktop * desktop);
89 void desktop_icons_sort(Desktop * desktop);
90 
91 void desktop_select_all(Desktop * desktop);
92 void desktop_select_above(Desktop * desktop, DesktopIcon * icon);
93 void desktop_select_under(Desktop * desktop, DesktopIcon * icon);
94 void desktop_unselect_all(Desktop * desktop);
95 
96 #endif /* !BROWSER_DESKTOP_H */
97