/////////////////////////////////////////////////////////////////////////////
// Name:        dbprocedure.cc
// Purpose:     Database Objects
// Author:      Daniel Horak
// Modified by:
// RCS-ID:      $Id: dbview.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 "config.h"
#include "xml.h"
#include "dbobject.h"
#include "dbview.h"


DBView::DBView(DataDesignerProject *project, DataDesignerContainer *container)
	:DBObject(DBViewType, "view", project, container)
{
}

wxDialog *DBView::Editor(bool edit)
{
	return new DBViewEditor(this, edit);
}

void DBView::LoadXmlNode(wxXmlNode *node)
{
	if (node->GetName() == m_typestr) {
		DBObject::LoadXmlNode(node);
	} else {
		wxLogMessage("wrong type '%s'", node->GetName().c_str());
	}
}

wxXmlNode *DBView::GetXmlNode()
{
	wxXmlNode *node = DBObject::GetXmlNode();
	
	return node;
}

/*
 * Editor
 */
DBViewEditor::DBViewEditor(DBObject *object, bool edit)
	: DBObjectEditor(_("View"), wxSize(500,200), object, edit)
{
}

DBViewEditor::~DBViewEditor()
{
}

bool DBViewEditor::TransferDataFromWindow()
{
	DBView	*object = (DBView *)GetObject();

	DBObjectEditor::TransferDataFromWindow();

	return TRUE;
}

bool DBViewEditor::TransferDataToWindow()
{
	DBView	*object = (DBView *)GetObject();
	
	DBObjectEditor::TransferDataToWindow();
	
	return TRUE;
}

/*
 * Container
 */
DBViewContainer::DBViewContainer(DataDesignerProject *project, const wxTreeItemId& parent)
	: DataDesignerContainer(project, parent, "views")
{
}

DBObject *DBViewContainer::CreateObject()
{
	return new DBView(GetProject(), this);
}

void DBViewContainer::ShowList()
{
	SetList(new DBViewListCtrl(GetProject()->GetSplitter(), this));
	
	DataDesignerContainer::AddObjectsToListAndShow();
}

/*
 * ObjectList
 */
DBViewListCtrl::DBViewListCtrl(wxWindow *parent, DataDesignerContainer *container)
	: DBObjectListCtrl(parent, container)
{
}

DBViewListCtrl::~DBViewListCtrl()
{
}

void DBViewListCtrl::SetObject(long item, DBObject *object)
{
	DBView *view = (DBView *)object;
}


syntax highlighted by Code2HTML, v. 0.9.1