-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnui_i_main.nss
2732 lines (2252 loc) · 107 KB
/
nui_i_main.nss
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// ----------------------------------------------------------------------------
/// @file nui_i_main.nss
/// @author Ed Burke (tinygiant98) <[email protected]>
/// @brief NUI Form Creation and Management System
/// ----------------------------------------------------------------------------
#include "util_i_csvlists"
#include "util_i_color"
#include "nui_c_config"
#include "nw_inc_nui"
// -----------------------------------------------------------------------------
// Constants
// -----------------------------------------------------------------------------
const string NUI_VERSION = "0.5.0";
const string NUI_DATABASE = "nui_form_data";
const int NUI_ORIENTATION_ROW = 0;
const int NUI_ORIENTATION_COLUMN = 1;
const int NUI_DRAW_ABOVE = 1;
const int NUI_DRAW_BELOW = -1;
const int NUI_DRAW_ALWAYS = 0;
const int NUI_DRAW_MOUSEOFF = 1;
const int NUI_DRAW_MOUSEHOVER = 2;
const int NUI_DRAW_MOUSELEFT = 3;
const int NUI_DRAW_MOUSERIGHT = 4;
const int NUI_DRAW_MOUSEMIDDLE = 5;
const int NUI_CHART_LINE = 0;
const int NUI_CHART_BAR = 1;
const string NUI_DEFINE = "DefineForm";
const string NUI_BIND = "BindForm";
const string NUI_EVENT_NUI = "HandleNUIEvents";
const string NUI_EVENT_MOD = "HandleModuleEvents";
const string NUI_OBJECT = "NUI_OBJECT";
const string NUI_FUNCTION = "NUI_FUNCTION";
const string NUI_ARGS = "NUI_ARGS";
const int NUI_FI_EVENT_UPDATE_FORMS = 100001;
const int NUI_FI_EVENT_UPDATE_EVENTS = 100002;
json jTrue = JSON_TRUE;
json jFalse = JSON_FALSE;
const int NUI_USE_CAMPAIGN_DATABASE = FALSE;
const string NUI_FORMFILE_PREFIX = "nui_f_";
struct NUIEventData {
object oPC; // PC object interacting with the form
int nToken; // Subject form token
string sFormID; // Form ID as assigned during the form definition process
string sEvent; // Event - mouseup, click, etc.
string sControlID; // Control ID as assigned during the form definition process
int nIndex; // Index of control in array, if the control is in an array (listbox)
json jPayload; // Event payload, if it exists
};
// -----------------------------------------------------------------------------
// NUI/JSON Helpers
// -----------------------------------------------------------------------------
/// @brief Formats a json-parseable string.
/// @param s String value.
string nuiString(string s);
/// @brief Formats a json-parseable integer.
/// @param n Integer value.
string nuiInt(int n);
/// @brief Formats a json-parseable float.
/// @param f Float value.
string nuiFloat(float f);
/// @brief Formats a json-parseable boolean.
/// @param b Boolean value.
string nuiBool(int b);
/// @brief Creates a json-parseable object for a data bind.
/// @param sBind Bind variable.
/// @param bWatch TRUE to set a bind watch.
string nuiBind(string sBind, int bWatch = FALSE);
/// @brief Creates a json-parseable object for referencing strings by StringRef.
/// @param nStrRef StringRef value.
string nuiStrRef(int nStrRef);
/// @brief Creates a json-parseable object for a null value.
string nuiNull();
// -----------------------------------------------------------------------------
// Form Definition, Controls, Custom JSON Structures, Drawing Elements
// -----------------------------------------------------------------------------
/// @brief Must be called during the module load process. Initializes the
/// required nui database tables and loads all available formfiles.
/// Automatically called by the system during the OnModuleLoad event
/// if not specifically called prior.
void NUI_Initialize();
/// @brief Creates a form template with all required form properties set to
/// default values:
/// accepts_input: true
/// border: true
/// closable: true
/// collapsible: true
/// geometry: bind:"geometry"
/// resizable: true
/// title: bind:"title"
/// transparent: false
/// @param sID Form ID.
/// @param sVersion A local version set into the form's json structure as
/// "local_version". This is different than the nui system's required
/// version, which should never be changed.
void NUI_CreateForm(string sID, string sVersion = "");
/// @brief Define a subform.
/// @param sID Subform ID.
/// @warning Must be used only during the form definition process and after
/// definition of the main form.
void NUI_CreateSubform(string sID);
/// @brief Define a point based on a single coordinate set.
/// @param x X-coordinate.
/// @param y Y-coordinate.
/// @returns A json-parseable string representing a single coordinate set.
/// {"x":x.x, "y":y.y}
string NUI_DefinePoint(float x, float y);
/// @brief Get an array of line endpoint coordinates.
/// @param x1 Start point x-coordinate.
/// @param y1 Start point y-coordinate.
/// @param x2 End point x-coordinate.
/// @param y2 End point y-coordinate.
/// @returns A json-parseable string representing an array of coordinates
/// that can be used in NUI_DrawLine().
/// [x1.x, y1.y, x2.x, y2.y]
string NUI_GetLinePoints(float x1, float y1, float x2, float y2);
/// @brief Add a single coordinate set to an empty or existing coordinate array.
/// @param sPoints Coordinate array. Can be a pre-existing arry as created by
/// NUI_GetLinePoints, an empty array string ("[]"), or an empty string ("").
/// @param x X-coordinate.
/// @param y Y-coordinate.
/// @returns A json-parseable string representing an array of coordinates
/// that can be used in NUI_DrawLine().
/// [..., x.x, y.y]
string NUI_AddLinePoint(string sPoints, float x, float y);
/// @brief Define an nui-usable color vector via rgba values.
/// @param r Red value.
/// @param g Green value.
/// @param b Blue value.
/// @param a Transparency value.
/// @returns A json-parseable string representing a color.
/// {"r":r, "g":g, "b":b, "a":a}
string NUI_DefineRGBColor(int r, int g, int b, int a = 255);
/// @brief Define an nui-usable color vector via hsv values.
/// @param h Hue.
/// @param s Saturation.
/// @param v Value.
/// @returns A json-parseable string representing a color.
/// {"r":r, "g":g, "b":b, "a":a}
string NUI_DefineHSVColor(float h, float s, float v);
/// @brief Define an nui-usable color vector via hex value.
/// @param nColor Hex color.
/// @returns A json-parseable string representing a color.
/// {"r":r, "g":g, "b":b, "a":a}
string NUI_DefineHexColor(int nColor);
/// @brief Define a random nui-usable color vector.
/// @returns A json-parseable string representing a color.
/// {"r":r, "g":g, "b":b, "a":a}
string NUI_DefineRandomColor();
/// @brief Define a rectangle based on coordinates and dimensions.
/// @param x X-coordinate, top left corner.
/// @param y Y-coordinate, top left corner.
/// @param w Width.
/// @param h Height.
/// @returns A json-parseable string representing a rectangular region.
/// {"x":x.x, "y":y.y, "w":w.w, "h":h.h}
string NUI_DefineRectangle(float x, float y, float w, float h);
/// @brief Get an array of rectangle corner coordinates.
/// @param x X-coordinate, top left corner.
/// @param y Y-coordinate, top left corner.
/// @param w Width.
/// @param h Height.
/// @returns A json-parseable string representing an array of coordinates
/// that can be used in NUI_DrawLine.
/// [x.x, y.y, x.x+w.w, y.y, x.x+w.w, y.y+h.h, x.x, y.y+h.h, x.x, y.y]
string NUI_GetRectanglePoints(float x, float y, float w, float h);
/// @brief Get an array of rectangle corner coordinates.
/// @param sRectangle A json-parseable string representing a rectangular
/// region as returned by NUI_DefineRectangle().
/// @returns A json-parseable string representing an array of coordinates
/// that can be used in NUI_DrawLine.
/// [x.x, y.y, x.x+w.w, y.y, x.x+w.w, y.y+h.h, x.x, y.y+h.h, x.x, y.y]
string NUI_GetDefinedRectanglePoints(string sRectangle);
/// @brief Define a circle based on coordinates and radius.
/// @param x X-coordinate, center point.
/// @param y Y-coordinate, center point.
/// @param r Radius.
/// @returns A json-parseable string representing a rectangular region
/// that can be used in NUI_DrawDefinedCircle().
/// [x.x-r.r, y.y-r.r, 2*r.r, 2*r.r]
string NUI_DefineCircle(float x, float y, float r);
/// @brief Add a column to the form or control group.
/// @param fWidth Column width. If omitted, width will calculated automatically.
/// @note Definition must be closed with NUI_CloseColumn().
void NUI_AddColumn(float fWidth = -1.0);
/// @brief Close a column definition.
void NUI_CloseColumn();
/// @brief Add a row to the form or control group.
/// @param fWidth Row height. If omitted, height will calculated automatically.
/// @note Definition must be closed with NUI_CloseRow().
void NUI_AddRow(float fHeight = -1.0);
/// @brief Close a row definition.
void NUI_CloseRow();
/// @brief Add a control group to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
/// @note Control group can contain other controls and can act as a layout element
/// for tab controls or as a form's subregion, containing its own columns and rows
/// of elements. Definition must be closed with NUI_CloseGroup().
void NUI_AddGroup(string sID = "");
/// @brief Close a control group definition.
void NUI_CloseGroup();
/// @brief Add a chart to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddChart(string sID = "");
/// @brief Add a checkbox to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddCheckbox(string sID = "");
/// @brief Add a color picker to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddColorPicker(string sID = "");
/// @brief Add a combobox to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddCombobox(string sID = "");
/// @brief Add a command button to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddCommandButton(string sID = "");
/// @brief Add a fully-formed custom control.
/// @param sJson Json-parseable string representing a form control with all
/// desired properties defined.
/// @warning This is a very advanced-use function and typically should not be
/// used unless you know what you are doing with respect to how the json
/// definitions are built. Once a custom control is added with this function,
/// the control definition is closed and properties cannot be added or
/// modified.
void NUI_AddCustomControl(string sJson);
/// @brief Add a float-based slider to the form or control group
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddFloatSlider(string sID = "");
/// @brief Add an image to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddImage(string sID = "");
/// @brief Add an image button to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddImageButton(string sID = "");
/// @brief Add an int-based slider to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddIntSlider(string sID = "");
/// @brief Add a label to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddLabel(string sID = "");
/// @brief Add a listbox to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
/// @note Each control added to the listbox row template can have individual
/// properties set. Additionally, template element properties can be set
/// with NUI_SetTemplateVariable() and NUI_SetTemplateWidth(). Definition
/// must be closed with NUI_CloseListbox().
void NUI_AddListbox(string sID = "");
/// @brief Close a listbox definition.
void NUI_CloseListbox();
/// @brief Add an option group to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
/// @note Radio buttons may be added with NUI_SetElements(). Option group
/// values are 0-based, starting with the first radio button added.
void NUI_AddOptionGroup(string sID = "");
/// @brief Add a progress bar to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddProgressBar(string sID = "");
/// @brief Add a spacer to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
void NUI_AddSpacer(string sID = "");
/// @brief Add an editable textbox to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
/// @note To force the textbox to be non-editable, use NUI_SetStatic();
void NUI_AddTextbox(string sID = "");
/// @brief Add a toggle button to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
/// @note Toggle buttons may be added with NUI_AddElement() or
/// NUI_AddElement(). Option group values are 0-based, starting with
/// the first radio button added.
void NUI_AddToggleButton(string sID = "");
/// @brief Add an toggle (option) button group to the form or control group.
/// @param sID Control id. Returned by NuiGetEventElement() (nwscript) or as
/// ed.sControlID in event data.
/// @note Toggle buttons may be added with NUI_SetElements(). Option group
/// values are 0-based, starting with the first toggle button added.
void NUI_AddToggleGroup(string sID = "");
/// @brief Add a canvas to a control or control group.
/// @note Any number of drawlist elements may be added to a single canvas.
/// Drawlist elements can be added to any control or control group, but
/// cannot be added to the base form. Definitions must be closed with
/// NUI_CloseCanvas().
void NUI_AddCanvas();
/// @brief Close a canvas definition.
void NUI_CloseCanvas();
/// @brief Draw a line or polyline on the canvas.
/// @param sPoints Json-parseable points array as defined by NUI_GetLinePoints(),
/// NUI_AddLinePoint(), or NUI_GetRectanglePoints().
/// @note Line point coordinates are relative to the top-left corner of the control
/// the drawlist element is being added to.
void NUI_DrawLine(string sPoints);
/// @brief Draw a rectangle on the canvas.
/// @param x X-coordinate, top left corner.
/// @param y Y-coordinate, top left corner.
/// @param w Width.
/// @param h Height.
/// @note X and Y coordinates are relative to the top-left corner of the control
/// the drawlist element is being added to.
void NUI_DrawRectangle(float x, float y, float w, float h);
/// @brief Draw a rectangle on the canvas.
/// @param sRect Json-parseable string representing a rectangular region as defined
/// by NUI_DefineRectangle().
/// @note X and Y coordinates are relative to the top-left corner of the control
/// the drawlist element is being added to.
void NUI_DrawDefinedRectangle(string sRect);
/// @brief Draw a circle on the canvas.
/// @param x X-coordinate, center point.
/// @param y Y-coordinate, center point.
/// @param r Radius.
/// @note X and Y coordinates are relative to the top-left corner of the control
/// the drawlist element is being added to.
void NUI_DrawCircle(float x, float y, float r);
/// @brief Draw a circle on the canvas.
/// @param sCircle Json-parseable string representing a rectangular region as defined
/// by NUI_DefineCircle().
/// @note X and Y coordinates are relative to the top-left corner of the control
/// the drawlist element is being added to.
void NUI_DrawDefinedCircle(string sCircle);
/// @brief Draw a textbox on the canvas.
/// @param sRect Json-parseable string representing a rectanglur region as defined
/// by NUI_DefineRectangle().
/// @param sText Text to be displayed in the drawn textbox.
/// @note X and Y coordinates are relative to the top-left corner of the control
/// the drawlist element is being added to.
void NUI_DrawTextbox(string sRect, string sText);
/// @brief Draw an image on the canvas.
/// @param sResref Resref of the image to be displayed.
/// @param sRect Json-parseable string representing a rectanglur region as defined
/// by NUI_DefineRectangle().
/// @param nAspect Aspect ratio.
/// @param nHAlign Horizontal Alignment.
/// @param nValign Vertical Alignment.
void NUI_DrawImage(string sResref, string sRect, int nAspect, int nHAlign, int nVAlign);
/// @brief Draw an arc on the canvas.
/// @param sCenter Json-parseable string representing the center of the arc as defined by
/// NUI_DefinePoint().
/// @param r Radius.
/// @param fAMin Start angle.
/// @param fAMax End angle.
/// @note fAMin and fAMax are measured in fractions of PI radians from the start radian of
/// (0 * PI) which is visually represented as 090 degrees. A complete circle is 2 * PI.
/// To draw a 90 degree arc from 180 degrees to 270 degrees, use
/// NUI_DrawArc([sCenter], [r], 0.5 * PI, PI);. The radius arms will also be drawn.
/// @note To achieve any given angle with 0 degrees as straight up, use
/// fAMin = (-0.5 * PI) + (<angle> / 180.0) * PI;
void NUI_DrawArc(string sCenter, float r, float fAMin, float fAMax);
/// @brief Draw a bezier curve on the canvas.
/// @param sStart Json-parseable string representing the curve's start point.
/// @param sEnd Json-parseable string representing the curve's end point.
/// @param sCtrl0 Json-parseable string representing the curve's first control point.
/// @param sCtrl1 Json-parseable string representing the curve's second control point.
/// @note All arguments for this function can be defined by NUI_DefinePoint().
/// @note More information about bezier curves: https://en.wikipedia.org/wiki/B%C3%A9zier_curve
void NUI_DrawCurve(string sStart, string sEnd, string sCtrl0, string sCtrl1);
/// @brief Binds the drawlist element's points property.
/// @param sBind Variable to bind.
void NUI_BindLine(string sBind);
/// @brief Binds the drawlist element's rectangle property.
/// @param sBind Variable to bind.
void NUI_BindCircle(string sBind);
/// @brief Binds the drawlist element's text and rectangle properties.
/// @param sRectangle Variable to bind.
/// @param sText Variable to bind.
void NUI_BindTextbox(string sRectangle, string sText);
/// @brief Binds the drawlist element's rectangle, resref (image), aspect and alignment properties.
/// @param sResref Variable to bind.
/// @param sRectangle Variable to bind.
/// @param sAspect Variable to bind.
/// @param sHAlign Variable to bind.
/// @param sVAlign Variable to bind.
void NUI_BindImage(string sResref, string sRectangle, string sAspect, string sHAlign, string sVAlign);
/// @brief Binds the drawlist element's center, radius, start angle and end angle properties.
/// @param sCenter Variable to bind.
/// @param sRadius Variable to bind.
/// @param sStartAngle Variable to bind.
/// @param sEndAngle Variable to bind.
void NUI_BindArc(string sCenter, string sRadius, string sStartAngle, string sEndAngle);
/// @brief Binds the drawlist element's start, end, and control point properties.
/// @param sStart Variable to bind.
/// @param sEnd Variable to bind.
/// @param sCtrl0 Variable to bind.
/// @param sCtrl1 Variable to bind.
void NUI_BindCurve(string sStart, string sEnd, string sCtrl0, string sCtrl1);
/// @brief Binds the form's accepts input property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindAcceptsInput(string sBind, int bWatch = FALSE);
/// @brief Binds the control's aspect property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindAspect(string sBind, int bWatch = FALSE);
/// @brief Binds the form's or control's border property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindBorder(string sBind, int bWatch = FALSE);
/// @brief Binds the form's closable property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindClosable(string sBind, int bWatch = FALSE);
/// @brief Binds the form's collapsible property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindCollapsible(string sBind, int bWatch = FALSE);
/// @brief Binds the control's color property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindColor(string sBind, int bWatch = FALSE);
/// @brief Binds the disabled control's tooltip property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindDisabledTooltip(string sBind, int bWatch = FALSE);
/// @brief Binds the form's edge constraint property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindEdgeConstraint(string sBind, int bWatch = FALSE);
/// @brief Binds the control's elements property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindElements(string sBind, int bWatch = FALSE);
/// @brief Binds the control's enabled property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindEnabled(string sBind, int bWatch = FALSE);
/// @brief Binds the control's encouraged property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindEncouraged(string sBind, int bWatch = FALSE);
/// @brief Binds the control's fill property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindFill(string sBind, int bWatch = FALSE);
/// @brief Binds the control's foreground color property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindForegroundColor(string sBind, int bWatch = FALSE);
/// @brief Binds the form's geometry property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindGeometry(string sBind, int bWatch = FALSE);
/// @brief Binds the control's horizontal alignment property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindHorizontalAlignment(string sBind, int bWatch = FALSE);
/// @brief Binds the control's resref (image) property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindResref(string sBind, int bWatch = FALSE);
/// @brief Binds the control's label property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindLabel(string sBind, int bWatch = FALSE);
/// @brief Binds the control's legend property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindLegend(string sBind, int bWatch = FALSE);
/// @brief Binds the control's line thickness property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindLineThickness(string sBind, int bWatch = FALSE);
/// @brief Binds the control's max property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindMax(string sBind, int bWatch = FALSE);
/// @brief Binds the control's min property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindMin(string sBind, int bWatch = FALSE);
/// @brief Binds the control's placeholder property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindPlaceholder(string sBind, int bWatch = FALSE);
/// @brief Binds the control's points property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindPoints(string sBind, int bWatch = FALSE);
/// @brief Binds the control's rectangle property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindRectangle(string sBind, int bWatch = FALSE);
/// @brief Binds the control's region property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindRegion(string sBind, int bWatch = FALSE);
/// @brief Binds the form's resizable property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindResizable(string sBind, int bWatch = FALSE);
/// @brief Binds the control's rowcount property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindRowCount(string sBind, int bWatch = FALSE);
/// @brief Binds the control's scissor property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindScissor(string sBind, int bWatch = FALSE);
/// @brief Binds the form's size constraint property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindSizeConstraint(string sBind, int bWatch = FALSE);
/// @brief Binds a slider control's bounds.
/// @param sUpper Variable to bind.
/// @param sLower Variable to bind.
/// @param sStep Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindSliderBounds(string sUpper, string sLower, string sStep, int bWatch = FALSE);
/// @brief Binds the control's step property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindStep(string sBind, int bWatch = FALSE);
/// @brief Binds the control's text property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindText(string sBind, int bWatch = FALSE);
/// @brief Binds the form's title property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindTitle(string sBind, int bWatch = FALSE);
/// @brief Binds the control's tooltip property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
/// @param bDisabledTooltip If TRUE, the control's disabled tooltip property
/// will also be bound to sBind.
void NUI_BindTooltip(string sBind, int bWatch = FALSE, int bDisabledTooltip = FALSE);
/// @brief Binds the form's elements property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindTransparent(string sBind, int bWatch = FALSE);
/// @brief Binds the control's type property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindType(string sBind, int bWatch = FALSE);
/// @brief Binds the control's value property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindValue(string sBind, int bWatch = FALSE);
/// @brief Binds the control's vertical alignment property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindVerticalAlignment(string sBind, int bWatch = FALSE);
/// @brief Binds the control's visible property.
/// @param sBind Variable to bind.
/// @param bWatch TRUE to set a bind watch.
void NUI_BindVisible(string sBind, int bWatch = FALSE);
/// @brief Set the form's accepts input property.
/// @param bAcceptsInput Whether the form will accept player input.
void NUI_SetAcceptsInput(int bAcceptsInput = TRUE);
/// @brief Sets the control's aspect property.
/// @param nAspect NUI_ASPECT_* constant.
void NUI_SetAspect(int nAspect);
/// @brief Sets the control's aspect ratio property.
/// @param fAspect Aspect ratio (x/y).
void NUI_SetAspectRatio(float fAspect);
/// @brief Sets the form's or control's border property.
/// @param bVisible Whether the border is visible.
void NUI_SetBorder(int bVisible = TRUE);
/// @brief Sets the control's center property.
/// @param x X-coordinate.
/// @param y Y-coordinate.
void NUI_SetCenter(float x, float y);
/// @brief Sets the form's closable property.
/// @param bClosable Whether the form is closable.
void NUI_SetClosable(int bClosable = TRUE);
/// @brief Sets the form's collapsible property.
/// @param bCollapsible Whether the form is collapsible.
void NUI_SetCollapsible(int bCollapsible = TRUE);
/// @brief Binds the control's color property.
/// @param sColor Json-parseable color vector as defined by NUI_DefineColor(),
/// NUI_DefineRGBColor(), NUI_DefineHSVColor(), NUI_DefineHexColor(), and
/// NUI_DefineRandomColor().
void NUI_SetColor(string sColor);
/// @brief Set a custom key:value pair into the build data for the
/// form or control currently being defined.
/// @param sKey Key.
/// @param sValue Json-parseable string.
void NUI_SetCustomKey(string sKey, string sValue);
/// @brief For bound controls, sets the value that will be initially set
/// to the control's value property.
/// @param sDefault Default value to set.
void NUI_SetDefaultValue(string sDefault);
/// @brief Sets the control's center property.
/// @param sCenter Json-parseable point vector as defined by NUI_DefinePoint().
void NUI_SetDefinedCenter(string sCenter);
/// @brief Sets the form's geometry property.
/// @param sGeometry Json-parseable string representing a rectangular region as
/// defined by NUI_DefineRectangle().
void NUI_SetDefinedGeometry(string sGeometry);
/// @brief Sets the control's width and height properties.
/// @param fWidth Width.
/// @param fHeight Height.
void NUI_SetDimensions(float fWidth, float fHeight);
/// @brief Sets the disabled control's tooltip property.
/// @param sTooltip Tooltip text.
void NUI_SetDisabledTooltip(string sText);
/// @brief Sets the control's direction property.
/// @param nDirection NUI_ORIENTATION_* constant.
void NUI_SetDirection(int nDirection = NUI_ORIENTATION_ROW);
/// @brief Sets the control's draw condition property.
/// @param nCondition NUI_CONDITION_* constant.
void NUI_SetDrawCondition(int nCondition = NUI_DRAW_ALWAYS);
/// @brief Sets the control's draw position property.
/// @param nPosition NUI_POSITION_* constant.
void NUI_SetDrawPosition(int nPosition = NUI_DRAW_ABOVE);
/// @brief Sets the form's edge constraint property.
/// @param fLeft Left Margin.
/// @param fRight Right Margin.
/// @param fTop Top Margin.
/// @param fBottom Bottom Margin.
void NUI_SetEdgeConstraint(float fLeft, float fRight, float fTop, float fBottom);
/// @brief Sets the control's elements property.
/// @param sElements
void NUI_SetElements(string sElements);
/// @brief Sets the control's enabled property.
/// @param bEnabled Whether the control is enabled.
void NUI_SetEnabled(int bEnabled = TRUE);
/// @brief Sets the control's encouraged property.
/// @param bEncourage Whether the control is encouraged.
void NUI_SetEncouraged(int bEncouraged = TRUE);
/// @brief Sets the control's fill property.
/// @param bFill Whether the control is filled.
void NUI_SetFill(int bFill = TRUE);
/// @brief Sets the bounds for a float-based slider.
/// @param fLower Lower bound.
/// @param fUpper Upper bound.
/// @param fStep Step Value.
void NUI_SetFloatSliderBounds(float fLower, float fUpper, float fStep);
/// @brief Sets the control's foreground color property.
/// @param sColor A json-parseable color vector as
/// defined by NUI_DefineRGBColor(), NUI_DefineHSVColor(),
/// NUI_DefineHexColor(), or NUI_DefineRandomColor().
void NUI_SetForegroundColor(string sColor);
/// @brief Sets the form's geometry property.
/// @param x X-coordinate, top left corner.
/// @param y Y-coordinate, top left corner.
/// @param w Width.
/// @param h Height.
void NUI_SetGeometry(float x, float y, float w, float h);
/// @brief Sets the control's height property.
/// @param fHeight Height.
void NUI_SetHeight(float fHeight);
/// @brief Sets the control's horizontal alignment property.
/// @param nAlign NUI_HALIGN_* constant.
void NUI_SetHorizontalAlignment(int nAlign);
/// @brief Sets the control's id property.
/// @param sID ID.
void NUI_SetID(string sID);
/// @brief Sets the bounds for a integer-based slider.
/// @param nLower Lower bound.
/// @param nUpper Upper bound.
/// @param nStep Step Value.
void NUI_SetIntSliderBounds(int nLower, int nUpper, int nStep);
/// @brief Sets the control's label property.
/// @param sLabel Label.
void NUI_SetLabel(string sLabel);
/// @brief Sets the control's max length property.
/// @param nLength Max number of characters.
void NUI_SetLength(int nLength);
/// @brief Sets the control's line thickness property.
/// @param fThickness Line thickness.
void NUI_SetLineThickness(float fThickness);
/// @brief Sets the control's margin property.
/// @param fMargin Margin.
void NUI_SetMargin(float fMargin);
/// @brief Sets the control's multiline property.
/// @param bMultiline Whether the textbox has multiple lines.
void NUI_SetMultiline(int bMultiline = TRUE);
/// @brief Sets the control's padding property.
/// @param fPadding Padding.
void NUI_SetPadding(float fPadding);
/// @brief Sets the control's placeholder property.
/// @param sText Placeholder text.
void NUI_SetPlaceholder(string sText);
/// @brief Sets the control's points property.
/// @param sPoint Json-parseable string representing a coordinate array as defined
/// by NUI_GetLinePoints(), NUI_AddLinePoint(), or NUI_GetRectanglePoints().
void NUI_SetPoints(string sPoints);
/// @brief Sets the control's radius property.
/// @param r Radius.
void NUI_SetRadius(float r);
/// @brief Sets the control's rectangle property.
/// @param sRectangle Json-parsaable string representing a rectangular region as defined
/// by NUI_DefineRectangle().
void NUI_SetRectangle(string sRectangle);
/// @brief Sets the control's region property.
/// @param sRegion Json-parsaable string representing a rectangular region as defined
/// by NUI_DefineRectangle().
void NUI_SetRegion(string sRegion);
/// @brief Sets the form's resizable property.
/// @param bResizable Whether the form is resizable.
void NUI_SetResizable(int bResizable = TRUE);
/// @brief Sets the control's resref/image property.
/// @param sResref Resource resref.
void NUI_SetResref(string sResref);
/// @brief Sets the control's row count property.
/// @param nRowCount Number of rows.
void NUI_SetRowCount(int nRowCount);
/// @brief Sets the control's row height property.
/// @param fRowHeight Row height.
void NUI_SetRowHeight(float fRowHeight);
/// @brief Sets the control's scissor property.
/// @param bScissor Whether to scissor to the control's dimensions.
void NUI_SetScissor(int bScissor);
/// @brief Sets the control's scrollbars property.
/// @param nScrollBars NUI_SCROLLBARS_* constant.
void NUI_SetScrollbars(int nScrollbars = NUI_SCROLLBARS_AUTO);
/// @brief Sets the form's size constraint property.
/// @param fMinWidth Minimum width.
/// @param fMinHeight Minimum height.
/// @param fMaxWidth Maximum width.
/// @param fMaxHeight Maximum height.
/// @note Set any parameter to 0.0 to ignore that parameter while
/// honoring the remaining parameters.
/// @note Setting a maximum constraint less than or equal to a minimum
/// constraint on the same dimension will prevent the form from
/// being resized in that dimension.
void NUI_SetSizeConstraint(float fMinWidth, float fMinHeight, float fMaxWidth, float fMaxHeight);
/// @brief Sets the control's width and height properties.
/// @param fSide Length of one side.
void NUI_SetSquare(float fSide);
/// @brief Sets the control's type property.
/// @note Sets an editable textbox to non-editable.
void NUI_SetStatic();
/// @brief Sets the template's variable property.
/// @param bVariable Whether the template control width is variable.
void NUI_SetTemplateVariable(int bVariable = TRUE);
/// @brief Sets the template's width property.
/// @param fWidth Width.
void NUI_SetTemplateWidth(float fWidth);
/// @brief Sets the control's text property.
/// @param sText Text.
void NUI_SetText(string sText);
/// @brief Sets the form's title property.
/// @param sTitle Title.
void NUI_SetTitle(string sTitle);
/// @brief Sets the control's tooltip property.
/// @param sText Tooltip text.
/// @param bDisabledTooltip If TRUE, the control's disabled tooltip property
/// will also be set to sText.
void NUI_SetTooltip(string sText, int bDisabledTooltip = FALSE);
/// @brief Sets the form's transparent property.
/// @param bTransparent Whether the form's background is transparent.
void NUI_SetTransparent(int bTransparent = TRUE);
/// @brief Sets the control's value property.
/// @param sValue Json-Parseable string.
/// @note sValue must be a string representing a value json structure.
void NUI_SetValue(string sValue);
/// @brief Sets the control's vertical alignment property.
/// @param nAlign NUI_VALIGN_* constant.
void NUI_SetVerticalAlignment(int nAlign);
/// @brief Sets the control's visible property.
/// @param bVisible Whether the control is visible.
void NUI_SetVisible(int bVisible = TRUE);
/// @brief Sets the control's width property.
/// @param fWidth Width.
void NUI_SetWidth(float fWidth);
/// @brief Set's the control's wordwrap property.
/// @param bWrap Whether the text wrap's withing the control's width.
void NUI_SetWordWrap(int bWrap = TRUE);
/// @brief Defines all forms via formfiles that match prefixes set into
/// the configuration file.
/// @param sFormfile Optional formfile specification.
/// @note If sFormfile is passed, only the specified formfile will be loaded.
void NUI_DefineForms(string sFormfile = "");
/// @brief Display a form.
/// @param oPC Client to display the form on.
/// @param sFormID ID of the form to display.
/// @param sProfile Optional form profile.
/// @param bSelfManage If TRUE, call the formfile directly instead of the
/// game's NUI event handler.
/// @returns Form's token as assigned by the game engine.
int NUI_DisplayForm(object oPC, string sFormID, string sProfile = "", int bSelfManage = FALSE);
/// @brief Close an open form.
/// @param oPC Client on which to close the form.
/// @param sFormID ID of the form to close.
void NUI_CloseForm(object oPC, string sFormID);
/// @brief Display a subform onto a control group element or form root.
/// @param oPC Client to display the subform on.
/// @param sFormID Form ID.
/// @param sElementID Element ID to replace.
/// @param sSubformID Subform ID to insert into sElement.
void NUI_DisplaySubform(object oPC, string sFormID, string sElementID, string sSubformID);
/// @brief Creates the default profile.
void NUI_CreateDefaultProfile();
/// @brief Create a custom form profile based on the default profile.
/// @param sProfile Profile name.
/// @param sBase Optional; must be a previously created profile. If set,
/// sProfile will be based on profile sBase.
void NUI_CreateProfile(string sProfile, string sBase = "");
/// @brief Set a profile default bind value.
/// @param sBind Bind name.
/// @param sJson Json-parseable string representing the bind's profile value.
void NUI_SetProfileBind(string sBind, string sJson);
/// @brief Set a profile default bind value.
/// @param sBind Bind name.
/// @param jValue Json bind value.
void NUI_SetProfileBindJ(string sBind, json jValue);
/// @brief Set multiple profile binds to a single value.
/// @param sBinds Comma-delimited list of bind names.
/// @param sJson Json-parseable string representing the bind's profile value.
void NUI_SetProfileBinds(string sBinds, string sJson);