edit.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef __EDIT_H
  2. #define __EDIT_H
  3. #include <api/script/script.h>
  4. #include <api/script/objects/guiobj.h>
  5. #define EDIT_PARENT EditWnd
  6. class EditScriptController : public GuiObjectScriptController {
  7. public:
  8. virtual const wchar_t *getClassName();
  9. virtual const wchar_t *getAncestorClassName();
  10. virtual ScriptObjectController *getAncestorController() { return guiController; }
  11. virtual int getNumFunctions();
  12. virtual const function_descriptor_struct *getExportedFunctions();
  13. virtual GUID getClassGuid();
  14. virtual ScriptObject *instantiate();
  15. virtual void destroy(ScriptObject *o);
  16. virtual void *encapsulate(ScriptObject *o);
  17. virtual void deencapsulate(void *o);
  18. private:
  19. static function_descriptor_struct exportedFunction[];
  20. };
  21. extern EditScriptController *editController;
  22. #ifndef _NOSTUDIO
  23. #include <api/wnd/wndclass/editwnd.h>
  24. class Edit : public EDIT_PARENT {
  25. public:
  26. Edit();
  27. ~Edit();
  28. virtual void onEditUpdate();
  29. virtual void onIdleEditUpdate();
  30. virtual int onEnter(); // user hit enter.. return 1 to close window
  31. virtual int onAbort(); // user hit escape.. return 1 to close window
  32. virtual int onInit();
  33. #ifdef WASABI_COMPILE_CONFIG
  34. virtual int onReloadConfig();
  35. #endif
  36. virtual int setXuiParam(int _xuihandle, int xmlattrid, const wchar_t *name, const wchar_t *value);
  37. void setText(const wchar_t *t);
  38. void setAutoUrl(int a);
  39. protected:
  40. /*static */void CreateXMLParameters(int master_handle);
  41. private:
  42. wchar_t *my_buffer;
  43. int autourl;
  44. int xuihandle;
  45. #else
  46. class Edit : public EDIT_SCRIPTPARENT {
  47. #endif
  48. public:
  49. static scriptVar script_vcpu_setText(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar t);
  50. static scriptVar script_vcpu_setAutoEnter(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar t);
  51. static scriptVar script_vcpu_getAutoEnter(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  52. static scriptVar script_vcpu_setIdleEnabled(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar t);
  53. static scriptVar script_vcpu_getIdleEnabled(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  54. static scriptVar script_vcpu_getText(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  55. static scriptVar script_vcpu_onEnter(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  56. static scriptVar script_vcpu_onAbort(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  57. static scriptVar script_vcpu_onEditUpdate(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  58. static scriptVar script_vcpu_onIdleEditUpdate(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  59. static scriptVar script_vcpu_selectAll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  60. static scriptVar script_vcpu_enter(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  61. protected:
  62. enum {
  63. EDIT_TEXT=0,
  64. EDIT_ACTION,
  65. EDIT_MULTILINE,
  66. EDIT_VSCROLL,
  67. EDIT_AUTOHSCROLL,
  68. EDIT_AUTOENTER,
  69. EDIT_PASSWORD,
  70. EDIT_AUTOSELECT,
  71. };
  72. private:
  73. static XMLParamPair params[];
  74. };
  75. extern const wchar_t editXuiObjectStr[];
  76. extern char editXuiSvcName[];
  77. class EditXuiSvc : public XuiObjectSvc<Edit, editXuiObjectStr, editXuiSvcName> {};
  78. #endif