1/*
2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26/**
27 * @file    ewk_file_chooser_request.h
28 * @brief   Describes the Ewk File Chooser API.
29 */
30
31#ifndef ewk_file_chooser_request_h
32#define ewk_file_chooser_request_h
33
34#include <Eina.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 * Declare Ewk_File_Chooser_Request as Ewk_Object.
42 *
43 * @see Ewk_Object
44 */
45typedef struct EwkObject Ewk_File_Chooser_Request;
46
47/**
48 * Queries if it is allowed to select multiple files or not.
49 *
50 * @param request request object to query
51 *
52 * @return @c EINA_TRUE if it is allowed to select multiple files,
53 *         @c EINA_FALSE otherwise
54 */
55EAPI Eina_Bool ewk_file_chooser_request_allow_multiple_files_get(const Ewk_File_Chooser_Request *request);
56
57/**
58 * Queries the list of accepted MIME types.
59 *
60 * Possible MIME types are:
61 * - "audio\/\*": All sound files are accepted
62 * - "video\/\*": All video files are accepted
63 * - "image\/\*": All image files are accepted
64 * - standard IANA MIME type (see http://www.iana.org/assignments/media-types/ for a complete list)
65 *
66 * @param request request object to query
67 *
68 * @return The list of accepted MIME types. The list items are guaranteed to be stringshared.
69 * The caller needs to free the list and its items after use
70 */
71EAPI Eina_List *ewk_file_chooser_request_accepted_mimetypes_get(const Ewk_File_Chooser_Request *request);
72
73/**
74 * Cancels the file chooser request.
75 *
76 * @param request request object to cancel
77 *
78 * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise
79 */
80EAPI Eina_Bool ewk_file_chooser_request_cancel(Ewk_File_Chooser_Request *request);
81
82/**
83 * Sets the files chosen by the user.
84 *
85 * @param request request object to update
86 *
87 * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise
88 *
89 * @see ewk_file_chooser_request_file_choose()
90 */
91EAPI Eina_Bool ewk_file_chooser_request_files_choose(Ewk_File_Chooser_Request *request, const Eina_List *chosen_files);
92
93/**
94 * Sets the file chosen by the user.
95 *
96 * This is a convenience function in case only one file needs to be set.
97 *
98 * @param request request object to update
99 *
100 * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise
101 *
102 * @see ewk_file_chooser_request_files_choose()
103 */
104EAPI Eina_Bool ewk_file_chooser_request_file_choose(Ewk_File_Chooser_Request *request, const char *chosen_file);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* ewk_file_chooser_request_h */
111