Beispiel #1
0
void LLSlider::draw()
{
	F32 alpha = getDrawContext().mAlpha;

	// since thumb image might still be decoding, need thumb to accomodate image size
	updateThumbRect();

	// Draw background and thumb.

	// drawing solids requires texturing be disabled
	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

	// Track
	LLRect track_rect(mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), 
						getRect().getWidth() - mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
	LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
	mTrackImage->draw(track_rect, LLColor4::white % alpha);
	mTrackHighlightImage->draw(highlight_rect, LLColor4::white % alpha);

	// Thumb
	if (hasFocus())
	{
		// Draw focus highlighting.
		mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor() % alpha, gFocusMgr.getFocusFlashWidth());
	}

	if( hasMouseCapture() )
	{
		// Show ghost where thumb was before dragging began.
		if (mThumbImage.notNull())
		{
			mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % (0.3f * alpha));
			mThumbImage->draw(mThumbRect, mThumbOutlineColor % alpha);
		}
	}
	else if(!getEnabled())
	{
		if (mThumbImage.notNull())
		{
			mThumbImage->draw(mThumbRect, mThumbCenterColor % (0.3f * alpha));
		}
	}
	else
	{
		if (mThumbImage.notNull())
		{
			mThumbImage->draw(mThumbRect, mThumbCenterColor % alpha);
		}
	}
	// Fill in the thumb.
	

	LLUICtrl::draw();
}
Beispiel #2
0
void LLSlider::draw()
{
	// since thumb image might still be decoding, need thumb to accomodate image size
	updateThumbRect();

	// Draw background and thumb.

	// drawing solids requires texturing be disabled
	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

	F32 opacity = getEnabled() ? 1.f : 0.3f;
	LLColor4 center_color = (mThumbCenterColor % opacity);
	LLColor4 track_color = (mTrackColor % opacity);

	// Track
	LLRect track_rect(mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), 
						getRect().getWidth() - mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
	LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
	mTrackImage->draw(track_rect);
	mTrackHighlightImage->draw(highlight_rect);

	// Thumb
	if( hasMouseCapture() )
	{
		// Show ghost where thumb was before dragging began.
		mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % 0.3f);
	}
	if (hasFocus())
	{
		// Draw focus highlighting.
		mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
	}
	// Fill in the thumb.
	mThumbImage->draw(mThumbRect, hasMouseCapture() ? mThumbOutlineColor : center_color);

	LLUICtrl::draw();
}
Beispiel #3
0
void LLMultiSlider::draw()
{
	static LLUICachedControl<S32> extra_triangle_height ("UIExtraTriangleHeight", 0);
	static LLUICachedControl<S32> extra_triangle_width ("UIExtraTriangleWidth", 0);
	LLColor4 curThumbColor;

	std::map<std::string, LLRect>::iterator mIt;
	std::map<std::string, LLRect>::iterator curSldrIt;

	// Draw background and thumb.

	// drawing solids requires texturing be disabled
	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

	LLRect rect(mDragStartThumbRect);

	F32 opacity = getEnabled() ? 1.f : 0.3f;

	// Track
	LLUIImagePtr thumb_imagep = LLUI::getUIImage("Rounded_Square");

	static LLUICachedControl<S32> multi_track_height ("UIMultiTrackHeight", 0);
	S32 height_offset = (getRect().getHeight() - multi_track_height) / 2;
	LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset );


	if(mDrawTrack)
	{
		track_rect.stretch(-1);
		thumb_imagep->draw(track_rect, mTrackColor.get() % opacity);
	}

	// if we're supposed to use a drawn triangle
	// simple gl call for the triangle
	if(mUseTriangle) {

		for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {

			gl_triangle_2d(
				mIt->second.mLeft - extra_triangle_width, 
				mIt->second.mTop + extra_triangle_height,
				mIt->second.mRight + extra_triangle_width, 
				mIt->second.mTop + extra_triangle_height,
				mIt->second.mLeft + mIt->second.getWidth() / 2, 
				mIt->second.mBottom - extra_triangle_height,
				mTriangleColor.get(), TRUE);
		}
	}
	else if (!thumb_imagep)
	{
		// draw all the thumbs
		curSldrIt = mThumbRects.end();
		for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
			
			// choose the color
			curThumbColor = mThumbCenterColor.get();
			if(mIt->first == mCurSlider) {
				
				curSldrIt = mIt;
				continue;
				//curThumbColor = mThumbCenterSelectedColor;
			}

			// the draw command
			gl_rect_2d(mIt->second, curThumbColor, TRUE);
		}

		// now draw the current slider
		if(curSldrIt != mThumbRects.end()) {
			gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor.get(), TRUE);
		}

		// and draw the drag start
		if (gFocusMgr.getMouseCapture() == this)
		{
			gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, FALSE);
		}
	}
	else if( gFocusMgr.getMouseCapture() == this )
	{
		// draw drag start
		thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f);

		// draw the highlight
		if (hasFocus())
		{
			thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
		}

		// draw the thumbs
		curSldrIt = mThumbRects.end();
		for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) 
		{
			// choose the color
			curThumbColor = mThumbCenterColor.get();
			if(mIt->first == mCurSlider) 
			{
				// don't draw now, draw last
				curSldrIt = mIt;
				continue;				
			}
			
			// the draw command
			thumb_imagep->drawSolid(mIt->second, curThumbColor);
		}
		
		// draw cur slider last
		if(curSldrIt != mThumbRects.end()) 
		{
			thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get());
		}
		
	}
	else
	{ 
		// draw highlight
		if (hasFocus())
		{
			thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
		}

		// draw thumbs
		curSldrIt = mThumbRects.end();
		for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) 
		{
			
			// choose the color
			curThumbColor = mThumbCenterColor.get();
			if(mIt->first == mCurSlider) 
			{
				curSldrIt = mIt;
				continue;
				//curThumbColor = mThumbCenterSelectedColor;
			}				
			
			thumb_imagep->drawSolid(mIt->second, curThumbColor % opacity);
		}

		if(curSldrIt != mThumbRects.end()) 
		{
			thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get() % opacity);
		}
	}

	LLF32UICtrl::draw();
}