Back to index

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

#import <nsChildView.h>

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

List of all members.

Public Member Functions

() - nsChildView
(virtual) - ~nsChildView
(NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIEVENTSINK
NS_IMETHOD
- ResetInputState
(NS_IMETHOD- SetIMEOpenState
(NS_IMETHOD- GetIMEOpenState
(NS_IMETHOD- CancelIMEComposition
(NS_IMETHOD- Create
 Create and initialize a widget.
(NS_IMETHOD- Create
 Create and initialize a widget with a native window parent.
(virtual nsresult- StandardCreate
(NS_IMETHOD- Destroy
 Close and destroy the internal native window.
(NS_IMETHOD- Show
 Show or hide this widget.
(NS_IMETHOD- IsVisible
 Returns whether the window is visible.
(virtual nsIWidget *) - GetParent
 Return the parent Widget of this Widget or nsnull if this is a top level window.
(NS_IMETHOD- ModalEventFilter
 Determine whether a given event should be processed assuming we are the currently active modal window.
(NS_IMETHOD- ConstrainPosition
 Perform platform-dependent sanity check on a potential window position.
(NS_IMETHOD- Move
 Move this widget.
(NS_IMETHOD- MoveWithRepaintOption
(NS_IMETHOD- Resize
 Resize this widget.
(NS_IMETHOD- Resize
 Move or resize this widget.
(NS_IMETHOD- Enable
 Enable or disable this Widget.
(NS_IMETHOD- IsEnabled
 Ask whether the widget is enabled.
(NS_IMETHOD- SetFocus
 Give focus to this widget.
(NS_IMETHOD- SetBounds
(NS_IMETHOD- GetBounds
 If the implementation of nsWindow supports borders this method MUST be overridden.
(virtual nsIFontMetrics *) - GetFont
 Get the font for this widget.
(NS_IMETHOD- SetFont
 Set the font for this widget.
(NS_IMETHOD- Invalidate
 Invalidate the widget and repaint it.
(NS_IMETHOD- Invalidate
 Invalidate a specified rect for a widget and repaints it.
(NS_IMETHOD- InvalidateRegion
 Invalidate a specified region for a widget and repaints it.
(NS_IMETHOD- Validate
 Validate the widget.
(virtual void *) - GetNativeData
(NS_IMETHOD- SetColorMap
 Set the color map for this widget.
(NS_IMETHOD- Scroll
 XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.
(NS_IMETHOD- WidgetToScreen
 Convert from this widget coordinates to screen coordinates.
(NS_IMETHOD- ScreenToWidget
 Convert from screen coordinates to this widget's coordinates.
(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- DispatchEvent
 Dispatches an event to the widget.
(virtual PRBool- DispatchMouseEvent
(virtual void- StartDraw
(virtual void- EndDraw
(NS_IMETHOD- Update
 Force a synchronous repaint of the window if there are dirty rects.
(virtual void- UpdateWidget
(virtual void- ConvertToDeviceCoordinates
(void- LocalToWindowCoordinate
(void- LocalToWindowCoordinate
(void- LocalToWindowCoordinate
(NS_IMETHOD- SetMenuBar
 Set the widget's MenuBar.
(NS_IMETHOD- ShowMenuBar
 Set the widget's MenuBar's visibility.
(virtual nsIMenuBar *) - GetMenuBar
(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- SetCursor
 Set the cursor for this widget.
(NS_IMETHOD- SetCursor
 Sets an image as the cursor for this 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.
(NS_IMETHOD- SetTitle
 Set the widget's title.
(NS_IMETHOD- GetAttention
 Bring this window to the user's attention.
(NS_IMETHOD- GetPluginClipRect
(NS_IMETHOD- StartDrawPlugin
(NS_IMETHOD- EndDrawPlugin
(virtual void- CalcWindowRegions
(virtual PRBool- PointInWidget
(virtual PRBool- DispatchWindowEvent
(virtual PRBool- DispatchWindowEvent
(virtual void- AcceptFocusOnClick
(PRBool- AcceptFocusOnClick
(void- Flash
(void- RemovedFromWindow
(void- AddedToWindow
(void- LiveResizeStarted
(void- LiveResizeEnded
NS_DECL_ISUPPORTS NS_IMETHOD PreCreateWidget (nsWidgetInitData *aWidgetInitData)
NS_IMETHOD CaptureMouse (PRBool aCapture)
 Enables/Disables system mouse capture.
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 SetParent (nsIWidget *aNewParent)
 Reparent a widget.
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 PlaceBehind (nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, PRBool aActivate)
 Position this widget just behind the given widget.
NS_IMETHOD SetSizeMode (PRInt32 aMode)
 Minimize, maximize or normalize the window size.
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 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 SetModal (PRBool aModal)
 Make the window modal.
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 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 GetScreenBounds (nsRect &aRect)
 If the implementation of nsWindow uses a local coordinate system within the window, 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 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 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.
boolean dispatchEvent (in voidPtr anEvent)
 Entry point for native events into Gecko.
boolean dragEvent (in unsigned long aMessage, in short aMouseGlobalX, in short aMouseGlobalY, in unsigned short aKeyModifiers)
 Alerts gecko of a drag event.
boolean scroll (in boolean aVertical, in short aNumLines, in short aMouseLocalX, in short aMouseLocalY)
 Tell gecko to scroll, usually in response to a mouse-wheel.
void Idle ()
 Perform any idle processing (handle timers, set the cursor, etc)

Static Public Member Functions

(static PRBool+ ConvertStatus

Protected Types

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

Protected Member Functions

(PRBool- ReportDestroyEvent
(PRBool- ReportMoveEvent
(PRBool- ReportSizeEvent
(NS_IMETHOD- CalcOffset
(virtual PRBool- OnPaint
(virtual NSView *) - CreateCocoaView
(void- TearDownView
(virtual GrafPtr) - GetQuickDrawPort
(GrafPtr) - GetChildViewQuickDrawPort
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

NSView< mozView > * mView
NSView< mozView > * mParentView
nsIWidgetmParentWidget
nsIFontMetricsmFontMetrics
nsIRenderingContextmTempRenderingContext
PRPackedBool mDestroyCalled
PRPackedBool mDestructorCalled
PRPackedBool mVisible
PRPackedBool mDrawing
PRPackedBool mTempRenderingContextMadeHere
PRPackedBool mAcceptFocusOnClick
PRPackedBool mLiveResizeInProgress
PRPackedBool mPluginDrawing
nsPluginPort * mPluginPort
RgnHandle mVisRgn
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 129 of file nsChildView.h.


Member Typedef Documentation

- (typedef nsBaseWidget) Inherited [private]

Reimplemented in nsNativeScrollbar, and nsNativeScrollbar.

Definition at line 135 of file nsChildView.h.


Member Enumeration Documentation

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

- nsChildView:
- nsChildView:

Definition at line 324 of file nsChildView.mm.

{
  // notify the children that we're gone
  for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
    nsChildView* childView = NS_STATIC_CAST(nsChildView*, kid);
    childView->mParentWidget = nsnull;
  }

  TearDownView(); // should have already been done from Destroy
  
  NS_IF_RELEASE(mTempRenderingContext); 
  NS_IF_RELEASE(mFontMetrics);
  
  delete mPluginPort;

  if (mVisRgn)
  {
    ::DisposeRgn(mVisRgn);
    mVisRgn = nsnull;
  }
}

Here is the call graph for this function:


Member Function Documentation

- (virtual void) AcceptFocusOnClick (PRBool aBool

Definition at line 256 of file nsChildView.h.

{ return mAcceptFocusOnClick;};

Definition at line 257 of file nsChildView.h.

:

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.

- (NS_IMETHODIMP) CalcOffset (PRInt32 &)  aX
(PRInt32 &)  aY 

Definition at line 1761 of file nsChildView.mm.

{
  aX = aY = 0;
  NSRect bounds = {{0, 0}, {0, 0}};
  bounds = [mView convertRect:bounds toView:nil];
  aX += NS_STATIC_CAST(PRInt32, bounds.origin.x);
  aY += NS_STATIC_CAST(PRInt32, bounds.origin.y);

  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 1746 of file nsChildView.mm.

{
  // i don't think this is necessary anymore...
}

Implements nsIKBStateControl.

Definition at line 1955 of file nsChildView.mm.

{
#ifdef DEBUG_IME
  NSLog(@"**** CancelIMEComposition");
#endif
  NSInputManager *currentIM = [NSInputManager currentInputManager];
  [currentIM markedTextAbandoned:mView];
  
  return NS_OK;
}
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_IMETHODIMP) 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 1878 of file nsChildView.mm.

{
  if (aDoCapture) {
    NS_IF_RELEASE(gRollupListener);
    NS_IF_RELEASE(gRollupWidget);
    gRollupListener = aListener;
    NS_ADDREF(aListener);
    gRollupWidget = this;
    NS_ADDREF(this);
  } else {
    NS_IF_RELEASE(gRollupListener);
    //gRollupListener = nsnull;
    NS_IF_RELEASE(gRollupWidget);
  }

  return NS_OK;
}

Here is the call graph for this function:

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 856 of file nsChildView.mm.

{
  return NS_OK;
}

Definition at line 1570 of file nsChildView.mm.

{
  switch (aStatus)
  {
    case nsEventStatus_eIgnore:             return(PR_FALSE);
    case nsEventStatus_eConsumeNoDefault:   return(PR_TRUE);  // don't do default processing
    case nsEventStatus_eConsumeDoDefault:   return(PR_FALSE);
    default:
      NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
      break;
  }
  return(PR_FALSE);
}

Here is the caller graph for this function:

Reimplemented from nsBaseWidget.

Definition at line 1868 of file nsChildView.mm.

{
  PRInt32 offX = 0, offY = 0;
  this->CalcOffset(offX,offY);

  aX += offX;
  aY += offY;
}

Here is the call graph for this function:

Here is the caller 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 493 of file nsChildView.mm.

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

Here is the call graph for this function:

- (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 511 of file nsChildView.mm.

{
  // what we're passed in |aNativeParent| is an NSView. 
  return(StandardCreate(nsnull, aRect, aHandleEventFunction,
                  aContext, aAppShell, aToolkit, aInitData, aNativeParent));
}

Here is the call graph for this function:

- (NSView *) CreateCocoaView (NSRect)  inFrame

Reimplemented in nsNativeScrollbar.

Definition at line 451 of file nsChildView.mm.

{
  return [[[ChildView alloc] initWithFrame:inFrame geckoChild:this eventSink:nsnull] autorelease];
}

Here is the caller graph for this function:

Close and destroy the internal native window.

This method does not delete the widget.

Reimplemented from nsBaseWidget.

Reimplemented in nsNativeScrollbar.

Definition at line 529 of file nsChildView.mm.

{
  if (mDestroyCalled)
    return NS_OK;
  mDestroyCalled = PR_TRUE;

  [mView widgetDestroyed];

  nsBaseWidget::OnDestroy();
  nsBaseWidget::Destroy();

  // just to be safe. If we're going away and for some reason we're still
  // the rollup widget, rollup and turn off capture.
  if ( this == gRollupWidget ) {
    if ( gRollupListener )
      gRollupListener->Rollup();
    CaptureRollupEvents(nsnull, PR_FALSE, PR_TRUE);
  }

  ReportDestroyEvent(); // beard: this seems to cause the window to be deleted. moved all release code to destructor.
  mParentWidget = nil;

  TearDownView();

  return NS_OK;
}

Here is the call graph for this function:

boolean nsIEventSink::dispatchEvent ( in voidPtr  anEvent) [inherited]

Entry point for native events into Gecko.

Returns:
PR_TRUE if event was handled PR_FALSE if not handled

On Mac, anEvent is a native EventRecord*.

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

Dispatches an event to the widget.

  

Implements nsIWidget.

Definition at line 1589 of file nsChildView.mm.

{
  aStatus = nsEventStatus_eIgnore;
  if (! mDestructorCalled)
  {
    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:

Reimplemented in nsNativeScrollbar, and nsNativeScrollbar.

Definition at line 1633 of file nsChildView.mm.

{

  PRBool result = PR_FALSE;
  if (nsnull == mEventCallback && nsnull == mMouseListener) {
    return result;
  }

  // call the event callback 
  if (nsnull != mEventCallback) 
    {
    result = (DispatchWindowEvent(aEvent));
    return result;
    }

  if (nsnull != mMouseListener) {
    switch (aEvent.message) {
      case NS_MOUSE_MOVE: {
        result = ConvertStatus(mMouseListener->MouseMoved(aEvent));
        nsRect rect;
        GetBounds(rect);
        if (rect.Contains(aEvent.point.x, aEvent.point.y)) 
          {
          //if (mWindowPtr == NULL || mWindowPtr != this) 
            //{
            // printf("Mouse enter");
            //mCurrentWindow = this;
            //}
          } 
        else 
          {
          // printf("Mouse exit");
          }

      } break;

      case NS_MOUSE_LEFT_BUTTON_DOWN:
      case NS_MOUSE_MIDDLE_BUTTON_DOWN:
      case NS_MOUSE_RIGHT_BUTTON_DOWN:
        result = ConvertStatus(mMouseListener->MousePressed(aEvent));
        break;

      case NS_MOUSE_LEFT_BUTTON_UP:
      case NS_MOUSE_MIDDLE_BUTTON_UP:
      case NS_MOUSE_RIGHT_BUTTON_UP:
        result = ConvertStatus(mMouseListener->MouseReleased(aEvent));
        result = ConvertStatus(mMouseListener->MouseClicked(aEvent));
        break;
    } // switch
  } 
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1614 of file nsChildView.mm.

{
  nsEventStatus status;
  DispatchEvent(&event, status);
  return ConvertStatus(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (PRBool) DispatchWindowEvent (nsGUIEvent &)  event
(nsEventStatus &)  aStatus 

Definition at line 1622 of file nsChildView.mm.

{
  DispatchEvent(&event, aStatus);
  return ConvertStatus(aStatus);
}

Here is the call graph for this function:

boolean nsIEventSink::dragEvent ( in unsigned long  aMessage,
in short  aMouseGlobalX,
in short  aMouseGlobalY,
in unsigned short  aKeyModifiers 
) [inherited]

Alerts gecko of a drag event.

Parameters:
aMessagethe message parameter for a Gecko NS_DRAGDROP_EVENT (See nsGUIEvent.h for list).
aMouseGlobalXx coordinate of mouse, in global coordinates
aMouseGlobalYy coordinate of mouse, in global coordinates
aKeyModifiersa native bitfield of which modifier keys are currently pressed
Returns:
PR_TRUE if event was handled PR_FALSE if not handled
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.

Reimplemented in nsNativeScrollbar.

Definition at line 721 of file nsChildView.mm.

{
  // unimplemented;
  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;
}

Definition at line 1318 of file nsChildView.mm.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1087 of file nsChildView.mm.

{
  NS_ASSERTION(mPluginPort, "EndDrawPlugin must only be called on a plugin widget");
  //[mView unlockFocus];
  mPluginDrawing = PR_FALSE;
  return NS_OK;
}

Call this when finished adjusting child windows.

Must be preceded by BeginResizingChildren.

Implements nsIWidget.

- (void) Flash (nsPaintEvent &)  aEvent

Definition at line 1335 of file nsChildView.mm.

{
#if DEBUG
  Rect flashRect;
  if (debug_WantPaintFlashing() && aEvent.rect ) {
    ::SetRect ( &flashRect, aEvent.rect->x, aEvent.rect->y, aEvent.rect->x + aEvent.rect->width,
            aEvent.rect->y + aEvent.rect->height );
    StPortSetter portSetter(GetQuickDrawPort());
    unsigned long endTicks;
    ::InvertRect ( &flashRect );
    ::Delay(10, &endTicks);
    ::InvertRect ( &flashRect );
  }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

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) GetAttention (PRInt32 aCycleCount

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.

Reimplemented from nsBaseWidget.

Definition at line 1906 of file nsChildView.mm.

{
  [NSApp requestUserAttention:NSCriticalRequest];
  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_IMETHODIMP) GetBounds (nsRect &)  aRect

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

Reimplemented from nsBaseWidget.

Definition at line 835 of file nsChildView.mm.

{
  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:

Definition at line 1984 of file nsChildView.mm.

{
  if ([mView isKindOfClass:[ChildView class]])
    return (GrafPtr)[(ChildView*)mView qdPort];

  return nsnull;
}

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.

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:

Implements nsIKBStateControl.

Definition at line 1947 of file nsChildView.mm.

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.

Definition at line 803 of file nsChildView.mm.

{
  return nsnull;
}
- (void *) GetNativeData (PRUint32 aDataType

Implements nsIWidget.

Definition at line 574 of file nsChildView.mm.

{
  void* retVal = nsnull;

  switch (aDataType) 
  {
    case NS_NATIVE_WIDGET:            // the NSView
    case NS_NATIVE_DISPLAY:
      retVal = (void*)mView;
      break;

    case NS_NATIVE_WINDOW:
      retVal = [mView getNativeWindow];
      break;
      
    case NS_NATIVE_GRAPHIC:           // quickdraw port
      // XXX qdPort is invalid if we have not locked focus
      retVal = GetChildViewQuickDrawPort();
      break;
      
    case NS_NATIVE_REGION:
    {
      if (!mVisRgn)
        mVisRgn = ::NewRgn();

      // XXX qdPort is invalid if we have not locked focus
      GrafPtr grafPort = GetChildViewQuickDrawPort();
      if (grafPort && mVisRgn)
        ::GetPortVisibleRegion(grafPort, mVisRgn);
      retVal = (void*)mVisRgn;
      break;
    }
      
    case NS_NATIVE_OFFSETX:
      retVal = 0;
      break;

    case NS_NATIVE_OFFSETY:
      retVal = 0;
      break;
    
#if 0
    case NS_NATIVE_COLORMAP:
      //ĄTODO
      break;
#endif

    case NS_NATIVE_PLUGIN_PORT:
      // this needs to be a combination of the port and the offsets.
      if (mPluginPort == nsnull)
      {
        mPluginPort = new nsPluginPort;
        if ([mView isKindOfClass:[ChildView class]])
          [(ChildView*)mView setIsPluginView: YES];
      }

      NSWindow* window = [mView getNativeWindow];
      if (window)
      {
        WindowRef topLevelWindow = (WindowRef)[window windowRef];
        if (topLevelWindow)
        {
          mPluginPort->port = ::GetWindowPort(topLevelWindow);

          NSPoint viewOrigin = [mView convertPoint:NSZeroPoint toView:nil];
          NSRect frame = [[window contentView] frame];
          viewOrigin.y = frame.size.height - viewOrigin.y;
          
          // need to convert view's origin to window coordinates.
          // then, encode as "SetOrigin" ready values.
          mPluginPort->portx = (PRInt32)-viewOrigin.x;
          mPluginPort->porty = (PRInt32)-viewOrigin.y;

        }
      }
      else
      {
#ifdef DEBUG
        printf("@@@@ Couldn't get NSWindow for plugin port. @@@@\n");
#endif
      }

      retVal = (void*)mPluginPort;
      break;
  }

  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:

- (virtual nsIWidget*) GetParent (void

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

Reimplemented from nsBaseWidget.

Here is the caller graph for this function:

- (NS_IMETHODIMP) GetPluginClipRect (nsRect &)  outClipRect
(nsPoint &)  outOrigin
(PRBool &)  outWidgetVisible 

Definition at line 980 of file nsChildView.mm.

{
  NS_ASSERTION(mPluginPort, "GetPluginClipRect must only be called on a plugin widget");
  if (!mPluginPort) return NS_ERROR_FAILURE;
  
  NSWindow* window = [mView getNativeWindow];
  if (!window) return NS_ERROR_FAILURE;
  
  NSPoint viewOrigin = [mView convertPoint:NSZeroPoint toView:nil];
  NSRect frame = [[window contentView] frame];
  viewOrigin.y = frame.size.height - viewOrigin.y;
  
  // set up the clipping region for plugins.
  NSRect visibleBounds = [mView visibleRect];
  NSPoint clipOrigin   = [mView convertPoint:visibleBounds.origin toView:nil];
  
  // Convert from cocoa to QuickDraw coordinates
  clipOrigin.y = frame.size.height - clipOrigin.y;
  
  outClipRect.x      = (nscoord)clipOrigin.x;
  outClipRect.y      = (nscoord)clipOrigin.y;
  
  if ([mView window] != nil)
  {
    outClipRect.width  = (nscoord)visibleBounds.size.width;
    outClipRect.height = (nscoord)visibleBounds.size.height;
    outWidgetVisible = PR_TRUE;
  }
  else
  {
    outClipRect.width = 0;
    outClipRect.height = 0;
    outWidgetVisible = PR_FALSE;
  }

  // need to convert view's origin to window coordinates.
  // then, encode as "SetOrigin" ready values.
  outOrigin.x = (nscoord)-viewOrigin.x;
  outOrigin.y = (nscoord)-viewOrigin.y;
  
  return NS_OK;
}

Here is the caller graph for this function:

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

Returns the preferred width and height for the widget.

  

Implements nsIWidget.

Definition at line 947 of file nsChildView.mm.

{
  return NS_ERROR_FAILURE;
}
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:

- (GrafPtr) GetQuickDrawPort

Reimplemented in nsNativeScrollbar.

Definition at line 1975 of file nsChildView.mm.

{
  if (mPluginPort)
    return mPluginPort->port;

  return GetChildViewQuickDrawPort();
}

Here is the call graph for this function:

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:

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

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsCocoaWindow, nsMacWindow, nsWindow, nsWindow, and nsCommonWidget.

Definition at line 768 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::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:

void nsIEventSink::Idle ( ) [inherited]

Perform any idle processing (handle timers, set the cursor, etc)

- (NS_IMETHODIMP) 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 1170 of file nsChildView.mm.

{
  if (!mView || !mVisible)
    return NS_OK;

  if (aIsSynchronous)
    [mView display];
  else if ([NSView focusView])
  {
    // if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
    // don't lose it.
    [mView setNeedsPendingDisplay];
  }
  else
    [mView setNeedsDisplay:YES];

  return NS_OK;
}

Here is the caller graph for this function:

- (NS_IMETHODIMP) 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 1194 of file nsChildView.mm.

{
  if (!mView || !mVisible)
    return NS_OK;

  NSRect r;
  ConvertGeckoToCocoaRect ( aRect, r );
  
  if (aIsSynchronous)
    [mView displayRect:r];
  else if ([NSView focusView])
  {
    // if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
    // don't lose it.
    [mView setNeedsPendingDisplayInRect:r];
  }
  else
    [mView setNeedsDisplayInRect:r];
  
  return NS_OK;
}

Here is the call graph for this function:

- (NS_IMETHODIMP) InvalidateRegion (const nsIRegion *)  aRegion
(PRBool aIsSynchronous 

Invalidate a specified region for a widget and repaints it.

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

Reimplemented from nsBaseWidget.

Definition at line 1235 of file nsChildView.mm.

{
  if ( !mView || !mVisible)
    return NS_OK;
    
//FIXME rewrite to use a Cocoa region when nsIRegion isn't a QD Region
  NSRect r;
  nsRect bounds;
  nsIRegion* region = NS_CONST_CAST(nsIRegion*, aRegion);     // ugh. this method should be const
  region->GetBoundingBox ( &bounds.x, &bounds.y, &bounds.width, &bounds.height );
  ConvertGeckoToCocoaRect(bounds, r);
  
  if ( aIsSynchronous )
    [mView displayRect:r];
  else
    [mView setNeedsDisplayInRect:r];

  return NS_OK;
}

Here is the call graph for this function:

- (NS_IMETHODIMP) IsEnabled (PRBool *)  aState

Ask whether the widget is enabled.

Parameters:
aStatereturns PR_TRUE if the widget is enabled

Implements nsIWidget.

Reimplemented in nsNativeScrollbar.

Definition at line 728 of file nsChildView.mm.

{
  // unimplemented
  if (aState)
   *aState = PR_TRUE;
  return NS_OK;
}
- (NS_METHOD) IsVisible (PRBool &)  aState

Returns whether the window is visible.

  

Implements nsIWidget.

Definition at line 671 of file nsChildView.mm.

{
  if (!mVisible) {
    bState = mVisible;
  } else {
    // mVisible does not accurately reflect the state of a hidden tabbed view
    // so verify that the view has a window as well
    bState = ([mView window] != nil);
  }
  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 1109 of file nsChildView.mm.

Here is the caller graph for this function:

Definition at line 1099 of file nsChildView.mm.

{
  // XXX todo. Use this to disable Java async redraw during resize
  mLiveResizeInProgress = PR_TRUE;
}

Here is the caller graph for this function:

Definition at line 226 of file nsChildView.h.

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) LocalToWindowCoordinate (nscoord &)  aX
(nscoord &)  aY 

Definition at line 227 of file nsChildView.h.

{ ConvertToDeviceCoordinates(aRect.x, aRect.y); }

Here is the call graph for this function:

Definition at line 228 of file nsChildView.h.

{ mAcceptFocusOnClick = aBool;};
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_IMETHODIMP) ModalEventFilter (PRBool aRealEvent
(void *)  aEvent
(PRBool *)  aForWindow 

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.

Reimplemented from nsBaseWidget.

Definition at line 707 of file nsChildView.mm.

{
  if (aForWindow)
    *aForWindow = PR_FALSE;
  return NS_ERROR_NOT_IMPLEMENTED;
}
- (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 867 of file nsChildView.mm.

{
  return MoveWithRepaintOption(aX, aY, PR_TRUE);
}

Here is the call graph for this function:

- (NS_IMETHODIMP) MoveWithRepaintOption (PRInt32 aX
(PRInt32 aY
(PRBool aRepaint 

Definition at line 872 of file nsChildView.mm.

{
  if ((mBounds.x != aX) || (mBounds.y != aY))
  {
    // Invalidate the current location
    if (mVisible && aRepaint)
      [[mView superview] setNeedsDisplayInRect: [mView frame]];    //XXX needed?
        
    // Set the bounds
    mBounds.x = aX;
    mBounds.y = aY;
   
    NSRect r;
    ConvertGeckoToCocoaRect(mBounds, r);
    [mView setFrame:r];

    if (mVisible && aRepaint)
      [mView setNeedsDisplay:YES];

    
    // Report the event
    ReportMoveEvent();
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller 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 &)  aEvent

Definition at line 1358 of file nsChildView.mm.

{
  return PR_TRUE;
}

Here is the caller graph for this function:

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_IMETHODIMP nsBaseWidget::PlaceBehind ( nsTopLevelWidgetZPlacement  aPlacement,
nsIWidget aWidget,
PRBool  aActivate 
) [virtual, inherited]

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsCocoaWindow, nsMacWindow, and nsWindow.

Definition at line 399 of file nsBaseWidget.cpp.

{
  return NS_OK;
}

Here is the caller graph for this function:

- (PRBool) PointInWidget (Point)  aThePoint

Definition at line 1777 of file nsChildView.mm.

{
  // get the origin in local coordinates
  nsPoint widgetOrigin(0, 0);
  LocalToWindowCoordinate(widgetOrigin);

  // get rectangle relatively to the parent
  nsRect widgetRect;
  GetBounds(widgetRect);

  // convert the topLeft corner to local coordinates
  widgetRect.MoveBy(widgetOrigin.x, widgetOrigin.y);

  // finally tell whether it's a hit
  return widgetRect.Contains(aThePoint.h, aThePoint.v);
}

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 1692 of file nsChildView.mm.

{
  // nsEvent
  nsGUIEvent event(PR_TRUE, NS_DESTROY, this);
  event.time        = PR_IntervalNow();

  // dispatch event
  return (DispatchWindowEvent(event));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1706 of file nsChildView.mm.

{
  // nsEvent
  nsGUIEvent moveEvent(PR_TRUE, NS_MOVE, this);
  moveEvent.point.x     = mBounds.x;
  moveEvent.point.y     = mBounds.y;
  moveEvent.time        = PR_IntervalNow();

  // dispatch event
  return (DispatchWindowEvent(moveEvent));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1722 of file nsChildView.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
  return(DispatchWindowEvent(sizeEvent));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIKBStateControl.

Definition at line 1919 of file nsChildView.mm.

{
#ifdef DEBUG_IME
  NSLog(@"**** ResetInputState");
#endif

  NSInputManager *currentIM = [NSInputManager currentInputManager];
  
  // commit the current text
  [currentIM unmarkText];

  // and clear the input manager's string
  [currentIM markedTextAbandoned:mView];
  
  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 903 of file nsChildView.mm.

{
  if ((mBounds.width != aWidth) || (mBounds.height != aHeight))
  {
    // Set the bounds
    mBounds.width  = aWidth;
    mBounds.height = aHeight;

    if (mVisible && aRepaint)
      [[mView superview] setNeedsDisplayInRect: [mView frame]];    //XXX needed?
    
    NSRect r;
    ConvertGeckoToCocoaRect(mBounds, r);
    [mView setFrame:r];

    if (mVisible && aRepaint)
      [mView setNeedsDisplay:YES];

    // Report the event
    ReportSizeEvent();
  }
 
  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 933 of file nsChildView.mm.

{
  MoveWithRepaintOption(aX, aY, aRepaint);
  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_IMETHODIMP) 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 1838 of file nsChildView.mm.

{
  NSRect temp;
  ConvertGeckoToCocoaRect(aGlobalRect, temp);

  // need to flip the point relative to the main screen
  if ([[NSScreen screens] count] > 0)   // paranoia
  {
    // "global" coords are relative to the upper left of the main screen,
    // which is the first screen in the array (not [NSScreen mainScreen]).
    NSRect mainScreenFrame = [[[NSScreen screens] objectAtIndex:0] frame];
    temp.origin.y = NSMaxY(mainScreenFrame) - temp.origin.y;
  }

  temp.origin = [[mView getNativeWindow] convertScreenToBase:temp.origin];   // convert to screen coords
  temp = [mView convertRect:temp fromView:nil];                     // convert to window coords

  ConvertCocoaToGeckoRect(temp, aLocalRect);
  
  return NS_OK;
} 

Here is the call graph for this function:

boolean nsIEventSink::scroll ( in boolean  aVertical,
in short  aNumLines,
in short  aMouseLocalX,
in short  aMouseLocalY 
) [inherited]

Tell gecko to scroll, usually in response to a mouse-wheel.

Parameters:
aVerticalPR_TRUE if scrolling veritcally, PR_FALSE if horizontal
aNumLinesthe number of lines to scroll, positive for down, negative for up
aMouseLocalXthe x coordinate of the mouse in window (local) coordinates
aMouseLocalYthe y coordinate of the mouse in window (local) coordinates
- (NS_IMETHODIMP) 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 1433 of file nsChildView.mm.

{
  BOOL viewWasDirty = NO;
  if (mVisible)
  {
    viewWasDirty = [mView needsDisplay];

    NSSize scrollVector = {aDx,aDy};
    [mView scrollRect: [mView visibleRect] by:scrollVector];
  }
  
  // Scroll the children (even if the widget is not visible)
  for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
    // We use resize rather than move since it gives us control
    // over repainting.  In the case of blitting, Quickdraw views
    // draw their child widgets on the blit, so we can scroll
    // like a bat out of hell by not wasting time invalidating
    // the widgets, since it's completely unnecessary to do so.
    nsRect bounds;
    kid->GetBounds(bounds);
    kid->Resize(bounds.x + aDx, bounds.y + aDy, bounds.width, bounds.height, PR_FALSE);
  }

  if (mVisible)
  {
    if (viewWasDirty)
    {
      [mView setNeedsDisplay:YES];
    }
    else
    {
      NSRect frame = [mView visibleRect];
      NSRect horizInvalid = frame;
      NSRect vertInvalid = frame;
  
      if (aDx != 0) {
        horizInvalid.size.width = abs(aDx);
        if (aDx < 0)
          horizInvalid.origin.x = frame.origin.x + frame.size.width + aDx;
        [mView setNeedsDisplayInRect: horizInvalid];
      }

      if (aDy != 0) {
        vertInvalid.size.height = abs(aDy);
        if (aDy < 0)
          vertInvalid.origin.y = frame.origin.y + frame.size.height + aDy;
        [mView setNeedsDisplayInRect: vertInvalid];
      }

      // We also need to check for any ChildViews which overlap this widget
      // but are not descendent widgets.  If there are any, we need to
      // invalidate the area of this view that these ChildViews will have been
      // blitted into, since these widgets aren't supposed to scroll with
      // this widget.

      // To do this, start at the root Gecko NSView, and walk down along
      // our ancestor view chain, looking at all the subviews in each level
      // of the hierarchy.  If we find a non-ancestor view that overlaps
      // this view, invalidate the area around it.

      // We need to convert all rects to a common ancestor view to intersect
      // them, since a view's frame is in the coordinate space of its parent.
      // Use mParentView as the frame of reference.
      NSRect selfFrame = [mParentView convertRect:[mView frame] fromView:[mView superview]];
      NSView* view = mParentView;
      BOOL selfLevel = NO;

      while (!selfLevel) {
        NSView* nextAncestorView;
        NSArray* subviews = [view subviews];
        for (unsigned int i = 0; i < [subviews count]; ++i) {
          NSView* subView = [subviews objectAtIndex: i];
          if (subView == mView)
            selfLevel = YES;
          else if ([mView isDescendantOf:subView])
            nextAncestorView = subView;
          else {
            NSRect intersectArea = NSIntersectionRect([mParentView convertRect:[subView frame] fromView:[subView superview]], selfFrame);
            if (!NSIsEmptyRect(intersectArea)) {
              NSPoint origin = [mView convertPoint:intersectArea.origin fromView:mParentView];

              if (aDy != 0) {
                vertInvalid.origin.x = origin.x;
                if (aDy < 0)  // scrolled down, invalidate above
                  vertInvalid.origin.y = origin.y + aDy;
                else          // invalidate below
                  vertInvalid.origin.y = origin.y + intersectArea.size.height;
                vertInvalid.size.width = intersectArea.size.width;
                [mView setNeedsDisplayInRect: vertInvalid];
              }

              if (aDx != 0) {
                horizInvalid.origin.y = origin.y;
                if (aDx < 0)  // scrolled right, invalidate to the left
                  horizInvalid.origin.x = origin.x + aDx;
                else          // invalidate to the right
                  horizInvalid.origin.x = origin.x + intersectArea.size.width;
                horizInvalid.size.height = intersectArea.size.height;
                [mView setNeedsDisplayInRect: horizInvalid];
              }
            }
          }
        }
        view = nextAncestorView;
      }
    }
  }
  
  // This is an evil hack that doesn't always work.
  // 
  // Drawing plugins in a Cocoa environment is tricky, because the
  // plugins are living in a Carbon WindowRef/BeginUpdate/EndUpdate
  // world, and Cocoa has its own notion of dirty rectangles. Throw
  // Quartz Extreme and QuickTime into the mix, and things get bad.
  // 
  // This code is working around a cosmetic issue seen when Quartz Extreme
  // is active, and you're scrolling a page with a QuickTime plugin; areas
  // outside the plugin fail to scroll properly. This [display] ensures that
  // the view is properly drawn before the next Scroll call.
  //
  // The time this doesn't work is when you're scrolling a page containing
  // an iframe which in turn contains a plugin.
  //
  // This is turned off because it makes scrolling pages with plugins slow.
  // 
  //if ([mView childViewHasPlugin])
  //  [mView display];

  return NS_OK;
}

Here is the call graph for this function:

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) SetBounds (const nsRect &)  aRect

Reimplemented from nsBaseWidget.

Definition at line 842 of file nsChildView.mm.

{
  nsresult rv = Inherited::SetBounds(aRect);
  if ( NS_SUCCEEDED(rv) ) {
    //CalcWindowRegions();
    NSRect r;
    ConvertGeckoToCocoaRect(aRect, r);
    [mView setFrame:r];
  }

  return rv;
}

Here is the call 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_IMETHODIMP) SetColorMap (nsColorMap *)  aColorMap

Set the color map for this widget.

Parameters:
aColorMapcolor map for displaying this widget

Implements nsIWidget.

Definition at line 779 of file nsChildView.mm.

{
  return NS_OK;
}
- (NS_IMETHODIMP) SetCursor (nsCursor aCursor

Set the cursor for this widget.

Parameters:
aCursorthe new cursor for this widget

Reimplemented from nsBaseWidget.

Definition at line 814 of file nsChildView.mm.

Here is the call graph for this function:

Here is the caller graph for this function:

- (NS_IMETHODIMP) SetCursor (imgIContainer *)  aCursor
(PRUint32 aHotspotX
(PRUint32 aHotspotY 

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

Reimplemented from nsBaseWidget.

Definition at line 822 of file nsChildView.mm.

{
  return nsBaseWidget::SetCursor(aCursor, aHotspotX, aHotspotY);
}

Here is the call graph for this function:

- (NS_IMETHODIMP) SetFocus (PRBool aRaise

Give focus to this widget.

Implements nsIWidget.

Definition at line 741 of file nsChildView.mm.

{
  NSWindow* window = [mView window];
  if (window)
    [window makeFirstResponder: mView];
  return NS_OK;
}
- (NS_IMETHODIMP) SetFont (const nsFont &)  aFont

Set the font for this widget.

Parameters:
aFontfont to display. See nsFont for allowable fonts

Implements nsIWidget.

Definition at line 765 of file nsChildView.mm.

Here is the call graph for this function:

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;
}

Implements nsIKBStateControl.

Definition at line 1939 of file nsChildView.mm.

- (NS_IMETHODIMP) SetMenuBar (nsIMenuBar *)  aMenuBar

Set the widget's MenuBar.

Must be called after Create.

Parameters:
aMenuBarthe menubar

Implements nsIWidget.

Definition at line 793 of file nsChildView.mm.

{
  return NS_ERROR_FAILURE;
}
NS_METHOD nsBaseWidget::SetModal ( PRBool  aModal) [virtual, inherited]

Make the window modal.

  

Implements nsIWidget.

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

Definition at line 920 of file nsBaseWidget.cpp.

{
  return NS_ERROR_FAILURE;
}
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_METHOD) SetPreferredSize (PRInt32 aWidth
(PRInt32 aHeight 

Set the preferred width and height for the widget.

  

Implements nsIWidget.

Definition at line 952 of file nsChildView.mm.

{
  return NS_ERROR_FAILURE;
}
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_IMETHODIMP nsBaseWidget::SetSizeMode ( PRInt32  aMode) [virtual, inherited]

Minimize, maximize or normalize the window size.

Takes a value from nsSizeMode (see nsGUIEvent.h)

Implements nsIWidget.

Reimplemented in nsWindow, nsCocoaWindow, nsWindow, nsMacWindow, and nsWindow.

Definition at line 411 of file nsBaseWidget.cpp.

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 1899 of file nsChildView.mm.

{
  // nothing to do here
  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.

Reimplemented in nsNativeScrollbar.

Definition at line 688 of file nsChildView.mm.

{    
  if (bState != mVisible) {
    if (bState) 
      [mParentView addSubview: mView];
    else
      [mView removeFromSuperview];
  }
  mVisible = bState;
  return NS_OK;
}

Set the widget's MenuBar's visibility.

Parameters:
aShowPR_TRUE to show, PR_FALSE to hide

Implements nsIWidget.

Definition at line 798 of file nsChildView.mm.

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

Definition at line 354 of file nsChildView.mm.

{
  mBounds = aRect;

//  CalcWindowRegions();

  BaseCreate(aParent, aRect, aHandleEventFunction, 
              aContext, aAppShell, aToolkit, aInitData);

  // inherit things from the parent view and create our parallel 
  // NSView in the Cocoa display system
  mParentView = nil;
  if ( aParent ) {
    SetBackgroundColor(aParent->GetBackgroundColor());
    SetForegroundColor(aParent->GetForegroundColor());

    // inherit the top-level window. NS_NATIVE_WIDGET is always a NSView
    // regardless of if we're asking a window or a view (for compatibility
    // with windows).
    mParentView = (NSView*)aParent->GetNativeData(NS_NATIVE_WIDGET); 
    mParentWidget = aParent;   
  }
  else
    mParentView = NS_REINTERPRET_CAST(NSView*,aNativeParent);
  
  // create our parallel NSView and hook it up to our parent. Recall
  // that NS_NATIVE_WIDGET is the NSView.
  NSRect r;
  ConvertGeckoToCocoaRect(mBounds, r);
  mView = [CreateCocoaView(r) retain];
  if (!mView) return NS_ERROR_FAILURE;
  
#if DEBUG
  // if our parent is a popup window, we're most certainly coming from a <select> list dropdown which
  // we handle in a different way than other platforms. It's ok that we don't have a parent
  // view because we bailed before even creating the cocoa widgetry and as a result, we
  // don't need to assert. However, if that's not the case, we definately want to assert
  // to show views aren't getting correctly parented.
  if ( aParent ) {
    nsWindowType windowType;
    aParent->GetWindowType(windowType);
    if ( windowType != eWindowType_popup )
      NS_ASSERTION(mParentView && mView, "couldn't hook up new NSView in hierarchy");
  }
  else
    NS_ASSERTION(mParentView && mView, "couldn't hook up new NSView in hierarchy");
#endif

  if (mParentView)
  {
    if (![mParentView isKindOfClass: [ChildView class]])
    {
      [mParentView addSubview:mView];
      mVisible = PR_TRUE;
      NSWindow* window = [mParentView window];
      if (!window) {
        // The enclosing view that embeds Gecko is actually hidden
        // right now!  This can happen when Gecko is embedded in the
        // tab of a Cocoa tab view.  See if the parent view responds
        // to our special getNativeWindow selector, and if it does,
        // use that to get the window instead.
        //if ([mParentView respondsToSelector: @selector(getNativeWindow:)])
        [mView setNativeWindow: [mParentView getNativeWindow]];
      }
      else
        [mView setNativeWindow: window];

    }
    else
    {
      [mView setNativeWindow: [mParentView getNativeWindow]];
    }
  }
  
  // if this is a ChildView, make sure that our per-window data
  // is set up
  if ([mView isKindOfClass:[ChildView class]])
    [(ChildView*)mView ensureWindowData];

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) StartDraw (nsIRenderingContext *)  aRenderingContext = nsnull

Definition at line 1265 of file nsChildView.mm.

{
  if (mDrawing)
    return;
  mDrawing = PR_TRUE;

  if (aRenderingContext == nsnull)
  {
    // make sure we have a rendering context
    mTempRenderingContext = GetRenderingContext();
    mTempRenderingContextMadeHere = PR_TRUE;
  }
  else
  {
    // if we already have a rendering context, save its state
    NS_IF_ADDREF(aRenderingContext);
    mTempRenderingContext = aRenderingContext;
    mTempRenderingContextMadeHere = PR_FALSE;
    mTempRenderingContext->PushState();

    // set the environment to the current widget
    mTempRenderingContext->Init(mContext, this);
  }

  // set the widget font. nsMacControl implements SetFont, which is where
  // the font should get set.
  if (mFontMetrics)
  {
    mTempRenderingContext->SetFont(mFontMetrics);
  }

  // set the widget background and foreground colors
  nscolor color = GetBackgroundColor();
  RGBColor macColor;
  macColor.red   = COLOR8TOCOLOR16(NS_GET_R(color));
  macColor.green = COLOR8TOCOLOR16(NS_GET_G(color));
  macColor.blue  = COLOR8TOCOLOR16(NS_GET_B(color));
  ::RGBBackColor(&macColor);

  color = GetForegroundColor();
  macColor.red   = COLOR8TOCOLOR16(NS_GET_R(color));
  macColor.green = COLOR8TOCOLOR16(NS_GET_G(color));
  macColor.blue  = COLOR8TOCOLOR16(NS_GET_B(color));
  ::RGBForeColor(&macColor);

  mTempRenderingContext->SetColor(color);       // just in case, set the rendering context color too
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1028 of file nsChildView.mm.

{
  NS_ASSERTION(mPluginPort, "StartDrawPlugin must only be called on a plugin widget");
  if (!mPluginPort)
    return NS_ERROR_FAILURE;
  
  // prevent reentrant drawing
  if (mPluginDrawing)
    return NS_ERROR_FAILURE;

  NSWindow* window = [mView getNativeWindow];
  if (!window) return NS_ERROR_FAILURE;

  if (window /* [mView lockFocusIfCanDraw] */)
  {
    // It appears that the WindowRef from which we get the plugin port undergoes the
    // traditional BeginUpdate/EndUpdate cycle, which, if you recall, sets the visible
    // region to the intersection of the visible region and the update region. Since
    // we don't know here if we're being drawn inside a BeginUpdate/EndUpdate pair
    // (which seem to occur in [NSWindow display]), and we don't want to have the burden
    // of correctly doing Carbon invalidates of the plugin rect, we manually set the
    // visible region to be the entire port every time.
    RgnHandle pluginRegion = ::NewRgn();
    if (pluginRegion)
    {
      StPortSetter setter(mPluginPort->port);
      ::SetOrigin(0, 0);

      nsRect  clipRect;   // this is in native window coordinates
      nsPoint origin;
      PRBool visible;
      GetPluginClipRect(clipRect, origin, visible);
      
      // XXX if we're not visible, set an empty clip region?
      Rect pluginRect;
      ConvertGeckoRectToMacRect(clipRect, pluginRect);
      
      ::RectRgn(pluginRegion, &pluginRect);
      ::SetPortVisibleRegion(mPluginPort->port, pluginRegion);
      ::SetPortClipRegion(mPluginPort->port, pluginRegion);
      
      // now set up the origin for the plugin
      ::SetOrigin(origin.x, origin.y);

      ::DisposeRgn(pluginRegion);
    }

    mPluginDrawing = PR_TRUE;
    return NS_OK;
  }
  
  NS_ASSERTION(0, "lockFocusIfCanDraw returned false\n");
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Definition at line 460 of file nsChildView.mm.

{
  if (mView)
  {
    NSWindow* win = [mView window];
    NSResponder* responder = [win firstResponder];

    // We're being unhooked from the view hierarchy, don't leave our view
    // or a child view as the window first responder.
    if (responder && [responder isKindOfClass:[NSView class]] &&
        [(NSView*)responder isDescendantOf:mView])
      [win makeFirstResponder: [mView superview]];

    GrafPtr curPort = GetChildViewQuickDrawPort();
    if (curPort)
    {
      nsCOMPtr<nsIQDFlushManager> qdFlushManager =
       do_GetService("@mozilla.org/gfx/qdflushmanager;1");
      if (qdFlushManager)
        qdFlushManager->RemovePort(curPort);
    }

    [mView removeFromSuperviewWithoutNeedingDisplay];
    [mView release];
    mView = nil;
  }
}

Here is the call graph for this function:

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 1369 of file nsChildView.mm.

{
  // Update means "Flush any pending changes right now."  It does *not* mean
  // repaint the world. :) -- dwh
  [mView displayIfNeeded];
  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;
}
- (void) UpdateWidget (nsRect &)  aRect
(nsIRenderingContext *)  aContext 

Definition at line 1390 of file nsChildView.mm.

{
  if (! mVisible)
    return;
  
  // For updating widgets, we _always_ want to use the NSQuickDrawView's port,
  // since that's the correct port for gecko to use to make rendering contexts.
  // The plugin is the only thing that uses the plugin port.
  GrafPtr curPort = GetChildViewQuickDrawPort();
  if (!curPort) return;

  StPortSetter port(curPort);
  
  // initialize the paint event
  nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, this);
  paintEvent.renderingContext = aContext;       // nsPaintEvent
  paintEvent.rect             = &aRect;

  // offscreen drawing is pointless.
  if (paintEvent.rect->x < 0)
    paintEvent.rect->x = 0;
  if (paintEvent.rect->y < 0)
    paintEvent.rect->y = 0;
    
  // draw the widget
  StartDraw(aContext);
  if ( OnPaint(paintEvent) ) {
    nsEventStatus eventStatus;
    DispatchWindowEvent(paintEvent,eventStatus);
    if(eventStatus != nsEventStatus_eIgnore)
      Flash(paintEvent);
  }
  EndDraw();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Validate the widget.

Reimplemented from nsBaseWidget.

Definition at line 1222 of file nsChildView.mm.

{
  [mView setNeedsDisplay:NO];
  return NS_OK;
}
- (NS_IMETHODIMP) 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 1803 of file nsChildView.mm.

{
  NSRect temp;
  ConvertGeckoToCocoaRect(aLocalRect, temp);
  temp = [mView convertRect:temp toView:nil];                       // convert to window coords
  temp.origin = [[mView getNativeWindow] convertBaseToScreen:temp.origin];   // convert to screen coords
  
  // need to flip the point relative to the main screen
  if ([[NSScreen screens] count] > 0)   // paranoia
  {
    // "global" coords are relative to the upper left of the main screen,
    // which is the first screen in the array (not [NSScreen mainScreen]).
    NSRect mainScreenFrame = [[[NSScreen screens] objectAtIndex:0] frame];
    temp.origin.y = NSMaxY(mainScreenFrame) - temp.origin.y;
  }
  
  // If this is rect has a size (and is not simply a point), it is important to account 
  // for the fact that convertRect:toView:nil thought our passed-in point was in bottom-left 
  // coords. Thus, we subtract the rect's height, to get the top-left rect's origin 
  // where we want it.
  temp.origin.y -= temp.size.height;

  ConvertCocoaToGeckoRect(temp, aGlobalRect);
  
  return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 306 of file nsChildView.h.

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.

- (PRPackedBool) mDestroyCalled [protected]

Definition at line 299 of file nsChildView.h.

Definition at line 300 of file nsChildView.h.

- (PRPackedBool) mDrawing [protected]

Definition at line 303 of file nsChildView.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.

- (nsIFontMetrics*) mFontMetrics [protected]

Definition at line 296 of file nsChildView.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.

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 307 of file nsChildView.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.

Reimplemented in nsWindow.

Definition at line 177 of file nsBaseWidget.h.

nsRect* nsBaseWidget::mOriginalBounds [protected, inherited]

Definition at line 179 of file nsBaseWidget.h.

- (NSView<mozView>*) mParentView [protected]

Definition at line 293 of file nsChildView.h.

- (nsIWidget*) mParentWidget [protected]

Definition at line 294 of file nsChildView.h.

- (PRPackedBool) mPluginDrawing [protected]

Definition at line 308 of file nsChildView.h.

- (nsPluginPort*) mPluginPort [protected]

Definition at line 310 of file nsChildView.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.

Definition at line 297 of file nsChildView.h.

Definition at line 304 of file nsChildView.h.

nsIToolkit* nsBaseWidget::mToolkit [protected, inherited]

Definition at line 164 of file nsBaseWidget.h.

- (NSView<mozView>*) mView [protected]

Definition at line 291 of file nsChildView.h.

- (PRPackedBool) mVisible [protected]

Definition at line 301 of file nsChildView.h.

- (RgnHandle) mVisRgn [protected]

Definition at line 311 of file nsChildView.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: