/**********************************************************************
 
	Copyright (C) 2003-2004
	Hirohisa MORI <joshua@nichibun.ac.jp>
	Tomoki SEKIYAMA <sekiyama@yahoo.co.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include "v/VSeparator.h"
#include "machine/v_object.h"


void
VSeparator::destroy_do(VObject * nmp)
{
	nmp->remove_child_do(this);
	v_serialized_exec_sub(gtk_widget_destroy, info);
	v_serialized_exec_sub(g_object_unref, info);
}

VSeparator::~VSeparator()
{
}

VExError
VSeparator::get_status(VObjectStatus *s, int flags) const
{
	V_OP_START_EX
	VExError err = v_get_status_standard(s, &flags, info);
	VExError err2 = VObject::get_status(s,flags);
	if ( err2.code )
		err = merge_VExError_vstatus_type(err,err2);
	V_OP_END
	return err;
};

VExError
VSeparator::set_status(const VObjectStatus *s, int flags)
{
	V_OP_START_EX
	VExError err = v_set_status_standard(s, flags, info);
	err = VObject::set_status(s,flags);
	if ( err.code ) {
		V_OP_END
		return err;
	}
	
	V_OP_END
		
	if ( flags & (VSF_ALIGN | VSF_PADDING ) ) {
		if ( sts.parent )
			sts.parent->child_status_changed(this, info);
		err.subcode1 &= ~(VSF_ALIGN | VSF_PADDING );
	}
	return err;
}

void
VSeparator::redraw(VRect *rect) const
{
	// do nothing
}



VExError
VHSeparator::create_do(const VObjectStatus* s, int flags, 
		VObject * nmp,void * arg)
{
	info = v_serialized_exec_func(gtk_hseparator_new);
	v_serialized_exec_sub(g_object_ref, info);

	return return_create_do(this,nmp,&sts,s,flags);
}


VExError
VVSeparator::create_do(const VObjectStatus* s, int flags, 
		VObject * nmp,void * arg)
{
	info = v_serialized_exec_func(gtk_vseparator_new);
	v_serialized_exec_sub(g_object_ref, info);

	return return_create_do(this,nmp,&sts,s,flags);
}
