// ---------------------------------------------------------------------------
// - HtmlDiv.hpp                                                             -
// - afnix:www library - html div element class definition                   -
// ---------------------------------------------------------------------------
// - This program is free software;  you can redistribute it  and/or  modify -
// - it provided that this copyright notice is kept intact.                  -
// -                                                                         -
// - 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.  In no event shall -
// - the copyright holder be liable for any  direct, indirect, incidental or -
// - special damages arising in any way out of the use of this software.     -
// ---------------------------------------------------------------------------
// - copyright (c) 1999-2005 amaury darsch                                   -
// ---------------------------------------------------------------------------

#ifndef  AFNIX_HTMLDIV_HPP
#define  AFNIX_HTMLDIV_HPP

#ifndef  AFNIX_HTMLELEMENT_HPP
#include "HtmlElement.hpp"
#endif

namespace afnix {

  /// The HtmlDiv class is a model fo the HTML 'div' element. The class
  /// is usefull in the sense it include a linked element that is expanded
  /// during the emit phase.
  /// @author amaury darsch

  class HtmlDiv : public HtmlElement {
  protected:
    /// the link element
    HtmlElement* p_link;

  public:
    /// create default element
    HtmlDiv (void);
    
    /// create an element with a class type
    /// @param cname the class name
    HtmlDiv (const String& cname);

    /// destroy this element
    ~HtmlDiv (void);

    /// @return the class name
    String repr (void) const;

    /// set the link element
    /// @param elem the element to link
    void setlink (HtmlElement* elem);

    /// @return the link element
    HtmlElement* getlink (void) const;

    /// emit the element into a buffer
    void emit (Buffer& buf) const;

    /// generate a new div element object
    /// @param argv the argument vector
    static Object* mknew (Vector* argv);

    /// apply this div element with a set of arguments and a quark
    /// @param robj  robj the current runnable
    /// @param nset  the current nameset    
    /// @param quark the quark to apply these arguments
    /// @param argv  the arguments to apply
    Object* apply (Runnable* robj, Nameset* nset, const long quark,
                   Vector* argv);
    
  private:
    // make the copy constructor private
    HtmlDiv (const HtmlDiv&);
    // make the assignment operator private
    HtmlDiv& operator = (const HtmlDiv&);
  };
}

#endif
