code:
######################################################
############## LIST TYPES AND TEMPLATES ##############
######################################################

template default_character_list_overlay
{
	modify_texture = {
		texture = "gfx/interface/buttons/button_standard_overlay.dds"
		spriteType = Corneredstretched
		spriteborder = { 3 3 }
		blend_mode = overlay
	}
}

template character_age_or_death_text
{
	hbox = {
		block "list_layout" {
			minimumsize = { 62 0 }
			expand = {}
		}

		margin_right = 5
		spacing = 2

		block "character_age"
		{
			text_single = {
				text = "[Character.GetAge]"
				align = nobaseline
			}
		}

		icon = {
			visible = "[Not(Character.IsDeadAndValid)]"
			size = { 23 23 }
			framesize = { 60 60 }
			frame = "[Character.GetHealthIconFrame]"
			texture = "gfx/interface/icons/character_status/icon_health.dds"
			tooltip = "[Character.GetHealthInfo]"
		}

		block "is_dead"
		{
			icon = {
				name = "is_dead"
				visible = "[Character.IsDeadAndValid]"
				size = { 23 23 }

				texture = "[Character.GetDeathReasonIcon]"
				tooltip = "CHARACTER_DEAD_TOOLTIP"
			}
		}
	}
}

types Lists
{
	type character_age_health = hbox
	{
		spacing = 2

		text_single = {
			text = "[Character.GetAge]"
			align = nobaseline
		}

		icon = {
			visible = "[Not(Character.IsDeadAndValid)]"
			size = { 23 23 }
			framesize = { 60 60 }
			frame = "[Character.GetHealthIconFrame]"
			texture = "gfx/interface/icons/character_status/icon_health.dds"
			tooltip = "[Character.GetHealthInfo]"
		}

		expand = {}
	}

	# Implementation details
	type character_list_arrow = highlight_icon
	{
		parentanchor = left|vcenter
		position = { -13 0 }

		size = { 14 14 }
		framesize  = { 14 28 }
		texture = "gfx/interface/buttons/button_entry_characterlist_arrow.dds"

		gfxtype = togglepushbuttongfx
		effectname = "NoHighlight"

		spriteType = Corneredstretched
		spriteborder = { 20 20 }
	}
	## Character Skill Value

	type widget_skill_item_no_icon = widget {
		tooltip = "SKILL_ITEM_TOOLTIP"
		using = tooltip_se
		size = { 32 25 }

		text_single = {
			name = "value"
			parentanchor = center
			margin_bottom = 4
			align = center
			text = "[SkillItem.GetValue]"
		}

		background = {
			name = "skill_icon_bg"
			texture = "gfx/interface/window_character/character_view_skills_bg.dds"
			framesize = { 70 26 }
			margin = { 5 0 }

			block "bg"
			{
				frame = "[SkillItem.GetFrame]"
			}
		}
	}

	## Character List Items
	type widget_character_list_item = widget {
		datacontext = "[CharacterListItem.GetCharacter]"
		size = { 10 110 }

		block "divider" {
			divider = {
				parentanchor = bottom|hcenter
				size = { 100% 3 }
			}
		}

		block "widget" {}

		hbox = {
			margin = { 0 5 }
			spacing = 15

			portrait_head_small = {}

			button_standard = {
				layoutpolicy_horizontal = expanding
				layoutpolicy_vertical = expanding

				onclick = "[CharacterListItem.OnClick('character')]"
				enabled = "[CharacterListItem.IsSelectable]"
				tooltip = "[CharacterListItem.GetUnselectableReason]"

				framesize = { 252 80 }
				spriteType = Corneredtiled
				spriteborder = { 10 30 }

				block "button_texture"
				{
					texture = "gfx/interface/buttons/button_entry_characterlist.dds"
				}

				block "button" {}

				character_list_arrow = {
					name = "character_list_arrow"
				}

				block "overlay" {
					using = default_character_list_overlay
				}

				block "button_content"
				{
					vbox = {
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding

						# Name
						hbox = {
							layoutpolicy_horizontal = expanding
							layoutpolicy_vertical = expanding

							# Age & Relation
							vbox = {
								layoutpolicy_horizontal = expanding
								layoutpolicy_vertical = expanding

								margin_left = 10

								min_width = 320
								max_width = 320

								text_single = {
									layoutpolicy_horizontal = expanding
									using = Font_Size_Medium
									autoresize = no
									alwaystransparent = yes

									text = "[Character.GetUINameNoTooltip|U]"
								}

								hbox = {
									layoutpolicy_horizontal = expanding
									layoutpolicy_vertical = expanding

									using = character_age_or_death_text
									blockoverride "list_layout" {}

									block "character_relation"
									{
										text_single = {
											name = "character_relation"
											layoutpolicy_horizontal = expanding
											raw_text = "|  [Character.GetRelationToString( GetPlayer )]"
											tooltip = "EXTENDED_RELATIONS_TOOLTIP"
											default_format = "#low"
											autoresize = no
											align = nobaseline
											visible = "[Character.HasRelationTo( GetPlayer )]"
											alwaystransparent = yes
										}

										expand = {
											visible = "[Not(Character.HasRelationTo( GetPlayer ))]"
										}
									}
								}

								block "character_description_extra" {}
							}

							expand = {}

							# Skills
							vbox = {
								layoutpolicy_vertical = expanding

								hbox = {
									name = "skills_grid"

									datamodel = "[CharacterListItem.GetSkillItems]"
									margin_right = 3
									margin_top = 3

									item = {
										widget_skill_item_no_icon = {}
									}
								}

								expand = {}
							}

							block "extra_skills" {}
						}

						expand = {}

						hbox = {
							layoutpolicy_horizontal = expanding
							layoutpolicy_vertical = expanding
							margin_left = 5
							spacing = 5

							# Dynasty
							widget = {
								size = { 35 40 }

								coa_house_tiny = {
									datacontext = "[Character.GetHouse]"
									parentanchor = center
								}
							}

							# Traits
							fixedgridbox = {
								name = "traits_grid"
								datamodel = "[CharacterListItem.GetTraits]"
								flipdirection = yes
								size = { 150 35 }
								addcolumn = 30
								addrow = 35
								block "horizontal_slots"
								{
									maxhorizontalslots = 6
								}
								maxverticalslots = 1

								item = {
									widget = {
										visible = "[Trait.IsValid]"
										size = { 35 35 }

										icon_trait = {
											parentanchor = center

											blockoverride "icon_size"
											{
												size = { 30 30 }
											}

											blockoverride "tooltip_placement"
											{
												using = tooltip_se
											}

											blockoverride "glow_radius"
											{
												glow_radius = 3
											}
										}
									}
								}
							}

							block "bottom_middle_box" {
								# Religion & Culture
								hbox = {
									layoutpolicy_vertical = expanding

									# Faith
									icon = {
										name = "faith_button"
										size = { 35 35 }
										datacontext = "[Character.GetFaith]"
										tooltipwidget = { faith_tooltip = {} }
										texture = "[Faith.GetIcon]"
									}

									# Culture
									widget = {
										datacontext = "[Character.GetCulture]"
										size = { 120 30 }

										hbox = {
											icon = {
												name = "culture"
												texture = "gfx/interface/icons/icon_culture.dds"
												size = { 30 30 }
											}

											text_multi = {
												layoutpolicy_horizontal = expanding
												min_width = 90
												max_width = 90
												autoresize = yes
												text = "CULTURE_LISTS_WINDOW"
											}
										}

										tooltipwidget = {
											culture_tooltip = {}
										}

										using = tooltip_se
									}

								}
							}

							expand = {}

							vbox = {
								datacontext = "[CharacterListItem.GetCharacter]"
								layoutpolicy_vertical = expanding
								margin_right = 5

								expand = {}

								block "bottom_right_box"
								{
									hbox = {
										layoutpolicy_horizontal = expanding
										layoutpolicy_vertical = expanding

										# Realm
										widget = {
											size = { 55 58 }
											visible = "[Not( IsDataModelEmpty( CharacterListItem.GetTitleItems ) )]"

											block "claims_visibility" {}

											datacontext = "[CharacterListItem.GetFirstClaim]"

											coa_title_tiny_crown = {
												using = tooltip_ne
												datacontext = "[Claim.GetTitle]"

												highlight_icon = {
													name = "pressed_claim"
													visible = "[And(Claim.IsPressed, Not(Claim.IsImplicit))]"
													texture = "gfx/interface/icons/title_status/icon_claim_pressed.dds"
													size = { 24 24 }
													parentanchor = bottom|right
												}

												highlight_icon = {
													name = "unpressed_claim"
													visible = "[And(Not(Claim.IsPressed), Not(Claim.IsImplicit))]"
													texture = "gfx/interface/icons/title_status/icon_claim_unpressed.dds"
													size = { 24 24 }
													parentanchor = bottom|right
												}

												highlight_icon = {
													name = "implicit_claim"
													visible = "[Claim.IsImplicit]"
													texture = "gfx/interface/icons/title_status/icon_claim_implicit.dds"
													size = { 24 24 }
													parentanchor = bottom|right
												}

												blockoverride "coa_tooltip"
												{
													tooltip = "CHARACTER_LIST_CLAIM_TOOLTIP"
												}
											}

											text_single = {
												align = right
												minimumsize = { 15 0 }
												parentanchor = vcenter|right
												text = "[CharacterListItem.GetTitleItemCount]"
												tooltip = "CHARACTER_LIST_CLAIM_TOOLTIP"
											}
										}
									}
								}

								expand = {}
							}
						}
					}
				}
			}
		}
	}

	type widget_character_list_item_finder = widget {
		datacontext = "[CharacterListItem.GetCharacter]"
		size = { 200 94 }

		#background = {
		#	visible = "[CharacterListItem.HasEvenOrderIndex]"
		#	using = Background_Area_Dark
		#	margin_top = -4
		#	margin_bottom = 200
		#	alpha = 0.5
		#}

		block "divider" {}

		block "widget" {}

		hbox = {
			margin_right = 15
			vbox = {
				portrait_head_small = {}

				expand = {}
			}

			block "button_content"
			{
				hbox = {
					layoutpolicy_horizontal = expanding
					layoutpolicy_vertical = expanding
					margin_top = 5

					vbox = {
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding

						# Name and age
						hbox = {
							layoutpolicy_horizontal = expanding
							margin = { 0 3 }
							margin_left = 5
							margin_right = 10

							background = {
								using = Background_Area_Characterlist
							}

							background = {
								using = Background_Area_Dark

								modify_texture = {
									texture = "gfx/interface/component_masks/mask_fade_vertical.dds"
									blend_mode = alphamultiply
									alpha = 1
									rotate_uv = 90
									mirror = vertical
								}
							}

							hbox = {
								margin_left = 3
								layoutpolicy_horizontal = expanding
								maximumsize = { 338 -1 }

								text_single = {
									using = Font_Size_Medium
									layoutpolicy_horizontal = expanding
									align = nobaseline
									text = "[Character.GetUINameNoTooltip|U]"
									autoresize = no
									fontsize_min = 14
								}

								block "character_relation"
								{
									hbox = {
										visible = "[And(Character.HasRelationTo( GetPlayer ), Not(Character.IsPlayer))]"
										text_single = {
											raw_text = "•"
											align = nobaseline
											margin = { 5 0 }
										}

										text_single = {
											name = "character_relation"
											text = "[Character.GetRelationToString( GetPlayer )]"
											tooltip = "EXTENDED_RELATIONS_TOOLTIP"
											default_format = "#low"
											align = nobaseline
											fontsize_min = 14
											max_width = 180
										}
									}
								}

								expand = {}
							}

							hbox = {
								using = character_age_or_death_text
							}

							# Skills
							hbox_skills_grid = {}
						}

						### BOTTOM ROW ###
						hbox = {
							layoutpolicy_horizontal = expanding
							layoutpolicy_vertical = expanding

							vbox = {
								layoutpolicy_horizontal = expanding
								layoutpolicy_vertical = expanding

								block "additional_info_kill_list" {}

								hbox = {
									layoutpolicy_horizontal = expanding
									layoutpolicy_vertical = expanding

									# Dynasty
									widget = {
										size = { 45 40 }

										coa_house_small = {
											datacontext = "[Character.GetHouse]"
											parentanchor = center
											scale = 0.7
										}
									}

									# Traits
									hbox = {
										layoutpolicy_vertical = expanding
										margin = { 10 0 }
										minimumsize = { 140 0 } #### needed for prison view

										background = {
											using = Background_Area_Dark
											alpha = 0.5
											margin = { 0 2 }
										}

										hbox = {
											layoutpolicy_horizontal = expanding

											fixedgridbox = {
												name = "traits_grid"
												datamodel = "[CharacterListItem.GetTraits]"
												datamodel_reuse_widgets = yes
												flipdirection = yes
												layoutpolicy_horizontal = expanding
												layoutpolicy_vertical = expanding
												addcolumn = 30
												addrow = 28

												block "gridbox_items"
												{
													min_width = 210
													datamodel_wrap = 7
													maxverticalslots = 2
												}

												item = {
													icon_trait = {
														visible = "[Trait.IsValid]"

														blockoverride "icon_size"
														{
															size = { 30 30 }
														}

														blockoverride "tooltip_placement"
														{
															using = tooltip_se
														}

														blockoverride "glow_radius"
														{
															glow_radius = 3
														}
													}
												}
											}
										}
									}

									expand = {}
								}
							}

							vbox = {
								datacontext = "[CharacterListItem.GetCharacter]"
								layoutpolicy_horizontal = expanding
								layoutpolicy_vertical = expanding

								block "bottom_right_box"
								{
									hbox = {
										layoutpolicy_horizontal = expanding
										layoutpolicy_vertical = expanding

										block "claims" { # for kill list
											widget_list_claims = {}
										}

										# Religion and culture
										hbox = {
											layoutpolicy_horizontal = expanding
											layoutpolicy_vertical = expanding
											margin_left = 8
											margin_right = 4
											spacing = 5
											minimumsize = { 110 0 }

											background = {
												using = Background_Area_Dark
												alpha = 0.5
												margin = { 0 2 }
											}

											icon = {
												name = "faith_button"
												size = { 38 38 }
												datacontext = "[Character.GetFaith]"
												tooltipwidget = { faith_tooltip = {} }
												using = tooltip_se

												texture = "[Faith.GetIcon]"
											}

											hbox = {
												datacontext = "[Character.GetCulture]"
												layoutpolicy_horizontal = expanding
												spacing = 3

												tooltipwidget = {
													culture_tooltip = {}
												}
												using = tooltip_se

												icon = {
													name = "culture"
													texture = "gfx/interface/icons/icon_culture.dds"
													size = { 24 24 }
												}

												text_single = {
													layoutpolicy_horizontal = expanding
													text = "CULTURE_LISTS_WINDOW"
													autoresize = no
													align = nobaseline
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

	type dropdown_menu_standard = dropDown {
		block "dropdown_properties"
		{
			#datamodel = "[GetPlayer.GetCourt]"
		}

		block "dropdown_size"
		{
			size = { 200 32 }
		}

		active_item = {
			container = {
				alwaystransparent = no

				button_drop = {
					block "dropdown_size"
					{
						size = { 200 32 }
					}
					block "dropdown_active_item_properties"
					{
						raw_text = "#D Current Option#!"
					}
					button_trigger = none

				}
			}
		}

		item = {
			container = {
				alwaystransparent = no

				button_dropdown = {
					block "dropdown_size"
					{
						size = { 200 32 }
					}
					button_trigger = none

					block "dropdown_item_properties"
					{
						raw_text = "#D Option#!"
					}

					default_format = "#clickable"
				}
			}
		}

		list = {
			scrollarea = {
				position = { 5 32 }
				block "dropdown_list_maxsize"
				{
					maximumsize = { 192 250 }
				}

				block "dropdown_list_properties"
				{

				}

				autoresizescrollarea = yes
				scrollbarpolicy_horizontal = always_off

				using = Background_DropDown

				scrollwidget = {
					dynamicgridbox = {
						alwaystransparent = no
					}
				}

				scrollbar_vertical = {
					using = Scrollbar_Vertical
				}
			}
		}
	}

	type dropdown_sort_characterlist = dropDown {
		name = "sort_options"
		block "size_button_drop" {   ########### only used for character finder
			size = { 190 33 }
		}

		active_item = {
			widget = {
				alwaystransparent = no
				size = { 100% 100% }

				button_drop = {
					block "text_button_drop" {
						text = "[CharacterListSortItem.GetName]"
					}
				}
			}
		}

		item = {
			widget = {
				alwaystransparent = no
				block "size_dropdown" {
					size = { 190 33 }
				}

				button_normal = {
					size = { 100% 30 }
					button_trigger = none
					gfxtype = framedbuttongfx
					effectname = "NoHighlight"
					shaderfile = "gfx/FX/pdxgui_pushbutton.shader"
					upframe = 1
					overframe = 2
					downframe = 3
					disableframe = 1
					texture = "gfx/interface/buttons/button_interaction_menu.dds"
					framesize = { 317 30 }
				}

				button_dropdown = {
					block "size_dropdown" {
						size = { 190 33 }
					}
					block "text_button_drop" {
						text = "[CharacterListSortItem.GetName]"
					}

					default_format = "#clickable"
				}
			}
		}

		list = {
			scrollarea = {
				position = { 5 33 }
				maximumsize = { 190 250 }
				autoresizescrollarea = yes
				scrollbarpolicy_horizontal = always_off

				using = Background_DropDown

				scrollwidget = {
					dynamicgridbox = {
						alwaystransparent = no
					}
				}

				scrollbar_vertical = {
					using = Scrollbar_Vertical
				}
			}
		}
	}

	type widget_list_claims = widget {
		datacontext = "[CharacterListItem.GetFirstClaim]"
		layoutpolicy_vertical = expanding
		size = { 55 0 }

		block "claims_visibility" {}

		coa_title_tiny_crown = {
			visible = "[Not( IsDataModelEmpty( CharacterListItem.GetTitleItems ) )]"
			parentanchor = center
			position = { -10 0 }
			scale = 0.8

			tooltip = "CHARACTER_LIST_CLAIM_TOOLTIP"
			using = tooltip_ne

			blockoverride "coa_button" {
				datacontext = "[Claim.GetTitle]"
				onclick = "[DefaultOnCoatOfArmsClick(Title.GetID)]"
				onrightclick = "[DefaultOnCoatOfArmsRightClick(Title.GetID)]"
				button_ignore = none
			}

			highlight_icon = {
				name = "pressed_claim"
				visible = "[And(Claim.IsPressed, Not(Claim.IsImplicit))]"
				texture = "gfx/interface/icons/title_status/icon_claim_pressed.dds"
				size = { 24 24 }
				parentanchor = bottom|right
			}

			highlight_icon = {
				name = "unpressed_claim"
				visible = "[And(Not(Claim.IsPressed), Not(Claim.IsImplicit))]"
				texture = "gfx/interface/icons/title_status/icon_claim_unpressed.dds"
				size = { 24 24 }
				parentanchor = bottom|right
			}

			highlight_icon = {
				name = "implicit_claim"
				visible = "[Claim.IsImplicit]"
				texture = "gfx/interface/icons/title_status/icon_claim_implicit.dds"
				size = { 24 24 }
				parentanchor = bottom|right
			}
		}

		text_single = {
			visible = "[CharacterListItem.HasTitleItems]"
			parentanchor = center
			position = { 18 0 }
			text = "[CharacterListItem.GetTitleItemCount]"
			default_format = "#high"
			using = Font_Size_Medium
			align = center
		}
	}

	## Same as hbox_skills_grid, except taking character instead of character list item
	type hbox_skills_grid_character_model = hbox {
		name = "hbox_skills_grid_character_model"
		minimumsize = { 160 0 }

		widget = {
			size = { 32 25 }

			text_single = {
				name = "value"
				parentanchor = center
				margin_bottom = 4
				align = center
				text = "[Character.GetSkill('diplomacy')]"
				tooltip = "diplomacy_concept"
			}

			background = {
				name = "skill_icon_bg"
				texture = "gfx/interface/window_character/character_view_skills_bg.dds"
				framesize = { 70 26 }
				margin = { 5 0 }

				frame = 1
			}
		}
		widget = {
			size = { 32 25 }

			text_single = {
				name = "value"
				parentanchor = center
				margin_bottom = 4
				align = center
				text = "[Character.GetSkill('martial')]"
				tooltip = "martial_concept"
			}

			background = {
				name = "skill_icon_bg"
				texture = "gfx/interface/window_character/character_view_skills_bg.dds"
				framesize = { 70 26 }
				margin = { 5 0 }

				frame = 2
			}
		}
		widget = {
			size = { 32 25 }

			text_single = {
				name = "value"
				parentanchor = center
				margin_bottom = 4
				align = center
				text = "[Character.GetSkill('stewardship')]"
				tooltip = "stewardship_concept"
			}

			background = {
				name = "skill_icon_bg"
				texture = "gfx/interface/window_character/character_view_skills_bg.dds"
				framesize = { 70 26 }
				margin = { 5 0 }

				frame = 3
			}
		}
		widget = {
			size = { 32 25 }

			text_single = {
				name = "value"
				parentanchor = center
				margin_bottom = 4
				align = center
				text = "[Character.GetSkill('intrigue')]"
				tooltip = "intrigue_concept"
			}

			background = {
				name = "skill_icon_bg"
				texture = "gfx/interface/window_character/character_view_skills_bg.dds"
				framesize = { 70 26 }
				margin = { 5 0 }

				frame = 4
			}
		}
		widget = {
			size = { 32 25 }

			text_single = {
				name = "value"
				parentanchor = center
				margin_bottom = 4
				align = center
				text = "[Character.GetSkill('learning')]"
				tooltip = "learning_concept"
			}

			background = {
				name = "skill_icon_bg"
				texture = "gfx/interface/window_character/character_view_skills_bg.dds"
				framesize = { 70 26 }
				margin = { 5 0 }

				frame = 5
			}
		}
	}

	type hbox_skills_grid = hbox {
		name = "skills_grid"
		minimumsize = { 160 0 }

		block "skills_datamodel"
		{
			datamodel = "[CharacterListItem.GetSkillItems]"
		}

		item = {
			widget_skill_item_no_icon = {}
		}
	}

	type hbox_list_sort_buttons = hbox {
		name = "sort_buttons"

		block "margins" {
			margin_left = 20
			margin_right = 30
			margin_top = 5
			spacing = 5
		}

		button_standard = {
			name = "filters"
			size = { 25 25 }

			down = "[CharacterSelectionList.FiltersShown]"
			frame = "[BoolTo1And2(CharacterSelectionList.IsAllDefault)]"
			onclick = "[CharacterSelectionList.OnToggleFilters]"

			tooltip = "TOGGLE_FILTERS"
			using = tooltip_nw

			button_search = {
				alwaystransparent = yes
				parentanchor = center
				size = { 20 20 }
			}

			block "filters_visible" {}
		}

		divider_light = {
			size = { 3 20 }
			block "filters_visible" {}
		}

		text_single = {
			text = "SORT_BY"
			align = nobaseline
			max_width = 90
		}

		block "sort_dropdown" {
			dropdown_sort_characterlist = {}
		}

		button_standard = {
			name = "sort_order"
			size = { 25 25 }
			onclick = "[CharacterSelectionList.RevertSortOrder]"

			tooltip = "CHARACTER_SORT_BY"
			using = tooltip_nw

			button_icon = {
				alwaystransparent = yes
				parentanchor = center
				size = { 25 25 }
				texture = "gfx/interface/icons/flat_icons/sort_icon.dds"
				framesize = { 66 66 }

				frame = "[BoolTo1And2(CharacterSelectionList.GetSortOrder)]"

				blockoverride "button_frames"
				{
					effectname = "NoHighlight"
				}
			}
		}

		expand = {}

		block "skill_sort_buttons"
		{
			hbox = {
				button_standard_hover = {
					name = "skill_diplomacy"
					size = { 32 32 }

					icon = {
						texture = "gfx/interface/icons/icon_skills.dds"
						size = { 32 32 }
						framesize = { 60 60 }
						frame = 1
					}

					onclick = "[CharacterSelectionList.SortBySkill('(int32)0')]"

					tooltip = "SORT_BY_DIPLOMACY"
					using = tooltip_ne

					skillitem_sort_icon = {
						visible = "[CharacterSelectionList.IsSortingBySkill('(int32)0')]"
					}
				}

				button_standard_hover = {
					name = "skill_martial"
					size = { 32 32 }

					icon = {
						texture = "gfx/interface/icons/icon_skills.dds"
						size = { 32 32 }
						framesize = { 60 60 }
						frame = 2
					}

					onclick = "[CharacterSelectionList.SortBySkill('(int32)1')]"

					tooltip = "SORT_BY_MARTIAL"
					using = tooltip_ne

					skillitem_sort_icon = {
						visible = "[CharacterSelectionList.IsSortingBySkill('(int32)1')]"
					}
				}

				button_standard_hover = {
					name = "skill_stewardship"
					size = { 32 32 }

					icon = {
						texture = "gfx/interface/icons/icon_skills.dds"
						size = { 32 32 }
						framesize = { 60 60 }
						frame = 3
					}

					onclick = "[CharacterSelectionList.SortBySkill('(int32)2')]"
					tooltip = "SORT_BY_STEWARDSHIP"
					using = tooltip_ne

					skillitem_sort_icon = {
						visible = "[CharacterSelectionList.IsSortingBySkill('(int32)2')]"
					}
				}

				button_standard_hover = {
					name = "skill_intrigue"
					size = { 32 32 }

					icon = {
						texture = "gfx/interface/icons/icon_skills.dds"
						size = { 32 32 }
						framesize = { 60 60 }
						frame = 4
					}

					onclick = "[CharacterSelectionList.SortBySkill('(int32)3')]"
					tooltip = "SORT_BY_INTRIGUE"
					using = tooltip_ne

					skillitem_sort_icon = {
						visible = "[CharacterSelectionList.IsSortingBySkill('(int32)3')]"
					}
				}

				button_standard_hover = {
					name = "skill_learning"
					size = { 32 32 }

					icon = {
						texture = "gfx/interface/icons/icon_skills.dds"
						size = { 32 32 }
						framesize = { 60 60 }
						frame = 5
					}

					onclick = "[CharacterSelectionList.SortBySkill('(int32)4')]"
					tooltip = "SORT_BY_LEARNING"
					using = tooltip_ne

					skillitem_sort_icon = {
						visible = "[CharacterSelectionList.IsSortingBySkill('(int32)4')]"
					}
				}
			}
		}
	}

	type skillitem_sort_icon = icon {
		frame = "[BoolTo1And2(CharacterSelectionList.GetSortOrder)]"
		alwaystransparent = yes
		parentanchor = top|hcenter
		position = { 0 -14 }
		texture = "gfx/interface/buttons/button_sort_toggle.dds"
		framesize = { 36 36 }
		size = { 18 18 }

		using = Master_Button_Modify_Texture

		blockoverride "master_color_frame" {
			frame = 1
		}
	}

	type vbox_character_list = vbox {
		name = "character_list"
		spacing = 3

		block "sort_buttons"
		{
			hbox_list_sort_buttons = {
				layoutpolicy_horizontal = expanding

				blockoverride "margins" {
					margin_left = 20
					margin_right = 23
					margin_top = 5
					spacing = 5
				}
			}
		}

		block "special_character" {}

		scrollbox = {

			name = "characters_scroll_area"
			layoutpolicy_vertical = expanding
			layoutpolicy_horizontal = expanding

			block "scrollbox_properties"
			{
			}

			blockoverride "scrollbox_content" {

				block "container_implementation" {
					vbox = {
						name = "characters_grid"
						datamodel = "[CharacterSelectionList.GetList]"
						visible = "[Not(CharacterSelectionList.IsBuildingList)]"
						layoutpolicy_horizontal = expanding

						item = {
							widget_character_list_item = {
								block "item_size" {
									size = { 650 110 }
									layoutpolicy_horizontal = expanding
								}
							}
						}
					}
				}
			}

			blockoverride "scrollbox_empty"
			{
				block "scrollbox_empty_visibility"
				{
					layoutpolicy_vertical = expanding
					visible = "[IsDataModelEmpty( CharacterSelectionList.GetList )]"
					text = "NO_CHARACTERS_TO_SELECT"
				}
			}
		}

		block "character_count"
		{
			hbox = {
				layoutpolicy_horizontal = growing
				margin = { 25 5 }
				margin_bottom = 8
				spacing = 5

				block "bottom_bar" {}

				expand = {}

				widget = {
					size = { 20 15 }

					warning_icon = {
						size = { 25 25 }
						visible = "[Not( CharacterSelectionList.IsAllDefault )]"
						tooltip = "CHARACTER_FINDER_FILTER_SET"
						position = { -3 -5 }
					}
				}

				text_single = {
					name = "character_count"
					datacontext = "[CharacterSelectionList]"
					text = "CHARACTER_FINDER_COUNT"
					align = center|nobaseline
					default_format = "#low"
				}
			}
		}
	}

	type fixed_gridbox_character_list = vbox_character_list
	{
		blockoverride "container_implementation"
		{
			fixedgridbox = {
				name = "characters_grid"

				block "character_gridbox"
				{
					addcolumn = 650
					addrow = 105
					datamodel_reuse_widgets = yes
				}

				datamodel = "[CharacterSelectionList.GetList]"
				visible = "[Not(CharacterSelectionList.IsBuildingList)]"

				item = {
					widget_character_list_item = {
						block "item_size"
						{
							size = { 650 110 }
						}
					}
				}
			}
		}
	}

	type button_recruit_character = button_round
	{
		visible = "[Character.IsPlayerInteractionShown('recruit_guest_interaction')]"
		enabled = "[Character.IsPlayerInteractionValid('recruit_guest_interaction')]"
		onclick = "[Character.OpenPlayerInteraction('recruit_guest_interaction')]"
		tooltip = "[Character.GetPlayerInteractionTooltip('recruit_guest_interaction')]"

		button_add_character = {
			alwaystransparent = yes
			parentanchor = center
		}
	}

	type widget_courtier_item = widget {
		size = { 0 125 }

		hbox = {
			spacing = 5

			background = {
				using = Background_Area_With_Header
				margin_right = 7
				margin_left = 5
			}

			portrait_head = {}

			vbox = {
				layoutpolicy_horizontal = expanding
				layoutpolicy_vertical = expanding
				margin_top = 3

				hbox = {
					layoutpolicy_horizontal = expanding

					text_single = {
						name = "name"
						layoutpolicy_horizontal = expanding
						autoresize = no
						text = "[Character.GetUINameNoTooltip]"
						using = Font_Size_Medium
						align = nobaseline
						fontsize_min = 14
						margin_right = 10
					}

					hbox_skills_grid = {}
				}

				vbox = {
					layoutpolicy_horizontal = expanding
					margin = { 0 3 }
					margin_bottom = 8

					hbox = {
						layoutpolicy_horizontal = expanding
						spacing = 3

						warning_icon = {
							visible = "[And( Character.CourtierWantsToLeaveCourt, Not( Character.IsImprisoned))]"
							size = { 20 20 }
							tooltip = "[Character.GetCourtierLeaveDescription]"
						}

						debug_square = {
							visible = "[InDebugMode]"
							size = { 20 20 }
							raw_tooltip = "#D [Character.GetDebugCourtierLeaveReasons]#!"
						}

						text_single = {
							name = "relation_to_court_owner"
							default_format = "#low"
							align = nobaseline
							max_width = 370
							visible = "[Not(Character.IsHostage)]"

							block "description_relation_text" {
								text = "[Character.GetRelationToString( CharacterWindow.GetCourtOwner )]"
								tooltip = "EXTENDED_RELATIONS_TOOLTIP"
							}

							background = {
								visible = "[Character.IsImprisoned]"
								using = Status_Bad
								alpha = 0.5
							}
						}

						text_single = {
							name = "relation_to_court_hostage"
							default_format = "#medium"
							align = nobaseline
							visible = "[Character.IsHostage]"

							block "description_relation_text" {
								text = "[Character.GetRelationToString( CharacterWindow.GetCourtOwner )]"
								tooltip = "EXTENDED_RELATIONS_TOOLTIP"
							}

							background = {
								visible = "[Character.IsHostage]"
								using = Status_Mixed
								alpha = 0.5
							}
						}
						expand = {}

						text_single = {
							name = "has_guardian"
							default_format = "#low"
							align = nobaseline
							max_width = 370
							margin_right = 5
							visible = "[And( Not(Character.IsAdult), Not(Character.HasGuardian) )]"

							text = "COURT_WINDOW_NO_GUARDIAN"
							tooltip = "COURT_WINDOW_NO_GUARDIAN_TOOLTIP"
						}
					}
				}

				hbox = {
					layoutpolicy_horizontal = expanding
					spacing = 5
					margin_bottom = 5

					block "action_buttons"
					{
						hbox = {
							margin = { 0 3 }
							spacing = 5

							button_recruit_character = {}
						}
					}

					hbox = {
						layoutpolicy_horizontal = expanding
						layoutpolicy_vertical = expanding
						minimumsize = { 0 60 }
						margin_left = 5

						background = {
							using = Background_Area_Dark
							margin = { 3 3 }
							alpha = 0.5
						}

						# Dynasty
						widget = {
							layoutpolicy_vertical = expanding
							size = { 45 40 }

							coa_house_small = {
								datacontext = "[Character.GetHouse]"
								parentanchor = center
								scale = 0.7
							}
						}

						# Traits
						vbox = {
							layoutpolicy_vertical = expanding
							margin = { 10 0 }

							hbox = {
								layoutpolicy_horizontal = expanding

								fixedgridbox = {
									name = "traits_grid_four"
									datamodel = "[CharacterListItem.GetTraits]"
									flipdirection = yes
									addcolumn = 30
									addrow = 28
									visible = "[Not( IsDataModelEmpty( CharacterListItem.GetTitleItems ) )]"

									block "gridbox_items"   ### for characterview
									{
										datamodel_wrap = 4
										maxverticalslots = 2
									}

									item = {
										icon_trait = {
											visible = "[Trait.IsValid]"

											blockoverride "icon_size"
											{
												size = { 30 30 }
											}

											blockoverride "tooltip_placement"
											{
												using = tooltip_se
											}

											blockoverride "glow_radius"
											{
												glow_radius = 3
											}
										}
									}
								}
								fixedgridbox = {
									name = "traits_grid_five"
									datamodel = "[CharacterListItem.GetTraits]"
									flipdirection = yes
									addcolumn = 30
									addrow = 28
									visible = "[IsDataModelEmpty( CharacterListItem.GetTitleItems )]"

									block "gridbox_items"   ### for characterview
									{
										datamodel_wrap = 5
										maxverticalslots = 2
									}

									item = {
										icon_trait = {
											visible = "[Trait.IsValid]"

											blockoverride "icon_size"
											{
												size = { 30 30 }
											}

											blockoverride "tooltip_placement"
											{
												using = tooltip_se
											}

											blockoverride "glow_radius"
											{
												glow_radius = 3
											}
										}
									}
								}

								expand = {}
							}
						}

						expand = {}

						divider_light = {
							layoutpolicy_vertical = expanding
							alpha = 0.5
						}

						hbox = {
							margin = { 3 0 }

							widget_list_claims = {
								visible = "[Not( IsDataModelEmpty( CharacterListItem.GetTitleItems ) )]"
							}
						}

						divider_light = {
							visible = "[Not( IsDataModelEmpty( CharacterListItem.GetTitleItems ) )]"
							layoutpolicy_vertical = expanding
							alpha = 0.5
						}

						hbox = {
							margin_right = 5

							button_religion_icon = {
								datacontext = "[Character.GetFaith]"
								size = { 40 40 }
							}

							vbox = {
								datacontext = "[Character.GetCulture]"

								tooltipwidget = {
									culture_tooltip = {}
								}
								using = tooltip_se

								icon = {
									name = "culture"
									texture = "gfx/interface/icons/icon_culture.dds"
									size = { 24 24 }
								}

								text_single = {
									layoutpolicy_horizontal = expanding
									min_width = 60
									align = center|nobaseline
									autoresize = no
									text = "CULTURE_LISTS_WINDOW"
								}
							}
						}
					}
				}
			}
		}
	}

	type widget_vassal_list_item = widget {
		datacontext = "[CharacterListItem.GetCharacter]"

		vbox = {
			margin = { 5 0 }

			background = {
				using = Background_Area_With_Header
			}

			hbox = {
				layoutpolicy_horizontal = expanding
				margin = { 5 5 }

				text_single = {
					layoutpolicy_horizontal = expanding
					text = "[Character.GetUINameNoTooltip]"
					using = Font_Size_Medium
					autoresize = no
					fontsize_min = 13
					align = nobaseline
					max_width = 340
				}

				expand = {}

				hbox_skills_grid = {}
			}

			hbox = {
				layoutpolicy_horizontal = expanding
				spacing = 5

				portrait_head_small = {}

				vbox = {
					layoutpolicy_horizontal = expanding
					layoutpolicy_vertical = expanding
					margin_right = 5

					hbox = {
						layoutpolicy_horizontal = expanding

						vbox = {
							layoutpolicy_horizontal = expanding

							margin_top = 3

							hbox = {
								layoutpolicy_horizontal = expanding

								text_single = {
									name = "character_relation"
									visible = "[Or(Character.GetLiege.IsLocalPlayer, Character.GetSuzerain.IsLocalPlayer)]"
									layoutpolicy_horizontal = expanding
									text = "[Character.GetRelationToString(GetPlayer)]"
									tooltip = "EXTENDED_RELATIONS_TOOLTIP"
									default_format = "#low"
									autoresize = no
									fontsize_min = 13
									align = nobaseline
									max_width = 420
								}

								expand = {}
							}

							hbox = {
								layoutpolicy_horizontal = expanding
								spacing = 5

								text_single = {
									visible = "[And( Character.HasOverlord, And( Character.UsesObedience, Character.IsObedientTo( Character.GetOverlord ) ) )]"

									text = "MY_REALM_WINDOW_OBEDIENT"
									align = nobaseline
									max_width = 170

									tooltipwidget = widget_obedience_tooltip
								}

								text_single = {
									visible = "[And( Character.HasOverlord, And( Character.UsesObedience, Not( Character.IsObedientTo( Character.GetOverlord ) ) ) )]"

									text = "MY_REALM_WINDOW_DISOBEDIENT"
									align = nobaseline
									max_width = 170

									tooltipwidget = widget_obedience_tooltip
								}

								divider_light = {
									visible = "[Character.UsesObedience]"
									layoutpolicy_vertical = expanding
								}

								vassal_stance_icon = {
									name = "vassal_stance"
									size = { 30 30 }
								}

								divider_light = {
									visible = "[And( Character.IsVassalOf( GetPlayer ), Not( Character.IsPlayer ) )]"
									layoutpolicy_vertical = expanding
								}

								vassal_expected_legitimacy_icon = {
									name = "legitimacy_expectation"
									size = { 30 30 }
								}

								block "realm_size_powerful_status" {
									flowcontainer = {
										spacing = 10

										text_single = {
											visible = "[NotEqualTo_int32(Character.GetPrimaryTitle.GetTierFrame, '(int32)2')]" #nonbaron
											layoutpolicy_horizontal = expanding

											text = "REALM_WINDOW_SIZE"
											align = nobaseline
											max_width = 150

											tooltip = "REALM_WINDOW_SIZE_TT"
										}
									}
								}

								expand = {}
							}

							block "vassal_buttons" {
								hbox = {
									visible = "[Character.IsPlayerInteractionShown('give_vassal_directive_interaction')]"
									layoutpolicy_horizontal = expanding
									spacing = 5

									button_round = {
										size = { 30 30 }

										enabled = "[Character.IsPlayerInteractionValid('give_vassal_directive_interaction')]"
										onclick = "[Character.OpenPlayerInteraction('give_vassal_directive_interaction')]"

										tooltip = "[Character.GetPlayerInteractionTooltip('give_vassal_directive_interaction')]"
										using = tooltip_se

										button_give_directive = {
											alwaystransparent = yes
											parentanchor = center
											size = { 24 24 }
										}
									}

									widget = {
										size = { 30 30 }

										text_single = {
											parentanchor = vcenter

											text = "[Character.Custom('vassal_directive_icon')]"
											align = nobaseline

											tooltip = "[Character.Custom('vassal_directive_text')]"
											using = tooltip_se
										}
									}

									divider_light = {
										visible = "[Character.IsPowerfulVassal]"
										layoutpolicy_vertical = expanding
									}

									text_single = {
										visible = "[Character.IsPowerfulVassal]"
										layoutpolicy_horizontal = expanding

										text = "MY_REALM_WINDOW_POWERFUL_VASSAL"
										align = nobaseline
										max_width = 200
									}

									expand = {}
								}
							}
						}

						block "own_vassal" {
							vbox = {
								visible = "[Character.GetLiege.IsLocalPlayer]"
								layoutpolicy_vertical = expanding
								margin_left = 10

								hbox = {
									coa_title_tiny_crown = {
										name = "allegiance_flag"
										datacontext = "[SubjectContract.GetTitleAllegiance]"
										visible = "[Title.IsValid]"

										tooltip = "MRW_TITLE_ALLEGIANCE"
										blockoverride "coa_tooltip" {}
									}
								}
							}
						}
					}

					hbox = {
						visible = "[Character.HasSuzerain]"
						layoutpolicy_horizontal = expanding
						datacontext = "[Character.GetSubjectContract]"
						spacing = 5

						tooltip = "MY_REALM_WINDOW_CEASE_PAYING_TRIBUTE_CHANCE_TT"

						icon_flat_standard = {
							size = { 30 30 }
							texture = "gfx/interface/icons/flat_icons/cease_paying_tributary.dds"
						}

						text_single = {
							layoutpolicy_horizontal = expanding
							text = "MY_REALM_WINDOW_CEASE_PAYING_TRIBUTE_CHANCE"
							align = left|nobaseline
							max_width = 300
						}

						expand = {}

						block "release_tributary_button" {
							button_round = {
								visible = "[Character.IsPlayerInteractionShown('release_tributary_interaction')]"
								enabled = "[Character.IsPlayerInteractionValid('release_tributary_interaction')]"
								onclick = "[Character.OpenPlayerInteraction('release_tributary_interaction')]"
								tooltip = "[Character.GetPlayerInteractionTooltip('release_tributary_interaction')]"

								button_icon = {
									alwaystransparent = yes
									parentanchor = center
									position = { 1 1 }
									size = { 28 28 }
									texture = "gfx/interface/icons/flat_icons/release_tributary.dds"
								}
							}
						}
					}

					expand = {}
				}
			}

			block "own_vassal"
			{
				vbox_vassal_item_footer = {
					datacontext = "[SubjectContract.GetContractGroup]"
				}
			}

			expand = {}
		}
	}

	type hbox_vassal_contract_button = hbox {
		spacing = 5

		widget = {
			visible = "[SubjectContractGroup.IsType('feudal_vassal')]"
			size = { 40 40 }

			button_round = {
				parentanchor = center

				enabled = "[Character.IsPlayerInteractionValid('liege_modify_vassal_contract_interaction')]"
				onclick = "[Character.OpenPlayerInteraction('liege_modify_vassal_contract_interaction')]"

				tooltip = "[Character.GetPlayerInteractionTooltip('liege_modify_vassal_contract_interaction')]"

				block "feudal_contract_button_round" {}

				button_feudal_contract = {
					alwaystransparent = yes
					parentanchor = center
				}
			}

			icon_vassal_contract_warning_blocked = {}
			icon_vassal_contract_warning_default = {}
		}

		widget = {
			visible = "[SubjectContractGroup.IsType('clan_vassal')]"
			size = { 40 40 }

			button_round = {
				parentanchor = center
				onclick = "[ToggleGameViewData( 'tax_slot_assign_vassal', Character.Self )]"

				tooltip = "TAX_SLOT_REALM_VIEW_OPEN_ASSIGN_VIEW"

				icon = {
					parentanchor = center
					size = { 30 30 }

					texture = "gfx/interface/skinned/hud_maintab/maintab_tax_jurisdictions.dds"
				}
			}

			warning_icon = {
				visible = "[Not( Character.IsAssignedAsTaxpayer )]"
				parentanchor = bottom|right
				size = { 20 20 }

				tooltip = "TAX_SLOT_REALM_VIEW_OPEN_ASSIGN_VIEW_UNASSIGNED"
			}
		}

		widget = {
			visible = "[SubjectContractGroup.IsType('admin_vassal')]"
			size = { 40 40 }

			button_round = {
				parentanchor = center

				enabled = "[Character.IsPlayerInteractionValid('admin_liege_modify_vassal_contract_interaction')]"
				onclick = "[Character.OpenPlayerInteraction('admin_liege_modify_vassal_contract_interaction')]"

				tooltip = "[Character.GetPlayerInteractionTooltip('admin_liege_modify_vassal_contract_interaction')]"

				block "admin_contract_button_round" {}

				button_add_laws = {
					alwaystransparent = yes
					parentanchor = center
				}
			}

			icon_vassal_contract_warning_blocked = {}
			icon_vassal_contract_warning_default = {}
		}

		widget = {
			visible = "[SubjectContractGroup.IsType('nomad_vassal')]"
			size = { 40 40 }

			button_round = {
				parentanchor = center

				enabled = "[Character.IsPlayerInteractionValid('nomad_liege_modify_vassal_contract_interaction')]"
				onclick = "[Character.OpenPlayerInteraction('nomad_liege_modify_vassal_contract_interaction')]"

				tooltip = "[Character.GetPlayerInteractionTooltip('nomad_liege_modify_vassal_contract_interaction')]"

				block "nomad_contract_button_round" {}

				button_add_laws = {
					alwaystransparent = yes
					parentanchor = center
				}
			}

			icon_vassal_contract_warning_blocked = {}
			icon_vassal_contract_warning_default = {}
		}

		widget = {
			visible = "[Or( SubjectContractGroup.IsType('tributary_nomadic'), SubjectContractGroup.IsType('tributary_settled') )]"
			size = { 40 40 }

			button_round = {
				parentanchor = center

				enabled = "[Character.IsPlayerInteractionValid('suzerain_modify_tributary_contract_interaction')]"
				onclick = "[Character.OpenPlayerInteraction('suzerain_modify_tributary_contract_interaction')]"

				tooltip = "[Character.GetPlayerInteractionTooltip('suzerain_modify_tributary_contract_interaction')]"

				block "nomad_tributary_contract_button_round" {}

				button_add_laws = {
					alwaystransparent = yes
					parentanchor = center
				}
			}

			icon_vassal_contract_warning_blocked = {}
			icon_vassal_contract_warning_default = {}
		}

		text_single = {
			text = "[SubjectContractGroup.GetName]"
			align = nobaseline
			max_width = 130
		}
	}

	type hbox_vassal_taxes = hbox {
		### FEUDAL ARE SPECIAL
		hbox = {
			visible = "[SubjectContractGroup.IsType( 'feudal_vassal' )]"
			spacing = 15

			### FEUDAL GOLD
			hbox = {
				spacing = 5

				text_single = { # Display the Tax Level
					layoutpolicy_horizontal = expanding

					text = "MY_REALM_WINDOW_VASSAL_FEUDAL_TAX"
					align = nobaseline
					default_format = "#low"
					max_width = 100

					margin_bottom = 2
				}

				text_single = {
					text = "[MyRealmWindowVassalItem.GetCachedTax|=1]"
					align = nobaseline
					max_width = 50
				}

				tooltipwidget = {
					my_realm_window_contribution_tooltip = {
						block "tax_breakdown"
						{
							datacontext = "[MyRealmWindowVassalItem.GetTaxBreakdown]"

						}
						blockoverride "levy_info_visible" { visible = no }
						blockoverride "contribution_tooltip_header"
						{
							text = "MRW_TT_TAXES_TO_ME"
						}

						blockoverride "levy_info"
						{
							text_single = {
								multiline = yes
								maximumsize = { 250 -1 }
								text = "[MyRealmWindowVassalItem.GetTaxTooltip]"
							}
						}
					}
				}
				using = tooltip_sw
			}

			### FEUDAL LEVIES
			hbox = {
				visible = "[GreaterThan_CFixedPoint( MyRealmWindowVassalItem.GetContract.GetLevyRatioForLiege, '(CFixedPoint)0' )]"
				spacing = 5

				text_single = { # Display the Levy Level
					layoutpolicy_horizontal = expanding

					text = "MY_REALM_WINDOW_VASSAL_FEUDAL_LEVIES"
					align = nobaseline
					default_format = "#low"
					max_width = 100

					margin_bottom = 2
				}

				text_single = {
					text = "[MyRealmWindowVassalItem.GetCachedLeviesFormatted]"
					align = nobaseline
					max_width = 50
				}

				tooltipwidget = {
					my_realm_window_contribution_tooltip = {
						block "levy_breakdown"
						{
							datacontext = "[MyRealmWindowVassalItem.GetLeviesBreakdown]"
						}
						blockoverride "tax_info_visible" { visible = no }
						blockoverride "contribution_tooltip_header"
						{
							text = "MRW_TT_LEVIES_TO_ME"
						}
						blockoverride "tax_info"
						{
							text_single = {
								multiline = yes
								maximumsize = { 250 -1 }
								text = "[MyRealmWindowVassalItem.GetLevyTooltip]"
							}
						}
					}
				}
				using = tooltip_sw
			}
		}

		### THE REST (NON-FEUDAL)
		hbox = {
			visible = "[Not( SubjectContractGroup.IsType( 'feudal_vassal' ) )]"
			spacing = 15

			### VASSAL GOLD
			hbox = {
				icon = {
					size = { 30 30 }
					texture = "gfx/interface/icons/icon_gold.dds"
				}

				text_single = {
					text = "[MyRealmWindowVassalItem.GetCachedTax|=1]"
					align = nobaseline
				}

				tooltipwidget = {
					my_realm_window_contribution_tooltip = {
						block "tax_breakdown"
						{
							datacontext = "[MyRealmWindowVassalItem.GetTaxBreakdown]"

						}

						blockoverride "levy_info_visible"
						{
							visible = no
						}

						blockoverride "contribution_tooltip_header"
						{
							text = "MRW_TT_TAXES_TO_ME"
						}

						blockoverride "levy_info"
						{
							text_single = {
								multiline = yes
								maximumsize = { 250 -1 }
								text = "[MyRealmWindowVassalItem.GetTaxTooltip]"
							}
						}
					}
				}
				using = tooltip_sw
			}

			### VASSAL LEVIES
			hbox = {
				visible = "[GreaterThan_CFixedPoint( MyRealmWindowVassalItem.GetContract.GetLevyRatioForLiege, '(CFixedPoint)0' )]"

				icon = {
					size = { 25 25 }
					texture = "gfx/interface/icons/icon_soldier.dds"
				}

				text_single = {
					text = "[MyRealmWindowVassalItem.GetCachedLeviesFormatted]"
					align = nobaseline
				}

				tooltipwidget = {
					my_realm_window_contribution_tooltip = {
						block "levy_breakdown"
						{
							datacontext = "[MyRealmWindowVassalItem.GetLeviesBreakdown]"
						}
						blockoverride "tax_info_visible" { visible = no }
						blockoverride "contribution_tooltip_header"
						{
							text = "MRW_TT_LEVIES_TO_ME"
						}
						blockoverride "tax_info"
						{
							text_single = {
								multiline = yes
								maximumsize = { 250 -1 }
								text = "[MyRealmWindowVassalItem.GetLevyTooltip]"
							}
						}
					}
				}
				using = tooltip_sw
			}

			### VASSAL HERD
			hbox = {
				visible = "[GreaterThan_CFixedPoint( MyRealmWindowVassalItem.GetContract.GetHerdRatioForLiege, '(CFixedPoint)0' )]"

				icon = {
					size = { 30 30 }
					texture = "gfx/interface/icons/icon_herd.dds"
				}

				text_single = {
					text = "[MyRealmWindowVassalItem.GetCachedHerd|=1]"
					align = nobaseline
				}

				tooltipwidget = {
					my_realm_window_contribution_tooltip = {
						block "tax_breakdown"
						{
							datacontext = "[MyRealmWindowVassalItem.GetHerdBreakdown]"

						}
						blockoverride "herd_info_visible" { visible = no }
						blockoverride "contribution_tooltip_header"
						{
							text = "MRW_TT_HERD_TO_ME"
						}

						blockoverride "herd_info"
						{
							text_single = {
								multiline = yes
								maximumsize = { 250 -1 }
								text = "[MyRealmWindowVassalItem.GetHerdTooltip]"
							}
						}
					}
				}
				using = tooltip_sw
			}
		}
	}

	type hbox_vassal_list_icons = hbox {
		spacing = 5

		icon = {
			name = "hook"
			visible = "[Character.PlayerHasHooksOrHookableSecrets]"
			size = { 25 25 }
			framesize = { 40 40 }
			texture = "gfx/interface/icons/portraits/hook_secret.dds"

			frame = "[Character.GetHookOrHookableSecretsFrame]"
			tooltip = "[Character.HookTooltip]"
		}

		icon = {
			name = "icon_non_dejure"
			visible = "[Not( SubjectContract.IsRightfulLiege )]"
			size = { 30 30 }
			texture = "gfx/interface/icons/levy_tax_reduction.dds"

			using = tooltip_ws
			tooltip = "MRW_TT_NOT_RIGHTFUL_LIEGE"
		}
	}

	type vbox_vassal_item_footer = vbox {
		layoutpolicy_horizontal = expanding

		margin_left = 5
		margin_right = 10
		margin_top = 5
		margin_bottom = 5
		spacing = 10

		hbox = {
			name = "subjects_contract_button"
			layoutpolicy_horizontal = expanding
			spacing = 10

			background = {
				using = Background_Area_Solid
				margin = { 10 5 }
				alpha = 0.75
			}

			icon = {
				visible = "[Not( SubjectContract.UsesObligationLevels )]"
				size = { 42 42 }
				texture = "gfx/interface/icons/symbols/icon_cross.dds"
				tooltip = MY_REALM_WINDOW_NO_FEUDAL_CONTRACT_TT
				enabled = no
			}

			hbox_vassal_contract_button = {}

			hbox_vassal_list_icons = {}

			expand = {}

			hbox_vassal_taxes = {}
		}

		hbox = {
			layoutpolicy_horizontal = expanding
			visible = "[SubjectContractGroup.IsType('clan_government')]"

			background = {
				using = Background_Area_Dark
				margin = { 10 5 }
				alpha = 0.75
			}

			spacer = {
				size = { 10 0 }
			}

			hbox = {
				spacing = 20

				text_single = {
					text = "[SubjectContractGroup.GetName]"
					align = nobaseline
				}

				button_standard = {
					size = { 300 36 }

					onclick = "[ToggleGameViewData( 'tax_slot_assign_vassal', Character.Self )]"

					background = {
						#TODO:this should only be visible if this character is not being taxed
						visible = no
						texture = "gfx/interface/colors/red.dds"
						alpha = 0.3

						modify_texture = {
							texture = "gfx/interface/component_masks/mask_dlc.dds"
							blend_mode = alphaMultiply
						}
					}

					text_single = {
						parentanchor = vcenter|left
						margin_left = 10
						max_width = 250
						align = nobaseline

						visible = "[Character.IsAssignedAsTaxpayer]"

						text = "TAX_SLOT_REALM_VIEW_OPEN_ASSIGN_VIEW"
					}

					text_single = {
						parentanchor = vcenter|left
						margin_left = 10
						max_width = 250
						align = nobaseline

						visible = "[Not( Character.IsAssignedAsTaxpayer )]"

						text = "TAX_SLOT_REALM_VIEW_OPEN_ASSIGN_VIEW_UNASSIGNED"
					}

					icon = {
						parentanchor = vcenter|right
						size = { 30 30 }
						position = { -5 0 }
						texture = "gfx/interface/icons/flat_icons/replace.dds"
						using = Master_Button_Modify_Texture
					}
				}
			}

			expand = {}
		}
	}

	type hbox_traits_list = hbox #Scrollboxes for bigger trait lists
	{
		layoutpolicy_horizontal = expanding

		widget = {
			layoutpolicy_horizontal = expanding
			size = { 0 55 }

			hbox = {
				name = "3_personality_traits"
				visible = "[LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetPersonalityTraits), '(int32)3')]"

				fixedgridbox = {
					name = "personality_traits"
					datamodel = "[TraitArrays.GetPersonalityTraits]"
					flipdirection = yes
					addcolumn = 54
					addrow = 55
					maxhorizontalslots = 3

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 55 55 }
							}
						}
					}
				}

				hbox = {
					visible = "[Not(IsDataModelEmpty( TraitArrays.GetTraits ))]"
					layoutpolicy_vertical = expanding
					margin = { 5 10 }

					divider_light = {
						layoutpolicy_vertical = expanding
					}
				}

				fixedgridbox = {
					name = "traits_big"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)5')]"
					flipdirection = yes
					addcolumn = 54
					addrow = 55
					maxhorizontalslots = 5
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 55 55 }
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_medium"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)5'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)7'))]"
					flipdirection = yes
					addcolumn = 39
					addrow = 40
					maxhorizontalslots = 7
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 40 40 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 4
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_small"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)7'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)10'))]"
					flipdirection = yes
					addcolumn = 28
					addrow = 29
					maxhorizontalslots = 10
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 29 29 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 3
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_tiny"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)10'),LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)22'))]"
					flipdirection = yes
					addcolumn = 24
					addrow = 25
					maxhorizontalslots = 11
					datamodel_wrap = 11
					maxverticalslots = 2

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 25 25 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 2
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_mini"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)22'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)51'))]"
					flipdirection = yes
					addcolumn = 17
					addrow = 18
					maxhorizontalslots = 17
					datamodel_wrap = 17
					maxverticalslots = 3

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 20 20 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 2
							}
						}
					}
				}

				scrollarea = {
					maximumsize = { -1 51 }
					min_width = 285
					autoresizescrollarea = yes
					scrollbarpolicy_horizontal = always_off
					visible = "[GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)51')]"

					scrollwidget = {
						fixedgridbox = {
							name = "traits_scrollable"
							datamodel = "[TraitArrays.GetTraits]"
							flipdirection = yes
							addcolumn = 17
							addrow = 20
							maxhorizontalslots = 16
							datamodel_wrap = 16

							item = {
								icon_trait = {
									blockoverride "icon_size"
									{
										size = { 20 20 }
									}

									blockoverride "glow_radius"
									{
										glow_radius = 2
									}
								}
							}
						}
					}

					scrollbar_vertical = {
						using = Scrollbar_Vertical
					}
				}

				expand = {}
			}

			hbox = {
				name = "4_personality_traits"
				visible = "[GreaterThan_int32(GetDataModelSize(TraitArrays.GetPersonalityTraits), '(int32)3')]"

				fixedgridbox = {
					name = "personality_traits"
					datamodel = "[TraitArrays.GetPersonalityTraits]"
					flipdirection = yes
					addcolumn = 54
					addrow = 55
					maxhorizontalslots = 4

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 55 55 }
							}
						}
					}
				}

				hbox = {
					visible = "[Not(IsDataModelEmpty( TraitArrays.GetTraits ))]"
					layoutpolicy_vertical = expanding
					margin = { 5 10 }

					divider_light = {
						layoutpolicy_vertical = expanding
					}
				}

				fixedgridbox = {
					name = "traits_big"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)4')]"
					flipdirection = yes
					addcolumn = 54
					addrow = 55
					maxhorizontalslots = 5
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 55 55 }
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_medium"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)4'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)6'))]"
					flipdirection = yes
					addcolumn = 39
					addrow = 40
					maxhorizontalslots = 7
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 40 40 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 4
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_small"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)6'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)8'))]"
					flipdirection = yes
					addcolumn = 28
					addrow = 29
					maxhorizontalslots = 10
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 29 29 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 3
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_tiny"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)8'),LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)18'))]"
					flipdirection = yes
					addcolumn = 24
					addrow = 25
					maxhorizontalslots = 9
					datamodel_wrap = 9
					maxverticalslots = 2

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 25 25 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 2
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_mini"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)18'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)42'))]"
					flipdirection = yes
					addcolumn = 16
					addrow = 18
					maxhorizontalslots = 14
					datamodel_wrap = 14
					maxverticalslots = 3

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 20 20 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 2
							}
						}
					}
				}

				scrollarea = {
					maximumsize = { -1 51 }
					min_width = 235
					autoresizescrollarea = yes
					scrollbarpolicy_horizontal = always_off
					visible = "[GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)42')]"

					scrollwidget = {
						fixedgridbox = {
							name = "traits_scrollable"
							datamodel = "[TraitArrays.GetTraits]"
							flipdirection = yes
							addcolumn = 17
							addrow = 20
							maxhorizontalslots = 13
							datamodel_wrap = 13

							item = {
								icon_trait = {
									blockoverride "icon_size"
									{
										size = { 20 20 }
									}

									blockoverride "glow_radius"
									{
										glow_radius = 2
									}
								}
							}
						}
					}

					scrollbar_vertical = {
						using = Scrollbar_Vertical
					}
				}

				expand = {}
			}
		}
		expand = {}
	}

	type hbox_traits_list_small = hbox
	{
		layoutpolicy_horizontal = expanding

		widget = {
			layoutpolicy_horizontal = expanding
			size = { 0 55 }

			hbox = {
				name = "3_personality_traits"
				visible = "[LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetPersonalityTraits), '(int32)3')]"

				fixedgridbox = {
					name = "personality_traits"
					datamodel = "[TraitArrays.GetPersonalityTraits]"
					flipdirection = yes
					addcolumn = 54
					addrow = 55
					maxhorizontalslots = 3

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 55 55 }
							}
						}
					}
				}

				hbox = {
					visible = "[Not(IsDataModelEmpty( TraitArrays.GetTraits ))]"
					layoutpolicy_vertical = expanding
					margin = { 5 10 }

					divider_light = {
						layoutpolicy_vertical = expanding
					}
				}

				fixedgridbox = {
					name = "traits_big"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)4')]"
					flipdirection = yes
					addcolumn = 39
					addrow = 40
					maxhorizontalslots = 4
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 40 40 }
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_small"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)4'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)6'))]"
					flipdirection = yes
					addcolumn = 28
					addrow = 29
					maxhorizontalslots = 6
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 29 29 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 3
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_tiny"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)6')]"
					flipdirection = yes
					addcolumn = 14
					addrow = 14
					maxhorizontalslots = 20
					datamodel_wrap = 20
					maxverticalslots = 4

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 25 25 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 2
							}
						}
					}
				}

				expand = {}
			}

			hbox = {
				name = "4_personality_traits"
				visible = "[GreaterThan_int32(GetDataModelSize(TraitArrays.GetPersonalityTraits), '(int32)3')]"

				fixedgridbox = {
					name = "personality_traits"
					datamodel = "[TraitArrays.GetPersonalityTraits]"
					flipdirection = yes
					addcolumn = 54
					addrow = 55
					maxhorizontalslots = 4

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 55 55 }
							}
						}
					}
				}

				hbox = {
					visible = "[Not(IsDataModelEmpty( TraitArrays.GetTraits ))]"
					layoutpolicy_vertical = expanding
					margin = { 5 10 }

					divider_light = {
						layoutpolicy_vertical = expanding
					}
				}

				fixedgridbox = {
					name = "traits_big"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)4')]"
					flipdirection = yes
					addcolumn = 39
					addrow = 40
					maxhorizontalslots = 4
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 40 40 }
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_small"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[And(GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)4'), LessThanOrEqualTo_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)6'))]"
					flipdirection = yes
					addcolumn = 28
					addrow = 29
					maxhorizontalslots = 6
					maxverticalslots = 1

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 29 29 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 3
							}
						}
					}
				}

				fixedgridbox = {
					name = "traits_tiny"
					datamodel = "[TraitArrays.GetTraits]"
					visible = "[GreaterThan_int32(GetDataModelSize(TraitArrays.GetTraits), '(int32)6')]"
					flipdirection = yes
					addcolumn = 14
					addrow = 14
					maxhorizontalslots = 20
					datamodel_wrap = 20
					maxverticalslots = 4

					item = {
						icon_trait = {
							blockoverride "icon_size"
							{
								size = { 25 25 }
							}

							blockoverride "glow_radius"
							{
								glow_radius = 2
							}
						}
					}
				}

				expand = {}
			}
		}
		expand = {}
	}
}

types Vassals
{
	type icon_vassal_contract_warning_blocked = alert_icon {
		visible = "[SubjectContract.IsBlockedFromModification]"
		parentanchor = bottom|right
		size = { 20 20 }

		tooltip = "VASSAL_CONTRACT_IS_BLOCKED"
		using = tooltip_sw
	}

	type icon_vassal_contract_warning_default = alert_icon {
		visible = "[Not( SubjectContract.IsContractDefault )]"
		parentanchor = bottom|right
		size = { 20 20 }

		tooltip = "VASSAL_CONTRACT_NOT_DEFAULT"
		using = tooltip_sw
	}

	type vassal_stance_icon = icon {
		datacontext = "[Character.GetVassalStance]"
		visible = "[And( Character.IsVassalOf( GetPlayer ), Not( Character.IsPlayer ) )]"

		texture = "[VassalStance.GetIcon]"
		tooltipwidget = {
			using = vassal_stance_tooltip
		}
	}

	type vassal_expected_legitimacy_icon = icon {
		visible = "[And( Character.IsVassalOf( GetPlayer ), Not( Character.IsPlayer ) )]"

		texture = "[GetPlayer.GetLegitimacyType.GetLevelsIcon]"
		framesize = { 70 70 }
		frame = "[IntToFrameIndex( Character.GetLegitimacyExpectationsOfLiege )]"

		tooltip = "VASSAL_EXPECTED_LEGITIMACY_TT"
	}
}

####################################
########### SCROLL AREA ############
####################################

## Generic scrollarea. Remember that "scrollbox_content" can only contain one child without siblings.
types Scrollbar
{
	type scrollbox = scrollarea {
		size = { 100 100 }

		scrollbarpolicy_horizontal = always_off

		block "scrollbox_scrollbar_vertical"
		{
			scrollbar_vertical = {
				using = Scrollbar_Vertical
			}
		}

		block "scrollbox_background"
		{
			background = {
				using = Background_Area
			}
		}

		scrollwidget = {
			block "scrollbox_replace_vbox"
			{
				vbox = {
					block "scrollbox_margins"
					{
						using = Scrollbox_Margins
					}

					block "scrollbox_content"
					{
						debug_square = {}
					}

					text_single = {
						layoutpolicy_vertical = expanding
						default_format = "#weak"

						block "scrollbox_empty"
						{
							visible = no
						}
					}

					block "scrollbox_expand"
					{
						expand = {
							layoutpolicy_vertical = growing
						}
					}
				}
			}
		}

		block "scrollbox_background_fade" {
			icon = {
				name = "scrollbar_fade"
				texture = "gfx/interface/scrollbars/scrollbar_fade.dds"
				size = { 100% 100% }
				alwaystransparent = yes

				spriteType = Corneredtiled
				spriteborder = { 0 30 }
			}
		}
	}
}

## Vertical scrollbar
template Scrollbar_Vertical
{
	scrollbar = {
		name = "vertical_scrollbar"
		size = { 12 12 }
		wheelstep = 60
		direction = vertical

		track = {
			button = {
				size = { 12 12 }
				gfxtype = buttongfx

				texture = "gfx/interface/scrollbars/scrollbar_track_vertical.dds"
				spriteType = Corneredtiled
				spriteborder = { 0 3 }
				effectname = "NoHighlight"
			}
		}

		slider = {
			button = {
				gfxtype = framedbuttongfx
				effectname = "NoHighlight"

				texture = "gfx/interface/scrollbars/scrollbar_slider.dds"
				spriteType = Corneredtiled
				spriteborder = { 0 3 }
				framesize = { 12 40 }
				minimumsize = { -1 40 }

				upframe = 1
				overframe = 2
				downframe = 2

				oversound = "event:/SFX/UI/Generic/sfx_ui_generic_icon_pointer_over"

				state = {
					name = _mouse_press
					start_sound = {
						soundeffect = "event:/SFX/UI/Generic/sfx_ui_generic_icon_select"
					}
				}

				state = {
					name = _mouse_release
					start_sound = {
						soundeffect = "event:/SFX/UI/Generic/sfx_ui_generic_icon_select"
					}
				}
			}
		}

		dec_button = {
			button = {
			}
		}

		inc_button = {
			button = {
			}
		}
	}
}

## Horizontal scrollbar
template Scrollbar_Horizontal
{
	scrollbar = {
		name = "horizontal_scrollbar"
		size = { 12 12 }
		wheelstep = 60
		direction = horizontal

		track = {
			button = {
				size = { 12 12 }
				gfxtype = buttongfx

				texture = "gfx/interface/scrollbars/scrollbar_track_horizontal.dds"
				spriteType = Corneredtiled
				spriteborder = { 3 0 }
				effectname = "NoHighlight"
				intersectionmask = yes
			}
		}

		slider = {
			button = {
				gfxtype = framedbuttongfx
				effectname = "NoHighlight"

				texture = "gfx/interface/scrollbars/scrollbar_slider_horizontal.dds"
				spriteType = Corneredtiled
				spriteborder = { 3 0 }
				framesize = { 40 12 }
				minimumsize = { 15 -1 }

				upframe = 1
				overframe = 2
				downframe = 2

				intersectionmask = yes
				oversound = "event:/SFX/UI/Generic/sfx_ui_generic_icon_pointer_over"

				state = {
					name = _mouse_press
					start_sound = {
						soundeffect = "event:/SFX/UI/Generic/sfx_ui_generic_icon_select"
					}
				}

				state = {
					name = _mouse_release
					start_sound = {
						soundeffect = "event:/SFX/UI/Generic/sfx_ui_generic_icon_select"
					}
				}
			}
		}

		dec_button = {
			button = {
			}
		}

		inc_button = {
			button = {
			}
		}
	}
}

types DataModelViewTypes
{
	type data_model_view_options_hbox = hbox
	{
		spacing = 5

		button_standard = {
			name = "filters"
			size = { 25 25 }

			down = "[DataModelView.AreFiltersShown]"
			onclick = "[DataModelView.ToggleFiltersShown]"

			tooltip = "TOGGLE_FILTERS"
			using = tooltip_nw

			button_search = {
				alwaystransparent = yes
				parentanchor = center
				size = { 20 20 }
			}
		}

		divider_light = {
			size = { 3 20 }
		}

		text_single = {
			text = "SORT_BY"
			align = nobaseline
		}

		dropdown_menu_standard = {
			name = "sort_options"

			blockoverride "dropdown_properties"
			{
				datamodel = "[DataModelView.GetSorters]"
				selectedindex = "[DataModelView.GetActiveSortIndex]"
				onselectionchanged = "[DataModelView.SortBy]"
			}

			blockoverride "dropdown_active_item_properties"
			{
				text = "[DataModelSorter.GetName]"
			}

			blockoverride "dropdown_item_properties"
			{
				text = "[DataModelSorter.GetName]"
			}
		}

		button_standard = {
			name = "sort_order"
			size = { 25 25 }

			using = tooltip_ne
			onclick = "[DataModelView.ToggleSortOrder]"

			button_icon = {
				size = { 25 25 }
				texture = "gfx/interface/icons/flat_icons/sort_icon.dds"
				framesize = { 66 66 }
				frame = "[BoolTo1And2( DataModelView.GetSortOrder )]"

				alwaystransparent = yes

				blockoverride "button_frames"
				{
					effectname = "NoHighlight"
				}
			}
		}
	}

	type data_model_view_toggle_filter = button_checkbox_label
	{
		layoutpolicy_horizontal = expanding

		onclick = "[DataModelView.ToggleFilter( PdxGuiWidget.GetIndexInDataModel )]"

		block "toggle_onclick"
		{
		}

		blockoverride "checkbox"
		{
			checked = "[DataModelFilter.IsEnabled]"
		}

		blockoverride "text"
		{
			text = "[DataModelFilter.GetName]"
		}
	}

	type data_model_view_dropdown_filter = hbox
	{
		layoutpolicy_horizontal = expanding

		spacing = 5

		text_single = {
			layoutpolicy_horizontal = expanding
			text = "[DataModelGroupedFilter.GetGroupName]"
			default_format = "#medium"
			align = nobaseline
			autoresize = no
		}

		dropdown_menu_standard = {
			blockoverride "dropdown_properties"
			{
				datamodel = "[DataModelGroupedFilter.GetFilters]"
				selectedindex = "[DataModelGroupedFilter.GetActiveFilter]"
				onselectionchanged = "[DataModelView.SelectGroupFilter( PdxGuiWidget.GetIndexInDataModel )]"

				block "dropdown_onselect"
				{
				}
			}

			blockoverride "dropdown_active_item_properties"
			{
				text = "[CString.GetString]"
			}

			blockoverride "dropdown_item_properties"
			{
				text = "[CString.GetString]"
			}
		}
	}

	type data_model_view_filter_hbox = hbox
	{
		layoutpolicy_horizontal = expanding
		spacing = 10

		hbox = {
			name = "toggle_filters"
			layoutpolicy_horizontal = expanding
			datamodel = "[DataModelView.GetFilters]"

			item = {
				data_model_view_toggle_filter = {}
			}
		}

		hbox = {
			name = "grouped_filters"
			layoutpolicy_horizontal = expanding
			datamodel = "[DataModelView.GetGroupedFilters]"

			item = {
				data_model_view_dropdown_filter = {}
			}
		}
	}

	type data_model_view_filters_window = window
	{
		visible_at_creation = no
		visible = "[DataModelView.AreFiltersShown]"

		parentanchor = top|right
		position = { -780 20 }
		size = { 510 800 }
		focuspolicy = click

		allow_outside = yes

		using = Window_Movable
		using = Window_Background_Subwindow

		state = {
			name = _show
			using = Animation_FadeIn_Quick
		}

		state = {
			name = _hide
			using = Animation_FadeOut_Quick
		}

		vbox = {
			margin = { 4 4 }

			spacing = 10

			header_pattern = {
				layoutpolicy_horizontal = expanding

				blockoverride "header_text"
				{
					text = "CHARACTER_LIST_FILTERS"
				}
				blockoverride "button_close"
				{
					onclick = "[DataModelView.ToggleSortOrder]"
				}
			}

			scrollbox = {
				layoutpolicy_horizontal = expanding
				layoutpolicy_vertical = expanding

				blockoverride "scrollbox_content"
				{
					vbox = {
						name = "toggle_filters"
						layoutpolicy_horizontal = expanding
						datamodel = "[DataModelView.GetFilters]"

						item = {
							data_model_view_toggle_filter = {}
						}
					}

					vbox = {
						name = "grouped_filters"
						layoutpolicy_horizontal = expanding
						datamodel = "[DataModelView.GetGroupedFilters]"

						item = {
							data_model_view_dropdown_filter = {}
						}
					}
				}
			}

			hbox = {
				layoutpolicy_horizontal = growing
				margin_bottom = 10

				button_standard = {
					name = "remove_filters"
					raw_text = "Remove Filters"
					focuspolicy = click
					onclick = "[DataModelView.RemoveAllFilters]"
				}
			}
		}
	}
}