mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Sigh.
This commit is contained in:
parent
8b1c0c50d5
commit
84a6485158
@ -152,7 +152,8 @@ nsContextMenu::~nsContextMenu()
|
|||||||
// Create the proper widget
|
// Create the proper widget
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
NS_METHOD nsContextMenu::Create(nsISupports *aParent, const nsString& anAlignment)
|
NS_METHOD nsContextMenu::Create(nsISupports *aParent, const nsString& anAlignment,
|
||||||
|
const nsString& anAnchorAlignment)
|
||||||
{
|
{
|
||||||
mParent = aParent;
|
mParent = aParent;
|
||||||
mMacMenuHandle = ::NewMenu(mMacMenuIDCount, (const unsigned char *)"");
|
mMacMenuHandle = ::NewMenu(mMacMenuIDCount, (const unsigned char *)"");
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||||
|
|
||||||
// nsIMenu Methods
|
// nsIMenu Methods
|
||||||
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment);
|
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment, const nsString& aAnchorAlign);
|
||||||
NS_IMETHOD GetParent(nsISupports *&aParent);
|
NS_IMETHOD GetParent(nsISupports *&aParent);
|
||||||
NS_IMETHOD AddItem(nsISupports* aText);
|
NS_IMETHOD AddItem(nsISupports* aText);
|
||||||
NS_IMETHOD AddSeparator();
|
NS_IMETHOD AddSeparator();
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsStringUtil.h"
|
#include "nsStringUtil.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <winuser.h>
|
||||||
|
|
||||||
#include "nsIAppShell.h"
|
#include "nsIAppShell.h"
|
||||||
#include "nsGUIEvent.h"
|
#include "nsGUIEvent.h"
|
||||||
@ -98,6 +99,7 @@ nsContextMenu::nsContextMenu()
|
|||||||
mWebShell = nsnull;
|
mWebShell = nsnull;
|
||||||
mConstructed = false;
|
mConstructed = false;
|
||||||
mAlignment = "topleft";
|
mAlignment = "topleft";
|
||||||
|
mAnchorAlignment = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -119,7 +121,8 @@ nsContextMenu::~nsContextMenu()
|
|||||||
// Create the proper widget
|
// Create the proper widget
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
NS_METHOD nsContextMenu::Create(nsISupports *aParent, const nsString& anAlignment)
|
NS_METHOD nsContextMenu::Create(nsISupports *aParent, const nsString& anAlignment,
|
||||||
|
const nsString& anAnchorAlignment)
|
||||||
{
|
{
|
||||||
if(aParent)
|
if(aParent)
|
||||||
{
|
{
|
||||||
@ -132,7 +135,7 @@ NS_METHOD nsContextMenu::Create(nsISupports *aParent, const nsString& anAlignmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
mAlignment = anAlignment;
|
mAlignment = anAlignment;
|
||||||
|
mAnchorAlignment = anAnchorAlignment;
|
||||||
mMenu = CreatePopupMenu();
|
mMenu = CreatePopupMenu();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -412,6 +415,51 @@ nsEventStatus nsContextMenu::MenuSelected(const nsMenuEvent & aMenuEvent)
|
|||||||
}
|
}
|
||||||
alignFlags |= TPM_RETURNCMD;
|
alignFlags |= TPM_RETURNCMD;
|
||||||
|
|
||||||
|
/* Commented out. Don't understand how to compile this so that it works.
|
||||||
|
if (mAnchorAlignment == "topleft") {
|
||||||
|
// Fancy animation in this case matters for
|
||||||
|
// bottomleft and topright
|
||||||
|
if (mAlignment == "topright") {
|
||||||
|
// Sliding from right to left
|
||||||
|
alignFlags |= TPM_HORPOSANIMATION;
|
||||||
|
}
|
||||||
|
else if (mAlignment == "bottomleft") {
|
||||||
|
// Sliding from bottom to top
|
||||||
|
alignFlags |= TPM_VERNEGANIMATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mAnchorAlignment == "topright") {
|
||||||
|
if (mAlignment == "topleft") {
|
||||||
|
// Sliding from left to right
|
||||||
|
alignFlags |= TPM_HORNEGANIMATION;
|
||||||
|
}
|
||||||
|
else if (mAlignment == "bottomright") {
|
||||||
|
// Sliding from bottom to top
|
||||||
|
alignFlags |= TPM_VERNEGANIMATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mAnchorAlignment == "bottomright") {
|
||||||
|
if (mAlignment == "bottomleft") {
|
||||||
|
// Sliding from left to right
|
||||||
|
alignFlags |= TPM_HORNEGANIMATION;
|
||||||
|
}
|
||||||
|
else if (mAlignment == "topright") {
|
||||||
|
// Sliding from top to bottom
|
||||||
|
alignFlags |= TPM_VERPOSANIMATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mAnchorAlignment == "bottomleft") {
|
||||||
|
if (mAlignment == "topleft") {
|
||||||
|
// Sliding from top to bottom
|
||||||
|
alignFlags |= TPM_VERPOSANIMATION;
|
||||||
|
}
|
||||||
|
else if (mAlignment == "bottomright") {
|
||||||
|
// Sliding from right to left
|
||||||
|
alignFlags |= TPM_HORPOSANIMATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
PRInt32 identifier = ::TrackPopupMenu(
|
PRInt32 identifier = ::TrackPopupMenu(
|
||||||
mMenu,
|
mMenu,
|
||||||
alignFlags,
|
alignFlags,
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||||
|
|
||||||
// nsIMenu Methods
|
// nsIMenu Methods
|
||||||
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment);
|
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment, const nsString& aAnchorAlign);
|
||||||
NS_IMETHOD GetParent(nsISupports *&aParent);
|
NS_IMETHOD GetParent(nsISupports *&aParent);
|
||||||
|
|
||||||
NS_IMETHOD AddItem(nsISupports * aItem);
|
NS_IMETHOD AddItem(nsISupports * aItem);
|
||||||
@ -129,6 +129,7 @@ protected:
|
|||||||
bool mConstructed;
|
bool mConstructed;
|
||||||
|
|
||||||
nsString mAlignment;
|
nsString mAlignment;
|
||||||
|
nsString mAnchorAlignment;
|
||||||
|
|
||||||
PRInt32 mX;
|
PRInt32 mX;
|
||||||
PRInt32 mY;
|
PRInt32 mY;
|
||||||
|
Loading…
Reference in New Issue
Block a user