#pragma once

// Forward declartion
struct t_sci_prop_set;

struct t_style_to_key_table
{
	int style_num;
	const char * key;
};

inline int sci_get_prop_int(HWND edit, const char * key, int defaultval = 0)
{
	return SendMessage(edit, SCI_GETPROPERTYINT, (WPARAM)key, defaultval);
}

//inline void sci_get_prop_string(HWND edit, const char * key, pfc::string_base & value)
//{
//	value.reset();
//
//	int len = SendMessage(edit, SCI_GETPROPERTYEXPANDED, (WPARAM)key, 0);
//	
//	if (len > 0)
//	{
//		SendMessage(edit, SCI_GETPROPERTYEXPANDED, (WPARAM)key, (LPARAM)value.lock_buffer(len));
//		value.unlock_buffer();
//	}
//}

DWORD sci_parse_hex(const char * hex);
DWORD sci_get_prop_color(HWND edit, const char * key, bool * key_exist = NULL);

void sci_init(HWND edit);
void sci_set_lexer(HWND edit, const char * lang);
void sci_match_brace(HWND edit);
void sci_auto_indent(HWND edit, char ch);
void sci_auto_margin_width(HWND edit);
void sci_set_text(HWND edit, const char * text, bool clear_undo_buffer = false);
void sci_set_props(HWND edit, const pfc::list_t<t_sci_prop_set> & data);
void sci_set_all_style_from_prop_by_table(HWND edit, const t_style_to_key_table table[]);
void sci_reload_style(HWND edit);
void sci_track_width(HWND edit);
