1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // This file was generated by the CEF translator tool and should not edited 33 // by hand. See the translator.README.txt file in the tools directory for 34 // more information. 35 // 36 // $hash=798f84672412f544765b800d03cf284b066f818c$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/views/cef_textfield_delegate_capi.h" 44 #include "include/capi/views/cef_view_capi.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /// 51 // A Textfield supports editing of text. This control is custom rendered with no 52 // platform-specific code. Methods must be called on the browser process UI 53 // thread unless otherwise indicated. 54 /// 55 typedef struct _cef_textfield_t { 56 /// 57 // Base structure. 58 /// 59 cef_view_t base; 60 61 /// 62 // Sets whether the text will be displayed as asterisks. 63 /// 64 void(CEF_CALLBACK* set_password_input)(struct _cef_textfield_t* self, 65 int password_input); 66 67 /// 68 // Returns true (1) if the text will be displayed as asterisks. 69 /// 70 int(CEF_CALLBACK* is_password_input)(struct _cef_textfield_t* self); 71 72 /// 73 // Sets whether the text will read-only. 74 /// 75 void(CEF_CALLBACK* set_read_only)(struct _cef_textfield_t* self, 76 int read_only); 77 78 /// 79 // Returns true (1) if the text is read-only. 80 /// 81 int(CEF_CALLBACK* is_read_only)(struct _cef_textfield_t* self); 82 83 /// 84 // Returns the currently displayed text. 85 /// 86 // The resulting string must be freed by calling cef_string_userfree_free(). 87 cef_string_userfree_t(CEF_CALLBACK* get_text)(struct _cef_textfield_t* self); 88 89 /// 90 // Sets the contents to |text|. The cursor will be moved to end of the text if 91 // the current position is outside of the text range. 92 /// 93 void(CEF_CALLBACK* set_text)(struct _cef_textfield_t* self, 94 const cef_string_t* text); 95 96 /// 97 // Appends |text| to the previously-existing text. 98 /// 99 void(CEF_CALLBACK* append_text)(struct _cef_textfield_t* self, 100 const cef_string_t* text); 101 102 /// 103 // Inserts |text| at the current cursor position replacing any selected text. 104 /// 105 void(CEF_CALLBACK* insert_or_replace_text)(struct _cef_textfield_t* self, 106 const cef_string_t* text); 107 108 /// 109 // Returns true (1) if there is any selected text. 110 /// 111 int(CEF_CALLBACK* has_selection)(struct _cef_textfield_t* self); 112 113 /// 114 // Returns the currently selected text. 115 /// 116 // The resulting string must be freed by calling cef_string_userfree_free(). 117 cef_string_userfree_t(CEF_CALLBACK* get_selected_text)( 118 struct _cef_textfield_t* self); 119 120 /// 121 // Selects all text. If |reversed| is true (1) the range will end at the 122 // logical beginning of the text; this generally shows the leading portion of 123 // text that overflows its display area. 124 /// 125 void(CEF_CALLBACK* select_all)(struct _cef_textfield_t* self, int reversed); 126 127 /// 128 // Clears the text selection and sets the caret to the end. 129 /// 130 void(CEF_CALLBACK* clear_selection)(struct _cef_textfield_t* self); 131 132 /// 133 // Returns the selected logical text range. 134 /// 135 cef_range_t(CEF_CALLBACK* get_selected_range)(struct _cef_textfield_t* self); 136 137 /// 138 // Selects the specified logical text range. 139 /// 140 void(CEF_CALLBACK* select_range)(struct _cef_textfield_t* self, 141 const cef_range_t* range); 142 143 /// 144 // Returns the current cursor position. 145 /// 146 size_t(CEF_CALLBACK* get_cursor_position)(struct _cef_textfield_t* self); 147 148 /// 149 // Sets the text color. 150 /// 151 void(CEF_CALLBACK* set_text_color)(struct _cef_textfield_t* self, 152 cef_color_t color); 153 154 /// 155 // Returns the text color. 156 /// 157 cef_color_t(CEF_CALLBACK* get_text_color)(struct _cef_textfield_t* self); 158 159 /// 160 // Sets the selection text color. 161 /// 162 void(CEF_CALLBACK* set_selection_text_color)(struct _cef_textfield_t* self, 163 cef_color_t color); 164 165 /// 166 // Returns the selection text color. 167 /// 168 cef_color_t(CEF_CALLBACK* get_selection_text_color)( 169 struct _cef_textfield_t* self); 170 171 /// 172 // Sets the selection background color. 173 /// 174 void(CEF_CALLBACK* set_selection_background_color)( 175 struct _cef_textfield_t* self, 176 cef_color_t color); 177 178 /// 179 // Returns the selection background color. 180 /// 181 cef_color_t(CEF_CALLBACK* get_selection_background_color)( 182 struct _cef_textfield_t* self); 183 184 /// 185 // Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>", 186 // where: - FONT_FAMILY_LIST is a comma-separated list of font family names, - 187 // STYLES is an optional space-separated list of style names (case-sensitive 188 // "Bold" and "Italic" are supported), and 189 // - SIZE is an integer font size in pixels with the suffix "px". 190 // 191 // Here are examples of valid font description strings: - "Arial, Helvetica, 192 // Bold Italic 14px" - "Arial, 14px" 193 /// 194 void(CEF_CALLBACK* set_font_list)(struct _cef_textfield_t* self, 195 const cef_string_t* font_list); 196 197 /// 198 // Applies |color| to the specified |range| without changing the default 199 // color. If |range| is NULL the color will be set on the complete text 200 // contents. 201 /// 202 void(CEF_CALLBACK* apply_text_color)(struct _cef_textfield_t* self, 203 cef_color_t color, 204 const cef_range_t* range); 205 206 /// 207 // Applies |style| to the specified |range| without changing the default 208 // style. If |add| is true (1) the style will be added, otherwise the style 209 // will be removed. If |range| is NULL the style will be set on the complete 210 // text contents. 211 /// 212 void(CEF_CALLBACK* apply_text_style)(struct _cef_textfield_t* self, 213 cef_text_style_t style, 214 int add, 215 const cef_range_t* range); 216 217 /// 218 // Returns true (1) if the action associated with the specified command id is 219 // enabled. See additional comments on execute_command(). 220 /// 221 int(CEF_CALLBACK* is_command_enabled)(struct _cef_textfield_t* self, 222 cef_text_field_commands_t command_id); 223 224 /// 225 // Performs the action associated with the specified command id. 226 /// 227 void(CEF_CALLBACK* execute_command)(struct _cef_textfield_t* self, 228 cef_text_field_commands_t command_id); 229 230 /// 231 // Clears Edit history. 232 /// 233 void(CEF_CALLBACK* clear_edit_history)(struct _cef_textfield_t* self); 234 235 /// 236 // Sets the placeholder text that will be displayed when the Textfield is 237 // NULL. 238 /// 239 void(CEF_CALLBACK* set_placeholder_text)(struct _cef_textfield_t* self, 240 const cef_string_t* text); 241 242 /// 243 // Returns the placeholder text that will be displayed when the Textfield is 244 // NULL. 245 /// 246 // The resulting string must be freed by calling cef_string_userfree_free(). 247 cef_string_userfree_t(CEF_CALLBACK* get_placeholder_text)( 248 struct _cef_textfield_t* self); 249 250 /// 251 // Sets the placeholder text color. 252 /// 253 void(CEF_CALLBACK* set_placeholder_text_color)(struct _cef_textfield_t* self, 254 cef_color_t color); 255 256 /// 257 // Set the accessible name that will be exposed to assistive technology (AT). 258 /// 259 void(CEF_CALLBACK* set_accessible_name)(struct _cef_textfield_t* self, 260 const cef_string_t* name); 261 } cef_textfield_t; 262 263 /// 264 // Create a new Textfield. 265 /// 266 CEF_EXPORT cef_textfield_t* cef_textfield_create( 267 struct _cef_textfield_delegate_t* delegate); 268 269 #ifdef __cplusplus 270 } 271 #endif 272 273 #endif // CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_ 274