Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mullvad Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Mullvad Browser
Commits
8b143ceb
Commit
8b143ceb
authored
26 years ago
by
rods%netscape.com
Browse files
Options
Downloads
Patches
Plain Diff
Added the dispatch to menu listeners
parent
cac090da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
widget/src/windows/nsWindow.cpp
+54
-1
54 additions, 1 deletion
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
+5
-0
5 additions, 0 deletions
widget/src/windows/nsWindow.h
with
59 additions
and
1 deletion
widget/src/windows/nsWindow.cpp
+
54
−
1
View file @
8b143ceb
...
@@ -33,6 +33,11 @@
...
@@ -33,6 +33,11 @@
#include
"prtime.h"
#include
"prtime.h"
#include
"nsIRenderingContextWin.h"
#include
"nsIRenderingContextWin.h"
#include
"nsIMenu.h"
#include
"nsIMenuItem.h"
#include
"nsIMenuListener.h"
#include
"nsMenuItem.h"
BOOL
nsWindow
::
sIsRegistered
=
FALSE
;
BOOL
nsWindow
::
sIsRegistered
=
FALSE
;
nsWindow
*
nsWindow
::
gCurrentWindow
=
nsnull
;
nsWindow
*
nsWindow
::
gCurrentWindow
=
nsnull
;
...
@@ -43,7 +48,10 @@ nsWindow* nsWindow::gCurrentWindow = nsnull;
...
@@ -43,7 +48,10 @@ nsWindow* nsWindow::gCurrentWindow = nsnull;
// g_hinst - handle of the application instance
// g_hinst - handle of the application instance
extern
HINSTANCE
g_hinst
;
extern
HINSTANCE
g_hinst
;
static
NS_DEFINE_IID
(
kIWidgetIID
,
NS_IWIDGET_IID
);
static
NS_DEFINE_IID
(
kIWidgetIID
,
NS_IWIDGET_IID
);
static
NS_DEFINE_IID
(
kIMenuIID
,
NS_IMENU_IID
);
static
NS_DEFINE_IID
(
kIMenuItemIID
,
NS_IMENUITEM_IID
);
//static NS_DEFINE_IID(kIMenuListenerIID, NS_IMENULISTENER_IID);
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//
//
...
@@ -73,6 +81,9 @@ nsWindow::nsWindow() : nsBaseWidget()
...
@@ -73,6 +81,9 @@ nsWindow::nsWindow() : nsBaseWidget()
mFont
=
nsnull
;
mFont
=
nsnull
;
mIsVisible
=
PR_FALSE
;
mIsVisible
=
PR_FALSE
;
mHas3DBorder
=
PR_FALSE
;
mHas3DBorder
=
PR_FALSE
;
mMenuBar
=
nsnull
;
mMenuCmdId
=
0
;
}
}
...
@@ -1278,6 +1289,28 @@ void nsWindow::SetUpForPaint(HDC aHDC)
...
@@ -1278,6 +1289,28 @@ void nsWindow::SetUpForPaint(HDC aHDC)
::
SetBkMode
(
aHDC
,
TRANSPARENT
);
::
SetBkMode
(
aHDC
,
TRANSPARENT
);
}
}
//-------------------------------------------------------------------------
nsIMenuItem
*
FindMenuItem
(
nsIMenu
*
aMenu
,
PRUint32
aId
)
{
PRUint32
i
,
count
;
aMenu
->
GetItemCount
(
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
nsISupports
*
item
;
aMenu
->
GetItemAt
(
i
,
item
);
nsIMenuItem
*
menuItem
;
nsIMenu
*
menu
;
if
(
NS_OK
==
item
->
QueryInterface
(
kIMenuItemIID
,
(
void
**
)
&
menuItem
))
{
if
(((
nsMenuItem
*
)
menuItem
)
->
GetCmdId
()
==
(
PRInt32
)
aId
)
{
return
menuItem
;
}
}
else
if
(
NS_OK
==
item
->
QueryInterface
(
kIMenuIID
,
(
void
**
)
&
menu
))
{
return
FindMenuItem
(
menu
,
aId
);
}
}
return
nsnull
;
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//
//
// Process all nsWindows messages
// Process all nsWindows messages
...
@@ -1300,6 +1333,23 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
...
@@ -1300,6 +1333,23 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
event
.
eventStructType
=
NS_MENU_EVENT
;
event
.
eventStructType
=
NS_MENU_EVENT
;
InitEvent
(
event
,
NS_MENU_SELECTED
);
InitEvent
(
event
,
NS_MENU_SELECTED
);
result
=
DispatchWindowEvent
(
&
event
);
result
=
DispatchWindowEvent
(
&
event
);
if
(
mMenuBar
)
{
PRUint32
i
,
count
;
mMenuBar
->
GetMenuCount
(
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
nsIMenu
*
menu
;
mMenuBar
->
GetMenuAt
(
i
,
menu
);
nsIMenuItem
*
menuItem
=
FindMenuItem
(
menu
,
event
.
mCommand
);
if
(
menuItem
)
{
nsIMenuListener
*
listener
;
if
(
NS_OK
==
menuItem
->
QueryInterface
(
kIMenuListenerIID
,
(
void
**
)
&
listener
))
{
listener
->
MenuSelected
(
event
);
NS_RELEASE
(
listener
);
}
NS_RELEASE
(
menuItem
);
}
}
}
NS_RELEASE
(
event
.
widget
);
NS_RELEASE
(
event
.
widget
);
}
}
}
}
...
@@ -2038,6 +2088,9 @@ PRBool nsWindow::AutoErase()
...
@@ -2038,6 +2088,9 @@ PRBool nsWindow::AutoErase()
NS_METHOD
nsWindow
::
SetMenuBar
(
nsIMenuBar
*
aMenuBar
)
NS_METHOD
nsWindow
::
SetMenuBar
(
nsIMenuBar
*
aMenuBar
)
{
{
mMenuBar
=
aMenuBar
;
NS_ADDREF
(
mMenuBar
);
HMENU
nativeMenuHandle
;
HMENU
nativeMenuHandle
;
void
*
voidData
;
void
*
voidData
;
aMenuBar
->
GetNativeData
(
voidData
);
aMenuBar
->
GetNativeData
(
voidData
);
...
...
This diff is collapsed.
Click to expand it.
widget/src/windows/nsWindow.h
+
5
−
0
View file @
8b143ceb
...
@@ -136,6 +136,8 @@ public:
...
@@ -136,6 +136,8 @@ public:
virtual
PRBool
AutoErase
();
virtual
PRBool
AutoErase
();
nsPoint
*
GetLastPoint
()
{
return
&
mLastPoint
;
}
nsPoint
*
GetLastPoint
()
{
return
&
mLastPoint
;
}
PRInt32
GetNewCmdMenuId
()
{
mMenuCmdId
++
;
return
mMenuCmdId
;}
protected
:
protected
:
virtual
PRBool
ProcessMessage
(
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
LRESULT
*
aRetValue
);
virtual
PRBool
ProcessMessage
(
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
LRESULT
*
aRetValue
);
...
@@ -197,6 +199,9 @@ protected:
...
@@ -197,6 +199,9 @@ protected:
PRInt32
mPreferredWidth
;
PRInt32
mPreferredWidth
;
PRInt32
mPreferredHeight
;
PRInt32
mPreferredHeight
;
nsIMenuBar
*
mMenuBar
;
PRInt32
mMenuCmdId
;
// Enumeration of the methods which are accessable on the "main GUI thread"
// Enumeration of the methods which are accessable on the "main GUI thread"
// via the CallMethod(...) mechanism...
// via the CallMethod(...) mechanism...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment