lwlaytool.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * LWSDK Header File
  3. * Copyright 2001, NewTek, Inc.
  4. *
  5. * LWLAYTOOL.H -- Layout Interactive Tools
  6. */
  7. #ifndef LWSDK_LAYTOOL_H
  8. #define LWSDK_LAYTOOL_H
  9. #include <lwtool.h>
  10. #include <lwcustobj.h>
  11. #define LWLAYOUTTOOL_CLASS "LayoutTool"
  12. #define LWLAYOUTTOOL_VERSION 1
  13. /*
  14. * A Layout tool is a LightWave viewport tool whose draw() function
  15. * takes a LWCustomObjAccess instead of a LWWireDrawAccess structure.
  16. * It has the following handler functions.
  17. *
  18. * done destroy the instance when the user discards the tool.
  19. *
  20. * draw display a wireframe representation of the tool in a 3D
  21. * viewport. Typically this draws the handles.
  22. *
  23. * help return a text string to be displayed as a help tip for
  24. * this tool.
  25. *
  26. * dirty return flag bit if either the wireframe or help string
  27. * need to be refreshed.
  28. *
  29. * count return the number of handles. If zero, then 'start' is
  30. * used to set the initial handle point.
  31. *
  32. * handle return the 3D location and priority of handle 'i', or zero
  33. * if the handle is currently invalid.
  34. *
  35. * start take an initial mouse-down position and return the index
  36. * of the handle that should be dragged.
  37. *
  38. * adjust drag the given handle to a new location and return the
  39. * index of the handle that should continue being dragged
  40. * (often the same as the input).
  41. *
  42. * down process a mouse-down event. If this function returns
  43. * false, handle processing will be done instead of raw
  44. * mouse event processing.
  45. *
  46. * move process a mouse-move event. This is only called if the
  47. * down function returned true.
  48. *
  49. * up process a mouse-up event. This is only called if the down
  50. * function returned true.
  51. *
  52. * event process a general event: DROP, RESET or ACTIVATE
  53. *
  54. * panel create and return a view-type xPanel for the tool instance.
  55. */
  56. typedef struct st_LWLayoutToolFuncs {
  57. void (*done) (LWInstance);
  58. void (*draw) (LWInstance, LWCustomObjAccess *);
  59. const char * (*help) (LWInstance, LWToolEvent *);
  60. int (*dirty) (LWInstance);
  61. int (*count) (LWInstance, LWToolEvent *);
  62. int (*handle) (LWInstance, LWToolEvent *, int i, LWDVector pos);
  63. int (*start) (LWInstance, LWToolEvent *);
  64. int (*adjust) (LWInstance, LWToolEvent *, int i);
  65. int (*down) (LWInstance, LWToolEvent *);
  66. void (*move) (LWInstance, LWToolEvent *);
  67. void (*up) (LWInstance, LWToolEvent *);
  68. void (*event) (LWInstance, int code);
  69. LWXPanelID (*panel) (LWInstance);
  70. } LWLayoutToolFuncs;
  71. typedef struct st_LWLayoutTool {
  72. LWInstance instance;
  73. LWLayoutToolFuncs *tool;
  74. } LWLayoutTool;
  75. #endif