entry: add text selection abilities. macos part

This commit is contained in:
Rustam Gamidov 2020-04-09 10:11:43 +03:00
parent 0a2cfd1238
commit dde2483e93
No known key found for this signature in database
GPG Key ID: 093B162FB3DE6996
1 changed files with 11 additions and 0 deletions

View File

@ -178,6 +178,17 @@ void uiEntrySetText(uiEntry *e, const char *text)
// don't queue the control for resize; entry sizes are independent of their contents // don't queue the control for resize; entry sizes are independent of their contents
} }
void uiEntrySelectText(uiEntry *e, int start, int end)
{
NSRange range = {start, end - start};
[e->textfield.currentEditor setSelectedRange:range];
}
void uiEntrySelectAllText(uiEntry *e)
{
[e->textfield selectText:cWindow];
}
void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *, void *), void *data) void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *, void *), void *data)
{ {
e->onChanged = f; e->onChanged = f;