コード例 #1
0
ファイル: GnInterfaceGroup.cpp プロジェクト: daoopp/WebGame
bool GnInterfaceGroup::PushUp(float fPointX, float fPointY)
{
	if( GnInterface::PushUp( fPointX, fPointY ) == false )
	{
		for ( gtuint i = 0; i < mPersonalChildren.GetSize(); i++ )
		{
			GnInterface* child = mPersonalChildren.GetAt( i );
			if( child->IsVisible() && child->PushUp( fPointX, fPointY ) )
			{
				GnIInputEvent event(GnIInputEvent::PUSHUP, fPointX, fPointY);
				mSignal.EmitSignal( child, &event );
			}
		}
		for ( gtuint i = 0; i < GetChildrenSize(); i++ )
		{
			GnInterface* child = GetChild( i );
			child->PushUp( fPointX, fPointY );			
		}
		return false;
	}
	
	for ( gtuint i = 0; i < GetChildrenSize(); i++ )
	{
		GnInterface* child = GetChild( i );
		if( child->IsVisible() && child->PushUp( fPointX, fPointY ) )
		{
			GnIInputEvent event(GnIInputEvent::PUSHUP, fPointX, fPointY);
			mSignal.EmitSignal( child, &event );
		}
	}
	return true;
}
コード例 #2
0
ファイル: GnInterfaceGroup.cpp プロジェクト: daoopp/WebGame
bool GnInterfaceGroup::Push(float fPointX, float fPointY)
{
	if( IfUseCheckCollision( fPointX, fPointY ) == false )
	{
		for ( gtuint i = 0; i < mPersonalChildren.GetSize(); i++ )
		{			
			GnInterface* child = mPersonalChildren.GetAt( i );
			PushChild( child, fPointX, fPointY );
		}
		return false;
	}
	
	bool isPush = false;
	for ( gtuint i = 0; i < GetChildrenSize() ; i++ )
	{
		GnInterface* child = GetChild( i );
		if( isPush == false )
		{
			if( PushChild( child, fPointX, fPointY ) )
				isPush = true;
		}
		else if( child->IsDisable() == false )
			child->SetVisibleNormal( true );
	}
	
	AddPushCount();
	return true;
}
コード例 #3
0
ファイル: GnInterfaceGroup.cpp プロジェクト: daoopp/WebGame
void GnInterfaceGroup::Update(float fDeltaTime)
{
	for( gtuint i = 0; i < GetChildrenSize() ; i++ )
	{
		GnInterface* child = GetChild( i );
		child->Update( fDeltaTime );
	}
}
コード例 #4
0
ファイル: abstract_expression.cpp プロジェクト: foche/peloton
void AbstractExpression::PerformBinding(
    const std::vector<const planner::BindingContext *> &binding_contexts) {
  // Most expressions don't need attribute binding, except for those
  // that actually reference table attributes (i.e., TVE)
  for (uint32_t i = 0; i < GetChildrenSize(); i++) {
    children_[i]->PerformBinding(binding_contexts);
  }
}
コード例 #5
0
ファイル: abstract_expression.cpp プロジェクト: foche/peloton
hash_t AbstractExpression::HashForExactMatch() const {
  hash_t hash = HashUtil::Hash(&exp_type_);
  for (size_t i = 0; i < GetChildrenSize(); i++) {
    auto child = GetChild(i);
    hash = HashUtil::CombineHashes(hash, child->HashForExactMatch());
  }
  return hash;
}
コード例 #6
0
ファイル: GnInterfaceGroup.cpp プロジェクト: daoopp/WebGame
void GnInterfaceGroup::SetAlpha(guchar ucAlpha)
{
	GnInterface::SetAlpha( ucAlpha );
	for( gtuint i = 0; i < GetChildrenSize() ; i++ )
	{
		GnInterface* child = GetChild( i );
		child->SetAlpha( ucAlpha );
	}	
}
コード例 #7
0
ファイル: GnITabCtrl.cpp プロジェクト: daoopp/WebGame
void GnITabCtrl::SetRect(float fLeft, float fTop, float fRight, float fBottom)
{
	GnInterfaceGroup::SetRect( fLeft, fTop, fRight, fBottom );
	mpTabButtons->SetRect( GetRect() );
	for ( gtuint i = 0; i < GetChildrenSize(); i++ )
	{
		GnITabPage* tabPage = GnDynamicCast( GnITabPage, GetChild( i ) );
		if( tabPage )
			tabPage->SetRect( GetRect() );
	}
}
コード例 #8
0
ファイル: GnITabCtrl.cpp プロジェクト: daoopp/WebGame
void GnITabCtrl::SetPosition(GnVector2& cPos)
{
	if( GetDefaultMesh() == NULL )
	{
		for ( gtuint i = 0; i < GetChildrenSize(); i++ )
		{
			GnITabPage* tabPage = GnDynamicCast( GnITabPage, GetChild( i ) );
			if( tabPage )
				tabPage->SetPosition( cPos );
		}
	}
	GnInterface::SetPosition( cPos );
	SetTabButtonPosition( GetStartTabButtonPosition() );
}
コード例 #9
0
void wxJigsawShape::GetSize(wxDC & dc, wxCoord * w, wxCoord * h, double scale)
{
	wxSize headerSize = GetHeaderSize(dc, scale);
	wxSize childrenSize = GetChildrenSize(dc, scale);
	m_Size.Set(0,0);
	if(m_HasCShape) 
	{
		childrenSize.SetHeight(wxMax(childrenSize.GetHeight(), 10*scale));
	}

		int & width = m_Size.x;
		width = 0;
		width = headerSize.GetWidth();
		// If a shape has children then we also have to add horizontal spacing
		int spacing = childrenSize.GetWidth() != 0 ? wxJigsawShape::ChildrenSpacing*scale : 0;
		width = wxMax(width, spacing + childrenSize.GetWidth());
		// If the width is lower than minimal width, then we have to set it to its minimal value
		width = wxMax(width, GetMinSize().GetWidth()*scale);

		int & height = m_Size.y;
		height = 0;
		height = headerSize.GetHeight();
		height = wxMax(height, GetMinSize().GetHeight()*scale);
		if(m_HasCShape)
		{
			height += childrenSize.GetHeight();
			height += wxJigsawShape::CShapeThickness*scale;
		}
	
		if(w)
		{
			*w = width;
		}
		if(h)
		{
			*h = height;
		}
}
コード例 #10
0
wxSize wxJigsawShape::GetChildrenSize(wxDC & dc, double scale)
{
	wxSize res(0,0);
	GetChildrenSize(dc, &res.x, &res.y, scale);
	return res;
}
コード例 #11
0
wxColour wxJigsawShape::DrawBackground(wxDC & dc, 
		const wxPoint & pos, const wxSize & headerSize, 
		const wxSize & size, double scale)
{	
	wxColour color(m_Colour);
		
	if(wxJigsawEditorMainFrame::Get()->GetCanvas()->GetSelectedShape() == this)
	{
		//Shape selected. Give a feedback to the user!
		double bright =  1.15 + .08*GetLevelColor();

		color.Set(__min(bright*color.Red(), 255), __min(bright*color.Green(), 255), __min(bright*color.Blue(), 255));		
	}
	else if(m_Parent && m_Colour == m_Parent->GetColour())
	{
		//Change the shape bright to contrast with the parent shape
		double bright =  1 + .08*GetLevelColor();

		color.Set(__min(bright*color.Red(), 255), __min(bright*color.Green(), 255), __min(bright*color.Blue(), 255));
	}
	
	dc.SetBrush(wxBrush(color));
	dc.SetPen(*wxTRANSPARENT_PEN);
	
	wxPoint connector[5] = 
	{
		wxPoint(0,0), 
		wxPoint(wxJigsawShape::ConnectorSize.GetHeight(),
			wxJigsawShape::ConnectorSize.GetHeight()), 
		wxPoint(wxJigsawShape::ConnectorSize.GetWidth()-wxJigsawShape::ConnectorSize.GetHeight(),
			wxJigsawShape::ConnectorSize.GetHeight()), 
		wxPoint(wxJigsawShape::ConnectorSize.GetWidth(),0), 
		wxPoint(0,0)
	};
	for(size_t i = 0; i < 5; i++)
	{
		connector[i].x *= scale;
		connector[i].y *= scale;
	}
	wxSize childrenSize = GetChildrenSize(dc, scale);
	int cShapeHeight = wxMax(childrenSize.GetHeight(), 10*scale);
	wxRegion clippingRegion(0, 0, dc.GetSize().GetWidth(), dc.GetSize().GetHeight());
	if(m_HasNotch)
	{
		wxRegion connectorRegion(5, connector);
		connectorRegion.Offset(pos.x + wxJigsawShape::ConnectorSize.GetWidth()*scale, pos.y);
		clippingRegion.Xor(connectorRegion);
	}
	if(m_HasCShape)
	{
		wxRegion connectorRegion(5, connector);
		connectorRegion.Offset(
			pos.x + (wxJigsawShape::CShapeThickness+wxJigsawShape::ConnectorSize.GetWidth())*scale, 
			pos.y + headerSize.GetHeight()+cShapeHeight);
		clippingRegion.Xor(connectorRegion);
	}

	dc.SetClippingRegion(clippingRegion);
	//dc.DrawRoundedRectangle(m_Position.x, m_Position.y, headerSize.GetWidth(), headerSize.GetHeight(), 4);
	DrawShapeHeader(dc, pos, headerSize, IntToJigsawShapeStyle(m_Style));
	
	if(m_HasCShape)
	{
		dc.DrawRectangle(pos.x, 
			pos.y + headerSize.GetHeight() / 2, 
			(wxJigsawShape::CShapeThickness+4)*scale, 
			headerSize.GetHeight() / 2 + cShapeHeight + (wxJigsawShape::CShapeThickness*scale)/2);
		dc.DrawRoundedRectangle(pos.x, 
			pos.y + headerSize.GetHeight()+cShapeHeight, 
			headerSize.GetWidth(), 
			wxJigsawShape::CShapeThickness*scale, 4);
		// Upper inner notch
		dc.DrawPolygon(5, connector, 
			pos.x + (wxJigsawShape::CShapeThickness+wxJigsawShape::ConnectorSize.GetWidth())*scale, 
			pos.y + headerSize.GetHeight());
	}
	if(m_HasBump)
	{
		dc.DrawPolygon(5, connector, 
			pos.x + wxJigsawShape::ConnectorSize.GetWidth()*scale, 
			pos.y + size.GetHeight());
	}
	dc.DestroyClippingRegion();

	return color;
}
コード例 #12
0
ファイル: GnInterfaceGroup.cpp プロジェクト: daoopp/WebGame
bool GnInterfaceGroup::PushMove(float fPointX, float fPointY)
{
	if( IsEnablePushMove() == false )
		return false;
	
	if( IfUseCheckCollision( fPointX, fPointY ) == false && mAllPush == false )
	{
		for ( gtuint i = 0; i < mPersonalChildren.GetSize(); i++ )
		{
			GnInterface* child = mPersonalChildren.GetAt( i );
			if( child->IsVisible() && child->PushMove( fPointX, fPointY ) )
			{
				GnIInputEvent event(GnIInputEvent::PUSHUP, fPointX, fPointY);
				mSignal.EmitSignal( child, &event );
			}
		}
		
		if( IsPush() )
		{
			for ( gtuint i = 0; i < GetChildrenSize(); i++ )
			{
				GnInterface* child = GetChild( i );
				if( child->IsPush() )
				{
					child->PushUp( fPointX, fPointY );
					GnIInputEvent event(GnIInputEvent::PUSHUP, fPointX, fPointY);
					mSignal.EmitSignal( child, &event );
				}
			}
		}
		return false;
	}
	
	if ( IsPush() == false )
	{
		Push( fPointX, fPointY );
		return true;
	}

	for( gtuint i = 0; i < GetChildrenSize() ; i++ )
	{
		GnInterface* child = GetChild( i );
		
		
		if( child->IfUseCheckCollision( fPointX, fPointY ) == false )
		{
			if( child->IsPush() )
			{
				child->PushUp();
				GnIInputEvent event(GnIInputEvent::PUSHUP, fPointX, fPointY);
				mSignal.EmitSignal( child, &event );
			}
		}
		else
		{
			if( child->IsVisible() && child->IsPush() == false )
			{
				child->Push( fPointX, fPointY );
				GnIInputEvent event(GnIInputEvent::PUSH, fPointX, fPointY);
				mSignal.EmitSignal( child, &event );		
			}
			else
			{
				child->PushMove( fPointX, fPointY );
				GnIInputEvent event(GnIInputEvent::MOVE, fPointX, fPointY);
				mSignal.EmitSignal( child, &event );	
			}
		}
	}
	return true;
}
コード例 #13
0
ファイル: abstract_expression.cpp プロジェクト: foche/peloton
void AbstractExpression::GetUsedAttributes(
    std::unordered_set<const planner::AttributeInfo *> &attributes) const {
  for (uint32_t i = 0; i < GetChildrenSize(); i++) {
    children_[i]->GetUsedAttributes(attributes);
  }
}