Back to index

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

Base of all GTK+ native widgets. More...

#include <nsWidget.h>

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

List of all members.

Public Member Functions

 nsWidget ()
virtual ~nsWidget ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
Create (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)
 Create and initialize a widget.
NS_IMETHOD Create (nsNativeWidget aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)
 Create and initialize a widget with a native window parent.
NS_IMETHOD Destroy (void)
 Close and destroy the internal native window.
nsIWidgetGetParent (void)
 Return the parent Widget of this Widget or nsnull if this is a top level window.
virtual void OnDestroy ()
NS_IMETHOD Show (PRBool state)
 Show or hide this widget.
NS_IMETHOD CaptureRollupEvents (nsIRollupListener *aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent)
 Enables/Disables system capture of any and all events that would cause a dropdown to be rolled up, This method ignores the aConsumeRollupEvent parameter when aDoCapture is FALSE.
NS_IMETHOD IsVisible (PRBool &aState)
 Returns whether the window is visible.
NS_IMETHOD ConstrainPosition (PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY)
 Perform platform-dependent sanity check on a potential window position.
NS_IMETHOD Move (PRInt32 aX, PRInt32 aY)
 Move 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 Enable (PRBool aState)
 Enable or disable this Widget.
NS_IMETHOD IsEnabled (PRBool *aState)
 Ask whether the widget is enabled.
NS_IMETHOD SetFocus (PRBool aRaise)
 Give focus to this widget.
virtual void LoseFocus (void)
PRBool OnResize (nsSizeEvent *event)
virtual PRBool OnResize (nsRect &aRect)
virtual PRBool OnMove (PRInt32 aX, PRInt32 aY)
NS_IMETHOD SetZIndex (PRInt32 aZIndex)
 Sets the widget's z-index.
nsIFontMetricsGetFont (void)
 Get the font for this widget.
NS_IMETHOD SetFont (const nsFont &aFont)
 Set the font for this widget.
NS_IMETHOD SetBackgroundColor (const nscolor &aColor)
 Set the background color for this widget.
NS_IMETHOD SetCursor (nsCursor aCursor)
 Set the cursor for this widget.
NS_IMETHOD SetColorMap (nsColorMap *aColorMap)
 Set the color map for this widget.
voidGetNativeData (PRUint32 aDataType)
NS_IMETHOD WidgetToScreen (const nsRect &aOldRect, nsRect &aNewRect)
 Convert from this widget coordinates to screen coordinates.
NS_IMETHOD ScreenToWidget (const nsRect &aOldRect, nsRect &aNewRect)
 Convert from screen coordinates to this widget's coordinates.
NS_IMETHOD BeginResizingChildren (void)
 When adjustments are to made to a whole set of child widgets, call this before resizing/positioning the child windows to minimize repaints.
NS_IMETHOD EndResizingChildren (void)
 Call this when finished adjusting child windows.
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 SetTitle (const nsAString &aTitle)
 Set the widget's title.
virtual void ConvertToDeviceCoordinates (nscoord &aX, nscoord &aY)
NS_IMETHOD Scroll (PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
 XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.
NS_IMETHOD SetMenuBar (nsIMenuBar *aMenuBar)
 Set the widget's MenuBar.
NS_IMETHOD ShowMenuBar (PRBool aShow)
 Set the widget's MenuBar's visibility.
NS_IMETHOD CaptureMouse (PRBool aCapture)
 Enables/Disables system mouse capture.
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 Validate ()
 Validate the widget.
NS_IMETHOD Invalidate (PRBool aIsSynchronous)
 Invalidate the widget and repaint it.
NS_IMETHOD Invalidate (const nsRect &aRect, PRBool aIsSynchronous)
 Invalidate a specified rect for a widget and repaints it.
NS_IMETHOD InvalidateRegion (const nsIRegion *aRegion, PRBool aIsSynchronous)
 Invalidate a specified region for a widget and repaints it.
NS_IMETHOD Update (void)
 Force a synchronous repaint of the window if there are dirty rects.
NS_IMETHOD DispatchEvent (nsGUIEvent *event, nsEventStatus &aStatus)
 Dispatches an event to the widget.
NS_IMETHOD ResetInputState ()
NS_IMETHOD SetIMEOpenState (PRBool aState)
NS_IMETHOD GetIMEOpenState (PRBool *aState)
NS_IMETHOD CancelIMEComposition ()
void InitEvent (nsGUIEvent &event, nsPoint *aPoint=nsnull)
PRBool ConvertStatus (nsEventStatus aStatus)
PRBool DispatchMouseEvent (nsMouseEvent &aEvent)
PRBool DispatchStandardEvent (PRUint32 aMsg)
PRBool DispatchFocus (nsGUIEvent &aEvent)
virtual void DispatchSetFocusEvent (void)
virtual void DispatchLostFocusEvent (void)
virtual void DispatchActivateEvent (void)
virtual void DispatchDeactivateEvent (void)
virtual GdkWindow * GetRenderWindow (GtkObject *aGtkWidget)
virtual GdkWindow * GetLayeringWindow ()
virtual GtkWindow * GetTopLevelWindow (void)
PRBool OnKey (nsKeyEvent &aEvent)
PRBool OnText (nsTextEvent &aEvent)
PRBool OnComposition (nsCompositionEvent &aEvent)
PRBool OnInput (nsInputEvent &aEvent)
virtual GtkWidget * GetOwningWidget ()
virtual void ThemeChanged ()
virtual void IMECommitEvent (GdkEventKey *aEvent)
virtual void ResetInternalVisibility ()
void ResetZOrder ()
 nsWidget ()
virtual ~nsWidget ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
Create (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)
 Create and initialize a widget.
NS_IMETHOD Create (nsNativeWidget aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)
 Create and initialize a widget with a native window parent.
NS_IMETHOD Destroy (void)
 Close and destroy the internal native window.
nsIWidgetGetParent (void)
 Return the parent Widget of this Widget or nsnull if this is a top level window.
virtual void OnDestroy ()
NS_IMETHOD SetModal (PRBool aModal)
 Make the window modal.
NS_IMETHOD Show (PRBool state)
 Show or hide this widget.
NS_IMETHOD CaptureRollupEvents (nsIRollupListener *aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent)
 Enables/Disables system capture of any and all events that would cause a dropdown to be rolled up, This method ignores the aConsumeRollupEvent parameter when aDoCapture is FALSE.
NS_IMETHOD IsVisible (PRBool &aState)
 Returns whether the window is visible.
NS_IMETHOD ConstrainPosition (PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY)
 Perform platform-dependent sanity check on a potential window position.
NS_IMETHOD Move (PRInt32 aX, PRInt32 aY)
 Move 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 Enable (PRBool aState)
 Enable or disable this Widget.
NS_IMETHOD IsEnabled (PRBool *aState)
 Ask whether the widget is enabled.
PRBool OnResize (nsSizeEvent event)
virtual PRBool OnResize (nsRect &aRect)
virtual PRBool OnMove (PRInt32 aX, PRInt32 aY)
nsIFontMetricsGetFont (void)
 Get the font for this widget.
NS_IMETHOD SetFont (const nsFont &aFont)
 Set the font for this widget.
NS_IMETHOD SetBackgroundColor (const nscolor &aColor)
 Set the background color for this widget.
NS_IMETHOD SetCursor (nsCursor aCursor)
 Set the cursor for this widget.
NS_IMETHOD SetColorMap (nsColorMap *aColorMap)
 Set the color map for this widget.
voidGetNativeData (PRUint32 aDataType)
NS_IMETHOD WidgetToScreen (const nsRect &aOldRect, nsRect &aNewRect)
 Convert from this widget coordinates to screen coordinates.
NS_IMETHOD ScreenToWidget (const nsRect &aOldRect, nsRect &aNewRect)
 Convert from screen coordinates to this widget's coordinates.
NS_IMETHOD BeginResizingChildren (void)
 When adjustments are to made to a whole set of child widgets, call this before resizing/positioning the child windows to minimize repaints.
NS_IMETHOD EndResizingChildren (void)
 Call this when finished adjusting child windows.
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 SetTitle (const nsAString &aTitle)
 Set the widget's title.
void ConvertToDeviceCoordinates (nscoord &aX, nscoord &aY)
NS_IMETHOD Scroll (PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
 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 SetMenuBar (nsIMenuBar *aMenuBar)
 Set the widget's MenuBar.
NS_IMETHOD ShowMenuBar (PRBool aShow)
 Set the widget's MenuBar's visibility.
NS_IMETHOD CaptureMouse (PRBool aCapture)
 Enables/Disables system mouse capture.
NS_IMETHOD Invalidate (PRBool aIsSynchronous)
 Invalidate the widget and repaint it.
NS_IMETHOD Invalidate (const nsRect &aRect, PRBool aIsSynchronous)
 Invalidate a specified rect for a widget and repaints it.
NS_IMETHOD InvalidateRegion (const nsIRegion *aRegion, PRBool aIsSynchronous)
 Invalidate a specified region for a widget and repaints it.
NS_IMETHOD Update (void)
 Force a synchronous repaint of the window if there are dirty rects.
NS_IMETHOD DispatchEvent (nsGUIEvent *event, nsEventStatus &aStatus)
 Dispatches an event to the widget.
NS_IMETHOD ResetInputState ()
NS_IMETHOD SetIMEOpenState (PRBool aState)
NS_IMETHOD GetIMEOpenState (PRBool *aState)
NS_IMETHOD CancelIMEComposition ()
void InitEvent (nsGUIEvent &event, PRUint32 aEventType, nsPoint *aPoint=nsnull)
PRBool ConvertStatus (nsEventStatus aStatus)
PRBool DispatchMouseEvent (nsMouseEvent &aEvent)
PRBool DispatchStandardEvent (PRUint32 aMsg)
 nsWidget ()
virtual ~nsWidget ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
Create (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)
 Create and initialize a widget.
NS_IMETHOD Create (nsNativeWidget aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell=nsnull, nsIToolkit *aToolkit=nsnull, nsWidgetInitData *aInitData=nsnull)
 Create and initialize a widget with a native window parent.
virtual nsresult StandardWidgetCreate (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData, nsNativeWidget aNativeParent=nsnull)
NS_IMETHOD Destroy ()
 Close and destroy the internal native window.
virtual nsIWidgetGetParent (void)
 Return the parent Widget of this Widget or nsnull if this is a top level window.
NS_IMETHOD Show (PRBool bState)
 Show or hide this widget.
NS_IMETHOD IsVisible (PRBool &aState)
 Returns whether the window is visible.
NS_IMETHOD ConstrainPosition (PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY)
 Perform platform-dependent sanity check on a potential window position.
NS_IMETHOD Move (PRInt32 aX, PRInt32 aY)
 Move 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 Enable (PRBool aState)
 Enable or disable this Widget.
NS_IMETHOD IsEnabled (PRBool *aState)
 Ask whether the widget is enabled.
NS_IMETHOD SetFocus (PRBool aRaise=PR_FALSE)
 Give focus to this widget.
NS_IMETHOD SetName (const char *aName)
NS_IMETHOD SetBackgroundColor (const nscolor &aColor)
 Set the background color for this widget.
virtual nsIFontMetricsGetFont (void)
 Get the font for this widget.
NS_IMETHOD SetFont (const nsFont &aFont)
 Set the font for this widget.
NS_IMETHOD SetCursor (nsCursor aCursor)
 Set the cursor for this widget.
void LockCursor (PRBool aLock)
NS_IMETHOD Invalidate (PRBool aIsSynchronous)
 Invalidate the widget and repaint it.
NS_IMETHOD Invalidate (const nsRect &aRect, PRBool aIsSynchronous)
 Invalidate a specified rect for a widget and repaints it.
NS_IMETHOD Update ()
 Force a synchronous repaint of the window if there are dirty rects.
virtual voidGetNativeData (PRUint32 aDataType)
NS_IMETHOD SetColorMap (nsColorMap *aColorMap)
 Set the color map for this widget.
NS_IMETHOD Scroll (PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
 XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead) Scroll this widget.
NS_IMETHOD SetMenuBar (nsIMenuBar *aMenuBar)
 Set the widget's MenuBar.
NS_IMETHOD ShowMenuBar (PRBool aShow)
 Set the widget's MenuBar's visibility.
NS_IMETHOD SetTooltips (PRUint32 aNumberOfTips, nsRect *aTooltipAreas[])
NS_IMETHOD RemoveTooltips ()
NS_IMETHOD UpdateTooltips (nsRect *aNewTips[])
NS_IMETHOD WidgetToScreen (const nsRect &aOldRect, nsRect &aNewRect)
 Convert from this widget coordinates to screen coordinates.
NS_IMETHOD ScreenToWidget (const nsRect &aOldRect, nsRect &aNewRect)
 Convert from screen coordinates to this widget's coordinates.
NS_IMETHOD BeginResizingChildren (void)
 When adjustments are to made to a whole set of child widgets, call this before resizing/positioning the child windows to minimize repaints.
NS_IMETHOD EndResizingChildren (void)
 Call this when finished adjusting child windows.
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 DispatchEvent (nsGUIEvent *event, nsEventStatus &aStatus)
 Dispatches an event to the widget.
NS_IMETHOD PreCreateWidget (nsWidgetInitData *aInitData)
NS_IMETHOD SetBounds (const nsRect &aRect)
NS_IMETHOD GetRequestedBounds (nsRect &aRect)
NS_IMETHOD CaptureRollupEvents (nsIRollupListener *aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent)
 Enables/Disables system capture of any and all events that would cause a dropdown to be rolled up, This method ignores the aConsumeRollupEvent parameter when aDoCapture is FALSE.
NS_IMETHOD SetTitle (const nsAString &title)
 Set the widget's title.
virtual PRBool OnPaint (nsPaintEvent &event)
virtual PRBool OnResize (nsSizeEvent &event)
virtual PRBool OnDeleteWindow (void)
virtual void OnDestroy (void)
virtual PRBool DispatchMouseEvent (nsMouseEvent &aEvent)
virtual PRBool DispatchKeyEvent (nsKeyEvent &aKeyEvent)
virtual PRBool DispatchDestroyEvent (void)
void SetVisibility (int aState)
void SetIonic (PRBool isIonic)
Cursor XlibCreateCursor (nsCursor aCursorType)
PRBool DispatchWindowEvent (nsGUIEvent &aEvent)
voidCheckParent (long ThisWindow)
PRBool IsMouseInWindow (Window window, PRInt32 inMouseX, PRInt32 inMouseY)
PRBool HandlePopup (PRInt32 inMouseX, PRInt32 inMouseY)
void WidgetShow (nsWidget *aWidget)
NS_IMETHOD GetClientData (void *&aClientData)
 Accessor functions to get and set the client data associated with the widget.
NS_IMETHOD SetClientData (void *aClientData)
NS_IMETHOD SetParent (nsIWidget *aNewParent)
 Reparent a widget.
virtual void AddChild (nsIWidget *aChild)
 Internal methods.
virtual void RemoveChild (nsIWidget *aChild)
NS_IMETHOD 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.
virtual nsCursor GetCursor ()
 Get the cursor for this widget.
NS_IMETHOD SetCursor (imgIContainer *aCursor, PRUint32 aHotspotX, PRUint32 aHotspotY)
 Sets an image as the cursor for this widget.
NS_IMETHOD GetWindowType (nsWindowType &aWindowType)
 Get the window type of this widget.
NS_IMETHOD SetWindowType (nsWindowType aWindowType)
NS_IMETHOD SetWindowTranslucency (PRBool aTranslucent)
 Set the translucency of the top-level window containing this widget.
NS_IMETHOD GetWindowTranslucency (PRBool &aTranslucent)
 Get the translucency of the top-level window that contains this widget.
NS_IMETHOD UpdateTranslucentWindowAlpha (const nsRect &aRect, PRUint8 *aAlphas)
 Update the alpha channel for some pixels of the top-level window that contains this widget.
NS_IMETHOD HideWindowChrome (PRBool aShouldHide)
 Hide window chrome (borders, buttons) for this widget.
NS_IMETHOD MakeFullScreen (PRBool aFullScreen)
 Put the toplevel window into or out of fullscreen mode.
nsresult MakeFullScreenInternal (PRBool aFullScreen)
virtual nsIRenderingContextGetRenderingContext ()
virtual nsIDeviceContextGetDeviceContext ()
virtual nsIAppShellGetAppShell ()
virtual nsIToolkitGetToolkit ()
 Return the widget's toolkit.
NS_IMETHOD ModalEventFilter (PRBool aRealEvent, void *aEvent, PRBool *aForWindow)
 Determine whether a given event should be processed assuming we are the currently active modal window.
NS_IMETHOD 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 GetBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetBoundsAppUnits (nsRect &aRect, float aAppUnits)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetClientBounds (nsRect &aRect)
 If the implementation of nsWindow supports borders this method MUST be overridden.
NS_IMETHOD GetScreenBounds (nsRect &aRect)
 If the implementation of nsWindow uses a local coordinate system within the window, this method must be overridden.
NS_IMETHOD GetBorderSize (PRInt32 &aWidth, PRInt32 &aHeight)
 Calculates the border width and height.
NS_IMETHOD Paint (nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect)
 Paints default border (XXX - this should be done by CSS)
NS_IMETHOD ScrollRect (nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
 Scroll an area of this widget.
NS_IMETHOD 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 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.

Static Public Member Functions

static void SetLastEventTime (guint32 aTime)
static void GetLastEventTime (guint32 *aTime)
static void DropMotionTarget (void)
static void DragStarted (void)
static void SetInstance (PtWidget_t *pWidget, nsWidget *inst)
static nsWidgetGetInstance (PtWidget_t *pWidget)
static nsWidgetGetWidgetForWindow (Window aWindow)
static Window GetFocusWindow (void)

Public Attributes

PRBool mIsToplevel

Static Public Attributes

static nsWidgetsFocusWindow = 0
static nsWidgetsButtonMotionTarget = NULL
static gint sButtonMotionRootX = -1
static gint sButtonMotionRootY = -1
static gint sButtonMotionWidgetX = -1
static gint sButtonMotionWidgetY = -1
static Atom WMDeleteWindow = 0
static Atom WMTakeFocus = 0
static Atom WMSaveYourself = 0
static PRBool WMProtocolsInitialized = PR_FALSE

Protected Types

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

Protected Member Functions

virtual void InitCallbacks (char *aName=nsnull)
NS_IMETHOD CreateNative (GtkObject *parentWindow)
nsresult CreateWidget (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData, nsNativeWidget aNativeParent=nsnull)
PRBool DispatchWindowEvent (nsGUIEvent *event)
virtual void DestroyNative (void)
virtual void SetFontNative (GdkFont *aFont)
virtual void SetBackgroundColorNative (GdkColor *aColorNor, GdkColor *aColorBri, GdkColor *aColorDark)
void InstallEnterNotifySignal (GtkWidget *aWidget)
void InstallLeaveNotifySignal (GtkWidget *aWidget)
void InstallButtonPressSignal (GtkWidget *aWidget)
void InstallButtonReleaseSignal (GtkWidget *aWidget)
virtual void InstallFocusInSignal (GtkWidget *aWidget)
virtual void InstallFocusOutSignal (GtkWidget *aWidget)
void InstallRealizeSignal (GtkWidget *aWidget)
void AddToEventMask (GtkWidget *aWidget, gint aEventMask)
virtual void OnMotionNotifySignal (GdkEventMotion *aGdkMotionEvent)
virtual void OnEnterNotifySignal (GdkEventCrossing *aGdkCrossingEvent)
virtual void OnLeaveNotifySignal (GdkEventCrossing *aGdkCrossingEvent)
virtual void OnButtonPressSignal (GdkEventButton *aGdkButtonEvent)
virtual void OnButtonReleaseSignal (GdkEventButton *aGdkButtonEvent)
virtual void OnFocusInSignal (GdkEventFocus *aGdkFocusEvent)
virtual void OnFocusOutSignal (GdkEventFocus *aGdkFocusEvent)
virtual void OnRealize (GtkWidget *aWidget)
virtual void OnDestroySignal (GtkWidget *aGtkWidget)
virtual void SetInternalVisibility (PRBool aVisible)
void InstallSignal (GtkWidget *aWidget, gchar *aSignalName, GtkSignalFunc aSignalFunction)
void InitMouseEvent (GdkEventButton *aGdkButtonEvent, nsMouseEvent &anEvent)
NS_IMETHOD CreateNative (PtWidget_t *parentWindow)
nsresult CreateWidget (nsIWidget *aParent, const nsRect &aRect, EVENT_CALLBACK aHandleEventFunction, nsIDeviceContext *aContext, nsIAppShell *aAppShell, nsIToolkit *aToolkit, nsWidgetInitData *aInitData, nsNativeWidget aNativeParent=nsnull)
PRBool DispatchWindowEvent (nsGUIEvent *event)
virtual void DestroyNative (void)
PRBool HandleEvent (PtWidget_t *, PtCallbackInfo_t *aCbInfo)
PRBool DispatchKeyEvent (PhKeyEvent_t *aPhKeyEvent, int force)
void ScreenToWidgetPos (PhPoint_t &pt)
void InitKeyEvent (PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent)
void InitKeyPressEvent (PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent)
void InitMouseEvent (PhPointerEvent_t *aPhButtonEvent, nsWidget *aWidget, nsMouseEvent &anEvent, PRUint32 aEventType)
PRUint32 nsConvertKey (PhKeyEvent_t *aPhKeyEvent)
PRBool ConvertStatus (nsEventStatus aStatus)
virtual void CreateNativeWindow (Window aParent, nsRect aRect, XSetWindowAttributes aAttr, unsigned long aMask)
virtual void CreateNative (Window aParent, nsRect aRect)
virtual void DestroyNative ()
void Map (void)
void Unmap (void)
virtual long GetEventMask ()
void SetUpWMHints (void)
void WidgetPut (nsWidget *aWidget)
void WidgetMove (nsWidget *aWidget)
void WidgetMoveResize (nsWidget *aWidget)
void WidgetResize (nsWidget *aWidget)
PRBool WidgetVisible (nsRect &aBounds)
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)

Static Protected Member Functions

static gint DestroySignal (GtkWidget *aGtkWidget, nsWidget *aWidget)
static gint EnterNotifySignal (GtkWidget *aWidget, GdkEventCrossing *aGdkCrossingEvent, gpointer aData)
static gint LeaveNotifySignal (GtkWidget *aWidget, GdkEventCrossing *aGdkCrossingEvent, gpointer aData)
static gint ButtonPressSignal (GtkWidget *aWidget, GdkEventButton *aGdkButtonEvent, gpointer aData)
static gint ButtonReleaseSignal (GtkWidget *aWidget, GdkEventButton *aGdkButtonEvent, gpointer aData)
static gint RealizeSignal (GtkWidget *aWidget, gpointer aData)
static gint FocusInSignal (GtkWidget *aWidget, GdkEventFocus *aGdkFocusEvent, gpointer aData)
static gint FocusOutSignal (GtkWidget *aWidget, GdkEventFocus *aGdkFocusEvent, gpointer aData)
static int RawEventHandler (PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo)
static int GotFocusCallback (PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo)
static int LostFocusCallback (PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo)
static int DestroyedCallback (PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo)
static void DestroyNativeChildren (Display *aDisplay, Window aWindow)
static void AddWindowCallback (Window aWindow, nsWidget *aWidget)
static void DeleteWindowCallback (Window aWindow)

Protected Attributes

PRBool mHasFocus
GtkWidget * mWidget
GtkWidget * mMozBox
nsCOMPtr< nsIWidgetmParent
nsCOMPtr< nsIRegionmUpdateArea
PRUint32 mPreferredWidth
PRUint32 mPreferredHeight
PRPackedBool mListenForResizes
PRPackedBool mShown
PRPackedBool mInternalShown
PtWidget_t * mWidget
nsIWidgetmParent
PRBool mShown
PRBool mListenForResizes
PRBool mIsShown
int mVisibility
nsIWidgetmParentWidget
Window mParentWindow
XlibRgbHandle * mXlibRgbHandle
DisplaymDisplay
Screen * mScreen
Window mBaseWindow
Visual * mVisual
int mDepth
unsigned long mBackgroundPixel
PRUint32 mBorderRGB
unsigned long mBorderPixel
nsString mName
nsRect mRequestedSize
PRPackedBool mIsToplevel
PRPackedBool mMapped
PRPackedBool mLastGrabFailed
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

Static Protected Attributes

static nsCOMPtr
< nsIRollupListener
gRollupListener
static nsWeakPtr gRollupWidget
static guint32 sLastEventTime = 0
static nsWidgetsFocusWidget = 0
static nsILookAndFeelsLookAndFeel = nsnull
static nsClipboardsClipboard = nsnull
static PRUint32 sWidgetCount = 0
static Window mFocusWindow = 0
static nsHashtable * gsWindowList = nsnull
static Cursor gsXlibCursorCache [eCursorCount]
static PRBool gRollupConsumeRollupEvent = PR_FALSE

Static Private Attributes

static PRBool mGDKHandlerInstalled = PR_FALSE
static PRBool sTimeCBSet = PR_FALSE

Detailed Description

Base of all GTK+ native widgets.

Base of all Photon native widgets.

Definition at line 78 of file nsWidget.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 221 of file nsWidget.cpp.

{
  mWidget = nsnull;
  mMozBox = 0;
  mParent = nsnull;
  mPreferredWidth  = 0;
  mPreferredHeight = 0;
  mShown = PR_FALSE;
  mInternalShown = PR_FALSE;
  mBounds.x = 0;
  mBounds.y = 0;
  mBounds.width = 0;
  mBounds.height = 0;
  mIsToplevel = PR_FALSE;

  mUpdateArea = do_CreateInstance(kRegionCID);
  if (mUpdateArea) {
    mUpdateArea->Init();
    mUpdateArea->SetTo(0, 0, 0, 0);
  }
  
  mListenForResizes = PR_FALSE;
  mHasFocus = PR_FALSE;
  if (mGDKHandlerInstalled == PR_FALSE) {
    mGDKHandlerInstalled = PR_TRUE;
    // It is most convenient for us to intercept our events after
    // they have been converted to GDK, but before GTK+ gets them
    gdk_event_handler_set (handle_gdk_event, NULL, NULL);
  }
  if (sTimeCBSet == PR_FALSE) {
    sTimeCBSet = PR_TRUE;
    nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
    if (!dragService) {
#ifdef DEBUG
      g_print("*** warning: failed to get the drag service. this is a _bad_ thing.\n");
#endif
      sTimeCBSet = PR_FALSE;
    }
    nsCOMPtr<nsIDragSessionGTK> dragServiceGTK;
    dragServiceGTK = do_QueryInterface(dragService);
    if (!dragServiceGTK) {
      sTimeCBSet = PR_FALSE;
      return;
    }
    dragServiceGTK->TargetSetTimeCallback(nsWidget::GetLastEventTime);
  }
}

Here is the call graph for this function:

nsWidget::~nsWidget ( ) [virtual]

Definition at line 269 of file nsWidget.cpp.

{
#ifdef NOISY_DESTROY
  IndentByDepth(stdout);
  printf("nsWidget::~nsWidget:%p\n", this);
#endif

  // it's safe to always call Destroy() because it will only allow itself
  // to be called once
  Destroy();

}

Here is the call graph for this function:

virtual nsWidget::~nsWidget ( ) [virtual]
virtual nsWidget::~nsWidget ( ) [virtual]

Member Function Documentation

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

Internal methods.

Implements nsIWidget.

Definition at line 284 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Processes a mouse pressed event.

Implements nsIWidget.

Definition at line 718 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

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

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

Implements nsIWidget.

Definition at line 735 of file nsBaseWidget.cpp.

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

Processes a mouse pressed event.

Implements nsIWidget.

Definition at line 705 of file nsBaseWidget.cpp.

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

Here is the call graph for this function:

void nsWidget::AddToEventMask ( GtkWidget *  aWidget,
gint  aEventMask 
) [protected]

Definition at line 1642 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( 0 != aEventMask, "mask is 0");

  gtk_widget_add_events(aWidget,aEventMask);
}

Here is the caller graph for this function:

void nsWidget::AddWindowCallback ( Window  aWindow,
nsWidget aWidget 
) [static, protected]

Definition at line 842 of file nsWidget.cpp.

{
  // make sure that the list has been initialized
  if (gsWindowList == nsnull) {
    gsWindowList = new nsHashtable();
  }
  nsWindowKey window_key(aWindow);
  gsWindowList->Put(&window_key, aWidget);
}

Here is the caller graph for this function:

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

Definition at line 130 of file nsBaseWidget.cpp.

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

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Implements nsIWidget.

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

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 1227 of file nsWidget.cpp.

{
  return NS_OK;
}

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 161 of file nsWidget.h.

              {
              PtHold();
              return NS_OK;
              }
gint nsWidget::ButtonPressSignal ( GtkWidget *  aWidget,
GdkEventButton *  aGdkButtonEvent,
gpointer  aData 
) [static, protected]

Definition at line 2202 of file nsWidget.cpp.

{
  //  printf("nsWidget::ButtonPressSignal(%p)\n",aData);

  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( nsnull != aGdkButtonEvent, "event is null");

  nsWidget * widget = (nsWidget *) aData;

  NS_ASSERTION( nsnull != widget, "instance pointer is null");

  widget->OnButtonPressSignal(aGdkButtonEvent);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint nsWidget::ButtonReleaseSignal ( GtkWidget *  aWidget,
GdkEventButton *  aGdkButtonEvent,
gpointer  aData 
) [static, protected]

Definition at line 2221 of file nsWidget.cpp.

{
  //  printf("nsWidget::ButtonReleaseSignal(%p)\n",aData);

  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( nsnull != aGdkButtonEvent, "event is null");

  nsWidget * widget = (nsWidget *) aData;

  NS_ASSERTION( nsnull != widget, "instance pointer is null");

  widget->OnButtonReleaseSignal(aGdkButtonEvent);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIKBStateControl.

Reimplemented in nsWindow, and nsWindow.

Definition at line 2397 of file nsWidget.cpp.

Implements nsIKBStateControl.

Reimplemented in nsWindow, and nsWindow.

NS_IMETHOD nsWidget::CaptureMouse ( PRBool  aCapture) [inline, virtual]

Enables/Disables system mouse capture.

Parameters:
aCapturePR_TRUE enables mouse capture, PR_FALSE disables mouse capture

Reimplemented from nsBaseWidget.

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

Definition at line 160 of file nsWidget.h.

{ return NS_ERROR_FAILURE; }
NS_IMETHOD nsWidget::CaptureMouse ( PRBool  aCapture) [inline, virtual]

Enables/Disables system mouse capture.

Parameters:
aCapturePR_TRUE enables mouse capture, PR_FALSE disables mouse capture

Reimplemented from nsBaseWidget.

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

Definition at line 199 of file nsWidget.h.

{ return NS_ERROR_FAILURE; }
NS_IMETHODIMP nsWidget::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 491 of file nsWidget.cpp.

{
  return NS_OK;
}
NS_IMETHOD nsWidget::CaptureRollupEvents ( nsIRollupListener aListener,
PRBool  aDoCapture,
PRBool  aConsumeRollupEvent 
) [inline, 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 111 of file nsWidget.h.

{ return NS_OK; }
NS_IMETHOD nsWidget::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.

void * nsWidget::CheckParent ( long  ThisWindow)

Definition at line 208 of file nsWidget.cpp.

{
  return (void*)-1;
}
NS_IMETHOD nsWidget::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.

NS_IMETHODIMP nsWidget::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 602 of file nsWidget.cpp.

{
  return NS_OK;
}
NS_IMETHOD nsWidget::ConstrainPosition ( PRBool  aAllowSlop,
PRInt32 aX,
PRInt32 aY 
) [inline, 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 115 of file nsWidget.h.

{ return NS_OK; }
PRBool nsWidget::ConvertStatus ( nsEventStatus  aStatus) [protected]

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 1428 of file nsWidget.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:

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 238 of file nsWidget.h.

              {
              switch(aStatus) {
                case nsEventStatus_eIgnore:
                case nsEventStatus_eConsumeDoDefault:
                  return(PR_FALSE);
                case nsEventStatus_eConsumeNoDefault:
                  return(PR_TRUE);
                }
              NS_ASSERTION(0, "Illegal nsEventStatus enumeration value");
              return PR_FALSE;
              }
void nsWidget::ConvertToDeviceCoordinates ( nscoord aX,
nscoord aY 
) [virtual]

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 1395 of file nsWidget.cpp.

{

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

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 190 of file nsWidget.h.

{ }
NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD nsWidget::Create ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [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.

NS_IMETHOD nsWidget::Create ( nsNativeWidget  aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [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.

NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD nsWidget::Create ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [inline, 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 75 of file nsWidget.h.

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

Here is the call graph for this function:

NS_IMETHOD nsWidget::Create ( nsNativeWidget  aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [inline, 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 87 of file nsWidget.h.

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

Here is the call graph for this function:

NS_IMETHODIMP nsWidget::Create ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [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 1355 of file nsWidget.cpp.

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

Here is the call graph for this function:

NS_IMETHODIMP nsWidget::Create ( nsNativeWidget  aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell = nsnull,
nsIToolkit aToolkit = nsnull,
nsWidgetInitData aInitData = nsnull 
) [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 1373 of file nsWidget.cpp.

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

Here is the call graph for this function:

void nsWidget::CreateNative ( Window  aParent,
nsRect  aRect 
) [protected, virtual]

Definition at line 765 of file nsWidget.cpp.

{
  XSetWindowAttributes attr;
  unsigned long attr_mask;

  attr.bit_gravity       = NorthWestGravity;
  attr.event_mask        = GetEventMask();
  attr.colormap          = xxlib_rgb_get_cmap(mXlibRgbHandle);
  attr.background_pixel  = mBackgroundPixel;
  attr.border_pixel      = mBorderPixel;
  attr_mask = CWBitGravity | CWEventMask | CWBorderPixel | CWBackPixel;

  if (attr.colormap)
    attr_mask |= CWColormap;

  CreateNativeWindow(aParent, mBounds, attr, attr_mask);
}

Here is the call graph for this function:

NS_IMETHOD nsWidget::CreateNative ( GtkObject *  parentWindow) [inline, protected]

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

Definition at line 234 of file nsWidget.h.

{ return NS_OK; }

Here is the caller graph for this function:

NS_IMETHOD nsWidget::CreateNative ( PtWidget_t *  parentWindow) [inline, protected]

Reimplemented in nsWindow.

Definition at line 273 of file nsWidget.h.

{ return NS_OK; }
void nsWidget::CreateNativeWindow ( Window  aParent,
nsRect  aRect,
XSetWindowAttributes  aAttr,
unsigned long  aMask 
) [protected, virtual]

Definition at line 807 of file nsWidget.cpp.

{
  NS_ASSERTION(!mBaseWindow, "already initialized");
  if (mBaseWindow) return;

  mBaseWindow = XCreateWindow(mDisplay,
                              aParent,
                              aRect.x, aRect.y,
                              aRect.width, aRect.height,
                              0,                // border width
                              mDepth,           // depth
                              InputOutput,      // class
                              mVisual,          // visual
                              aMask,
                              &aAttr);
  XSetWindowBackgroundPixmap(mDisplay, mBaseWindow, None);

  mRequestedSize.height = mBounds.height = aRect.height;
  mRequestedSize.width = mBounds.width = aRect.width;
  AddWindowCallback(mBaseWindow, this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsWidget::CreateWidget ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell,
nsIToolkit aToolkit,
nsWidgetInitData aInitData,
nsNativeWidget  aNativeParent = nsnull 
) [protected]

Definition at line 1257 of file nsWidget.cpp.

{
  GtkObject *parentWidget = nsnull;

#ifdef NOISY_DESTROY
  if (aParent)
    g_print("nsWidget::CreateWidget (%p) nsIWidget parent\n",
            this);
  else if (aNativeParent)
    g_print("nsWidget::CreateWidget (%p) native parent\n",
            this);
  else if(aAppShell)
    g_print("nsWidget::CreateWidget (%p) nsAppShell parent\n",
            this);
#endif

  gtk_widget_push_colormap(gdk_rgb_get_cmap());
  gtk_widget_push_visual(gdk_rgb_get_visual());

  nsIWidget *baseParent = aInitData &&
    (aInitData->mWindowType == eWindowType_dialog ||
     aInitData->mWindowType == eWindowType_toplevel ||
     aInitData->mWindowType == eWindowType_invisible) ?
    nsnull : aParent;

  NS_ASSERTION(aInitData->mWindowType != eWindowType_popup ||
               !aParent, "Popups should not be hooked into nsIWidget hierarchy");

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

  mParent = aParent;

  if (aNativeParent) {
    parentWidget = GTK_OBJECT(aNativeParent);
    mListenForResizes = PR_TRUE;
  } else if (aParent) {
    // this ups the refcount of the gtk widget, we must unref later.
    parentWidget = GTK_OBJECT(aParent->GetNativeData(NS_NATIVE_WIDGET));
    mListenForResizes = aInitData ? aInitData->mListenForResizes : PR_FALSE;
  }

  mBounds = aRect;
  CreateNative (parentWidget);

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

  gtk_widget_pop_colormap();
  gtk_widget_pop_visual();

  if (mWidget) {
    /* we used to listen to motion notify signals, button press
       signals and button release signals here but since nsWindow
       became its own managed class we don't need to do that by
       default anymore.  Any subclasses that need to listen to those
       events should do so on their own. */
    
    // InstallButtonPressSignal(mWidget);
    // InstallButtonReleaseSignal(mWidget);
    
    // InstallMotionNotifySignal(mWidget);
    
    InstallEnterNotifySignal(mWidget);
    InstallLeaveNotifySignal(mWidget);
    
    // Focus
    InstallFocusInSignal(mWidget);
    InstallFocusOutSignal(mWidget);
    
  }

  DispatchStandardEvent(NS_CREATE);
  InitCallbacks();

  if (mWidget) {
    // Add in destroy callback
    gtk_signal_connect(GTK_OBJECT(mWidget),
                       "destroy",
                       GTK_SIGNAL_FUNC(DestroySignal),
                       this);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsWidget::CreateWidget ( nsIWidget aParent,
const nsRect aRect,
EVENT_CALLBACK  aHandleEventFunction,
nsIDeviceContext aContext,
nsIAppShell aAppShell,
nsIToolkit aToolkit,
nsWidgetInitData aInitData,
nsNativeWidget  aNativeParent = nsnull 
) [protected]
void nsWidget::DeleteWindowCallback ( Window  aWindow) [static, protected]

Definition at line 853 of file nsWidget.cpp.

{
  nsWindowKey window_key(aWindow);
  gsWindowList->Remove(&window_key);

  if (gsWindowList->Count() == 0) {
    delete gsWindowList;
    gsWindowList = nsnull;

    /* clear out the cursor cache */
#ifdef DEBUG_CURSORCACHE
    printf("freeing cursor cache\n");
#endif
    for (int i = 0; i < eCursorCount; i++)
      if (gsXlibCursorCache[i])
        XFreeCursor(nsAppShell::mDisplay, gsXlibCursorCache[i]);
  }
}

Close and destroy the internal native window.

This method does not delete the widget.

Reimplemented from nsBaseWidget.

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

Close and destroy the internal native window.

This method does not delete the widget.

Reimplemented from nsBaseWidget.

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

Close and destroy the internal native window.

This method does not delete the widget.

Reimplemented from nsBaseWidget.

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

Definition at line 339 of file nsWidget.cpp.

{
  //  printf("%p nsWidget::Destroy()\n", this);
  // make sure we don't call this more than once.
  if (mIsDestroying)
    return NS_OK;

  // we don't want people sending us events if we are the button motion target
  if (sButtonMotionTarget == this)
    DropMotionTarget();

  // ok, set our state
  mIsDestroying = PR_TRUE;

  // call in and clean up any of our base widget resources
  // are released
  nsBaseWidget::Destroy();
  mParent = 0;

  // just to be safe. If we're going away and for some reason we're still
  // the rollup widget, rollup and turn off capture.
  nsCOMPtr<nsIWidget> rollupWidget = do_QueryReferent(gRollupWidget);
  if ( NS_STATIC_CAST(nsIWidget*,this) == rollupWidget.get() ) {
    if ( gRollupListener )
      gRollupListener->Rollup();
    gRollupWidget = nsnull;
    gRollupListener = nsnull;
  }

  // destroy our native windows
  DestroyNative();

  // make sure to call the OnDestroy if it hasn't been called yet
  if (mOnDestroyCalled == PR_FALSE)
    OnDestroy();

  // make sure no callbacks happen
  mEventCallback = nsnull;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsWidget::DestroyedCallback ( PtWidget_t *  widget,
void data,
PtCallbackInfo_t *  cbinfo 
) [static, protected]

Definition at line 1358 of file nsWidget.cpp.

                                                                                          {
  nsWidget *pWidget = (nsWidget *) data;
  if( !pWidget->mIsDestroying ) pWidget->OnDestroy();
  return Pt_CONTINUE;
       }

Here is the call graph for this function:

virtual void nsWidget::DestroyNative ( ) [protected, virtual]

Reimplemented in nsWindow, and nsWindow.

void nsWidget::DestroyNative ( void  ) [protected, virtual]

Reimplemented in nsWindow, and nsWindow.

Definition at line 384 of file nsWidget.cpp.

{
  if (mMozBox) {
    // destroying the mMozBox will also destroy the mWidget in question.
    ::gtk_widget_destroy(mMozBox);
    mWidget = NULL;
    mMozBox = NULL;
  }
}

Here is the caller graph for this function:

virtual void nsWidget::DestroyNative ( void  ) [protected, virtual]

Reimplemented in nsWindow, and nsWindow.

void nsWidget::DestroyNativeChildren ( Display aDisplay,
Window  aWindow 
) [static, protected]

Definition at line 170 of file nsWidget.cpp.

{
  Window       root_return;
  Window       parent_return;
  Window      *children_return = nsnull;
  unsigned int nchildren_return = 0;
  unsigned int i = 0;
  
  XQueryTree(aDisplay, aWindow, &root_return, &parent_return,
             &children_return, &nchildren_return);
  // walk the list of children
  for (i=0; i < nchildren_return; i++) {
    nsWidget *thisWidget = GetWidgetForWindow(children_return[i]);
    if (thisWidget) {
      thisWidget->Destroy();
    }
  }      

  // free up this struct
  if (children_return)
    XFree(children_return);
}

Here is the call graph for this function:

gint nsWidget::DestroySignal ( GtkWidget *  aGtkWidget,
nsWidget aWidget 
) [static, protected]

Definition at line 407 of file nsWidget.cpp.

{
  aWidget->OnDestroySignal(aGtkWidget);
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

Definition at line 2422 of file nsWidget.cpp.

{
  NS_ASSERTION(0, "nsWidget::DispatchActivateEvent shouldn't be called!\n");
}

Reimplemented in nsWindow.

Definition at line 2426 of file nsWidget.cpp.

{
  NS_ASSERTION(0, "nsWidget::DispatchDeactivateEvent shouldn't be called!\n");
}

Here is the caller graph for this function:

Definition at line 1064 of file nsWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Dispatches an event to the widget.

  

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

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

Dispatches an event to the widget.

  
  • ATENTIE */ printf( "mEventCallback call (%d %d) this=%p\n", aEvent->point.x, aEvent->point.y, this );

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 1526 of file nsWidget.cpp.

{
  NS_ADDREF(aEvent->widget);

#ifdef DEBUG
  GtkObject *gw;
  void *nativeWidget = aEvent->widget->GetNativeData(NS_NATIVE_WIDGET);
  if (nativeWidget) {
    gw = GTK_OBJECT(nativeWidget);
    
    // Check the pref _before_ checking caps lock, because checking
    // caps lock requires a server round-trip.

    if (debug_GetCachedBoolPref("nglayout.debug.event_dumping") && CAPS_LOCK_IS_ON)
      {
        debug_DumpEvent(stdout,
                        aEvent->widget,
                        aEvent,
                        debug_GetName(gw),
                        (PRInt32) debug_GetRenderXID(gw));
      }
  }
#endif // DEBUG

  if (nsnull != mMenuListener) {
    if (NS_MENU_EVENT == aEvent->eventStructType)
      aStatus = mMenuListener->MenuSelected(NS_STATIC_CAST(nsMenuEvent&, *aEvent));
  }

  aStatus = nsEventStatus_eIgnore;
  if (nsnull != mEventCallback) {
    aStatus = (*mEventCallback)(aEvent);
  }

  // Dispatch to event listener if event was not consumed
  if ((aStatus != nsEventStatus_eIgnore) && (nsnull != 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 nsWidget::DispatchEvent ( nsGUIEvent event,
nsEventStatus aStatus 
) [virtual]

Dispatches an event to the widget.

  

Implements nsIWidget.

Reimplemented in nsWindow, nsWindow, nsWindow, and nsWindow.

Definition at line 1465 of file nsWidget.cpp.

{
  if (mEventCallback)
    return DispatchWindowEvent(&aEvent);

  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsWidget::DispatchKeyEvent ( nsKeyEvent aKeyEvent) [virtual]

Definition at line 1139 of file nsWidget.cpp.

{
  if (mEventCallback) 
  {
    return DispatchWindowEvent(aKeyEvent);
  }

  return PR_FALSE;
}

Here is the call graph for this function:

PRBool nsWidget::DispatchKeyEvent ( PhKeyEvent_t *  aPhKeyEvent,
int  force 
) [protected]

Definition at line 873 of file nsWidget.cpp.

                                                                         {
  NS_ASSERTION(aPhKeyEvent, "nsWidget::DispatchKeyEvent a NULL PhKeyEvent was passed in");

  if( !(aPhKeyEvent->key_flags & (Pk_KF_Cap_Valid|Pk_KF_Sym_Valid) ) ) {
              //printf("nsWidget::DispatchKeyEvent throwing away invalid key: Modifiers Valid=<%d,%d,%d> this=<%p>\n",
              //(aPhKeyEvent->key_flags & Pk_KF_Scan_Valid), (aPhKeyEvent->key_flags & Pk_KF_Sym_Valid), (aPhKeyEvent->key_flags & Pk_KF_Cap_Valid), this );
              return PR_FALSE;
              }

  if ( !force && PtIsFocused(mWidget) != 2) {
     //printf("nsWidget::DispatchKeyEvent Not on focus leaf! PtIsFocused(mWidget)=<%d>\n", PtIsFocused(mWidget));
     return PR_FALSE;
       }
  
  if ( ( aPhKeyEvent->key_cap == Pk_Shift_L )
       || ( aPhKeyEvent->key_cap == Pk_Shift_R )
       || ( aPhKeyEvent->key_cap == Pk_Control_L )
       || ( aPhKeyEvent->key_cap ==  Pk_Control_R )
       || ( aPhKeyEvent->key_cap ==  Pk_Num_Lock )
       || ( aPhKeyEvent->key_cap ==  Pk_Scroll_Lock )
     )
    return PR_TRUE;

  nsWindow *w = (nsWindow *) this;

  w->AddRef();
 
  if (aPhKeyEvent->key_flags & Pk_KF_Key_Down) {
              nsKeyEvent keyDownEvent(PR_TRUE, NS_KEY_DOWN, w);
              InitKeyEvent(aPhKeyEvent, keyDownEvent);
              PRBool noDefault = w->OnKey(keyDownEvent);

              nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, w);
              InitKeyPressEvent(aPhKeyEvent, keyPressEvent);
              if (noDefault) {  // If prevent default set for keydown, do same for keypress
                     keyPressEvent.flags = NS_EVENT_FLAG_NO_DEFAULT;
              }
              w->OnKey(keyPressEvent);
       }
  else if (aPhKeyEvent->key_flags & Pk_KF_Key_Repeat) {
              nsKeyEvent keyPressEvent(PR_TRUE, NS_KEY_PRESS, w);
              InitKeyPressEvent(aPhKeyEvent, keyPressEvent);
              w->OnKey(keyPressEvent);
       }
  else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0) {
              nsKeyEvent kevent(PR_TRUE, NS_KEY_UP, w);
              InitKeyEvent(aPhKeyEvent, kevent);
              w->OnKey(kevent);
       }

  w->Release();

  return PR_TRUE;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

Definition at line 2418 of file nsWidget.cpp.

{
  NS_ASSERTION(0, "nsWidget::DispatchLostFocusEvent shouldn't be called!\n");
}

Here is the caller graph for this function:

virtual PRBool nsWidget::DispatchMouseEvent ( nsMouseEvent aEvent) [virtual]

Reimplemented in nsWindow, nsNativeScrollbar, nsNativeScrollbar, and nsMacControl.

Definition at line 1576 of file nsWidget.cpp.

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

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

    return result;
  }

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

      } break;

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

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

    case NS_DRAGDROP_DROP:
#ifdef DEBUG 
      printf("nsWidget::DispatchMouseEvent, NS_DRAGDROP_DROP\n");
#endif
      break;

    default:
      break;

    } // switch
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow.

Definition at line 2414 of file nsWidget.cpp.

{
  NS_ASSERTION(0, "nsWidget::DispatchSetFocusEvent shouldn't be called!\n");
}

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 1457 of file nsWidget.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 252 of file nsWidget.h.

Here is the call graph for this function:

Reimplemented in nsWindow.

Definition at line 1132 of file nsWidget.cpp.

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

Here is the call graph for this function:

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 1444 of file nsWidget.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsWidget::DispatchWindowEvent ( nsGUIEvent event) [inline, protected]

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 284 of file nsWidget.h.

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

Here is the call graph for this function:

static void nsWidget::DragStarted ( void  ) [inline, static]

Definition at line 226 of file nsWidget.h.

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

Definition at line 193 of file nsWidget.cpp.

{
  if (sButtonMotionTarget) {
    GtkWidget *owningWidget = sButtonMotionTarget->GetOwningWidget();
    if (owningWidget)
      gtk_grab_remove(owningWidget);

    sButtonMotionTarget = nsnull;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsWidget::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.

NS_IMETHODIMP nsWidget::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.

Definition at line 734 of file nsWidget.cpp.

{
  if (mWidget)
  {
    if (GTK_WIDGET_SENSITIVE(mWidget) == aState)
      return NS_OK;
    gtk_widget_set_sensitive(mWidget, aState);
  }

  return NS_OK;
}
NS_IMETHOD nsWidget::Enable ( PRBool  aState) [inline, 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.

Definition at line 125 of file nsWidget.h.

              {
              if( mWidget ) PtSetResource( mWidget, Pt_ARG_FLAGS, aState ? 0 : Pt_BLOCKED, Pt_BLOCKED );
              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.

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 1232 of file nsWidget.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 167 of file nsWidget.h.

              {
              PtRelease();
              return NS_OK;
              }
gint nsWidget::EnterNotifySignal ( GtkWidget *  aWidget,
GdkEventCrossing *  aGdkCrossingEvent,
gpointer  aData 
) [static, protected]

Definition at line 2168 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( nsnull != aGdkCrossingEvent, "event is null");

  nsWidget * widget = (nsWidget *) aData;

  NS_ASSERTION( nsnull != widget, "instance pointer is null");

  widget->OnEnterNotifySignal(aGdkCrossingEvent);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint nsWidget::FocusInSignal ( GtkWidget *  aWidget,
GdkEventFocus *  aGdkFocusEvent,
gpointer  aData 
) [static, protected]

Definition at line 2255 of file nsWidget.cpp.

{
  //  printf("nsWidget::ButtonReleaseSignal(%p)\n",aData);

  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( nsnull != aGdkFocusEvent, "event is null");

  nsWidget * widget = (nsWidget *) aData;

  NS_ASSERTION( nsnull != widget, "instance pointer is null");

  widget->OnFocusInSignal(aGdkFocusEvent);

  if (GTK_IS_WINDOW(aWidget))
    gtk_signal_emit_stop_by_name(GTK_OBJECT(aWidget), "focus_in_event");
  
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint nsWidget::FocusOutSignal ( GtkWidget *  aWidget,
GdkEventFocus *  aGdkFocusEvent,
gpointer  aData 
) [static, protected]

Definition at line 2277 of file nsWidget.cpp.

{
  //  printf("nsWidget::ButtonReleaseSignal(%p)\n",aData);

  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( nsnull != aGdkFocusEvent, "event is null");

  nsWidget * widget = (nsWidget *) aData;

  NS_ASSERTION( nsnull != widget, "instance pointer is null");

  widget->OnFocusOutSignal(aGdkFocusEvent);

  if (GTK_IS_WINDOW(aWidget))
    gtk_signal_emit_stop_by_name(GTK_OBJECT(aWidget), "focus_out_event");
  
  return PR_TRUE;
}

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;
}
nsCursor nsBaseWidget::GetCursor ( ) [virtual, inherited]

Get the cursor for this widget.

Returns:
this widget's cursor.

Implements nsIWidget.

Reimplemented in nsCommonWidget.

Definition at line 482 of file nsBaseWidget.cpp.

{
  return mCursor;
}

Here is the caller graph for this function:

Implements nsIWidget.

Definition at line 651 of file nsBaseWidget.cpp.

Here is the caller graph for this function:

long nsWidget::GetEventMask ( ) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 784 of file nsWidget.cpp.

{
  long event_mask;

  event_mask = 
    ButtonMotionMask |
    Button1MotionMask |
    ButtonPressMask |
    ButtonReleaseMask |
    EnterWindowMask |
    ExposureMask |
    KeyPressMask |
    KeyReleaseMask |
    LeaveWindowMask |
    PointerMotionMask |
    StructureNotifyMask |
    VisibilityChangeMask |
    FocusChangeMask |
    OwnerGrabButtonMask;

  return event_mask;
}

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:

Window nsWidget::GetFocusWindow ( void  ) [static]

Definition at line 551 of file nsWidget.cpp.

{
  return mFocusWindow;
}

Here is the caller graph for this function:

virtual nsIFontMetrics* nsWidget::GetFont ( void  ) [virtual]

Get the font for this widget.

Returns:
the font metrics

Implements nsIWidget.

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

Get the font for this widget.

Returns:
the font metrics

Implements nsIWidget.

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

Definition at line 789 of file nsWidget.cpp.

{
  NS_NOTYETIMPLEMENTED("nsWidget::GetFont");
  return nsnull;
}
nsIFontMetrics* nsWidget::GetFont ( void  ) [inline, virtual]

Get the font for this widget.

Returns:
the font metrics

Implements nsIWidget.

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

Definition at line 142 of file nsWidget.h.

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

Get the foreground color for this widget.

Returns:
this widget's foreground color

Implements nsIWidget.

Definition at line 438 of file nsBaseWidget.cpp.

{
  return mForeground;
}

Here is the caller graph for this function:

Implements nsIKBStateControl.

Reimplemented in nsWindow, and nsWindow.

Definition at line 2393 of file nsWidget.cpp.

NS_IMETHOD nsWidget::GetIMEOpenState ( PRBool aState) [virtual]

Implements nsIKBStateControl.

Reimplemented in nsWindow, and nsWindow.

static nsWidget* nsWidget::GetInstance ( PtWidget_t *  pWidget) [inline, static]

Definition at line 265 of file nsWidget.h.

              {
              nsWidget *data;
              PtGetResource( pWidget, Pt_ARG_POINTER, &data, 0 );
              return data;
              }

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;
    }
void nsWidget::GetLastEventTime ( guint32 *  aTime) [static]

Definition at line 187 of file nsWidget.cpp.

{
  if (aTime)
    *aTime = sLastEventTime;
}

Here is the caller graph for this function:

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.

GdkWindow * nsWidget::GetLayeringWindow ( ) [virtual]

Reimplemented in nsWindow.

Definition at line 496 of file nsWidget.cpp.

{
  return mWidget->window;
}

Here is the caller graph for this function:

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

Implements nsIWidget.

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

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

Implements nsIWidget.

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

Definition at line 1183 of file nsWidget.cpp.

{
  switch(aDataType) {
  case NS_NATIVE_WINDOW:
    if (mWidget) {
      return (void *)mWidget->window;
    }
    break;

  case NS_NATIVE_DISPLAY:
    return (void *)GDK_DISPLAY();

  case NS_NATIVE_WIDGET:
  case NS_NATIVE_PLUGIN_PORT:
    if (mWidget) {
      return (void *)mWidget;
    }
    break;

  case NS_NATIVE_GRAPHIC:
    /* GetSharedGC ups the ref count on the GdkGC so make sure you release
     * it afterwards. */
    NS_ASSERTION(nsnull != mToolkit, "NULL toolkit, unable to get a GC");
    return (void *)NS_STATIC_CAST(nsToolkit*,mToolkit)->GetSharedGC();

  default:
#ifdef DEBUG
    g_print("nsWidget::GetNativeData(%i) - weird value\n", aDataType);
#endif
    break;
  }
  return nsnull;
}

Here is the caller graph for this function:

void* nsWidget::GetNativeData ( PRUint32  aDataType) [inline, virtual]

Implements nsIWidget.

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

Definition at line 156 of file nsWidget.h.

{ return (void *)mWidget; }
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:

GtkWidget * nsWidget::GetOwningWidget ( ) [virtual]

Reimplemented in nsWindow.

Definition at line 176 of file nsWidget.cpp.

{
  NS_WARNING("nsWidget::GetOwningWidget called!\n");
  return nsnull;
}

Here is the caller graph for this function:

virtual nsIWidget* nsWidget::GetParent ( void  ) [virtual]

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.

nsIWidget* nsWidget::GetParent ( void  ) [inline, virtual]

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 99 of file nsWidget.h.

              {
              if( mIsDestroying ) return nsnull;
              nsIWidget* result = mParent;
              if( mParent ) NS_ADDREF( result );
              return result;
              }

Here is the call graph for this function:

nsIWidget * nsWidget::GetParent ( void  ) [virtual]

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 425 of file nsWidget.cpp.

{
  nsIWidget *ret;
  ret = mParent;
  NS_IF_ADDREF(ret);
  return ret;
}
NS_IMETHOD nsWidget::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 nsWidget::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 1237 of file nsWidget.cpp.

NS_IMETHOD nsWidget::GetPreferredSize ( PRInt32 aWidth,
PRInt32 aHeight 
) [inline, 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 173 of file nsWidget.h.

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:

GdkWindow * nsWidget::GetRenderWindow ( GtkObject *  aGtkWidget) [virtual]

Reimplemented in nsWindow.

Definition at line 2300 of file nsWidget.cpp.

{
  GdkWindow * renderWindow = nsnull;

  if (GDK_IS_SUPERWIN(aGtkWidget)) {
    renderWindow = GDK_SUPERWIN(aGtkWidget)->bin_window;
  }

  return renderWindow;
}

Definition at line 1521 of file nsWidget.cpp.

{
  aRect = mRequestedSize;
  return NS_OK;
}
NS_METHOD nsBaseWidget::GetScreenBounds ( nsRect aRect) [virtual, inherited]

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

Implements nsIWidget.

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

Definition at line 768 of file nsBaseWidget.cpp.

{
  return GetBounds(aRect);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return size mode (minimized, maximized, normalized).

Returns a value from nsSizeMode (see nsGUIEvent.h)

Implements nsIWidget.

Definition at line 427 of file nsBaseWidget.cpp.

                                                      {

  *aMode = mSizeMode;
  return NS_OK;
}

Here is the caller graph for this function:

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

Return the widget's toolkit.

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

Implements nsIWidget.

Reimplemented in nsWindow.

Definition at line 639 of file nsBaseWidget.cpp.

GtkWindow * nsWidget::GetTopLevelWindow ( void  ) [virtual]

Reimplemented in nsWindow, and nsWindow.

Definition at line 2402 of file nsWidget.cpp.

{
  if (mWidget) 
    return GTK_WINDOW(gtk_widget_get_toplevel(mWidget));
  else
    return NULL;
}

Here is the caller graph for this function:

nsWidget * nsWidget::GetWidgetForWindow ( Window  aWindow) [static]

Definition at line 831 of file nsWidget.cpp.

{
  if (gsWindowList == nsnull) {
    return nsnull;
  }
  nsWindowKey window_key(aWindow);
  nsWidget *retval = (nsWidget *)gsWindowList->Get(&window_key);
  return retval;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsWidget::GetWindowClass ( char *  aClass) [virtual]

Gets the window class implemented in gtk.

Reimplemented from nsBaseWidget.

Definition at line 544 of file nsWidget.cpp.

{
//nsWidget's base impl will throw a failure
//to find out that this toolkit supports this function pass null.
  if (!aClass)
    return NS_OK;

  *aClass = nsnull;

  if (mWindowType != eWindowType_toplevel)
    return NS_OK;

  GtkWindow *topWindow;
  topWindow = GetTopLevelWindow();

  if (!topWindow)
    return NS_ERROR_FAILURE;

  XClassHint *class_hint = XAllocClassHint();

  if (XGetClassHint(GDK_DISPLAY(),
                    GDK_WINDOW_XWINDOW(GTK_WIDGET(topWindow)->window),
                    class_hint))
    aClass = strdup(class_hint->res_class);

  XFree(class_hint);
  return NS_OK;
}

Here is the call graph for this function:

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;
}
int nsWidget::GotFocusCallback ( PtWidget_t *  widget,
void data,
PtCallbackInfo_t *  cbinfo 
) [static, protected]

Definition at line 1334 of file nsWidget.cpp.

{
  nsWidget *pWidget = (nsWidget *) data;

       if( PtWidgetIsClass( widget, PtWindow ) ) {
              if( pWidget->mEventCallback ) {
                     /* the WM_ACTIVATE code */
                     pWidget->DispatchStandardEvent(NS_ACTIVATE);
                     return Pt_CONTINUE;
                     }
              }

       pWidget->DispatchStandardEvent(NS_GOTFOCUS);

  return Pt_CONTINUE;
}

Here is the call graph for this function:

PRBool nsWidget::HandleEvent ( PtWidget_t *  widget,
PtCallbackInfo_t *  aCbInfo 
) [inline, protected]
  • ATENTIE */ printf( "Ph_EV_PTR_MOTION_NOBUTTON (%d %d)\n", ptrev->pos.x, ptrev->pos.y );

Definition at line 984 of file nsWidget.cpp.

                                                                                   {
  PRBool  result = PR_TRUE; // call the default nsWindow proc
  PhEvent_t* event = aCbInfo->event;
  static int prevx=-1, prevy=-1, left_button_down, kwww_outbound_valid;

       if (event->processing_flags & Ph_CONSUMED) return PR_TRUE;

       switch ( event->type ) {

      case Ph_EV_PTR_MOTION_NOBUTTON:
              {
              PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
              nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);

        if( ptrev ) {

                                   if( ptrev->flags & Ph_PTR_FLAG_Z_ONLY ) break; // sometimes z presses come out of nowhere */


              ScreenToWidgetPos( ptrev->pos );
              InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE );
              result = DispatchMouseEvent(theMouseEvent);
              }
              }
              break;

      case Ph_EV_BUT_PRESS:
       {

              PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
                nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);

                            /* there should be no reason to do this - mozilla should figure out how to call SetFocus */
                            /* this though fixes the problem with the plugins capturing the focus */
                            PtWidget_t *disjoint = PtFindDisjoint( widget );
                            if( PtWidgetIsClassMember( disjoint, PtServer ) || //mozserver
                                   PtWidgetIsClassMember( disjoint, PtContainer ) ) //TestPhEmbed
                                   PtContainerGiveFocus( widget, aCbInfo->event );

        if( ptrev ) {
                prevx = ptrev->pos.x;
                prevy = ptrev->pos.y;
          ScreenToWidgetPos( ptrev->pos );

          if( ptrev->buttons & Ph_BUTTON_SELECT ) { // Normally the left mouse button
                     InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_DOWN );
                     left_button_down = 1;
          } else if( ptrev->buttons & Ph_BUTTON_MENU ) // the right button
                     InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_RIGHT_BUTTON_DOWN );
          else // middle button
                     InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MIDDLE_BUTTON_DOWN );

                //printf("*** Button down\n");
                result = DispatchMouseEvent(theMouseEvent);

                                   // if we're a right-button-down we're trying to popup a context menu. send that event to gecko also
                                   if( ptrev->buttons & Ph_BUTTON_MENU ) {
                                          nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull,
                                                      nsMouseEvent::eReal);
                                          InitMouseEvent( ptrev, this, contextMenuEvent, NS_CONTEXTMENU );
                                          result = DispatchMouseEvent( contextMenuEvent );
                                          }
         }

        }
              break;        
              
              case Ph_EV_BUT_RELEASE:
                {
                       PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
                       nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull,
                                         nsMouseEvent::eReal);
                       
                       // Update the current input group for clipboard mouse events
                       // (mozilla only). Note that for mozserver the mouse based
                       // (eg. Edit->Copy/Paste menu) events don't come through here.
                       // They are sent by the voyager client app via libPtWeb.so to
                       // do_command() in mozserver.cpp.
                       if (sClipboard)
                            sClipboard->SetInputGroup(event->input_group);

                       if (event->subtype==Ph_EV_RELEASE_REAL || event->subtype==Ph_EV_RELEASE_PHANTOM) {
                              if (ptrev) {
                                     ScreenToWidgetPos( ptrev->pos );
                                     if ( ptrev->buttons & Ph_BUTTON_SELECT ) { // Normally the left mouse button
                                           InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP );
                                           kwww_outbound_valid = 0;
                                           //
                                           // To be clean, let's not send multiple left button up
                                           // events.
                                           //
                                           if (!left_button_down)
                                             break; //case
                                           left_button_down = 0;
                                     } else if( ptrev->buttons & Ph_BUTTON_MENU ) // the right button
                                           InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_RIGHT_BUTTON_UP );
                                     else // middle button
                                           InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MIDDLE_BUTTON_UP );
                                     
                                  //printf("*** Button up %s\n", event->subtype==Ph_EV_RELEASE_PHANTOM ? "(phantom)" : "");
                                     result = DispatchMouseEvent(theMouseEvent);
                              }
                       }
                       else if (event->subtype==Ph_EV_RELEASE_OUTBOUND) {
                              PhRect_t rect = {{0,0},{0,0}};
                              PhRect_t boundary = {{-10000,-10000},{10000,10000}};

                              //printf("*** OUTBOUND\n");
                        if (__progname && strcmp(__progname, "kwww") == 0) {
                                   //
                                   // In kscope we only use dragging to scroll the view. So
                                   // we don't want Mozilla to do any special drag processing,
                                   // and fake this out by immediately doing a left-button-up.
                                   // We do it at (999999,999999) so any control or link under
                                   // the pointer doesn't get activated.
                                   //
                             ptrev->pos.x = ptrev->pos.y = 999999;
                    InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP );
                    result = DispatchMouseEvent(theMouseEvent);
                      InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE );
                      result = DispatchMouseEvent(theMouseEvent);
                                   left_button_down = 0;
                                   kwww_outbound_valid = 1;
                                   //
                                   // In case we activated a combo box, do another down/up
                                   // Sending an Esc key also works. Which is better?
                                   // The mouse button method may prevent drag initiation
                                   // within (multiline?) input fields. 
                                   //
#if 0
                    InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_DOWN );
                    result = DispatchMouseEvent(theMouseEvent);
                    InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP );
                    result = DispatchMouseEvent(theMouseEvent);
#else
                                   PhKeyEvent_t kev;
                    memset( &kev, 0, sizeof(kev) );
                                   kev.key_cap = kev.key_sym = Pk_Escape;
                                   kev.key_flags = Pk_KF_Key_Down | Pk_KF_Cap_Valid | Pk_KF_Sym_Valid;
                                   DispatchKeyEvent( &kev, 1 );
                    memset( &kev, 0, sizeof(kev) );
                                   kev.key_cap = Pk_Escape;
                                   kev.key_flags = Pk_KF_Cap_Valid;
                                   DispatchKeyEvent( &kev, 1 );
#endif
                              }

                              PhInitDrag( PtWidgetRid(mWidget), ( Ph_DRAG_KEY_MOTION | Ph_DRAG_TRACK | Ph_TRACK_DRAG),&rect, &boundary, aCbInfo->event->input_group , NULL, NULL, NULL, NULL, NULL);
                       }
                }
           break;

              case Ph_EV_PTR_MOTION_BUTTON:
       {
        PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
              nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);

        if( ptrev ) {

                                   if( ptrev->flags & Ph_PTR_FLAG_Z_ONLY ) break; // sometimes z presses come out of nowhere */

#ifdef PHOTON_DND
                                   if( sDragService ) {
                                          nsDragService *d;
                                          nsIDragService *s = sDragService;
                                          d = ( nsDragService * )s;
                                          d->SetNativeDndData( widget, event );
                                          }
#endif

                if (!__progname || strcmp(__progname, "kwww") != 0) {
                  //
                     // We don't send these events in kscope. Dragging is devoted to
                     // scrolling.
                     //
            ScreenToWidgetPos( ptrev->pos );
              InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE );
            result = DispatchMouseEvent(theMouseEvent);
                     }
          }
       }
       break;

      case Ph_EV_KEY:
        // Update the current input group for clipboard key events. This
        // covers both mozserver and mozilla.
        if (sClipboard)
          sClipboard->SetInputGroup(event->input_group);
                            result = DispatchKeyEvent( (PhKeyEvent_t*) PhGetData( event ), 0 );
        break;

      case Ph_EV_DRAG:
              {
          nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);

          switch(event->subtype) {
              static int is_kwww=-1;

            case Ph_EV_DRAG_COMPLETE: {
                nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull,
                                               nsMouseEvent::eReal);
                PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event );
                            //printf("*** Drag complete\n");
                if (is_kwww) {  
                    // Already did the button up
                              kwww_outbound_valid = 0;
                              prevx = prevy = -1;
                         } else {
                  ScreenToWidgetPos( ptrev2->pos );
                  InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP );
                  result = DispatchMouseEvent(theMouseEvent);
                              left_button_down = 0;
                }
                       }
              break;
            case Ph_EV_DRAG_MOTION_EVENT: {
                PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event );
                            //printf("*** Drag motion\n");
                         if (is_kwww == -1) {
                           is_kwww = 0;
                              if (__progname && strcmp(__progname, "kwww") == 0)
                            is_kwww = 1;
                         }

                         if (is_kwww) {
                              nsIWidget *nsw = this;
                              nsIWidget *top_widget = nsw;

                              if (!kwww_outbound_valid) {
                    struct dragevent {
                        PhEvent_t hdr;
                        PhDragEvent_t drag;
                        } ev;

                                   //
                                   // If the user does a drag where he releases the left mouse
                                   // button almost right away, then we will start getting
                                   // drag events even though the mouse button is not pressed!
                                   // Work around this Photon bug by cancelling the drag
                                   // ourselves. In 6.4.0 we can use PhCancelDrag() to do this.
                                   //
                                   //printf("*** CANCELLING DRAG!\n");
                    memset( &ev, 0, sizeof(ev) );
                    ev.hdr.type = Ph_EV_DRAG;
                    ev.hdr.emitter.rid = Ph_DEV_RID;
                    ev.hdr.flags = Ph_EVENT_INCLUSIVE | Ph_EMIT_TOWARD;
                    ev.hdr.data_len = sizeof( ev.drag );
                                   ev.hdr.subtype = Ph_EV_DRAG_COMPLETE;
                                   ev.hdr.input_group = aCbInfo->event->input_group;
                                   ev.drag.rid = PtWidgetRid(mWidget);
                                   ev.drag.flags = 0;
                                   PhEmit( &ev.hdr, NULL, &ev.drag );
                                   break; //case
                              }

                              while (nsw) {
                                   top_widget = nsw;
                                   nsw = nsw->GetParent();
                              }
                     try_again:
                  nsIView *view = nsToolkit::GetViewFor(top_widget);
                              if (view) {
                                   nsIViewManager* vm = view->GetViewManager();
                                   if (vm) {
                                  nsIScrollableView* scrollView = nsnull;
                                  vm->GetRootScrollableView(&scrollView);
                                     if (scrollView) {
                                          if (prevx != -1 || prevy != -1) {
                                            //
                                            // The -1 check is to handle prevx and prevy not set
                                            // to the button press location, which happens when
                                            // you click on flash.
                                            //
                                            nsresult rc = ((nsIScrollableView_MOZILLA_1_8_BRANCH*)scrollView)->ScrollByPixels(prevx - ptrev2->pos.x, prevy - ptrev2->pos.y);
                                            //printf("*** rc %d from ScrollByPixels\n");
                                          }
                                     } else if (top_widget != this) {
                                       //
                                          // There is no scrollable view for the top level widget.
                                          // See if there is one for the original widget.
                                          //
                                          top_widget = this;
                                          goto try_again;
                                     }
                                   }
                           }
                           prevx = ptrev2->pos.x;
                           prevy = ptrev2->pos.y;
                         } else {
                  ScreenToWidgetPos( ptrev2->pos );
                  InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_MOVE );
                  result = DispatchMouseEvent(theMouseEvent);
                         }
              }
              break;
            }
          }
        break;

      case Ph_EV_BOUNDARY:
                            PRUint32 evtype;

        switch( event->subtype ) {
          case Ph_EV_PTR_ENTER:
                                   case Ph_EV_PTR_ENTER_FROM_CHILD:
                                          evtype = NS_MOUSE_ENTER;
            break;
                                   case Ph_EV_PTR_LEAVE_TO_CHILD:
          case Ph_EV_PTR_LEAVE:
                                          evtype = NS_MOUSE_EXIT;
            break;
          default:
                                          evtype = 0;
            break;
              }

                            if( evtype != 0 ) {
                                   PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event );
                                   nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull,
                                               nsMouseEvent::eReal);
                                   ScreenToWidgetPos( ptrev->pos );
                                   InitMouseEvent( ptrev, this, theMouseEvent, evtype );
                                   result = DispatchMouseEvent( theMouseEvent );
                                   }
        break;
       }

  return result;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsWidget::HandlePopup ( PRInt32  inMouseX,
PRInt32  inMouseY 
)

Definition at line 993 of file nsWidget.cpp.

{
  PRBool retVal = PR_FALSE;
  PRBool rollup = PR_FALSE;

  // The gRollupListener and gRollupWidget are both set to nsnull when a popup is no
  // longer visible

  nsCOMPtr<nsIWidget> rollupWidget = do_QueryReferent(gRollupWidget);

  if (rollupWidget && gRollupListener) {
    Window currentPopup = (Window)rollupWidget->GetNativeData(NS_NATIVE_WINDOW);

    if (!IsMouseInWindow(currentPopup, inMouseX, inMouseY)) {
      rollup = PR_TRUE;
      nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
      
      if ( menuRollup ) {
        nsCOMPtr<nsISupportsArray> widgetChain;
        menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
        if ( widgetChain ) {
          PRUint32 count = 0;
          widgetChain->Count ( &count );
          for ( PRUint32 i = 0; i < count; ++i ) {
            nsCOMPtr<nsISupports> genericWidget;
            widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
            nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
            if ( widget ) {
              Window currWindow = (Window)widget->GetNativeData(NS_NATIVE_WINDOW);
              if ( IsMouseInWindow(currWindow, inMouseX, inMouseY) ) {
                rollup = PR_FALSE;
                break;
              }
            }
          } // foreach parent menu widget
        }
      }
    }
  }

  if (rollup) {
    gRollupListener->Rollup();
    retVal = PR_TRUE;
  }
  return retVal;
}

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

void nsWidget::IMECommitEvent ( GdkEventKey *  aEvent) [virtual]

Reimplemented in nsWindow.

Definition at line 2410 of file nsWidget.cpp.

                                                 {
  NS_ASSERTION(0, "nsWidget::IMECommitEvent() shouldn't be called!\n");
}

Here is the caller graph for this function:

void nsWidget::InitCallbacks ( char *  aName = nsnull) [protected, virtual]

Reimplemented in nsWindow, nsCheckButton, and nsButton.

Definition at line 1391 of file nsWidget.cpp.

{
}

Here is the caller graph for this function:

void nsWidget::InitEvent ( nsGUIEvent event,
nsPoint aPoint = nsnull 
)

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 1400 of file nsWidget.cpp.

{
  // This copies, and we need to call gdk_event_free.
  GdkEvent *ge = gtk_get_current_event();

  if (aPoint == nsnull) {     // use the point from the event
    // get the message position in client coordinates and in twips

    if (ge != nsnull) {
      //       ::ScreenToClient(mWnd, &cpos);
      event.point.x = PRInt32(ge->configure.x);
      event.point.y = PRInt32(ge->configure.y);
    }  
  }    
  else {                      // use the point override if provided
    event.point.x = aPoint->x;
    event.point.y = aPoint->y;
  }

  event.time = gdk_event_get_time(ge);

  //    mLastPoint.x = event.point.x;
  //    mLastPoint.y = event.point.y;

  if (ge)
    gdk_event_free(ge);
}

Here is the caller graph for this function:

void nsWidget::InitEvent ( nsGUIEvent event,
PRUint32  aEventType,
nsPoint aPoint = nsnull 
) [inline]

Definition at line 221 of file nsWidget.h.

              {
              if( aPoint == nsnull ) {
                event.point.x = 0;
                event.point.y = 0;
                }
              else {
                event.point.x = aPoint->x;
                event.point.y = aPoint->y;
                }
              event.widget = this;
              event.time = PR_IntervalNow();
              event.message = aEventType;
              }
void nsWidget::InitKeyEvent ( PhKeyEvent_t *  aPhKeyEvent,
nsKeyEvent anEvent 
) [inline, protected]

Definition at line 928 of file nsWidget.cpp.

{
       anEvent.keyCode =    nsConvertKey( aPhKeyEvent );
       anEvent.time =                     PR_IntervalNow();
       anEvent.isShift =   ( aPhKeyEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
       anEvent.isControl = ( aPhKeyEvent->key_mods & Pk_KM_Ctrl )  ? PR_TRUE : PR_FALSE;
       anEvent.isAlt =     ( aPhKeyEvent->key_mods & Pk_KM_Alt )   ? PR_TRUE : PR_FALSE;
       anEvent.isMeta =    PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InitKeyPressEvent ( PhKeyEvent_t *  aPhKeyEvent,
nsKeyEvent anEvent 
) [inline, protected]

Definition at line 964 of file nsWidget.cpp.

{
       anEvent.isShift =   ( aPhKeyEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
       anEvent.isControl = ( aPhKeyEvent->key_mods & Pk_KM_Ctrl )  ? PR_TRUE : PR_FALSE;
       anEvent.isAlt =     ( aPhKeyEvent->key_mods & Pk_KM_Alt )   ? PR_TRUE : PR_FALSE;
       anEvent.isMeta =    PR_FALSE;

       if( key_sym_displayable( aPhKeyEvent ) ) anEvent.charCode = aPhKeyEvent->key_sym;
       else {
              /* in photon Ctrl<something> or Alt<something> is not a displayable character, but
                     mozilla wants the keypress event as a charCode+isControl+isAlt, instead of a keyCode */
              if( ( anEvent.isControl || anEvent.isAlt ) && key_cap_displayable( aPhKeyEvent ) )
                     anEvent.charCode = aPhKeyEvent->key_cap;
              else anEvent.keyCode = nsConvertKey( aPhKeyEvent );
              }

       anEvent.time =                     PR_IntervalNow();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InitMouseEvent ( PhPointerEvent_t *  aPhButtonEvent,
nsWidget aWidget,
nsMouseEvent anEvent,
PRUint32  aEventType 
) [protected]

Definition at line 717 of file nsWidget.cpp.

{
  anEvent.message = aEventType;
  anEvent.widget  = aWidget;

  if (aPhButtonEvent != nsnull) {
    anEvent.time =      PR_IntervalNow();
    anEvent.isShift =   ( aPhButtonEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE;
    anEvent.isControl = ( aPhButtonEvent->key_mods & Pk_KM_Ctrl )  ? PR_TRUE : PR_FALSE;
    anEvent.isAlt =     ( aPhButtonEvent->key_mods & Pk_KM_Alt )   ? PR_TRUE : PR_FALSE;
              anEvent.isMeta =            PR_FALSE;
    anEvent.point.x =   aPhButtonEvent->pos.x; 
    anEvent.point.y =   aPhButtonEvent->pos.y;
    anEvent.clickCount = aPhButtonEvent->click_count;
       }
       }
void nsWidget::InitMouseEvent ( GdkEventButton *  aGdkButtonEvent,
nsMouseEvent anEvent 
) [protected]

Definition at line 2131 of file nsWidget.cpp.

{
  if (aGdkButtonEvent != NULL) {
    anEvent.point.x = nscoord(aGdkButtonEvent->x);
    anEvent.point.y = nscoord(aGdkButtonEvent->y);

    anEvent.isShift = (aGdkButtonEvent->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
    anEvent.isControl = (aGdkButtonEvent->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
    anEvent.isAlt = (aGdkButtonEvent->state & GDK_MOD1_MASK) ? PR_TRUE : PR_FALSE;
    anEvent.isMeta = PR_FALSE;  // GTK+ doesn't support the meta key
    anEvent.time = aGdkButtonEvent->time;

    switch(aGdkButtonEvent->type)
      {
      case GDK_BUTTON_PRESS:
        anEvent.clickCount = 1;
        break;
      case GDK_2BUTTON_PRESS:
        anEvent.clickCount = 2;
        break;
      case GDK_3BUTTON_PRESS:
        anEvent.clickCount = 3;
        break;
      default:
        anEvent.clickCount = 1;
    }

  }
}

Here is the caller graph for this function:

void nsWidget::InstallButtonPressSignal ( GtkWidget *  aWidget) [protected]

Definition at line 1672 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");

  InstallSignal(aWidget,
                            (gchar *)"button_press_event",
                            GTK_SIGNAL_FUNC(nsWidget::ButtonPressSignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallButtonReleaseSignal ( GtkWidget *  aWidget) [protected]

Definition at line 1682 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");

  InstallSignal(aWidget,
                            (gchar *)"button_release_event",
                            GTK_SIGNAL_FUNC(nsWidget::ButtonReleaseSignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallEnterNotifySignal ( GtkWidget *  aWidget) [protected]

Definition at line 1652 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");

  InstallSignal(aWidget,
                            (gchar *)"enter_notify_event",
                            GTK_SIGNAL_FUNC(nsWidget::EnterNotifySignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallFocusInSignal ( GtkWidget *  aWidget) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1692 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");

  InstallSignal(aWidget,
                            (gchar *)"focus_in_event",
                            GTK_SIGNAL_FUNC(nsWidget::FocusInSignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallFocusOutSignal ( GtkWidget *  aWidget) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1702 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");

  InstallSignal(aWidget,
                            (gchar *)"focus_out_event",
                            GTK_SIGNAL_FUNC(nsWidget::FocusOutSignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallLeaveNotifySignal ( GtkWidget *  aWidget) [protected]

Definition at line 1662 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");

  InstallSignal(aWidget,
                            (gchar *)"leave_notify_event",
                            GTK_SIGNAL_FUNC(nsWidget::LeaveNotifySignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallRealizeSignal ( GtkWidget *  aWidget) [protected]

Definition at line 1712 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");
  
  InstallSignal(aWidget,
                            (gchar *)"realize",
                            GTK_SIGNAL_FUNC(nsWidget::RealizeSignal));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::InstallSignal ( GtkWidget *  aWidget,
gchar *  aSignalName,
GtkSignalFunc  aSignalFunction 
) [protected]

Definition at line 2116 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( aSignalName, "signal name is null");
  NS_ASSERTION( aSignalFunction, "signal function is null");

  gtk_signal_connect(GTK_OBJECT(aWidget),
                     aSignalName,
                     GTK_SIGNAL_FUNC(aSignalFunction),
                     (gpointer) this);
}

Here is the caller graph for this function:

NS_IMETHOD nsWidget::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.

NS_IMETHOD nsWidget::Invalidate ( const nsRect aRect,
PRBool  aIsSynchronous 
) [virtual]

Invalidate a specified rect for a widget and repaints it.

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

Implements nsIWidget.

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

NS_IMETHODIMP nsWidget::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 1015 of file nsWidget.cpp.

{
  if (!mWidget)
    return NS_OK; // mWidget will be null during printing. 

  if (!GTK_IS_WIDGET(mWidget))
    return NS_ERROR_FAILURE;

  if (!GTK_WIDGET_REALIZED(mWidget) || !GTK_WIDGET_VISIBLE(mWidget))
    return NS_ERROR_FAILURE;

#ifdef DEBUG
  // Check the pref _before_ checking caps lock, because checking
  // caps lock requires a server round-trip.
  if (debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping") && CAPS_LOCK_IS_ON)
  {
    debug_DumpInvalidate(stdout,
                         this,
                         nsnull,
                         aIsSynchronous,
                         debug_GetName(mWidget),
                         debug_GetRenderXID(mWidget));
  }
#endif // DEBUG

  mUpdateArea->SetTo(0, 0, mBounds.width, mBounds.height);

  if (aIsSynchronous) {
    ::gtk_widget_draw(mWidget, (GdkRectangle *) NULL);
  } else {
    ::gtk_widget_queue_draw(mWidget);
  }

  return NS_OK;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsWidget::Invalidate ( const nsRect aRect,
PRBool  aIsSynchronous 
) [virtual]

Invalidate a specified rect for a widget and repaints it.

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

Implements nsIWidget.

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

Definition at line 1051 of file nsWidget.cpp.

{
  if (!mWidget)
    return NS_OK;  // mWidget is null during printing

  if (!GTK_IS_WIDGET(mWidget))
    return NS_ERROR_FAILURE;

  if (!GTK_WIDGET_REALIZED(mWidget) || !GTK_WIDGET_VISIBLE(mWidget))
    return NS_ERROR_FAILURE;

  mUpdateArea->Union(aRect.x, aRect.y, aRect.width, aRect.height);

#ifdef DEBUG
  // Check the pref _before_ checking caps lock, because checking
  // caps lock requires a server round-trip.
  if (debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping") && CAPS_LOCK_IS_ON)
  {
    debug_DumpInvalidate(stdout,
                         this,
                         &aRect,
                         aIsSynchronous,
                         debug_GetName(mWidget),
                         debug_GetRenderXID(mWidget));
  }
#endif // DEBUG

  if (aIsSynchronous)
  {
    GdkRectangle nRect;
    NSRECT_TO_GDKRECT(aRect, nRect);

    gtk_widget_draw(mWidget, &nRect);
  }
  else
  {
    gtk_widget_queue_draw_area(mWidget,
                               aRect.x, aRect.y,
                               aRect.width, aRect.height);
  }

  return NS_OK;
}
NS_IMETHOD nsWidget::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.

NS_IMETHOD nsWidget::Invalidate ( const nsRect aRect,
PRBool  aIsSynchronous 
) [virtual]

Invalidate a specified rect for a widget and repaints it.

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

Implements nsIWidget.

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

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

Invalidate a specified region for a widget and repaints it.

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

Reimplemented from nsBaseWidget.

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

Definition at line 1096 of file nsWidget.cpp.

{
  nsRegionRectSet *regionRectSet = nsnull;

  if (!GTK_IS_WIDGET(mWidget))
    return NS_ERROR_FAILURE;

  if (!GTK_WIDGET_REALIZED(mWidget) || !GTK_WIDGET_VISIBLE(mWidget))
    return NS_ERROR_FAILURE;

  mUpdateArea->Union(*aRegion);

  if (NS_FAILED(mUpdateArea->GetRects(&regionRectSet)))
  {
    return NS_ERROR_FAILURE;
  }

  PRUint32 len;
  PRUint32 i;

  len = regionRectSet->mRectsLen;

  for (i=0;i<len;++i)
  {
    nsRegionRect *r = &(regionRectSet->mRects[i]);


#ifdef DEBUG
    // Check the pref _before_ checking caps lock, because checking
    // caps lock requires a server round-trip.
    if (debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping") && CAPS_LOCK_IS_ON)
    {
      nsRect rect(r->x, r->y, r->width, r->height);
      debug_DumpInvalidate(stdout,
                           this,
                           &rect,
                           aIsSynchronous,
                           debug_GetName(mWidget),
                           debug_GetRenderXID(mWidget));
    }
#endif // DEBUG


    if (aIsSynchronous)
    {
      GdkRectangle nRect;
      nRect.x = r->x;
      nRect.y = r->y;
      nRect.width = r->width;
      nRect.height = r->height;
      gtk_widget_draw(mWidget, &nRect);
    } else {
      gtk_widget_queue_draw_area(mWidget,
                                 r->x, r->y,
                                 r->width, r->height);
    }
  }

  // drop the const.. whats the right thing to do here?
  ((nsIRegion*)aRegion)->FreeRects(regionRectSet);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsWidget::InvalidateRegion ( const nsIRegion aRegion,
PRBool  aIsSynchronous 
) [virtual]

Invalidate a specified region for a widget and repaints it.

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

Reimplemented from nsBaseWidget.

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

NS_IMETHOD nsWidget::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.

NS_IMETHODIMP nsWidget::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.

Definition at line 746 of file nsWidget.cpp.

{
  NS_ENSURE_ARG_POINTER(aState);
  *aState = !mWidget || GTK_WIDGET_SENSITIVE(mWidget);
  return NS_OK;
}
NS_IMETHOD nsWidget::IsEnabled ( PRBool aState) [inline, 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.

Definition at line 131 of file nsWidget.h.

              {
              if(PtWidgetFlags(mWidget) & Pt_BLOCKED) *aState = PR_FALSE;
              else *aState = PR_TRUE;
              return NS_OK;
              }
PRBool nsWidget::IsMouseInWindow ( Window  window,
PRInt32  inMouseX,
PRInt32  inMouseY 
)

Definition at line 938 of file nsWidget.cpp.

{
  XWindowAttributes inWindowAttributes;

  /* sometimes we get NULL window */
  if (!window)
    return PR_FALSE;

  /* Get the origin (top left corner) coordinate and window's size */
  if (XGetWindowAttributes(mDisplay, window, &inWindowAttributes) == 0) {
    fprintf(stderr, "Failed calling XGetWindowAttributes in nsWidget::IsMouseInWindow");
    return PR_FALSE;
  }

  // Note: These coordinates are now relative to the root window as popups are now created
  // with the root window as parent

  // Must get mouse click coordinates relative to root window
  int root_inMouse_x,
      root_inMouse_y;
  Window returnedChild;
  Window rootWindow;
  rootWindow = XRootWindow(mDisplay, XDefaultScreen(mDisplay));
  if (!XTranslateCoordinates(mDisplay, mBaseWindow, rootWindow,
    inMouseX, inMouseY,
    &root_inMouse_x, &root_inMouse_y, &returnedChild)){
    fprintf(stderr, "Could not get coordinates for origin coordinates for mouseclick\n");
    // should we return true or false??????
    return PR_FALSE;
  }
  //fprintf(stderr, "Here are the mouse click coordinates x:%i y%i\n", root_inMouse_x, root_inMouse_y);

  // Test using coordinates relative to root window if click was inside passed popup window
  if (root_inMouse_x > inWindowAttributes.x &&
      root_inMouse_x < (inWindowAttributes.x + inWindowAttributes.width) &&
      root_inMouse_y > inWindowAttributes.y &&
      root_inMouse_y < (inWindowAttributes.y + inWindowAttributes.height)) {
#ifdef DEBUG_whoemeveraddedthatprintforginally
    //fprintf(stderr, "Mouse click INSIDE passed popup\n");
#endif
    return PR_TRUE;
  }
  
#ifdef DEBUG_whoemeveraddedthatprintforginally
  //fprintf(stderr, "Mouse click OUTSIDE of passed popup\n");
#endif
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsWidget::IsVisible ( PRBool aState) [virtual]

Returns whether the window is visible.

  

Implements nsIWidget.

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

NS_IMETHODIMP nsWidget::IsVisible ( PRBool aState) [virtual]

Returns whether the window is visible.

  

Implements nsIWidget.

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

Definition at line 534 of file nsWidget.cpp.

{
  if (mWidget)
    aState = GTK_WIDGET_VISIBLE(mWidget);
  else
    aState = PR_FALSE;

  return NS_OK;
}
NS_IMETHOD nsWidget::IsVisible ( PRBool aState) [inline, virtual]

Returns whether the window is visible.

  

Implements nsIWidget.

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

Definition at line 113 of file nsWidget.h.

{ aState = mShown; return NS_OK; }
gint nsWidget::LeaveNotifySignal ( GtkWidget *  aWidget,
GdkEventCrossing *  aGdkCrossingEvent,
gpointer  aData 
) [static, protected]

Definition at line 2185 of file nsWidget.cpp.

{
  NS_ASSERTION( nsnull != aWidget, "widget is null");
  NS_ASSERTION( nsnull != aGdkCrossingEvent, "event is null");

  nsWidget * widget = (nsWidget *) aData;

  NS_ASSERTION( nsnull != widget, "instance pointer is null");

  widget->OnLeaveNotifySignal(aGdkCrossingEvent);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::LoseFocus ( void  ) [virtual]

Reimplemented in nsWindow, and nsWindow.

Definition at line 773 of file nsWidget.cpp.

{
  // doesn't do anything.  needed for nsWindow housekeeping, really.
  if (mHasFocus == PR_FALSE)
    return;

  sFocusWindow = 0;
  mHasFocus = PR_FALSE;

}

Here is the caller graph for this function:

int nsWidget::LostFocusCallback ( PtWidget_t *  widget,
void data,
PtCallbackInfo_t *  cbinfo 
) [static, protected]

Definition at line 1351 of file nsWidget.cpp.

{
  nsWidget *pWidget = (nsWidget *) data;
       pWidget->DispatchStandardEvent(NS_LOSTFOCUS);
  return Pt_CONTINUE;
}

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:

void nsWidget::Map ( void  ) [protected]

Definition at line 1307 of file nsWidget.cpp.

{
  if (!mMapped) {
     /* Workaround for bug 77344. I am not sure whether this is mandatory or not. */
    if (mDisplay)
      XMapWindow(mDisplay, mBaseWindow);
    mMapped = PR_TRUE;
  }
}

Here is the caller graph for this function:

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

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

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

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

Implements nsIWidget.

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

Definition at line 926 of file nsBaseWidget.cpp.

{
  *aForWindow = PR_TRUE;
  return NS_OK;
}
NS_IMETHOD nsWidget::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.

NS_IMETHODIMP nsWidget::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 614 of file nsWidget.cpp.

{
  // check if we are at right place already
  if((aX == mBounds.x) && (aY == mBounds.y)) {
    return NS_OK;
  }
     
  mBounds.x = aX;
  mBounds.y = aY;

  if (mMozBox) 
  {
    gtk_mozbox_set_position(GTK_MOZBOX(mMozBox), aX, aY);
  }

  ResetInternalVisibility();

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD nsWidget::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.

PRUint32 nsWidget::nsConvertKey ( PhKeyEvent_t *  aPhKeyEvent) [protected]

Definition at line 832 of file nsWidget.cpp.

                                                           {

       unsigned long keysym, keymods;

  const int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter);

       keymods = aPhKeyEvent->key_mods;
       if( aPhKeyEvent->key_flags & Pk_KF_Sym_Valid )
              keysym = aPhKeyEvent->key_sym;
       else if( aPhKeyEvent->key_flags & Pk_KF_Cap_Valid )
              keysym = aPhKeyEvent->key_cap;
       else return 0;
       
  // First, try to handle alphanumeric input, not listed in nsKeycodes:
  if (keysym >= Pk_a && keysym <= Pk_z)
     return keysym - Pk_a + NS_VK_A;

  if (keysym >= Pk_A && keysym <= Pk_Z)
     return keysym - Pk_A + NS_VK_A;

  if (keysym >= Pk_0 && keysym <= Pk_9)
     return keysym - Pk_0 + NS_VK_0;
                
  if (keysym >= Pk_F1 && keysym <= Pk_F24) {
     return keysym - Pk_F1 + NS_VK_F1;
       }

       if( keymods & Pk_KM_Num_Lock ) {
       if( keysym >= Pk_KP_0 && keysym <= Pk_KP_9 )
       return keysym - Pk_0 + NS_VK_0;
              }

  for (int i = 0; i < length; i++) {
    if( nsKeycodes[i].keysym == keysym ) {
      return (nsKeycodes[i].vkCode);
       }
       }

  return((int) 0);
       }

Here is the caller graph for this function:

void nsWidget::OnButtonPressSignal ( GdkEventButton *  aGdkButtonEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1878 of file nsWidget.cpp.

{
  nsMouseScrollEvent scrollEvent(PR_TRUE, NS_MOUSE_SCROLL, this);
  PRUint32 eventType = 0;

  // If you double click in GDK, it will actually generate a single
  // click event before sending the double click event, and this is
  // different than the DOM spec.  GDK puts this in the queue
  // programatically, so it's safe to assume that if there's a
  // double click in the queue, it was generated so we can just drop
  // this click.
  GdkEvent *peekedEvent = gdk_event_peek();
  if (peekedEvent) {
    GdkEventType type = peekedEvent->any.type;
    gdk_event_free(peekedEvent);
    if (type == GDK_2BUTTON_PRESS || type == GDK_3BUTTON_PRESS)
      return;
  }


  // Switch on single, double, triple click.
  switch (aGdkButtonEvent->type) 
  {
    // Single click.
  case GDK_BUTTON_PRESS:
    // Double click.
  case GDK_2BUTTON_PRESS:
    // Triple click.
  case GDK_3BUTTON_PRESS:

    switch (aGdkButtonEvent->button)  // Which button?
    {
    case 1:
      eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
      break;

    case 2:
      eventType = NS_MOUSE_MIDDLE_BUTTON_DOWN;
      break;

    case 3:
      eventType = NS_MOUSE_RIGHT_BUTTON_DOWN;
      break;

    case 4:
    case 5:
    case 6:
    case 7:
      if (aGdkButtonEvent->button == 4 || aGdkButtonEvent->button == 5)
        scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
      else
        scrollEvent.scrollFlags = nsMouseScrollEvent::kIsHorizontal;

      if (aGdkButtonEvent->button == 4 || aGdkButtonEvent->button == 6)
        scrollEvent.delta = -3;
      else
        scrollEvent.delta = 3;

      scrollEvent.point.x = nscoord(aGdkButtonEvent->x);
      scrollEvent.point.y = nscoord(aGdkButtonEvent->y);
      
      scrollEvent.isShift = (aGdkButtonEvent->state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
      scrollEvent.isControl = (aGdkButtonEvent->state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
      scrollEvent.isAlt = (aGdkButtonEvent->state & GDK_MOD1_MASK) ? PR_TRUE : PR_FALSE;
      scrollEvent.isMeta = PR_FALSE;  // GTK+ doesn't support the meta key
      scrollEvent.time = aGdkButtonEvent->time;
      AddRef();
      if (mEventCallback)
        DispatchWindowEvent(&scrollEvent);
      Release();
      return;

      // Single-click default.
    default:
      eventType = NS_MOUSE_LEFT_BUTTON_DOWN;
      break;
    }
    break;

  default:
    break;
  }

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

  // Set the button motion target and remeber the widget and root coords
  sButtonMotionTarget = this;

  // Make sure to add this widget to the gtk grab list so that events
  // are rewritten to this window.
  GtkWidget *owningWidget;
  owningWidget = GetOwningWidget();
  if (owningWidget)
    gtk_grab_add(owningWidget);

  sButtonMotionRootX = (gint) aGdkButtonEvent->x_root;
  sButtonMotionRootY = (gint) aGdkButtonEvent->y_root;

  sButtonMotionWidgetX = (gint) aGdkButtonEvent->x;
  sButtonMotionWidgetY = (gint) aGdkButtonEvent->y;
  
  AddRef(); // kung-fu deathgrip

  DispatchMouseEvent(event);

  // if we're a right-button-down on linux, we're trying to
  // popup a context menu. send that event to gecko also.
  if (eventType == NS_MOUSE_RIGHT_BUTTON_DOWN) {
    nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
                                  nsMouseEvent::eReal);
    InitMouseEvent(aGdkButtonEvent, contextMenuEvent);
    DispatchMouseEvent(contextMenuEvent);
  }

  Release();

}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnButtonReleaseSignal ( GdkEventButton *  aGdkButtonEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1998 of file nsWidget.cpp.

{
  PRUint32 eventType = 0;

  switch (aGdkButtonEvent->button)
  {
  case 1:
    eventType = NS_MOUSE_LEFT_BUTTON_UP;
    break;
         
  case 2:
    eventType = NS_MOUSE_MIDDLE_BUTTON_UP;
    break;
         
  case 3:
    eventType = NS_MOUSE_RIGHT_BUTTON_UP;
    break;

  case 4:
  case 5:
  case 6:
  case 7:
    // We don't really need to do anything here, but we don't want
    // LEFT_BUTTON_UP to happen
    return;

  default:
    eventType = NS_MOUSE_LEFT_BUTTON_UP;
    break;
       }

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

  if (sButtonMotionTarget) {
    gint diffX = 0;
    gint diffY = 0;

    diffX = (gint) aGdkButtonEvent->x_root - sButtonMotionRootX;
    diffY = (gint) aGdkButtonEvent->y_root - sButtonMotionRootY;

    event.widget = sButtonMotionTarget;

    // see comments in nsWidget::OnMotionNotifySignal
    event.point.x = nscoord(sButtonMotionWidgetX + diffX);
    event.point.y = nscoord(sButtonMotionWidgetY + diffY);
  }

  // Drop the motion target before dispatching the event so that we
  // don't get events that we shouldn't.
  DropMotionTarget();

  // event.widget can get set to null when calling DispatchMouseEvent,
  // so to release it we must make a copy
  nsWidget* theWidget = NS_STATIC_CAST(nsWidget*,event.widget);

  NS_ADDREF(theWidget);
  theWidget->DispatchMouseEvent(event);
  NS_IF_RELEASE(theWidget);

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 212 of file nsWidget.h.

{ return OnInput(aEvent); };

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1054 of file nsWidget.cpp.

{
#ifdef DEBUG
  printf("nsWidget::OnDeleteWindow()\n");
#endif /* DEBUUG */  
  nsBaseWidget::OnDestroy();
  // emit a destroy signal
  return DispatchDestroyEvent();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnDestroy ( void  ) [virtual]

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

Definition at line 396 of file nsWidget.cpp.

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

  nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
  DispatchStandardEvent(NS_DESTROY);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsWidget::OnDestroy ( ) [virtual]

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

virtual void nsWidget::OnDestroy ( void  ) [virtual]

Reimplemented from nsBaseWidget.

Reimplemented in nsWindow, nsWindow, and nsWindow.

void nsWidget::OnDestroySignal ( GtkWidget *  aGtkWidget) [protected, virtual]

Reimplemented in nsWindow, and nsCheckButton.

Definition at line 414 of file nsWidget.cpp.

{
  OnDestroy();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnEnterNotifySignal ( GdkEventCrossing *  aGdkCrossingEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1808 of file nsWidget.cpp.

{
  if (aGdkCrossingEvent->subwindow != NULL)
    return;

  // If there is a button motion target, then we can ignore this
  // event since what the gecko event system expects is for
  // only motion events to be sent to that widget, even if the
  // pointer is crossing on other widgets.
  //
  // XXX ramiro - Same as above.
  //
  if (nsnull != sButtonMotionTarget)
  {
    return;
  }

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

  if (aGdkCrossingEvent != NULL) 
  {
    event.point.x = nscoord(aGdkCrossingEvent->x);
    event.point.y = nscoord(aGdkCrossingEvent->y);
    event.time = aGdkCrossingEvent->time;
  }

  AddRef();

  DispatchMouseEvent(event);

  Release();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnFocusInSignal ( GdkEventFocus *  aGdkFocusEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 2061 of file nsWidget.cpp.

{
  if (mIsDestroying)
    return;

  GTK_WIDGET_SET_FLAGS(mWidget, GTK_HAS_FOCUS);

  nsFocusEvent event(PR_TRUE, NS_GOTFOCUS, this);

//  event.time = aGdkFocusEvent->time;;
//  event.time = PR_Now();

  AddRef();
  
  DispatchFocus(event);
  
  Release();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnFocusOutSignal ( GdkEventFocus *  aGdkFocusEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 2081 of file nsWidget.cpp.

{
  if (mIsDestroying)
    return;

  GTK_WIDGET_UNSET_FLAGS(mWidget, GTK_HAS_FOCUS);

  nsFocusEvent event(PR_TRUE, NS_LOSTFOCUS, this);

//  event.time = aGdkFocusEvent->time;;
//  event.time = PR_Now();

  AddRef();
  
  DispatchFocus(event);
  
  Release();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 151 of file nsWidget.cpp.

{

  PRBool    ret = PR_FALSE;
  PRBool    releaseWidget = PR_FALSE;
  nsWidget *widget = NULL;

  // rewrite the key event to the window with 'de focus
  if (sFocusWindow) {
    widget = sFocusWindow;
    NS_ADDREF(widget);
    aEvent.widget = sFocusWindow;
    releaseWidget = PR_TRUE;
  }
  if (mEventCallback) {
    ret = DispatchWindowEvent(&aEvent);
  }

  if (releaseWidget)
    NS_RELEASE(widget);

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in nsWindow, and nsTextWidget.

Definition at line 81 of file nsWidget.cpp.

{

  PRBool    ret = PR_FALSE;
  PRBool    releaseWidget = PR_FALSE;
  nsWidget *widget = nsnull;

  // rewrite the key event to the window with 'de focus
  if (sFocusWindow) {
    widget = sFocusWindow;
    NS_ADDREF(widget);
    aEvent.widget = sFocusWindow;
    releaseWidget = PR_TRUE;
  }
  if (mEventCallback) {
    // before we dispatch a key, check if it's the context menu key.
    // If so, send a context menu key event instead.
    if (IsContextMenuKey(aEvent)) {
      nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal);
      ConvertKeyEventToContextMenuEvent(&aEvent, &contextMenuEvent);
      ret = DispatchWindowEvent(&contextMenuEvent);
    }
    else
      ret = DispatchWindowEvent(&aEvent);
  }

  if (releaseWidget)
    NS_RELEASE(widget);

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnLeaveNotifySignal ( GdkEventCrossing *  aGdkCrossingEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1842 of file nsWidget.cpp.

{
  if (aGdkCrossingEvent->subwindow != NULL)
    return;

  // If there is a button motion target, then we can ignore this
  // event since what the gecko event system expects is for
  // only motion events to be sent to that widget, even if the
  // pointer is crossing on other widgets.
  //
  // XXX ramiro - Same as above.
  //
  if (nsnull != sButtonMotionTarget)
  {
    return;
  }

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

  if (aGdkCrossingEvent != NULL) 
  {
    event.point.x = nscoord(aGdkCrossingEvent->x);
    event.point.y = nscoord(aGdkCrossingEvent->y);
    event.time = aGdkCrossingEvent->time;
  }

  AddRef();

  DispatchMouseEvent(event);

  Release();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWidget::OnMotionNotifySignal ( GdkEventMotion *  aGdkMotionEvent) [protected, virtual]

Reimplemented in nsWindow.

Definition at line 1724 of file nsWidget.cpp.

{
  
  if (mIsDestroying)
    return;

  nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, nsnull, nsMouseEvent::eReal);

  // If there is a button motion target, use that instead of the
  // current widget

  // XXX pav
  // i'm confused as to wtf this sButtonMoetionTarget thing is for.
  // so i'm not going to use it.

  // XXX ramiro
  // 
  // Because of dynamic widget creation and destruction, this could
  // potentially be a dangerious thing to do.  
  //
  // If the sButtonMotionTarget is destroyed between the time when
  // it got set and now, we should end up sending an event to 
  // a junk nsWidget.
  //
  // The way to solve this would be to add a destroy signal to
  // the GtkWidget corresponding to the sButtonMotionTarget and
  // marking if nsnull in there.
  //
  gint x, y;

  if (aGdkMotionEvent)
  {
    x = (gint) aGdkMotionEvent->x;
    y = (gint) aGdkMotionEvent->y;

    event.point.x = nscoord(x);
    event.point.y = nscoord(y);
    event.widget = this;
  }

  if (sButtonMotionTarget)
  {
    gint diffX;
    gint diffY;

    if (aGdkMotionEvent) 
    {
      // Compute the difference between the original root coordinates
      diffX = (gint) aGdkMotionEvent->x_root - sButtonMotionRootX;
      diffY = (gint) aGdkMotionEvent->y_root