pathpicker.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #ifndef __PATHPICKER_H
  2. #define __PATHPICKER_H
  3. #include <api/wnd/wndclass/guiobjwnd.h>
  4. #include <api/script/objects/c_script/h_guiobject.h>
  5. #include <api/script/objects/c_script/h_button.h>
  6. #define PATHPICKER_PARENT GuiObjectWnd
  7. class PPClicksCallback;
  8. extern int __id;
  9. /**
  10. Class
  11. @short
  12. @author Nullsoft
  13. @ver 1.0
  14. @see
  15. */
  16. class PathPicker : public PATHPICKER_PARENT {
  17. public:
  18. /**
  19. Method
  20. @see
  21. @ret
  22. @param
  23. */
  24. PathPicker();
  25. virtual ~PathPicker();
  26. /**
  27. Method
  28. @see
  29. @ret
  30. @param
  31. */
  32. virtual int onInit();
  33. /**
  34. Method
  35. @see
  36. @ret
  37. @param
  38. */
  39. void clickCallback();
  40. #ifdef WASABI_COMPILE_CONFIG
  41. /**
  42. Method
  43. @see
  44. @ret
  45. @param
  46. */
  47. virtual int onReloadConfig();
  48. #endif
  49. /**
  50. Method
  51. @see
  52. @ret
  53. @param
  54. */
  55. virtual void abstract_onNewContent();
  56. void setPath(const wchar_t *newpath);
  57. const wchar_t *getPath() { return curpath; }
  58. /**
  59. Method
  60. @see
  61. @ret
  62. @param
  63. */
  64. virtual void onPathChanged(const wchar_t *newpath);
  65. /**
  66. Method
  67. @see
  68. @ret
  69. @param
  70. */
  71. virtual void setDefault();
  72. private:
  73. /**
  74. Method
  75. @see
  76. @ret
  77. @param
  78. */
  79. void updatePathInControl();
  80. /**
  81. Method
  82. @see
  83. @ret
  84. @param
  85. */
  86. #ifdef WASABI_COMPILE_CONFIG
  87. void updatePathFromConfig();
  88. #endif
  89. /**
  90. Method
  91. @see
  92. @ret
  93. @param
  94. */
  95. void trapControls();
  96. PPClicksCallback *clicks_button;
  97. StringW curpath;
  98. int disable_cfg_event;
  99. };
  100. /**
  101. Class
  102. @short
  103. @author Nullsoft
  104. @ver 1.0
  105. @see
  106. */
  107. class PPClicksCallback : public H_GuiObject {
  108. public:
  109. /**
  110. Method
  111. @see
  112. @ret
  113. @param
  114. */
  115. PPClicksCallback(ScriptObject *trap, PathPicker *_callback) :
  116. /**
  117. Method
  118. @see
  119. @ret
  120. @param
  121. */
  122. callback(_callback), H_GuiObject(trap) {
  123. }
  124. /**
  125. Method
  126. @see
  127. @ret
  128. @param
  129. */
  130. virtual void hook_onLeftButtonDown(int x, int y) {
  131. callback->clickCallback();
  132. }
  133. private:
  134. PathPicker *callback;
  135. };
  136. #endif