/* 
 * © 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_TEXTBOX_H_
#define _WF_TEXTBOX_H_

#include <mforms/mforms.h>

#include "wf_view.h"

using namespace System::Windows;

namespace MySQL {
  namespace Forms {

    public ref class TextBoxImpl : public ViewImpl
    {
      static bool create(::mforms::TextBox *self, ::mforms::ScrollBars scroll_bars);
      static void set_text(::mforms::TextBox *self, const std::string &text);
      static void append_text(::mforms::TextBox *self, const std::string &text);
      static std::string get_text(::mforms::TextBox *self);
      static void set_read_only(::mforms::TextBox *self, bool flag);
      static void set_padding(::mforms::TextBox *self, int pad);
      static void set_bordered(::mforms::TextBox *self, bool flag);
      TextBoxImpl(::mforms::TextBox *text);

      static void change(Object^ sender, EventArgs^ args);
    public:
      static void init(Manager ^mgr)
      {
        ::mforms::ControlFactory *f= ::mforms::ControlFactory::get_instance();

        DEF_CALLBACK2(bool, ::mforms::TextBox*, ::mforms::ScrollBars, mgr, f->_textbox_impl, TextBoxImpl, create);
        DEF_CALLBACK2(void, ::mforms::TextBox*, bool, mgr, f->_textbox_impl, TextBoxImpl, set_bordered);
        DEF_CALLBACK2(void, ::mforms::TextBox*, const std::string&, mgr, f->_textbox_impl, TextBoxImpl, set_text);
        DEF_CALLBACK2(void, ::mforms::TextBox*, const std::string&, mgr, f->_textbox_impl, TextBoxImpl, append_text);
        DEF_CALLBACK2(void, ::mforms::TextBox*, bool, mgr, f->_textbox_impl, TextBoxImpl, set_read_only);
        DEF_CALLBACK2(void, ::mforms::TextBox*, int, mgr, f->_textbox_impl, TextBoxImpl, set_padding);
        DEF_CALLBACK1(std::string, ::mforms::TextBox*, mgr, f->_textbox_impl, TextBoxImpl, get_text);
      }
    };

  };
};

#endif
