SetTooltipAction (Component* const comp, ComponentLayout& layout, const String& newValue_) : ComponentUndoableAction <Component> (comp, layout), newValue (newValue_) { SettableTooltipClient* ttc = dynamic_cast <SettableTooltipClient*> (comp); jassert (ttc != 0); oldValue = ttc->getTooltip(); }
void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) { String params (getCreationParameters (component)); const String virtualName (component->getProperties() ["virtualName"].toString()); String s; s << "addAndMakeVisible (" << memberVariableName << " = new "; if (virtualName.isNotEmpty()) s << makeValidCppIdentifier (virtualName, false, false, true); else s << getClassName (component); if (params.isEmpty()) s << "());\n"; else { StringArray lines; lines.addLines (params); params = lines.joinIntoString ("\n" + String::repeatedString (" ", s.length() + 2)); s << " (" << params << "));\n"; } SettableTooltipClient* ttc = dynamic_cast <SettableTooltipClient*> (component); if (ttc != 0 && ttc->getTooltip().isNotEmpty()) { s << memberVariableName << "->setTooltip (" << quotedString (ttc->getTooltip()) << ");\n"; } if (component->getExplicitFocusOrder() > 0) s << memberVariableName << "->setExplicitFocusOrder (" << component->getExplicitFocusOrder() << ");\n"; code.constructorCode += s; }
String getText() const { SettableTooltipClient* ttc = dynamic_cast <SettableTooltipClient*> (component); return ttc->getTooltip(); }