1
0

drag.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __WASABI_DRAG_H
  2. #define __WASABI_DRAG_H
  3. class ifc_window;
  4. #include <bfc/wasabi_std.h>
  5. class NOVTABLE DragInterface
  6. {
  7. public:
  8. // (called on dest) when dragged item enters the winder
  9. virtual int dragEnter(ifc_window *sourceWnd) = 0;
  10. // (called on dest) during the winder
  11. virtual int dragOver(int x, int y, ifc_window *sourceWnd) = 0;
  12. // (called on src)
  13. virtual int dragSetSticky(ifc_window *wnd, int left, int right, int up, int down) = 0;
  14. // (called on dest) when dragged item leaves the winder
  15. virtual int dragLeave(ifc_window *sourceWnd) = 0;
  16. // (called on dest) here is where we actually drop it
  17. virtual int dragDrop(ifc_window *sourceWnd, int x, int y) = 0;
  18. // must be called from within dragDrop(); (receiver)
  19. virtual const wchar_t *dragGetSuggestedDropTitle(void) = 0;
  20. // must be called from within your dragEnter, Over, Leave, or Drop
  21. // return the slot # if you support this form of the data, -1 otherwise
  22. // nitems can be NULL if you're just checking validity
  23. virtual int dragCheckData(const wchar_t *type, int *nitems = NULL) = 0;
  24. // fetches a specific pointer that was stored
  25. virtual void *dragGetData(int slot, int itemnum) = 0;
  26. virtual int dragCheckOption(int option) = 0;
  27. };
  28. class DragInterfaceI : public DragInterface
  29. {
  30. public:
  31. // (called on dest) when dragged item enters the winder
  32. virtual int dragEnter(ifc_window *sourceWnd) { return 0; }
  33. // (called on dest) during the winder
  34. virtual int dragOver(int x, int y, ifc_window *sourceWnd) { return 0; }
  35. // (called on src)
  36. virtual int dragSetSticky(ifc_window *wnd, int left, int right, int up, int down) { return 0; }
  37. // (called on dest) when dragged item leaves the winder
  38. virtual int dragLeave(ifc_window *sourceWnd) { return 0; }
  39. // (called on dest) here is where we actually drop it
  40. virtual int dragDrop(ifc_window *sourceWnd, int x, int y) { return 0; }
  41. // must be called from within dragDrop(); (receiver)
  42. virtual const wchar_t *dragGetSuggestedDropTitle(void) { return NULL; }
  43. // must be called from within your dragEnter, Over, Leave, or Drop
  44. // return the slot # if you support this form of the data, -1 otherwise
  45. // nitems can be NULL if you're just checking validity
  46. virtual int dragCheckData(const wchar_t *type, int *nitems = NULL) { return 0; }
  47. // fetches a specific pointer that was stored
  48. virtual void *dragGetData(int slot, int itemnum) { return 0; }
  49. virtual int dragCheckOption(int option) { return 0; }
  50. };
  51. class DI
  52. {
  53. public:
  54. DI(ifc_window *rw);
  55. int dragEnter(ifc_window *sourceWnd);
  56. int dragOver(int x, int y, ifc_window *sourceWnd);
  57. int dragSetSticky(ifc_window *wnd, int left, int right, int up, int down);
  58. int dragLeave(ifc_window *sourceWnd);
  59. int dragDrop(ifc_window *sourceWnd, int x, int y);
  60. const wchar_t *dragGetSuggestedDropTitle(void);
  61. int dragCheckData(const wchar_t *type, int *nitems = NULL);
  62. void *dragGetData(int slot, int itemnum);
  63. int dragCheckOption(int option);
  64. private:
  65. DragInterface *di;
  66. };
  67. #endif