/////////////////////////////////////////////////////////////////////////////
// Name: dbmodelrelation.cc
// Purpose: Database Objects
// Author: Daniel Horak
// Modified by:
// RCS-ID: $Id: dbmodelrelation.cc,v 1.2 2004/01/01 13:56:19 horakdan Exp $
// Copyright: (c) Daniel Horak
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/ogl/ogl.h>
#include "config.h"
#include "xml.h"
#include "dbobject.h"
#include "dbmodelrelation.h"
#include "dbrelation.h"
#include "project.h"
DBModelRelation::DBModelRelation(DataDesignerProject *project, DataDesignerContainer *container)
:DBObject(DBModelRelationType, "modelrelation", project, container),
m_xpos(100), m_ypos(100), m_relation(NULL)
{
}
void DBModelRelation::LoadXmlNode(wxXmlNode *node)
{
wxString number;
if (node->GetName() == m_typestr) {
m_name = node->GetPropVal("name", wxEmptyString);
} else {
wxLogMessage("wrong type '%s'", node->GetName().c_str());
}
// must set pointer to the real entity
m_relation = (DBRelation *)GetProject()->m_top_relations->GetObjectByName(m_name);
if (m_relation && m_relation->GetType() == DBRelationType)
m_relation->AddModelRelation(this);
else
wxLogMessage("DBModelRelation::LoadXmlNode - cannot find real relation for " + m_name);
m_project->SetItemText(m_treeitemid, m_name);
}
wxXmlNode *DBModelRelation::GetXmlNode()
{
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, m_typestr);
wxString number;
node->AddProperty("name", m_name);
return node;
}
void DBModelRelation::CreateShape()
{
// m_shape = new DBRelationShape(this);
// m_shape->Show(TRUE);
}
/*
* Container
*/
DBModelRelationContainer::DBModelRelationContainer(DataDesignerProject *project, const wxTreeItemId& parent)
: DataDesignerContainer(project, parent, "modelrelations")
{
}
DBObject *DBModelRelationContainer::CreateObject()
{
return new DBModelRelation(GetProject(), this);
}
void DBModelRelationContainer::ShowList()
{
SetList(new DBModelRelationListCtrl(GetProject()->GetSplitter(), this));
DataDesignerContainer::AddObjectsToListAndShow();
}
/*
* ObjectList
*/
DBModelRelationListCtrl::DBModelRelationListCtrl(wxWindow *parent, DataDesignerContainer *container)
: DBObjectListCtrl(parent, container)
{
}
DBModelRelationListCtrl::~DBModelRelationListCtrl()
{
}
void DBModelRelationListCtrl::SetObject(long item, DBObject *object)
{
DBModelRelation *attribute = (DBModelRelation *)object;
}
syntax highlighted by Code2HTML, v. 0.9.1