コード例 #1
0
	void BoxSkin::setFrameThickness( Border frame )
	{
		bool hadFrame = (m_frame.width() + m_frame.height() > 0 );
		bool hasFrame = (frame.width() + frame.height() > 0);
	
		m_frame = frame;
	
		if( hadFrame != hasFrame )
			_updateOpaqueFlag();
	}
コード例 #2
0
	BoxSkin::BoxSkin( Color color, Border frame, Color frameColor )
	{
	    m_frame = frame;
	
		for( int i = 0 ; i < StateEnum_Nb ; i++ )
		{
			m_color[i] = color;
			m_frameColor[i] = frameColor;
		}
	
		bool hasFrame = (frame.width() + frame.height() > 0 );
		if( color.a == 255 && (!hasFrame || frameColor.a == 255) )
			m_bOpaque = true;
		else
			m_bOpaque = false;
	}
コード例 #3
0
ファイル: wg_menubar.cpp プロジェクト: tordj/WonderGUI
	void Menubar::_render( GfxDevice * pDevice, const Rect& _canvas, const Rect& _window, const Rect& _clip )
	{
		Widget::_render(pDevice,_canvas,_window,_clip);
	
		// Take backgrounds content borders into account
	
		Rect	window;
		Rect	clip;
	
		if( m_pSkin )
		{
			window = m_pSkin->contentRect( _canvas, m_state );
			clip.intersection( window, _clip );
		}
		else
		{
			window = _canvas;
			clip = _clip;
		}
	
		// Go throught the MenuBarItems and print their text and render their rectangles.
	
		MenuBarItem * pI = m_items.first();
		uint32_t posX = window.x;
	
		Pen pen;
	
	
		TextAttr	attr;
		TextTool::addPropAttributes( attr, Base::getDefaultTextprop(), StateEnum::Normal);
		TextTool::addPropAttributes( attr, m_pTextProp, StateEnum::Normal);
	
		pen.setAttributes( attr );
		pen.setClipRect( clip );
		pen.setDevice( pDevice );
	
		uint32_t printPosY = window.y + ( window.h - pen.getLineHeight() )/2 + pen.getBaseline();
	
		uint32_t itemNb = 1;
		while( pI )
		{
			if( pI->isVisible() )
			{
				State	state = StateEnum::Disabled;
				if( m_state.isEnabled() && pI->m_bEnabled )
				{
					state = StateEnum::Normal;
	
					if( itemNb == m_selectedItem )
						state = StateEnum::Pressed;
					else if( itemNb == m_markedItem )
						state = StateEnum::Hovered;
				}
	
				Border b = _getEntryBorder();
	
	//			ColorsetPtr pTextColors;
				
	//			if( m_pSkin )
	//				pTextColors = m_pSkin->TextColors();
	
				if( m_pEntrySkin )
				{
					Rect	dest( posX, window.y, pI->m_width + b.width(), window.h );
					m_pEntrySkin->render( pDevice, dest, state, clip );
	
	//				pTextColors = m_pEntrySkin->TextColors();
				}
	
				pen.setPos( Coord(posX + b.left, printPosY) );
	
				TextAttr	attr;
				TextTool::addPropAttributes( attr, Base::getDefaultTextprop(), state );
	//			TextTool::setAttrColor( attr, pTextColors, mode );
				TextTool::addPropAttributes( attr, m_pTextProp, state );
				pen.setAttributes( attr );
	
				pDevice->printLine( pen, attr, pI->m_pText );
	
				posX += pI->m_width + b.width();
			}
			itemNb++;
			pI = pI->next();
		}
	}