зеркало из https://github.com/mozilla/gecko-dev.git
Adding support for tooltips from the content area
This commit is contained in:
Родитель
ea813dc9ea
Коммит
4f23d07ee4
|
@ -68,6 +68,9 @@ class nsIDragHelperService;
|
|||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode;
|
||||
// Called when a tooltip should be shown or hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
@end
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "nsISHEntry.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsITooltipListener.h"
|
||||
|
||||
typedef unsigned int DragReference;
|
||||
#include "nsIDragHelperService.h"
|
||||
|
@ -100,7 +101,8 @@ class nsCocoaBrowserListener : public nsSupportsWeakReference,
|
|||
public nsIWindowCreator,
|
||||
public nsIEmbeddingSiteWindow,
|
||||
public nsIWebProgressListener,
|
||||
public nsIContextMenuListener
|
||||
public nsIContextMenuListener,
|
||||
public nsITooltipListener
|
||||
{
|
||||
public:
|
||||
nsCocoaBrowserListener(CHBrowserView* aView);
|
||||
|
@ -113,6 +115,7 @@ public:
|
|||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSICONTEXTMENULISTENER
|
||||
NS_DECL_NSITOOLTIPLISTENER
|
||||
|
||||
void AddListener(id <NSBrowserListener> aListener);
|
||||
void RemoveListener(id <NSBrowserListener> aListener);
|
||||
|
@ -142,14 +145,15 @@ nsCocoaBrowserListener::~nsCocoaBrowserListener()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS7(nsCocoaBrowserListener,
|
||||
NS_IMPL_ISUPPORTS8(nsCocoaBrowserListener,
|
||||
nsIInterfaceRequestor,
|
||||
nsIWebBrowserChrome,
|
||||
nsIWindowCreator,
|
||||
nsIEmbeddingSiteWindow,
|
||||
nsIWebProgressListener,
|
||||
nsISupportsWeakReference,
|
||||
nsIContextMenuListener)
|
||||
nsIContextMenuListener,
|
||||
nsITooltipListener)
|
||||
|
||||
// Implementation of nsIInterfaceRequestor
|
||||
NS_IMETHODIMP
|
||||
|
@ -204,6 +208,23 @@ nsCocoaBrowserListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent* a
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsITooltipListener
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
|
||||
{
|
||||
NSPoint where;
|
||||
where.x = aXCoords; where.y = aYCoords;
|
||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnHideTooltip()
|
||||
{
|
||||
[mContainer onHideTooltip];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsIWebBrowserChrome
|
||||
/* void setStatus (in unsigned long statusType, in wstring status); */
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -95,6 +95,8 @@
|
|||
- (void)onLocationChange:(NSURL*)url;
|
||||
- (void)onStatusChange:(NSString*)aMessage;
|
||||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
|
||||
// NSBrowserContainer messages
|
||||
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
|
||||
|
|
|
@ -365,6 +365,24 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[mTab setLabel:@"Untitled"];
|
||||
}
|
||||
|
||||
// called when a toolip should be shown/hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text
|
||||
{
|
||||
NSLog([text description]);
|
||||
#if 0
|
||||
// This doesn't work, and i'm not sure why
|
||||
[mBrowserView setToolTip:text];
|
||||
NSToolTipTag tag = [mBrowserView addToolTipRect:[mBrowserView bounds] owner:text userData:nil];
|
||||
printf("tag is %d\n", tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)onHideTooltip
|
||||
{
|
||||
NSLog(@"hiding");
|
||||
[mBrowserView removeAllToolTips];
|
||||
}
|
||||
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode
|
||||
{
|
||||
|
|
|
@ -95,6 +95,8 @@
|
|||
- (void)onLocationChange:(NSURL*)url;
|
||||
- (void)onStatusChange:(NSString*)aMessage;
|
||||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
|
||||
// NSBrowserContainer messages
|
||||
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
|
||||
|
|
|
@ -365,6 +365,24 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[mTab setLabel:@"Untitled"];
|
||||
}
|
||||
|
||||
// called when a toolip should be shown/hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text
|
||||
{
|
||||
NSLog([text description]);
|
||||
#if 0
|
||||
// This doesn't work, and i'm not sure why
|
||||
[mBrowserView setToolTip:text];
|
||||
NSToolTipTag tag = [mBrowserView addToolTipRect:[mBrowserView bounds] owner:text userData:nil];
|
||||
printf("tag is %d\n", tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)onHideTooltip
|
||||
{
|
||||
NSLog(@"hiding");
|
||||
[mBrowserView removeAllToolTips];
|
||||
}
|
||||
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode
|
||||
{
|
||||
|
|
|
@ -68,6 +68,9 @@ class nsIDragHelperService;
|
|||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode;
|
||||
// Called when a tooltip should be shown or hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
@end
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "nsISHEntry.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsITooltipListener.h"
|
||||
|
||||
typedef unsigned int DragReference;
|
||||
#include "nsIDragHelperService.h"
|
||||
|
@ -100,7 +101,8 @@ class nsCocoaBrowserListener : public nsSupportsWeakReference,
|
|||
public nsIWindowCreator,
|
||||
public nsIEmbeddingSiteWindow,
|
||||
public nsIWebProgressListener,
|
||||
public nsIContextMenuListener
|
||||
public nsIContextMenuListener,
|
||||
public nsITooltipListener
|
||||
{
|
||||
public:
|
||||
nsCocoaBrowserListener(CHBrowserView* aView);
|
||||
|
@ -113,6 +115,7 @@ public:
|
|||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSICONTEXTMENULISTENER
|
||||
NS_DECL_NSITOOLTIPLISTENER
|
||||
|
||||
void AddListener(id <NSBrowserListener> aListener);
|
||||
void RemoveListener(id <NSBrowserListener> aListener);
|
||||
|
@ -142,14 +145,15 @@ nsCocoaBrowserListener::~nsCocoaBrowserListener()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS7(nsCocoaBrowserListener,
|
||||
NS_IMPL_ISUPPORTS8(nsCocoaBrowserListener,
|
||||
nsIInterfaceRequestor,
|
||||
nsIWebBrowserChrome,
|
||||
nsIWindowCreator,
|
||||
nsIEmbeddingSiteWindow,
|
||||
nsIWebProgressListener,
|
||||
nsISupportsWeakReference,
|
||||
nsIContextMenuListener)
|
||||
nsIContextMenuListener,
|
||||
nsITooltipListener)
|
||||
|
||||
// Implementation of nsIInterfaceRequestor
|
||||
NS_IMETHODIMP
|
||||
|
@ -204,6 +208,23 @@ nsCocoaBrowserListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent* a
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsITooltipListener
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
|
||||
{
|
||||
NSPoint where;
|
||||
where.x = aXCoords; where.y = aYCoords;
|
||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnHideTooltip()
|
||||
{
|
||||
[mContainer onHideTooltip];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsIWebBrowserChrome
|
||||
/* void setStatus (in unsigned long statusType, in wstring status); */
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -68,6 +68,9 @@ class nsIDragHelperService;
|
|||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode;
|
||||
// Called when a tooltip should be shown or hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
@end
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "nsISHEntry.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsITooltipListener.h"
|
||||
|
||||
typedef unsigned int DragReference;
|
||||
#include "nsIDragHelperService.h"
|
||||
|
@ -100,7 +101,8 @@ class nsCocoaBrowserListener : public nsSupportsWeakReference,
|
|||
public nsIWindowCreator,
|
||||
public nsIEmbeddingSiteWindow,
|
||||
public nsIWebProgressListener,
|
||||
public nsIContextMenuListener
|
||||
public nsIContextMenuListener,
|
||||
public nsITooltipListener
|
||||
{
|
||||
public:
|
||||
nsCocoaBrowserListener(CHBrowserView* aView);
|
||||
|
@ -113,6 +115,7 @@ public:
|
|||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSICONTEXTMENULISTENER
|
||||
NS_DECL_NSITOOLTIPLISTENER
|
||||
|
||||
void AddListener(id <NSBrowserListener> aListener);
|
||||
void RemoveListener(id <NSBrowserListener> aListener);
|
||||
|
@ -142,14 +145,15 @@ nsCocoaBrowserListener::~nsCocoaBrowserListener()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS7(nsCocoaBrowserListener,
|
||||
NS_IMPL_ISUPPORTS8(nsCocoaBrowserListener,
|
||||
nsIInterfaceRequestor,
|
||||
nsIWebBrowserChrome,
|
||||
nsIWindowCreator,
|
||||
nsIEmbeddingSiteWindow,
|
||||
nsIWebProgressListener,
|
||||
nsISupportsWeakReference,
|
||||
nsIContextMenuListener)
|
||||
nsIContextMenuListener,
|
||||
nsITooltipListener)
|
||||
|
||||
// Implementation of nsIInterfaceRequestor
|
||||
NS_IMETHODIMP
|
||||
|
@ -204,6 +208,23 @@ nsCocoaBrowserListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent* a
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsITooltipListener
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
|
||||
{
|
||||
NSPoint where;
|
||||
where.x = aXCoords; where.y = aYCoords;
|
||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnHideTooltip()
|
||||
{
|
||||
[mContainer onHideTooltip];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsIWebBrowserChrome
|
||||
/* void setStatus (in unsigned long statusType, in wstring status); */
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -95,6 +95,8 @@
|
|||
- (void)onLocationChange:(NSURL*)url;
|
||||
- (void)onStatusChange:(NSString*)aMessage;
|
||||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
|
||||
// NSBrowserContainer messages
|
||||
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
|
||||
|
|
|
@ -365,6 +365,24 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[mTab setLabel:@"Untitled"];
|
||||
}
|
||||
|
||||
// called when a toolip should be shown/hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text
|
||||
{
|
||||
NSLog([text description]);
|
||||
#if 0
|
||||
// This doesn't work, and i'm not sure why
|
||||
[mBrowserView setToolTip:text];
|
||||
NSToolTipTag tag = [mBrowserView addToolTipRect:[mBrowserView bounds] owner:text userData:nil];
|
||||
printf("tag is %d\n", tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)onHideTooltip
|
||||
{
|
||||
NSLog(@"hiding");
|
||||
[mBrowserView removeAllToolTips];
|
||||
}
|
||||
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode
|
||||
{
|
||||
|
|
|
@ -95,6 +95,8 @@
|
|||
- (void)onLocationChange:(NSURL*)url;
|
||||
- (void)onStatusChange:(NSString*)aMessage;
|
||||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
|
||||
// NSBrowserContainer messages
|
||||
- (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
|
||||
|
|
|
@ -365,6 +365,24 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
[mTab setLabel:@"Untitled"];
|
||||
}
|
||||
|
||||
// called when a toolip should be shown/hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text
|
||||
{
|
||||
NSLog([text description]);
|
||||
#if 0
|
||||
// This doesn't work, and i'm not sure why
|
||||
[mBrowserView setToolTip:text];
|
||||
NSToolTipTag tag = [mBrowserView addToolTipRect:[mBrowserView bounds] owner:text userData:nil];
|
||||
printf("tag is %d\n", tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)onHideTooltip
|
||||
{
|
||||
NSLog(@"hiding");
|
||||
[mBrowserView removeAllToolTips];
|
||||
}
|
||||
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode
|
||||
{
|
||||
|
|
|
@ -68,6 +68,9 @@ class nsIDragHelperService;
|
|||
- (void)onSecurityStateChange:(unsigned long)newState;
|
||||
// Called when a context menu should be shown.
|
||||
- (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode;
|
||||
// Called when a tooltip should be shown or hidden
|
||||
- (void)onShowTooltip:(NSPoint)where withText:(NSString*)text;
|
||||
- (void)onHideTooltip;
|
||||
@end
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "nsISHEntry.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsITooltipListener.h"
|
||||
|
||||
typedef unsigned int DragReference;
|
||||
#include "nsIDragHelperService.h"
|
||||
|
@ -100,7 +101,8 @@ class nsCocoaBrowserListener : public nsSupportsWeakReference,
|
|||
public nsIWindowCreator,
|
||||
public nsIEmbeddingSiteWindow,
|
||||
public nsIWebProgressListener,
|
||||
public nsIContextMenuListener
|
||||
public nsIContextMenuListener,
|
||||
public nsITooltipListener
|
||||
{
|
||||
public:
|
||||
nsCocoaBrowserListener(CHBrowserView* aView);
|
||||
|
@ -113,6 +115,7 @@ public:
|
|||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSICONTEXTMENULISTENER
|
||||
NS_DECL_NSITOOLTIPLISTENER
|
||||
|
||||
void AddListener(id <NSBrowserListener> aListener);
|
||||
void RemoveListener(id <NSBrowserListener> aListener);
|
||||
|
@ -142,14 +145,15 @@ nsCocoaBrowserListener::~nsCocoaBrowserListener()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS7(nsCocoaBrowserListener,
|
||||
NS_IMPL_ISUPPORTS8(nsCocoaBrowserListener,
|
||||
nsIInterfaceRequestor,
|
||||
nsIWebBrowserChrome,
|
||||
nsIWindowCreator,
|
||||
nsIEmbeddingSiteWindow,
|
||||
nsIWebProgressListener,
|
||||
nsISupportsWeakReference,
|
||||
nsIContextMenuListener)
|
||||
nsIContextMenuListener,
|
||||
nsITooltipListener)
|
||||
|
||||
// Implementation of nsIInterfaceRequestor
|
||||
NS_IMETHODIMP
|
||||
|
@ -204,6 +208,23 @@ nsCocoaBrowserListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent* a
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsITooltipListener
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
|
||||
{
|
||||
NSPoint where;
|
||||
where.x = aXCoords; where.y = aYCoords;
|
||||
[mContainer onShowTooltip:where withText:[NSString stringWithCharacters:aTipText length:nsCRT::strlen(aTipText)]];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCocoaBrowserListener::OnHideTooltip()
|
||||
{
|
||||
[mContainer onHideTooltip];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation of nsIWebBrowserChrome
|
||||
/* void setStatus (in unsigned long statusType, in wstring status); */
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче