gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

editable.h (879B)


      1 #pragma once
      2 
      3 #include <functional>
      4 #include <string>
      5 
      6 #include "juce_gui_basics/juce_gui_basics.h"
      7 
      8 namespace jucePluginEditorLib::patchManager
      9 {
     10 	class Editable : juce::Label::Listener, juce::TextEditor::Listener
     11 	{
     12 	public:
     13 		using FinishedEditingCallback = std::function<void(bool, const std::string&)>;
     14 
     15 		~Editable() override;
     16 
     17 	protected:
     18 		bool beginEdit(juce::Component* _parent, const juce::Rectangle<int>& _position, const std::string& _initialText, FinishedEditingCallback&& _callback);
     19 
     20 		// juce::Label::Listener
     21 		void editorHidden(juce::Label*, juce::TextEditor&) override;
     22 		void labelTextChanged(juce::Label* _label) override;
     23 		void textEditorTextChanged (juce::TextEditor&) override;
     24 
     25 	private:
     26 		void destroyEditorLabel();
     27 
     28 		FinishedEditingCallback m_finishedEditingCallback;
     29 		juce::Label* m_editorLabel = nullptr;
     30 		std::string m_editorInitialText;
     31 	};
     32 }