Browse Source

TreeView: Allow built-in mouse handling to be enabled/disabled for custom components

v6.1.6
reuk 3 years ago
parent
commit
b2f318a775
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
2 changed files with 8 additions and 1 deletions
  1. +1
    -1
      modules/juce_gui_basics/widgets/juce_TreeView.cpp
  2. +7
    -0
      modules/juce_gui_basics/widgets/juce_TreeView.h

+ 1
- 1
modules/juce_gui_basics/widgets/juce_TreeView.cpp View File

@@ -344,7 +344,7 @@ public:
auto newComp = std::make_unique<ItemComponent> (*treeItem);
addAndMakeVisible (*newComp);
newComp->addMouseListener (this, false);
newComp->addMouseListener (this, treeItem->customComponentUsesTreeViewMouseHandler());
componentsToKeep.insert (newComp.get());
itemComponents.push_back (std::move (newComp));


+ 7
- 0
modules/juce_gui_basics/widgets/juce_TreeView.h View File

@@ -363,6 +363,13 @@ public:
/** Draws the line that extends vertically up towards one of its parents, or down to one of its children. */
virtual void paintVerticalConnectingLine (Graphics&, const Line<float>& line);
/** This should return true if you want to use a custom component, and also use
the TreeView's built-in mouse handling support, enabling drag-and-drop,
itemClicked() and itemDoubleClicked(); return false if the component should
consume all mouse clicks.
*/
virtual bool customComponentUsesTreeViewMouseHandler() const { return false; }
/** Called when the user clicks on this item.
If you're using createItemComponent() to create a custom component for the


Loading…
Cancel
Save