function on_always_on_top_changed(state) {}
// called when "Always On Top" state changes from using the menu, Alt + A, fb.AlwaysOnTop, etc
// state: boolean.

function on_char(code) {}
// code: UTF16 encoded char.
// in order to use this callback, use window.DlgCode(DLGC_WANTCHARS);
// see flags.txt > DLGC_WANTCHARS.

function on_colors_changed() {}
// called when colours are changed via default UI/columns UI preferences.
// use window.GetColourCUI()/window.GetColorDUI() to get new colours.

function on_cursor_follow_playback_changed(state) {}
// called when "cursor follow playback" state is changed.
// state: boolean. reflect current "cursor follow playback" value.

function on_drag_drop(action, x, y, mask) {}
function on_drag_enter(action, x, y, mask) {}
function on_drag_leave() {}
function on_drag_over(action, x, y, mask) {}
// for on_drag_* callbacks, @feature "dragdrop" must be set in the preprocessor section.
// see preprocessors.txt for more details.
// see samples\basic\Drag Drop Basic.txt for how to use "action".

function on_focus(is_focused) {}
// called when the panel gets/loses focus

function on_font_changed() {}
// called when fonts are changed via default UI/columns UI preferences
// retrieve fonts using window.GetFontDUI()/window.GetFontCUI()

function on_get_album_art_done(handle, art_id, image, image_path) {}
// called when thread created by utils.GetAlbumArtAsync() is done.
// image_path will point to the image file (or music file if image is embedded).

function on_item_focus_change(playlistIndex, from, to) {}
// called when playlist focus has been changed

function on_item_played(handle) {}
// called when at least 60s of the track has been played or the track has reached
// its end after at least 1/3 of it has been played through.

function on_key_down(vkey) {}
function on_key_up(vkey) {}
/*
both keyboard related callbacks require "Grab focus" enabled in the Configuration window.
in order to use arrow keys, use window.DlgCode(DLGC_WANTARROWS);
see flags.txt > DLGC_WANTARROWS.
vkey: Virtual Key Code, refer to: http://msdn.microsoft.com/en-us/library/ms927178.aspx

on_key_down only: keyboard shortcuts defined in the main preferences are always executed first
and are not passed to the callback.
*/

function on_library_items_added() {}
function on_library_items_removed() {}
function on_library_items_changed() {}

function on_load_image_done(cookie, image) {}
// called when thread created by gdi.LoadImageAsync() is done.

function on_main_menu(index) {}
/*
On the main menu>File>JScript Panel, there are 10 menu items and whichever number
is selected is sent as the "index" to this callback. Being main menu items now means you
can bind them to global keyboard shortcuts, standard toolbar buttons, panel stack splitter
buttons, etc. Remember to think carefully about where you use this code as you probably only
want it to run once and so don't include it in common files and scripts where you might have
multiple instances. Also, you should avoid sharing scripts containing this code so as not
to conflict with what other users may already be using.
Example:

function on_main_menu(index) {
	switch (index) {
	case 1: // triggered when File>JScript Panel>1 is run
		do_something();
		break;
	case 2: // triggered when File>JScript Panel>2 is run
		do_something_else();
		break;
	}
}
*/

function on_metadb_changed(handle_list, fromhook) {}
// called when metadb contents change.
// see samples\basic\Watch Metadb Change.txt

function on_mouse_lbtn_dblclk(x, y, mask) {}
function on_mouse_lbtn_down(x, y, mask) {}
function on_mouse_lbtn_up(x, y, mask) {}
function on_mouse_leave() {}
function on_mouse_mbtn_dblclk(x, y, mask) {}
function on_mouse_mbtn_down(x, y, mask) {}
function on_mouse_mbtn_up(x, y, mask) {}
function on_mouse_move(x, y, mask) {}
function on_mouse_rbtn_dblclk(x, y, mask) {}
function on_mouse_rbtn_down(x, y, mask) {}
// see flags.txt > Mask for mouse callbacks

function on_mouse_rbtn_up(x, y, mask) {}
// you must return true if you want to suppress the default context menu.
// hold left shift + left windows key to bypass user code and open default context menu.

function on_mouse_wheel(step) {}
// scroll up/down

function on_mouse_wheel_h(step) {}
// scroll left/right

function on_notify_data(name, info) {}
// called in other panels after window.NotifyOthers(name, info) is executed

function on_paint(gr) {}
// called when window is ready to draw
// see interfaces.txt for all the methods used with gr

function on_playback_follow_cursor_changed(state) {}
// called when "playback follow cursor" state is changed
// state: boolean, reflect current "playback follow cursor" value

function on_playback_dynamic_info() {}
// dynamic info (VBR bitrate etc) change.

function on_playback_dynamic_info_track() {}
// per-track dynamic info (stream track titles etc) change.
// happens less often than on_playback_dynamic_info().

function on_playback_edited(handle) {}
// called when currently playing file gets edited.

function on_playback_new_track(handle) {}

function on_playback_order_changed(new_order_index) {}
/*
called when playback order is changed
new_order_index:
0 Default
1 Repeat (Playlist)
2 Repeat (Track)
3 Random
4 Shuffle (tracks)
5 Shuffle (albums)
6 Shuffle (folders)
*/

function on_playback_pause(state) {}
// state: true when paused, false when unpaused.

function on_playback_queue_changed(origin) {}
// origin: 0 user_added, 1 user_removed, 2 playback advance

function on_playback_seek(time) {}
// time: float value, in seconds.

function on_playback_starting(cmd, is_paused) {}
// cmd: 0 default, 1 play, 2 next, 3 prev, 4 settrack, 5 rand, 6 resume.

function on_playback_stop(reason) {}
// reason: 0 user, 1 eof, 2 starting_another.

function on_playback_time(time) {}
// called every second, for time display.
// time - float value, in sec.

function on_playlist_item_ensure_visible(playlistIndex, item) {}

function on_playlist_items_added(playlistIndex) {}
function on_playlist_items_removed(playlistIndex, new_count) {}
function on_playlist_items_reordered(playlistIndex) {}

function on_playlist_items_selection_change() {}
// workaround for some 3rd party playlist viewers not working with on_selection_changed()

function on_playlist_stop_after_current_changed(state) {}
// called when "stop after current" is enabled/disabled.
// state: "stop after current" value, either true or false.

function on_playlist_switch() {}

function on_playlists_changed() {}
/*
on_playlists_changed will be called when:
-playlists are added/removed/reordered/renamed
-a playlist's lock status changes through the use of components such as foo_utils or foo_playlist_attributes
*/

function on_refresh_background_done() {}
// Always call window.GetBackgroundImage() during this callback.
// IMPORTANT: DO NOT call window.Repaint()

function on_script_unload() {}
// This callback is not guaranteed to be called during unloading.

function on_selection_changed() {}
// called when selection changes based on "File>Preferences>Display>Selection viewers".

function on_size() {}
// called when panel is resized.
// IMPORTANT: DO NOT call window.Repaint()

function on_volume_change(val) {}
// val: volume level in dB. minimum is -100. maximum is 0.
