Ejemplo n.º 1
0
	void Button::updateButtonState()
	{
		if (mStateSelected)
		{
			if (!getEnabled())
			{
				if (!_setState("disabled_checked"))
					_setState("disabled");
			}
			else if (mIsMousePressed)
			{
				if (!_setState("pushed_checked"))
					_setState("pushed");
			}
			else if (mIsMouseFocus)
			{
				if (!_setState("highlighted_checked"))
					_setState("pushed");
			}
			else
				_setState("normal_checked");
		}
		else
		{
			if (!getEnabled())
				_setState("disabled");
			else if (mIsMousePressed)
				_setState("pushed");
			else if (mIsMouseFocus)
				_setState("highlighted");
			else
				_setState("normal");
		}
	}
Ejemplo n.º 2
0
Layer* TabPanel::getDrawnTabBackground(const UInt32& Index) const
{
    if(getEnabled())
    {
        if(Index == getSelectedIndex())
        {
            return getTabActiveBackground();
        }
        else if(Index == _MouseInTabLastMouse)
        {
            return getTabRolloverBackground();
        }
        else if(getTabs(Index)->getFocused())
        {
            return getTabFocusedBackground();
        }
        else
        {
            return getTabBackground();
        }
    }
    else
    {
        return getTabDisabledBackground();
    }
}
Ejemplo n.º 3
0
void GLDebugDrawer::drawContactPoint( const btVector3& pointOnB,
    const btVector3& normalOnB, btScalar distance,
    int lifeTime, const btVector3& color) {
    if( !getEnabled() )
        return;

    if( !_active ) {
        osg::notify( osg::WARN ) << "GLDebugDrawer: BeginDraw was not called." << std::endl;
        return;
    }

    _contacts++;

    _ptVerts->push_back( asOsgVec3( pointOnB ) );
    _ptColors->push_back( asOsgVec4( color, 1. ) );

    btVector3 to=pointOnB+normalOnB*distance;
    const btVector3&from = pointOnB;

    drawLine( from, to, color );

    char buf[12];
    sprintf(buf," %d",lifeTime);

    draw3dText( from, buf );
}
Ejemplo n.º 4
0
void ScrollBar::handleMaxButtonAction(ActionEventDetails* const e)
{
	if(getEnabled())
	{
		scrollUnit(1);
	}
}
Ejemplo n.º 5
0
	void TMenuItem::paintAt(Graphics* g, int x, int y) {
		switch (type) {
			case TYPE_ITEM:
				if (getEnabled()) {
					if (getFocused()) {
						g->setColor(Color::blue);
						g->drawRect(x, y, getWidth(), getHeight());
						g->setColor(COLOR_BLUEGRAY);
						g->fillRect(x + 1, y + 1, getWidth() - 2, getHeight() - 2);
					} else {
						g->setColor(getBackground());
						g->fillRect(x, y, getWidth(), getHeight());
					}
					g->setColor(getForeground());
					g->drawString(title, x + 10, y + 3);
				} else {
					g->setColor(getBackground());
					g->fillRect(x, y, getWidth(), getHeight());
					g->setColor(Color::gray);
					g->drawString(title, 10 + x, 3 + y);
				}
				break;
			case TYPE_SEPARATOR:
				g->setColor(getForeground());
				g->drawLine(x + 5, y + 3, x + getWidth() - 5, y + 3);
				break;
			default:
				break;
		}
	}
Ejemplo n.º 6
0
void Button::mousePressed(MouseEventDetails* const e)
{
    if(getEnabled())
    {
        if(e->getButton()==MouseEventDetails::BUTTON1){
            this->setActive(true);
            _Armed = true;

            if(getParentWindow() != NULL && getParentWindow()->getParentDrawingSurface()!=NULL&& getParentWindow()->getParentDrawingSurface()->getEventProducer() != NULL)
            {
                _ArmedMouseReleasedConnection.disconnect();
                _ArmedMouseReleasedConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectMouseReleased(boost::bind(&Button::handleArmedMouseReleased, this, _1));

                if(getEnableActionOnMouseDownTime())
                {
                    produceMousePressedActionPerformed();
                    resetArmed();
                    _ArmedUpdateEventConnection.disconnect();
                    _ArmedUpdateEventConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectUpdate(boost::bind(&Button::handleArmedUpdate, this, _1));
                }
            }
        }
    }
    Component::mousePressed(e);
}
Ejemplo n.º 7
0
UIDrawObjectCanvas* Button::getDrawnDrawObject(void) const
{
    if(getEnabled())
    {
        //if(getFocused())
        //{
        //    return getFocusedDrawObject();
        //}
        if(getActive())
        {
            return getActiveDrawObject();
        }
        else if(_MouseInComponentLastMouse)
        {
            return getRolloverDrawObject();
        }
        else
        {
            return getDrawObject();
        }
    }
    else
    {
        return getDisabledDrawObject();
    }
}
Ejemplo n.º 8
0
Color4f Button::getDrawnTextColor(void) const
{
    if(getEnabled())
    {
        //if(getFocused())
        //{
        //    return getFocusedTextColor();
        //}
        if(getActive())
        {
            return getActiveTextColor();
        }
        else if(_MouseInComponentLastMouse)
        {
            return getRolloverTextColor();
        }
        else
        {
            return getTextColor();
        }
    }
    else
    {
        return getDisabledTextColor();
    }
}
Ejemplo n.º 9
0
Layer* Button::getDrawnForeground(void) const
{
    if(getEnabled())
    {
        //if(getFocused())
        //{
        //    return getFocusedTextColor();
        //}
        if(getActive())
        {
            return getActiveForeground();
        }
        else if(_MouseInComponentLastMouse)
        {
            return getRolloverForeground();
        }
        else
        {
            return getForeground();
        }
    }
    else
    {
        return getDisabledForeground();
    }
}
Ejemplo n.º 10
0
Layer* Button::getDrawnBackground(void) const
{
    if(getEnabled())
    {
        //if(getFocused())
        //{
        //    return getFocusedTextColor();
        //}
        if(getActive())
        {
            return getActiveBackground();
        }
        else if(getMouseOver())
        {
            return getRolloverBackground();
        }
        else
        {
            return getBackground();
        }
    }
    else
    {
        return getDisabledBackground();
    }
}
void LLTextureCtrl::onFloaterCommit(ETexturePickOp op)
{
	LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();

	if( floaterp && getEnabled())
	{
		mDirty = (op != TEXTURE_CANCEL);
		if( floaterp->isDirty() )
		{
			setTentative( FALSE );
			mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
			lldebugs << "mImageItemID: " << mImageItemID << llendl;
			mImageAssetID = floaterp->getAssetID();
			lldebugs << "mImageAssetID: " << mImageAssetID << llendl;
			if (op == TEXTURE_SELECT && mOnSelectCallback)
			{
				mOnSelectCallback(this, mCallbackUserData);
			}
			else if (op == TEXTURE_CANCEL && mOnCancelCallback)
			{
				mOnCancelCallback(this, mCallbackUserData);
			}
			else
			{
				onCommit();
			}
		}
	}
}
Ejemplo n.º 12
0
//-----------------------------------------------------------------------------
// onCommitEmote()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitEmote()
{
	if (!getEnabled())
		return;

	resetMotion(); // ssts emote
}
Ejemplo n.º 13
0
Layer* AbstractWindow::getDrawnForeground(void) const
{
	if(getDrawDecorations())
    {
        if(getEnabled())
        {
            if(getFocused())
            {
                return getFocusedForeground();
            }
            else if(_MouseInComponentLastMouse)
            {
                return getRolloverForeground();
            }
            else
            {
                return getForeground();
            }
        }
        else
        {
            return getDisabledForeground();
        }
    }
    else
	{
		return NULL;
	}
}
Ejemplo n.º 14
0
void LLSpinCtrl::updateLabelColor()
{
	if( mLabelBox )
	{
		mLabelBox->setColor( getEnabled() ? mTextEnabledColor.get() : mTextDisabledColor.get() );
	}
}
Ejemplo n.º 15
0
STDMETHODIMP NATNetworkWrap::COMGETTER(Enabled)(BOOL *aEnabled)
{
    LogRelFlow(("{%p} %s: enter aEnabled=%p\n", this, "NATNetwork::getEnabled", aEnabled));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        CheckComArgOutPointerValidThrow(aEnabled);

        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = getEnabled(aEnabled);
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave *aEnabled=%RTbool hrc=%Rhrc\n", this, "NATNetwork::getEnabled", *aEnabled, hrc));
    return hrc;
}
Ejemplo n.º 16
0
Border* AbstractWindow::getDrawnBorder(void) const
{
    if(getDrawDecorations())
    {
        if(getEnabled())
        {
            if(getFocused())
            {
                return getFocusedBorder();
            }
            else if(_MouseInComponentLastMouse)
            {
                return getRolloverBorder();
            }
            else
            {
                return getBorder();
            }
        }
        else
        {
            return getDisabledBorder();
        }
    }
    else
    {
        return NULL;
    }
}
Ejemplo n.º 17
0
//-----------------------------------------------------------------------------
// onCommitBaseAnim()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitBaseAnim()
{
	if (!getEnabled())
		return;

	if (mAnimPreview)
	{
		LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar();

		BOOL paused = avatarp->areAnimationsPaused();

		// stop all other possible base motions
		avatarp->stopMotion(mIDList["Standing"], TRUE);
		avatarp->stopMotion(mIDList["Walking"], TRUE);
		avatarp->stopMotion(mIDList["Sitting"], TRUE);
		avatarp->stopMotion(mIDList["Flying"], TRUE);

		resetMotion();

		if (!paused)
		{
			mPauseRequest = NULL;
		}
	}
}
Ejemplo n.º 18
0
void LLComboBox::draw()
{
	mButton->setEnabled(getEnabled() /*&& !mList->isEmpty()*/);

	// Draw children normally
	LLUICtrl::draw();
}
Ejemplo n.º 19
0
void DebugRenderer::BeginDraw()
{
    if( !getEnabled() )
        return;

    if( _ptVerts->size() > 0 )
    {
        _ptGeom->removePrimitiveSet( 0 );
        _ptVerts->clear();
        _ptColors->clear();
    }

    if( _lnVerts->size() > 0 )
    {
        _lnGeom->removePrimitiveSet( 0 );
        _lnVerts->clear();
        _lnColors->clear();
    }

    if( _triVerts->size() > 0 )
    {
        _triGeom->removePrimitiveSet( 0 );
        _triVerts->clear();
        _triColors->clear();
    }

    if( _geode->getNumDrawables() > 3 )
        _geode->removeDrawables( 3, _textStrings );
    _textStrings = 0;

    _contacts = 0;

    _active = true;
}
Ejemplo n.º 20
0
void LLSpinCtrl::onDownBtn( const LLSD& data )
{
	if( getEnabled() )
	{
		std::string text = mEditor->getText();
		if( LLLineEditor::postvalidateFloat( text ) )
		{

			LLLocale locale(LLLocale::USER_LOCALE);
			F32 cur_val = (F32) atof(text.c_str());
		
			F32 val = cur_val - mIncrement;
			val = clamp_precision(val, mPrecision);
			val = llmax( val, mMinValue );

			if (val < mMinValue) val = mMinValue;
			if (val > mMaxValue) val = mMaxValue;
			
			F32 saved_val = (F32)getValue().asReal();
			setValue(val);
			if( mValidateSignal && !(*mValidateSignal)( this, val ) )
			{
				setValue( saved_val );
				reportInvalidData();
				updateEditor();
				return;
			}
		
			updateEditor();
			onCommit();
		}
	}
}
Ejemplo n.º 21
0
void DebugRenderer::draw3dText(const osg::Vec3& location,const char* textString)
{
    if( !getEnabled() )
        return;

    FIXME(Bullet Text)
    //if( (_debugMode & btIDebugDraw::DBG_DrawText) == 0 )
    //    return;

    if( !_active )
    {
        osg::notify( osg::WARN ) << "DebugRenderer: BeginDraw was not called." << std::endl;
        return;
    }

    if( _textStrings == _textVec.size() )
    {
        int oldSize( _textVec.size() );
        int newSize( oldSize * 2 );
        _textVec.resize( newSize );
        int idx;
        for( idx=oldSize; idx<newSize; idx++ )
            _textVec[ idx ] = initText();
    }
    osgText::Text* text = _textVec[ _textStrings ].get();
    _textStrings++;

    text->setPosition( location /*osgbCollision::asOsgVec3( location )*/ );
    text->setText( std::string( textString ) );

    _geode->addDrawable( text );
}
Ejemplo n.º 22
0
void DebugRenderer::drawContactPoint( const osg::Vec3& pointOnB,
    const osg::Vec3& normalOnB, float distance, 
    int lifeTime, const osg::Vec3& color)
{
    if( !getEnabled() )
        return;

    if( !_active )
    {
        osg::notify( osg::WARN ) << "DebugRenderer: BeginDraw was not called." << std::endl;
        return;
    }

    _contacts++;

    _ptVerts->push_back( pointOnB /*osgbCollision::asOsgVec3( pointOnB )*/ );
    _ptColors->push_back( osg::Vec4( color, 1.) /*osgbCollision::asOsgVec4( color, 1. )*/ );

    /*btVector3*/osg::Vec3 to=pointOnB+normalOnB*distance;
    const /*btVector3*/osg::Vec3 &from = pointOnB;

    drawLine( from, to, color );

    char buf[12];
    sprintf(buf," %d",lifeTime);

    draw3dText( from, buf );
}
Ejemplo n.º 23
0
void DebugRenderer::drawLine(const osg::Vec3& from,const osg::Vec3& to,const osg::Vec3& color)
{
    if( !getEnabled() )
        return;

    if( !_active)
    {
        osg::notify( osg::WARN ) << "DebugRenderer: BeginDraw was not called." << std::endl;
        return;
    }

    // If the physics sim contains a plane, the AABB is rendered with
    // astronomical values. When this occurs in combination with OSG's
    // auto-compute near/far feature, the resulting far plane is very
    // distant, and consequently the near plane is pulled back to maintain
    // the default near/far ratio. As a result, the entire scene is clipped.
    // In this case, don't draw this line.
    osg::Vec3 osgFrom = from; //osgbCollision::asOsgVec3( from );
    osg::Vec3 osgTo = to;     //osgbCollision::asOsgVec3( to );
    const double bigValue( 10000. );
    if( ( osg::absolute< double >( osgFrom[ 0 ] ) > bigValue ) ||
        ( osg::absolute< double >( osgFrom[ 1 ] ) > bigValue ) ||
        ( osg::absolute< double >( osgFrom[ 2 ] ) > bigValue ) ||
        ( osg::absolute< double >( osgTo[ 0 ] ) > bigValue ) ||
        ( osg::absolute< double >( osgTo[ 1 ] ) > bigValue ) ||
        ( osg::absolute< double >( osgTo[ 2 ] ) > bigValue ) )
        return;
    _lnVerts->push_back( osgFrom );
    _lnVerts->push_back( osgTo );  

    osg::Vec4 c = osg::Vec4(color,1); //osgbCollision::asOsgVec4( color, 1. );
    _lnColors->push_back( c );
    _lnColors->push_back( c );
}
Ejemplo n.º 24
0
//--------------------------------------------------------------
// get current frame and text color from state
void mgSimpleField::getFrame(
  const mgFrame*& frame,
  mgColor& textColor)
{
  if (getEnabled())
  {
    if (isKeyFocus())
    {
      frame = m_downFrame;
      textColor = m_downColor;
    }
    else if (m_hasMouse)
    {
      frame = m_hoverFrame;
      textColor = m_hoverColor;
    }
    else
    {
      frame = m_upFrame;
      textColor = m_upColor;
    }
  }
  else
  {
    frame = m_disFrame;
    textColor = m_disColor;
  }
}
Ejemplo n.º 25
0
//-----------------------------------------------------------------------------
// onCommitHandPose()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitHandPose()
{
	if (!getEnabled())
		return;

	resetMotion(); // sets hand pose
}
bool CIRCDDBGatewayConfigIrcDDBSet::Validate()
{
	int n = m_enabled->GetCurrentSelection();
	if (n == wxNOT_FOUND)
		return false;

	bool enabled = getEnabled();
	if (!enabled)
		return true;

	bool res = getHostname().IsEmpty();
	if (res) {
		wxMessageDialog dialog(this, _("The Hostname may not be empty"), m_title + _(" Error"), wxICON_ERROR);
		dialog.ShowModal();
		return false;
	}

	res = getUsername().IsEmpty();
	if (res) {
		wxMessageDialog dialog(this, _("The Username may not be empty"), m_title + _(" Error"), wxICON_ERROR);
		dialog.ShowModal();
		return false;
	}

	return true;
}
Ejemplo n.º 27
0
void LLTextBox::draw()
{
	if (mBorderVisible)
	{
		gl_rect_2d_offset_local(getLocalRect(), 2, FALSE);
	}

	if( mBorderDropShadowVisible )
	{
		static LLColor4 color_drop_shadow = LLUI::sColorsGroup->getColor("ColorDropShadow");
		static S32 drop_shadow_tooltip = LLUI::sConfigGroup->getS32("DropShadowTooltip");
		gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
			color_drop_shadow, drop_shadow_tooltip);
	}

	if (mBackgroundVisible)
	{
		LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 );
		gl_rect_2d( r, mBackgroundColor );
	}

	S32 text_x = 0;
	switch( mHAlign )
	{
	case LLFontGL::LEFT:	
		text_x = mHPad;						
		break;
	case LLFontGL::HCENTER:
		text_x = getRect().getWidth() / 2;
		break;
	case LLFontGL::RIGHT:
		text_x = getRect().getWidth() - mHPad;
		break;
	}

	S32 text_y = getRect().getHeight() - mVPad;

	if ( getEnabled() )
	{
		if(mHasHover)
		{
			drawText( text_x, text_y, mHoverColor );
		}
		else
		{
			drawText( text_x, text_y, mTextColor );
		}				
	}
	else
	{
		drawText( text_x, text_y, mDisabledColor );
	}

	if (sDebugRects)
	{
		drawDebugRect();
	}

	mHasHover = FALSE; // This is reset every frame.
}
Ejemplo n.º 28
0
void HypNode::markEnable(int on, int descend) {
  int j;
  int wanted, value;
  HypLink *l;
  HypNode *n;
  setEnabled(on);
  for (j = 0; j < getChildCount(); j++) {
    l = getChildLink(j);
    n = l->getChild();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  l = getParentLink();
  if (l) {
    n = l->getParent();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  for (j = 0; j < getOutgoingCount(); j++) {
    l = getOutgoing(j);
    n = l->getChild();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  for (j = 0; j < getIncomingCount(); j++) {
    l = getIncoming(j);
    n = l->getParent();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  if (descend) 
    for (j = 0; j < getChildCount(); j++) {
      children[j]->markEnable(on, descend);
    }
}
Ejemplo n.º 29
0
	void Scrollbar::paint(Graphics* g)
	{
		int w = getWidth();
		int h = getHeight();
		
		// 外枠
		g->setColor(Color::gray);
		g->fillRect(0, 0, w, h);
		g->setColor(Color::black);
		g->drawRect(0, 0, w, h);
		
		// 非活性のときはボタンを描画しない
		// 最大値と最小値が等しいときはボタンを描画しない
		if (getEnabled() == false || (getMaximum() - getMinimum()) == 0) return;
		
		// 垂直スクロールバー
		if (this->orientation == VERTICAL) {
			// 上向き矢印
			for (int i = 0; i < 16; i++) {
				for (int j = 0; j < 16; j++) {
					g->drawPixel(j, i, arrow_palette[arrow1_data[i * 16 + j] & 0xFF]);
				}
			}
			// 下向き矢印
			for (int i = 0; i < 16; i++) {
				for (int j = 0; j < 16; j++) {
					g->drawPixel(j, i + h - 16, arrow_palette[arrow2_data[i * 16 + j] & 0xFF]);
				}
			}
			// ボタン
			int offset = 15 + (h - 47) * (getValue() - getMinimum()) / (getMaximum() - getMinimum());
			for (int i = 0; i < 17; i++) {
				for (int j = 0; j < 16; j++) {
					g->drawPixel(j, i + offset, button_palette[button_data[i * 16 + j] & 0xFF]);
				}
			}
		// 水平スクロールバー
		} else {
			// 左向き矢印
			for (int i = 0; i < 16; i++) {
				for (int j = 0; j < 16; j++) {
					g->drawPixel(i, j, arrow_palette[arrow1_data[i * 16 + j] & 0xFF]);
				}
			}
			// 右向き矢印
			for (int i = 0; i < 16; i++) {
				for (int j = 0; j < 16; j++) {
					g->drawPixel(i + w - 16, j, arrow_palette[arrow2_data[i * 16 + j] & 0xFF]);
				}
			}
			// ボタン
			int offset = 15 + (w - 47) * (getValue() - getMinimum()) / (getMaximum() - getMinimum());
			for (int i = 0; i < 17; i++) {
				for (int j = 0; j < 16; j++) {
					g->drawPixel(i + offset, j, button_palette[button_data[i * 16 + j] & 0xFF]);
				}
			}
		}
	}
Ejemplo n.º 30
0
	void Button::baseUpdateEnable()
	{
		updateButtonState();
		if (!getEnabled())
		{
			mIsMouseFocus = false;
		}
	}