First pass at getting a toolbar up for htmlarea form widgets. It's limping...

This commit is contained in:
jfrancis%netscape.com 1998-08-17 09:23:45 +00:00
parent 6b1ef4f964
commit ca8746f350
4 changed files with 126 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include "CEditView.h"
#include "resgui.h"
#include "edt.h"
#include "URobustCreateWindow.h"
CFormattingToolBar::CFormattingToolBar(LStream * inStream)
: CAMSavvyBevelView(inStream)
@ -122,3 +123,64 @@ void CFormattingToolBar::ListenToMessage( MessageT inMessage, void* ioParam )
mEditView->ObeyCommand( inMessage, ioParam );
}
#ifdef ENDER
LWindow* CFormattingToolFloatView::mFormatToolWin = 0;
// CFormattingToolFloatView is just a CFormattingToolBar for <htmlarea>
// form widgets. CFormattingToolFloatView lives in a floating window
// instead of in a toolbar in the browser window.
CFormattingToolFloatView::CFormattingToolFloatView(LStream * inStream)
: CFormattingToolBar(inStream)
{
mEditView = NULL;
}
CFormattingToolFloatView::~CFormattingToolFloatView()
{
}
void CFormattingToolFloatView::FinishCreateSelf()
{
UReanimator::LinkListenerToControls(this, this, 11616);
}
void CFormattingToolFloatView::SetEditView(CEditView* inEditView)
{
mEditView = inEditView;
}
// GetFloatingToolBar() [ static ]
// lazy construction of floating formatting tool bar for Ender done here.
CFormattingToolFloatView* CFormattingToolFloatView::GetFloatingToolBar(CEditView* inEditView)
{
if (!mFormatToolWin)
{
// time to build the floating formatting tool windoid
mFormatToolWin = (URobustCreateWindow::CreateWindow(
CFormattingToolFloatView::mToolWinResID,
LCommander::GetTopCommander() ));
// sanity check
if (!mFormatToolWin) return 0;
}
CFormattingToolFloatView *theView =
(CFormattingToolFloatView*)(mFormatToolWin->FindPaneByID( CFormattingToolFloatView::pane_ID ));
Assert_(theView);
theView->SetEditView(inEditView);
return theView;
}
// ShowFormatFloatTool() [ static ]
// tool bar revealed - this is called from CHTMLView::BeTarget()
void CFormattingToolFloatView::ShowFormatFloatTool()
{
if (mFormatToolWin) mFormatToolWin->Show();
}
// HideFormatFloatTool() [ static ]
// tool bar hidden - this is called from CHTMLView::DontBeTarget()
void CFormattingToolFloatView::HideFormatFloatTool()
{
if (mFormatToolWin) mFormatToolWin->Hide();
}
#endif // ENDER

View File

@ -40,3 +40,23 @@ protected:
CEditView* mEditView;
};
#ifdef ENDER
class CFormattingToolFloatView : public CFormattingToolBar
{
public:
enum { pane_ID = 'ftfv', class_ID = 'FoTV', mToolWinResID = 5252 };
CFormattingToolFloatView(LStream * inStream);
~CFormattingToolFloatView();
virtual void FinishCreateSelf();
void SetEditView(CEditView* inEditView);
static CFormattingToolFloatView* GetFloatingToolBar(CEditView* inEditView);
static void ShowFormatFloatTool();
static void HideFormatFloatTool();
protected:
static LWindow* mFormatToolWin;
};
#endif // ENDER

View File

@ -56,6 +56,7 @@
#include <LCommander.h>
#include "CSimpleTextView.h"
#include "CFormattingToolBar.h"
#include "UUnicodeTextHandler.h"
#include "UUTF8TextHandler.h"
@ -745,7 +746,43 @@ CFormHTMLArea::CFormHTMLArea(LStream *inStream)
CFormHTMLArea::~CFormHTMLArea()
{
}
void CFormHTMLArea::FinishCreateSelf()
{
mParagraphToolbarPopup = 0;
mSizeToolbarPopup = 0;
mAlignToolbarPopup = 0;
mFontToolbarPopup = 0;
mColorPopup = 0;
CHTMLView::FinishCreateSelf();
}
void CFormHTMLArea::BeTarget()
{
// I tried to do this stuff in FinishCreateSelf(), but the UReanimator class
// (which streams in these objects, including the tool windoid) is not
// reintrant. ugh.
LView *view = CFormattingToolFloatView::GetFloatingToolBar(this);
Assert_(view);
mParagraphToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Paragraph_Hierarchical_Menu );
mSizeToolbarPopup = (LGAPopup *)view->FindPaneByID( cmd_Font_Size_Hierarchical_Menu );
mAlignToolbarPopup = (CPatternButtonPopup *)view->FindPaneByID( cmd_Align_Hierarchical_Menu );
mFontToolbarPopup = (CFontMenuPopup *)view->FindPaneByID( 'Font' );
mColorPopup = (CColorPopup *)view->FindPaneByID( 'Colr' );
CFormattingToolFloatView::ShowFormatFloatTool();
inherited::BeTarget();
}
void CFormHTMLArea::DontBeTarget()
{
inherited::DontBeTarget();
CFormattingToolFloatView::HideFormatFloatTool();
}
#pragma mark == CFormList ==
//---------------------------------------------------------------------------

View File

@ -326,8 +326,13 @@ public:
// ĽĽ Constructors/destructors
CFormHTMLArea(LStream *inStream);
virtual ~CFormHTMLArea();
void FinishCreateSelf();
// ¥¥ Misc
virtual void BeTarget();
virtual void DontBeTarget();
};