///////
/////// wxWorkshop's default configuration scripts
/////// ==========================================
///////
/////// used for creating/maintaing source code for RAD. 
///////
/////// 2001 (C) Aleksandras Gluchovas (email: alex@soften.ktu.lt)
///////
/////// $Id: config_srctempl.txt,v 1.6 2001/04/04 12:42:36 aleksandras Exp $
///////

// misc subscripts invoked from higher-level generation-rules

script = {

	name = event_entry_subscript
	content = 
[[	$(EVT_MACRO_NAME)( $(IF$(ID_1))XMLID("$(ID_1)"), $(END_IF)$(IF$(ID_2))XMLID("$(ID_2)"), $(END_IF)$(IF$(EVT_TYPE))$(EVT_TYPE), $(END_IF)$(CLASS_NAME)::$(METHOD_NAME) )
]]

}

script = {

	name = alt_impl_subscript
	content = [[
void $(CLASS_NAME)::$(METHOD_NAME)( $(EVENT_CLASS)& event )
{
}
]]
}

script = {

	name = py_event_entry_subscript
	content = 
[[	$(EVT_MACRO_NAME)( self, $(IF$(ID_1))XMLID("$(ID_1)"), $(END_IF)$(IF$(ID_2))XMLID("$(ID_2)"), $(END_IF)$(IF$(EVT_TYPE))$(EVT_TYPE), $(END_IF)$(CLASS_NAME)::$(METHOD_NAME) )
]]

}

script = {

	name = py_alt_impl_subscript
	content = [[
def $(METHOD_NAME)( self, event ):

]]
}

script = {

	name = event_method_imp_subscript
	content = 
[[$(@event_body_at[CUR_EVENT_NO,alt_impl_subscript])$(@inc_var[CUR_EVENT_NO])]]
}

script = {

	name = py_event_method_imp_subscript
	content = 
[[$(@event_body_at[CUR_EVENT_NO,py_alt_impl_subscript])$(@inc_var[CUR_EVENT_NO])]]
}

script = {

	name = event_method_decl_subscript
	content = 
[[	void $(METHOD_NAME)( $(EVENT_CLASS)& event );
]]
}

script = {

	name = file_info_subscript
	content = 
[[// { TEMPL = "$(TEMPL)" WND_RES = "$(WND_RES)" MENU_RES = "$(MENU_RES)" $(IF$(IS_HDR))IMP_FILE = "$(IMP_FILE)" $(END_IF)$(IF$(IS_IMP))DECL_FILE = "$(DECL_FILE)" $(END_IF)CLASS = "$(CLASS_NAME)" RES_FILE = "$(RES_FILE)" }
]]

}

script = {

	name = py_file_info_subscript
	content = 
[[# { TEMPL = "$(TEMPL)" WND_RES = "$(WND_RES)" MENU_RES = "$(MENU_RES)" $(IF$(IS_HDR))IMP_FILE = "$(IMP_FILE)" $(END_IF)$(IF$(IS_IMP))DECL_FILE = "$(DECL_FILE)" $(END_IF)CLASS = "$(CLASS_NAME)" RES_FILE = "$(RES_FILE)" }
]]

}

// ======================================================================== //

generation_rules = {

	name = "cpp_rules"
	
	// event-binding related tagged-block descriptions
	
	{
		tag = "EVT_TBL"
		collect_event_entries = true
		content = [[$(@event_list[event_entry_subscript])]]

	}
	
	{ 
		tag = "EVT_IMPS"
		collect_event_bodies = true
		content = 
[[$(@assign_var[CUR_EVENT_NO="0"])$(@event_list[event_method_imp_subscript])]]
		
	}
	
	{
		tag = "EVT_DECLS"
		content = [[$(@event_list[event_method_decl_subscript])]]
	}
	
	{
		tag = "INFO"
		content = [[$(@subscript[file_info_subscript])]]
	}
	
	{
		tag = "APP_INIT"
		content = 
[[	InitWSPP();
	wxTheXmlResource->InitAllHandlers();
	wxTheXmlResource->Load("$(RES_FILE)");
	
	// load and show Application's main-window
	wxWindow* wnd = wxTheXmlResource->LoadWindow( "$(WND_RES)", TRUE );
]]
	}

	// member-binding related tagged-block descriptions
	
	{
		tag = "MEMBER_DECLS"
		collect_members = true
		
		content = "$(@member_list[decl_source])"
	}
	{
		tag = "CTL_MEMBER_DECLS"
		collect_ctl_members = true
		
		content = "$(@member_list[ctl_decl_source])"
	}
	{
		tag = "MEMBER_INITS"
		content = "$(@member_list[init_source])"
	}
	{
		tag = "CTL_MEMBER_INITS"
		content = "$(@member_list[ctl_init_source])"
	}
	{
		tag = "MEMBER_VALUES_TO_CTL"
		content = "$(@member_list[to_ctl_source])"
	}
	{
		tag = "CTL_VALUES_TO_MEMBER"
		content = "$(@member_list[to_member_source])"
	}
	{
		tag = "GETTER_DECLS"
		collect_getters = true
		
		content = "$(@member_list[getter_decl_source])"
	}
	{
		tag = "SETTER_DECLS"
		collect_setters = true
		
		content = "$(@member_list[setter_decl_source])"
	}
	{
		tag = "GETTER_IMPLS"
		content = "$(@member_list[getter_imp_source])"
	}
	{
		tag = "SETTER_IMPLS"
		content = "$(@member_list[setter_imp_source])"
	}
}

///// now, the same for wxPython /////

generation_rules = {

	name = "python_rules"
	{
		tag = "EVT_TBL"
		collect_event_entries = true
		content = [[$(@event_list[py_event_entry_subscript])]]

	}
	
	{ 
		tag = "EVT_IMPS"
		collect_event_bodies = true
		content = 
[[$(@assign_var[CUR_EVENT_NO="0"])$(@event_list[py_event_method_imp_subscript])]]
		
	}
	
	{
		tag = "INFO"
		content = [[$(@subscript[py_file_info_subscript])]]
	}
}

///// some helper subscripts used in definition of "cpp_member_binding_rules" ////////

script = {
	name = ctl_decl_subscript
	content = [[	$(CTL_CLASS)* $(CTL_MEMBER_NAME); // { $(RES_NAME) $(CTL_MEMBER_NAME) }\n]]
}

script = {
	name = ctl_init_subscript
	content = [[	$(CTL_MEMBER_NAME) = ($(CTL_CLASS)*)wxXmlFindWindow( "$(RES_NAME)", this );\n]]
}

script = {
	name = getter_name_hint
	content = "Get$(RES_NAME_FIRST_CAP)"
}

script = {
	name = setter_name_hint
	content = "Set$(RES_NAME_FIRST_CAP)"
}

script = {
	name = getter_decl_source
	content = [[	const $(TYPE)& $(GETTER_METHOD)() const; // { "$(RES_NAME)" $(GETTER_METHOD) }\n]]
}

script = {
	name = getter_imp_source
	content = [[const $(TYPE)& $(CLASS_NAME)::$(GETTER_METHOD)() const\n{ return $(MEMBER_NAME); }\n\n]]
}

script = {
	name = setter_decl_source
	content = [[	void $(SETTER_METHOD)( const $(TYPE)& value ); // { "$(RES_NAME)" $(SETTER_METHOD) }\n]]
}

script = {
	name = setter_imp_source
	content = [[void $(CLASS_NAME)::$(SETTER_METHOD)( const $(TYPE)& value )\n{ $(MEMBER_NAME) = value; }\n\n]]
}

script = {
	name = member_decl_subscript
	content = [[	$(TYPE) $(MEMBER_NAME); // { "$(RES_NAME)" $(TYPE) $(MEMBER_NAME) "$(INIT_VALUE)" }\n]]
}

// ======================================================================== //

binding_rules = {

	name = "cpp_member_binding_rules"
	
	///////////////////////// wxTextCtrl /////////////////////////

	{
		control_class = "wxTextCtrl"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"
		getter_name_hint = "Get$(RES_NAME_FIRST_CAP)"
		setter_name_hint = "Set$(RES_NAME_FIRST_CAP)"
		
		ctl_decl_source 	 = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source		 = "$(@subscript[ctl_init_subscript])"
			
		can_have_member = true

		setter_name_hint   = "$(@subscript[setter_name_hint])"
		getter_name_hint   = "$(@subscript[getter_name_hint])"
		setter_decl_source = "$(@subscript[setter_decl_source])"
		getter_decl_source = "$(@subscript[getter_decl_source])"
		setter_imp_source  = "$(@subscript[setter_imp_source])"
		getter_imp_source  = "$(@subscript[getter_imp_source])"

		{
			bound_as = "wxString"
			
			member_name_hint = "m_$(RES_NAME_FIRST_CAP)"
			
    		decl_source = "$(@subscript[member_decl_subscript])"
    			
			init_source =
				[[	$(MEMBER_NAME) = _("$(INIT_VALUE)");\n]]
				
			to_ctl_source = 
				[[	$(CTL_MEMBER_NAME)->SetValue( $(MEMBER_NAME) );\n]]
				
			to_member_source = 
				[[	$(MEMBER_NAME) = $(CTL_MEMBER_NAME)->GetValue();\n]]
		}
			
		{
			bound_as = "double"
			
			member_name_hint = "m_$(RES_NAME_FIRST_CAP)"
			
    		decl_source = "$(@subscript[member_decl_subscript])"
    			
			init_source =
				[[	$(MEMBER_NAME) = $(INIT_VALUE);\n]]
				
			to_ctl_source = 
				[[	$(CTL_MEMBER_NAME)->SetValue( wxString() << $(MEMBER_NAME) );\n]]
				
			to_member_source = 
				[[	sscanf( $(CTL_MEMBER_NAME)->GetValue(), "%f", &$(MEMBER_NAME) );\n]]
		}

		{
			bound_as = "int"
			
			member_name_hint = "m_$(RES_NAME_FIRST_CAP)"
			
    		decl_source = "$(@subscript[member_decl_subscript])"
    			
			init_source =
				[[	$(MEMBER_NAME) = $(INIT_VALUE);\n]]
				
			to_ctl_source = 
				[[	$(CTL_MEMBER_NAME)->SetValue( wxString() << $(MEMBER_NAME) );\n]]
				
			to_member_source = 
				[[	sscanf( $(CTL_MEMBER_NAME)->GetValue(), "%d", &$(MEMBER_NAME) );\n]]
		}

		{
			bound_as = "long"
			
			member_name_hint = "m_$(RES_NAME_FIRST_CAP)"
			
    		decl_source = "$(@subscript[member_decl_subscript])"
    			
			init_source =
				[[	$(MEMBER_NAME) = $(INIT_VALUE);\n]]
				
			to_ctl_source = 
				[[	$(CTL_MEMBER_NAME)->SetValue( wxString() << $(MEMBER_NAME) );\n]]
				
			to_member_source = 
				[[	sscanf( $(CTL_MEMBER_NAME)->GetValue(), "%d", &$(MEMBER_NAME) );\n]]
		}
	}
	
	///////////////////////// wxCheckBox /////////////////////////
	
	{
		control_class = "wxCheckBox"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"
		getter_name_hint = "Get$(RES_NAME_FIRST_CAP)"
		setter_name_hint = "Set$(RES_NAME_FIRST_CAP)"

		ctl_decl_source 	 = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source		 = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = true
		
		setter_name_hint   = "$(@subscript[setter_name_hint])"
		getter_name_hint   = "$(@subscript[getter_name_hint])"
		setter_decl_source = "$(@subscript[setter_decl_source])"
		getter_decl_source = "$(@subscript[getter_decl_source])"
		setter_imp_source  = "$(@subscript[setter_imp_source])"
		getter_imp_source  = "$(@subscript[getter_imp_source])"

		{
			bound_as = "bool"
			
			member_name_hint = "m_$(RES_NAME_FIRST_CAP)"
			
    		decl_source = "$(@subscript[member_decl_subscript])"
    			
			init_source =
				[[	$(MEMBER_NAME) = $(INIT_VALUE);\n]]
				
			to_ctl_source = 
				[[	$(CTL_MEMBER_NAME)->SetValue( $(MEMBER_NAME) );\n]]
				
			to_member_source = 
				[[	$(MEMBER_NAME) = $(CTL_MEMBER_NAME)->GetValue();\n]]
		}

		{
			bound_as = "wxString"
			
			member_name_hint = "m_$(RES_NAME_FIRST_CAP)"
			
    		decl_source = "$(@subscript[member_decl_subscript])"
    			
			init_source =
				[[	$(MEMBER_NAME) = _("$(INIT_VALUE)");\n]]
				
			to_ctl_source = 
				[[	$(CTL_MEMBER_NAME)->SetValue( $(MEMBER_NAME) == "true" );\n]]
				
			to_member_source = 
				[[	$(MEMBER_NAME) = $(CTL_MEMBER_NAME)->GetValue() ? "true" : "false";\n]]
		}
	}

	///////////////////////// wxButton /////////////////////////

	{
		control_class = "wxButton"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"

		ctl_decl_source      = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source      = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = false
		
		// no variable bounding rules for wxButton (only ctontrol-pointer binding)
	}
	
	///////////////////////// wxPanel /////////////////////////

	{
		control_class = "wxPanel"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"

		ctl_decl_source      = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source      = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = false
		
		// no variable bounding rules for wxButton (only ctontrol-pointer binding)
	}

	///////////////////////// wxNotebook /////////////////////////

	{
		control_class = "wxNotebook"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"

		ctl_decl_source      = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source      = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = false
		
		// no variable bounding rules for wxButton (only ctontrol-pointer binding)
	}

	///////////////////////// wxCardCtrl /////////////////////////

	{
		control_class = "wxCardCtrl"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"

		ctl_decl_source      = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source      = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = false
		
		// no variable bounding rules for wxButton (only ctontrol-pointer binding)
	}

	///////////////////////// wxGenericListCtrl /////////////////////////

	{
		control_class = "wxGenericListCtrl"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"

		ctl_decl_source      = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source      = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = false
		
		// no variable bounding rules for wxButton (only ctontrol-pointer binding)
	}

	///////////////////////// wxDbListCtrl /////////////////////////

	{
		control_class = "wxDbListCtrl"
		
		ctl_member_name_hint = "m_p$(RES_NAME_FIRST_CAP)"

		ctl_decl_source      = "$(@subscript[ctl_decl_subscript])"
		ctl_init_source      = "$(@subscript[ctl_init_subscript])"
		
		can_have_member = false
		
		// no variable bounding rules for wxButton (only ctontrol-pointer binding)
	}

	// END of binding_rules (cpp)	
}	

// ======================================================================== //

source_template = {
	
	name = "wxDialog for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxDialog"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxDialog"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxFrame for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxFrame"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxFrame"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxPanel for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxPanel"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxPanel"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxTreeCtrl for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxTreeCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxTreeCtrl"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxListCtrl for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxListCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxListCtrl"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxTextCtrl for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxTextCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxTextCtrl"])$(@subscript[cpp_implementation_subscript])]]
}


// ======================================================================== //

source_template = {
	
	name = "wxButton for C++"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxButton"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxButton"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxWindows C++ Application"
	language = "C++"
	has_header = false
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules

	implementation_source = 
		[[$(@assign_var[BASE_CLASS=""])$(@assign_var[IS_APP="TRUE"])$(@assign_var[APP_CLASS=CLASS_NAME])$(@subscript[cpp_implementation_subscript])]]
}    

// ======================================================================== //

source_template = {
	
	name = "wxWindows C++ Application with Frame class"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxFrame"])$(@assign_var[IS_APP="TRUE"])$(@assign_var[APP_CLASS="MyApp"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxFrame"])$(@assign_var[IS_APP="TRUE"])$(@assign_var[APP_CLASS="MyApp"])$(@subscript[cpp_implementation_subscript])]]
}    

// ======================================================================== //

// ======================================================================== //

source_template = {
	
	name = "wxPython application (experimental)"
	language = "Python"
	has_header = FALSE
	imp_ext = ".py"
	rules = python_rules
	binding_rules = cpp_member_binding_rules // TBD:: bindings for Python!
	
	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxFrame"])$(@subscript[py_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "My test-template (C++)"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxFoo"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxFoo"])$(@subscript[cpp_implementation_subscript])]]
}    

// ======================================================================== //

source_template = {
	
	name = "wxCardCtrl for C++ (requires WSPP)"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxCardCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxCardCtrl"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxDateCtrl for C++ (requires WSPP)"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxGenericListCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxGenericListCtrl"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxGenericListCtrl for C++ (requires WSPP)"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxGenericListCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxGenericListCtrl"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //

source_template = {
	
	name = "wxDbListCtrl for C++ (requires WSPP)"
	language = "C++"
	has_header = true
	header_ext = ".h"
	imp_ext = ".cpp"
	rules = cpp_rules
	binding_rules = cpp_member_binding_rules
	
	header_source = 
		[[$(@assign_var[BASE_CLASS="wxDbListCtrl"])$(@subscript[cpp_header_subscript])]]

	implementation_source = 
		[[$(@assign_var[BASE_CLASS="wxDbListCtrl"])$(@subscript[cpp_implementation_subscript])]]
}

// ======================================================================== //


script = {

	name = source_heading_comments
	content = 
[[////////////////////////////////////////////////////////////////////////////////
// Name:        $(FNAME) (generated and maintained by wxWorkshop's RAD)
// Purpose:     
// Author:      
// Modified by:
// Created:     $(DATE)
// RCS-ID:      $ Id$
// Copyright:   (c) 
// Licence:   	
//////////////////////////////////////////////////////////////////////////////////
]]
}

// ======================================================================== //

script = {

	name = py_source_heading_comments
	content = 
[[#---------------------------------------------------------------------------
# Name:        $(FNAME)
# Purpose:     
# Author:      
# Modified by:
# Created:     $(DATE)
# RCS-ID:      $ Id$
# Copyright:   (c) 
# Licence:   	
#---------------------------------------------------------------------------
]]
}

// ======================================================================== //
	
script = {

	name = cpp_header_subscript
	content =
[[$(@subscript[source_heading_comments])
#ifndef __$(FNAME_CAPITALIZED)_G__
#define __$(FNAME_CAPITALIZED)_G__

#include "wx/wx.h"
#include "wx/wspp/all.h"

// %%INFO-{
$(@subscript[file_info_subscript])
// %%INFO-}

class $(CLASS_NAME) : public $(BASE_CLASS)
{
public:
	$(CLASS_NAME)();
	~$(CLASS_NAME)();

	// %%EVT_DECLS-{
	void OnInitDialog( wxInitDialogEvent& event );	
	// %%EVT_DECLS-}	

	// %%GETTER_DECLS-{
	// %%GETTER_DECLS-}

	// %%SETTER_DECLS-{
	// %%SETTER_DECLS-}
	
	DECLARE_EVENT_TABLE()
	DECLARE_DYNAMIC_CLASS( $(CLASS_NAME) )	

protected:
	void ExchangeValues( bool toControls );
	void DoInit();	

protected:
	// %%MEMBER_DECLS-{
	// %%MEMBER_DECLS-}

	// %%CTL_MEMBER_DECLS-{
	// %%CTL_MEMBER_DECLS-}
};

#endif // __$(FNAME_CAPITALIZED)_G__
]]

}

// ======================================================================== //

script = {

	name = cpp_implementation_subscript
	
	content = [[$(@subscript[source_heading_comments])
// %%INFO-{
$(@subscript[file_info_subscript])
// %%INFO-}

#ifdef __GNUG__
    #pragma implementation "$(IMP_FILE)"
    #pragma interface "$(DECL_FILE)"
#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

$(IF$(HAS_HEADER))#include "$(DECL_FILE)"$(END_IF)
#include "wx/xml/xmlres.h"
#include "wx/wspp/init.h"

$(IF$(IS_APP))// Define a new application type, each program should derive a class from wxApp
class $(APP_CLASS) : public wxApp
{
public:
    // override base class virtuals
    // ----------------------------

    // this one is called on application startup and is a good place for the app
    // initialization (doing it here and not in the ctor allows to have an error
    // return: if OnInit() returns false, the application terminates)
    virtual bool OnInit();
};

// Create a new application object: this macro will allow wxWindows to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
IMPLEMENT_APP($(APP_CLASS))

// ============================================================================
// implementation
// ============================================================================

/***** Implementation for class $(APP_CLASS) *****/

// 'Main program' equivalent: the program execution "starts" here
bool $(APP_CLASS)::OnInit()
{
    // %%APP_INIT-{
    // %%APP_INIT-}

    // success: wxApp::OnRun() will be called which will enter the main message
    // loop and the application will run. If we returned FALSE here, the
    // application would exit immediately.
    return TRUE;
    
}$(END_IF)

$(IF$(BASE_CLASS)!="")/***** Implementation for class $(CLASS_NAME) *****/

IMPLEMENT_DYNAMIC_CLASS( $(CLASS_NAME), $(BASE_CLASS) )

BEGIN_EVENT_TABLE( $(CLASS_NAME), $(BASE_CLASS) )

// %%EVT_TBL-{
	EVT_INIT_DIALOG( $(CLASS_NAME)::OnInitDialog )
// %%EVT_TBL-}

END_EVENT_TABLE()

$(CLASS_NAME)::$(CLASS_NAME)()

	: $(BASE_CLASS)()
{
}

$(CLASS_NAME)::~$(CLASS_NAME)()
{
}

// %%EVT_IMPS-{
void $(CLASS_NAME)::OnInitDialog( wxInitDialogEvent& event )
{
	DoInit();
}

// %%EVT_IMPS-}

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

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

void $(CLASS_NAME)::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 $(CLASS_NAME)::DoInit()
{
	// %%MEMBER_INITS-{
	// %%MEMBER_INITS-}

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

$(END_IF)]]

}

// ======================================================================== //

script = {

	name = py_implementation_subscript
	content =
[[#!/usr/bin/python

from wxPython.wx import *

$(@subscript[py_source_heading_comments])

# %%INFO-{
$(@subscript[py_file_info_subscript])
# %%INFO-}

class $(CLASS_NAME)($(BASE_CLASS)):
    def __init__(self, parent, id, title=''):
        $(BASE_CLASS).__init__(self, parent, id, title, wxPyDefaultPosition,
                         wxPyDefaultSize )

        self.mainmenu = wxMenuBar()

# %%EVT_TBL-{
# %%EVT_TBL-}

# %%EVT_IMPS-{
# %%EVT_IMPS-}

# if running standalone

if __name__ == '__main__':
    class MyApp(wxApp):
        def OnInit(self):
            frame = $(CLASS_NAME)(NULL, -1, "wxPython application")
            frame.Show(true)
            self.SetTopWindow(frame)
            return true

    app = MyApp(0)
    app.MainLoop()

]]
}