|
| 1 | +/* |
| 2 | + * Vala bindings for xkbregistry |
| 3 | + * Copyright 2022 Corentin Noël <corentin.noel@collabora.com> |
| 4 | + * |
| 5 | + * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | + * copy of this software and associated documentation files (the "Software"), |
| 7 | + * to deal in the Software without restriction, including without limitation |
| 8 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | + * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | + * Software is furnished to do so, subject to the following conditions: |
| 11 | + * |
| 12 | + * The above copyright notice and this permission notice (including the next |
| 13 | + * paragraph) shall be included in all copies or substantial portions of the |
| 14 | + * Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | + * DEALINGS IN THE SOFTWARE. |
| 23 | + */ |
| 24 | + |
| 25 | +[CCode (cheader_filename = "xkbcommon/xkbregistry.h", cprefix = "rxkb_", lower_case_cprefix = "rxkb_")] |
| 26 | +namespace Rxkb { |
| 27 | + [CCode (cname = "struct rxkb_context", ref_function = "rxkb_context_ref", unref_function = "rxkb_context_unref", has_type_id = false)] |
| 28 | + [Compact] |
| 29 | + public class Context { |
| 30 | + public Context (Rxkb.ContextFlags flags); |
| 31 | + public void set_log_level (Rxkb.LogLevel level); |
| 32 | + public Rxkb.LogLevel get_log_level (); |
| 33 | + public bool parse (string ruleset); |
| 34 | + public bool parse_default_ruleset (); |
| 35 | + public bool include_path_append (string path); |
| 36 | + public bool include_path_append_default (); |
| 37 | + public void set_log_fn (LogFn log_fn); |
| 38 | + public void set_user_data (void* user_data); |
| 39 | + public void* get_user_data (); |
| 40 | + [CCode (cname = "rxkb_model_first")] |
| 41 | + public unowned Rxkb.Model? get_first_model (); |
| 42 | + [CCode (cname = "rxkb_layout_first")] |
| 43 | + public unowned Rxkb.Layout? get_first_layout (); |
| 44 | + [CCode (cname = "rxkb_option_group_first")] |
| 45 | + public unowned Rxkb.OptionGroup? get_first_option_group (); |
| 46 | + public unowned Rxkb.Context @ref (); |
| 47 | + public void unref (); |
| 48 | + } |
| 49 | + |
| 50 | + [CCode (cname = "struct rxkb_model", ref_function = "rxkb_model_ref", unref_function = "rxkb_model_unref", has_type_id = false)] |
| 51 | + [Compact] |
| 52 | + public class Model { |
| 53 | + public unowned Rxkb.Model? next (); |
| 54 | + public unowned string get_name (); |
| 55 | + public unowned string? get_description (); |
| 56 | + public unowned string? get_vendor (); |
| 57 | + public Rxkb.Popularity get_popularity (); |
| 58 | + public unowned Rxkb.Model @ref (); |
| 59 | + public void unref (); |
| 60 | + } |
| 61 | + |
| 62 | + [CCode (cname = "struct rxkb_layout", ref_function = "rxkb_layout_ref", unref_function = "rxkb_layout_unref", has_type_id = false)] |
| 63 | + [Compact] |
| 64 | + public class Layout { |
| 65 | + public unowned Rxkb.Layout? next (); |
| 66 | + public unowned string get_name (); |
| 67 | + public unowned string? get_description (); |
| 68 | + public unowned string? get_variant (); |
| 69 | + public unowned string? get_brief (); |
| 70 | + [CCode (cname = "rxkb_layout_get_iso639_first")] |
| 71 | + public unowned Rxkb.Iso639Code? get_first_iso639 (); |
| 72 | + [CCode (cname = "rxkb_layout_get_iso3166_first")] |
| 73 | + public unowned Rxkb.Iso3166Code? get_first_iso3166 (); |
| 74 | + public unowned Rxkb.Layout @ref (); |
| 75 | + public void unref (); |
| 76 | + } |
| 77 | + |
| 78 | + [CCode (cname = "struct rxkb_option_group", ref_function = "rxkb_option_group_ref", unref_function = "rxkb_option_group_unref", has_type_id = false)] |
| 79 | + [Compact] |
| 80 | + public class OptionGroup { |
| 81 | + public unowned Rxkb.OptionGroup? next (); |
| 82 | + public unowned string get_name (); |
| 83 | + public unowned string? get_description (); |
| 84 | + public bool allows_multiple (); |
| 85 | + public Rxkb.Popularity get_popularity (); |
| 86 | + [CCode (cname = "rxkb_option_first")] |
| 87 | + public unowned Rxkb.Option? get_first_option (); |
| 88 | + public unowned Rxkb.OptionGroup @ref (); |
| 89 | + public void unref (); |
| 90 | + } |
| 91 | + |
| 92 | + [CCode (cname = "struct rxkb_option", ref_function = "rxkb_option_ref", unref_function = "rxkb_option_unref", has_type_id = false)] |
| 93 | + [Compact] |
| 94 | + public class Option { |
| 95 | + public unowned Rxkb.Option? next (); |
| 96 | + public unowned string get_name (); |
| 97 | + public unowned string? get_description (); |
| 98 | + public unowned string? get_brief (); |
| 99 | + public Rxkb.Popularity get_popularity (); |
| 100 | + public unowned Rxkb.Option @ref (); |
| 101 | + public void unref (); |
| 102 | + } |
| 103 | + |
| 104 | + [CCode (cname = "struct rxkb_iso639_code", ref_function = "rxkb_iso639_code_ref", unref_function = "rxkb_iso639_code_unref", has_type_id = false)] |
| 105 | + [Compact] |
| 106 | + public class Iso639Code { |
| 107 | + public unowned Rxkb.Iso639Code? next (); |
| 108 | + public unowned string get_code (); |
| 109 | + public unowned Rxkb.Iso639Code @ref (); |
| 110 | + public void unref (); |
| 111 | + } |
| 112 | + |
| 113 | + [CCode (cname = "struct rxkb_iso3166_code", ref_function = "rxkb_iso3166_code_ref", unref_function = "rxkb_iso3166_code_unref", has_type_id = false)] |
| 114 | + [Compact] |
| 115 | + public class Iso3166Code { |
| 116 | + public unowned Rxkb.Iso3166Code? next (); |
| 117 | + public unowned string get_code (); |
| 118 | + public unowned Rxkb.Iso3166Code @ref (); |
| 119 | + public void unref (); |
| 120 | + } |
| 121 | + |
| 122 | + [CCode (cname = "enum rxkb_context_flags", cprefix = "RXKB_CONTEXT_", has_type_id = false)] |
| 123 | + [Flags] |
| 124 | + public enum ContextFlags { |
| 125 | + NO_FLAGS, |
| 126 | + NO_DEFAULT_INCLUDES, |
| 127 | + LOAD_EXOTIC_RULES |
| 128 | + } |
| 129 | + |
| 130 | + [CCode (cname = "enum rxkb_popularity", cprefix = "RXKB_POPULARITY_", has_type_id = false)] |
| 131 | + public enum Popularity { |
| 132 | + STANDARD, |
| 133 | + EXOTIC |
| 134 | + } |
| 135 | + |
| 136 | + [CCode (cname = "enum rxkb_log_level", cprefix = "RXKB_LOG_LEVEL_", has_type_id = false)] |
| 137 | + public enum LogLevel { |
| 138 | + CRITICAL, |
| 139 | + ERROR, |
| 140 | + WARNING, |
| 141 | + INFO, |
| 142 | + DEBUG |
| 143 | + } |
| 144 | + |
| 145 | + [CCode (has_target = false, has_typedef = false)] |
| 146 | + public delegate void LogFn (Rxkb.Context ctx, Rxkb.LogLevel level, string format, va_list args); |
| 147 | +} |
0 commit comments