Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
TopLevelFrame Class Reference

#include <TopLevelFrame.h>

Inheritance diagram for TopLevelFrame:
Inheritance graph
[legend]
Collaboration diagram for TopLevelFrame:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TopLevelFrame (nsIEventHandler *handler, JMFrameRef frameRef, JMFrameKind kind, const Rect *initialBounds, Boolean resizeable)
virtual ~TopLevelFrame ()
virtual void setSize (const Rect *newSize)
 Methods used to implement the JMFrame callback protocol.
virtual void invalRect (const Rect *invalidRect)
virtual void showHide (Boolean visible)
virtual void setTitle (const StringPtr title)
virtual void checkUpdate ()
virtual void reorder (ReorderRequest request)
virtual void setResizeable (Boolean resizeable)
virtual void activate (Boolean active)
virtual void click (const EventRecord *event)
WindowRef getWindow ()
 TopLevelFrame (nsIEventHandler *handler, JMFrameRef frameRef, JMFrameKind kind, const Rect *initialBounds, Boolean resizeable)
virtual ~TopLevelFrame ()
virtual void setSize (const Rect *newSize)
 Methods used to implement the JMFrame callback protocol.
virtual void invalRect (const Rect *invalidRect)
virtual void showHide (Boolean visible)
virtual void setTitle (const StringPtr title)
virtual void checkUpdate ()
virtual void reorder (ReorderRequest request)
virtual void setResizeable (Boolean resizeable)
virtual void activate (Boolean active)
virtual void click (const EventRecord *event)
WindowRef getWindow ()
virtual Boolean handleEvent (const EventRecord *event)
 Methods to handle various events.
virtual Boolean handleEvent (const EventRecord *event)
 Methods to handle various events.
virtual void idle (SInt16 modifiers)
virtual void idle (SInt16 modifiers)
virtual void update ()
virtual void update ()
virtual void resume (Boolean inFront)
virtual void resume (Boolean inFront)
virtual void click (const EventRecord *event, Point localWhere)
virtual void keyPress (UInt32 message, SInt16 modifiers)
virtual void keyPress (UInt32 message, SInt16 modifiers)
virtual void keyRelease (UInt32 message, SInt16 modifiers)
virtual void keyRelease (UInt32 message, SInt16 modifiers)
virtual void focusEvent (Boolean gotFocus)
virtual void focusEvent (Boolean gotFocus)
virtual void menuSelected (UInt32 message, SInt16 modifiers)
virtual void menuSelected (UInt32 message, SInt16 modifiers)
virtual void print (GrafPtr printingPort, Point frameOrigin)
virtual void print (GrafPtr printingPort, Point frameOrigin)

Protected Member Functions

virtual GrafPtr getPort ()
virtual GrafPtr getPort ()

Protected Attributes

JMFrameRef mFrameRef
Boolean mActive
Boolean mFocused

Private Attributes

nsIEventHandlermHandler
WindowRef mWindow
Rect mBounds

Detailed Description

Definition at line 56 of file TopLevelFrame.h.


Constructor & Destructor Documentation

TopLevelFrame::TopLevelFrame ( nsIEventHandler handler,
JMFrameRef  frameRef,
JMFrameKind  kind,
const Rect *  initialBounds,
Boolean  resizeable 
)

Definition at line 71 of file TopLevelFrame.cpp.

       :      MRJFrame(frameRef),
              mHandler(handler), mWindow(NULL), mBounds(*initialBounds)
{
       Boolean hasGoAway = true;
       SInt16 windowProc = documentProc;
       SInt16 resizeHeight = resizeable ? 15 : 0;
       
       switch (kind) {
       case eBorderlessModelessWindowFrame:
              hasGoAway = false;
              windowProc = plainDBox;
              // mBounds.bottom += resizeHeight;
              resizeable = false;
              break;
       case eModelessWindowFrame:
       case eModelessDialogFrame:
              hasGoAway = true;
              windowProc = resizeable ? zoomDocProc : documentProc;
              // mBounds.bottom += resizeHeight;
              break;
       case eModalWindowFrame:
              hasGoAway = true;
              // We have to allow resizeable modal windows.
              windowProc = resizeable ? documentProc : movableDBoxProc;
              break;
       }
       
       mWindow = ::NewCWindow(NULL, &mBounds, "\p", false, windowProc, WindowPtr(-1), hasGoAway, long(this));
       if (mWindow != NULL) {
              Point zeroPt = { 0, 0 };
              ::JMSetFrameVisibility(frameRef, mWindow, zeroPt, mWindow->clipRgn);
       }
}

Here is the call graph for this function:

Definition at line 107 of file TopLevelFrame.cpp.

{
       // make sure the window is hidden (and unregistered with the browser).
       showHide(false);

       // make sure this port isn't ever current again.
       ::UnsetPort(mWindow);

       if (mWindow != NULL)
              ::DisposeWindow(mWindow);
}

Here is the call graph for this function:

TopLevelFrame::TopLevelFrame ( nsIEventHandler handler,
JMFrameRef  frameRef,
JMFrameKind  kind,
const Rect *  initialBounds,
Boolean  resizeable 
)
virtual TopLevelFrame::~TopLevelFrame ( ) [virtual]

Member Function Documentation

void TopLevelFrame::activate ( Boolean  active) [virtual]

Reimplemented from MRJFrame.

Definition at line 218 of file TopLevelFrame.cpp.

{
       focusEvent(active);
       MRJFrame::activate(active);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void TopLevelFrame::activate ( Boolean  active) [virtual]

Reimplemented from MRJFrame.

Reimplemented from MRJFrame.

Definition at line 174 of file TopLevelFrame.cpp.

{
}
virtual void TopLevelFrame::checkUpdate ( ) [virtual]

Reimplemented from MRJFrame.

void TopLevelFrame::click ( const EventRecord *  event) [virtual]

Reimplemented from MRJFrame.

Definition at line 224 of file TopLevelFrame.cpp.

{
       Point where = event->where;
       SInt16 modifiers = event->modifiers;
       WindowRef hitWindow;
       short partCode = ::FindWindow(where, &hitWindow);
       switch (partCode) {
       case inContent:
              ::SelectWindow(mWindow);
              MRJFrame::click(event);
              break;
       case inDrag:
              {
                     Rect bounds = (**GetGrayRgn()).rgnBBox;
                     DragWindow(mWindow, where, &bounds);
                     computeBounds(mWindow, &bounds);
                     ::JMSetFrameSize(mFrameRef, &bounds);

                     Point zeroPt = { 0, 0 };
                     ::JMSetFrameVisibility(mFrameRef, mWindow, zeroPt, mWindow->clipRgn);
              }
              break;
       case inGrow:
              Rect limits = { 30, 30, 5000, 5000 };
              long result = GrowWindow(mWindow, where, &limits);
              if (result != 0) {
                     short width = (result & 0xFFFF);
                     short height = (result >> 16) & 0xFFFF;
                     Rect newBounds;
                     topLeft(newBounds) = topLeft(mBounds);
                     newBounds.right = newBounds.left + width;
                     newBounds.bottom = newBounds.top + height;
                     ::JMSetFrameSize(mFrameRef, &newBounds);

                     Point zeroPt = { 0, 0 };
                     ::JMSetFrameVisibility(mFrameRef, mWindow, zeroPt, mWindow->clipRgn);
              }
              break;
       case inGoAway:
              if (::TrackGoAway(mWindow, where))
                     ::JMFrameGoAway(mFrameRef);
              break;
       case inZoomIn:
       case inZoomOut:
              if (::TrackBox(mWindow, where, partCode)) {
                     ZoomWindow(mWindow, partCode, true);
                     computeBounds(mWindow, &mBounds);
                     ::JMSetFrameSize(mFrameRef, &mBounds);
              }
              break;
       case inCollapseBox:
              break;
       }
}

Here is the call graph for this function:

virtual void TopLevelFrame::click ( const EventRecord *  event) [virtual]

Reimplemented from MRJFrame.

void MRJFrame::click ( const EventRecord *  event,
Point  localWhere 
) [virtual, inherited]

Definition at line 181 of file MRJFrame.cpp.

{
       if (&::JMFrameClickWithEventRecord != NULL)
              ::JMFrameClickWithEventRecord(mFrameRef, localWhere, event);
       else
              ::JMFrameClick(mFrameRef, localWhere, event->modifiers);
}
void MRJFrame::focusEvent ( Boolean  gotFocus) [virtual, inherited]

Definition at line 139 of file MRJFrame.cpp.

{
       if (&::JMFrameFocus != NULL) {
              if (gotFocus != mFocused) {
                     if (gotFocus) {
                            // HACK, until focus really works.
                            if (mActive != gotFocus) {
                                   mActive = gotFocus;
                                   ::JMFrameActivate(mFrameRef, gotFocus);
                            }
                     }
                     mFocused = gotFocus;
                     ::JMFrameFocus(mFrameRef, gotFocus);
              }
       } else {
              if (mActive != gotFocus) {
                     mActive = gotFocus;
                     ::JMFrameActivate(mFrameRef, gotFocus);
              }
       }
}

Here is the caller graph for this function:

virtual void MRJFrame::focusEvent ( Boolean  gotFocus) [virtual, inherited]
GrafPtr TopLevelFrame::getPort ( ) [protected, virtual]

Implements MRJFrame.

Definition at line 284 of file TopLevelFrame.cpp.

{
       return mWindow;
}
virtual GrafPtr TopLevelFrame::getPort ( ) [protected, virtual]

Implements MRJFrame.

WindowRef TopLevelFrame::getWindow ( )

Definition at line 279 of file TopLevelFrame.cpp.

{
       return mWindow;
}
WindowRef TopLevelFrame::getWindow ( )
Boolean MRJFrame::handleEvent ( const EventRecord *  event) [virtual, inherited]

Methods to handle various events.

Definition at line 67 of file MRJFrame.cpp.

{
       Boolean eventHandled = true;

       switch (event->what) {
       case nsPluginEventType_AdjustCursorEvent:
              idle(event->modifiers);
              break;
       
       case ::mouseDown:
              click(event);
              break;
       
       case keyDown:
       case autoKey:
              keyPress(event->message, event->modifiers);
              break;
       
       case keyUp:
              keyRelease(event->message, event->modifiers);
              break;

       case updateEvt:
              update();
              break;
       
       case activateEvt:
              activate((event->modifiers & activeFlag) != 0);
              break;

#if 0
       case osEvt:
              resume((event->message & resumeFlag) != 0);
              eventHandled = false;
              break;
#endif
       
       default:
              eventHandled = false;
              break;
       }
              
       return eventHandled;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Boolean MRJFrame::handleEvent ( const EventRecord *  event) [virtual, inherited]

Methods to handle various events.

void MRJFrame::idle ( SInt16  modifiers) [virtual, inherited]

Definition at line 112 of file MRJFrame.cpp.

{
       LocalPort port(getPort());
       port.Enter();
       
       Point pt;
       ::GetMouse(&pt);
       ::JMFrameMouseOver(mFrameRef, pt, modifiers);
       
       port.Exit();
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void MRJFrame::idle ( SInt16  modifiers) [virtual, inherited]
void TopLevelFrame::invalRect ( const Rect *  invalidRect) [virtual]

Reimplemented from MRJFrame.

Definition at line 131 of file TopLevelFrame.cpp.

{
       if (mWindow != NULL) {
              ::InvalRect(invalidRect);
       }
}
virtual void TopLevelFrame::invalRect ( const Rect *  invalidRect) [virtual]

Reimplemented from MRJFrame.

void MRJFrame::keyPress ( UInt32  message,
SInt16  modifiers 
) [virtual, inherited]

Definition at line 189 of file MRJFrame.cpp.

{
       ::JMFrameKey(mFrameRef, message & charCodeMask, (message & keyCodeMask) >> 8, modifiers);
}

Here is the caller graph for this function:

virtual void MRJFrame::keyPress ( UInt32  message,
SInt16  modifiers 
) [virtual, inherited]
void MRJFrame::keyRelease ( UInt32  message,
SInt16  modifiers 
) [virtual, inherited]

Definition at line 194 of file MRJFrame.cpp.

{
       ::JMFrameKeyRelease(mFrameRef, message & charCodeMask, (message & keyCodeMask) >> 8, modifiers);
}

Here is the caller graph for this function:

virtual void MRJFrame::keyRelease ( UInt32  message,
SInt16  modifiers 
) [virtual, inherited]
void MRJFrame::menuSelected ( UInt32  message,
SInt16  modifiers 
) [virtual, inherited]

Definition at line 199 of file MRJFrame.cpp.

{
       MenuHandle menu = ::GetMenuHandle(short(message >> 16));
       if (menu != NULL) {
              short item = short(message);
              if (&::JMMenuSelectedWithModifiers != NULL)
                     ::JMMenuSelectedWithModifiers(::JMGetFrameContext(mFrameRef), menu, item, modifiers);
              else
                     ::JMMenuSelected(::JMGetFrameContext(mFrameRef), menu, item);
       }
}

Here is the caller graph for this function:

virtual void MRJFrame::menuSelected ( UInt32  message,
SInt16  modifiers 
) [virtual, inherited]
void MRJFrame::print ( GrafPtr  printingPort,
Point  frameOrigin 
) [virtual, inherited]

Definition at line 211 of file MRJFrame.cpp.

{
#if 0
       // this doesn't work, as Apple hasn't implemented it yet.
       OSStatus status = JMDrawFrameInPort(mFrameRef, printingPort, frameOrigin, printingPort->clipRgn, false);
       if (status != noErr) {
              ::MoveTo(10, 12);
              ::TextFont(0);
              ::TextSize(12);
              ::DrawString("\pMRJPlugin:  printing failed.");
       }
#endif
}

Here is the call graph for this function:

virtual void MRJFrame::print ( GrafPtr  printingPort,
Point  frameOrigin 
) [virtual, inherited]
void TopLevelFrame::reorder ( ReorderRequest  request) [virtual]

Reimplemented from MRJFrame.

Definition at line 178 of file TopLevelFrame.cpp.

{
       switch (request) {
       case eBringToFront:         /* bring the window to front */
              ::BringToFront(mWindow);
              break;
       case eSendToBack:           /* send the window to back */
              ::SendBehind(mWindow, NULL);
              break;
       case eSendBehindFront:      /* send the window behind the front window */
              WindowPtr frontWindow = ::FrontWindow();
              if (mWindow == frontWindow) {
                     ::SendBehind(mWindow, GetNextWindow(mWindow));
              } else {
                     ::SendBehind(mWindow, frontWindow);
              }
              break;
       }
}
virtual void TopLevelFrame::reorder ( ReorderRequest  request) [virtual]

Reimplemented from MRJFrame.

void MRJFrame::resume ( Boolean  inFront) [virtual, inherited]

Definition at line 161 of file MRJFrame.cpp.

{
       ::JMFrameResume(mFrameRef, inFront);
}

Here is the caller graph for this function:

virtual void MRJFrame::resume ( Boolean  inFront) [virtual, inherited]
void TopLevelFrame::setResizeable ( Boolean  resizeable) [virtual]

Reimplemented from MRJFrame.

Definition at line 198 of file TopLevelFrame.cpp.

{
       // this might have to recreate the window, no?
}
virtual void TopLevelFrame::setResizeable ( Boolean  resizeable) [virtual]

Reimplemented from MRJFrame.

void TopLevelFrame::setSize ( const Rect *  newSize) [virtual]

Methods used to implement the JMFrame callback protocol.

Reimplemented from MRJFrame.

Definition at line 119 of file TopLevelFrame.cpp.

{
       mBounds = *newSize;

       if (mWindow != NULL) {
              SInt16 width = newSize->right - newSize->left;
              SInt16 height = newSize->bottom - newSize->top;
              ::SizeWindow(mWindow, width, height, true);
              ::MoveWindow(mWindow, newSize->left, newSize->top, false);
       }
}
virtual void TopLevelFrame::setSize ( const Rect *  newSize) [virtual]

Methods used to implement the JMFrame callback protocol.

Reimplemented from MRJFrame.

void TopLevelFrame::setTitle ( const StringPtr  title) [virtual]

Reimplemented from MRJFrame.

Definition at line 167 of file TopLevelFrame.cpp.

{
       if (mWindow != NULL) {
              ::SetWTitle(mWindow, title);
       }
}
virtual void TopLevelFrame::setTitle ( const StringPtr  title) [virtual]

Reimplemented from MRJFrame.

void TopLevelFrame::showHide ( Boolean  visible) [virtual]

Reimplemented from MRJFrame.

Definition at line 138 of file TopLevelFrame.cpp.

{
       if (mWindow != NULL && visible != IsWindowVisible(mWindow)) {
              if (visible) {
#if !defined(USE_ALT_WINDOW_HANDLING)            
                     // Have to notify the browser that this window exists, so that it will receive events.
                     thePluginManager2->RegisterWindow(mHandler, mWindow);
                     // the plugin manager takes care of showing the window.
                     // ::ShowWindow(mWindow);
                     // ::SelectWindow(mWindow);
#else
            AltRegisterWindow(mHandler, mWindow);
#endif
              } else {
#if defined(USE_ALT_WINDOW_HANDLING)             
            AltUnregisterWindow(mHandler, mWindow);
#else
                     // the plugin manager takes care of hiding the window.
                     // ::HideWindow(mWindow);
                     // Let the browser know it doesn't have to send events anymore.
                     thePluginManager2->UnregisterWindow(mHandler, mWindow);
#endif
                     activate(false);
              }
              
              // ::ShowHide(mWindow, visible);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void TopLevelFrame::showHide ( Boolean  visible) [virtual]

Reimplemented from MRJFrame.

void MRJFrame::update ( ) [virtual, inherited]

Definition at line 124 of file MRJFrame.cpp.

{
       GrafPtr framePort = getPort();
       if (framePort != NULL)
              ::JMFrameUpdate(mFrameRef, framePort->clipRgn);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void MRJFrame::update ( ) [virtual, inherited]

Member Data Documentation

Boolean MRJFrame::mActive [protected, inherited]

Definition at line 93 of file MRJFrame.h.

Rect TopLevelFrame::mBounds [private]

Definition at line 80 of file TopLevelFrame.h.

Boolean MRJFrame::mFocused [protected, inherited]

Definition at line 94 of file MRJFrame.h.

JMFrameRef MRJFrame::mFrameRef [protected, inherited]

Definition at line 92 of file MRJFrame.h.

Definition at line 78 of file TopLevelFrame.h.

WindowRef TopLevelFrame::mWindow [private]

Definition at line 79 of file TopLevelFrame.h.


The documentation for this class was generated from the following files: