I'd like to implement a system in Juce where nodes can be created with connecting lines. I guess you can think of something like a flow chart. Nodes can be dragged around and connecting lines automatically move to follow. Nodes and lines can be added and removed. Here are a couple of examples of this done using WPF:
Creating the nodes is easy as they're just Components that get dragged around. But does anyone have any idea what approach I might use in implementing the connecting lines using Juce? Two issues comes to mind right off:
- Drawing curved lines.
It looks like the Graphics object can only draw straight lines. Is there any facility anywhere to draw curved lines such as bezier? (or even <gulp> quadratic bezier?)
- Is there any way to select the lines?
One reason for them to be selectable is so they can be removed. At first I thought a connecting line could be drawn in its own component. But then how would mouse clicks pass through in the blank areas? I thought maybe I could implement the hittest() function and filter hits that weren't right on the line itself. But how could you know that? I don't see any easy way to know that the hit is on the line, such as checking the color of the pixel at the hit location.
On the other hand, lines which are not Components wouldn't get mouse clicks and so couldn't be selected.