// ==PREPROCESSOR==
// @name "Properties"
// @author "marc2003"
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// @import "%fb2k_component_path%samples\complete\js\helpers.js"
// @import "%fb2k_component_path%samples\complete\js\panel.js"
// @import "%fb2k_component_path%samples\complete\js\list.js"
// ==/PREPROCESSOR==

var panel = new _.panel();
var list = new _.list('properties', LM, TM, 0, 0);

// uncomment if you want to display data from the JScript Panel database documented here: https://github.com/marc2k3/foo_jscript_panel/wiki/Playback-Stats
// list.custom_fields = ['JSP_PLAYCOUNT', 'JSP_LOVED', 'JSP_FIRST_PLAYED', 'JSP_LAST_PLAYED', 'JSP_RATING'];

panel.item_focus_change();

function on_size() {
	panel.size();
	list.w = panel.w - (LM * 2);
	list.h = panel.h - TM;
	list.size();
}

function on_paint(gr) {
	panel.paint(gr);
	gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT);
	gr.DrawLine(list.x, list.y + 1, list.x + list.w, list.y + 1, 1, panel.colours.highlight);
	list.paint(gr);
}

function on_metadb_changed() {
	list.metadb_changed();
}

function on_mouse_wheel(s) {
	list.wheel(s);
}

function on_mouse_move(x, y) {
	list.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
	list.lbtn_up(x, y);
}

function on_key_down(k) {
	list.key_down(k);
}

function on_mouse_rbtn_up(x, y) {
	return panel.rbtn_up(x, y, list);
}
