18518; Add nsIWidget::Flash with null default implementation in nsBaseWidget and real functionality in Windows version of nsWindow; r=syd@netscape.com, a=chofmann@netscape.com
git-svn-id: svn://10.0.0.236/trunk@55844 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
079e07a0a2
commit
f6869e82d6
@ -720,6 +720,16 @@ class nsIWidget : public nsISupports {
|
||||
*/
|
||||
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow) = 0;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
NS_IMETHOD Flash() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
|
||||
@ -4312,3 +4312,34 @@ NS_IMETHODIMP nsWindow::PasswordFieldExit(PRUint32 aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Pick some random timer ID. Is there a better way?
|
||||
#define NS_FLASH_TIMER_ID 0x011231984
|
||||
|
||||
// This function is called on a timer to do the flashing. It simply toggles the flash
|
||||
// status until the window comes to the foreground.
|
||||
static VOID CALLBACK nsFlashTimerFunc( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ) {
|
||||
// Flash the window until we're in the foreground.
|
||||
if ( GetForegroundWindow() != hwnd ) {
|
||||
// We're not in the foreground yet.
|
||||
FlashWindow( hwnd, TRUE );
|
||||
} else {
|
||||
KillTimer( hwnd, idEvent );
|
||||
}
|
||||
}
|
||||
|
||||
// Draw user's attention to this window until it comes to foreground.
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Flash() {
|
||||
// Got window?
|
||||
if ( !mWnd ) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
// If window is in foreground, no notification is necessary.
|
||||
if ( GetForegroundWindow() != mWnd ) {
|
||||
// Kick off timer that does single flash till window comes to foreground.
|
||||
SetTimer( mWnd, NS_FLASH_TIMER_ID, GetCaretBlinkTime(), nsFlashTimerFunc );
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -143,6 +143,8 @@ public:
|
||||
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
|
||||
|
||||
NS_IMETHOD Flash();
|
||||
|
||||
// nsIKBStateControl interface
|
||||
|
||||
NS_IMETHOD ResetInputState();
|
||||
|
||||
@ -720,6 +720,11 @@ NS_METHOD nsBaseWidget::ModalEventFilter(PRBool aRealEvent, void *aEvent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseWidget::Flash() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@ -98,6 +98,7 @@ public:
|
||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar);
|
||||
#endif
|
||||
NS_IMETHOD EnableDragDrop(PRBool aEnable);
|
||||
NS_IMETHOD Flash();
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}//~~~
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user