<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!--
wxFormBuilder - A Visual Dialog Editor for wxWidgets.
Copyright (C) 2005 José Antonio Hurtado

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

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.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Written by
  José Antonio Hurtado - joseantonio.hurtado@gmail.com
  Juan Antonio Ortega  - jortegalalmolda@gmail.com

Python code generation writen by
  Michal Bližňák - michal.bliznak@gmail.com
-->
<codegen language="Python">
  <templates class="wxWindow">
	<template name="toolbar_add">self.#parent $name.AddControl( self.$name )</template>
  </templates>

  <templates class="wxStatusBar">
	<template name="construction">self.$name = #wxparent $name.CreateStatusBar( $fields, $style #ifnotnull $window_style @{ |$window_style @}, $id #ifnotnull $window_name @{, $window_name @} )</template>
  </templates>

  <templates class="wxMenuBar">
	<template name="construction">self.$name = #class( $style #ifnotnull $window_style @{ |$window_style @} )</template>
	<template name="after_addchild">#wxparent $name.SetMenuBar( self.$name )</template>
  </templates>

  <templates class="wxMenu">
	<template name="construction">self.$name = #class()</template>
		<template name="after_addchild">
		#ifnotnull #parent $context_menu
		@{ #ifequal #parent $context_menu "1"
		@{
			#ifparenttypeequal "widget || container || expanded_widget || wizardpagesimple || treelistctrl || dataviewctrl || dataviewtreectrl || dataviewlistctrl || propgrid || propgridman"
				@{ self.#parent $name.Bind( wx.EVT_RIGHT_DOWN, self.#parent $name #append OnContextMenu ) @}
			#ifparenttypeequal "form || wizard"
				@{ self.Bind( wx.EVT_RIGHT_DOWN, self.#parent $name #append OnContextMenu ) @}
			#ifparenttypeequal "tool"
				@{ self.Bind( wx.aui.EVT_AUITOOLBAR_TOOL_DROPDOWN, self.#parent $name #append OnDropDownMenu ) @}
		@}@}
		#ifparenttypeequal "menubar"
		@{
			self.#parent $name.Append( self.$name, $label )
		@}
		#ifparenttypeequal "menubar_form"
		@{
			self.Append( self.$name, $label )
		@}
	</template>
	<template name="generated_event_handlers">
		#ifnotnull #parent $context_menu
		@{ #ifequal #parent $context_menu "1"
		@{
			#ifparenttypeequal "widget || container || expanded_widget || wizardpagesimple || treelistctrl || dataviewctrl || dataviewtreectrl || dataviewlistctrl || propgrid || propgridman"
			@{
				def #parent $name #append OnContextMenu( self, event ): #indent #nl
				self.#parent $name.PopupMenu( self.$name, event.GetPosition() ) #nl #unindent
			@}
			#ifparenttypeequal "form || wizard"
			@{
				def #parent $name #append OnContextMenu( self, event ): #indent #nl
				self.PopupMenu( self.$name, event.GetPosition() ) #nl #unindent
			@}
			#ifparenttypeequal "tool"
			@{
				def #parent $name #append OnDropDownMenu( self, event ): #indent #nl
				if event.IsDropDownClicked() == True: #indent #nl
					#wxparent $name.SetToolSticky( event.GetId(), True ) #nl
					rect = #wxparent $name.GetToolRect( event.GetId() ) #nl
					pt = self.ScreenToClient( #wxparent $name.ClientToScreen( rect.GetBottomLeft() ) ); #nl
					#wxparent $name.PopupMenu( self.$name, pt ) #nl
					#wxparent $name.SetToolSticky( event.GetId(), False ) #nl #unindent #unindent
			@}
		@}@}
	</template>
  </templates>

  <templates class="submenu">
	<template name="construction">self.$name = wx.Menu()</template>
	<template name="after_addchild">self.#parent $name.AppendSubMenu( self.$name, $label )</template>
  </templates>

  <templates class="wxMenuItem">
	<template name="construction">
        self.$name = #class( self.#parent $name, $id, $label #ifnotnull $shortcut @{ + u"\t" + $shortcut @}, $help, $kind )</template>
    <template name="settings">
		#ifnotnull $bitmap
		@{
			self.$name.SetBitmap( $bitmap ) #nl
		@}
		self.#parent $name.Append( self.$name ) #nl
		#ifequal $enabled "0"
			@{ self.$name.Enable( $enabled ) #nl @}
		#ifequal $kind "wxITEM_CHECK"
		@{
			#ifequal $checked "1"
			@{ self.$name.Check( $checked ) #nl @}
		@}
		#ifequal $kind "wxITEM_RADIO"
		@{
			#ifequal $checked "1"
			@{ self.$name.Check( $checked ) #nl @}
		@}
    </template>
	<template name="evt_connect_OnMenuSelection">self.Bind( wx.EVT_MENU, #handler, id = self.$name.GetId() )</template>
	<template name="evt_disconnect_OnMenuSelection">self.Unbind( wx.EVT_MENU, id = self.$name.GetId() )</template>
	<template name="evt_connect_OnUpdateUI">self.Bind( wx.EVT_UPDATE_UI, #handler, id = self.$name.GetId() )</template>
  	<template name="evt_disconnect_OnUpdateUI">self.Unbind( wx.EVT_UPDATE_UI, id = self.$name.GetId() )</template>
  </templates>

  <templates class="separator">
	<template name="construction">self.#parent $name.AppendSeparator() #nl</template>
  </templates>

  <templates class="wxToolBar">
	<template name="construction">
                 #ifparenttypeequal "form"
                 @{
					#ifequal #parent $aui_managed "1"
					@{
						self.$name = #class( #wxparent $name, $id, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, $window_name @} )
					@}
					#ifequal #parent $aui_managed "0"
					@{
						self.$name = #wxparent $name.CreateToolBar( $style #ifnotnull $window_style @{ |$window_style @}, $id #ifnotnull $window_name @{, $window_name @} )
					@}
                 @}
                 #ifparenttypeequal "sizeritem"
                 @{
						self.$name = #class( #wxparent $name, $id, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, $window_name @} )
                 @}
                 #ifparenttypeequal "gbsizeritem"
                 @{
						self.$name = #class( #wxparent $name, $id, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, $window_name @} )
                 @}
		#ifnotnull $bitmapsize @{ #nl self.$name.SetToolBitmapSize( $bitmapsize ) @}

		#ifnotnull $separation
		@{
		  #ifnotequal $separation "5"
		  @{ #nl self.$name.SetToolSeparation( $separation ) @}
		@}

		#ifnotnull $margins    @{ #nl self.$name.SetMargins( $margins ) @}

		#ifnotnull $packing
		@{
			#ifnotequal $packing "1"
			@{ #nl self.$name.SetToolPacking( $packing ) @}
		@}</template>
	<template name="after_addchild">
		self.$name.Realize()
		#ifparenttypeequal "form"
		@{
		#ifequal #parent $aui_managed "1"
		@{ #nl
			self.m_mgr.AddPane( self.$name, wx.aui.AuiPaneInfo()
			#ifnotnull $aui_name @{.Name( $aui_name )@}.$docking()
			#ifnotnull $caption @{.Caption( $caption )@}
			#ifequal $caption_visible "0" @{.CaptionVisible( $caption_visible )@}
			#ifequal $close_button "0" @{.CloseButton( $close_button )@}
			#ifequal $maximize_button "1" @{.MaximizeButton( $maximize_button )@}
			#ifequal $minimize_button "1" @{.MinimizeButton( $minimize_button )@}
			#ifequal $pin_button "1" @{.PinButton( $pin_button )@}
			#ifequal $pane_border "0" @{.PaneBorder( $pane_border )@}
			#ifequal $gripper "1" @{.Gripper()@}
			#ifequal $show "0" @{.Hide()@}
			#ifequal $moveable "0" @{.Movable( $moveable )@}
			#ifnotnull $dock @{.$dock()#ifequal $dock "Float" @{.FloatingPosition( $pane_position )@}@}
			#ifnotnull $resize @{.$resize()#ifequal $resize "Resizable"	@{.FloatingSize( $pane_size )@}@}
			#ifequal $dock_fixed "1" @{.DockFixed( $dock_fixed )@}
			#ifequal $BottomDockable "0" @{.BottomDockable( $BottomDockable )@}
			#ifequal $TopDockable "0" @{.TopDockable( $TopDockable )@}
			#ifequal $LeftDockable "0" @{.LeftDockable( $LeftDockable )@}
			#ifequal $RightDockable "0"	@{.RightDockable( $RightDockable )@}
			#ifequal $floatable "0"	@{.Floatable( $floatable )@}
			#ifnotnull $aui_row	@{.Row( $aui_row )@}
			#ifnotnull $aui_position @{.Position( $aui_position )@}
			#ifnotnull $best_size @{.BestSize( $best_size )@}
			#ifnotnull $min_size @{.MinSize( $min_size )@}
			#ifnotnull $max_size @{.MaxSize( $max_size )@}
			#ifnotnull $aui_layer @{.Layer( $aui_layer )@}
			#ifequal $center_pane "1" @{.CentrePane()@}
			#ifequal $default_pane "1" @{.DefaultPane()@}
			#ifequal $toolbar_pane "1" @{.ToolbarPane()@}
			)
		@}
		@}
	</template>
  </templates>

  <templates class="wxAuiToolBar">
	<template name="include">import wx.aui</template>
	<template name="construction">
		self.$name = wx.aui.AuiToolBar( #wxparent $name, $id, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, wxDefaultValidator, $window_name @} )

		#ifnotnull $bitmapsize @{ #nl self.$name.SetToolBitmapSize( $bitmapsize ) @}

		#ifnotnull $separation
		@{
		  #ifnotequal $separation "5"
		  @{ #nl self.$name.SetToolSeparation( $separation ) @}
		@}

		#ifnotnull $margins    @{ #nl self.$name.SetMargins( $margins ) @}

		#ifnotnull $packing
		@{
			#ifnotequal $packing "1"
			@{ #nl self.$name.SetToolPacking( $packing ) @}
		@}</template>
	<template name="after_addchild">
		self.$name.Realize()
		#ifparenttypeequal "form"
		@{
		#ifequal #parent $aui_managed "1"
		@{ #nl
			self.m_mgr.AddPane( self.$name, wx.aui.AuiPaneInfo()#ifnotnull $aui_name
			@{.Name( $aui_name )@}.$docking()#ifnotnull $caption
			@{.Caption( $caption )@}#ifequal $caption_visible "0"
			@{.CaptionVisible( $caption_visible )@}#ifequal $close_button "0"
			@{.CloseButton( $close_button )@}#ifequal $maximize_button "1"
			@{.MaximizeButton( $maximize_button )@}#ifequal $minimize_button "1"
			@{.MinimizeButton( $minimize_button )@}#ifequal $pin_button "1"
			@{.PinButton( $pin_button )@}#ifequal $pane_border "0"
			@{.PaneBorder( $pane_border )@}#ifequal $gripper "1"
			@{.Gripper()@}#ifequal $show "0"
			@{.Hide()@}#ifequal $moveable "0"
			@{.Movable( $moveable )@}#ifnotnull $dock
			@{.$dock()#ifequal $dock "Float"
				@{.FloatingPosition( $pane_position )@}
			@}#ifnotnull $resize
			@{.$resize()#ifequal $resize "Resizable"
				@{.FloatingSize( $pane_size )@}
			@}#ifequal $dock_fixed "1"
			@{.DockFixed( $dock_fixed )@}#ifequal $BottomDockable "0"
			@{.BottomDockable( $BottomDockable )@}#ifequal $TopDockable "0"
			@{.TopDockable( $TopDockable )@}#ifequal $LeftDockable "0"
			@{.LeftDockable( $LeftDockable )@}#ifequal $RightDockable "0"
			@{.RightDockable( $RightDockable )@}#ifequal $floatable "0"
			@{.Floatable( $floatable )@}#ifnotnull $aui_row
			@{.Row( $aui_row )@}#ifnotnull $aui_position
			@{.Position( $aui_position )@}#ifnotnull $aui_layer
			@{.Layer( $aui_layer )@}#ifequal $center_pane "1"
			@{.CentrePane()@}#ifequal $default_pane "1"
			@{.DefaultPane()@}#ifequal $toolbar_pane "1"
			@{.ToolbarPane()@}
			)
		@}
		@}
		</template>
  </templates>

  <templates class="tool">
	<template name="construction">
	#ifparenttypeequal "toolbar"
	@{
		#ifparentclassnotequal "wxAuiToolBar"
		@{
			self.$name = self.#parent $name.AddLabelTool( $id, $label, $bitmap, wx.NullBitmap, $kind, $tooltip, $statusbar, None )
		@}
		#ifparentclassequal "wxAuiToolBar"
		@{
			#ifequal #parent $use_explicit_ids "1"
			@{
				self.#parent $name.AddTool( $id, $label, $bitmap, wx.NullBitmap, $kind, $tooltip, $statusbar, None ) #nl
				self.$name = self.#parent $name.FindTool( $id );
			@}
			#ifequal #parent $use_explicit_ids "0"
			@{
				self.$name = self.#parent $name.AddTool( $id, $label, $bitmap, wx.NullBitmap, $kind, $tooltip, $statusbar, None )
			@}
			#ifequal $context_menu "1"
			@{
				#nl self.#parent $name.SetToolDropDown( self.$name.GetId(), True );
				#nl
			@}
		@}
	@}
	#ifparenttypeequal "toolbar_form"
	@{
		self.$name = self.AddLabelTool( $id, $label, $bitmap, wx.NullBitmap, $kind, $tooltip, $statusbar, None )
	@}
	</template>
	<template name="evt_connect_OnToolClicked">self.Bind( wx.EVT_TOOL, #handler, id = self.$name.GetId() )</template>
	<template name="evt_disconnect_OnToolClicked">self.Unbind( wx.EVT_TOOL, id = self.$name.GetId() )</template>
	<template name="evt_connect_OnMenuSelection">self.Bind( wx.EVT_TOOL, #handler, id = self.$name.GetId() )</template>
	<template name="evt_disconnect_OnMenuSelection">self.Unbind( wx.EVT_TOOL, id = self.$name.GetId() )</template>
	<template name="evt_connect_OnToolRClicked">self.Bind( wx.EVT_TOOL_RCLICKED, #handler, id = self.$name.GetId() )</template>
	<template name="evt_disconnect_OnToolRClicked">self.Unbind( wx.EVT_TOOL_RCLICKED, id = self.$name.GetId() )</template>
	<template name="evt_connect_OnToolEnter">self.Bind( wx.EVT_TOOL_ENTER, #handler, id = self.$name.GetId() )</template>
	<template name="evt_disconnect_OnToolEnter">self.Unbind( wx.EVT_TOOL_ENTER, id = self.$name.GetId() )</template>
	<template name="evt_connect_OnUpdateUI">self.Bind( wx.EVT_UPDATE_UI, #handler, id = self.$name.GetId() )</template>
	<template name="evt_disconnect_OnUpdateUI">self.Unbind( wx.EVT_UPDATE_UI, id = self.$name.GetId() )</template>
  </templates>

  <templates class="toolSeparator">
    <template name="construction">self.#parent $name.AddSeparator()</template>
  </templates>

  <templates class="wxInfoBar">
    <template name="construction">self.$name = #class( #wxparent $name )</template>
	<template name="settings">
		self.$name.SetShowHideEffects( $show_effect, $hide_effect ) #nl
		self.$name.SetEffectDuration( $duration )
	</template>
  </templates>

</codegen>
