void umlBiDirectAssocItem::Initialize()
{
    // initialize shape	

	AcceptConnection(wxT("uddNoteConnItem"));
    AcceptSrcNeighbour(wxT("All"));
    AcceptTrgNeighbour(wxT("All"));

	m_Pen = *wxBLACK_PEN;
	
	// create labels
	SetMaxLabelCount( 4 );
	
	uddLabelElement *pLabel = CreateLabel( udLABEL::ltASSOC_MULT1 );
	if( pLabel )
	{
		pLabel->SetText( wxT("*") );
		pLabel->SetCustomDockPoint(sfdvLINESHAPE_DOCKPOINT_START);
		pLabel->SetRelativePosition(0, -15);
		pLabel->SetHAlign( halignLINE_START );
		pLabel->SetHBorder( 10 );
		pLabel->RemoveStyle( sfsPOSITION_CHANGE );
	}

	pLabel = CreateLabel( udLABEL::ltASSOC_ROLE1 );
	if( pLabel )
	{
		pLabel->SetText( wxT("role 1") );
		pLabel->SetCustomDockPoint(sfdvLINESHAPE_DOCKPOINT_START);
		pLabel->SetRelativePosition(0, 5);
		pLabel->SetHAlign( halignLINE_START );
		pLabel->SetHBorder( 10 );
		pLabel->RemoveStyle( sfsPOSITION_CHANGE );
	}
	
	pLabel = CreateLabel( udLABEL::ltASSOC_MULT2 );
	if( pLabel )
	{
		pLabel->SetText( wxT("*") );
		pLabel->SetCustomDockPoint(sfdvLINESHAPE_DOCKPOINT_END);
		pLabel->SetRelativePosition(0, -15);
		pLabel->SetHAlign( halignLINE_END );
		pLabel->SetHBorder( 10 );
		pLabel->RemoveStyle( sfsPOSITION_CHANGE );
	}
	
	pLabel = CreateLabel( udLABEL::ltASSOC_ROLE2 );
	if( pLabel )
	{
		pLabel->SetText( wxT("role 2") );
		pLabel->SetCustomDockPoint(sfdvLINESHAPE_DOCKPOINT_END);
		pLabel->SetRelativePosition(0, 5);
		pLabel->SetHAlign( halignLINE_END );
		pLabel->SetHBorder( 10 );
		pLabel->RemoveStyle( sfsPOSITION_CHANGE );
	}
}
void umlInheritanceItem::Initialize()
{
    // initialize shape	
	SetTrgArrow(CLASSINFO(wxSFSolidArrow));

	AcceptConnection(wxT("uddNoteConnItem"));
    AcceptSrcNeighbour(wxT("All"));
    AcceptTrgNeighbour(wxT("All"));

	m_Pen = *wxBLACK_PEN;
}
void umlClassTemplateItem::Initialize()
{
	ClearAcceptedChilds();
	ClearAcceptedConnections();
	ClearAcceptedSrcNeighbours();
	ClearAcceptedTrgNeighbours();
	
	AcceptChild(wxT("uddDnDElement"));
	
	AcceptConnection(wxT("umlTemplateBindItem"));
	AcceptConnection(wxT("uddNoteConnItem"));
	
	AcceptSrcNeighbour(wxT("umlClassItem"));
	AcceptTrgNeighbour(wxT("uddNoteItem"));
    AcceptSrcNeighbour(wxT("uddNoteItem"));
	
	// set accepted project items (USED INTERNALLY)
	AcceptChild(wxT("udGenericVariableItem"));
	AcceptChild(wxT("udGenericFunctionItem"));
	AcceptChild(wxT("udMemberDataItem"));
	AcceptChild(wxT("udMemberFunctionItem"));
	AcceptChild(wxT("udSStateChartDiagramItem"));
	AcceptChild(wxT("udHStateChartDiagramItem"));
	AcceptChild(wxT("udConstructorFunctionItem"));
	AcceptChild(wxT("udDestructorFunctionItem"));
	
	m_pTemplate = new uddLabelElement();
	if( m_pTemplate )
	{
		m_pTemplate->SetBorder( wxPen( *wxBLACK, 1, wxDOT ) );
		m_pTemplate->SetFill( *wxWHITE_BRUSH );
		
		UpdateTemplateCtrl( wxT("Template") );
		
		m_pTemplate->SetHAlign( wxSFShapeBase::halignRIGHT );
		m_pTemplate->SetVAlign( wxSFShapeBase::valignTOP );
		m_pTemplate->SetVBorder( -8 );
		
		m_pTemplate->SetLabelType( udLABEL::ltCLASS_TEMPLATE );
		
		m_pTemplate->RemoveStyle( wxSFShapeBase::sfsALWAYS_INSIDE );
		m_pTemplate->RemoveStyle( wxSFShapeBase::sfsPARENT_CHANGE );
		
		SF_ADD_COMPONENT( m_pTemplate, wxT("template") );
	}
}
Beispiel #4
0
void cStarShape::Initialize()
{
    // initialize custom data members...
    m_sDescription = wxT("Insert some shape's description text here...");
    // now tell the serializer that this data member should be serialized
    // (see library documentation to get more info about available serialization
    // macros (supported data types))
    XS_SERIALIZE(m_sDescription, wxT("description"));

    // polygon-based shapes can be connected either to the vertices or to the
    // nearest border point (default value is TRUE).
    SetConnectToVertex(false);

    // set accepted connections for the new shape
    AcceptConnection(wxT("All"));
    AcceptSrcNeighbour(wxT("cStarShape"));
    AcceptTrgNeighbour(wxT("cStarShape"));

	// create associated shape(s)
	m_pText = new wxSFEditTextShape();
    // set some properties
    if(m_pText)
    {
        // set text
        m_pText->SetText(wxT("Hello!"));

        // set alignment
        m_pText->SetVAlign(wxSFShapeBase::valignMIDDLE);
        m_pText->SetHAlign(wxSFShapeBase::halignCENTER);

        // set required shape style(s)
		m_pText->SetStyle(sfsALWAYS_INSIDE | sfsHOVERING | sfsPROCESS_DEL | sfsPROPAGATE_DRAGGING | sfsPROPAGATE_SELECTION);
		// you can also force displaying of the shapes handles even if the interactive
		// size change is not allowed:
		//m_pText->AddStyle(sfsSHOW_HANDLES);

        // components of composite shapes created at runtime in parent shape's
        // constructor cannot be fully serialized (it means created by
		// the serializer) so it is important to disable their standard serialization
        // but they can be still serialized as the parent shape's properties 
		// in the standard way by the following macro:
		SF_ADD_COMPONENT( m_pText, wxT("title") );
    }
}