added .masked and destructor for EditState
This commit is contained in:
@@ -156,6 +156,7 @@ typedef struct TimEvent {
|
||||
} TimEvent;
|
||||
|
||||
typedef struct TimEditState {
|
||||
bool masked; // if true prints '*' instead of buffer content
|
||||
i32 cursor; // cursor position (utf8)
|
||||
i32 length; // string length (utf8)
|
||||
i32 capacity; // buffer size in bytes
|
||||
@@ -273,12 +274,21 @@ bool tim_checkbox(cstr txt, i32* state, i32 x, i32 y, i32 w, TimStyle style);
|
||||
bool tim_radiobutton(cstr txt, i32* state, i32 v, i32 x, i32 y, i32 w, TimStyle style);
|
||||
|
||||
/// text edit - value in state
|
||||
/// @param e persistent edit state, use TimEditState_init() to create new state
|
||||
/// @param e persistent edit state, use TimEditState_construct() to create new state
|
||||
/// @param color frame, background, text
|
||||
/// @return key id or 0
|
||||
TimKey tim_edit(TimEditState* e, i32 x, i32 y, i32 w, TimStyle style);
|
||||
|
||||
void TimEditState_init(TimEditState* e, i32 capacity, cstr initial_content);
|
||||
/// @param e uninitialized state
|
||||
/// @param capacity in bytes
|
||||
/// @param initial_content may be NULL
|
||||
void TimEditState_construct(TimEditState* e, i32 capacity, cstr initial_content);
|
||||
|
||||
static inline void TimEditState_destroy(TimEditState* e) {
|
||||
if(!e)
|
||||
return;
|
||||
free(e->s);
|
||||
}
|
||||
|
||||
void TimEditState_insert(TimEditState* e, cstr s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user