1 /* $Id$ */
2 /* Copyright (c) 2010-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_DESKTOPICON_H
33 # define BROWSER_DESKTOPICON_H
34 
35 # include <gtk/gtk.h>
36 # include "desktop.h"
37 
38 
39 /* DesktopIcon */
40 /* types */
41 # ifndef Desktop
42 #  define Desktop Desktop
43 typedef struct _Desktop Desktop;
44 # endif
45 # ifndef DesktopIcon
46 #  define DesktopIcon DesktopIcon
47 typedef struct _DesktopIcon DesktopIcon;
48 # endif
49 typedef void (*DesktopIconCallback)(Desktop * desktop, gpointer data);
50 
51 
52 /* constants */
53 #define DESKTOPICON_ICON_SIZE	48
54 #define DESKTOPICON_MAX_HEIGHT	(DESKTOPICON_ICON_SIZE + 40)
55 #define DESKTOPICON_MAX_WIDTH	(DESKTOPICON_ICON_SIZE << 1)
56 #define DESKTOPICON_MIN_HEIGHT	DESKTOPICON_MAX_HEIGHT
57 #define DESKTOPICON_MIN_WIDTH	DESKTOPICON_MAX_WIDTH
58 
59 
60 /* functions */
61 DesktopIcon * desktopicon_new(Desktop * desktop, char const * name,
62 		char const * url);
63 DesktopIcon * desktopicon_new_application(Desktop * desktop, char const * path,
64 		char const * datadir);
65 DesktopIcon * desktopicon_new_category(Desktop * desktop, char const * name,
66 		char const * icon);
67 void desktopicon_delete(DesktopIcon * desktopicon);
68 
69 /* accessors */
70 gboolean desktopicon_get_first(DesktopIcon * desktopicon);
71 gboolean desktopicon_get_immutable(DesktopIcon * desktopicon);
72 gboolean desktopicon_get_isdir(DesktopIcon * desktopicon);
73 char const * desktopicon_get_name(DesktopIcon * desktopicon);
74 char const * desktopicon_get_path(DesktopIcon * desktopicon);
75 gboolean desktopicon_get_selected(DesktopIcon * desktopicon);
76 gboolean desktopicon_get_updated(DesktopIcon * desktopicon);
77 
78 # if GTK_CHECK_VERSION(3, 0, 0)
79 void desktopicon_set_background(DesktopIcon * desktopicon, GdkRGBA * color);
80 # else
81 void desktopicon_set_background(DesktopIcon * desktopicon, GdkColor * color);
82 # endif
83 void desktopicon_set_callback(DesktopIcon * desktopicon,
84 		DesktopIconCallback callback, gpointer data);
85 void desktopicon_set_confirm(DesktopIcon * desktopicon, gboolean confirm);
86 void desktopicon_set_executable(DesktopIcon * desktopicon, gboolean executable);
87 void desktopicon_set_first(DesktopIcon * desktopicon, gboolean first);
88 void desktopicon_set_font(DesktopIcon * desktopicon,
89 		PangoFontDescription * font);
90 # if GTK_CHECK_VERSION(3, 0, 0)
91 void desktopicon_set_foreground(DesktopIcon * desktopicon, GdkRGBA * color);
92 # else
93 void desktopicon_set_foreground(DesktopIcon * desktopicon, GdkColor * color);
94 # endif
95 void desktopicon_set_icon(DesktopIcon * desktopicon, GdkPixbuf * icon);
96 void desktopicon_set_immutable(DesktopIcon * desktopicon, gboolean immutable);
97 void desktopicon_set_selected(DesktopIcon * desktopicon, gboolean selected);
98 void desktopicon_set_updated(DesktopIcon * desktopicon, gboolean updated);
99 
100 /* useful */
101 void desktopicon_move(DesktopIcon * desktopicon, int x, int y);
102 void desktopicon_show(DesktopIcon * desktopicon);
103 
104 #endif /* !BROWSER_DESKTOPICON_H */
105