/* -------------------------------------------------------------------------
//MyCell Library - MyCell version 1.0
//
// This file is a part of the MyCell Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.txt at this distribution. By using
// this software in any fashion, you are agreeing to be bound by the terms
// of this license. You must not remove this notice, or any other, from
// this software.
//
// Creator: yanxueming
// Email: xueming.yan@gmail.com
// -----------------------------------------------------------------------*/
#pragma once
#include "msg.h"
#include "CellEditorBase.h"
namespace mycell{
class Workbook;
namespace editor{
class TextEditor : public CellEditorBase<TextEditor>
{
Workbook* pWookbook_;
public:
TextEditor():pWookbook_(NULL)
{}
void Init(Workbook* p)
{
pWookbook_=p;
}
//LRESULT OnLButtonDblClk(const CELLHITTESTINFO& chi);
//LRESULT OnLButtonDown(const CELLHITTESTINFO& chi,BOOL& bHandled);
//LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//LRESULT OnImeComposition(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
STDMETHOD(OnLButtonDblClick)(int ptX,int ptY,Cell cell,const VARIANT* pCellVal,UINT flags);
//STDMETHOD(OnLButtonDown)(int ptX,int ptY,int row,int col,UINT flags,VARIANT_BOOL* pbHandled);
STDMETHOD(OnChar)(Cell cell,const VARIANT* pCellVal,WPARAM wParam,LPARAM lParam,VARIANT_BOOL* pbHandled);
STDMETHOD(OnImeComposition)(Cell cell,const VARIANT* pCellVal,WPARAM wParam,LPARAM lParam,VARIANT_BOOL* pbHandled);
private:
void OnEditCell(int row,int col,LPCTSTR lpszCellText,UINT nChar)
{
TCHAR sz[2];
sz[0]=(TCHAR)nChar;
sz[1]=_T('\0');
OnEditCell(row,col,lpszCellText,sz);
}
void OnEditCell(int row, int col,LPCTSTR lpszCellText,LPCSTR szInit);
//void CheckCell(long row,long col,BOOL bCheck);
};
class CheckBoxEditor : public CellEditorBase<TextEditor>
{
Workbook* pWookbook_;
public:
CheckBoxEditor():pWookbook_(NULL)
{}
void Init(Workbook* p)
{
pWookbook_=p;
}
STDMETHOD(OnLButtonDown)(int ptX,int ptY,Cell cell,const VARIANT* pCellVal,UINT flags,VARIANT_BOOL* pbHandled);
private:
void CheckCell(long row,long col,BOOL bCheck);
};
}//nemespace editor
}//namespace mycell