Back to index

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

#include <nsCommonWidget.h>

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

List of all members.

Public Member Functions

 nsCommonWidget ()
virtual ~nsCommonWidget ()
virtual nsIWidgetGetParent (void)
 Return the parent Widget of this Widget or nsnull if this is a top level window.
void CommonCreate (nsIWidget *aParent, PRBool aListenForResizes)
void InitButtonEvent (nsMouseEvent &aEvent, GdkEventButton *aGdkEvent)
void InitMouseScrollEvent (nsMouseScrollEvent &aEvent, GdkEventScroll *aGdkEvent)
void InitKeyEvent (nsKeyEvent &aEvent, GdkEventKey *aGdkEvent)
void DispatchGotFocusEvent (void)
void DispatchLostFocusEvent (void)
void DispatchActivateEvent (void)
void DispatchDeactivateEvent (void)
void DispatchResizeEvent (nsRect &aRect, nsEventStatus &aStatus)
NS_IMETHOD DispatchEvent (nsGUIEvent *aEvent, nsEventStatus &aStatus)
 Dispatches an event to the widget.
virtual void NativeResize (PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)=0
virtual void NativeResize (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)=0
virtual void NativeShow (PRBool aAction)=0
NS_IMETHOD Show (PRBool aState)
 Show or hide this widget.
NS_IMETHOD Resize (PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
 Resize this widget.
NS_IMETHOD Resize (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
 Move or resize this widget.
NS_IMETHOD GetPreferredSize (PRInt32 &aWidth, PRInt32 &aHeight)
 Returns the preferred width and height for the widget.
NS_IMETHOD SetPreferredSize (PRInt32 aWidth, PRInt32 aHeight)
 Set the preferred width and height for the widget.
NS_IMETHOD Enable (PRBool aState)
 Enable or disable this Widget.
NS_IMETHOD IsEnabled (PRBool *aState)
 Ask whether the widget is enabled.
void OnDestroy (void)
PRBool AreBoundsSane (void)
 nsCommonWidget ()
 ~nsCommonWidget ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
Show (PRBool)
 Show or hide this widget.
NS_IMETHOD IsVisible (PRBool &)
 Returns whether the window is visible.
NS_IMETHOD ConstrainPosition (PRBool, PRInt32 *, PRInt32 *)
 Perform platform-dependent sanity check on a potential window position.
NS_IMETHOD Move (PRInt32, PRInt32)
 Move this widget.
NS_IMETHOD Resize (PRInt32, PRInt32, PRBool)
 Resize this widget.
NS_IMETHOD Resize (PRInt32, PRInt32, PRInt32, PRInt32, PRBool)
 Move or resize this widget.
NS_IMETHOD Enable (PRBool)
 Enable or disable this Widget.
NS_IMETHOD IsEnabled (PRBool *)
 Ask whether the widget is enabled.
NS_IMETHOD SetFocus (PRBool araise=PR_FALSE)
 Give focus to this widget.
virtual nsIFontMetricsGetFont ()
 Get the font for this widget.
NS_IMETHOD SetFont (const nsFont &)
 Set the font for this widget.
NS_IMETHOD Invalidate (PRBool)
 Invalidate the widget and repaint it.
NS_IMETHOD Invalidate (const nsRect &, int)
NS_IMETHOD Update ()
 Force a synchronous repaint of the window if there are dirty rects.
NS_IMETHOD SetColorMap (nsColorMap *)
 Set the color map for this widget.
NS_IMETHOD Scroll (PRInt32, PRInt32, nsRect *)
 XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.
NS_IMETHOD ScrollWidgets (PRInt32 aDx, PRInt32 aDy)
 Scroll the contents of the widget.
NS_IMETHOD SetModal (PRBool aModal)
 Make the window modal.
virtual voidGetNativeData (PRUint32)
NS_IMETHOD SetTitle (const nsAString &)
 Set the widget's title.
NS_IMETHOD SetMenuBar (nsIMenuBar *)
 Set the widget's MenuBar.
NS_IMETHOD ShowMenuBar (PRBool)
 Set the widget's MenuBar's visibility.
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 WidgetToScreen (const nsRect &, nsRect &)
 Convert from this widget coordinates to screen coordinates.
NS_IMETHOD ScreenToWidget (const nsRect &, nsRect &)
 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 GetPreferredSize (PRInt32 &, PRInt32 &)
 Returns the preferred width and height for the widget.
NS_IMETHOD SetPreferredSize (PRInt32, PRInt32)
 Set the preferred width and height for the widget.
NS_IMETHOD DispatchEvent (nsGUIEvent *, nsEventStatus &)
 Dispatches an event to the widget.
NS_IMETHOD CaptureRollupEvents (nsIRollupListener *, PRBool, PRBool)
 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 Create (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData)
 Create and initialize a widget.
NS_IMETHOD Create (nsNativeWidget aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData)
 Create and initialize a widget with a native window parent.
nsCursor GetCursor ()
 Get the cursor for this widget.
NS_METHOD SetCursor (nsCursor aCursor)
 Set the cursor for this widget.
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 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.
NS_IMETHOD SetCursor (imgIContainer *aCursor, PRUint32 aHotspotX, PRUint32 aHotspotY)
 Sets an image as the cursor for this widget.
NS_IMETHOD GetWindowType (nsWindowType &aWindowType)
 Get the window type of this widget.
NS_IMETHOD SetWindowType (nsWindowType aWindowType)
NS_IMETHOD SetWindowTranslucency (PRBool aTranslucent)
 Set the translucency of the top-level window containing this widget.
NS_IMETHOD GetWindowTranslucency (PRBool &aTranslucent)
 Get the translucency of the top-level window that contains this widget.
NS_IMETHOD UpdateTranslucentWindowAlpha (const nsRect &aRect, PRUint8 *aAlphas)
 Update the alpha channel for some pixels of the top-level window that contains this widget.
NS_IMETHOD HideWindowChrome (PRBool aShouldHide)
 Hide window chrome (borders, buttons) for this widget.
NS_IMETHOD MakeFullScreen (PRBool aFullScreen)
 Put the toplevel window into or out of fullscreen mode.
nsresult MakeFullScreenInternal (PRBool aFullScreen)
virtual nsIRenderingContextGetRenderingContext ()
virtual nsIDeviceContextGetDeviceContext ()
virtual nsIAppShellGetAppShell ()
virtual nsIToolkitGetToolkit ()
 Return the widget's toolkit.
NS_IMETHOD ModalEventFilter (PRBool aRealEvent, void *aEvent, PRBool *aForWindow)
 Determine whether a given event should be processed assuming we are the currently active modal window.
NS_IMETHOD GetWindowClass (char *aClass)
 Gets the window class implemented in gtk.
NS_IMETHOD SetWindowClass (char *aClass)
 Sets the window class implemented in gtk.
NS_IMETHOD SetBorderStyle (nsBorderStyle aBorderStyle)
 Set border style Must be called before Create.
NS_IMETHOD AddMouseListener (nsIMouseListener *aListener)
 Processes a mouse pressed event.
NS_IMETHOD AddEventListener (nsIEventListener *aListener)
 Processes a mouse pressed event.
NS_IMETHOD AddMenuListener (nsIMenuListener *aListener)
 Add a menu listener This interface should only be called by the menu services manager This will AddRef() the menu listener This will Release() a previously set menu listener.
NS_IMETHOD SetBounds (const nsRect &aRect)
NS_IMETHOD GetBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetBoundsAppUnits (nsRect &aRect, float aAppUnits)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetClientBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetBorderSize (PRInt32 &aWidth, PRInt32 &aHeight)
 Calculates the border width and height.
NS_IMETHOD Paint (nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect)
 Paints default border (XXX - this should be done by CSS)
NS_IMETHOD ScrollRect (nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
 Scroll an area of this widget.
NS_IMETHOD EnableDragDrop (PRBool aEnable)
 Enables the dropping of files to a widget (XXX this is temporary)
NS_IMETHOD GetAttention (PRInt32 aCycleCount)
 Bring this window to the user's attention.
NS_IMETHOD GetLastInputEventTime (PRUint32 &aTime)
 Get the last user input event time in milliseconds.
NS_IMETHOD SetIcon (const nsAString &anIconSpec)
 Set the widget's icon.
virtual void ConvertToDeviceCoordinates (nscoord &aX, nscoord &aY)
virtual void FreeNativeData (void *data, PRUint32 aDataType)
nsIWidgetGetFirstChild () const
 Return the first child of this widget.
nsIWidgetGetLastChild () const
 Return the last child of this widget.
nsIWidgetGetNextSibling () const
 Return the next sibling of this widget.
void SetNextSibling (nsIWidget *aSibling)
 Set the next sibling of this widget.
nsIWidgetGetPrevSibling () const
 Return the previous sibling of this widget.
void SetPrevSibling (nsIWidget *aSibling)
 Set the previous sibling of this widget.
NS_IMETHOD Invalidate (const nsRect &aRect, PRBool aIsSynchronous)=0
 Invalidate a specified rect for a widget and repaints it.

Protected Types

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

Protected Member Functions

virtual bool mousePressEvent (QMouseEvent *)
virtual bool mouseReleaseEvent (QMouseEvent *)
virtual bool mouseDoubleClickEvent (QMouseEvent *)
virtual bool mouseMoveEvent (QMouseEvent *)
virtual bool wheelEvent (QWheelEvent *)
virtual bool keyPressEvent (QKeyEvent *)
virtual bool keyReleaseEvent (QKeyEvent *)
virtual bool focusInEvent (QFocusEvent *)
virtual bool focusOutEvent (QFocusEvent *)
virtual bool enterEvent (QEvent *)
virtual bool leaveEvent (QEvent *)
virtual bool paintEvent (QPaintEvent *)
virtual bool moveEvent (QMoveEvent *)
virtual bool resizeEvent (QResizeEvent *)
virtual bool closeEvent (QCloseEvent *)
virtual bool contextMenuEvent (QContextMenuEvent *)
virtual bool imStartEvent (QIMEvent *)
virtual bool imComposeEvent (QIMEvent *)
virtual bool imEndEvent (QIMEvent *)
virtual bool dragEnterEvent (QDragEnterEvent *)
virtual bool dragMoveEvent (QDragMoveEvent *)
virtual bool dragLeaveEvent (QDragLeaveEvent *)
virtual bool dropEvent (QDropEvent *)
virtual bool showEvent (QShowEvent *)
virtual bool hideEvent (QHideEvent *)
virtual QWidget * createQWidget (QWidget *parent, nsWidgetInitData *aInitData)=0
virtual void NativeResize (PRInt32, PRInt32, PRInt32, PRInt32, PRBool)
virtual void NativeResize (PRInt32, PRInt32, PRBool)
virtual void NativeShow (PRBool)
bool ignoreEvent (nsEventStatus aStatus) const
void Initialize (QWidget *widget)
 Has to be called in subclasses after they created the actual QWidget if they overwrite the Create calls from the nsCommonWidget class.
void DispatchGotFocusEvent (void)
void DispatchLostFocusEvent (void)
void DispatchActivateEvent (void)
void DispatchDeactivateEvent (void)
void DispatchResizeEvent (nsRect &aRect, nsEventStatus &aStatus)
void InitKeyEvent (nsKeyEvent *nsEvent, QKeyEvent *qEvent)
void InitMouseEvent (nsMouseEvent *nsEvent, QMouseEvent *qEvent, int aClickCount)
void InitMouseWheelEvent (nsMouseScrollEvent *aEvent, QWheelEvent *qEvent)
void CommonCreate (nsIWidget *aParent, PRBool aListenForResizes)
PRBool AreBoundsSane () const
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 BaseCreate (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData)

Protected Attributes

nsCOMPtr< nsIWidgetmParent
PRPackedBool mIsTopLevel
PRPackedBool mIsDestroyed
PRPackedBool mNeedsResize
PRPackedBool mNeedsMove
PRPackedBool mListenForResizes
PRPackedBool mIsShown
PRPackedBool mNeedsShow
PRBool mEnabled
PRBool mCreated
PRBool mPlaced
PRUint32 mPreferredWidth
PRUint32 mPreferredHeight
QWidget * mContainer
QWidget * mWidget
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 Member Functions

nsresult NativeCreate (nsIWidget *aParent, QWidget *aNativeParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData)

Friends

class nsQtEventDispatcher
 Event handlers (proxied from the actual qwidget).
class InterceptContainer
class MozQWidget

Detailed Description

Definition at line 72 of file nsCommonWidget.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

Definition at line 59 of file nsCommonWidget.cpp.

{
}

Member Function Documentation

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

Internal methods.

Implements nsIWidget.

Definition at line 284 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Processes a mouse pressed event.

Implements nsIWidget.

Definition at line 718 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

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

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

Implements nsIWidget.

Definition at line 735 of file nsBaseWidget.cpp.

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

Processes a mouse pressed event.

Implements nsIWidget.

Definition at line 705 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

Definition at line 461 of file nsCommonWidget.cpp.

{
    if (mBounds.width > 0 && mBounds.height > 0)
        return PR_TRUE;

    return PR_FALSE;
}

Here is the caller graph for this function:

PRBool nsCommonWidget::AreBoundsSane ( ) const [protected]
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.

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

Definition at line 764 of file nsCommonWidget.cpp.

{
    qWarning("XXXXXX BeginResizingChildren");
    return  NS_ERROR_NOT_IMPLEMENTED;
}
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 nsCommonWidget::CaptureRollupEvents ( nsIRollupListener aListener,
PRBool  aDoCapture,
PRBool  aConsumeRollupEvent 
) [virtual]

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.

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

Definition at line 817 of file nsCommonWidget.cpp.

{
    return NS_OK;
}
bool nsCommonWidget::closeEvent ( QCloseEvent *  ) [protected, virtual]

Definition at line 1195 of file nsCommonWidget.cpp.

{
    nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, this);

    event.point.x = 0;
    event.point.y = 0;

    nsEventStatus status;
    DispatchEvent(&event, status);

    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCommonWidget::CommonCreate ( nsIWidget aParent,
PRBool  aListenForResizes 
)

Definition at line 73 of file nsCommonWidget.cpp.

{
    mParent = aParent;
    mListenForResizes = aListenForResizes;
    mCreated = PR_TRUE;
}

Here is the caller graph for this function:

void nsCommonWidget::CommonCreate ( nsIWidget aParent,
PRBool  aListenForResizes 
) [protected]
NS_IMETHODIMP nsCommonWidget::ConstrainPosition ( PRBool  aAllowSlop,
PRInt32 aX,
PRInt32 aY 
) [virtual]

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.

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

Definition at line 325 of file nsCommonWidget.cpp.

{
    if (mContainer) {
        PRInt32 screenWidth  = QApplication::desktop()->width();
        PRInt32 screenHeight = QApplication::desktop()->height();
        if (aAllowSlop) {
            if (*aX < (kWindowPositionSlop - mBounds.width))
                *aX = kWindowPositionSlop - mBounds.width;
            if (*aX > (screenWidth - kWindowPositionSlop))
                *aX = screenWidth - kWindowPositionSlop;
            if (*aY < (kWindowPositionSlop - mBounds.height))
                *aY = kWindowPositionSlop - mBounds.height;
            if (*aY > (screenHeight - kWindowPositionSlop))
                *aY = screenHeight - kWindowPositionSlop;
        } else {
            if (*aX < 0)
                *aX = 0;
            if (*aX > (screenWidth - mBounds.width))
                *aX = screenWidth - mBounds.width;
            if (*aY < 0)
                *aY = 0;
            if (*aY > (screenHeight - mBounds.height))
                *aY = screenHeight - mBounds.height;
        }
    }
    return NS_OK;
}
bool nsCommonWidget::contextMenuEvent ( QContextMenuEvent *  ) [protected, virtual]

Definition at line 1209 of file nsCommonWidget.cpp.

{
    //qDebug("context menu");
    return false;
}

Here is the caller graph for this function:

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

Implements nsIWidget.

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

Definition at line 135 of file nsBaseWidget.h.

{}
NS_IMETHODIMP nsCommonWidget::Create ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell,
nsIToolkit aToolkit,
nsWidgetInitData aInitData 
) [virtual]

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.

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

Definition at line 1381 of file nsCommonWidget.cpp.

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

Here is the call graph for this function:

NS_IMETHODIMP nsCommonWidget::Create ( nsNativeWidget  aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell,
nsIToolkit aToolkit,
nsWidgetInitData aInitData 
) [virtual]

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.

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

Definition at line 1390 of file nsCommonWidget.cpp.

{
    return NativeCreate(nsnull, (QWidget*)aParent, aRect, aHandleEventFunction, aContext, aAppShell,
                        aToolkit, aInitData);
}

Here is the call graph for this function:

virtual QWidget* nsCommonWidget::createQWidget ( QWidget *  parent,
nsWidgetInitData aInitData 
) [protected, pure virtual]

Implemented in nsNativeScrollbar, and nsWindow.

Here is the caller graph for this function:

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

Close and destroy the internal native window.

This method does not delete the widget.

Implements nsIWidget.

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

Definition at line 238 of file nsBaseWidget.cpp.

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

  return NS_OK;
}

Here is the call graph for this function:

Reimplemented in nsWindow.

Definition at line 178 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

Reimplemented in nsWindow.

Definition at line 186 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

NS_IMETHODIMP nsCommonWidget::DispatchEvent ( nsGUIEvent event,
nsEventStatus aStatus 
) [virtual]

Dispatches an event to the widget.

  

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 209 of file nsCommonWidget.cpp.

{
    aStatus = nsEventStatus_eIgnore;

    // hold a widget reference while we dispatch this event
    NS_ADDREF(aEvent->widget);

    // send it to the standard callback
    if (mEventCallback)
        aStatus = (* mEventCallback)(aEvent);

    // dispatch to event listener if event was not consumed
    if ((aStatus != nsEventStatus_eIgnore) && mEventListener)
        aStatus = mEventListener->ProcessEvent(*aEvent);

    NS_IF_RELEASE(aEvent->widget);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsCommonWidget::DispatchEvent ( nsGUIEvent event,
nsEventStatus aStatus 
) [virtual]

Dispatches an event to the widget.

  

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 162 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

Definition at line 170 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

Definition at line 194 of file nsCommonWidget.cpp.

{
    nsSizeEvent event(PR_TRUE, NS_SIZE, this);

    event.windowSize = &aRect;
    event.point.x = aRect.x;
    event.point.y = aRect.y;
    event.mWinWidth = aRect.width;
    event.mWinHeight = aRect.height;

    nsEventStatus status;
    DispatchEvent(&event, status); 
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCommonWidget::DispatchResizeEvent ( nsRect aRect,
nsEventStatus aStatus 
) [protected]
bool nsCommonWidget::dragEnterEvent ( QDragEnterEvent *  ) [protected, virtual]

Definition at line 1237 of file nsCommonWidget.cpp.

{
    qDebug("XXX dragEnterEvent");
    return false;
}

Here is the caller graph for this function:

bool nsCommonWidget::dragLeaveEvent ( QDragLeaveEvent *  ) [protected, virtual]

Definition at line 1251 of file nsCommonWidget.cpp.

{
    qDebug("XXX dragLeaveEvent");
    return false;
}

Here is the caller graph for this function:

bool nsCommonWidget::dragMoveEvent ( QDragMoveEvent *  ) [protected, virtual]

Definition at line 1244 of file nsCommonWidget.cpp.

{
    qDebug("XXX dragMoveEvent");
    return false;
}

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

bool nsCommonWidget::dropEvent ( QDropEvent *  ) [protected, virtual]

Definition at line 1258 of file nsCommonWidget.cpp.

{
    qDebug("XXX dropEvent");
    return false;
}

Here is the caller graph for this function:

NS_IMETHOD nsCommonWidget::Enable ( PRBool  aState) [virtual]

Enable or disable this Widget.

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

Implements nsIWidget.

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

Enable or disable this Widget.

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

Implements nsIWidget.

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

Definition at line 424 of file nsCommonWidget.cpp.

{
    mEnabled = aState;

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

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

  

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 915 of file nsBaseWidget.cpp.

{
  return NS_OK;
}

Call this when finished adjusting child windows.

Must be preceded by BeginResizingChildren().

Implements nsIWidget.

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

Definition at line 771 of file nsCommonWidget.cpp.

{
    qWarning("XXXXXXX EndResizingChildren");
    return NS_ERROR_NOT_IMPLEMENTED;
}
bool nsCommonWidget::enterEvent ( QEvent *  ) [protected, virtual]

Definition at line 1069 of file nsCommonWidget.cpp.

{
    nsMouseEvent event(PR_TRUE, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);

    QPoint pt = QCursor::pos();

    event.point.x = nscoord(pt.x());
    event.point.y = nscoord(pt.y());

    nsEventStatus status;
    DispatchEvent(&event, status);
    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::focusInEvent ( QFocusEvent *  ) [protected, virtual]

Definition at line 1038 of file nsCommonWidget.cpp.

{
    if (!mWidget)
        return FALSE;

#ifdef DEBUG_WIDGETS
    qDebug("focusInEvent mWidget=%p, mContainer=%p", (void*)mWidget, (void*)mContainer);
#endif

    DispatchGotFocusEvent();

    DispatchActivateEvent();

    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::focusOutEvent ( QFocusEvent *  ) [protected, virtual]

Definition at line 1055 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("focusOutEvent mWidget=%p,mContainer = %p", (void*)mWidget, (void*)mContainer);
#endif

    DispatchLostFocusEvent();
    if (mContainer)
        DispatchDeactivateEvent();

    return FALSE;
}

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 nsBaseWidget::GetAttention ( PRInt32  aCycleCount) [virtual, inherited]

Bring this window to the user's attention.

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

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

Implements nsIWidget.

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

Definition at line 934 of file nsBaseWidget.cpp.

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

Get the background color for this widget.

Returns:
this widget's background color

Implements nsIWidget.

Definition at line 461 of file nsBaseWidget.cpp.

{
  return mBackground;
}

Here is the caller graph for this function:

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

Calculates the border width and height.

Implements nsIWidget.

Definition at line 805 of file nsBaseWidget.cpp.

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

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

  return NS_OK;
}

Here is the call graph for this function:

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

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

Implements nsIWidget.

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

Definition at line 757 of file nsBaseWidget.cpp.

{
  aRect = mBounds;
  return NS_OK;
}

Here is the caller graph for this function:

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

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

Definition at line 777 of file nsBaseWidget.cpp.

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

Here is the caller graph for this function:

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

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsFrameWindow.

Definition at line 748 of file nsBaseWidget.cpp.

{
  return GetBounds(aRect);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Implements nsIWidget.

Definition at line 221 of file nsBaseWidget.cpp.

{
  aClientData = mClientData;
  return NS_OK;
}

Get the cursor for this widget.

Returns:
this widget's cursor.

Reimplemented from nsBaseWidget.

Definition at line 1446 of file nsCommonWidget.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:

Get the font for this widget.

Returns:
the font metrics

Implements nsIWidget.

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

Definition at line 575 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qWarning("nsCommonWidget.cpp: GetFont not implemented");
#endif
    return nsnull;
}
nscolor nsBaseWidget::GetForegroundColor ( void  ) [virtual, inherited]

Get the foreground color for this widget.

Returns:
this widget's foreground color

Implements nsIWidget.

Definition at line 438 of file nsBaseWidget.cpp.

{
  return mForeground;
}

Here is the caller graph for this function:

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

Return the last child of this widget.

Will return null if there are no children.

Definition at line 382 of file nsIWidget.h.

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

Get the last user input event time in milliseconds.

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

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

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 939 of file nsBaseWidget.cpp.

void * nsCommonWidget::GetNativeData ( PRUint32  aDataType) [virtual]

Implements nsIWidget.

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

Definition at line 670 of file nsCommonWidget.cpp.

{
    switch(aDataType) {
    case NS_NATIVE_WINDOW:
        return mWidget;
        break;

    case NS_NATIVE_DISPLAY:
        if (mWidget)
            return mWidget->x11Display();
        break;

    case NS_NATIVE_WIDGET:
        return mWidget;
        break;

    case NS_NATIVE_PLUGIN_PORT:
        if (mWidget)
            return (void*)mWidget->winId();
        break;

    default:
        break;
    }

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

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 64 of file nsCommonWidget.cpp.

{
    nsIWidget *retval;
    retval = mParent;
    NS_IF_ADDREF(retval);
    return retval;
}
NS_IMETHOD nsCommonWidget::GetPreferredSize ( PRInt32 aWidth,
PRInt32 aHeight 
) [virtual]

Returns the preferred width and height for the widget.

  

Implements nsIWidget.

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

NS_IMETHODIMP nsCommonWidget::GetPreferredSize ( PRInt32 aWidth,
PRInt32 aHeight 
) [virtual]

Returns the preferred width and height for the widget.

  

Implements nsIWidget.

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

Definition at line 405 of file nsCommonWidget.cpp.

{
    aWidth  = mPreferredWidth;
    aHeight = mPreferredHeight;
    return (mPreferredWidth != 0 && mPreferredHeight != 0) ? 
        NS_OK : 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:

Implements nsIWidget.

Definition at line 605 of file nsBaseWidget.cpp.

{
  nsresult                      rv;
  nsCOMPtr<nsIRenderingContext> renderingCtx;

  if (mOnDestroyCalled)
    return nsnull;

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nsBaseWidget.

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

Definition at line 1539 of file nsCommonWidget.cpp.

{
       nsRect origin(0,0,mBounds.width,mBounds.height);
       WidgetToScreen(origin, aRect);
       return NS_OK;
}

Here is the call graph for this function:

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

Return size mode (minimized, maximized, normalized).

Returns a value from nsSizeMode (see nsGUIEvent.h)

Implements nsIWidget.

Definition at line 427 of file nsBaseWidget.cpp.

                                                      {

  *aMode = mSizeMode;
  return NS_OK;
}

Here is the caller graph for this function:

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

Return the widget's toolkit.

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

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 639 of file nsBaseWidget.cpp.

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

Gets the window class implemented in gtk.

Implements nsIWidget.

Reimplemented in nsWidget.

Definition at line 684 of file nsBaseWidget.cpp.

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

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

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

Implements nsIWidget.

Definition at line 526 of file nsBaseWidget.cpp.

                                                                      {
  aTranslucent = PR_FALSE;
  return NS_OK;
}

Here is the caller graph for this function:

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

Get the window type of this widget.

Parameters:
aWindowTypethe window type of the widget

Implements nsIWidget.

Definition at line 504 of file nsBaseWidget.cpp.

{
  aWindowType = mWindowType;
  return NS_OK;
}

Here is the caller graph for this function:

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

Gets the widget's z-index.

Implements nsIWidget.

Definition at line 388 of file nsBaseWidget.cpp.

{
  *aZIndex = mZIndex;
  return NS_OK;
}
bool nsCommonWidget::hideEvent ( QHideEvent *  ) [protected, virtual]

Definition at line 1292 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("hideEvent mWidget=%p", (void*)mWidget);
#endif
    return false;
}

Here is the caller graph for this function:

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:

bool nsCommonWidget::ignoreEvent ( nsEventStatus  aStatus) const [protected]

Definition at line 1507 of file nsCommonWidget.cpp.

{
      switch(aStatus) {
    case nsEventStatus_eIgnore:
        return(PR_FALSE);

    case nsEventStatus_eConsumeNoDefault:
        return(PR_TRUE);

    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:

bool nsCommonWidget::imComposeEvent ( QIMEvent *  ) [protected, virtual]

Definition at line 1223 of file nsCommonWidget.cpp.

{
    qWarning("XXX imComposeEvent");
    return false;
}

Here is the caller graph for this function:

bool nsCommonWidget::imEndEvent ( QIMEvent *  ) [protected, virtual]

Definition at line 1230 of file nsCommonWidget.cpp.

{
    qWarning("XXX imComposeEvent");
    return false;
}

Here is the caller graph for this function:

bool nsCommonWidget::imStartEvent ( QIMEvent *  ) [protected, virtual]

Definition at line 1216 of file nsCommonWidget.cpp.

{
    qWarning("XXX imStartEvent");
    return false;
}

Here is the caller graph for this function:

void nsCommonWidget::InitButtonEvent ( nsMouseEvent aEvent,
GdkEventButton *  aGdkEvent 
)

Definition at line 81 of file nsCommonWidget.cpp.

{
    aEvent.point.x = nscoord(aGdkEvent->x);
    aEvent.point.y = nscoord(aGdkEvent->y);

    aEvent.isShift   = (aGdkEvent->state & GDK_SHIFT_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isControl = (aGdkEvent->state & GDK_CONTROL_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isAlt     = (aGdkEvent->state & GDK_MOD1_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isMeta    = (aGdkEvent->state & GDK_MOD4_MASK)
        ? PR_TRUE : PR_FALSE;

    switch (aGdkEvent->type) {
    case GDK_2BUTTON_PRESS:
        aEvent.clickCount = 2;
        break;
    case GDK_3BUTTON_PRESS:
        aEvent.clickCount = 3;
        break;
        // default is one click
    default:
        aEvent.clickCount = 1;
    }
}

Here is the caller graph for this function:

void nsCommonWidget::Initialize ( QWidget *  widget) [protected]

Has to be called in subclasses after they created the actual QWidget if they overwrite the Create calls from the nsCommonWidget class.

Definition at line 269 of file nsCommonWidget.cpp.

{
    Q_ASSERT(widget);

    mWidget = widget;
    mWidget->setMouseTracking(PR_TRUE);
    mWidget->setFocusPolicy(QWidget::WheelFocus);
}

Here is the caller graph for this function:

void nsCommonWidget::InitKeyEvent ( nsKeyEvent aEvent,
GdkEventKey *  aGdkEvent 
)

Definition at line 147 of file nsCommonWidget.cpp.

{
    aEvent.keyCode   = GdkKeyCodeToDOMKeyCode(aGdkEvent->keyval);
    aEvent.isShift   = (aGdkEvent->state & GDK_SHIFT_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isControl = (aGdkEvent->state & GDK_CONTROL_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isAlt     = (aGdkEvent->state & GDK_MOD1_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isMeta    = (aGdkEvent->state & GDK_MOD4_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.time      = aGdkEvent->time;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCommonWidget::InitKeyEvent ( nsKeyEvent nsEvent,
QKeyEvent *  qEvent 
) [protected]

Definition at line 1301 of file nsCommonWidget.cpp.

{
    nsEvent->isShift   = qEvent->state() & Qt::ShiftButton;
    nsEvent->isControl = qEvent->state() & Qt::ControlButton;
    nsEvent->isAlt     = qEvent->state() & Qt::AltButton;
    nsEvent->isMeta    = qEvent->state() & Qt::MetaButton;
    nsEvent->time      = 0;

    if (qEvent->text().length() && qEvent->text()[0].isPrint()) {
        nsEvent->charCode = (PRInt32)qEvent->text()[0].unicode();
    }
    else {
        nsEvent->charCode = 0;
    }

    if (nsEvent->charCode) {
        nsEvent->keyCode = 0;
    }
    else {
        nsEvent->keyCode = NS_GetKey(qEvent->key());
    }
}

Here is the call graph for this function:

void nsCommonWidget::InitMouseEvent ( nsMouseEvent nsEvent,
QMouseEvent *  qEvent,
int  aClickCount 
) [protected]

Definition at line 1325 of file nsCommonWidget.cpp.

{
    nsEvent->point.x = nscoord(qEvent->x());
    nsEvent->point.y = nscoord(qEvent->y());

    nsEvent->isShift         = qEvent->state() & Qt::ShiftButton;
    nsEvent->isControl       = qEvent->state() & Qt::ControlButton;
    nsEvent->isAlt           = qEvent->state() & Qt::AltButton;
    nsEvent->isMeta          = qEvent->state() & Qt::MetaButton;
    nsEvent->clickCount      = aClickCount;
}

Here is the caller graph for this function:

void nsCommonWidget::InitMouseScrollEvent ( nsMouseScrollEvent aEvent,
GdkEventScroll *  aGdkEvent 
)

Definition at line 110 of file nsCommonWidget.cpp.

{
    switch (aGdkEvent->direction) {
    case GDK_SCROLL_UP:
        aEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
        aEvent.delta = -3;
        break;
    case GDK_SCROLL_DOWN:
        aEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
        aEvent.delta = 3;
        break;
    case GDK_SCROLL_LEFT:
        aEvent.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
        aEvent.delta = -3;
        break;
    case GDK_SCROLL_RIGHT:
        aEvent.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
        aEvent.delta = 3;
        break;
    }

    aEvent.point.x = nscoord(aGdkEvent->x);
    aEvent.point.y = nscoord(aGdkEvent->y);

    aEvent.isShift   = (aGdkEvent->state & GDK_SHIFT_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isControl = (aGdkEvent->state & GDK_CONTROL_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isAlt     = (aGdkEvent->state & GDK_MOD1_MASK)
        ? PR_TRUE : PR_FALSE;
    aEvent.isMeta    = (aGdkEvent->state & GDK_MOD4_MASK)
        ? PR_TRUE : PR_FALSE;
    
}

Here is the caller graph for this function:

void nsCommonWidget::InitMouseWheelEvent ( nsMouseScrollEvent aEvent,
QWheelEvent *  qEvent 
) [protected]

Definition at line 1338 of file nsCommonWidget.cpp.

{
    switch (qEvent->orientation()) {
    case Qt::Vertical:
        aEvent->scrollFlags = nsMouseScrollEvent::kIsVertical;
        break;
    case Qt::Horizontal:
        aEvent->scrollFlags = nsMouseScrollEvent::kIsHorizontal;
        break;
    default:
        Q_ASSERT(0);
        break;
    }
    aEvent->delta = (int)((qEvent->delta() / WHEEL_DELTA) * -3);

    aEvent->point.x = nscoord(qEvent->x());
    aEvent->point.y = nscoord(qEvent->y());

    aEvent->isShift         = qEvent->state() & Qt::ShiftButton;
    aEvent->isControl       = qEvent->state() & Qt::ControlButton;
    aEvent->isAlt           = qEvent->state() & Qt::AltButton;
    aEvent->isMeta          = qEvent->state() & Qt::MetaButton;
    aEvent->time            = 0;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsCommonWidget::Invalidate ( PRBool  aIsSynchronous) [virtual]

Invalidate the widget and repaint it.

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

Implements nsIWidget.

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

Definition at line 590 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("nsCommonWidget::Invalidate1 container=%p widget=%p", (void*)mContainer, (void*)mWidget);
#endif
    if (!mWidget)
        return NS_OK;

    if (aIsSynchronous)
        mWidget->repaint();
    else
        mWidget->update();

    return NS_OK;
}
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, inherited]

Invalidate a specified region for a widget and repaints it.

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

Implements nsIWidget.

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

Definition at line 210 of file nsBaseWidget.cpp.

{
  return NS_ERROR_FAILURE;
}
NS_IMETHOD nsCommonWidget::IsEnabled ( PRBool aState) [virtual]

Ask whether the widget is enabled.

Parameters:
aStatereturns PR_TRUE if the widget is enabled

Implements nsIWidget.

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

Ask whether the widget is enabled.

Parameters:
aStatereturns PR_TRUE if the widget is enabled

Implements nsIWidget.

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

Definition at line 432 of file nsCommonWidget.cpp.

{
    *aState = mEnabled;

    return NS_OK;
}

Returns whether the window is visible.

  

Implements nsIWidget.

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

Definition at line 315 of file nsCommonWidget.cpp.

{
    if (mWidget)
        visible = mWidget->isVisible();
    else
        visible = PR_FALSE;
    return NS_OK;
}
bool nsCommonWidget::keyPressEvent ( QKeyEvent *  e) [protected, virtual]

Definition at line 983 of file nsCommonWidget.cpp.

{
    //qDebug("keyPressEvent");

    nsEventStatus status;

    // If the key repeat flag isn't set then set it so we don't send
    // another key down event on the next key press -- DOM events are
    // key down, key press and key up.  X only has key press and key
    // release.  gtk2 already filters the extra key release events for
    // us.

    nsKeyEvent pressEvent(PR_TRUE, NS_KEY_PRESS, this);
    InitKeyEvent(&pressEvent, e);
    pressEvent.charCode = (PRInt32)e->text()[0].unicode();

    if (!e->isAutoRepeat()) {

        // send the key down event
        nsKeyEvent downEvent(PR_TRUE, NS_KEY_DOWN, this);
        InitKeyEvent(&downEvent, e);
        DispatchEvent(&downEvent, status);
        if (ignoreEvent(status)) { // If prevent default on keydown, do same for keypress
          pressEvent.flags |= NS_EVENT_FLAG_NO_DEFAULT;
        }
    }

    // before we dispatch a key, check if it's the context menu key.
    // If so, send a context menu key event instead.
    if (isContextMenuKey(pressEvent)) {
        nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);
        keyEventToContextMenuEvent(&pressEvent, &contextMenuEvent);
        DispatchEvent(&contextMenuEvent, status);
    }
    else {
        // send the key press event
        DispatchEvent(&pressEvent, status);
    }

    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::keyReleaseEvent ( QKeyEvent *  e) [protected, virtual]

Definition at line 1026 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::leaveEvent ( QEvent *  aEvent) [protected, virtual]

Definition at line 1084 of file nsCommonWidget.cpp.

{
    nsMouseEvent event(PR_TRUE, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);

    QPoint pt = QCursor::pos();

    event.point.x = nscoord(pt.x());
    event.point.y = nscoord(pt.y());

    nsEventStatus status;
    DispatchEvent(&event, status);
    return FALSE;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBaseWidget::MakeFullScreen ( PRBool  aFullScreen) [virtual, inherited]

Put the toplevel window into or out of fullscreen mode.

Implements nsIWidget.

Reimplemented in nsWindow, and nsWindow.

Definition at line 551 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

Definition at line 557 of file nsBaseWidget.cpp.

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

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

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

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

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

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

Implements nsIWidget.

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

Definition at line 926 of file nsBaseWidget.cpp.

{
  *aForWindow = PR_TRUE;
  return NS_OK;
}
bool nsCommonWidget::mouseDoubleClickEvent ( QMouseEvent *  e) [protected, virtual]

Definition at line 934 of file nsCommonWidget.cpp.

{
    PRUint32      eventType;

    switch (e->button()) {
    case Qt::MidButton:
        eventType = NS_MOUSE_MIDDLE_BUTTON_DOWN;
        break;
    case Qt::RightButton:
        eventType = NS_MOUSE_RIGHT_BUTTON_DOWN;
        break;
    default:
        eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
        break;
    }

    nsMouseEvent event(PR_TRUE, eventType, this, nsMouseEvent::eReal);

    InitMouseEvent(&event, e, 2);
    //pressed
    nsEventStatus status;
    DispatchEvent(&event, status);
    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::mouseMoveEvent ( QMouseEvent *  e) [protected, virtual]

Definition at line 960 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::mousePressEvent ( QMouseEvent *  e) [protected, virtual]

Definition at line 869 of file nsCommonWidget.cpp.

{
    //qDebug("mousePressEvent mWidget=%p", (void*)mWidget);
//     backTrace();
    PRUint32      eventType;

    switch (e->button()) {
    case Qt::MidButton:
        eventType = NS_MOUSE_MIDDLE_BUTTON_DOWN;
        break;
    case Qt::RightButton:
        eventType = NS_MOUSE_RIGHT_BUTTON_DOWN;
        break;
    default:
        eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
        break;
    }

    nsMouseEvent event(PR_TRUE, eventType, this, nsMouseEvent::eReal);

    InitMouseEvent(&event, e, 1);

    nsEventStatus status;
    DispatchEvent(&event, status);

    // right menu click on linux should also pop up a context menu
    if (eventType == NS_MOUSE_RIGHT_BUTTON_DOWN) {
        nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
                                      nsMouseEvent::eReal);
        InitMouseEvent(&contextMenuEvent, e, 1);
        DispatchEvent(&contextMenuEvent, status);
    }

    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool nsCommonWidget::mouseReleaseEvent ( QMouseEvent *  e) [protected, virtual]

Definition at line 906 of file nsCommonWidget.cpp.

{
    //qDebug("mouseReleaseEvent mWidget=%p", (void*)mWidget);
    PRUint32      eventType;

    switch (e->button()) {
    case Qt::MidButton:
        eventType = NS_MOUSE_MIDDLE_BUTTON_UP;
        break;
    case Qt::RightButton:
        eventType = NS_MOUSE_RIGHT_BUTTON_UP;
        break;
    default:
        eventType = NS_MOUSE_LEFT_BUTTON_UP;
        break;
    }

    nsMouseEvent event(PR_TRUE, eventType, this, nsMouseEvent::eReal);

    InitMouseEvent(&event, e, 1);

    //not pressed
    nsEventStatus status;
    DispatchEvent(&event, status);
    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsCommonWidget::Move ( PRInt32  aX,
PRInt32  aY 
) [virtual]

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.

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

Definition at line 354 of file nsCommonWidget.cpp.

{
    bool popup = mWidget ? mWidget->isPopup() : false;

    if (!mWidget || (x == mBounds.x && y == mBounds.y &&
                     !popup))
        return NS_OK;

#ifdef DEBUG_WIDGETS
    qDebug("Move [%d,%d] (%s)", x, y, popup?"popup":"widget");
#endif

    if (!mWidget)
        return NS_OK;

    QPoint pos(x, y);
    if (mContainer) {
        if (mParent && mWidget->isPopup()) {
            nsRect oldrect, newrect;
            oldrect.x = x;
            oldrect.y = y;

            mParent->WidgetToScreen(oldrect, newrect);

            pos = QPoint(newrect.x, newrect.y);
#ifdef DEBUG_WIDGETS
            qDebug("pos is [%d,%d]", pos.x(), pos.y());
#endif
        } else {
            qDebug("Widget within another? (%p)", (void*)mWidget);
        }
    }

    mBounds.x = pos.x();
    mBounds.y = pos.y();

    mWidget->move(pos);

    return NS_OK;
}

Here is the call graph for this function:

bool nsCommonWidget::moveEvent ( QMoveEvent *  e) [protected, virtual]

Definition at line 1129 of file nsCommonWidget.cpp.

{
    // can we shortcut?
    if (!mWidget || (mBounds.x == e->pos().x() &&
                     mBounds.y == e->pos().y()))
        return FALSE;

#ifdef DEBUG_WIDGETS
    bool shown = mWidget ? mWidget->isShown() : false;
    bool popup = mWidget ? mWidget->isPopup() : false;

    qDebug("moveEvent mWidget=%p %d %d (%s, %s)", (void*)mWidget, e->pos().x(), e->pos().y(),
           shown? "shown": "hidden", popup ? "popup": "widget");
#endif

    // Toplevel windows need to have their bounds set so that we can
    // keep track of our location.  It's not often that the x,y is set
    // by the layout engine.  Width and height are set elsewhere.
    QPoint pos = e->pos();

    if (mContainer) {
        // Need to translate this into the right coordinates
        nsRect oldrect, newrect;
        WidgetToScreen(oldrect, newrect);
        mBounds.x = newrect.x;
        mBounds.y = newrect.y;
#ifdef DEBUG_WIDGETS
        qDebug("BOUNDS are [%d, %d]", mBounds.x, mBounds.y);
#endif
    }

    nsGUIEvent event(PR_TRUE, NS_MOVE, this);
    event.point.x = pos.x();
    event.point.y = pos.y();

    // XXX mozilla will invalidate the entire window after this move
    // complete.  wtf?
    nsEventStatus status;
    DispatchEvent(&event, status);
    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsCommonWidget::NativeCreate ( nsIWidget aParent,
QWidget *  aNativeParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell,
nsIToolkit aToolkit,
nsWidgetInitData aInitData 
) [private]

Definition at line 1399 of file nsCommonWidget.cpp.

{
    // only set the base parent if we're going to be a dialog or a
    // toplevel
    nsIWidget *baseParent = aInitData &&
                            (aInitData->mWindowType == eWindowType_dialog ||
                             aInitData->mWindowType == eWindowType_toplevel ||
                             aInitData->mWindowType == eWindowType_invisible) ?
                            nsnull : aParent;

    // initialize all the common bits of this class
    BaseCreate(baseParent, aRect, aHandleEventFunction, aContext,
               aAppShell, aToolkit, aInitData);

    // Do we need to listen for resizes?
    PRBool listenForResizes = PR_FALSE;;
    if (aNativeParent || (aInitData && aInitData->mListenForResizes))
        listenForResizes = PR_TRUE;

    // and do our common creation
    CommonCreate(aParent, listenForResizes);

    // save our bounds
    mBounds = aRect;

    QWidget *parent = 0;
    if (aParent != nsnull)
        parent = (QWidget*)aParent->GetNativeData(NS_NATIVE_WIDGET);
    else
        parent = aNativeParent;

    mWidget = createQWidget(parent, aInitData);

    Initialize(mWidget);

    Resize(mBounds.width, mBounds.height, PR_FALSE);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCommonWidget::NativeResize ( PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [pure virtual]

Implemented in nsWindow.

Definition at line 1561 of file nsCommonWidget.cpp.

{
    mNeedsResize = PR_FALSE;

    mWidget->resize( aWidth, aHeight);

    if (aRepaint) {
        if (mWidget->isVisible())
            mWidget->repaint(false);
    }
}

Here is the caller graph for this function:

void nsCommonWidget::NativeResize ( PRInt32  aX,
PRInt32  aY,
PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [pure virtual]

Implemented in nsWindow.

Definition at line 1574 of file nsCommonWidget.cpp.

{
    mNeedsResize = PR_FALSE;

    QPoint pos(aX, aY);
    if (mContainer)
    {
        if (mParent && mWidget->isPopup()) {
            nsRect oldrect, newrect;
            oldrect.x = aX;
            oldrect.y = aY;

            mParent->WidgetToScreen(oldrect, newrect);

            pos = QPoint(newrect.x, newrect.y);
#ifdef DEBUG_WIDGETS
            qDebug("pos is [%d,%d]", pos.x(), pos.y());
#endif
        } else {
#ifdef DEBUG_WIDGETS
            qDebug("Widget with original position? (%p)", mWidget);
#endif
        }
    }

    mWidget->setGeometry(pos.x(), pos.y(), aWidth, aHeight);

    if (aRepaint) {
        if (mWidget->isVisible())
            mWidget->repaint(false);
    }
}

Here is the call graph for this function:

virtual void nsCommonWidget::NativeResize ( PRInt32  ,
PRInt32  ,
PRInt32  ,
PRInt32  ,
PRBool   
) [protected, virtual]

Reimplemented in nsWindow.

virtual void nsCommonWidget::NativeResize ( PRInt32  ,
PRInt32  ,
PRBool   
) [protected, virtual]

Reimplemented in nsWindow.

void nsCommonWidget::NativeShow ( PRBool  aAction) [pure virtual]

Implemented in nsWindow.

Definition at line 1547 of file nsCommonWidget.cpp.

{
    mNeedsShow = PR_FALSE;

    if (!mWidget) {
         //XXX: apperently can be null during the printing, check whether
         //     that's true
         qDebug("nsCommon::Show : widget empty");
         return;
    }
    mWidget->setShown(aState);
}

Here is the caller graph for this function:

virtual void nsCommonWidget::NativeShow ( PRBool  ) [protected, virtual]

Reimplemented in nsWindow.

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 440 of file nsCommonWidget.cpp.

{
    if (mOnDestroyCalled)
        return;

    mOnDestroyCalled = PR_TRUE;

    // release references to children, device context, toolkit + app shell
    nsBaseWidget::OnDestroy();

    // let go of our parent
    mParent = nsnull;

    nsCOMPtr<nsIWidget> kungFuDeathGrip = this;

    nsGUIEvent event(PR_TRUE, NS_DESTROY, this);
    nsEventStatus status;
    DispatchEvent(&event, status);
}

Here is the call 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:

bool nsCommonWidget::paintEvent ( QPaintEvent *  e) [protected, virtual]

Definition at line 1099 of file nsCommonWidget.cpp.

{
    //qDebug("paintEvent: mWidget=%p x = %d, y = %d, width =  %d, height = %d", (void*)mWidget,
    //e->rect().x(), e->rect().y(), e->rect().width(), e->rect().height());
//     qDebug("paintEvent: Widgetrect %d %d %d %d", mWidget->x(), mWidget->y(),
//            mWidget->width(), mWidget->height());

    QRect r = e->rect();
    if (!r.isValid())
        r = mWidget->rect();
    nsRect rect(r.x(), r.y(), r.width(), r.height());

    nsCOMPtr<nsIRenderingContext> rc = getter_AddRefs(GetRenderingContext());

    // Generate XPFE paint event
    nsPaintEvent event(PR_TRUE, NS_PAINT, this);
    event.point.x = 0;
    event.point.y = 0;
    event.rect = &rect;
    // XXX fix this!
    event.region = nsnull;
    // XXX fix this!
    event.renderingContext = rc;

    nsEventStatus status;
    DispatchEvent(&event, status);
    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller 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:

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:

NS_IMETHOD nsCommonWidget::Resize ( PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [virtual]

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.

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

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

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.

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

NS_IMETHODIMP nsCommonWidget::Resize ( PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [virtual]

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.

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

Definition at line 268 of file nsCommonWidget.cpp.

{
    mBounds.width = aWidth;
    mBounds.height = aHeight;

    if (!mCreated)
        return NS_OK;

    // There are several cases here that we need to handle, based on a
    // matrix of the visibility of the widget, the sanity of this resize
    // and whether or not the widget was previously sane.

    // Has this widget been set to visible?
    if (mIsShown) {
        // Are the bounds sane?
        if (AreBoundsSane()) {
            // Yep?  Resize the window
            //Maybe, the toplevel has moved

            // Note that if the widget needs to be shown because it
            // was previously insane in Resize(x,y,w,h), then we need
            // to set the x and y here too, because the widget wasn't
            // moved back then
            if (mIsTopLevel || mNeedsShow)
                NativeResize(mBounds.x, mBounds.y,
                             mBounds.width, mBounds.height, aRepaint);
            else
                NativeResize(mBounds.width, mBounds.height, aRepaint);

            // Does it need to be shown because it was previously insane?
            if (mNeedsShow)
                NativeShow(PR_TRUE);
        }
        else {
            // If someone has set this so that the needs show flag is false
            // and it needs to be hidden, update the flag and hide the
            // window.  This flag will be cleared the next time someone
            // hides the window or shows it.  It also prevents us from
            // calling NativeShow(PR_FALSE) excessively on the window which
            // causes unneeded X traffic.
            if (!mNeedsShow) {
                mNeedsShow = PR_TRUE;
                NativeShow(PR_FALSE);
            }
        }
    }
    // If the widget hasn't been shown, mark the widget as needing to be
    // resized before it is shown.
    else {
        if (AreBoundsSane() && mListenForResizes) {
            // For widgets that we listen for resizes for (widgets created
            // with native parents) we apparently _always_ have to resize.  I
            // dunno why, but apparently we're lame like that.
            NativeResize(aWidth, aHeight, aRepaint);
        }
        else {
            mNeedsResize = PR_TRUE;
        }
    }

    // synthesize a resize event if this isn't a toplevel
    if (mIsTopLevel || mListenForResizes) {
        nsRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
        nsEventStatus status;
        DispatchResizeEvent(rect, status);
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsCommonWidget::Resize ( PRInt32  aX,
PRInt32  aY,
PRInt32  aWidth,
PRInt32  aHeight,
PRBool  aRepaint 
) [virtual]

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.

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

Definition at line 339 of file nsCommonWidget.cpp.

{
    mBounds.x = aX;
    mBounds.y = aY;
    mBounds.width = aWidth;
    mBounds.height = aHeight;

    mPlaced = PR_TRUE;

    if (!mCreated)
        return NS_OK;

    // There are several cases here that we need to handle, based on a
    // matrix of the visibility of the widget, the sanity of this resize
    // and whether or not the widget was previously sane.

    // Has this widget been set to visible?
    if (mIsShown) {
        // Are the bounds sane?
        if (AreBoundsSane()) {
            // Yep?  Resize the window
            NativeResize(aX, aY, aWidth, aHeight, aRepaint);
            // Does it need to be shown because it was previously insane?
            if (mNeedsShow)
                NativeShow(PR_TRUE);
        }
        else {
            // If someone has set this so that the needs show flag is false
            // and it needs to be hidden, update the flag and hide the
            // window.  This flag will be cleared the next time someone
            // hides the window or shows it.  It also prevents us from
            // calling NativeShow(PR_FALSE) excessively on the window which
            // causes unneeded X traffic.
            if (!mNeedsShow) {
                mNeedsShow = PR_TRUE;
                NativeShow(PR_FALSE);
            }
        }
    }
    // If the widget hasn't been shown, mark the widget as needing to be
    // resized before it is shown
    else {
        if (AreBoundsSane() && mListenForResizes){
            // For widgets that we listen for resizes for (widgets created
            // with native parents) we apparently _always_ have to resize.  I
            // dunno why, but apparently we're lame like that.
            NativeResize(aX, aY, aWidth, aHeight, aRepaint);
        }
        else {
            mNeedsResize = PR_TRUE;
            mNeedsMove = PR_TRUE;
        }
    }

    if (mIsTopLevel || mListenForResizes) {
        // synthesize a resize event
        nsRect rect(aX, aY, aWidth, aHeight);
        nsEventStatus status;
        DispatchResizeEvent(rect, status);
    }

    return NS_OK;
}

Here is the call graph for this function:

bool nsCommonWidget::resizeEvent ( QResizeEvent *  e) [protected, virtual]

Definition at line 1172 of file nsCommonWidget.cpp.

{
    nsRect rect;

    // Generate XPFE resize event
    GetBounds(rect);
    rect.width = e->size().width();
    rect.height = e->size().height();

    mBounds.width = rect.width;
    mBounds.height = rect.height;

#ifdef DEBUG_WIDGETS
    qDebug("resizeEvent: mWidget=%p, aWidth=%d, aHeight=%d, aX = %d, aY = %d", (void*)mWidget,
           rect.width, rect.height, rect.x, rect.y);
#endif

    nsEventStatus status;
    DispatchResizeEvent(rect, status);
    return ignoreEvent(status);
}

Here is the call graph for this function:

Here is the caller 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 nsCommonWidget::ScreenToWidget ( const nsRect aOldRect,
nsRect aNewRect 
) [virtual]

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.

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

Definition at line 747 of file nsCommonWidget.cpp.

{
    if (mWidget) {
        PRInt32 X,Y;

        QPoint offset(0,0);
        offset = mWidget->mapFromGlobal(offset);
        X = offset.x();
        Y = offset.y();

        aNewRect.x = aOldRect.x + X;
        aNewRect.y = aOldRect.y + Y;
    }
    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsCommonWidget::Scroll ( PRInt32  aDx,
PRInt32  aDy,
nsRect aClipRect 
) [virtual]

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.

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

Definition at line 643 of file nsCommonWidget.cpp.

{
    if (mWidget)
        mWidget->scroll(aDx, aDy);

    // Update bounds on our child windows
    for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
        nsRect bounds;
        kid->GetBounds(bounds);
        bounds.x += aDx;
        bounds.y += aDy;
        NS_STATIC_CAST(nsBaseWidget*, kid)->SetBounds(bounds);
    }
    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;
}

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

Reimplemented from nsBaseWidget.

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

Definition at line 660 of file nsCommonWidget.cpp.

{
    if (mWidget)
        mWidget->scroll(aDx, aDy);

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

Set the background color for this widget.

Parameters:
aColorthe new background color

Implements nsIWidget.

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

Definition at line 471 of file nsBaseWidget.cpp.

{
  mBackground = aColor;
  return NS_OK;
}

Here is the caller graph for this function:

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

Set border style Must be called before Create.

Parameters:
aBorderStyle
See also:
nsBorderStyle

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 694 of file nsBaseWidget.cpp.

{
  mBorderStyle = aBorderStyle;
  return NS_OK;
}

Here is the caller graph for this function:

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

Reimplemented in nsChildView, nsWindow, and nsWidget.

Definition at line 792 of file nsBaseWidget.cpp.

{
  mBounds = aRect;

  return NS_OK;
}

Here is the caller graph for this function:

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

Implements nsIWidget.

Definition at line 227 of file nsBaseWidget.cpp.

{
  mClientData = aClientData;
  return NS_OK;
}

Set the color map for this widget.

Parameters:
aColorMapcolor map for displaying this widget

Implements nsIWidget.

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

Definition at line 637 of file nsCommonWidget.cpp.

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

Sets an image as the cursor for this widget.

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

Implements nsIWidget.

Reimplemented in nsWindow, nsChildView, nsWindow, and nsWindow.

Definition at line 493 of file nsBaseWidget.cpp.

Set the cursor for this widget.

Parameters:
aCursorthe new cursor for this widget

Reimplemented from nsBaseWidget.

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

Definition at line 1451 of file nsCommonWidget.cpp.

{
    mCursor = aCursor;
    Qt::CursorShape cursor = Qt::ArrowCursor;
    switch(mCursor) {
    case eCursor_standard:
       cursor = Qt::ArrowCursor;
        break;
    case eCursor_wait:
        cursor = Qt::WaitCursor;
        break;
    case eCursor_select:
        cursor = Qt::IbeamCursor;
        break;
    case eCursor_hyperlink:
        cursor = Qt::PointingHandCursor;
        break;
    case eCursor_ew_resize:
        cursor = Qt::SplitHCursor;
        break;
    case eCursor_ns_resize:
        cursor = Qt::SplitVCursor;
        break;
    case eCursor_nw_resize:
    case eCursor_se_resize:
       cursor = Qt::SizeBDiagCursor;
        break;
    case eCursor_ne_resize:
    case eCursor_sw_resize:
       cursor = Qt::SizeFDiagCursor;
        break;
    case eCursor_crosshair:
    case eCursor_move:
       cursor = Qt::SizeAllCursor;
        break;
    case eCursor_help:
       cursor = Qt::WhatsThisCursor;
        break;
    case eCursor_copy:
    case eCursor_alias:
        break;
    case eCursor_context_menu:
    case eCursor_cell:
    case eCursor_grab:
    case eCursor_grabbing:
    case eCursor_spinning:
    case eCursor_zoom_in:
    case eCursor_zoom_out:

    default:
        break;
    }
    mWidget->setCursor(cursor);
    return NS_OK;
}

Give focus to this widget.

Implements nsIWidget.

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

Definition at line 557 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("SetFocus mWidget=%p, mContainer=%p, focuswidget=%p (%d)",
           (void*)mWidget, (void*)mContainer, (void*)mWidget->focusWidget());
#endif
    if (mWidget) {
        if (aRaise)
            mWidget->raise();
        mWidget->setFocus();

        DispatchGotFocusEvent();
    }

    return NS_OK;
}

Here is the call graph for this function:

Set the font for this widget.

Parameters:
aFontfont to display. See nsFont for allowable fonts

Implements nsIWidget.

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

Definition at line 584 of file nsCommonWidget.cpp.

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

Set the foreground color for this widget.

Parameters:
aColorthe new foreground color

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 449 of file nsBaseWidget.cpp.

{
  mForeground = aColor;
  return NS_OK;
}

Here is the caller graph for this function:

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

Set the widget's icon.

Must be called after Create.

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 944 of file nsBaseWidget.cpp.

{
  return NS_OK;
}

Set the widget's MenuBar.

Must be called after Create.

Parameters:
aMenuBarthe menubar

Implements nsIWidget.

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

Definition at line 711 of file nsCommonWidget.cpp.

{
    qWarning("XXXXX SetMenuBar");
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_METHOD nsCommonWidget::SetModal ( PRBool  aModal) [virtual]

Make the window modal.

  

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 1526 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("------------> SetModal mWidget=%p",(void*) mWidget);
#endif

    MozQWidget *mozWidget = qt_cast<MozQWidget*>(mWidget);
    if (mozWidget)
        mozWidget->setModal(aModal);

    return NS_OK;
}

Here is the call graph for this function:

void nsIWidget::SetNextSibling ( nsIWidget aSibling) [inline, inherited]

Set the next sibling of this widget.

Definition at line 396 of file nsIWidget.h.

                                             {
        mNextSibling = aSibling;
    }

Here is the caller graph for this function:

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

Reparent a widget.

Change the widgets parent

Parameters:
aNewParentnew parent

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 263 of file nsBaseWidget.cpp.

NS_IMETHOD nsCommonWidget::SetPreferredSize ( PRInt32  aWidth,
PRInt32  aHeight 
) [virtual]

Set the preferred width and height for the widget.

  

Implements nsIWidget.

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

NS_IMETHODIMP nsCommonWidget::SetPreferredSize ( PRInt32  aWidth,
PRInt32  aHeight 
) [virtual]

Set the preferred width and height for the widget.

  

Implements nsIWidget.

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

Definition at line 415 of file nsCommonWidget.cpp.

{
    mPreferredWidth  = aWidth;
    mPreferredHeight = aHeight;
    return NS_OK;
}
void nsIWidget::SetPrevSibling ( nsIWidget aSibling) [inline, inherited]

Set the previous sibling of this widget.

Definition at line 410 of file nsIWidget.h.

                                             {
        mPrevSibling = aSibling;
    }

Here is the caller graph for this function:

NS_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 nsCommonWidget::SetTitle ( const nsAString &  aTitle) [virtual]

Set the widget's title.

Must be called after Create.

Parameters:
aTitlestring displayed as the title of the widget

Implements nsIWidget.

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

Definition at line 699 of file nsCommonWidget.cpp.

{
    nsAString::const_iterator it;
    QString qStr = QString::fromUcs2(str.BeginReading(it).get());

    if (mContainer)
        mContainer->setCaption(qStr);

    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:

Show or hide this widget.

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, nsWindow, nsMacWindow, nsWindow, nsWindow, nsFrameWindow, nsNativeScrollbar, and nsMacControl.

NS_IMETHODIMP nsCommonWidget::Show ( PRBool  aState) [virtual]

Show or hide this widget.

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

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, nsWindow, nsMacWindow, nsWindow, nsWindow, nsFrameWindow, nsNativeScrollbar, and nsMacControl.

Definition at line 231 of file nsCommonWidget.cpp.

{
    mIsShown = aState;

    LOG(("nsCommonWidget::Show [%p] state %d\n", (void *)this, aState));

    // Ok, someone called show on a window that isn't sized to a sane
    // value.  Mark this window as needing to have Show() called on it
    // and return.
    if ((aState && !AreBoundsSane()) || !mCreated) {
        LOG(("\tbounds are insane or window hasn't been created yet\n"));
        mNeedsShow = PR_TRUE;
        return NS_OK;
    }

    // If someone is hiding this widget, clear any needing show flag.
    if (!aState)
        mNeedsShow = PR_FALSE;

    // If someone is showing this window and it needs a resize then
    // resize the widget.
    if (aState) {
        if (mNeedsMove) {
            LOG(("\tresizing\n"));
            NativeResize(mBounds.x, mBounds.y, mBounds.width, mBounds.height,
                         PR_FALSE);
        } else if (mNeedsResize) {
            NativeResize(mBounds.width, mBounds.height, PR_FALSE);
        }
    }

    NativeShow(aState);

    return NS_OK;
}

Here is the call graph for this function:

bool nsCommonWidget::showEvent ( QShowEvent *  ) [protected, virtual]

Definition at line 1265 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("showEvent mWidget=%p", (void*)mWidget);
#endif

    QRect r = mWidget->rect();
    nsRect rect(r.x(), r.y(), r.width(), r.height());

    nsCOMPtr<nsIRenderingContext> rc = getter_AddRefs(GetRenderingContext());
       // Generate XPFE paint event
    nsPaintEvent event(PR_TRUE, NS_PAINT, this);
    event.point.x = 0;
    event.point.y = 0;
    event.rect = &rect;
    // XXX fix this!
    event.region = nsnull;
    // XXX fix this!
    event.renderingContext = rc;

    nsEventStatus status;
    DispatchEvent(&event, status);

    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Set the widget's MenuBar's visibility.

Parameters:
aShowPR_TRUE to show, PR_FALSE to hide

Implements nsIWidget.

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

Definition at line 718 of file nsCommonWidget.cpp.

{

    qWarning("XXXXX ShowMenuBar");
    return NS_ERROR_NOT_IMPLEMENTED;
}

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

See also:
Invalidate()

Implements nsIWidget.

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

Definition at line 624 of file nsCommonWidget.cpp.

{
#ifdef DEBUG_WIDGETS
    qDebug("nsCommonWidget::Update container=%p widget=%p", (void*)mContainer, (void*)mWidget);
#endif
    if (!mWidget)
        return NS_OK;
    mWidget->update();

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

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

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

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

Implements nsIWidget.

Definition at line 531 of file nsBaseWidget.cpp.

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

Validate the widget.

Implements nsIWidget.

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

Definition at line 205 of file nsBaseWidget.cpp.

{
  return NS_OK;
}
bool nsCommonWidget::wheelEvent ( QWheelEvent *  e) [protected, virtual]

Definition at line 971 of file nsCommonWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsCommonWidget::WidgetToScreen ( const nsRect aOldRect,
nsRect aNewRect 
) [virtual]

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.

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

Definition at line 726 of file nsCommonWidget.cpp.

{
    aNewRect.width = aOldRect.width;
    aNewRect.height = aOldRect.height;

    if (mWidget) {
        PRInt32 x,y;

        QPoint offset(0,0);
        offset = mWidget->mapToGlobal(offset);
        x = offset.x();
        y = offset.y();

        aNewRect.x = aOldRect.x + x;
        aNewRect.y = aOldRect.y + y;
    }

    return NS_OK;
}

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class InterceptContainer [friend]

Definition at line 135 of file nsCommonWidget.h.

friend class MozQWidget [friend]

Definition at line 136 of file nsCommonWidget.h.

friend class nsQtEventDispatcher [friend]

Event handlers (proxied from the actual qwidget).

They follow normal Qt widget semantics.

Definition at line 134 of file nsCommonWidget.h.


Member Data Documentation

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

Definition at line 163 of file nsBaseWidget.h.

nscolor nsBaseWidget::mBackground [protected, inherited]

Definition at line 168 of file nsBaseWidget.h.

nsBorderStyle nsBaseWidget::mBorderStyle [protected, inherited]

Definition at line 172 of file nsBaseWidget.h.

nsRect nsBaseWidget::mBounds [protected, inherited]

Definition at line 178 of file nsBaseWidget.h.

void* nsBaseWidget::mClientData [protected, inherited]

Definition at line 160 of file nsBaseWidget.h.

QWidget* nsCommonWidget::mContainer [protected]

Reimplemented in nsWindow.

Definition at line 194 of file nsCommonWidget.h.

nsIDeviceContext* nsBaseWidget::mContext [protected, inherited]

Definition at line 162 of file nsBaseWidget.h.

Definition at line 153 of file nsCommonWidget.h.

nsCursor nsBaseWidget::mCursor [protected, inherited]

Definition at line 170 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 151 of file nsCommonWidget.h.

EVENT_CALLBACK nsBaseWidget::mEventCallback [protected, inherited]

Definition at line 161 of file nsBaseWidget.h.

Definition at line 166 of file nsBaseWidget.h.

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

Definition at line 1046 of file nsIWidget.h.

nscolor nsBaseWidget::mForeground [protected, inherited]

Definition at line 169 of file nsBaseWidget.h.

PRPackedBool nsBaseWidget::mIsAltDown [protected, inherited]

Reimplemented in nsWindow.

Definition at line 175 of file nsBaseWidget.h.

Reimplemented in nsWindow.

Definition at line 174 of file nsBaseWidget.h.

Definition at line 137 of file nsCommonWidget.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.

Definition at line 148 of file nsCommonWidget.h.

Definition at line 135 of file nsCommonWidget.h.

nsIWidget* nsIWidget::mLastChild [protected, inherited]

Definition at line 1047 of file nsIWidget.h.

Reimplemented in nsWindow.

Definition at line 146 of file nsCommonWidget.h.

Definition at line 167 of file nsBaseWidget.h.

Definition at line 165 of file nsBaseWidget.h.

Definition at line 144 of file nsCommonWidget.h.

Definition at line 141 of file nsCommonWidget.h.

Definition at line 149 of file nsCommonWidget.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.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 133 of file nsCommonWidget.h.

Definition at line 156 of file nsCommonWidget.h.

Reimplemented in nsWindow.

Definition at line 160 of file nsCommonWidget.h.

Reimplemented in nsWindow.

Definition at line 159 of file nsCommonWidget.h.

nsIWidget* nsIWidget::mPrevSibling [protected, inherited]

Definition at line 1049 of file nsIWidget.h.

nsSizeMode nsBaseWidget::mSizeMode [protected, inherited]

Definition at line 181 of file nsBaseWidget.h.

nsIToolkit* nsBaseWidget::mToolkit [protected, inherited]

Definition at line 164 of file nsBaseWidget.h.

QWidget* nsCommonWidget::mWidget [protected]

Definition at line 195 of file nsCommonWidget.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: