////////////////////////////////////////////////////////////////////////////////
// Name:        mytext.cpp (generated and maintained by wxWorkshop's RAD)
// Purpose:     
// Author:      
// Modified by:
// Created:     02/19/01 07:30:54
// RCS-ID:      $ Id$
// Copyright:   (c) 
// Licence:   	
//////////////////////////////////////////////////////////////////////////////////

// %%INFO-{
// { TEMPL = "wxTextCtrl for C++" WND_RES = "MyText" MENU_RES = "" DECL_FILE = "mytext.h" CLASS = "MyTextCtrl" RES_FILE = "demo.xrc" }
// %%INFO-}

#ifdef __GNUG__
    #pragma implementation "mytext.cpp"
    #pragma interface "mytext.h"
#endif

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

#include "mytext.h"
#include "wx/xml/xmlres.h"
#include "wx/wspp/init.h"



/***** Implementation for class MyTextCtrl *****/

IMPLEMENT_DYNAMIC_CLASS( MyTextCtrl, wxTextCtrl )

BEGIN_EVENT_TABLE( MyTextCtrl, wxTextCtrl )

// %%EVT_TBL-{
	EVT_INIT_DIALOG( MyTextCtrl::OnInitDialog )
	EVT_PAINT( MyTextCtrl::OnPaint )
	EVT_CHAR_HOOK( MyTextCtrl::OnCharHook )
// %%EVT_TBL-}

END_EVENT_TABLE()

MyTextCtrl::MyTextCtrl()

	: wxTextCtrl()
{
}

MyTextCtrl::~MyTextCtrl()
{
}

// %%EVT_IMPS-{
void MyTextCtrl::OnInitDialog( wxInitDialogEvent& event )
{
	wxFont fnt( 25, wxDECORATIVE, wxITALIC, wxBOLD, TRUE );
	this->SetBackgroundColour( wxColour( 196,0,196 ) );
	this->SetFont( fnt );

	DoInit();
}

void MyTextCtrl::DoPaint( wxDC& dc )
{
	dc.SetFont( this->GetFont() );
	dc.DrawText( this->GetValue(), 0,0 );

	int w = 0, h = 0;
	GetClientSize( &w, &h );

	wxPen pen( wxColour( 0,255,0 ), 5, wxSOLID );
	dc.SetPen( pen );
	dc.SetBrush( *wxTRANSPARENT_BRUSH );
	dc.DrawRoundedRectangle( 0,0, w, h, 20.0 );
}

void MyTextCtrl::OnCharHook( wxKeyEvent& event )
{
	wxClientDC dc(this);
	DoPaint(dc);
	
	event.Skip();
}
// %%EVT_IMPS-}

// %%GETTER_IMPLS-{
// %%GETTER_IMPLS-}

// %%SETTER_IMPLS-{
// %%SETTER_IMPLS-}

void MyTextCtrl::ExchangeValues( bool toControls )
{
	if ( toControls )
	{
	// %%MEMBER_VALUES_TO_CTL-{
	// %%MEMBER_VALUES_TO_CTL-}
	}
	else
	{
	// %%CTL_VALUES_TO_MEMBER-{
	// %%CTL_VALUES_TO_MEMBER-}
	}
}

/*** protected members ***/

void MyTextCtrl::DoInit()
{
	// %%MEMBER_INITS-{
	// %%MEMBER_INITS-}

	// %%CTL_MEMBER_INITS-{
	// %%CTL_MEMBER_INITS-}
	
	ExchangeValues( TRUE );	
}

void MyTextCtrl::OnPaint( wxPaintEvent& event )
{
	wxPaintDC dc(this);

	DoPaint( dc );

	event.Skip();
}