Back to index

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

Common widget implementation used as base class for native or crossplatform implementations of Widgets. More...

#include <nsBaseWidget.h>

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

List of all members.

Public Member Functions

 nsBaseWidget ()
virtual ~nsBaseWidget ()
NS_DECL_ISUPPORTS NS_IMETHOD PreCreateWidget (nsWidgetInitData *aWidgetInitData)
NS_IMETHOD CaptureMouse (PRBool aCapture)
 Enables/Disables system mouse capture.
NS_IMETHOD Validate ()
 Validate the widget.
NS_IMETHOD InvalidateRegion (const nsIRegion *aRegion, PRBool aIsSynchronous)
 Invalidate a specified region for a widget and repaints it.
NS_IMETHOD GetClientData (void *&aClientData)
 Accessor functions to get and set the client data associated with the widget.
NS_IMETHOD SetClientData (void *aClientData)
NS_IMETHOD Destroy ()
 Close and destroy the internal native window.
NS_IMETHOD SetParent (nsIWidget *aNewParent)
 Reparent a widget.
virtual nsIWidgetGetParent (void)
 Return the parent Widget of this Widget or nsnull if this is a top level window.
virtual void AddChild (nsIWidget *aChild)
 Internal methods.
virtual void RemoveChild (nsIWidget *aChild)
NS_IMETHOD SetZIndex (PRInt32 aZIndex)
 Sets the widget's z-index.
NS_IMETHOD GetZIndex (PRInt32 *aZIndex)
 Gets the widget's z-index.
NS_IMETHOD 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 SetCursor (nsCursor aCursor)
 Set the cursor for this widget.
NS_IMETHOD SetCursor (imgIContainer *aCursor, PRUint32 aHotspotX, PRUint32 aHotspotY)
 Sets an image as the cursor for this widget.
NS_IMETHOD GetWindowType (nsWindowType &aWindowType)
 Get the window type of this widget.
NS_IMETHOD SetWindowType (nsWindowType aWindowType)
NS_IMETHOD SetWindowTranslucency (PRBool aTranslucent)
 Set the translucency of the top-level window containing this widget.
NS_IMETHOD GetWindowTranslucency (PRBool &aTranslucent)
 Get the translucency of the top-level window that contains this widget.
NS_IMETHOD UpdateTranslucentWindowAlpha (const nsRect &aRect, PRUint8 *aAlphas)
 Update the alpha channel for some pixels of the top-level window that contains this widget.
NS_IMETHOD HideWindowChrome (PRBool aShouldHide)
 Hide window chrome (borders, buttons) for this widget.
NS_IMETHOD MakeFullScreen (PRBool aFullScreen)
 Put the toplevel window into or out of fullscreen mode.
nsresult MakeFullScreenInternal (PRBool aFullScreen)
virtual nsIRenderingContextGetRenderingContext ()
virtual nsIDeviceContextGetDeviceContext ()
virtual nsIAppShellGetAppShell ()
virtual nsIToolkitGetToolkit ()
 Return the widget's toolkit.
NS_IMETHOD SetModal (PRBool aModal)
 Make the window modal.
NS_IMETHOD ModalEventFilter (PRBool aRealEvent, void *aEvent, PRBool *aForWindow)
 Determine whether a given event should be processed assuming we are the currently active modal window.
NS_IMETHOD GetWindowClass (char *aClass)
 Gets the window class implemented in gtk.
NS_IMETHOD SetWindowClass (char *aClass)
 Sets the window class implemented in gtk.
NS_IMETHOD SetBorderStyle (nsBorderStyle aBorderStyle)
 Set border style Must be called before Create.
NS_IMETHOD AddMouseListener (nsIMouseListener *aListener)
 Processes a mouse pressed event.
NS_IMETHOD AddEventListener (nsIEventListener *aListener)
 Processes a mouse pressed event.
NS_IMETHOD AddMenuListener (nsIMenuListener *aListener)
 Add a menu listener This interface should only be called by the menu services manager This will AddRef() the menu listener This will Release() a previously set menu listener.
NS_IMETHOD SetBounds (const nsRect &aRect)
NS_IMETHOD GetBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetBoundsAppUnits (nsRect &aRect, float aAppUnits)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetClientBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD 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 GetAttention (PRInt32 aCycleCount)
 Bring this window to the user's attention.
NS_IMETHOD GetLastInputEventTime (PRUint32 &aTime)
 Get the last user input event time in milliseconds.
NS_IMETHOD SetIcon (const nsAString &anIconSpec)
 Set the widget's icon.
virtual void ConvertToDeviceCoordinates (nscoord &aX, nscoord &aY)
virtual void FreeNativeData (void *data, PRUint32 aDataType)
NS_IMETHOD Create (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)=0
 Create and initialize a widget.
NS_IMETHOD Create (nsNativeWidget aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)=0
 Create and initialize a widget with a native window parent.
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.
NS_IMETHOD Show (PRBool aState)=0
 Show or hide this widget.
NS_IMETHOD IsVisible (PRBool &aState)=0
 Returns whether the window is visible.
NS_IMETHOD ConstrainPosition (PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY)=0
 Perform platform-dependent sanity check on a potential window position.
NS_IMETHOD Move (PRInt32 aX, PRInt32 aY)=0
 Move this widget.
NS_IMETHOD Resize (PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)=0
 Resize this widget.
NS_IMETHOD Resize (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)=0
 Move or resize this widget.
NS_IMETHOD Enable (PRBool aState)=0
 Enable or disable this Widget.
NS_IMETHOD IsEnabled (PRBool *aState)=0
 Ask whether the widget is enabled.
NS_IMETHOD SetFocus (PRBool aRaise=PR_FALSE)=0
 Give focus to this widget.
virtual nsIFontMetricsGetFont (void)=0
 Get the font for this widget.
NS_IMETHOD SetFont (const nsFont &aFont)=0
 Set the font for this widget.
NS_IMETHOD Invalidate (PRBool aIsSynchronous)=0
 Invalidate the widget and repaint it.
NS_IMETHOD Invalidate (const nsRect &aRect, PRBool aIsSynchronous)=0
 Invalidate a specified rect for a widget and repaints it.
NS_IMETHOD Update ()=0
 Force a synchronous repaint of the window if there are dirty rects.
NS_IMETHOD SetColorMap (nsColorMap *aColorMap)=0
 Set the color map for this widget.
NS_IMETHOD Scroll (PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)=0
 XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.
NS_IMETHOD SetTitle (const nsAString &aTitle)=0
 Set the widget's title.
NS_IMETHOD SetMenuBar (nsIMenuBar *aMenuBar)=0
 Set the widget's MenuBar.
NS_IMETHOD ShowMenuBar (PRBool aShow)=0
 Set the widget's MenuBar's visibility.
NS_IMETHOD WidgetToScreen (const nsRect &aOldRect, nsRect &aNewRect)=0
 Convert from this widget coordinates to screen coordinates.
NS_IMETHOD ScreenToWidget (const nsRect &aOldRect, nsRect &aNewRect)=0
 Convert from screen coordinates to this widget's coordinates.
NS_IMETHOD BeginResizingChildren (void)=0
 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 (void)=0
 Call this when finished adjusting child windows.
NS_IMETHOD GetPreferredSize (PRInt32 &aWidth, PRInt32 &aHeight)=0
 Returns the preferred width and height for the widget.
NS_IMETHOD SetPreferredSize (PRInt32 aWidth, PRInt32 aHeight)=0
 Set the preferred width and height for the widget.
NS_IMETHOD DispatchEvent (nsGUIEvent *event, nsEventStatus &aStatus)=0
 Dispatches an event to the widget.
NS_IMETHOD CaptureRollupEvents (nsIRollupListener *aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent)=0
 Enables/Disables system capture of any and all events that would cause a dropdown to be rolled up, This method ignores the aConsumeRollupEvent parameter when aDoCapture is FALSE.
virtual voidGetNativeData (PRUint32 aDataType)=0

Protected Types

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Common widget implementation used as base class for native or crossplatform implementations of Widgets.

All cross-platform behavior that all widgets need to implement should be placed in this class. (Note: widget implementations are not required to use this class, but it gives them a head start.)

Definition at line 62 of file nsBaseWidget.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
CREATE 
CREATE_NATIVE 
DESTROY 
SET_FOCUS 
SET_CURSOR 
CREATE_HACK 

Definition at line 186 of file nsBaseWidget.h.


Constructor & Destructor Documentation

Definition at line 73 of file nsBaseWidget.cpp.

Definition at line 110 of file nsBaseWidget.cpp.

{
#ifdef NOISY_WIDGET_LEAKS
  gNumWidgets--;
  printf("WIDGETS- = %d\n", gNumWidgets);
#endif

  NS_IF_RELEASE(mMenuListener);
  NS_IF_RELEASE(mToolkit);
  NS_IF_RELEASE(mContext);
  if (mOriginalBounds)
    delete mOriginalBounds;
}

Member Function Documentation

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

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:

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:

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.

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]

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:

NS_IMETHOD nsIWidget::BeginResizingChildren ( void  ) [pure virtual, inherited]

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.

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsCocoaWindow, nsWidget, nsWindow, nsWidget, nsCommonWidget, and nsWindow.

Enables/Disables system mouse capture.

Parameters:
aCapturePR_TRUE enables mouse capture, PR_FALSE disables mouse capture

Implements nsIWidget.

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

Definition at line 200 of file nsBaseWidget.cpp.

{
  return NS_OK;
}
NS_IMETHOD nsIWidget::CaptureRollupEvents ( nsIRollupListener aListener,
PRBool  aDoCapture,
PRBool  aConsumeRollupEvent 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsCocoaWindow, nsWindow, nsWidget, nsWindow, nsWidget, nsWidget, nsCommonWidget, nsWindow, nsWindow, and nsWindow.

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::ConstrainPosition ( PRBool  aAllowSlop,
PRInt32 aX,
PRInt32 aY 
) [pure virtual, inherited]

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.

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsMacWindow, nsWindow, nsWidget, nsWindow, and nsCommonWidget.

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

Implements nsIWidget.

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

Definition at line 135 of file nsBaseWidget.h.

{}
NS_IMETHOD nsIWidget::Create ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsCommonWidget, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsWindow, nsWidget, and nsMacControl.

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::Create ( nsNativeWidget  aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsCommonWidget, nsWindow, nsWindow, nsWidget, nsMacWindow, nsWidget, nsCocoaWindow, nsWindow, and nsWidget.

Close and destroy the internal native window.

This method does not delete the widget.

Implements nsIWidget.

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

Definition at line 238 of file nsBaseWidget.cpp.

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

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHOD nsIWidget::DispatchEvent ( nsGUIEvent event,
nsEventStatus aStatus 
) [pure virtual, inherited]

Dispatches an event to the widget.

  

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWidget, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsCommonWidget, and nsCommonWidget.

Here is the caller graph for this function:

void nsBaseWidget::DrawScaledLine ( nsIRenderingContext aRenderingContext,
nscoord  aSX,
nscoord  aSY,
nscoord  aEX,
nscoord  aEY,
float  aScale,
float  aAppUnits,
PRBool  aIsHorz 
) [protected, virtual]

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]

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_IMETHOD nsIWidget::Enable ( PRBool  aState) [pure virtual, inherited]

Enable or disable this Widget.

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsCommonWidget, nsCocoaWindow, nsWidget, nsWindow, nsWidget, nsWindow, nsNativeScrollbar, nsCommonWidget, and nsMacControl.

Here is the caller graph for this function:

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;
}
NS_IMETHOD nsIWidget::EndResizingChildren ( void  ) [pure virtual, inherited]

Call this when finished adjusting child windows.

Must be preceded by BeginResizingChildren().

Implemented in nsWindow, nsChildView, nsWindow, nsWidget, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWindow, nsWidget, nsCommonWidget, and nsWindow.

virtual void nsBaseWidget::FreeNativeData ( void data,
PRUint32  aDataType 
) [inline, virtual]

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 136 of file nsBaseWidget.h.

{}//~~~

Implements nsIWidget.

Definition at line 663 of file nsBaseWidget.cpp.

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

Here is the caller graph for this function:

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

Bring this window to the user's attention.

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

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

Implements nsIWidget.

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

Definition at line 934 of file nsBaseWidget.cpp.

                                              {
    return NS_OK;
}

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]

Calculates the border width and height.

Implements nsIWidget.

Definition at line 805 of file nsBaseWidget.cpp.

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

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

  return NS_OK;
}

Here is the call graph for this function:

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

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

Implements nsIWidget.

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

Definition at line 757 of file nsBaseWidget.cpp.

{
  aRect = mBounds;
  return NS_OK;
}

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::GetBoundsAppUnits ( nsRect aRect,
float  aAppUnits 
)

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:

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]

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

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* nsIWidget::GetFont ( void  ) [pure virtual, inherited]

Get the font for this widget.

Returns:
the font metrics

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsWidget, nsWindow, and nsCommonWidget.

Get the foreground color for this widget.

Returns:
this widget's foreground color

Implements nsIWidget.

Definition at line 438 of file nsBaseWidget.cpp.

{
  return mForeground;
}

Here is the caller graph for this function:

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

Return the last child of this widget.

Will return null if there are no children.

Definition at line 382 of file nsIWidget.h.

                                    {
        return mLastChild;
    }

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.

virtual void* nsIWidget::GetNativeData ( PRUint32  aDataType) [pure virtual, inherited]
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:

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

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

Implements nsIWidget.

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

Definition at line 274 of file nsBaseWidget.cpp.

{
  return nsnull;
}

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::GetPreferredSize ( PRInt32 aWidth,
PRInt32 aHeight 
) [pure virtual, inherited]

Returns the preferred width and height for the widget.

  

Implemented in nsWindow, nsChildView, nsWindow, nsWidget, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsCommonWidget, nsCommonWidget, nsLabel, nsLabel, and nsLabel.

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

Return the previous sibling of this widget.

Definition at line 403 of file nsIWidget.h.

                                      {
        return mPrevSibling;
    }

Here is the caller graph for this function:

Implements nsIWidget.

Definition at line 605 of file nsBaseWidget.cpp.

{
  nsresult                      rv;
  nsCOMPtr<nsIRenderingContext> renderingCtx;

  if (mOnDestroyCalled)
    return nsnull;

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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:

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:

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]

Gets the window class implemented in gtk.

Implements nsIWidget.

Reimplemented in nsWidget.

Definition at line 684 of file nsBaseWidget.cpp.

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:

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]

Gets the widget's z-index.

Implements nsIWidget.

Definition at line 388 of file nsBaseWidget.cpp.

{
  *aZIndex = mZIndex;
  return NS_OK;
}

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 541 of file nsBaseWidget.cpp.

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::Invalidate ( PRBool  aIsSynchronous) [pure virtual, inherited]

Invalidate the widget and repaint it.

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

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWidget, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWindow, nsWindow, nsWindow, and nsCommonWidget.

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::Invalidate ( const nsRect aRect,
PRBool  aIsSynchronous 
) [pure virtual, inherited]

Invalidate a specified rect for a widget and repaints it.

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

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWidget, nsWindow, nsWindow, nsCocoaWindow, nsWindow, nsWidget, nsWindow, and nsWindow.

NS_IMETHODIMP nsBaseWidget::InvalidateRegion ( const nsIRegion aRegion,
PRBool  aIsSynchronous 
) [virtual]

Invalidate a specified region for a widget and repaints it.

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

Implements nsIWidget.

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

Definition at line 210 of file nsBaseWidget.cpp.

{
  return NS_ERROR_FAILURE;
}
NS_IMETHOD nsIWidget::IsEnabled ( PRBool aState) [pure virtual, inherited]

Ask whether the widget is enabled.

Parameters:
aStatereturns PR_TRUE if the widget is enabled

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsCommonWidget, nsCocoaWindow, nsWidget, nsWindow, nsWidget, nsNativeScrollbar, and nsCommonWidget.

NS_IMETHOD nsIWidget::IsVisible ( PRBool aState) [pure virtual, inherited]

Returns whether the window is visible.

  

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsWindow, nsWidget, and nsCommonWidget.

Here is the caller graph for this function:

Put the toplevel window into or out of fullscreen mode.

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 551 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

Definition at line 557 of file nsBaseWidget.cpp.

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

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

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

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

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

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

Implements nsIWidget.

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

Definition at line 926 of file nsBaseWidget.cpp.

{
  *aForWindow = PR_TRUE;
  return NS_OK;
}
NS_IMETHOD nsIWidget::Move ( PRInt32  aX,
PRInt32  aY 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsMacWindow, nsWindow, nsWidget, nsWindow, nsWindow, and nsCommonWidget.

Here is the caller graph for this function:

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

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:

NS_METHOD nsBaseWidget::Paint ( nsIRenderingContext aRenderingContext,
const nsRect aDirtyRect 
) [virtual]

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]

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:

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]

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:

NS_IMETHOD nsIWidget::Resize ( PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsMacWindow, nsWidget, nsWidget, nsCommonWidget, nsWindow, nsWidget, nsWindow, nsWindow, and nsCommonWidget.

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::Resize ( PRInt32  aX,
PRInt32  aY,
PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsCommonWidget, nsWidget, nsWindow, nsWidget, nsWindow, nsWindow, and nsCommonWidget.

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

Resolve the given icon name into a local file object.

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

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

Definition at line 975 of file nsBaseWidget.cpp.

{ 
  *aResult = nsnull;

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

  // first check auxilary chrome directories

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

  // then check the main app chrome directory

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

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::ScreenToWidget ( const nsRect aOldRect,
nsRect aNewRect 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsWidget, nsWindow, nsWidget, nsCocoaWindow, and nsCommonWidget.

NS_IMETHOD nsIWidget::Scroll ( PRInt32  aDx,
PRInt32  aDy,
nsRect aClipRect 
) [pure virtual, inherited]

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.

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWindow, nsWindow, nsWidget, nsCocoaWindow, nsWindow, nsWidget, nsWindow, nsCommonWidget, nsWindow, and nsWindow.

Here is the caller graph for this function:

NS_IMETHODIMP nsBaseWidget::ScrollRect ( nsRect aSrcRect,
PRInt32  aDx,
PRInt32  aDy 
) [virtual]

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

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

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:

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:

Reimplemented in nsChildView, nsWindow, and nsWidget.

Definition at line 792 of file nsBaseWidget.cpp.

{
  mBounds = aRect;

  return NS_OK;
}

Here is the caller graph for this function:

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

Implements nsIWidget.

Definition at line 227 of file nsBaseWidget.cpp.

{
  mClientData = aClientData;
  return NS_OK;
}
NS_IMETHOD nsIWidget::SetColorMap ( nsColorMap aColorMap) [pure virtual, inherited]

Set the color map for this widget.

Parameters:
aColorMapcolor map for displaying this widget

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsCocoaWindow, nsWidget, nsWindow, nsWidget, and nsCommonWidget.

NS_METHOD nsBaseWidget::SetCursor ( nsCursor  aCursor) [virtual]

Set the cursor for this widget.

Parameters:
aCursorthe new cursor for this widget

Implements nsIWidget.

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

Definition at line 487 of file nsBaseWidget.cpp.

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

Sets an image as the cursor for this widget.

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

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, and nsWindow.

Definition at line 493 of file nsBaseWidget.cpp.

NS_IMETHOD nsIWidget::SetFocus ( PRBool  aRaise = PR_FALSE) [pure virtual, inherited]
NS_IMETHOD nsIWidget::SetFont ( const nsFont aFont) [pure virtual, inherited]

Set the font for this widget.

Parameters:
aFontfont to display. See nsFont for allowable fonts

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsWidget, nsWindow, nsCommonWidget, and nsMacControl.

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]

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;
}
NS_IMETHOD nsIWidget::SetMenuBar ( nsIMenuBar aMenuBar) [pure virtual, inherited]

Set the widget's MenuBar.

Must be called after Create.

Parameters:
aMenuBarthe menubar

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWindow, nsWindow, nsWidget, nsWindow, nsCocoaWindow, nsWidget, and nsCommonWidget.

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::SetModal ( PRBool  aModal) [virtual]

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]

Reparent a widget.

Change the widgets parent

Parameters:
aNewParentnew parent

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 263 of file nsBaseWidget.cpp.

NS_IMETHOD nsIWidget::SetPreferredSize ( PRInt32  aWidth,
PRInt32  aHeight 
) [pure virtual, inherited]

Set the preferred width and height for the widget.

  

Implemented in nsWindow, nsChildView, nsWindow, nsWidget, nsWindow, nsWindow, nsCocoaWindow, nsWidget, nsWidget, nsCommonWidget, nsCommonWidget, nsLabel, nsLabel, and nsLabel.

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:

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_IMETHOD nsIWidget::SetTitle ( const nsAString &  aTitle) [pure virtual, inherited]

Set the widget's title.

Must be called after Create.

Parameters:
aTitlestring displayed as the title of the widget

Implemented in nsWindow, nsChildView, nsWindow, nsWidget, nsWindow, nsWindow, nsWidget, nsCocoaWindow, nsWidget, nsWindow, nsMacWindow, nsWindow, nsCommonWidget, nsWindow, and nsWindow.

Here is the caller graph for this function:

NS_METHOD nsBaseWidget::SetWindowClass ( char *  aClass) [virtual]

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:

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:

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_IMETHOD nsIWidget::Show ( PRBool  aState) [pure virtual, inherited]

Show or hide this widget.

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsCocoaWindow, nsCommonWidget, nsWidget, nsMacWindow, nsWidget, nsWindow, nsWidget, nsWindow, nsFrameWindow, nsNativeScrollbar, nsMacControl, and nsCommonWidget.

Here is the caller graph for this function:

NS_IMETHOD nsIWidget::ShowMenuBar ( PRBool  aShow) [pure virtual, inherited]

Set the widget's MenuBar's visibility.

Parameters:
aShowPR_TRUE to show, PR_FALSE to hide

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWindow, nsWindow, nsWidget, nsWindow, nsCocoaWindow, nsWidget, and nsCommonWidget.

NS_IMETHOD nsIWidget::Update ( ) [pure virtual, inherited]

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

See also:
Invalidate()

Implemented in nsWindow, nsChildView, nsWidget, nsWindow, nsWindow, nsWidget, nsWindow, nsCocoaWindow, nsWindow, nsMacWindow, nsWindow, nsWidget, nsWindow, and nsCommonWidget.

Here is the caller graph for this function:

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

Validate the widget.

Implements nsIWidget.

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

Definition at line 205 of file nsBaseWidget.cpp.

{
  return NS_OK;
}
NS_IMETHOD nsIWidget::WidgetToScreen ( const nsRect aOldRect,
nsRect aNewRect 
) [pure virtual, inherited]

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

Implemented in nsWindow, nsChildView, nsWindow, nsWindow, nsWindow, nsWidget, nsWidget, nsWindow, nsWidget, nsCocoaWindow, nsCommonWidget, nsWindow, and nsWindow.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 163 of file nsBaseWidget.h.

Definition at line 168 of file nsBaseWidget.h.

Definition at line 172 of file nsBaseWidget.h.

Definition at line 178 of file nsBaseWidget.h.

Definition at line 160 of file nsBaseWidget.h.

Definition at line 162 of file nsBaseWidget.h.

Definition at line 170 of file nsBaseWidget.h.

EVENT_CALLBACK nsBaseWidget::mEventCallback [protected]

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.

Definition at line 169 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 175 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 174 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 176 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 173 of file nsBaseWidget.h.

nsIWidget* nsIWidget::mLastChild [protected, inherited]

Definition at line 1047 of file nsIWidget.h.

Definition at line 167 of file nsBaseWidget.h.

Definition at line 165 of file nsBaseWidget.h.

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

Definition at line 1048 of file nsIWidget.h.

Reimplemented in nsWindow.

Definition at line 177 of file nsBaseWidget.h.

Definition at line 179 of file nsBaseWidget.h.

nsIWidget* nsIWidget::mPrevSibling [protected, inherited]

Definition at line 1049 of file nsIWidget.h.

Definition at line 181 of file nsBaseWidget.h.

Definition at line 164 of file nsBaseWidget.h.

Definition at line 171 of file nsBaseWidget.h.

Definition at line 180 of file nsBaseWidget.h.


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