
/* This file is part of MetaDOM
 * a generic bind package for the Document Object Model API.
 * Copyright (C) 2001  Luca Padovani <luca.padovani@cs.unibo.it>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library 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.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * For more information, please visit the author's home page
 * http://www.cs.unibo.it/~lpadovan
 * or send an email to <luca.padovani@cs.unibo.it>
 *
 * DO NOT EDIT: this file has been generated automatically by MetaDOM
 */

#include <gdome.h>

#include <gdome-events.h>
#include "GdomeSmartDOMHelper.hh"


#include "GdomeSmartDOMBasic.hh"
#include "GdomeSmartDOMDOMImplementation.hh"
#include "GdomeSmartDOMCore.hh"

#include "GdomeSmartDOMEvents.hh"


namespace GdomeSmartDOM {

Event::Event(GdomeEvent* obj)

{
  gdome_obj = obj;
  if (gdome_obj != 0) {
    GdomeException exc_;
    gdome_evnt_ref(gdome_obj, &exc_);
    if (exc_ != 0) throw DOMException(exc_, "Event::Event");
  }
}

Event::Event(const Event& obj)
  
{
  
  GdomeException exc_ = 0;
  gdome_obj = obj.gdome_obj;
  if (gdome_obj != 0) gdome_evnt_ref(gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::Event casting from Event");
  
}

  Event& Event::operator=(const Event& obj)
{
  if (this == &obj) return *this;

  GdomeException exc_ = 0;

  if (gdome_obj != 0) {

    gdome_evnt_unref(gdome_obj, &exc_);
  

    gdome_obj = 0;
  }
  
  if (exc_ == 0) {
    gdome_obj = obj.gdome_obj;

    if (gdome_obj != 0) gdome_evnt_ref(gdome_obj, &exc_);
  
  }
  
  if (exc_ != 0) throw DOMException(exc_, "Event::operator=");

  return *this;
}

bool Event::operator==(const Event& obj) const
{
  return gdome_obj == obj.gdome_obj;
}

Event::~Event()
{
  
  if (gdome_obj != 0) {
    GdomeException exc_;
    gdome_evnt_unref(gdome_obj, &exc_);
    if (exc_ != 0) throw DOMException(exc_, "Event::~Event");
    gdome_obj = 0;
  }
  
}


GdomeEvent* Event::gdome_object() const
{
  if (gdome_obj != 0) {
    GdomeException exc_;
    gdome_evnt_ref(gdome_obj, &exc_);
    if (exc_ != 0) throw DOMException(exc_, "Event::gdome_object");
  }

  return gdome_obj;
}
DOMString Event::get_type() const
{
  GdomeException exc_;
  GdomeDOMString* res_ = gdome_evnt_type((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_type");
  return DOMString_of_GdomeDOMString(res_);
}

EventTarget Event::get_target() const
{
  GdomeException exc_;
  GdomeEventTarget* res_ = gdome_evnt_target((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_target");
  return EventTarget(res_);
}

EventTarget Event::get_currentTarget() const
{
  GdomeException exc_;
  GdomeEventTarget* res_ = gdome_evnt_currentTarget((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_currentTarget");
  return EventTarget(res_);
}

unsigned short Event::get_eventPhase() const
{
  GdomeException exc_;
  unsigned short res_ = gdome_evnt_eventPhase((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_eventPhase");
  return res_;
}

bool Event::get_bubbles() const
{
  GdomeException exc_;
  GdomeBoolean res_ = gdome_evnt_bubbles((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_bubbles");
  return res_;
}

bool Event::get_cancelable() const
{
  GdomeException exc_;
  GdomeBoolean res_ = gdome_evnt_cancelable((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_cancelable");
  return res_;
}

DOMTimeStamp Event::get_timeStamp() const
{
  GdomeException exc_;
  GdomeDOMTimeStamp res_ = gdome_evnt_timeStamp((GdomeEvent*) gdome_obj, &exc_);
  if (exc_ != 0) throw DOMException(exc_, "Event::get_timeStamp");
  return res_;
}

void Event::stopPropagation() const
{
  GdomeException exc_;
  gdome_evnt_stopPropagation((GdomeEvent*) gdome_obj, &exc_);
  
  if (exc_ != 0) throw DOMException(exc_, "Event::stopPropagation");
  
}

void Event::preventDefault() const
{
  GdomeException exc_;
  gdome_evnt_preventDefault((GdomeEvent*) gdome_obj, &exc_);
  
  if (exc_ != 0) throw DOMException(exc_, "Event::preventDefault");
  
}

void Event::initEvent(const DOMString& eventTypeArg, const bool canBubbleArg, const bool cancelableArg) const
{
  GdomeException exc_;
  GdomeDOMString* eventTypeArg_ = GdomeDOMString_of_DOMString(eventTypeArg);
  gdome_evnt_initEvent((GdomeEvent*) gdome_obj, eventTypeArg_, canBubbleArg, cancelableArg, &exc_);
  
  if (eventTypeArg_ != 0) gdome_str_unref(eventTypeArg_);
  
  if (exc_ != 0) throw DOMException(exc_, "Event::initEvent");
  
}



}

