2016-05-04 19:24:41 +02:00
|
|
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
|
|
|
*****************************************************************************/
|
|
|
|
#pragma endregion
|
|
|
|
|
2016-03-10 00:07:55 +01:00
|
|
|
#ifndef _TEXTINPUTBUFFER_H_
|
|
|
|
#define _TEXTINPUTBUFFER_H_
|
|
|
|
|
|
|
|
#include "../common.h"
|
|
|
|
|
2016-05-12 23:57:40 +02:00
|
|
|
typedef struct textinputbuffer {
|
2016-03-10 00:07:55 +01:00
|
|
|
utf8 * buffer;
|
|
|
|
size_t max_size; // Maximum number of bytes (excluding null terminator)
|
|
|
|
size_t current_size; // Number of bytes (excluding null terminator)
|
|
|
|
|
|
|
|
uint32 length; // Number of codepoints
|
|
|
|
|
|
|
|
size_t selection_offset; // Selection start, in bytes
|
|
|
|
size_t selection_size; // Selection length in bytes
|
|
|
|
} textinputbuffer;
|
|
|
|
|
|
|
|
void textinputbuffer_init(textinputbuffer * tib, utf8 * buffer, size_t size);
|
|
|
|
void textinputbuffer_clear(textinputbuffer * tib);
|
|
|
|
void textinputbuffer_remove_selected(textinputbuffer * tib);
|
|
|
|
void textinputbuffer_insert_codepoint(textinputbuffer * tib, uint32 codepoint);
|
|
|
|
void textinputbuffer_insert(textinputbuffer * tib, utf8 * source);
|
|
|
|
void textinputbuffer_cursor_left(textinputbuffer * tib);
|
|
|
|
void textinputbuffer_cursor_right(textinputbuffer * tib);
|
|
|
|
void textinputbuffer_cursor_home(textinputbuffer * tib);
|
|
|
|
void textinputbuffer_cursor_end(textinputbuffer * tib);
|
|
|
|
void textinputbuffer_recalculate_length(textinputbuffer * tib);
|
|
|
|
|
|
|
|
#endif
|