AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

TooltipComp.h (1369B)


      1 #ifndef TOOLTIPCOMP_H_INCLUDED
      2 #define TOOLTIPCOMP_H_INCLUDED
      3 
      4 #include <JuceHeader.h>
      5 
      6 class TooltipComponent : public Component,
      7                          private Timer
      8 {
      9 public:
     10     TooltipComponent();
     11 
     12     enum ColourIDs
     13     {
     14         backgroundColourID,
     15         textColourID,
     16         nameColourID,
     17     };
     18 
     19     void paint (Graphics& g) override;
     20     void timerCallback() override;
     21     void getTipFor (Component& c, String& newTip, String& newName);
     22 
     23 private:
     24     String name, tip;
     25     std::atomic_bool showTip;
     26 
     27     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TooltipComponent)
     28 };
     29 
     30 class TooltipItem : public foleys::GuiItem
     31 {
     32 public:
     33     FOLEYS_DECLARE_GUI_FACTORY (TooltipItem)
     34 
     35     TooltipItem (foleys::MagicGUIBuilder& builder, const ValueTree& node) : foleys::GuiItem (builder, node)
     36     {
     37         setColourTranslation ({
     38             { "tooltip-background", TooltipComponent::backgroundColourID },
     39             { "tooltip-text", TooltipComponent::textColourID },
     40             { "tooltip-name", TooltipComponent::nameColourID },
     41         });
     42 
     43         addAndMakeVisible (tooltipComp);
     44     }
     45 
     46     void update() override
     47     {
     48     }
     49 
     50     Component* getWrappedComponent() override
     51     {
     52         return &tooltipComp;
     53     }
     54 
     55 private:
     56     TooltipComponent tooltipComp;
     57 
     58     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TooltipItem)
     59 };
     60 
     61 #endif // TOOLTIPCOMP_H_INCLUDED