//============================================================================== const String colourToHex (const Colour& col) { return String::toHexString ((int) col.getARGB()); }
bool MultiDocumentPanel::addDocument (Component* const component, const Colour& docColour, const bool deleteWhenRemoved) { // If you try passing a full DocumentWindow or ResizableWindow in here, you'll end up // with a frame-within-a-frame! Just pass in the bare content component. jassert (dynamic_cast <ResizableWindow*> (component) == nullptr); if (component == nullptr || (maximumNumDocuments > 0 && components.size() >= maximumNumDocuments)) return false; components.add (component); component->getProperties().set ("mdiDocumentDelete_", deleteWhenRemoved); component->getProperties().set ("mdiDocumentBkg_", (int) docColour.getARGB()); component->addComponentListener (this); if (mode == FloatingWindows) { if (isFullscreenWhenOneDocument()) { if (components.size() == 1) { addAndMakeVisible (component); } else { if (components.size() == 2) addWindow (components.getFirst()); addWindow (component); } } else { addWindow (component); } } else { if (tabComponent == nullptr && components.size() > numDocsBeforeTabsUsed) { addAndMakeVisible (tabComponent = new MDITabbedComponentInternal()); Array <Component*> temp (components); for (int i = 0; i < temp.size(); ++i) tabComponent->addTab (temp[i]->getName(), docColour, temp[i], false); resized(); } else { if (tabComponent != nullptr) tabComponent->addTab (component->getName(), docColour, component, false); else addAndMakeVisible (component); } setActiveDocument (component); } resized(); activeDocumentChanged(); return true; }
/// getters int LComponent::findColour ( lua_State* ) { if (child) { int colourId = LUA::getNumber(2); bool inheritFromParent = LUA::checkAndGetBoolean(2, false); //return LUA::returnString( (child->findColour( colourId, inheritFromParent )).toString() ); //return LUA::returnString( (child->findColour( colourId, inheritFromParent )).toDisplayString(true) ); Colour c = child->findColour(colourId, inheritFromParent); return LUCE::luce_pushtable( std::list<var>{ c.toDisplayString(true), var((int)c.getARGB()) } ); } else return 0; }