Adding support for tooltips from the content area

This commit is contained in:
pinkerton%netscape.com 2002-05-31 18:26:57 +00:00
Родитель ea813dc9ea
Коммит 4f23d07ee4
16 изменённых файлов: 188 добавлений и 12 удалений

Просмотреть файл

@ -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