new constructor for creating attachments from code, not from Constructor.

This commit is contained in:
pinkerton%netscape.com 1998-10-08 21:56:26 +00:00
Родитель 3cdae751c2
Коммит f2f8fe6956
2 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@ -28,9 +28,24 @@ CContextMenuAttachment::CContextMenuAttachment(LStream* inStream)
//-----------------------------------
{
*inStream >> mMenuID >> mTextTraitsID;
mHostView = dynamic_cast<LView*>(LAttachable::GetDefaultAttachable());
mHostCommander = dynamic_cast<LCommander*>(LAttachable::GetDefaultAttachable());
mHostView = dynamic_cast<LPane*>(LAttachable::GetDefaultAttachable());
Assert_(mHostView);
mHostCommander = dynamic_cast<LCommander*>(LAttachable::GetDefaultAttachable());
if ( !mHostCommander )
mHostCommander = LCommander::GetDefaultCommander();
Assert_(mHostCommander);
}
//-----------------------------------
CContextMenuAttachment::CContextMenuAttachment ( ResIDT inMenuID, ResIDT inTextTraitsID )
: LAttachment(), mMenuID(inMenuID), mTextTraitsID(inTextTraitsID)
//-----------------------------------
{
mHostView = dynamic_cast<LPane*>(LAttachable::GetDefaultAttachable());
Assert_(mHostView);
mHostCommander = dynamic_cast<LCommander*>(LAttachable::GetDefaultAttachable());
if ( !mHostCommander )
mHostCommander = LCommander::GetDefaultCommander();
Assert_(mHostCommander);
}
@ -193,7 +208,6 @@ void CContextMenuAttachment::DoPopup(const SMouseDownEvent& inMouseDown, EClickS
{
Int16 saveFont = ::LMGetSysFontFam();
Int16 saveSize = ::LMGetSysFontSize();
StMercutioMDEFTextState theMercutioMDEFTextState;
if (mTextTraitsID)
{
TextTraitsH traitsH = UTextTraits::LoadTextTraits(mTextTraitsID);

Просмотреть файл

@ -43,11 +43,12 @@ class CContextMenuAttachment : public LAttachment
// This listens to mouse clicks, waits for timeout, handles popup menu etc. It will also
// handle changing the cursor if called from within AdjustCursorSelf(), etc.
//
// Must be attached via constructor, just like CPaneEnabler.
// Must be attached via constructor, just like CPaneEnabler. [This is _so_ not true (pinkerton)]
//======================================
{
public:
enum { class_ID = 'CxMn', msg_ContextMenu = 'CxMn', msg_ContextMenuCursor = 'CxMC'};
CContextMenuAttachment(ResIDT inMenuID, ResIDT inTextTraitsID);
CContextMenuAttachment(LStream* inStream);
virtual ~CContextMenuAttachment();
@ -89,6 +90,6 @@ protected:
private:
ResIDT mMenuID;
ResIDT mTextTraitsID;
LView* mHostView;
LPane* mHostView;
LCommander* mHostCommander; // same as view, precast for convenience
}; // class CContextMenuAttachment