//////////////////////////////////////////
// User.h
// クラスを使わない関数等は自分で書きます
//////////////////////////////////////////
//☆ユーザーが自由に宣言、定義、処理を記述できます

//--------------------------------
// メニュー、ツールバー状態の変更
//--------------------------------
void ChangeMenuStatus(bool EnableFlag) {

	HMENU hMenu = GetMenu(RTEditor.GetHandle());	//メニューハンドルの取得

	//メニューバー
	EnableMenuItem(hMenu, 1, MF_BYPOSITION | (EnableFlag ? MF_ENABLED : MF_GRAYED));
	EnableMenuItem(hMenu, 2, MF_BYPOSITION | (EnableFlag ? MF_ENABLED : MF_GRAYED));
	EnableMenuItem(hMenu, 3, MF_BYPOSITION | (EnableFlag ? MF_ENABLED : MF_GRAYED));

	HMENU hFileMenu;
	hFileMenu = GetSubMenu(hMenu, 0);
	EnableMenuItem(hFileMenu, IDM_SAVE, MF_BYCOMMAND | (EnableFlag ? MF_ENABLED : MF_GRAYED));
	EnableMenuItem(hFileMenu, IDM_SAVEAS, MF_BYCOMMAND | (EnableFlag ? MF_ENABLED : MF_GRAYED));
	EnableMenuItem(hFileMenu, IDM_SETPRINT, MF_BYCOMMAND | (EnableFlag ? MF_ENABLED : MF_GRAYED));
	EnableMenuItem(hFileMenu, IDM_PRINT, MF_BYCOMMAND | (EnableFlag ? MF_ENABLED : MF_GRAYED));
	DrawMenuBar(RTEditor.GetHandle());	//Re-draw "&File" menu

	//ツールバー(MAKELONGマクロは16bit整数2つをunsigned 32bit整数にする)
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_SAVE, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_PRINT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_UNDO, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_CUT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_COPY, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_PASTE, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_FIND, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_REPLACE, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_LEFT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_CENTER, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_RIGHT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_FONT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_LINDENT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_LOUTDENT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_RINDENT, MAKELONG(EnableFlag, 0));
	SendMessage(TBar.GetHandle(), TB_ENABLEBUTTON, IDM_ROUTDENT, MAKELONG(EnableFlag, 0));
}
