зеркало из https://github.com/mozilla/gecko-dev.git
*** empty log message ***
This commit is contained in:
Родитель
8085c39725
Коммит
3aa1c8aa81
|
@ -33,3 +33,4 @@ nsIPopUpMenu.h
|
|||
nsIKeyBindMgr.h
|
||||
nsStringUtil.h
|
||||
nsIContextMenu.h
|
||||
nsIRollupListener.h
|
||||
|
|
|
@ -64,6 +64,7 @@ EXPORTS = \
|
|||
nsIFontSizeIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIContextMenu.h \
|
||||
nsIRollupListener.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
|
|
@ -64,6 +64,7 @@ EXPORTS=nsui.h \
|
|||
nsIMenuItem.h \
|
||||
nsIContextMenu.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIRollupListener.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ struct nsRect;
|
|||
struct nsFont;
|
||||
class nsIMenuBar;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
|
||||
/**
|
||||
* Callback function that processes events.
|
||||
* The argument is actually a subtype (subclass) of nsEvent which carries
|
||||
|
@ -660,6 +662,14 @@ class nsIWidget : public nsISupports {
|
|||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system capture of any and all events that would cause a
|
||||
* dropdown to be rolled up
|
||||
* @param aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
|
|
|
@ -49,6 +49,7 @@ struct nsRect;
|
|||
struct nsFont;
|
||||
class nsIMenuBar;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
%}
|
||||
|
||||
[ptr] native nsWidgetInitData(nsWidgetInitData);
|
||||
|
@ -636,4 +637,12 @@ interface nsIWidget : nsISupports
|
|||
*/
|
||||
void CaptureMouse(in PRBool aCapture);
|
||||
|
||||
/**
|
||||
* Enables/Disables system capture of any and all events that would cause a
|
||||
* dropdown to be rolled up
|
||||
* @param aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
*
|
||||
*/
|
||||
void CaptureRollupEvents(in nsIRollupListener aListener, in PRBool aDoCapture);
|
||||
|
||||
};
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include <imm.h>
|
||||
|
||||
#include "nsNativeDragTarget.h"
|
||||
#include "nsIRollupListener.h"
|
||||
|
||||
|
||||
//~~~ windowless plugin support
|
||||
#include "nsplugindefs.h"
|
||||
|
@ -59,6 +61,10 @@ static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
|
|||
|
||||
BOOL nsWindow::sIsRegistered = FALSE;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
static nsIRollupListener * gRollupListener = nsnull;
|
||||
static nsIWidget * gRollupWidget = nsnull;
|
||||
|
||||
nsWindow* nsWindow::gCurrentWindow = nsnull;
|
||||
|
||||
#define IS_VK_DOWN(a) (PRBool)(((GetKeyState(a) & 0x80)) ? (PR_TRUE) : (PR_FALSE))
|
||||
|
@ -370,6 +376,25 @@ PRBool nsWindow::DispatchStandardEvent(PRUint32 aMsg)
|
|||
return result;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture)
|
||||
{
|
||||
if (aDoCapture) {
|
||||
NS_IF_RELEASE(gRollupListener);
|
||||
NS_IF_RELEASE(gRollupWidget);
|
||||
gRollupListener = aListener;
|
||||
NS_ADDREF(aListener);
|
||||
gRollupWidget = this;
|
||||
NS_ADDREF(this);
|
||||
} else {
|
||||
NS_IF_RELEASE(gRollupListener);
|
||||
//gRollupListener = nsnull;
|
||||
NS_IF_RELEASE(gRollupWidget);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// the nsWindow procedure for all nsWindows in this toolkit
|
||||
|
@ -377,6 +402,33 @@ PRBool nsWindow::DispatchStandardEvent(PRUint32 aMsg)
|
|||
//-------------------------------------------------------------------------
|
||||
LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
//if (msg != 0x200 && msg != 0x84 && msg != 0x20) {
|
||||
// printf("hWnd 0x%p msg: %X 0x%p 0x%p %X\n", hWnd, msg, gRollupListener, gRollupWidget, WM_LBUTTONDOWN);
|
||||
//}
|
||||
|
||||
// check to see if we have a rollup listener registered
|
||||
if (nsnull != gRollupListener && nsnull != gRollupWidget) {
|
||||
if (msg == WM_ACTIVATE || msg == WM_NCLBUTTONDOWN || msg == WM_LBUTTONDOWN || msg == WM_NCMBUTTONDOWN || msg == WM_NCRBUTTONDOWN) {
|
||||
// check to see if the window the event happened
|
||||
// in is not the rollup window
|
||||
//if (hWnd != ((nsWindow *)gRollupWidget)->mWnd) {
|
||||
RECT r;
|
||||
::GetWindowRect(((nsWindow *)gRollupWidget)->mWnd, &r);
|
||||
DWORD pos = ::GetMessagePos();
|
||||
POINT mp;
|
||||
mp.x = LOWORD(pos);
|
||||
mp.y = HIWORD(pos);
|
||||
// now make sure that it wasn't one of our children
|
||||
if (mp.x < r.left || mp.x > r.right ||
|
||||
mp.y < r.top || mp.y > r.bottom) {
|
||||
gRollupListener->Rollup();
|
||||
return TRUE;
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get the window which caused the event and ask it to process the message
|
||||
nsWindow *someWindow = (nsWindow*)::GetWindowLong(hWnd, GWL_USERDATA);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче