Browse Source

Added a method to TextPropertyComponent to set whether it should respond to file drag and drop

tags/2021-05-28
ed 8 years ago
parent
commit
73654ee535
2 changed files with 21 additions and 1 deletions
  1. +13
    -1
      modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp
  2. +8
    -0
      modules/juce_gui_basics/properties/juce_TextPropertyComponent.h

+ 13
- 1
modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp View File

@@ -41,7 +41,7 @@ public:
bool isInterestedInFileDrag (const StringArray&) override
{
return true;
return interestedInFileDrag;
}
void filesDropped (const StringArray& files, int, int) override
@@ -77,10 +77,16 @@ public:
repaint();
}
void setInterestedInFileDrag (bool isInterested)
{
interestedInFileDrag = isInterested;
}
private:
TextPropertyComponent& owner;
int maxChars;
bool isMultiline;
bool interestedInFileDrag = true;
};
//==============================================================================
@@ -169,3 +175,9 @@ void TextPropertyComponent::colourChanged()
PropertyComponent::colourChanged();
textEditor->updateColours();
}
void TextPropertyComponent::setInterestedInFileDrag (bool isInterested)
{
if (textEditor != nullptr)
textEditor->setInterestedInFileDrag (isInterested);
}

+ 8
- 0
modules/juce_gui_basics/properties/juce_TextPropertyComponent.h View File

@@ -122,6 +122,14 @@ public:
*/
void removeListener (Listener* listener);
//==============================================================================
/** Sets whether the text property component can have files dropped onto it by an external application.
The default setting for this is true but you may want to disable this behaviour if you derive
from this class and want your subclass to respond to the file drag.
*/
void setInterestedInFileDrag (bool isInterested);
//==============================================================================
/** @internal */
void refresh() override;


Loading…
Cancel
Save