/* 
 * © 2008-2009 Sun Microsystems, Inc.
 *
 * 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 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.
 */

#ifndef _WF_TEXTENTRY_H_
#define _WF_TEXTENTRY_H_

#include <mforms/mforms.h>

#include "wf_view.h"

/**
 * Declaration of the Windows wrapper for the mforms TextEntry class.
 */
using namespace System;
using namespace Windows::Forms;

namespace MySQL {
  namespace Forms {

    public ref class TextEntryImpl : public ViewImpl
    {
      static bool create(::mforms::TextEntry *self, bool password);
      static void set_text(::mforms::TextEntry *self, const std::string &text);
      static std::string get_text(::mforms::TextEntry *self);
      static void set_password(::mforms::TextEntry *self, bool flag);
      static void set_max_length(::mforms::TextEntry *self, int length);
      static void change(Object^ sender, EventArgs^ args);
      TextEntryImpl(::mforms::TextEntry *text);
    public:
      static void init(Manager ^mgr)
      {
        ::mforms::ControlFactory *f= ::mforms::ControlFactory::get_instance();

        DEF_CALLBACK2(bool, ::mforms::TextEntry*, bool, mgr, f->_textentry_impl, TextEntryImpl, create);
        DEF_CALLBACK2(void, ::mforms::TextEntry*, const std::string&, mgr, f->_textentry_impl, TextEntryImpl, set_text);
        DEF_CALLBACK1(std::string, ::mforms::TextEntry*, mgr, f->_textentry_impl, TextEntryImpl, get_text);
        DEF_CALLBACK2(void, ::mforms::TextEntry*, int, mgr, f->_textentry_impl, TextEntryImpl, set_max_length);
      }
    };

  };
};

#endif
