You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCETICE project - Copyright 2009 by Lucio Asnaghi.
  4. JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
  5. Copyright 2007 by Julian Storer.
  6. ------------------------------------------------------------------------------
  7. JUCE and JUCETICE can be redistributed and/or modified under the terms of
  8. the GNU General Public License, as published by the Free Software Foundation;
  9. either version 2 of the License, or (at your option) any later version.
  10. JUCE and JUCETICE are distributed in the hope that they will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
  16. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  17. Boston, MA 02111-1307 USA
  18. ==============================================================================
  19. */
  20. #ifndef __JUCETICE_GRAPHLINKCOMPONENT_HEADER__
  21. #define __JUCETICE_GRAPHLINKCOMPONENT_HEADER__
  22. class GraphConnectorComponent;
  23. //==============================================================================
  24. class GraphLinkComponent : public Component
  25. {
  26. public:
  27. //==============================================================================
  28. GraphConnectorComponent* from;
  29. GraphConnectorComponent* to;
  30. //==============================================================================
  31. GraphLinkComponent (const bool leftToRight,
  32. const int lineThickness = 2,
  33. const float tension = 0.45f);
  34. ~GraphLinkComponent ();
  35. //==============================================================================
  36. void setStartPoint (const int x, const int y);
  37. void setEndPoint (const int x, const int y);
  38. //==============================================================================
  39. void setTension (const float tension);
  40. //==============================================================================
  41. /** @internal */
  42. void mouseUp (const MouseEvent& e);
  43. /** @internal */
  44. void mouseDrag (const MouseEvent& e);
  45. /** @internal */
  46. void paint (Graphics& graphics);
  47. /** @internal */
  48. bool hitTest (int x, int y);
  49. //==============================================================================
  50. juce_UseDebuggingNewOperator
  51. protected:
  52. //==============================================================================
  53. void updateBounds();
  54. Path path;
  55. int startPointX;
  56. int startPointY;
  57. int endPointX;
  58. int endPointY;
  59. bool leftToRight;
  60. int lineThickness;
  61. float tension;
  62. };
  63. #endif