summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-dev-kit/include/kodi/c-api/general.h
blob: 8518a96e544fa0635fd88b5599c8eaa5d0eb565c (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#ifndef C_API_GENERAL_H
#define C_API_GENERAL_H

#include <stdbool.h>

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

  //============================================================================
  /// \ingroup cpp_kodi_Defs
  /// @brief For kodi::CurrentKeyboardLayout used defines
  ///
  typedef enum StdKbButtons
  {
    /// The quantity of buttons per row on Kodi's standard keyboard
    STD_KB_BUTTONS_PER_ROW = 20,
    /// The quantity of rows on Kodi's standard keyboard
    STD_KB_BUTTONS_MAX_ROWS = 4,
    /// Keyboard layout type, this for initial standard
    STD_KB_MODIFIER_KEY_NONE = 0x00,
    /// Keyboard layout type, this for shift controled layout (uppercase)
    STD_KB_MODIFIER_KEY_SHIFT = 0x01,
    /// Keyboard layout type, this to show symbols
    STD_KB_MODIFIER_KEY_SYMBOL = 0x02
  } StdKbButtons;
  //----------------------------------------------------------------------------

  //============================================================================
  /// \ingroup cpp_kodi_Defs
  /// @brief For kodi::QueueNotification() used message types
  ///
  typedef enum QueueMsg
  {
    /// Show info notification message
    QUEUE_INFO,
    /// Show warning notification message
    QUEUE_WARNING,
    /// Show error notification message
    QUEUE_ERROR,
    /// Show with own given image and parts if set on values
    QUEUE_OWN_STYLE
  } QueueMsg;
  //----------------------------------------------------------------------------

  //============================================================================
  /// \ingroup cpp_kodi_Defs
  /// @brief Format codes to get string from them.
  ///
  /// Used on kodi::GetLanguage().
  ///
  typedef enum LangFormats
  {
    /// two letter code as defined in ISO 639-1
    LANG_FMT_ISO_639_1,
    /// three letter code as defined in ISO 639-2/T or ISO 639-2/B
    LANG_FMT_ISO_639_2,
    /// full language name in English
    LANG_FMT_ENGLISH_NAME
  } LangFormats;
  //----------------------------------------------------------------------------

  /*
   * For interface between add-on and kodi.
   *
   * This structure defines the addresses of functions stored inside Kodi which
   * are then available for the add-on to call
   *
   * All function pointers there are used by the C++ interface functions below.
   * You find the set of them on xbmc/addons/interfaces/General.cpp
   *
   * Note: For add-on development itself this is not needed
   */
  typedef struct AddonKeyboardKeyTable
  {
    char* keys[STD_KB_BUTTONS_MAX_ROWS][STD_KB_BUTTONS_PER_ROW];
  } AddonKeyboardKeyTable;
  typedef struct AddonToKodiFuncTable_kodi
  {
    char* (*get_addon_info)(void* kodiBase, const char* id);
    bool (*open_settings_dialog)(void* kodiBase);
    char* (*unknown_to_utf8)(void* kodiBase, const char* source, bool* ret, bool failOnBadChar);
    char* (*get_localized_string)(void* kodiBase, long label_id);
    char* (*get_language)(void* kodiBase, int format, bool region);
    bool (*queue_notification)(void* kodiBase,
                               int type,
                               const char* header,
                               const char* message,
                               const char* imageFile,
                               unsigned int displayTime,
                               bool withSound,
                               unsigned int messageTime);
    void (*get_md5)(void* kodiBase, const char* text, char* md5);
    char* (*get_temp_path)(void* kodiBase);
    char* (*get_region)(void* kodiBase, const char* id);
    void (*get_free_mem)(void* kodiBase, long* free, long* total, bool as_bytes);
    int (*get_global_idle_time)(void* kodiBase);
    bool (*is_addon_avilable)(void* kodiBase, const char* id, char** version, bool* enabled);
    void (*kodi_version)(void* kodiBase,
                         char** compile_name,
                         int* major,
                         int* minor,
                         char** revision,
                         char** tag,
                         char** tagversion);
    char* (*get_current_skin_id)(void* kodiBase);
    bool (*get_keyboard_layout)(void* kodiBase,
                                char** layout_name,
                                int modifier_key,
                                struct AddonKeyboardKeyTable* layout);
    bool (*change_keyboard_layout)(void* kodiBase, char** layout_name);
  } AddonToKodiFuncTable_kodi;


#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

#endif /* !C_API_GENERAL_H */