@@ -809,6 +809,42 @@ class PluginVersionCell : public Component
809809 std::function<void (const String&)> onVersionChanged;
810810};
811811
812+ class PluginDescriptionCalloutComponent : public Component
813+ {
814+ public:
815+ PluginDescriptionCalloutComponent (String descriptionToShow, Font descriptionFont)
816+ : font (std::move (descriptionFont))
817+ {
818+ descriptionText.append (std::move (descriptionToShow),
819+ font,
820+ findColour (ThemeColours::defaultText));
821+ descriptionText.setJustification (Justification::topLeft);
822+ descriptionText.setWordWrap (AttributedString::WordWrap::byWord);
823+ descriptionLayout.createLayout (descriptionText, static_cast <float > (contentWidth - padding * 2 ));
824+ setSize (contentWidth, getPreferredHeight ());
825+ }
826+
827+ void paint (Graphics& g) override
828+ {
829+ g.setColour (findColour (ThemeColours::widgetBackground));
830+ g.fillRoundedRectangle (getLocalBounds ().toFloat ().reduced (1 .0f ), 5 .0f );
831+ descriptionLayout.draw (g, getLocalBounds ().reduced (padding).toFloat ());
832+ }
833+
834+ private:
835+ int getPreferredHeight () const
836+ {
837+ return jlimit (40 , 500 , roundToInt (descriptionLayout.getHeight ()) + padding * 2 );
838+ }
839+
840+ static constexpr int contentWidth = 360 ;
841+ static constexpr int padding = 12 ;
842+
843+ AttributedString descriptionText;
844+ TextLayout descriptionLayout;
845+ Font font;
846+ };
847+
812848class PluginIconButtonCell : public Component
813849{
814850public:
@@ -1117,6 +1153,23 @@ void PluginListBoxComponent::paintCell (Graphics& g,
11171153 g.drawText (text.isNotEmpty () ? text : String (" -" ), textBounds, Justification::centredLeft, true );
11181154}
11191155
1156+ void PluginListBoxComponent::cellClicked (int rowNumber, int columnId, const MouseEvent&)
1157+ {
1158+ if (columnId != descriptionColumn)
1159+ return ;
1160+
1161+ const auto * pluginInfo = getPluginForVisibleRow (rowNumber);
1162+
1163+ if (pluginInfo == nullptr || pluginInfo->description .trim ().isEmpty () || pluginTable == nullptr )
1164+ return ;
1165+
1166+ auto anchorBounds = pluginTable->getCellPosition (descriptionColumn, rowNumber, true );
1167+ auto content = std::make_unique<PluginDescriptionCalloutComponent> (pluginInfo->description .trim (),
1168+ Font (FontOptions (" Inter" , " Regular" , 15 .0f )));
1169+ auto & callOut = CallOutBox::launchAsynchronously (std::move (content), anchorBounds, this );
1170+ callOut.setDismissalMouseClicksAreAlwaysConsumed (true );
1171+ }
1172+
11201173Component* PluginListBoxComponent::refreshComponentForCell (int rowNumber,
11211174 int columnId,
11221175 bool /* isRowSelected*/ ,
@@ -1207,7 +1260,7 @@ String PluginListBoxComponent::getCellTooltip (int rowNumber, int columnId)
12071260 return pluginInfo->developers ;
12081261
12091262 case descriptionColumn:
1210- return pluginInfo->description ;
1263+ return pluginInfo->description . isNotEmpty () ? " Click to view full description " : String () ;
12111264
12121265 case dependenciesColumn:
12131266 return getDependenciesText (*pluginInfo);
0 commit comments