<!-- This file is provided under the Open Game License version 1.0a
  -- For more information on OGL and related issues, see 
  --   http://www.wizards.com/d20
  --
  -- For information on the Fantasy Grounds d20 Ruleset licensing and
  -- the OGL license text, see the d20 ruleset license in the program
  -- options.
  --
  -- All producers of work derived from this definition are adviced to
  -- familiarize themselves with the above licenses, and to take special
  -- care in providing the definition of Product Identity (as specified
  -- by the OGL) in their products.
  --
  -- Copyright 2007 SmiteWorks Ltd.
  -->

<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.0">
	<windowclass name="item_stats">
		<sheetdata>
			<!-- Description -->		
			<formattedtextfield name="description">
				<anchored>
					<left>
						<anchor>left</anchor>
					</left>
					<right>
						<anchor>right</anchor>
					</right>
					<top>
						<anchor>top</anchor>
					</top>
				</anchored>
				<font>
					<normal>LED_regularfont</normal>
					<bold>LED_boldfont</bold>
					<italic>LED_italicfont</italic>
					<bolditalic>LED_bolditalicfont</bolditalic>
					<title>LED_defaultstringcontrol</title>
				</font>
				<linkicon>
					<link>button_openwindow</link>
					<emptylink>button_emptytarget</emptylink>
				</linkicon>
				<footer>footer_wide</footer>
				<selectioncolor>#FFD296</selectioncolor>
				<empty>Click to enter description</empty>
			</formattedtextfield>

			<columnstringfield name="aura">
				<anchor>description</anchor>
				<tabtarget next="cl" prev="description" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>aura</anchor>
				<static>Aura</static>
			</columnfieldlabel>

			<columnnumberfield name="cl">
				<anchor>description</anchor>
				<tabtarget next="cl" prev="description" />
			</columnnumberfield>
			<columnfieldlabel>
				<anchor>cl</anchor>
				<static>Caster level</static>
			</columnfieldlabel>

			<columnstringfield name="prerequisites">
				<anchor>description</anchor>
				<tabtarget next="cl" prev="description" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>prerequisites</anchor>
				<static>Prerequisites</static>
			</columnfieldlabel>

			<columnstringfield name="price">
				<anchor>description</anchor>
				<tabtarget next="cl" prev="description" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>price</anchor>
				<static>Price</static>
			</columnfieldlabel>

			<columnstringfield name="cost">
				<anchor>description</anchor>
				<tabtarget next="cl" prev="description" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>cost</anchor>
				<static>Cost</static>
			</columnfieldlabel>

			<!-- Spacer -->
			<genericcontrol>
				<anchored>
					<to>cost</to>
					<position>below</position>
					<size>
						<height>15</height>
					</size>
				</anchored>
			</genericcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="item_description">
		<sheetdata>
			<!-- Non-Identified -->		
			<stringfield name="nonidentified">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>7</offset>
					</left>
					<right>
						<anchor>right</anchor>
						<offset>-7</offset>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>16</offset>
					</top>
				</anchored>
				<frame>
					<name>modifier</name>
					<offset>7,5,7,5</offset>
				</frame>
				<font>sheettextsmall</font>
				<multilinespacing>15</multilinespacing>
			</stringfield>
			<stringcontrol>
				<anchored>
					<to>nonidentified</to>
					<position>aboveleft</position>
					<offset>0,1</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>At a glance</static>
			</stringcontrol>

			<!-- Identified -->		
			<stringfield name="identified">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>7</offset>
					</left>
					<right>
						<anchor>right</anchor>
						<offset>-7</offset>
					</right>
					<top>
						<parent>nonidentified</parent>
						<anchor>bottom</anchor>
						<offset>19</offset>
					</top>
				</anchored>
				<frame>
					<name>modifier</name>
					<offset>7,5,7,5</offset>
				</frame>
				<font>sheettextsmall</font>
				<multilinespacing>15</multilinespacing>
			</stringfield>
			<stringcontrol>
				<anchored>
					<to>identified</to>
					<position>aboveleft</position>
					<offset>0,1</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>When identified</static>
			</stringcontrol>
			<checkbox name="isidentified">
				<anchored>
					<to>identified</to>
					<position>aboveright</position>
					<offset>0,1</offset>
					<size>
						<width>12</width>
						<height>12</height>
					</size>
				</anchored>
			</checkbox>

			<!-- Spacer -->
			<genericcontrol>
				<anchored>
					<to>identified</to>
					<position>below</position>
					<size>
						<height>15</height>
					</size>
				</anchored>
			</genericcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="item">
		<datasource>item</datasource>
		<frame>charsheet</frame>
		<placement>
			<size>
				<width>270</width>
				<height>370</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic />
			<minimum>
				<width>200</width>
				<height>220</height>
			</minimum>
		</sizelimits>
		<minimize>minimized_item</minimize>
		<sharable>
			<shareas>item_client</shareas>
		</sharable>
		<tooltip>
			<field>name</field>
		</tooltip>
		<sheetdata>
			<!-- NAME -->
			<genericcontrol name="nameframe">
				<bounds>10,20,-20,35</bounds>
				<frame>
					<name>sheetgroup</name>
				</frame>
			</genericcontrol>
			<windowopencontrol>
				<anchored>
					<to>nameframe</to>
					<position>insidetopleft</position>
					<offset>13,8</offset>
					<size>
						<width>20</width>
						<height>20</height>
					</size>
				</anchored>
				<icon>
					<normal>button_openwindow</normal>
					<pressed>button_emptytarget</pressed>
				</icon>
				<class>item</class>
				<description>
					<field>name</field>
				</description>
			</windowopencontrol>
			<stringfield name="name">
				<anchored>
					<top>
						<parent>nameframe</parent>
						<anchor>top</anchor>
						<offset>9</offset>
					</top>
					<left>
						<parent>nameframe</parent>
						<anchor>left</anchor>
						<offset>35</offset>
					</left>
					<right>
						<parent>nameframe</parent>
						<anchor>right</anchor>
						<offset>-15</offset>
					</right>
				</anchored>
				<empty>&#171; New Item &#187;</empty>
				<font>sheettext</font>
			</stringfield>

			<!-- Frame -->		
			<genericcontrol name="contentframe">
				<bounds>10,54,-25,-13</bounds>
				<frame>
					<name>sheetgroup</name>
					<offset>0,1,0,0</offset>
				</frame>
			</genericcontrol>


			<!-- Subwindows -->
			<subwindow name="stats">
				<bounds>22,64,-35,-23</bounds>
				<class>item_stats</class>
			</subwindow>
			<scrollercontrol name="stats_scroller">
				<anchored>
					<to>stats</to>
					<position>insidebottomright</position>
				</anchored>
				<target>stats</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>

			<subwindow name="description">
				<bounds>22,64,-35,-23</bounds>
				<class>item_description</class>
			</subwindow>
			<scrollercontrol name="description_scroller">
				<anchored>
					<to>description</to>
					<position>insidebottomright</position>
				</anchored>
				<target>description</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>

			<!-- Tabs -->
			<tabcontrol name="tabs">
				<bounds>-22,50,18,155</bounds>
				<tab>
					<icon>tab_main</icon>
					<subwindow>stats</subwindow>
					<scroller>stats_scroller</scroller>
				</tab>
				<tab>
					<icon>tab_shared</icon>
					<subwindow>description</subwindow>
					<scroller>description_scroller</scroller>
				</tab>
				<activate>1</activate>
			</tabcontrol>
		
			<v-iewerlist>
				<bounds>2,-43,-10,34</bounds>
			</v-iewerlist>
		</sheetdata>
	</windowclass>
	
	<windowclass name="item_client">
		<frame>charsheet</frame>
		<placement>
			<size>
				<width>250</width>
				<height>300</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic />
		</sizelimits>
		<minimize>minimized_item</minimize>
		<tooltip>
			<field>name</field>
		</tooltip>
		<sheetdata>
			<!-- NAME -->
			<genericcontrol name="nameframe">
				<bounds>10,20,-12,35</bounds>
				<frame>
					<name>sheetgroup</name>
				</frame>
			</genericcontrol>
			<windowopencontrol>
				<anchored>
					<to>nameframe</to>
					<position>insidetopleft</position>
					<offset>13,8</offset>
					<size>
						<width>20</width>
						<height>20</height>
					</size>
				</anchored>
				<icon>
					<normal>button_openwindow</normal>
					<pressed>button_emptytarget</pressed>
				</icon>
				<class>item_client</class>
				<description>
					<field>name</field>
				</description>
			</windowopencontrol>
			<stringfield name="name">
				<anchored>
					<to>nameframe</to>
					<position>insidetopleft</position>
					<offset>35,9</offset>
				</anchored>
				<empty>&#171; New Item &#187;</empty>
				<font>sheettext</font>
			</stringfield>

			<!-- Frame -->		
			<genericcontrol name="contentframe">
				<bounds>10,54,-12,-13</bounds>
				<frame>
					<name>sheetgroup</name>
					<offset>0,1,0,0</offset>
				</frame>
			</genericcontrol>
			
			<stringfield name="nonidentified">
				<anchored>
					<to>contentframe</to>
					<position>over</position>
					<offset>-12,-7</offset>
				</anchored>
				<font>sheettextsmall</font>
				<multilinespacing>15</multilinespacing>
			</stringfield>
			<stringfield name="identified">
				<anchored>
					<to>contentframe</to>
					<position>over</position>
					<offset>-12,-7</offset>
				</anchored>
				<font>sheettextsmall</font>
				<multilinespacing>15</multilinespacing>
				<invisible />
			</stringfield>
		</sheetdata>
		<script>
			function identifyUpdated()
				if identifynode.getValue() ~= 0 then
					nonidentified.setVisible(false);
					identified.setVisible(true);
				else
					nonidentified.setVisible(true);
					identified.setVisible(false);
				end
			end
		
			function onInit()
				identifynode = getDatabaseNode().createChild("isidentified", "number");
				identifynode.onUpdate = identifyUpdated;
			end
		</script>
	</windowclass>
	
	<windowclass name="itemsmall">
		<sizelimits>
			<minimum>
				<height>10</height>
			</minimum>
		</sizelimits>
		<sheetdata>
			<windowreferencecontrol name="open">
				<bounds>0,0,20,20</bounds>
				<icon>
					<normal>button_openwindow</normal>
					<pressed>button_emptytarget</pressed>
				</icon>
				<class>item</class>
				<description>
					<field>name</field>
				</description>
			</windowreferencecontrol>
			<linkstringfield name="name">
				<bounds>25,1,-1,20</bounds>
				<empty>&#171; New Item &#187;</empty>
				<selectioncolor>#90ffffff</selectioncolor>
				<font>sheettext_npc</font>
				<linktarget>open</linktarget>
			</linkstringfield>
		</sheetdata>
	</windowclass>
	
	<windowclass name="itemlist">
		<frame>scrollboxfortabs</frame>
		<s-oftclose />
		<placement>
			<size>
				<width>275</width>
				<height>350</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic />
			<minimum>
				<width>200</width>
				<height>290</height>
			</minimum>
		</sizelimits>
		<nodelete />
		<sheetdata>
			<genericcontrol>
				<bounds>16,21,30,177</bounds>
				<icon>title_items</icon>
			</genericcontrol>
			<windowlist name="list">
				<bounds>50,25,-30,-34</bounds>
				<datasource>.</datasource>
				<class>itemsmall</class>
				<sortfields>name</sortfields>
				<footer>footer_narrow</footer>
				<allowcreate />
				<allowdelete />
				<acceptdrop>
					<class>item</class>
					<field>name</field>
					<field>description</field>
					<field>aura</field>
					<field>cl</field>
					<field>prerequisites</field>
					<field>price</field>
					<field>cost</field>
					<field>identified</field>
					<field>nonidentified</field>
					<field>isidentified</field>
				</acceptdrop>
				<script>
					function onSortCompare(w1, w2)
						return w1.name.getValue() &gt; w2.name.getValue();
					end;
					
					function onFilter(w)
						local f = string.lower(window.filter.getValue());
						
						if f == "" then
							return true;
						end
						
						if string.find(string.lower(w.name.getValue()), f, 0, true) then
							return true;
						end
						
						return false;
					end
				</script>
			</windowlist>
			<scrollercontrol>
				<bounds>-105,-61,45,27</bounds>
				<target>list</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>
			<buttoncontrol>
				<bounds>-55,-58,34,25</bounds>
				<icon>
					<normal>button_newwindow</normal>
					<pressed>button_newwindowdown</pressed>
				</icon>
				<class>item</class>
				<script>
					function onButtonPress()
						local node = window.getDatabaseNode();
						if node then
							node = node.createChild();
							if node then
								Interface.openWindow(class[1], node.getNodeName());
							end
						end
					end
				</script>
			</buttoncontrol>
			<categoryselectioncontrol>
				<bounds>24,-39,-24,-1</bounds>
				<targetcontrol>list</targetcontrol>
			</categoryselectioncontrol>

			<filter name="filter">
				<bounds>55,-70,-50,20</bounds>
				<target>list</target>
				<trigger>filtertrigger</trigger>
			</filter>
			<filtertrigger name="filtertrigger">
				<bounds>20,-85,21,41</bounds>
				<target>filter</target>
			</filtertrigger>			
		</sheetdata>
	</windowclass>
</root>
