-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnativeui.monkey
126 lines (101 loc) · 4.36 KB
/
nativeui.monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Strict
'This module was backed by CopperCircle, you should thank him with praise and gifts a plenty!
'version 3
' - added code to force all android with ui are run on ui thread.
' - added solution to repo
' - implemented lee's changes to android
' - added GetPickerIndex to find out the array index of teh selected item
' - added android native code for handling one picker/input/message at a time
' - tweaked lees text input code to clean things up
' - added picker routine
' - added confirm ok/cancel routine
' - tweaked existing message box routine
' - added code to handle "finished/done" being pressed when input box is showing
'version 2
' - refactored all native files to use different structure
' - added support for android ShowMessage
'version 1
' - first release working on iOS
#If TARGET = "ios" Or TARGET = "glfw" Or TARGET = "android"
'ios
Import "native/nativeui.${TARGET}.${LANG}"
Const INPUT_TYPE_STRING:= 0
Const INPUT_TYPE_INT:= 1
Const INPUT_TYPE_FLOAT:= 2
#If TARGET = "android"
Extern
Function InitNativeUI:Void() = "NativeUINative.InitNative"
Function ShowPicker:Void(values:String[], value:String = "") = "NativeUINative.ShowPickerNative"
Function HasPickerFinished:Bool() = "NativeUINative.HasPickerFinishedNative"
Function GetPickerValue:String() = "NativeUINative.GetPickerValueNative"
Function GetPickerIndex:Int() = "NativeUINative.GetPickerIndexNative"
Function ShowDatePicker:Void(type:String) = "NativeUINative.ShowDatePickerNative"
Function HasDatePickerFinished:Bool() = "NativeUINative.HasDatePickerFinishedNative"
Function GetDatePickerValue:String() = "NativeUINative.GetDatePickerValueNative"
Function ShowInput:Void(title:String, value:String = "", type:Int = INPUT_TYPE_STRING) = "NativeUINative.ShowInputNative"
Function ShowConfirm:Void(title:String) = "NativeUINative.ShowConfirmNative"
Function ShowMessage:Void(message:String, title:String = "", button:String = "OK") = "NativeUINative.ShowMessageNative"
Function HasInputFinished:Bool() = "NativeUINative.HasInputFinishedNative"
Function WasInputCancelled:Bool() = "NativeUINative.WasInputCancelledNative"
Function GetInputValue:String() = "NativeUINative.GetInputValueNative"
Public
#Else
Extern
Function InitNativeUI:Void() = "NativeUINative::InitNative"
Function ShowPicker:Void(values:String[], value:String = "") = "NativeUINative::ShowPickerNative"
Function HasPickerFinished:Bool() = "NativeUINative::HasPickerFinishedNative"
Function GetPickerValue:String() = "NativeUINative::GetPickerValueNative"
Function GetPickerIndex:Int() = "NativeUINative::GetPickerIndexNative"
Function ShowDatePicker:Void(type:String) = "NativeUINative::ShowDatePickerNative"
Function HasDatePickerFinished:Bool() = "NativeUINative::HasDatePickerFinishedNative"
Function GetDatePickerValue:String() = "NativeUINative::GetDatePickerValueNative"
Function ShowInput:Void(title:String, value:String = "", type:Int = INPUT_TYPE_STRING) = "NativeUINative::ShowInputNative"
Function ShowConfirm:Void(title:String) = "NativeUINative::ShowConfirmNative"
Function ShowMessage:Void(message:String, title:String = "", button:String = "OK") = "NativeUINative::ShowMessageNative"
Function HasInputFinished:Bool() = "NativeUINative::HasInputFinishedNative"
Function WasInputCancelled:Bool() = "NativeUINative::WasInputCancelledNative"
Function GetInputValue:String() = "NativeUINative::GetInputValueNative"
Public
#EndIf
#Else
'unsupported target
Const INPUT_TYPE_STRING := 0
Const INPUT_TYPE_INT:= 1
Const INPUT_TYPE_FLOAT:= 2
Function InitNativeUI:Void()
End
Function ShowPicker:Void(values:String[], value:String = "")
End
Function HasPickerFinished:Bool()
Return True
End
Function GetPickerValue:String()
Return ""
End
Function GetPickerIndex:Int()
Return -1
End
Function ShowDatePicker:Void(type:String)
End
Function HasDatePickerFinished:Bool()
Return True
End
Function GetDatePickerValue:String()
Return ""
End
Function ShowInput:Void(title:String, value:String = "", type:Int = INPUT_TYPE_STRING)
End
Function ShowConfirm:Void(title:String)
End
Function ShowMessage:Void(message:String, title:String = "", button:String = "OK")
End
Function HasInputFinished:Bool()
Return True
End
Function WasInputCancelled:Bool()
Return False
End
Function GetInputValue:String()
Return ""
End
#EndIf