29 lines
934 B
Plaintext
29 lines
934 B
Plaintext
#import "kryon.h"
|
|
|
|
app "Kryon Text Editor" {
|
|
size 800 600
|
|
fps 60
|
|
font examples
|
|
theme THEME_SKY light
|
|
}
|
|
|
|
state {
|
|
text_value: [512] char = "Edit this text."
|
|
cursor: int = 15
|
|
focused: int = 0
|
|
scroll: int = 0
|
|
}
|
|
|
|
screen TextEditorExample(viewport: Rectangle) {
|
|
Background(GetThemeBackground())
|
|
TextArea((TextAreaProps){{40,70,520,180},text_value,sizeof(text_value),&cursor,&focused,&scroll,500,UI_TEXT_16,6,401,"Write here",UI_SYNTAX_NONE,{0},NULL,NULL})
|
|
Text("Ctrl/Cmd+C,X,and V work in the text area.", 40, 260, UI_TEXT_16, GetThemeText())
|
|
if GenericButton(101, 40, 300, 110, 34, "Copy", UI_BUTTON_STYLE_SECONDARY, 0, NULL) {
|
|
SetUIClipboardTextValue(text_value)
|
|
}
|
|
if GenericButton(102, 170, 300, 110, 34, "Paste", UI_BUTTON_STYLE_SECONDARY, 0, NULL) {
|
|
clip: const char * = GetUIClipboardTextValue()
|
|
snprintf(text_value,sizeof(text_value),"%s",clip)
|
|
}
|
|
}
|