Back to index

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

#import <nsCocoaWindow.h>

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

List of all members.

Public Types

enum  { kTitleBarHeight = 20 }

Public Member Functions

() - nsCocoaWindow
(virtual) - ~nsCocoaWindow
(NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD
- Create
 Create and initialize a widget with a native window parent.
(NS_IMETHOD- Create
 Create and initialize a widget.
(virtual nsresult- StandardCreate
(NS_IMETHOD- Show
 Show or hide this widget.
(NS_IMETHOD- Enable
 Enable or disable this Widget.
(NS_IMETHOD- IsEnabled
 Ask whether the widget is enabled.
(NS_IMETHOD- SetModal
 Make the window modal.
(NS_IMETHOD- IsVisible
 Returns whether the window is visible.
(NS_IMETHOD- SetFocus
 Give focus to this widget.
(NS_IMETHOD- SetMenuBar
 Set the widget's MenuBar.
(NS_IMETHOD- ShowMenuBar
 Set the widget's MenuBar's visibility.
(NS_IMETHOD- WidgetToScreen
 Convert from this widget coordinates to screen coordinates.
(NS_IMETHOD- ScreenToWidget
 Convert from screen coordinates to this widget's coordinates.
(virtual void *) - GetNativeData
(NS_IMETHOD- ConstrainPosition
 Perform platform-dependent sanity check on a potential window position.
(NS_IMETHOD- Move
 Move this widget.
(NS_IMETHOD- PlaceBehind
 Position this widget just behind the given widget.
(NS_IMETHOD- SetSizeMode
 Minimize, maximize or normalize the window size.
(void- CalculateAndSetZoomedSize
(NS_IMETHOD- Resize
 Resize this widget.
(NS_IMETHOD- Resize
 Move or resize this widget.
(NS_IMETHOD- GetScreenBounds
 If the implementation of nsWindow uses a local coordinate system within the window, this method must be overridden.
(virtual PRBool- OnPaint
(void- ReportSizeEvent
(NS_IMETHOD- SetTitle
 Set the widget's title.
(virtual nsIFontMetrics *) - GetFont
 Get the font for this widget.
(NS_IMETHOD- SetFont
 Set the font for this widget.
(NS_IMETHOD- Invalidate
 Invalidate a specified rect for a widget and repaints it.
(NS_IMETHOD- Invalidate
 Invalidate the widget and repaint it.
(NS_IMETHOD- Update
 Force a synchronous repaint of the window if there are dirty rects.
(NS_IMETHOD- Scroll
 XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.
(NS_IMETHOD- SetColorMap
 Set the color map for this widget.
(NS_IMETHOD- BeginResizingChildren
 When adjustments are to made to a whole set of child widgets, call this before resizing/positioning the child windows to minimize repaints.
(NS_IMETHOD- EndResizingChildren
 Call this when finished adjusting child windows.
(NS_IMETHOD- GetPreferredSize
 Returns the preferred width and height for the widget.
(NS_IMETHOD- SetPreferredSize
 Set the preferred width and height for the widget.
(NS_IMETHOD- DispatchEvent
 Dispatches an event to the widget.
(NS_IMETHOD- CaptureRollupEvents
 Enables/Disables system capture of any and all events that would cause a dropdown to be rolled up, This method ignores the aConsumeRollupEvent parameter when aDoCapture is FALSE.
(virtual PRBool- DragEvent
(PRBool- IsResizing
(void- StartResizing
(void- StopResizing
(void- ComeToFront
(NS_IMETHOD- ResetInputState
(void- MoveToGlobalPoint
(void- IsActive
(void- SetIsActive
NS_DECL_ISUPPORTS NS_IMETHOD PreCreateWidget (nsWidgetInitData *aWidgetInitData)
NS_IMETHOD CaptureMouse (PRBool aCapture)
 Enables/Disables system mouse capture.
NS_IMETHOD Validate ()
 Validate the widget.
NS_IMETHOD InvalidateRegion (const nsIRegion *aRegion, PRBool aIsSynchronous)
 Invalidate a specified region for a widget and repaints it.
NS_IMETHOD GetClientData (void *&aClientData)
 Accessor functions to get and set the client data associated with the widget.
NS_IMETHOD SetClientData (void *aClientData)
NS_IMETHOD Destroy ()
 Close and destroy the internal native window.
NS_IMETHOD SetParent (nsIWidget *aNewParent)
 Reparent a widget.
virtual nsIWidgetGetParent (void)
 Return the parent Widget of this Widget or nsnull if this is a top level window.
virtual void AddChild (nsIWidget *aChild)
 Internal methods.
virtual void RemoveChild (nsIWidget *aChild)
NS_IMETHOD SetZIndex (PRInt32 aZIndex)
 Sets the widget's z-index.
NS_IMETHOD GetZIndex (PRInt32 *aZIndex)
 Gets the widget's z-index.
NS_IMETHOD GetSizeMode (PRInt32 *aMode)
 Return size mode (minimized, maximized, normalized).
virtual nscolor GetForegroundColor (void)
 Get the foreground color for this widget.
NS_IMETHOD SetForegroundColor (const nscolor &aColor)
 Set the foreground color for this widget.
virtual nscolor GetBackgroundColor (void)
 Get the background color for this widget.
NS_IMETHOD SetBackgroundColor (const nscolor &aColor)
 Set the background color for this widget.
virtual nsCursor GetCursor ()
 Get the cursor for this widget.
NS_IMETHOD SetCursor (nsCursor aCursor)
 Set the cursor for this widget.
NS_IMETHOD SetCursor (imgIContainer *aCursor, PRUint32 aHotspotX, PRUint32 aHotspotY)
 Sets an image as the cursor for this widget.
NS_IMETHOD GetWindowType (nsWindowType &aWindowType)
 Get the window type of this widget.
NS_IMETHOD SetWindowType (nsWindowType aWindowType)
NS_IMETHOD SetWindowTranslucency (PRBool aTranslucent)
 Set the translucency of the top-level window containing this widget.
NS_IMETHOD GetWindowTranslucency (PRBool &aTranslucent)
 Get the translucency of the top-level window that contains this widget.
NS_IMETHOD UpdateTranslucentWindowAlpha (const nsRect &aRect, PRUint8 *aAlphas)
 Update the alpha channel for some pixels of the top-level window that contains this widget.
NS_IMETHOD HideWindowChrome (PRBool aShouldHide)
 Hide window chrome (borders, buttons) for this widget.
NS_IMETHOD MakeFullScreen (PRBool aFullScreen)
 Put the toplevel window into or out of fullscreen mode.
nsresult MakeFullScreenInternal (PRBool aFullScreen)
virtual nsIRenderingContextGetRenderingContext ()
virtual nsIDeviceContextGetDeviceContext ()
virtual nsIAppShellGetAppShell ()
virtual nsIToolkitGetToolkit ()
 Return the widget's toolkit.
NS_IMETHOD ModalEventFilter (PRBool aRealEvent, void *aEvent, PRBool *aForWindow)
 Determine whether a given event should be processed assuming we are the currently active modal window.
NS_IMETHOD GetWindowClass (char *aClass)
 Gets the window class implemented in gtk.
NS_IMETHOD SetWindowClass (char *aClass)
 Sets the window class implemented in gtk.
NS_IMETHOD SetBorderStyle (nsBorderStyle aBorderStyle)
 Set border style Must be called before Create.
NS_IMETHOD AddMouseListener (nsIMouseListener *aListener)
 Processes a mouse pressed event.
NS_IMETHOD AddEventListener (nsIEventListener *aListener)
 Processes a mouse pressed event.
NS_IMETHOD AddMenuListener (nsIMenuListener *aListener)
 Add a menu listener This interface should only be called by the menu services manager This will AddRef() the menu listener This will Release() a previously set menu listener.
NS_IMETHOD SetBounds (const nsRect &aRect)
NS_IMETHOD GetBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetBoundsAppUnits (nsRect &aRect, float aAppUnits)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetClientBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetBorderSize (PRInt32 &aWidth, PRInt32 &aHeight)
 Calculates the border width and height.
NS_IMETHOD Paint (nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect)
 Paints default border (XXX - this should be done by CSS)
NS_IMETHOD ScrollRect (nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
 Scroll an area of this widget.
NS_IMETHOD ScrollWidgets (PRInt32 aDx, PRInt32 aDy)
 Scroll the contents of the widget.
NS_IMETHOD EnableDragDrop (PRBool aEnable)
 Enables the dropping of files to a widget (XXX this is temporary)
NS_IMETHOD GetAttention (PRInt32 aCycleCount)
 Bring this window to the user's attention.
NS_IMETHOD GetLastInputEventTime (PRUint32 &aTime)
 Get the last user input event time in milliseconds.
NS_IMETHOD SetIcon (const nsAString &anIconSpec)
 Set the widget's icon.
virtual void ConvertToDeviceCoordinates (nscoord &aX, nscoord &aY)
virtual void FreeNativeData (void *data, PRUint32 aDataType)
nsIWidgetGetFirstChild () const
 Return the first child of this widget.
nsIWidgetGetLastChild () const
 Return the last child of this widget.
nsIWidgetGetNextSibling () const
 Return the next sibling of this widget.
void SetNextSibling (nsIWidget *aSibling)
 Set the next sibling of this widget.
nsIWidgetGetPrevSibling () const
 Return the previous sibling of this widget.
void SetPrevSibling (nsIWidget *aSibling)
 Set the previous sibling of this widget.

Protected Types

enum  {
  CREATE = 0x0101, CREATE_NATIVE, DESTROY, SET_FOCUS,
  SET_CURSOR, CREATE_HACK
}

Protected Member Functions

virtual void ResolveIconName (const nsAString &aIconName, const nsAString &aIconSuffix, nsILocalFile **aResult)
 Resolve the given icon name into a local file object.
virtual void DrawScaledRect (nsIRenderingContext &aRenderingContext, const nsRect &aRect, float aScale, float aAppUnits)
 Calculates the border width and height.
virtual void DrawScaledLine (nsIRenderingContext &aRenderingContext, nscoord aSX, nscoord aSY, nscoord aEX, nscoord aEY, float aScale, float aAppUnits, PRBool aIsHorz)
 Calculates the border width and height.
virtual void OnDestroy ()
virtual void BaseCreate (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData)

Protected Attributes

nsIWidgetmOffsetParent
PRBool mIsDialog
PRBool mIsResizing
PRBool mWindowMadeHere
NSWindow * mWindow
WindowDelegatemDelegate
PRBool mVisible
voidmClientData
EVENT_CALLBACK mEventCallback
nsIDeviceContextmContext
nsCOMPtr< nsIAppShellmAppShell
nsIToolkitmToolkit
nsIMouseListenermMouseListener
nsIEventListenermEventListener
nsIMenuListenermMenuListener
nscolor mBackground
nscolor mForeground
nsCursor mCursor
nsWindowType mWindowType
nsBorderStyle mBorderStyle
PRPackedBool mIsShiftDown
PRPackedBool mIsControlDown
PRPackedBool mIsAltDown
PRPackedBool mIsDestroying
PRPackedBool mOnDestroyCalled
nsRect mBounds
nsRectmOriginalBounds
PRInt32 mZIndex
nsSizeMode mSizeMode
nsCOMPtr< nsIWidgetmFirstChild
nsIWidgetmLastChild
nsCOMPtr< nsIWidgetmNextSibling
nsIWidgetmPrevSibling

Private Types

typedef nsBaseWidget Inherited

Detailed Description

Definition at line 73 of file nsCocoaWindow.h.


Member Typedef Documentation

- (typedef nsBaseWidget) Inherited [private]

Definition at line 76 of file nsCocoaWindow.h.


Member Enumeration Documentation

- (anonymous) enum
Enumerator:
kTitleBarHeight 

Definition at line 80 of file nsCocoaWindow.h.

{ kTitleBarHeight = 20 };
anonymous enum [protected, inherited]
Enumerator:
CREATE 
CREATE_NATIVE 
DESTROY 
SET_FOCUS 
SET_CURSOR 
CREATE_HACK 

Definition at line 186 of file nsBaseWidget.h.


Constructor & Destructor Documentation

- nsCocoaWindow:

Definition at line 275 of file nsCocoaWindow.mm.

: 
  mOffsetParent(nsnull)
, mIsDialog(PR_FALSE)
, mIsResizing(PR_FALSE)
, mWindowMadeHere(PR_FALSE)
, mWindow(nil)
{
#if 0
  mMacEventHandler.reset(new nsMacEventHandler(this));

  // create handlers for drag&drop
  mDragTrackingHandlerUPP = NewDragTrackingHandlerUPP(DragTrackingHandler);
  mDragReceiveHandlerUPP = NewDragReceiveHandlerUPP(DragReceiveHandler);
#endif
}
- nsCocoaWindow:

Definition at line 306 of file nsCocoaWindow.mm.

{
  if ( mWindow && mWindowMadeHere ) {
    [mWindow autorelease];
    [mDelegate autorelease];
  }
  
#if 0
  if (mWindowPtr)
  {
    if (mWindowMadeHere)
      ::DisposeWindow(mWindowPtr);
      
    // clean up DragManager stuff
    if ( mDragTrackingHandlerUPP ) {
      ::RemoveTrackingHandler ( mDragTrackingHandlerUPP, mWindowPtr );
      ::DisposeDragTrackingHandlerUPP ( mDragTrackingHandlerUPP );
     }
    if ( mDragReceiveHandlerUPP ) {
      ::RemoveReceiveHandler ( mDragReceiveHandlerUPP, mWindowPtr );
      ::DisposeDragReceiveHandlerUPP ( mDragReceiveHandlerUPP );
    }

    nsMacMessageSink::RemoveRaptorWindowFromList(mWindowPtr);
    mWindowPtr = nsnull;
  }
#endif
  
}

Member Function Documentation

void nsBaseWidget::AddChild ( nsIWidget aChild) [virtual, inherited]

Internal methods.

Implements nsIWidget.

Definition at line 284 of file nsBaseWidget.cpp.

{
  NS_PRECONDITION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
                  "aChild not properly removed from its old child list");
  
  if (!mFirstChild) {
    mFirstChild = mLastChild = aChild;
  } else {
    // append to the list
    NS_ASSERTION(mLastChild, "Bogus state");
    NS_ASSERTION(!mLastChild->GetNextSibling(), "Bogus state");
    mLastChild->SetNextSibling(aChild);
    aChild->SetPrevSibling(mLastChild);
    mLastChild = aChild;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::AddEventListener ( nsIEventListener aListener) [virtual, inherited]

Processes a mouse pressed event.

Implements nsIWidget.

Definition at line 718 of file nsBaseWidget.cpp.

{
  NS_PRECONDITION(mEventListener == nsnull, "Null mouse listener");
  NS_IF_RELEASE(mEventListener);
  NS_ADDREF(aListener);
  mEventListener = aListener;
  return NS_OK;
}

Here is the call graph for this function:

NS_METHOD nsBaseWidget::AddMenuListener ( nsIMenuListener aListener) [virtual, inherited]

Add a menu listener This interface should only be called by the menu services manager This will AddRef() the menu listener This will Release() a previously set menu listener.

Implements nsIWidget.

Definition at line 735 of file nsBaseWidget.cpp.

NS_METHOD nsBaseWidget::AddMouseListener ( nsIMouseListener aListener) [virtual, inherited]

Processes a mouse pressed event.

Implements nsIWidget.

Definition at line 705 of file nsBaseWidget.cpp.

{
  NS_PRECONDITION(mMouseListener == nsnull, "Null mouse listener");
  NS_IF_RELEASE(mMouseListener);
  NS_ADDREF(aListener);
  mMouseListener = aListener;
  return NS_OK;
}

Here is the call graph for this function:

void nsBaseWidget::BaseCreate ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell,
nsIToolkit aToolkit,
nsWidgetInitData aInitData 
) [protected, virtual, inherited]

Definition at line 130 of file nsBaseWidget.cpp.

{
  if (nsnull == mToolkit) {
    if (nsnull != aToolkit) {
      mToolkit = (nsIToolkit*)aToolkit;
      NS_ADDREF(mToolkit);
    }
    else {
      if (nsnull != aParent) {
        mToolkit = (nsIToolkit*)(aParent->GetToolkit()); // the call AddRef's, we don't have to
      }
      // it's some top level window with no toolkit passed in.
      // Create a default toolkit with the current thread
#if !defined(USE_TLS_FOR_TOOLKIT)
      else {
        static NS_DEFINE_CID(kToolkitCID, NS_TOOLKIT_CID);
        
        nsresult res;
        res = CallCreateInstance(kToolkitCID, &mToolkit);
        NS_ASSERTION(NS_SUCCEEDED(res), "Can not create a toolkit in nsBaseWidget::Create");
        if (mToolkit)
          mToolkit->Init(PR_GetCurrentThread());
      }
#else /* USE_TLS_FOR_TOOLKIT */
      else {
        nsresult rv;

        rv = NS_GetCurrentToolkit(&mToolkit);
      }
#endif /* USE_TLS_FOR_TOOLKIT */
    }
    
  }
  
  mAppShell = aAppShell;    // addrefs
  
  // save the event callback function
  mEventCallback = aHandleEventFunction;
  
  // keep a reference to the device context
  if (aContext) {
    mContext = aContext;
    NS_ADDREF(mContext);
  }
  else {
    nsresult  res;
    
    static NS_DEFINE_CID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
    
    res = CallCreateInstance(kDeviceContextCID, &mContext);

    if (NS_SUCCEEDED(res))
      mContext->Init(nsnull);
  }

  if (nsnull != aInitData) {
    PreCreateWidget(aInitData);
  }

  if (aParent) {
    aParent->AddChild(this);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

When adjustments are to made to a whole set of child widgets, call this before resizing/positioning the child windows to minimize repaints.

Must be followed by EndResizingChildren after child windows have been adjusted.

Implements nsIWidget.

Definition at line 152 of file nsCocoaWindow.h.

{ return NS_OK; }

Definition at line 1198 of file nsCocoaWindow.mm.

{
#if 0
  StPortSetter setOurPort(mWindowPtr);

  // calculate current window portbounds
  Rect windRect;
  ::GetWindowPortBounds(mWindowPtr, &windRect);
  ::LocalToGlobal((Point *)&windRect.top);
  ::LocalToGlobal((Point *)&windRect.bottom);

  // calculate window's borders on each side, these differ in Aqua / Platinum
  short wTitleHeight;
  short wLeftBorder;
  short wRightBorder;
  short wBottomBorder;
       
  RgnHandle structRgn = ::NewRgn();
  ::GetWindowRegion(mWindowPtr, kWindowStructureRgn, structRgn);
  Rect structRgnBounds;
  ::GetRegionBounds(structRgn, &structRgnBounds);
  wTitleHeight = windRect.top - structRgnBounds.top;
  wLeftBorder = windRect.left - structRgnBounds.left;
  wRightBorder =  structRgnBounds.right - windRect.right;
  wBottomBorder = structRgnBounds.bottom - windRect.bottom;

  ::DisposeRgn(structRgn);

  windRect.top -= wTitleHeight;
  windRect.bottom += wBottomBorder;
  windRect.right += wRightBorder;
  windRect.left -= wLeftBorder;

  // find which screen the window is (mostly) on and get its rect. GetAvailRect()
  // handles subtracting out the menubar and the dock for us. Set the zoom rect
  // to the screen rect, less some fudging and room for icons on the primary screen.
  nsCOMPtr<nsIScreenManager> screenMgr = do_GetService(sScreenManagerContractID);
  if ( screenMgr ) {
    nsCOMPtr<nsIScreen> screen;
    screenMgr->ScreenForRect ( windRect.left, windRect.top, windRect.right - windRect.left, windRect.bottom - windRect.top,
                                getter_AddRefs(screen) );
    if ( screen ) {
      nsRect newWindowRect;
      screen->GetAvailRect ( &newWindowRect.x, &newWindowRect.y, &newWindowRect.width, &newWindowRect.height );
      
      // leave room for icons on primary screen
      nsCOMPtr<nsIScreen> primaryScreen;
      screenMgr->GetPrimaryScreen ( getter_AddRefs(primaryScreen) );
      if (screen == primaryScreen) {
        int iconSpace = 96;
#if TARGET_CARBON
        iconSpace = 128;
#endif
        newWindowRect.width -= iconSpace;
      }

      Rect zoomRect;
      ::SetRect(&zoomRect,
                  newWindowRect.x + wLeftBorder,
                  newWindowRect.y + wTitleHeight,
                  newWindowRect.x + newWindowRect.width - wRightBorder,
                  newWindowRect.y + newWindowRect.height - wBottomBorder); 
      ::SetWindowStandardState ( mWindowPtr, &zoomRect );
    }
  }
#endif
  
} // CalculateAndSetZoomedSize

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::CaptureMouse ( PRBool  aCapture) [virtual, inherited]

Enables/Disables system mouse capture.

Parameters:
aCapturePR_TRUE enables mouse capture, PR_FALSE disables mouse capture

Implements nsIWidget.

Reimplemented in nsWindow, nsWidget, nsWidget, nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 200 of file nsBaseWidget.cpp.

{
  return NS_OK;
}
- (NS_IMETHOD) CaptureRollupEvents (nsIRollupListener *)  aListener
(PRBool aDoCapture
(PRBool aConsumeRollupEvent 

Enables/Disables system capture of any and all events that would cause a dropdown to be rolled up, This method ignores the aConsumeRollupEvent parameter when aDoCapture is FALSE.

Parameters:
aDoCapturePR_TRUE enables capture, PR_FALSE disables capture
aConsumeRollupEventPR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event

Implements nsIWidget.

Definition at line 157 of file nsCocoaWindow.h.

{ return NS_OK; }

Definition at line 1485 of file nsCocoaWindow.mm.

                                {
#if 0
  nsZLevelEvent  event(PR_TRUE, NS_SETZLEVEL, this);

  event.point.x = mBounds.x;
  event.point.y = mBounds.y;
  event.time = PR_IntervalNow();

  event.mImmediate = PR_TRUE;

  DispatchWindowEvent(event);
#endif
}

Here is the caller graph for this function:

- (NS_IMETHODIMP) ConstrainPosition (PRBool aAllowSlop
(PRInt32 *)  aX
(PRInt32 *)  aY 

Perform platform-dependent sanity check on a potential window position.

This is guaranteed to work only for top-level windows.

Parameters:
aAllowSlop,:if true, allow the window to slop offscreen; the window should be partially visible. if false, force the entire window onscreen (or at least the upper-left corner, if it's too large).
aXin: an x position expressed in screen coordinates. out: the x position constrained to fit on the screen(s).
aYin: an y position expressed in screen coordinates. out: the y position constrained to fit on the screen(s).
Returns:
vapid success indication. but see also the parameters.

Implements nsIWidget.

Definition at line 942 of file nsCocoaWindow.mm.

{
#if 0
  if (eWindowType_popup == mWindowType || !mWindowMadeHere)
    return NS_OK;

  // Sanity check against screen size
  // make sure the window stays visible

  // get the window bounds
  Rect portBounds;
  ::GetWindowPortBounds(mWindowPtr, &portBounds);
  short pos;
  short windowWidth = portBounds.right - portBounds.left;
  short windowHeight = portBounds.bottom - portBounds.top;

  // now get our playing field. use the current screen, or failing that for any reason,
  // the GrayRgn (which of course is arguably more correct but has drawbacks as well)
  Rect screenRect;
  nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
  if (screenmgr) {
    nsCOMPtr<nsIScreen> screen;
    PRInt32 left, top, width, height, fullHeight;

    // zero size rects can happen during window creation, and confuse
    // the screen manager
    width = windowWidth > 0 ? windowWidth : 1;
    height = windowHeight > 0 ? windowHeight : 1;
    screenmgr->ScreenForRect(*aX, *aY, width, height,
                            getter_AddRefs(screen));
    if (screen) {
      screen->GetAvailRect(&left, &top, &width, &height);
      screen->GetRect(&left, &top, &width, &fullHeight);
      screenRect.left = left;
      screenRect.right = left+width;
      screenRect.top = top;
      screenRect.bottom = top+height;
    }
  } else
    ::GetRegionBounds(::GetGrayRgn(), &screenRect);

  pos = screenRect.left;
  if (windowWidth > kWindowPositionSlop)
    pos -= windowWidth - kWindowPositionSlop;
  if (*aX < pos)
    *aX = pos;
  else if (*aX >= screenRect.right - kWindowPositionSlop)
    *aX = screenRect.right - kWindowPositionSlop;

  pos = screenRect.top;
  if (windowHeight > kWindowPositionSlop)
    pos -= windowHeight - kWindowPositionSlop;
  if (*aY < pos)
    *aY = pos;
  else if (*aY >= screenRect.bottom - kWindowPositionSlop)
    *aY = screenRect.bottom - kWindowPositionSlop;

#endif
  return NS_OK;
}

Here is the call graph for this function:

virtual void nsBaseWidget::ConvertToDeviceCoordinates ( nscoord aX,
nscoord aY 
) [inline, virtual, inherited]

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWindow, nsWidget, and nsWindow.

Definition at line 135 of file nsBaseWidget.h.

{}
- (NS_IMETHODIMP) Create (nsNativeWidget aParent
(const nsRect &)  aRect
(EVENT_CALLBACK)  aHandleEventFunction
(nsIDeviceContext *)  aContext
(nsIAppShell *)  aAppShell = nsnull
(nsIToolkit *)  aToolkit = nsnull
(nsWidgetInitData *)  aInitData = nsnull 

Create and initialize a widget with a native window parent.

The widget represents a window that can be drawn into. It also is the base class for user-interface widgets such as buttons and text boxes.

All the arguments can be NULL in which case a top level window with size 0 is created. The event callback function has to be provided only if the caller wants to deal with the events this widget receives. The event callback is basically a preprocess hook called synchronously. The return value determines whether the event goes to the default window procedure or it is hidden to the os. The assumption is that if the event handler returns false the widget does not see the event.

Parameters:
aParentnative window.
aRectthe widget dimension
aHandleEventFunctionthe event handler callback function

Implements nsIWidget.

Definition at line 760 of file nsCocoaWindow.mm.

{
  return(StandardCreate(nsnull, aRect, aHandleEventFunction,
                          aContext, aAppShell, aToolkit, aInitData,
                            aNativeParent));
}

Here is the call graph for this function:

- (NS_IMETHODIMP) Create (nsIWidget *)  aParent
(const nsRect &)  aRect
(EVENT_CALLBACK)  aHandleEventFunction
(nsIDeviceContext *)  aContext
(nsIAppShell *)  aAppShell = nsnull
(nsIToolkit *)  aToolkit = nsnull
(nsWidgetInitData *)  aInitData = nsnull 

Create and initialize a widget.

The widget represents a window that can be drawn into. It also is the base class for user-interface widgets such as buttons and text boxes.

All the arguments can be NULL in which case a top level window with size 0 is created. The event callback function has to be provided only if the caller wants to deal with the events this widget receives. The event callback is basically a preprocess hook called synchronously. The return value determines whether the event goes to the default window procedure or it is hidden to the os. The assumption is that if the event handler returns false the widget does not see the event. The widget should not automatically clear the window to the background color. The calling code must handle paint messages and clear the background itself.

aInitData cannot be eWindowType_popup here; popups cannot be hooked into the nsIWidget hierarchy.

Parameters:
parentor null if it's a top level window
aRectthe widget dimension
aHandleEventFunctionthe event handler callback function
aContext
aAppShellthe parent application shell. If nsnull, the parent window's application shell will be used.
aToolkit
aInitDatadata that is used for widget initialization

Implements nsIWidget.

Definition at line 774 of file nsCocoaWindow.mm.

{
  return(StandardCreate(aParent, aRect, aHandleEventFunction,
                          aContext, aAppShell, aToolkit, aInitData,
                            nsnull));
}

Here is the call graph for this function:

NS_METHOD nsBaseWidget::Destroy ( ) [virtual, inherited]

Close and destroy the internal native window.

This method does not delete the widget.

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWindow, nsWidget, nsWidget, nsWindow, nsWidget, nsNativeScrollbar, and nsMacControl.

Definition at line 238 of file nsBaseWidget.cpp.

{
  // Just in case our parent is the only ref to us
  nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
  
  // disconnect from the parent
  nsIWidget *parent = GetParent();
  if (parent) {
    parent->RemoveChild(this);
    NS_RELEASE(parent);
  }
  // disconnect listeners.
  NS_IF_RELEASE(mMouseListener);
  NS_IF_RELEASE(mEventListener);
  NS_IF_RELEASE(mMenuListener);

  return NS_OK;
}

Here is the call graph for this function:

- (NS_IMETHODIMP) DispatchEvent (nsGUIEvent *)  event
(nsEventStatus &)  aStatus 

Dispatches an event to the widget.

  

Implements nsIWidget.

Definition at line 1602 of file nsCocoaWindow.mm.

{
  aStatus = nsEventStatus_eIgnore;

  nsIWidget* aWidget = event->widget;
  NS_IF_ADDREF(aWidget);
  
  if (nsnull != mMenuListener){
    if(NS_MENU_EVENT == event->eventStructType)
      aStatus = mMenuListener->MenuSelected( static_cast<nsMenuEvent&>(*event) );
  }
  if (mEventCallback)
    aStatus = (*mEventCallback)(event);

  // Dispatch to event listener if event was not consumed
  if ((aStatus != nsEventStatus_eConsumeNoDefault) && (mEventListener != nsnull))
    aStatus = mEventListener->ProcessEvent(*event);

  NS_IF_RELEASE(aWidget);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (PRBool) DragEvent (unsigned int aMessage
(Point)  aMouseGlobal
(UInt16 aKeyModifiers 

Definition at line 1467 of file nsCocoaWindow.mm.

{
#if 0
  PRBool retVal;
  if (mMacEventHandler.get())
    retVal = mMacEventHandler->DragEvent(aMessage, aMouseGlobal, aKeyModifiers);
  else
    retVal = PR_FALSE;
  return retVal;
#endif
  return PR_FALSE;
}
void nsBaseWidget::DrawScaledLine ( nsIRenderingContext aRenderingContext,
nscoord  aSX,
nscoord  aSY,
nscoord  aEX,
nscoord  aEY,
float  aScale,
float  aAppUnits,
PRBool  aIsHorz 
) [protected, virtual, inherited]

Calculates the border width and height.

Definition at line 850 of file nsBaseWidget.cpp.

{
  float sx = (float)aSX;
  float sy = (float)aSY;
  float ex = (float)aEX;
  float ey = (float)aEY;

  for (int i=0;i<int(aScale);i++) {
    aSX = nscoord(sx);
    aSY = nscoord(sy);
    aEX = nscoord(ex);
    aEY = nscoord(ey);
    aRenderingContext.DrawLine(aSX, aSY, aEX, aEY);
    if (aIsHorz) {
      sy += aAppUnits; 
      ey += aAppUnits;
    } else {
      sx += aAppUnits; 
      ex += aAppUnits;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBaseWidget::DrawScaledRect ( nsIRenderingContext aRenderingContext,
const nsRect aRect,
float  aScale,
float  aAppUnits 
) [protected, virtual, inherited]

Calculates the border width and height.

Definition at line 823 of file nsBaseWidget.cpp.

{
  nsRect rect = aRect;

  float x = (float)rect.x;
  float y = (float)rect.y;
  float w = (float)rect.width;
  float h = (float)rect.height;
  float twoAppUnits = aAppUnits * 2.0f;

  for (int i=0;i<int(aScale);i++) {
    rect.x      = nscoord(x);
    rect.y      = nscoord(y);
    rect.width  = nscoord(w);
    rect.height = nscoord(h);
    aRenderingContext.DrawRect(rect);
    x += aAppUnits; 
    y += aAppUnits;
    w -= twoAppUnits; 
    h -= twoAppUnits;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (NS_IMETHODIMP) Enable (PRBool aState

Enable or disable this Widget.

Parameters:
aStatePR_TRUE to enable the Widget, PR_FALSE to disable it.

Implements nsIWidget.

Definition at line 911 of file nsCocoaWindow.mm.

{
  return NS_OK;
}
NS_METHOD nsBaseWidget::EnableDragDrop ( PRBool  aEnable) [virtual, inherited]

Enables the dropping of files to a widget (XXX this is temporary)

  

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 915 of file nsBaseWidget.cpp.

{
  return NS_OK;
}

Call this when finished adjusting child windows.

Must be preceded by BeginResizingChildren.

Implements nsIWidget.

Definition at line 153 of file nsCocoaWindow.h.

{ return NS_OK; }
virtual void nsBaseWidget::FreeNativeData ( void data,
PRUint32  aDataType 
) [inline, virtual, inherited]

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 136 of file nsBaseWidget.h.

{}//~~~
nsIAppShell * nsBaseWidget::GetAppShell ( ) [virtual, inherited]

Implements nsIWidget.

Definition at line 663 of file nsBaseWidget.cpp.

{
  nsIAppShell*  theAppShell = mAppShell;
  NS_IF_ADDREF(theAppShell);
  return theAppShell;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::GetAttention ( PRInt32  aCycleCount) [virtual, inherited]

Bring this window to the user's attention.

This is intended to be a more gentle notification than popping the window to the top or putting up an alert. See, for example, Win32 FlashWindow or the NotificationManager on the Mac. The notification should be suppressed if the window is already in the foreground and should be dismissed when the user brings this window to the foreground.

Parameters:
aCycleCountMaximum number of times to animate the window per system conventions. If set to -1, cycles indefinitely until window is brought into the foreground.

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 934 of file nsBaseWidget.cpp.

                                              {
    return NS_OK;
}
nscolor nsBaseWidget::GetBackgroundColor ( void  ) [virtual, inherited]

Get the background color for this widget.

Returns:
this widget's background color

Implements nsIWidget.

Definition at line 461 of file nsBaseWidget.cpp.

{
  return mBackground;
}

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::GetBorderSize ( PRInt32 aWidth,
PRInt32 aHeight 
) [virtual, inherited]

Calculates the border width and height.

Implements nsIWidget.

Definition at line 805 of file nsBaseWidget.cpp.

{
  nsRect rectWin;
  nsRect rect;
  GetBounds(rectWin);
  GetClientBounds(rect);

  aWidth  = (rectWin.width - rect.width) / 2;
  aHeight = (rectWin.height - rect.height) / 2;

  return NS_OK;
}

Here is the call graph for this function:

NS_METHOD nsBaseWidget::GetBounds ( nsRect aRect) [virtual, inherited]

If the implementation of nsWindow supports borders this method MUST be overridden.

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, nsWindow, nsLabel, nsLabel, nsTextWidget, and nsTextWidget.

Definition at line 757 of file nsBaseWidget.cpp.

{
  aRect = mBounds;
  return NS_OK;
}

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::GetBoundsAppUnits ( nsRect aRect,
float  aAppUnits 
) [inherited]

If the implementation of nsWindow supports borders this method MUST be overridden.

Definition at line 777 of file nsBaseWidget.cpp.

{
  aRect = mBounds;
  // Convert to twips
  aRect.x      = nscoord((PRFloat64)aRect.x * aAppUnits);
  aRect.y      = nscoord((PRFloat64)aRect.y * aAppUnits);
  aRect.width  = nscoord((PRFloat64)aRect.width * aAppUnits); 
  aRect.height = nscoord((PRFloat64)aRect.height * aAppUnits);
  return NS_OK;
}

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::GetClientBounds ( nsRect aRect) [virtual, inherited]

If the implementation of nsWindow supports borders this method MUST be overridden.

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsFrameWindow.

Definition at line 748 of file nsBaseWidget.cpp.

{
  return GetBounds(aRect);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::GetClientData ( void *&  aClientData) [virtual, inherited]

Accessor functions to get and set the client data associated with the widget.

Implements nsIWidget.

Definition at line 221 of file nsBaseWidget.cpp.

{
  aClientData = mClientData;
  return NS_OK;
}
nsCursor nsBaseWidget::GetCursor ( ) [virtual, inherited]

Get the cursor for this widget.

Returns:
this widget's cursor.

Implements nsIWidget.

Reimplemented in nsCommonWidget.

Definition at line 482 of file nsBaseWidget.cpp.

{
  return mCursor;
}

Here is the caller graph for this function:

Implements nsIWidget.

Definition at line 651 of file nsBaseWidget.cpp.

Here is the caller graph for this function:

nsIWidget* nsIWidget::GetFirstChild ( ) const [inline, inherited]

Return the first child of this widget.

Will return null if there are no children.

Definition at line 374 of file nsIWidget.h.

                                     {
        return mFirstChild;
    }

Here is the caller graph for this function:

- (virtual nsIFontMetrics*) GetFont (void

Get the font for this widget.

Returns:
the font metrics

Implements nsIWidget.

Definition at line 145 of file nsCocoaWindow.h.

{ return nsnull; }
nscolor nsBaseWidget::GetForegroundColor ( void  ) [virtual, inherited]

Get the foreground color for this widget.

Returns:
this widget's foreground color

Implements nsIWidget.

Definition at line 438 of file nsBaseWidget.cpp.

{
  return mForeground;
}

Here is the caller graph for this function:

nsIWidget* nsIWidget::GetLastChild ( ) const [inline, inherited]

Return the last child of this widget.

Will return null if there are no children.

Definition at line 382 of file nsIWidget.h.

                                    {
        return mLastChild;
    }
NS_IMETHODIMP nsBaseWidget::GetLastInputEventTime ( PRUint32 aTime) [virtual, inherited]

Get the last user input event time in milliseconds.

If there are any pending native toolkit input events it returns the current time. All input events are included (ie. it is not limited to events targeted at this nsIWidget instance.

Parameters:
aTimeLast user input time in milliseconds. This value can be used to compare durations but can not be used for determining wall clock time. The value returned is platform dependent, but is compatible with the expression PR_IntervalToMicroseconds(PR_IntervalNow()).

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 939 of file nsBaseWidget.cpp.

- (void *) GetNativeData (PRUint32 aDataType

Implements nsIWidget.

Definition at line 789 of file nsCocoaWindow.mm.

{
  void* retVal = nsnull;
  
  switch ( aDataType ) {
    
    // to emulate how windows works, we always have to return a NSView
    // for NS_NATIVE_WIDGET
    case NS_NATIVE_WIDGET:
    case NS_NATIVE_DISPLAY:
      retVal = [mWindow contentView];
      break;
      
    case NS_NATIVE_WINDOW:  
      retVal = mWindow;
      break;
      
    case NS_NATIVE_GRAPHIC:          // quickdraw port of top view (for now)
      retVal = [[mWindow contentView] qdPort];
      break;
      
#if 0
    case NS_NATIVE_REGION:
    retVal = (void*)mVisRegion;
      break;

    case NS_NATIVE_COLORMAP:
      //ĄTODO
      break;

    case NS_NATIVE_OFFSETX:
      point.MoveTo(mBounds.x, mBounds.y);
      LocalToWindowCoordinate(point);
      retVal = (void*)point.x;
      break;

    case NS_NATIVE_OFFSETY:
      point.MoveTo(mBounds.x, mBounds.y);
      LocalToWindowCoordinate(point);
      retVal = (void*)point.y;
      break;
    
    case NS_NATIVE_PLUGIN_PORT:
      // this needs to be a combination of the port and the offsets.
      if (mPluginPort == nsnull)
        mPluginPort = new nsPluginPort;
      
      point.MoveTo(mBounds.x, mBounds.y);
      LocalToWindowCoordinate(point);
      
      // for compatibility with 4.X, this origin is what you'd pass
      // to SetOrigin.
      mPluginPort->port = ::GetWindowPort(mWindowPtr);
      mPluginPort->portx = -point.x;
      mPluginPort->porty = -point.y;
    
      retVal = (void*)mPluginPort;
      break;
#endif
  }

  return retVal;
}

Here is the call graph for this function:

nsIWidget* nsIWidget::GetNextSibling ( ) const [inline, inherited]

Return the next sibling of this widget.

Definition at line 389 of file nsIWidget.h.

                                      {
        return mNextSibling;
    }

Here is the caller graph for this function:

nsIWidget * nsBaseWidget::GetParent ( void  ) [virtual, inherited]

Return the parent Widget of this Widget or nsnull if this is a top level window.

Returns:
the parent widget or nsnull if it does not have a parent

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsWidget, nsWidget, and nsCommonWidget.

Definition at line 274 of file nsBaseWidget.cpp.

{
  return nsnull;
}

Here is the caller graph for this function:

- (NS_IMETHOD) GetPreferredSize (PRInt32 &)  aWidth
(PRInt32 &)  aHeight 

Returns the preferred width and height for the widget.

  

Implements nsIWidget.

Definition at line 154 of file nsCocoaWindow.h.

{ return NS_OK; }
nsIWidget* nsIWidget::GetPrevSibling ( ) const [inline, inherited]

Return the previous sibling of this widget.

Definition at line 403 of file nsIWidget.h.

                                      {
        return mPrevSibling;
    }

Here is the caller graph for this function:

Implements nsIWidget.

Definition at line 605 of file nsBaseWidget.cpp.

{
  nsresult                      rv;
  nsCOMPtr<nsIRenderingContext> renderingCtx;

  if (mOnDestroyCalled)
    return nsnull;

  rv = mContext->CreateRenderingContextInstance(*getter_AddRefs(renderingCtx));
  if (NS_SUCCEEDED(rv)) {
    rv = renderingCtx->Init(mContext, this);
    if (NS_SUCCEEDED(rv)) {
      nsIRenderingContext *ret = renderingCtx;
      /* Increment object refcount that the |ret| object is still a valid one
       * after we leave this function... */
      NS_ADDREF(ret);
      return ret;
    }
    else {
      NS_WARNING("GetRenderingContext: nsIRenderingContext::Init() failed.");
    }  
  }
  else {
    NS_WARNING("GetRenderingContext: Cannot create RenderingContext.");
  }  
  
  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

If the implementation of nsWindow uses a local coordinate system within the window, this method must be overridden.

Reimplemented from nsBaseWidget.

Definition at line 1400 of file nsCocoaWindow.mm.

                                                          {
#if 0 
  nsRect localBounds;
  PRInt32 yAdjust = 0;

  GetBounds(localBounds);
  // nsCocoaWindow local bounds are always supposed to be local (0,0) but in the middle of a move
  // can be global. This next adjustment assures they are in local coordinates, even then.
  localBounds.MoveBy(-localBounds.x, -localBounds.y);
  WidgetToScreen(localBounds, aRect);

  nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
  if (screenmgr) {
    nsCOMPtr<nsIScreen> screen;
    //screenmgr->GetPrimaryScreen(getter_AddRefs(screen));
    screenmgr->ScreenForRect(aRect.x, aRect.y, aRect.width, aRect.height,
                             getter_AddRefs(screen));
    if (screen) {
      PRInt32 left, top, width, height, fullTop;
      screen->GetAvailRect(&left, &top, &width, &height);
      screen->GetRect(&left, &fullTop, &width, &height);
      yAdjust = top-fullTop;
    }
  }
 
  if (mIsDialog)
    aRect.MoveBy(-kDialogMarginWidth, -kDialogTitleBarHeight-yAdjust);
  else
    aRect.MoveBy(-kWindowMarginWidth, -kWindowTitleBarHeight-yAdjust);

#endif
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBaseWidget::GetSizeMode ( PRInt32 aMode) [virtual, inherited]

Return size mode (minimized, maximized, normalized).

Returns a value from nsSizeMode (see nsGUIEvent.h)

Implements nsIWidget.

Definition at line 427 of file nsBaseWidget.cpp.

                                                      {

  *aMode = mSizeMode;
  return NS_OK;
}

Here is the caller graph for this function:

nsIToolkit * nsBaseWidget::GetToolkit ( ) [virtual, inherited]

Return the widget's toolkit.

Returns:
the toolkit this widget was created in. See nsToolkit.

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 639 of file nsBaseWidget.cpp.

NS_METHOD nsBaseWidget::GetWindowClass ( char *  aClass) [virtual, inherited]

Gets the window class implemented in gtk.

Implements nsIWidget.

Reimplemented in nsWidget.

Definition at line 684 of file nsBaseWidget.cpp.

NS_IMETHODIMP nsBaseWidget::GetWindowTranslucency ( PRBool aTranslucent) [virtual, inherited]

Get the translucency of the top-level window that contains this widget.

Parameters:
aTranslucenttrue if the window may have translucent or transparent pixels

Implements nsIWidget.

Definition at line 526 of file nsBaseWidget.cpp.

                                                                      {
  aTranslucent = PR_FALSE;
  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::GetWindowType ( nsWindowType aWindowType) [virtual, inherited]

Get the window type of this widget.

Parameters:
aWindowTypethe window type of the widget

Implements nsIWidget.

Definition at line 504 of file nsBaseWidget.cpp.

{
  aWindowType = mWindowType;
  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::GetZIndex ( PRInt32 aZIndex) [virtual, inherited]

Gets the widget's z-index.

Implements nsIWidget.

Definition at line 388 of file nsBaseWidget.cpp.

{
  *aZIndex = mZIndex;
  return NS_OK;
}
NS_IMETHODIMP nsBaseWidget::HideWindowChrome ( PRBool  aShouldHide) [virtual, inherited]

Hide window chrome (borders, buttons) for this widget.

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 541 of file nsBaseWidget.cpp.

Here is the caller graph for this function:

- (NS_IMETHOD) Invalidate (const nsRect &)  aRect
(PRBool aIsSynchronous 

Invalidate a specified rect for a widget and repaints it.

Parameters:
aIsSynchronousePR_TRUE then repaint synchronously. If PR_FALSE repaint later.
See also:
- Update

Implements nsIWidget.

Definition at line 147 of file nsCocoaWindow.h.

{ return NS_OK; }
- (NS_IMETHOD) Invalidate (PRBool aIsSynchronous

Invalidate the widget and repaint it.

Parameters:
aIsSynchronousPR_TRUE then repaint synchronously. If PR_FALSE repaint later.
See also:
- Update

Implements nsIWidget.

Definition at line 148 of file nsCocoaWindow.h.

{ return NS_OK; };
NS_IMETHODIMP nsBaseWidget::InvalidateRegion ( const nsIRegion aRegion,
PRBool  aIsSynchronous 
) [virtual, inherited]

Invalidate a specified region for a widget and repaints it.

Parameters:
aIsSynchronousePR_TRUE then repaint synchronously. If PR_FALSE repaint later.
See also:
Update()

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWidget, nsWindow, nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 210 of file nsBaseWidget.cpp.

{
  return NS_ERROR_FAILURE;
}
- (void) IsActive (PRBool *)  aActive

Definition at line 1511 of file nsCocoaWindow.mm.

{
//  *aActive = mIsActive;
}
- (NS_IMETHODIMP) IsEnabled (PRBool *)  aState

Ask whether the widget is enabled.

Parameters:
aStatereturns PR_TRUE if the widget is enabled

Implements nsIWidget.

Definition at line 917 of file nsCocoaWindow.mm.

{
  if (aState)
    *aState = PR_TRUE;
  return NS_OK;
}
- (PRBool) IsResizing const

Definition at line 163 of file nsCocoaWindow.h.

{ return mIsResizing; }

Here is the caller graph for this function:

- (NS_IMETHODIMP) IsVisible (PRBool &)  aState

Returns whether the window is visible.

  

Implements nsIWidget.

Definition at line 854 of file nsCocoaWindow.mm.

{
  aState = mVisible;
  return NS_OK;
}
NS_IMETHODIMP nsBaseWidget::MakeFullScreen ( PRBool  aFullScreen) [virtual, inherited]

Put the toplevel window into or out of fullscreen mode.

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 551 of file nsBaseWidget.cpp.

{
  HideWindowChrome(aFullScreen);
  return MakeFullScreenInternal(aFullScreen);
}

Here is the call graph for this function:

Definition at line 557 of file nsBaseWidget.cpp.

{
  nsCOMPtr<nsIFullScreen> fullScreen = do_GetService("@mozilla.org/browser/fullscreen;1");

  if (aFullScreen) {
    if (!mOriginalBounds)
      mOriginalBounds = new nsRect();
    GetScreenBounds(*mOriginalBounds);

    // Move to top-left corner of screen and size to the screen dimensions
    nsCOMPtr<nsIScreenManager> screenManager;
    screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1"); 
    NS_ASSERTION(screenManager, "Unable to grab screenManager.");
    if (screenManager) {
      nsCOMPtr<nsIScreen> screen;
      screenManager->ScreenForRect(mOriginalBounds->x, mOriginalBounds->y,
                                   mOriginalBounds->width, mOriginalBounds->height,
                                   getter_AddRefs(screen));
      if (screen) {
        PRInt32 left, top, width, height;
        if (NS_SUCCEEDED(screen->GetRect(&left, &top, &width, &height))) {
          SetSizeMode(nsSizeMode_Normal);
          Resize(left, top, width, height, PR_TRUE);
    
          // Hide all of the OS chrome
          if (fullScreen)
            fullScreen->HideAllOSChrome();
        }
      }
    }

  } else if (mOriginalBounds) {
    Resize(mOriginalBounds->x, mOriginalBounds->y, mOriginalBounds->width,
           mOriginalBounds->height, PR_TRUE);

    // Show all of the OS chrome
    if (fullScreen)
      fullScreen->ShowAllOSChrome();
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::ModalEventFilter ( PRBool  aRealEvent,
void aEvent,
PRBool aForWindow 
) [virtual, inherited]

Determine whether a given event should be processed assuming we are the currently active modal window.

Note that the exact semantics of this method are platform-dependent. The Macintosh, for instance, cares deeply that this method do exactly as advertised. Gtk, for instance, handles modality in a completely different fashion and does little if anything with this method.

Parameters:
aRealEventevent is real or a null placeholder (Macintosh)
aEventvoid pointer to native event structure
aForWindowreturn value. PR_TRUE iff event should be processed.

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, nsWindow, and nsWindow.

Definition at line 926 of file nsBaseWidget.cpp.

{
  *aForWindow = PR_TRUE;
  return NS_OK;
}
- (NS_IMETHODIMP) Move (PRInt32 aX
(PRInt32 aY 

Move this widget.

Parameters:
aXthe new x position expressed in the parent's coordinate system
aYthe new y position expressed in the parent's coordinate system

Implements nsIWidget.

Definition at line 1012 of file nsCocoaWindow.mm.

{  
  if ( mWindow ) {  
    // if we're a popup, we have to convert from our parent widget's coord
    // system to the global coord system first because the (x,y) we're given
    // is in its coordinate system.
    if ( mWindowType == eWindowType_popup ) {
      nsRect localRect, globalRect; 
      localRect.x = aX;
      localRect.y = aY;  
      if ( mOffsetParent ) {
        mOffsetParent->WidgetToScreen(localRect,globalRect);
        aX=globalRect.x;
        aY=globalRect.y;
     }
    }
    
    NSPoint coord = {aX, aY};
    //coord = [mWindow convertBaseToScreen:coord];
//printf("moving to %d %d. screen coords %f %f\n", aX, aY, coord.x, coord.y);

 //FIXME -- ensure it's on the screen. Cocoa automatically corrects for windows
 //   with title bars, but for other windows, we have to do this...
 
    // the point we have assumes that the screen origin is the top-left. Well,
    // it's not. Use the screen object to convert.
    //FIXME -- doesn't work on monitors other than primary
    NSRect screenRect = [[NSScreen mainScreen] frame];
    coord.y = (screenRect.origin.y + screenRect.size.height) - coord.y;
//printf("final coords %f %f\n", coord.x, coord.y);
//printf("- window coords before %f %f\n", [mWindow frame].origin.x, [mWindow frame].origin.y);
    [mWindow setFrameTopLeftPoint:coord];
//printf("- window coords after %f %f\n", [mWindow frame].origin.x, [mWindow frame].origin.y);
  }
  
#if 0
  StPortSetter setOurPortForLocalToGlobal ( mWindowPtr );
  
  if (eWindowType_popup == mWindowType) {
    PRInt32 xOffset=0,yOffset=0;
    nsRect  localRect,globalRect;

    // convert to screen coordinates
    localRect.x = aX;
    localRect.y = aY;
    localRect.width = 100;
    localRect.height = 100; 

    if ( mOffsetParent ) {
      mOffsetParent->WidgetToScreen(localRect,globalRect);
      aX=globalRect.x;
      aY=globalRect.y;
      
      // there is a bug on OSX where if we call ::MoveWindow() with the same
      // coordinates (within a pixel or two) as a window's current location, it will 
      // move to (0,0,-1,-1). The fix is to not move the window if we're already
      // there. (radar# 2669004)
#if TARGET_CARBON
      const PRInt32 kMoveThreshold = 2;
#else
      const PRInt32 kMoveThreshold = 0;
#endif
      Rect currBounds;
      ::GetWindowBounds ( mWindowPtr, kWindowGlobalPortRgn, &currBounds );
      if ( abs(currBounds.left-aX) > kMoveThreshold || abs(currBounds.top-aY) > kMoveThreshold ) {
        ::MoveWindow(mWindowPtr, aX, aY, false);
        
        Rect newBounds;
        ::GetWindowBounds ( mWindowPtr, kWindowGlobalPortRgn, &newBounds );
      }  
    }

    return NS_OK;
  } else if (mWindowMadeHere) {
    Rect portBounds;
    ::GetWindowPortBounds(mWindowPtr, &portBounds);

    if (mIsDialog) {
      aX += kDialogMarginWidth;
      aY += kDialogTitleBarHeight;
    } else {
      aX += kWindowMarginWidth;
      aY += kWindowTitleBarHeight;
    }

    nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
    if (screenmgr) {
      nsCOMPtr<nsIScreen> screen;
      PRInt32 left, top, width, height, fullTop;
      // adjust for unset bounds, which confuses the screen manager
      width = portBounds.right - portBounds.left;
      height = portBounds.bottom - portBounds.top;
      if (height <= 0) height = 1;
      if (width <= 0) width = 1;

      screenmgr->ScreenForRect(aX, aY, width, height,
                               getter_AddRefs(screen));
      if (screen) {
        screen->GetAvailRect(&left, &top, &width, &height);
        screen->GetRect(&left, &fullTop, &width, &height);
        aY += top-fullTop;
      }
    }

    // move the window if it has not been moved yet
    // (ie. if this function isn't called in response to a DragWindow event)
    Point macPoint = topLeft(portBounds);
    ::LocalToGlobal(&macPoint);
    if (macPoint.h != aX || macPoint.v != aY)
      ::MoveWindow(mWindowPtr, aX, aY, false);

    // propagate the event in global coordinates
    Inherited::Move(aX, aY);

    // reset the coordinates to (0,0) because it's the top level widget
    mBounds.x = 0;
    mBounds.y = 0;
  }
#endif
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) MoveToGlobalPoint (PRInt32 aX
(PRInt32 aY 

Definition at line 1278 of file nsCocoaWindow.mm.

{
#if 0
  PRInt32 left, top, width, height, fullTop;
  Rect portBounds;

  StPortSetter doThatThingYouDo(mWindowPtr);
  ::GetWindowPortBounds(mWindowPtr, &portBounds);

  width = portBounds.right - portBounds.left;
  height = portBounds.bottom - portBounds.top;
  ::LocalToGlobal(&topLeft(portBounds));

  nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
  if (screenmgr) {
    nsCOMPtr<nsIScreen> screen;
    //screenmgr->GetPrimaryScreen(getter_AddRefs(screen));
    screenmgr->ScreenForRect(portBounds.left, portBounds.top, width, height,
                             getter_AddRefs(screen));
    if (screen) {
      screen->GetAvailRect(&left, &top, &width, &height);
      screen->GetRect(&left, &fullTop, &width, &height);
      aY -= top-fullTop;
    }
  }

  if (mIsDialog) {
    aX -= kDialogMarginWidth;
    aY -= kDialogTitleBarHeight;
  } else {
    aX -= kWindowMarginWidth;
    aY -= kWindowTitleBarHeight;
  }
  Move(aX, aY);
#endif
}

Here is the call graph for this function:

void nsBaseWidget::OnDestroy ( void  ) [protected, virtual, inherited]

Reimplemented in nsWindow, nsWindow, nsWindow, nsWidget, nsCommonWidget, nsWidget, and nsWidget.

Definition at line 676 of file nsBaseWidget.cpp.

{
  // release references to device context, toolkit, and app shell
  NS_IF_RELEASE(mContext);
  NS_IF_RELEASE(mToolkit);
  mAppShell = nsnull;     // clear out nsCOMPtr
}

Here is the caller graph for this function:

- (PRBool) OnPaint (nsPaintEvent &)  event

Definition at line 1438 of file nsCocoaWindow.mm.

{
  return PR_TRUE; // don't dispatch the update event
}
NS_METHOD nsBaseWidget::Paint ( nsIRenderingContext aRenderingContext,
const nsRect aDirtyRect 
) [virtual, inherited]

Paints default border (XXX - this should be done by CSS)

Implements nsIWidget.

Reimplemented in nsCheckButton, nsTextWidget, nsCheckButton, nsButton, nsTextWidget, nsButton, nsCheckButton, nsButton, and nsTextWidget.

Definition at line 884 of file nsBaseWidget.cpp.

{
  nsRect rect;
  float  appUnits;
  float  scale;
  nsIDeviceContext * context;
  aRenderingContext.GetDeviceContext(context);

  context->GetCanonicalPixelScale(scale);
  appUnits = context->DevUnitsToAppUnits();

  GetBoundsAppUnits(rect, appUnits);
  aRenderingContext.SetColor(NS_RGB(0,0,0));

  DrawScaledRect(aRenderingContext, rect, scale, appUnits);

  NS_RELEASE(context);
  return NS_OK;
}

Here is the call graph for this function:

- (NS_METHOD) PlaceBehind (nsTopLevelWidgetZPlacement aPlacement
(nsIWidget *)  aWidget
(PRBool aActivate 

Position this widget just behind the given widget.

(Used to control z-order for top-level widgets. Get/SetZIndex by contrast control z-order for child widgets of other widgets.)

Parameters:
aPlacementtop, bottom, or below a widget (if top or bottom, param aWidget is ignored)
aWidgetwidget to place this widget behind (only if aPlacement is eZPlacementBelow). null is equivalent to aPlacement of eZPlacementTop
aActivatetrue to activate the widget after placing it

Reimplemented from nsBaseWidget.

Definition at line 1139 of file nsCocoaWindow.mm.

{
#if 0
  if (aWidget) {
    WindowPtr behind = (WindowPtr)aWidget->GetNativeData(NS_NATIVE_DISPLAY);
    ::SendBehind(mWindowPtr, behind);
    ::HiliteWindow(mWindowPtr, FALSE);
  } else {
    if (::FrontWindow() != mWindowPtr)
      ::SelectWindow(mWindowPtr);
  }
#endif
  return NS_OK;
}

Here is the call graph for this function:

NS_DECL_ISUPPORTS NS_IMETHOD nsBaseWidget::PreCreateWidget ( nsWidgetInitData aWidgetInitData) [inline, inherited]

Reimplemented in nsWindow, nsWidget, nsWindow, nsWindow, nsLabel, nsLabel, nsWindow, nsTextHelper, nsTextHelper, nsTextHelper, nsLabel, nsLabel, nsTextHelper, and nsWindow.

Definition at line 71 of file nsBaseWidget.h.

{ return NS_OK;}

Here is the caller graph for this function:

void nsBaseWidget::RemoveChild ( nsIWidget aChild) [virtual, inherited]

Implements nsIWidget.

Definition at line 307 of file nsBaseWidget.cpp.

{
  NS_ASSERTION(nsCOMPtr<nsIWidget>(dont_AddRef(aChild->GetParent())) ==
                 NS_STATIC_CAST(nsIWidget*, this),
               "Not one of our kids!");
  
  if (mLastChild == aChild) {
    mLastChild = mLastChild->GetPrevSibling();
  }
  if (mFirstChild == aChild) {
    mFirstChild = mFirstChild->GetNextSibling();
  }

  // Now remove from the list.  Make sure that we pass ownership of the tail
  // of the list correctly before we have aChild let go of it.
  nsIWidget* prev = aChild->GetPrevSibling();
  nsIWidget* next = aChild->GetNextSibling();
  if (prev) {
    prev->SetNextSibling(next);
  }
  if (next) {
    next->SetPrevSibling(prev);
  }
  
  aChild->SetNextSibling(nsnull);
  aChild->SetPrevSibling(nsnull);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1627 of file nsCocoaWindow.mm.

{
  // nsEvent
  nsSizeEvent sizeEvent(PR_TRUE, NS_SIZE, this);
  sizeEvent.time        = PR_IntervalNow();

  // nsSizeEvent
  sizeEvent.windowSize  = &mBounds;
  sizeEvent.mWinWidth   = mBounds.width;
  sizeEvent.mWinHeight  = mBounds.height;
  
  // dispatch event
  nsEventStatus status = nsEventStatus_eIgnore;
  DispatchEvent(&sizeEvent, status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1500 of file nsCocoaWindow.mm.

{
//  return mMacEventHandler->ResetInputState();
  return NS_OK;
}
- (NS_IMETHODIMP) Resize (PRInt32 aWidth
(PRInt32 aHeight
(PRBool aRepaint 

Resize this widget.

Parameters:
aWidththe new width expressed in the parent's coordinate system
aHeightthe new height expressed in the parent's coordinate system
aRepaintwhether the widget should be repainted

Implements nsIWidget.

Definition at line 1329 of file nsCocoaWindow.mm.

{
  if ( mWindow ) {
    NSRect newBounds = [mWindow frame];
    newBounds.size.width = aWidth;
    if ( mWindowType == eWindowType_popup )
      newBounds.size.height = aHeight;
    else
      newBounds.size.height = aHeight + kTitleBarHeight;     // add height of title bar
    StartResizing();
    [mWindow setFrame:newBounds display:NO];
    StopResizing();
  }

  mBounds.width  = aWidth;
  mBounds.height = aHeight;
  
  // tell gecko to update all the child widgets
  ReportSizeEvent();
  
#if 0
  if (mWindowMadeHere) {
      // Sanity check against screen size
      Rect screenRect;
    ::GetRegionBounds(::GetGrayRgn(), &screenRect);

      // Need to use non-negative coordinates
      PRInt32 screenWidth;
      if(screenRect.left < 0)
        screenWidth = screenRect.right - screenRect.left;
      else
        screenWidth = screenRect.right;
        
      PRInt32 screenHeight;
      if(screenRect.top < 0)
        screenHeight = screenRect.bottom - screenRect.top;
      else
        screenHeight = screenRect.bottom;
          
      if(aHeight > screenHeight)
        aHeight = screenHeight;
        
      if(aWidth > screenWidth)
        aWidth = screenWidth;      
    
    Rect macRect;
    ::GetWindowPortBounds ( mWindowPtr, &macRect );

    short w = macRect.right - macRect.left;
    short h = macRect.bottom - macRect.top;
    Boolean needReposition = (w == 1 && h == 1);

    if ((w != aWidth) || (h != aHeight))
    {
      // make sure that we don't infinitely recurse if live-resize is on
      mResizeIsFromUs = PR_TRUE;
      ::SizeWindow(mWindowPtr, aWidth, aHeight, aRepaint);
      mResizeIsFromUs = PR_FALSE;

#if defined(XP_MACOSX)
      // workaround for bug in MacOSX if windows start life as 1x1.
      if (needReposition)
        RepositionWindow(mWindowPtr, NULL, kWindowCascadeOnMainScreen);
#endif
    }
  }
#endif
  //Inherited::Resize(aWidth, aHeight, aRepaint);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (NS_IMETHODIMP) Resize (PRInt32 aX
(PRInt32 aY
(PRInt32 aWidth
(PRInt32 aHeight
(PRBool aRepaint 

Move or resize this widget.

Parameters:
aXthe new x position expressed in the parent's coordinate system
aYthe new y position expressed in the parent's coordinate system
aWidththe new width expressed in the parent's coordinate system
aHeightthe new height expressed in the parent's coordinate system
aRepaintwhether the widget should be repainted if the size changes

Implements nsIWidget.

Definition at line 1316 of file nsCocoaWindow.mm.

{
  Move(aX, aY);
  Resize(aWidth, aHeight, aRepaint);
  return NS_OK;
}

Here is the call graph for this function:

void nsBaseWidget::ResolveIconName ( const nsAString &  aIconName,
const nsAString &  aIconSuffix,
nsILocalFile **  aResult 
) [protected, virtual, inherited]

Resolve the given icon name into a local file object.

This method is intended to be called by subclasses of nsBaseWidget. aIconSuffix is a platform specific icon file suffix (e.g., ".ico" under Win32).

If no file is found matching the given parameters, then null is returned.

Definition at line 975 of file nsBaseWidget.cpp.

{ 
  *aResult = nsnull;

  nsCOMPtr<nsIProperties> dirSvc = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
  if (!dirSvc)
    return;

  // first check auxilary chrome directories

  nsCOMPtr<nsISimpleEnumerator> dirs;
  dirSvc->Get(NS_APP_CHROME_DIR_LIST, NS_GET_IID(nsISimpleEnumerator),
              getter_AddRefs(dirs));
  if (dirs) {
    PRBool hasMore;
    while (NS_SUCCEEDED(dirs->HasMoreElements(&hasMore)) && hasMore) {
      nsCOMPtr<nsISupports> element;
      dirs->GetNext(getter_AddRefs(element));
      if (!element)
        continue;
      nsCOMPtr<nsILocalFile> file = do_QueryInterface(element);
      if (!file)
        continue;
      if (ResolveIconNameHelper(file, aIconName, aIconSuffix)) {
        NS_ADDREF(*aResult = file);
        return;
      }
    }
  }

  // then check the main app chrome directory

  nsCOMPtr<nsILocalFile> file;
  dirSvc->Get(NS_APP_CHROME_DIR, NS_GET_IID(nsILocalFile),
              getter_AddRefs(file));
  if (file && ResolveIconNameHelper(file, aIconName, aIconSuffix))
    NS_ADDREF(*aResult = file);
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (NS_IMETHOD) ScreenToWidget (const nsRect &)  aOldRect
(nsRect &)  aNewRect 

Convert from screen coordinates to this widget's coordinates.

Parameters:
aOldRectscreen coordinates stored in the x,y members
aNewRectwidget's coordinates stored in the x,y members

Implements nsIWidget.

Definition at line 125 of file nsCocoaWindow.h.

{ return NS_OK; }
- (NS_IMETHOD) Scroll (PRInt32 aDx
(PRInt32 aDy
(nsRect *)  aClipRect 

XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.

Parameters:
aDxamount to scroll along the x-axis
aDyamount to scroll along the y-axis.
aClipRectclipping rectangle to limit the scroll to.

Implements nsIWidget.

Definition at line 150 of file nsCocoaWindow.h.

{ return NS_OK; }
NS_IMETHODIMP nsBaseWidget::ScrollRect ( nsRect aSrcRect,
PRInt32  aDx,
PRInt32  aDy 
) [virtual, inherited]

Scroll an area of this widget.

Child widgets are not scrolled. A NS_PAINT message is synchronously dispatched for the newly exposed rectangle.

Parameters:
aRectsource rectangle to scroll in the widget in pixels
aDxx offset from the source in pixels
aDyy offset from the source in pixels

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 910 of file nsBaseWidget.cpp.

{
  return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsBaseWidget::ScrollWidgets ( PRInt32  aDx,
PRInt32  aDy 
) [virtual, inherited]

Scroll the contents of the widget.

All child widgets are also scrolled by offsetting their coordinates. A NS_PAINT message is synchronously dispatched for the newly exposed rectangle.

Parameters:
aDxamount to scroll along the x-axis in pixels
aDyamount to scroll along the y-axis in pixels

Implements nsIWidget.

Reimplemented in nsWindow, nsWidget, nsWindow, nsWindow, nsWindow, nsCommonWidget, nsWindow, and nsWindow.

Definition at line 905 of file nsBaseWidget.cpp.

{
  return NS_ERROR_FAILURE;
}
NS_METHOD nsBaseWidget::SetBackgroundColor ( const nscolor aColor) [virtual, inherited]

Set the background color for this widget.

Parameters:
aColorthe new background color

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWidget, nsWidget, nsWindow, nsWidget, and nsWindow.

Definition at line 471 of file nsBaseWidget.cpp.

{
  mBackground = aColor;
  return NS_OK;
}

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::SetBorderStyle ( nsBorderStyle  aBorderStyle) [virtual, inherited]

Set border style Must be called before Create.

Parameters:
aBorderStyle
See also:
nsBorderStyle

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 694 of file nsBaseWidget.cpp.

{
  mBorderStyle = aBorderStyle;
  return NS_OK;
}

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::SetBounds ( const nsRect aRect) [inherited]

Reimplemented in nsChildView, nsWindow, and nsWidget.

Definition at line 792 of file nsBaseWidget.cpp.

{
  mBounds = aRect;

  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::SetClientData ( void aClientData) [virtual, inherited]

Implements nsIWidget.

Definition at line 227 of file nsBaseWidget.cpp.

{
  mClientData = aClientData;
  return NS_OK;
}
- (NS_IMETHOD) SetColorMap (nsColorMap *)  aColorMap

Set the color map for this widget.

Parameters:
aColorMapcolor map for displaying this widget

Implements nsIWidget.

Definition at line 151 of file nsCocoaWindow.h.

{ return NS_OK; }
NS_METHOD nsBaseWidget::SetCursor ( nsCursor  aCursor) [virtual, inherited]

Set the cursor for this widget.

Parameters:
aCursorthe new cursor for this widget

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsWidget, nsCommonWidget, nsWindow, nsWidget, and nsWindow.

Definition at line 487 of file nsBaseWidget.cpp.

{
  mCursor = aCursor; 
  return NS_OK;
}
NS_IMETHODIMP nsBaseWidget::SetCursor ( imgIContainer aCursor,
PRUint32  aHotspotX,
PRUint32  aHotspotY 
) [virtual, inherited]

Sets an image as the cursor for this widget.

Parameters:
aCursorthe cursor to set
aXthe X coordinate of the hotspot (from left).
aYthe Y coordinate of the hotspot (from top).
Return values:
NS_ERROR_NOT_IMPLEMENTEDif setting images as cursors is not supported

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, and nsWindow.

Definition at line 493 of file nsBaseWidget.cpp.

- (NS_IMETHOD) SetFocus (PRBool aRaise = PR_FALSE

Give focus to this widget.

Implements nsIWidget.

Definition at line 121 of file nsCocoaWindow.h.

{ return NS_OK; }
- (NS_IMETHOD) SetFont (const nsFont &)  aFont

Set the font for this widget.

Parameters:
aFontfont to display. See nsFont for allowable fonts

Implements nsIWidget.

Definition at line 146 of file nsCocoaWindow.h.

{ return NS_OK; }
NS_METHOD nsBaseWidget::SetForegroundColor ( const nscolor aColor) [virtual, inherited]

Set the foreground color for this widget.

Parameters:
aColorthe new foreground color

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 449 of file nsBaseWidget.cpp.

{
  mForeground = aColor;
  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::SetIcon ( const nsAString &  anIconSpec) [virtual, inherited]

Set the widget's icon.

Must be called after Create.

Parameters:
anIconSpecstring specifying the icon to use; convention is to pass a resource: URL from which a platform-dependent resource file name will be constructed

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 944 of file nsBaseWidget.cpp.

{
  return NS_OK;
}
- (void) SetIsActive (PRBool aActive

Definition at line 1506 of file nsCocoaWindow.mm.

{
//  mIsActive = aActive;
}
- (NS_IMETHOD) SetMenuBar (nsIMenuBar *)  aMenuBar

Set the widget's MenuBar.

Must be called after Create.

Parameters:
aMenuBarthe menubar

Implements nsIWidget.

Definition at line 122 of file nsCocoaWindow.h.

{ return NS_OK; }
- (NS_IMETHOD) SetModal (PRBool aModal

Make the window modal.

  

Reimplemented from nsBaseWidget.

Definition at line 119 of file nsCocoaWindow.h.

{ return NS_OK; }
void nsIWidget::SetNextSibling ( nsIWidget aSibling) [inline, inherited]

Set the next sibling of this widget.

Definition at line 396 of file nsIWidget.h.

                                             {
        mNextSibling = aSibling;
    }

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::SetParent ( nsIWidget aNewParent) [virtual, inherited]

Reparent a widget.

Change the widgets parent

Parameters:
aNewParentnew parent

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 263 of file nsBaseWidget.cpp.

- (NS_IMETHOD) SetPreferredSize (PRInt32 aWidth
(PRInt32 aHeight 

Set the preferred width and height for the widget.

  

Implements nsIWidget.

Definition at line 155 of file nsCocoaWindow.h.

{ return NS_OK; }
void nsIWidget::SetPrevSibling ( nsIWidget aSibling) [inline, inherited]

Set the previous sibling of this widget.

Definition at line 410 of file nsIWidget.h.

                                             {
        mPrevSibling = aSibling;
    }

Here is the caller graph for this function:

- (NS_METHOD) SetSizeMode (PRInt32 aMode

Minimize, maximize or normalize the window size.

Takes a value from nsSizeMode (see nsGUIEvent.h)

Reimplemented from nsBaseWidget.

Definition at line 1160 of file nsCocoaWindow.mm.

{
#if 0
  nsresult rv;
  PRInt32  currentMode;

  if (aMode == nsSizeMode_Minimized) // unlikely on the Mac
    return NS_ERROR_UNEXPECTED;

  // already done? it's bad to rezoom a window, so do nothing
  rv = nsBaseWidget::GetSizeMode(&currentMode);
  if (NS_SUCCEEDED(rv) && currentMode == aMode)
    return NS_OK;

  if (!mVisible) {
    /* zooming on the Mac doesn't seem to work until the window is visible.
       the rest of the app is structured to zoom before the window is visible
       to avoid flashing. here's where we defeat that. */
    if (aMode == nsSizeMode_Maximized)
      mZoomOnShow = PR_TRUE;
  } else {
    Rect macRect;
    rv = nsBaseWidget::SetSizeMode(aMode);
    if (NS_SUCCEEDED(rv)) {
      if (aMode == nsSizeMode_Maximized) {
        CalculateAndSetZoomedSize();
        ::ZoomWindow(mWindowPtr, inZoomOut, ::FrontWindow() == mWindowPtr);
      } else
        ::ZoomWindow(mWindowPtr, inZoomIn, ::FrontWindow() == mWindowPtr);
      ::GetWindowPortBounds(mWindowPtr, &macRect);
      Resize(macRect.right - macRect.left, macRect.bottom - macRect.top, PR_FALSE);
    }
  }
#endif

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (NS_IMETHODIMP) SetTitle (const nsAString &)  aTitle

Set the widget's title.

Must be called after Create.

Parameters:
aTitlestring displayed as the title of the widget

Implements nsIWidget.

Definition at line 1448 of file nsCocoaWindow.mm.

{
  const nsString& strTitle = PromiseFlatString(aTitle);
  NSString* title = [NSString stringWithCharacters:strTitle.get() length:strTitle.Length()];
  [mWindow setTitle:title];

  return NS_OK;
}
NS_METHOD nsBaseWidget::SetWindowClass ( char *  aClass) [virtual, inherited]

Sets the window class implemented in gtk.

Implements nsIWidget.

Reimplemented in nsWidget.

Definition at line 689 of file nsBaseWidget.cpp.

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::SetWindowTranslucency ( PRBool  aTranslucent) [virtual, inherited]

Set the translucency of the top-level window containing this widget.

So, e.g., if you call this on the widget for an IFRAME, the top level browser window containing the IFRAME actually gets set. Be careful.

This can fail if the platform doesn't support transparency/translucency. By default widgets are not transparent. This will also fail if the toplevel window is not a Mozilla window, e.g., if the widget is in an embedded context.

After translucency has been enabled, the initial alpha channel value for all pixels is 1, i.e., opaque. If the window is resized then the alpha channel values for all pixels are reset to 1. Pixel RGB color values are already premultiplied with alpha channel values.

Parameters:
aTranslucenttrue if the window may have translucent or transparent pixels

Implements nsIWidget.

Definition at line 522 of file nsBaseWidget.cpp.

Definition at line 510 of file nsBaseWidget.cpp.

{
  mWindowType = aWindowType;
  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::SetZIndex ( PRInt32  aZIndex) [virtual, inherited]

Sets the widget's z-index.

Implements nsIWidget.

Reimplemented in nsWidget, and nsWindow.

Definition at line 341 of file nsBaseWidget.cpp.

{
  mZIndex = aZIndex;

  // reorder this child in its parent's list.
  nsBaseWidget* parent = NS_STATIC_CAST(nsBaseWidget*, GetParent());
  if (parent) {
    parent->RemoveChild(this);
    // Scope sib outside the for loop so we can check it afterward
    nsIWidget* sib = parent->GetFirstChild();
    for ( ; sib; sib = sib->GetNextSibling()) {
      PRInt32 childZIndex;
      if (NS_SUCCEEDED(sib->GetZIndex(&childZIndex))) {
        if (aZIndex < childZIndex) {
          // Insert ourselves before sib
          nsIWidget* prev = sib->GetPrevSibling();
          mNextSibling = sib;
          mPrevSibling = prev;
          sib->SetPrevSibling(this);
          if (prev) {
            prev->SetNextSibling(this);
          } else {
            NS_ASSERTION(sib == parent->mFirstChild, "Broken child list");
            // We've taken ownership of sib, so it's safe to have parent let
            // go of it
            parent->mFirstChild = this;
          }
          PlaceBehind(eZPlacementBelow, sib, PR_FALSE);
          break;
        }
      }
    }
    // were we added to the list?
    if (!sib) {
      parent->AddChild(this);
    }
    
    NS_RELEASE(parent);
  }
  return NS_OK;
}

Here is the call graph for this function:

- (NS_IMETHODIMP) Show (PRBool aState

Show or hide this widget.

Parameters:
aStatePR_TRUE to show the Widget, PR_FALSE to hide it

Implements nsIWidget.

Definition at line 865 of file nsCocoaWindow.mm.

{
  if ( bState )
    [mWindow orderFront:NULL];
  else
    [mWindow orderOut:NULL];

  mVisible = bState;

#if 0
  // we need to make sure we call ::Show/HideWindow() to generate the 
  // necessary activate/deactivate events. Calling ::ShowHide() is
  // not adequate, unless we don't want activation (popups). (pinkerton).
  if ( bState && !mBounds.IsEmpty() ) {
    if ( mAcceptsActivation )
      ::ShowWindow(mWindowPtr);
    else {
      ::ShowHide(mWindowPtr, true);
      ::BringToFront(mWindowPtr); // competes with ComeToFront, but makes popups work
    }
    if (mZoomOnShow) {
      SetSizeMode(nsSizeMode_Maximized);
      mZoomOnShow = PR_FALSE;
    }
    ComeToFront();
  }
  else {
    // when a toplevel window goes away, make sure we rollup any popups that may 
    // be lurking. We want to catch this here because we're guaranteed that
    // we hide a window before we destroy it, and doing it here more closely
    // approximates where we do the same thing on windows.
    if ( mWindowType == eWindowType_toplevel ) {
      if ( gRollupListener )
        gRollupListener->Rollup();
      NS_IF_RELEASE(gRollupListener);
      NS_IF_RELEASE(gRollupWidget);
    }
    ::HideWindow(mWindowPtr);
  }
  
#endif

  return NS_OK;
}

Here is the call graph for this function:

- (NS_IMETHOD) ShowMenuBar (PRBool aShow

Set the widget's MenuBar's visibility.

Parameters:
aShowPR_TRUE to show, PR_FALSE to hide

Implements nsIWidget.

Definition at line 123 of file nsCocoaWindow.h.

{ return NS_OK; }
- (nsresult) StandardCreate (nsIWidget *)  aParent
(const nsRect &)  aRect
(EVENT_CALLBACK)  aHandleEventFunction
(nsIDeviceContext *)  aContext
(nsIAppShell *)  aAppShell
(nsIToolkit *)  aToolkit
(nsWidgetInitData *)  aInitData
(nsNativeWidget aNativeParent = nsnull 

Definition at line 343 of file nsCocoaWindow.mm.

{
  Inherited::BaseCreate ( aParent, aRect, aHandleEventFunction, aContext, aAppShell,
                            aToolkit, aInitData );
                            
  if (!aNativeParent || (aInitData && aInitData->mWindowType == eWindowType_popup))
  {
    mOffsetParent = aParent;

    nsWindowType windowType = eWindowType_toplevel;
    if (aInitData)
    {
      mWindowType = aInitData->mWindowType;
      // if a toplevel window was requested without a titlebar, use a dialog windowproc
      if (aInitData->mWindowType == eWindowType_toplevel &&
        (aInitData->mBorderStyle == eBorderStyle_none ||
         aInitData->mBorderStyle != eBorderStyle_all && !(aInitData->mBorderStyle & eBorderStyle_title)))
        windowType = eWindowType_dialog;
    } 
    else
    {
      mWindowType = (mIsDialog ? eWindowType_dialog : eWindowType_toplevel);
    }
    
    // create the cocoa window
    NSRect rect;
    rect.origin.x = rect.origin.y = 1.0;
    rect.size.width = rect.size.height = 1.0;
    unsigned int features = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask 
                              | NSResizableWindowMask;
    if ( mWindowType == eWindowType_popup || mWindowType == eWindowType_invisible )
      features = 0;

    // XXXdwh Just don't make popup windows yet.  They mess up the world.
    if (mWindowType == eWindowType_popup)
      return NS_OK;

    mWindow = [[NSWindow alloc] initWithContentRect:rect styleMask:features 
                        backing:NSBackingStoreBuffered defer:NO];
    
    // Popups will receive a "close" message when an app terminates
    // that causes an extra release to occur.  Make sure popups
    // are set not to release when closed.
    if (features == 0)
      [mWindow setReleasedWhenClosed: NO];

    // create a quickdraw view as the toplevel content view of the window
    NSQuickDrawView* content = [[[NSQuickDrawView alloc] init] autorelease];
    [content setFrame:[[mWindow contentView] frame]];
    [mWindow setContentView:content];
    
    // register for mouse-moved events. The default is to ignore them for perf reasons.
    [mWindow setAcceptsMouseMovedEvents:YES];
    
    // setup our notification delegate. Note that setDelegate: does NOT retain.
    mDelegate = [[WindowDelegate alloc] initWithGeckoWindow:this];
    [mWindow setDelegate:mDelegate];
    
    mWindowMadeHere = PR_TRUE;    
  }

#if 0
  short bottomPinDelta = 0;     // # of pixels to subtract to pin window bottom
  nsCOMPtr<nsIToolkit> theToolkit = aToolkit;
  
  // build the main native window
  if (aNativeParent == nsnull)
  {
    nsWindowType windowType;
    if (aInitData)
    {
      mWindowType = aInitData->mWindowType;
      // if a toplevel window was requested without a titlebar, use a dialog windowproc
      if (aInitData->mWindowType == eWindowType_toplevel &&
        (aInitData->mBorderStyle == eBorderStyle_none ||
         aInitData->mBorderStyle != eBorderStyle_all && !(aInitData->mBorderStyle & eBorderStyle_title)))
        windowType = eWindowType_dialog;
    } else
      mWindowType = (mIsDialog ? eWindowType_dialog : eWindowType_toplevel);

    short     wDefProcID = kWindowDocumentProc;
    Boolean   goAwayFlag;
    short     hOffset;
    short     vOffset;

    switch (mWindowType)
    {
      case eWindowType_popup:
        // We're a popup, context menu, etc. Sets
        // mAcceptsActivation to false so we don't activate the window
        // when we show it.
        mOffsetParent = aParent;
        if( !aParent )
          theToolkit = getter_AddRefs(aParent->GetToolkit());

        mAcceptsActivation = PR_FALSE;
        goAwayFlag = false;
        hOffset = 0;
        vOffset = 0;
#if TARGET_CARBON
        wDefProcID = kWindowSimpleProc;
#else
        wDefProcID = plainDBox;
#endif
        break;

      case eWindowType_child:
        wDefProcID = plainDBox;
        goAwayFlag = false;
        hOffset = 0;
        vOffset = 0;
        break;

      case eWindowType_dialog:
        if (aInitData)
        {
          // Prior to Carbon, defProcs were solely about appearance. If told to create a dialog,
          // we could use, for example, |kWindowMovableModalDialogProc| even if the dialog wasn't
          // supposed to be modal. Carbon breaks this assumption, enforcing modality when using these
          // particular proc ids. As a result, when compiling under Carbon we have to use the
          // standard window proc id's and below, after we have a windowPtr, we'll hide the closebox
          // that comes with the standard window proc.
          //
          // I'm making the assumption here that any dialog created w/out a titlebar is modal and am
          // therefore keeping the old modal dialog proc. I'm only special-casing dialogs with a 
          // titlebar since those are the only ones that might end up not being modal.
          
          switch (aInitData->mBorderStyle)
          {
            case eBorderStyle_none:
              wDefProcID = kWindowModalDialogProc;
              break;
              
            case eBorderStyle_all:
              #if TARGET_CARBON
                wDefProcID = kWindowGrowDocumentProc;
              #else
                wDefProcID = kWindowMovableModalGrowProc;   // should we add a close box (kWindowGrowDocumentProc) ?
              #endif
              break;
              
            case eBorderStyle_default:
              wDefProcID = kWindowModalDialogProc;
              break;
            
            default:
              // we ignore the close flag here, since mac dialogs should never have a close box.
              switch(aInitData->mBorderStyle & (eBorderStyle_resizeh | eBorderStyle_title))
              {
                // combinations of individual options.
                case eBorderStyle_title:
                  #if TARGET_CARBON
                    wDefProcID = kWindowDocumentProc;
                  #else
                    wDefProcID = kWindowMovableModalDialogProc;
                  #endif
                  break;
                                    
                case eBorderStyle_resizeh:
                case (eBorderStyle_title | eBorderStyle_resizeh):
                  #if TARGET_CARBON
                    wDefProcID = kWindowGrowDocumentProc;
                  #else
                    wDefProcID = kWindowMovableModalGrowProc;   // this is the only kind of resizable dialog.
                  #endif
                  break;
                                  
                default:
                  NS_WARNING("Unhandled combination of window flags");
                  break;
              }
          }
        }
        else
        {
          wDefProcID = kWindowModalDialogProc;
          goAwayFlag = true; // revisit this below
        }
                
        hOffset = kDialogMarginWidth;
        vOffset = kDialogTitleBarHeight;
        break;

      case eWindowType_toplevel:
        if (aInitData &&
          aInitData->mBorderStyle != eBorderStyle_all &&
          aInitData->mBorderStyle != eBorderStyle_default &&
          (aInitData->mBorderStyle == eBorderStyle_none ||
           !(aInitData->mBorderStyle & eBorderStyle_resizeh)))
          wDefProcID = kWindowDocumentProc;
        else
          wDefProcID = kWindowFullZoomGrowDocumentProc;
        goAwayFlag = true;
        hOffset = kWindowMarginWidth;
        vOffset = kWindowTitleBarHeight;
        break;

      case eWindowType_invisible:
        // don't do anything
        break;
    }

    // now turn off some default features if requested by aInitData
    if (aInitData && aInitData->mBorderStyle != eBorderStyle_all)
    {
      if (aInitData->mBorderStyle == eBorderStyle_none ||
          aInitData->mBorderStyle == eBorderStyle_default &&
          windowType == eWindowType_dialog ||
          !(aInitData->mBorderStyle & eBorderStyle_close))
        goAwayFlag = false;
    }

    Rect wRect;
    nsRectToMacRect(aRect, wRect);

    if (eWindowType_popup != mWindowType)
      ::OffsetRect(&wRect, hOffset, vOffset + ::GetMBarHeight());
    else
      ::OffsetRect(&wRect, hOffset, vOffset);

    nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
    if (screenmgr) {
      nsCOMPtr<nsIScreen> screen;
      //screenmgr->GetPrimaryScreen(getter_AddRefs(screen));
      screenmgr->ScreenForRect(wRect.left, wRect.top,
                                 wRect.right - wRect.left, wRect.bottom - wRect.top,
                                 getter_AddRefs(screen));
      if (screen) {
          PRInt32 left, top, width, height;
        screen->GetAvailRect(&left, &top, &width, &height);
        if (wRect.bottom > top+height) {
          bottomPinDelta = wRect.bottom - (top+height);
          wRect.bottom -= bottomPinDelta;
        }
      }
    }
    mWindowPtr = ::NewCWindow(nil, &wRect, "\p", false, wDefProcID, (WindowRef)-1, goAwayFlag, (long)nsnull);
    mWindowMadeHere = PR_TRUE;
  }
  else
  {
    mWindowPtr = (WindowPtr)aNativeParent;
    mWindowMadeHere = PR_FALSE;
  }

  if (mWindowPtr == nsnull)
    return NS_ERROR_OUT_OF_MEMORY;
  
  nsMacMessageSink::AddRaptorWindowToList(mWindowPtr, this);

  // create the root control
  ControlHandle   rootControl = nil;
  if (GetRootControl(mWindowPtr, &rootControl) != noErr)
  {
    OSErr err = CreateRootControl(mWindowPtr, &rootControl);
    NS_ASSERTION(err == noErr, "Error creating window root control");
  }

  // reset the coordinates to (0,0) because it's the top level widget
  // and adjust for any adjustment required to requested window bottom
  nsRect bounds(0, 0, aRect.width, aRect.height - bottomPinDelta);

  // init base class
  // (note: aParent is ignored. Mac (real) windows don't want parents)
  Inherited::StandardCreate(nil, bounds, aHandleEventFunction, aContext, aAppShell, theToolkit, aInitData);

#if TARGET_CARBON
  if ( mWindowType == eWindowType_popup ) {
    // OSX enforces window layering so we have to make sure that popups can
    // appear over modal dialogs (at the top of the layering chain). Create
    // the popup like normal and change its window class to the modal layer.
    //
    // XXX This needs to use ::SetWindowGroup() when we move to headers that
    // XXX support it.
    ::SetWindowClass(mWindowPtr, kModalWindowClass);
  }
  else if ( mWindowType == eWindowType_dialog ) {
    // Dialogs on mac don't have a close box, but we probably used a defproc above that
    // contains one. Thankfully, carbon lets us turn it off after the window has been 
    // created. Do so. We currently leave the collapse widget for all dialogs.
    ::ChangeWindowAttributes(mWindowPtr, 0L, kWindowCloseBoxAttribute );
  }
  
  // Setup the live window resizing
  if ( mWindowType == eWindowType_toplevel || mWindowType == eWindowType_invisible ) {
    WindowAttributes removeAttributes = kWindowNoAttributes;
    if ( mWindowType == eWindowType_invisible )
      removeAttributes |= kWindowInWindowMenuAttribute;     
    ::ChangeWindowAttributes ( mWindowPtr, kWindowLiveResizeAttribute, removeAttributes );
    
    EventTypeSpec windEventList[] = { {kEventClassWindow, kEventWindowBoundsChanged},
                                      {kEventClassWindow, kEventWindowConstrain} };
    EventTypeSpec scrollEventList[] = { {kEventClassMouse, kEventMouseWheelMoved} };
    OSStatus err1 = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(WindowEventHandler), 2, windEventList, this, NULL );
    OSStatus err2 = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(ScrollEventHandler), 1, scrollEventList, this, NULL );
      // note, passing NULL as the final param to IWEH() causes the UPP to be disposed automatically
      // when the event target (the window) goes away. See CarbonEvents.h for info.
    
    NS_ASSERTION(err1 == noErr && err2 == noErr, "Couldn't install Carbon Event handlers");
  }  
#endif
  
    
  // register tracking and receive handlers with the native Drag Manager
  if ( mDragTrackingHandlerUPP ) {
    OSErr result = ::InstallTrackingHandler ( mDragTrackingHandlerUPP, mWindowPtr, this );
    NS_ASSERTION ( result == noErr, "can't install drag tracking handler");
  }
  if ( mDragReceiveHandlerUPP ) {
    OSErr result = ::InstallReceiveHandler ( mDragReceiveHandlerUPP, mWindowPtr, this );
    NS_ASSERTION ( result == noErr, "can't install drag receive handler");
  }

  // If we're a popup, we don't want a border (we want CSS to draw it for us). So
  // install our own window defProc.
  if ( mWindowType == eWindowType_popup )
    InstallBorderlessDefProc(mWindowPtr);

#endif

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 164 of file nsCocoaWindow.h.

Here is the caller graph for this function:

Definition at line 165 of file nsCocoaWindow.h.

Here is the caller graph for this function:

Force a synchronous repaint of the window if there are dirty rects.

See also:
- Invalidate

Implements nsIWidget.

Definition at line 149 of file nsCocoaWindow.h.

{ return NS_OK; }
NS_IMETHODIMP nsBaseWidget::UpdateTranslucentWindowAlpha ( const nsRect aRect,
PRUint8 aAlphas 
) [virtual, inherited]

Update the alpha channel for some pixels of the top-level window that contains this widget.

The window must have been made translucent using SetWindowTranslucency. Pixel RGB color values are already premultiplied with alpha channel values.

Parameters:
aRectthe rect to update
aAlphasthe alpha values, in w x h array, row-major order, in units of 1/255. nsBlender::GetAlphas is a good way to compute this array.

Implements nsIWidget.

Definition at line 531 of file nsBaseWidget.cpp.

                                                                                              {
  NS_ASSERTION(PR_FALSE, "Window is not translucent");
  return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsBaseWidget::Validate ( ) [virtual, inherited]

Validate the widget.

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWindow, and nsWindow.

Definition at line 205 of file nsBaseWidget.cpp.

{
  return NS_OK;
}
- (NS_IMETHOD) WidgetToScreen (const nsRect &)  aOldRect
(nsRect &)  aNewRect 

Convert from this widget coordinates to screen coordinates.

Parameters:
aOldRectwidget coordinates stored in the x,y members
aNewRectscreen coordinates stored in the x,y members

Implements nsIWidget.

Definition at line 124 of file nsCocoaWindow.h.

{ return NS_OK; }

Here is the caller graph for this function:


Member Data Documentation

nsCOMPtr<nsIAppShell> nsBaseWidget::mAppShell [protected, inherited]

Definition at line 163 of file nsBaseWidget.h.

nscolor nsBaseWidget::mBackground [protected, inherited]

Definition at line 168 of file nsBaseWidget.h.

nsBorderStyle nsBaseWidget::mBorderStyle [protected, inherited]

Definition at line 172 of file nsBaseWidget.h.

nsRect nsBaseWidget::mBounds [protected, inherited]

Definition at line 178 of file nsBaseWidget.h.

void* nsBaseWidget::mClientData [protected, inherited]

Definition at line 160 of file nsBaseWidget.h.

nsIDeviceContext* nsBaseWidget::mContext [protected, inherited]

Definition at line 162 of file nsBaseWidget.h.

nsCursor nsBaseWidget::mCursor [protected, inherited]

Definition at line 170 of file nsBaseWidget.h.

- (WindowDelegate*) mDelegate [protected]

Definition at line 206 of file nsCocoaWindow.h.

EVENT_CALLBACK nsBaseWidget::mEventCallback [protected, inherited]

Definition at line 161 of file nsBaseWidget.h.

Definition at line 166 of file nsBaseWidget.h.

nsCOMPtr<nsIWidget> nsIWidget::mFirstChild [protected, inherited]

Definition at line 1046 of file nsIWidget.h.

nscolor nsBaseWidget::mForeground [protected, inherited]

Definition at line 169 of file nsBaseWidget.h.

PRPackedBool nsBaseWidget::mIsAltDown [protected, inherited]

Reimplemented in nsWindow.

Definition at line 175 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 174 of file nsBaseWidget.h.

PRPackedBool nsBaseWidget::mIsDestroying [protected, inherited]

Reimplemented in nsWindow.

Definition at line 176 of file nsBaseWidget.h.

- (PRBool) mIsDialog [protected]

Definition at line 202 of file nsCocoaWindow.h.

- (PRBool) mIsResizing [protected]

Definition at line 203 of file nsCocoaWindow.h.

PRPackedBool nsBaseWidget::mIsShiftDown [protected, inherited]

Reimplemented in nsWindow.

Definition at line 173 of file nsBaseWidget.h.

nsIWidget* nsIWidget::mLastChild [protected, inherited]

Definition at line 1047 of file nsIWidget.h.

Definition at line 167 of file nsBaseWidget.h.

Definition at line 165 of file nsBaseWidget.h.

nsCOMPtr<nsIWidget> nsIWidget::mNextSibling [protected, inherited]

Definition at line 1048 of file nsIWidget.h.

- (nsIWidget*) mOffsetParent [protected]

Definition at line 201 of file nsCocoaWindow.h.

Reimplemented in nsWindow.

Definition at line 177 of file nsBaseWidget.h.

nsRect* nsBaseWidget::mOriginalBounds [protected, inherited]

Definition at line 179 of file nsBaseWidget.h.

nsIWidget* nsIWidget::mPrevSibling [protected, inherited]

Definition at line 1049 of file nsIWidget.h.

nsSizeMode nsBaseWidget::mSizeMode [protected, inherited]

Definition at line 181 of file nsBaseWidget.h.

nsIToolkit* nsBaseWidget::mToolkit [protected, inherited]

Definition at line 164 of file nsBaseWidget.h.

- (PRBool) mVisible [protected]

Definition at line 208 of file nsCocoaWindow.h.

- (NSWindow*) mWindow [protected]

Definition at line 205 of file nsCocoaWindow.h.

- (PRBool) mWindowMadeHere [protected]

Definition at line 204 of file nsCocoaWindow.h.

nsWindowType nsBaseWidget::mWindowType [protected, inherited]

Definition at line 171 of file nsBaseWidget.h.

PRInt32 nsBaseWidget::mZIndex [protected, inherited]

Definition at line 180 of file nsBaseWidget.h.


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