#include "stdafx.h"
#include "PdfToolFrame.h"
#include "GlobalUI.h"

namespace DuiLib
{
	CPdfToolFrame::CPdfToolFrame(HWND wnd)
	{
		m_wnd = wnd;
	}

	CPdfToolFrame::~CPdfToolFrame(void)
	{
		
	}
	void CPdfToolFrame::Notify(TNotifyUI& msg)
	{
		
		
		if( msg.sType == _T("click") ) {

			if (msg.pSender->GetName() == _T("tool_pre_page"))
			{
				::PostMessage(m_wnd,WM_PDF_PRE_PAGE,NULL,NULL);
				return;
			}
			else if (msg.pSender->GetName() == _T("tool_next_page"))
			{
				::PostMessage(m_wnd,WM_PDF_NEXT_PAGE,NULL,NULL);
				return;
			}

			
		}
		__super::Notify(msg);
	}
	void CPdfToolFrame::OnInit()
	{
		
		__super::OnInit();
	}

	void CPdfToolFrame::OnLoad()
	{
		__super::OnLoad();
	}

	LRESULT CPdfToolFrame::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		return __super::HandleMessage(uMsg, wParam, lParam);
	}
	void CPdfToolFrame::SetPreButtonEnable( bool bFlag )
	{
		CButtonUI* btn = static_cast<CButtonUI*>(m_pm.FindControl(_T("tool_pre_page")));
		btn->SetEnabled(bFlag);
	}

	void CPdfToolFrame::SetNextButtonEnable( bool bFlag )
	{
		CButtonUI* btn = static_cast<CButtonUI*>(m_pm.FindControl(_T("tool_next_page")));
		btn->SetEnabled(bFlag);
	}
}