| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2014 Eran Ifrah |
| 5 |
// file name : ErdForeignKey.cpp |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
#include "ErdForeignKey.h" |
| 27 |
|
| 28 |
XS_IMPLEMENT_CLONABLE_CLASS(ErdForeignKey,wxSFRoundOrthoLineShape); |
| 29 |
|
| 30 |
ErdForeignKey::ErdForeignKey():wxSFRoundOrthoLineShape() |
| 31 |
{ |
| 32 |
m_pConstraint = NULL; |
| 33 |
|
| 34 |
EnableSerialization( false ); |
| 35 |
} |
| 36 |
|
| 37 |
ErdForeignKey::ErdForeignKey(Constraint* pConstraint):wxSFRoundOrthoLineShape() |
| 38 |
{ |
| 39 |
m_pConstraint = pConstraint; |
| 40 |
wxSFTextShape* pLabel = new wxSFTextShape(); |
| 41 |
|
| 42 |
if( pLabel ) |
| 43 |
{ |
| 44 |
pLabel->GetFont().SetPointSize(8); |
| 45 |
pLabel->GetFont().SetWeight(wxFONTWEIGHT_BOLD); |
| 46 |
|
| 47 |
pLabel->SetText(pConstraint->GetName()); |
| 48 |
pLabel->SetVAlign(valignMIDDLE); |
| 49 |
pLabel->SetHAlign(halignCENTER); |
| 50 |
pLabel->SetFill(*wxTRANSPARENT_BRUSH); |
| 51 |
pLabel->SetStyle(sfsLOCK_CHILDREN | sfsPARENT_CHANGE); |
| 52 |
pLabel->RemoveStyle(sfsPARENT_CHANGE); |
| 53 |
pLabel->RemoveStyle(sfsSHOW_HANDLES); |
| 54 |
|
| 55 |
AddChild(pLabel); |
| 56 |
} |
| 57 |
|
| 58 |
SetTrgArrow(CLASSINFO(OneArrow)); |
| 59 |
SetSrcArrow(CLASSINFO(NArrow)); |
| 60 |
|
| 61 |
SetDockPoint(sfdvLINESHAPE_DOCKPOINT_CENTER); |
| 62 |
|
| 63 |
EnableSerialization( false ); |
| 64 |
} |
| 65 |
|
| 66 |
ErdForeignKey::ErdForeignKey(const ErdForeignKey& obj):wxSFRoundOrthoLineShape(obj) |
| 67 |
{ |
| 68 |
m_pConstraint = obj.m_pConstraint; |
| 69 |
} |
| 70 |
|
| 71 |
ErdForeignKey::~ErdForeignKey() |
| 72 |
{ |
| 73 |
} |
| 74 |
|
| 75 |
void ErdForeignKey::CreateHandles() |
| 76 |
{ |
| 77 |
wxSFRoundOrthoLineShape::CreateHandles(); |
| 78 |
|
| 79 |
RemoveHandle( wxSFShapeHandle::hndLINESTART ); |
| 80 |
RemoveHandle( wxSFShapeHandle::hndLINEEND ); |
| 81 |
} |