зеркало из https://github.com/mozilla/gecko-dev.git
Made a basic working editor mode.
This commit is contained in:
Родитель
f4866fea9b
Коммит
061c6a5a26
|
@ -548,6 +548,38 @@ HRESULT CMozillaBrowser::SetEditorMode(BOOL bEnabled)
|
|||
}
|
||||
|
||||
|
||||
HRESULT CMozillaBrowser::OnEditorCommand(DWORD nCmdID)
|
||||
{
|
||||
if (!m_bEditorMode)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
if (!m_pEditor)
|
||||
{
|
||||
NG_ASSERT(0);
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
switch (nCmdID)
|
||||
{
|
||||
case IDM_BOLD:
|
||||
break;
|
||||
case IDM_ITALIC:
|
||||
break;
|
||||
case IDM_UNDERLINE:
|
||||
break;
|
||||
|
||||
// TODO add the rest!
|
||||
|
||||
default:
|
||||
// DO NOTHING
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
// Returns the presentation shell
|
||||
HRESULT CMozillaBrowser::GetPresShell(nsIPresShell **pPresShell)
|
||||
{
|
||||
|
@ -2394,11 +2426,15 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Resizable(VARIANT_BOOL Value)
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Ole Command Handlers
|
||||
|
||||
HRESULT _stdcall CMozillaBrowser::EditModeHandler(IOleCommandTarget *pTarget, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
HRESULT _stdcall CMozillaBrowser::EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
CMozillaBrowser *pBrowser = dynamic_cast<CMozillaBrowser *>(pTarget);
|
||||
BOOL bEditorMode = (nCmdID == IDM_EDITMODE) ? TRUE : FALSE;
|
||||
pBrowser->SetEditorMode(bEditorMode);
|
||||
pThis->SetEditorMode(bEditorMode);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT _stdcall CMozillaBrowser::EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
pThis->OnEditorCommand(nCmdID);
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,8 @@ BEGIN_MSG_MAP(CMozillaBrowser)
|
|||
COMMAND_ID_HANDLER(ID_PAGESETUP, OnPageSetup)
|
||||
END_MSG_MAP()
|
||||
|
||||
static HRESULT _stdcall EditModeHandler(IOleCommandTarget *pCmdTarget, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
||||
static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
||||
static HRESULT _stdcall EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
||||
|
||||
BEGIN_OLECOMMAND_TABLE()
|
||||
// Standard "common" commands
|
||||
|
@ -304,6 +305,7 @@ protected:
|
|||
virtual HRESULT GetPresShell(nsIPresShell **pPresShell);
|
||||
virtual HRESULT GetDOMDocument(nsIDOMDocument **pDocument);
|
||||
virtual HRESULT SetEditorMode(BOOL bEnabled);
|
||||
virtual HRESULT OnEditorCommand(DWORD nCmdID);
|
||||
virtual BOOL IsValid();
|
||||
virtual int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = _T(""), UINT nType = MB_OK);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче