コード例 #1
0
MLDrawing::MLDrawing(MLWidget* pContainer) :
	MLWidget(pContainer)
{
	MLWidget::setComponent(this);
	MLLookAndFeel* myLookAndFeel = (&(getRootViewResources(this).mLookAndFeel));
		
	setOpaque(myLookAndFeel->getDefaultOpacity());
	setBufferedToImage(myLookAndFeel->getDefaultBufferMode());
	setPaintingIsUnclipped(myLookAndFeel->getDefaultUnclippedMode());

	// setup component
	setRepaintsOnMouseActivity (false);
	setInterceptsMouseClicks(false, false);
	
	// set default drawing state
	mLineThickness = 1.0f;
	mDarkColor = mLineColor = myLookAndFeel->findColour(MLLookAndFeel::darkLabelColor);
	mLightColor = myLookAndFeel->findColour(MLLookAndFeel::lightLabelColor);

}
コード例 #2
0
// the colors for different MLDial parts are generated algorithmically.
void MLMultiSlider::setFillColor (const Colour& c)
{
	float g = c.getFloatGreen();
	float b = (1.f - g);	

	// thumb fill
	setColour(fillColor, c);
	// bright line
	setColour(indicatorColor, Colour(c.getHue(), jmax(c.getSaturation() - (b*0.05), 0.), jmin((c.getBrightness() + b*2.f), 1.f), 1.f));

	MLLookAndFeel* myLookAndFeel = (&(getRootViewResources(this).mLookAndFeel));
	// track background plain
	setColour(trackEmptyDarkColor, myLookAndFeel->findColour(MLLookAndFeel::darkestFillColor));
	// dial fill selected 
	setColour(trackFullLightColor, findColour(fillColor).overlaidWith(findColour(indicatorColor).withAlpha(0.15f)));
	// track fill 
	setColour(trackFullDarkColor, c.overlaidWith(Colours::black.withAlpha(0.17f)).withMultipliedSaturation(1.5f));

    lookAndFeelChanged();
}