Ejemplo n.º 1
0
	void	FalagardAnimate::drawSelf(float z)
	{
		if( d_needsRedraw )
		{
			d_renderCache.clearCachedImagery();
			d_needsRedraw = false;
			// normal 状态是作为永远显示模式出现的
			drawNormal( z );
			if (isDisabled(true) )
			{
				drawDisabled(z);
			}
			else
			{
				//If pushed or checked draw "Pushed" Layer
				if (isPushed() ) 
				{
					drawPushed(z);
				}
				//Draw "Hover" Layer
				if (isHovering() )
				{
					drawHover(z);
				}
			}
		}
		Window::drawSelf(z);
	}
Ejemplo n.º 2
0
void gcImgButtonCount::refreshImage()
{
	gcImageButton::refreshImage();

	if (isHovering())
		m_imgCount = GetGCThemeManager()->getImageHandle("#count_background_hover");
	else
		m_imgCount = GetGCThemeManager()->getImageHandle("#count_background");
}
Ejemplo n.º 3
0
void gcImgButtonCount::doPaint(wxDC* dc)
{
	gcImageButton::doPaint(dc);

	if (m_uiCount == 0 || !m_imgCount.getImg() || !m_imgCount->IsOk())
	{
		return;
	}

	gcWString text(L"+");

	if (m_uiCount < 10)
	{
		text = gcWString(L"{0}", m_uiCount);
		wxFont font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
		dc->SetFont(font);
	}
	else
	{
		wxFont font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
		dc->SetFont(font);
	}

	if (isHovering())
		dc->SetTextForeground(wxColor(GetGCThemeManager()->getColor("countbubble", "hov-fg")));
	else
		dc->SetTextForeground(wxColor(GetGCThemeManager()->getColor("countbubble", "fg")));


	wxSize sz = GetSize();

	int x = sz.GetWidth()-15;
	int y = 4;

	int w = m_imgCount->GetWidth();
	int h = m_imgCount->GetHeight();

	int tx = x+(w - dc->GetTextExtent(text).GetWidth())/2;
	int ty = y+(h - dc->GetTextExtent(text).GetHeight())/2;

	wxBitmap temp(m_imgCount->Copy());

	wxMemoryDC memDC(temp);

	dc->Blit(x, y,			// Draw at (100, 100)
			w, h,			// Draw full bitmap
			&memDC,			// Draw from memDC
			0, 0,			// Draw from bitmap origin
			wxCOPY,			// Logical operation
			true);			// Take mask into account

	memDC.SelectObject(wxNullBitmap);

	dc->DrawText(text, tx, ty);
}
Ejemplo n.º 4
0
//main function to get values out of the timeline, operates on the given value range
bool ofxTLFlags::mousePressed(ofMouseEventArgs& args, long millis){
	
    //if we aren't entering text and someone has the shift key held down don't let us go into modal
//    if(!enteringText && ofGetModifierSelection()){
//        return ofxTLBangs::mousePressed(args, millis);
//    }
        
    clickedTextField = NULL;    
    //look at each element to see if a text field was clicked
    for(int i = 0; i < keyframes.size(); i++){
        ofxTLFlag* key = (ofxTLFlag*)keyframes[i];
		if(key->display.inside(args.x, args.y)){
            clickedTextField = key;
            break;
        }
    }

//	cout << "text field? " << (clickedTextField == NULL ? "NULL" : clickedTextField->textField.text) << endl;
    //if so, select that text field and key and present modally
    //so that keyboard input all goes to the text field.
    //selection model is designed so that you can type into
    //mulitple fields at once
    if(clickedTextField != NULL){
        timeline->presentedModalContent(this);
        if(!ofGetModifierSelection()){
            timeline->unselectAll();
        }
		if(ofGetModifierSelection() && clickedTextField->textField.isEditing()){
			clickedTextField->textField.endEditing();
		}
		else{
			clickedTextField->textField.beginEditing();
			enteringText = true;
			//make sure this key is selected
			selectKeyframe(clickedTextField);
		}
        return false;
    }
	else{
		if(enteringText && !isHovering()){
			for(int i = 0; i < selectedKeyframes.size(); i++){
				((ofxTLFlag*)selectedKeyframes[i])->textField.endEditing();
			}
			enteringText = false;
			timeline->dismissedModalContent();
		}
	}
	
	if(!enteringText){
		//if we get all the way here we didn't click on a text field and we aren't
		//currently entering text so proceed as normal
		return ofxTLBangs::mousePressed(args, millis);
	}
	return false;
}
Ejemplo n.º 5
0
ofxTLKeyframe* ofxTLColorTrack::keyframeAtScreenpoint(ofVec2f p) {
    if(isHovering()) {
        for(int i = 0; i < keyframes.size(); i++) {
            float offset = p.x - timeline->millisToScreenX(keyframes[i]->time);
            if (abs(offset) < 5) {
                return keyframes[i];
            }
        }
    }
    return NULL;
}
Ejemplo n.º 6
0
QPainterPath ArrowItem::shape() const {
  QPainterPath selectPath;
  selectPath.setFillRule(Qt::WindingFill);
  selectPath.addPolygon(rect());
  selectPath.addPolygon(start);
  selectPath.addPolygon(end);
  if ((!isSelected() && !isHovering()) || (view()->mouseMode() == View::Create)) {
  } else {
    selectPath.addPath(grips());
  }
  return selectPath;
}
Ejemplo n.º 7
0
/*************************************************************************
Draw method
*************************************************************************/
void TabButton::drawSelf(float z)
{
	if (isDisabled())
	{
		drawDisabled(z);
	}
	else if (isHovering())
	{
		drawHover(z);
	}
    else if (d_selected)
    {
        drawPushed(z);
    }
    else
    {
        drawNormal(z);
    }
}
Ejemplo n.º 8
0
/*************************************************************************
	Perform the rendering for this widget.	
*************************************************************************/
void ButtonBase::drawSelf(float z)
{
	if (isHovering())
	{
		drawHover(z);
	}
	else if (isPushed())
	{
		drawPushed(z);
	}
	else if (isDisabled())
	{
		drawDisabled(z);
	}
	else
	{
		drawNormal(z);
	}

}
Ejemplo n.º 9
0
void LLHoverView::draw()
{
	if ( !isHovering() )
	{
		return;
	}

	// To toggle off hover tips, you have to just suppress the draw.
	// The picking is still needed to do cursor changes over physical
	// and scripted objects.  JC
//	if (!sShowHoverTips) 
// [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l
#ifdef RLV_EXTENSION_CMD_INTERACT
	if ( (!sShowHoverTips) || (gRlvHandler.hasBehaviour(RLV_BHVR_INTERACT)) )
#else
	if (!sShowHoverTips) 
#endif // RLV_EXTENSION_CMD_INTERACT
// [/RLVa:KB]
	{
		return;
	}

	const F32 MAX_HOVER_DISPLAY_SECS = 5.f;
	if (mHoverTimer.getElapsedTimeF32() > MAX_HOVER_DISPLAY_SECS)
	{
		return;
	}

	const F32 MAX_ALPHA = 0.9f;
	//const F32 STEADY_ALPHA = 0.3f;
	F32 alpha;
	if (mHoverActive)
	{
		alpha = 1.f;

		if (isHoveringObject())
		{
			// look at object
			LLViewerObject *hover_object = getLastHoverObject();
			if (hover_object->isAvatar())
			{
				gAgent.setLookAt(LOOKAT_TARGET_HOVER, getLastHoverObject(), LLVector3::zero);
			}
			else
			{
				gAgent.setLookAt(LOOKAT_TARGET_HOVER, getLastHoverObject(), mHoverOffset);
			}
		}
	}
	else
	{
		alpha = llmax(0.f, MAX_ALPHA - mHoverTimer.getElapsedTimeF32()*2.f);
	}

	// Bail out if no text to display
	if (mText.empty())
	{
		return;
	}

	// Don't draw if no alpha
	if (alpha <= 0.f)
	{
		return;
	}

	LLUIImagePtr box_imagep = LLUI::getUIImage("rounded_square.tga");
	LLUIImagePtr shadow_imagep = LLUI::getUIImage("rounded_square_soft.tga");

	const LLFontGL* fontp = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF_SMALL);

	// Render text.
	LLColor4 text_color = gColors.getColor("ToolTipTextColor");
	// LLColor4 border_color = gColors.getColor("ToolTipBorderColor");
	LLColor4 bg_color = gColors.getColor("ToolTipBgColor");
	LLColor4 shadow_color = gColors.getColor("ColorDropShadow");

	// Could decrease the alpha here. JC
	//text_color.mV[VALPHA] = alpha;
	//border_color.mV[VALPHA] = alpha;
	//bg_color.mV[VALPHA] = alpha;

	S32 max_width = 0;
	S32 num_lines = mText.size();
	for (text_list_t::iterator iter = mText.begin(); iter != mText.end(); ++iter)
	{
		max_width = llmax(max_width, (S32)fontp->getWidth(*iter));
	}

	S32 left	= mHoverPos.mX + 10;
	S32 top		= mHoverPos.mY - 16;
	S32 right	= mHoverPos.mX + max_width + 30;
	S32 bottom	= mHoverPos.mY - 24 - llfloor(num_lines*fontp->getLineHeight());

	// Push down if there's a one-click icon
	if (mHoverActive
		&& isHoveringObject()
		&& mLastHoverObject->getClickAction() != CLICK_ACTION_NONE)
	{
		const S32 CLICK_OFFSET = 10;
		top -= CLICK_OFFSET;
		bottom -= CLICK_OFFSET;
	}

	// Make sure the rect is completely visible
	LLRect old_rect = getRect();
	setRect( LLRect(left, top, right, bottom ) );
	translateIntoRect( gViewerWindow->getVirtualWindowRect(), FALSE );
	left = getRect().mLeft;
	top = getRect().mTop;
	right = getRect().mRight;
	bottom = getRect().mBottom;
	setRect(old_rect);

	LLGLSUIDefault gls_ui;

	shadow_color.mV[VALPHA] = 0.7f * alpha;
	S32 shadow_offset = gSavedSettings.getS32("DropShadowTooltip");
	shadow_imagep->draw(LLRect(left + shadow_offset, top - shadow_offset, right + shadow_offset, bottom - shadow_offset), shadow_color);

	bg_color.mV[VALPHA] = alpha;
	box_imagep->draw(LLRect(left, top, right, bottom), bg_color);

	S32 cur_offset = top - 4;
	for (text_list_t::iterator iter = mText.begin(); iter != mText.end(); ++iter)
	{
		fontp->renderUTF8(*iter, 0, left + 10, cur_offset, text_color, LLFontGL::LEFT, LLFontGL::TOP);
		cur_offset -= llfloor(fontp->getLineHeight());
	}
}
Ejemplo n.º 10
0
void FalagardActionButton::drawSelf( float z )
{
    if (d_needsRedraw  )
    {
        d_renderCache.clearCachedImagery();
        d_needsRedraw = false;
        const StateImagery* imagery;
        // get WidgetLookFeel for the assigned look.
        const WidgetLookFeel& wlf = WidgetLookManager::getSingleton().getWidgetLook(d_lookName);
        if( wlf.isStateImageryPresent( "BackgroundImage" ) )
        {
            imagery = &wlf.getStateImagery( "BackgroundImage" );
            // peform the rendering operation.
            imagery->render(*this);
        }
        // 画背景

        d_BackImage.draw(d_renderCache);
        //Empty
        if(isEmpty())
        {
            if((isHovering() || isPushed()) && !isDisabled(true) )//&& !isGloom())
            {
                drawHover(z);
            }
        }
        else
        {
            //Draw normal image
            drawNormal(z);

            //Draw percentage Img
            if(isPercentagePresent())
            {
                drawPercentageImg(z);
            }

            //Notin Dragging
            if(d_dragging && !isGloom())
            {
                drawPushed(z);
            }
            else
            {
                //Draw disable mask only when disabled
                if (isDisabled(true) || isGloom() )
                {
                    drawDisabled(z);
                    if (isPushed() || isChecked())
                    {
                        drawPushed(z);
                    }
                    drawAnimate(z);
                }
                else
                {
                    //If pushed or checked draw "Pushed" Layer
                    if (isPushed() || isChecked())
                    {
                        drawPushed(z);
                    }

                    //Draw "Hover" Layer
                    if (isHovering() && !isChecked())
                    {
                        drawHover(z);
                    }

                    drawAnimate(z);
                    // If default
                    if(isDefault())
                    {
                        drawDefault(z);
                    }

                }

                //Draw corner character
                drawCorner(z);
                drawFlash( z );
            }
        }
    }

    Window::drawSelf(z);
}
Ejemplo n.º 11
0
	void FalagardActionButton::drawSelf( float z )
	{
		if (d_needsRedraw  )
		{
			d_renderCache.clearCachedImagery();
			d_needsRedraw = false;
			
			//Empty
			if(isEmpty())
			{
				if((isHovering() || isPushed()) && !isDisabled(true) )//&& !isGloom())
				{
					drawHover(z);
				}
			}
			else
			{
				//Draw normal image
				drawNormal(z);

				//Notin Dragging
				if(d_dragging && !isGloom())
				{
					drawPushed(z);
				}
				else
				{
					//Draw disable mask only when disabled
					if (isDisabled(true) || isGloom() )
					{
						drawDisabled(z);
						if (isPushed() || isChecked()) 
						{
							drawPushed(z);
						}
					}
					else
					{
						//If pushed or checked draw "Pushed" Layer
						if (isPushed() || isChecked()) 
						{
							drawPushed(z);
						}

						//Draw "Hover" Layer
						if (isHovering() && !isChecked())
						{
							drawHover(z);
						}

						drawAnimate(z);
						// If default
						if(isDefault())
						{
							drawDefault(z);
						}
						
					}

					//Draw corner character
					drawCorner(z);
				}
			}
		}

		Window::drawSelf(z);
	}