// ==PREPROCESSOR==
// @name "Menu Button"
// @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"
// ==/PREPROCESSOR==

var panel = new _.panel('Menu Button', ['custom_background']);
var buttons = new _.buttons();
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function (x, y, mask) { _.menu(0, 36); }, 'Menu');

function on_size() {
	panel.size();
}

function on_paint(gr) {
	panel.paint(gr);
	buttons.paint(gr);
}

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

function on_mouse_leave() {
	buttons.leave();
}

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

function on_mouse_rbtn_up(x, y) {
	if (buttons.buttons.menu.trace(x, y)) {
		_.help(0, 36);
		return true;
	} else {
		return panel.rbtn_up(x, y);
	}
}
