Home | History | Annotate | Download | only in ewk
      1 /*
      2     Copyright (C) 2010 ProFUSION embedded systems
      3     Copyright (C) 2010 Samsung Electronics
      4 
      5     This library is free software; you can redistribute it and/or
      6     modify it under the terms of the GNU Library General Public
      7     License as published by the Free Software Foundation; either
      8     version 2 of the License, or (at your option) any later version.
      9 
     10     This library is distributed in the hope that it will be useful,
     11     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13     Library General Public License for more details.
     14 
     15     You should have received a copy of the GNU Library General Public License
     16     along with this library; see the file COPYING.LIB.  If not, write to
     17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18     Boston, MA 02110-1301, USA.
     19 */
     20 
     21 /**
     22  * @file    ewk_contextmenu.h
     23  * @brief   Describes the context menu API.
     24  */
     25 
     26 #ifndef ewk_contextmenu_h
     27 #define ewk_contextmenu_h
     28 
     29 #include "ewk_eapi.h"
     30 
     31 #include <Eina.h>
     32 #include <Evas.h>
     33 
     34 #ifdef __cplusplus
     35 extern "C" {
     36 #endif
     37 
     38 /**
     39  * \enum    _Ewk_Context_Menu_Action
     40  * @brief   Provides the actions of items for the context menu.
     41  * @info    Keep this in sync with ContextMenuItem.h
     42  */
     43 enum _Ewk_Context_Menu_Action {
     44     EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION = 0, // this item is not actually in web_uidelegate.h
     45     EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW = 1,
     46     EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK,
     47     EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD,
     48     EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW,
     49     EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK,
     50     EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD,
     51     EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW,
     52     EWK_CONTEXT_MENU_ITEM_TAG_COPY,
     53     EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK,
     54     EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD,
     55     EWK_CONTEXT_MENU_ITEM_TAG_STOP,
     56     EWK_CONTEXT_MENU_ITEM_TAG_RELOAD,
     57     EWK_CONTEXT_MENU_ITEM_TAG_CUT,
     58     EWK_CONTEXT_MENU_ITEM_TAG_PASTE,
     59     EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS,
     60     EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND,
     61     EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING,
     62     EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING,
     63     EWK_CONTEXT_MENU_ITEM_TAG_OTHER,
     64     EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT,
     65     EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB,
     66     EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY,
     67     EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION,
     68     EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE,
     69     EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN,
     70     EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT,
     71     EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE,
     72     EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE,
     73     EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES,
     74     EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS,
     75     EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE,
     76     EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE,
     77     EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK = 2000,
     78     EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR,
     79     EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, /**< spelling or spelling/grammar sub-menu */
     80     EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL,
     81     EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING,
     82     EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING,
     83     EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING,
     84     EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, /**< font sub-menu */
     85     EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS,
     86     EWK_CONTEXT_MENU_ITEM_TAG_BOLD,
     87     EWK_CONTEXT_MENU_ITEM_TAG_ITALIC,
     88     EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE,
     89     EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE,
     90     EWK_CONTEXT_MENU_ITEM_TAG_STYLES,
     91     EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS,
     92     EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, /**< speech sub-menu */
     93     EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING,
     94     EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING,
     95     EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, /**< writing direction sub-menu */
     96     EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION,
     97     EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT,
     98     EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT,
     99     EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING,
    100     EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING,
    101     // EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT, /**< This feature is disabled in WebKit-EFL - it is a subject to INSPECTOR build variable */
    102     EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, /**< text direction sub-menu */
    103     EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT,
    104     EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
    105     EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
    106     EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
    107     EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
    108     EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
    109     EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
    110     EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
    111     EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
    112     EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
    113     EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG = 5000,
    114     EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION = 5998,
    115     EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG = 5999,
    116     EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
    117 };
    118 /** Creates a type name for _Ewk_Context_Menu_Action */
    119 typedef enum _Ewk_Context_Menu_Action Ewk_Context_Menu_Action;
    120 
    121 /**
    122  * \enum    _Ewk_Context_Menu_Item_Type
    123  * @brief   Defines the types of the items for the context menu.
    124  * @info    Keep this in sync with ContextMenuItem.h
    125  */
    126 enum _Ewk_Context_Menu_Item_Type {
    127     EWK_ACTION_TYPE,
    128     EWK_CHECKABLE_ACTION_TYPE,
    129     EWK_SEPARATOR_TYPE,
    130     EWK_SUBMENU_TYPE
    131 };
    132 /** Creates a type name for _Ewk_Context_Menu_Item_Type */
    133 typedef enum _Ewk_Context_Menu_Item_Type    Ewk_Context_Menu_Item_Type;
    134 
    135 /** Creates a type name for _Ewk_Context_Menu */
    136 typedef struct _Ewk_Context_Menu            Ewk_Context_Menu;
    137 
    138 /** Creates a type name for _Ewk_Context_Menu_Item */
    139 typedef struct _Ewk_Context_Menu_Item       Ewk_Context_Menu_Item;
    140 
    141 
    142 
    143 /************************** Exported functions ***********************/
    144 
    145 EAPI void                        ewk_context_menu_ref(Ewk_Context_Menu* menu);
    146 EAPI void                        ewk_context_menu_unref(Ewk_Context_Menu* menu);
    147 EAPI Eina_Bool                   ewk_context_menu_destroy(Ewk_Context_Menu* menu);
    148 
    149 EAPI const Eina_List*            ewk_context_menu_item_list_get(Ewk_Context_Menu* o);
    150 
    151 EAPI Ewk_Context_Menu_Item*      ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Action action, Ewk_Context_Menu* submenu, const char* title, Eina_Bool checked, Eina_Bool enabled);
    152 EAPI void                        ewk_context_menu_item_free(Ewk_Context_Menu_Item* item);
    153 EAPI Eina_Bool                   ewk_context_menu_item_select(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item);
    154 EAPI Ewk_Context_Menu_Item_Type  ewk_context_menu_item_type_get(Ewk_Context_Menu_Item* o);
    155 EAPI Eina_Bool                   ewk_context_menu_item_type_set(Ewk_Context_Menu_Item* o, Ewk_Context_Menu_Item_Type type);
    156 EAPI Ewk_Context_Menu_Action     ewk_context_menu_item_action_get(Ewk_Context_Menu_Item* o);
    157 EAPI Eina_Bool                   ewk_context_menu_item_action_set(Ewk_Context_Menu_Item* o, Ewk_Context_Menu_Action action);
    158 EAPI const char*                 ewk_context_menu_item_title_get(Ewk_Context_Menu_Item* o);
    159 EAPI const char*                 ewk_context_menu_item_title_set(Ewk_Context_Menu_Item* o, const char* title);
    160 EAPI Eina_Bool                   ewk_context_menu_item_checked_get(Ewk_Context_Menu_Item* o);
    161 EAPI Eina_Bool                   ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item* o, Eina_Bool checked);
    162 EAPI Eina_Bool                   ewk_context_menu_item_enabled_get(Ewk_Context_Menu_Item* o);
    163 EAPI Eina_Bool                   ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item* o, Eina_Bool enabled);
    164 
    165 #ifdef __cplusplus
    166 }
    167 #endif
    168 #endif // ewk_contextmenu_h
    169