umlClassTemplateItem::umlClassTemplateItem(const umlClassTemplateItem &obj) : umlClassItem(obj) { m_pTemplate = (uddLabelElement*)obj.m_pTemplate->Clone(); if( m_pTemplate ) { SF_ADD_COMPONENT( m_pTemplate, wxT("template") ); } }
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") ); } }
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") ); } }