base/src/nscore.h

This commit is contained in:
akkana%netscape.com 1998-12-04 21:36:23 +00:00
parent 7e610d5df9
commit 5da3c4fcdf
17 changed files with 82 additions and 80 deletions

View File

@ -99,7 +99,7 @@ nsresult nsImageGTK :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMa
mAlphaBits = new unsigned char[mAlphaRowBytes * aHeight];
mAlphaWidth = aWidth;
mAlphaHeight = aHeight;
mAlphaPixmap = gdk_pixmap_new(NULL, mWidth, mHeight, 1);
mAlphaPixmap = gdk_pixmap_new(nsnull, mWidth, mHeight, 1);
}
else
@ -247,7 +247,7 @@ NS_IMETHODIMP nsImageGTK :: Draw(nsIRenderingContext &aContext, nsDrawingSurface
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
{
g_return_val_if_fail ((aSurface != NULL), NS_ERROR_FAILURE);
g_return_val_if_fail ((aSurface != nsnull), NS_ERROR_FAILURE);
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*)aSurface;
@ -269,14 +269,14 @@ NS_IMETHODIMP nsImageGTK :: Draw(nsIRenderingContext &aContext,
PRInt32 aX, PRInt32 aY,
PRInt32 aWidth, PRInt32 aHeight)
{
g_return_val_if_fail ((aSurface != NULL), NS_ERROR_FAILURE);
g_return_val_if_fail ((aSurface != nsnull), NS_ERROR_FAILURE);
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*) aSurface;
XImage *x_image = NULL;
XImage *x_image = nsnull;
Pixmap pixmap = 0;
Display *dpy = NULL;
Visual *visual = NULL;
Display *dpy = nsnull;
Visual *visual = nsnull;
GC gc;
XGCValues gcv;
@ -332,7 +332,7 @@ NS_IMETHODIMP nsImageGTK :: Draw(nsIRenderingContext &aContext,
if (mAlphaBits != nsnull)
{
gdk_gc_set_clip_origin(drawing->gc, 0, 0);
gdk_gc_set_clip_mask(drawing->gc, NULL);
gdk_gc_set_clip_mask(drawing->gc, nsnull);
x_image->data = 0; /* Don't free the IL_Pixmap's bits. */
XDestroyImage(x_image);
}

View File

@ -567,7 +567,7 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawPolyline(const nsPoint aPoints[], PRInt
g_return_val_if_fail(mRenderingSurface->gc != NULL, NS_ERROR_FAILURE);
GdkPoint *pts = new GdkPoint[aNumPoints];
for (PRInt32 i = 0; i < aNumPoints; i++)
for (i = 0; i < aNumPoints; i++)
{
nsPoint p = aPoints[i];
mTMatrix->TransformCoord(&p.x,&p.y);
@ -1121,7 +1121,7 @@ nsRenderingContextGTK::SetClipRectInPixels(const nsRect& aRect,
if (::gdk_region_empty(mRegion) == True) {
bEmpty = PR_TRUE;
::gdk_gc_set_clip_region(mRenderingSurface->gc, NULL);
::gdk_gc_set_clip_region(mRenderingSurface->gc, nsnull);
} else {

View File

@ -402,7 +402,7 @@ nsRDFDocumentContentSink::OpenObject(const nsIParserNode& aNode)
return rv;
}
mRootElement = static_cast<nsIContent*>(rdfElement);
mRootElement = NS_STATIC_CAST(nsIContent*,rdfElement);
mDocument->SetRootContent(mRootElement);
// don't release the rdfElement since we're keeping

View File

@ -145,7 +145,7 @@ nsRDFResourceManager::GetNode(const nsString& uri, nsIRDFNode*& resource)
ResourceHashKey key(atom);
resource = static_cast<nsIRDFNode*>(mResources.Get(&key));
resource = NS_STATIC_CAST(nsIRDFNode*,mResources.Get(&key));
if (! resource) {
resource = new RDFNodeImpl(this, atom);
if (resource)

View File

@ -72,7 +72,7 @@ public:
MultiCursor(nsVoidArray& dataSources);
virtual ~MultiCursor(void);
NS_DECL_ISUPPORTS;
NS_DECL_ISUPPORTS
NS_IMETHOD HasMoreElements(PRBool& result);
NS_IMETHOD GetNext(nsIRDFNode*& next, PRBool& tv);

View File

@ -19,6 +19,7 @@
#include <gtk/gtk.h>
#include "gtklayout.h"
#include "resources.h"
#include "nscore.h"
#include "stdio.h"
@ -32,61 +33,61 @@ void gtk_ifactory_cb (gpointer callback_data,
GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/File/_New Window", NULL, gtk_ifactory_cb, 0 },
{ "/File/_Open...", NULL, gtk_ifactory_cb, 0 },
{ "/File/_Samples", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/File/Samples/demo #0", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #1", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #2", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #3", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #4", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #5", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #6", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #7", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #8", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #9", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #10", NULL, gtk_ifactory_cb, 0, },
{ "/File/Samples/Top 100 Sites", NULL, gtk_ifactory_cb, 0, },
{ "/_File", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Branch>" },
{ "/File/_New Window", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/File/_Open...", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/File/_Samples", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Branch>" },
{ "/File/Samples/demo #0", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #2", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #3", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #4", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #5", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #6", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #7", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #8", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #9", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/demo #10", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/File/Samples/Top 100 Sites", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, },
{ "/_Edit", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/Edit/Cut", "T", gtk_ifactory_cb, 0 },
{ "/Edit/Copy", "C", gtk_ifactory_cb, 0 },
{ "/Edit/Paste", "P", gtk_ifactory_cb, 0 },
{ "/Edit/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Edit/Select All", "A", gtk_ifactory_cb, 0 },
{ "/Edit/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Edit/Find in Page", "F", gtk_ifactory_cb, 0 },
{ "/_Edit", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Branch>" },
{ "/Edit/Cut", "T", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Edit/Copy", "C", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Edit/Paste", "P", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Edit/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Edit/Select All", "A", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Edit/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Edit/Find in Page", "F", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/_Debug", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/Debug/Visual Debugging", "V", gtk_ifactory_cb, 0 },
{ "/Debug/Reflow Test", "R", gtk_ifactory_cb, 0 },
{ "/Debug/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Dump Content", "C", gtk_ifactory_cb, 0 },
{ "/Debug/Dump Frames", "F", gtk_ifactory_cb, 0 },
{ "/Debug/Dump Views", "V", gtk_ifactory_cb, 0 },
{ "/Debug/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Dump Style Sheets", "S", gtk_ifactory_cb, 0 },
{ "/Debug/Dump Style Contexts", "T", gtk_ifactory_cb, 0 },
{ "/Debug/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Show Content Size", "z", gtk_ifactory_cb, 0 },
{ "/Debug/Show Frame Size", "a", gtk_ifactory_cb, 0 },
{ "/Debug/Show Style Size", "y", gtk_ifactory_cb, 0 },
{ "/Debug/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Debug Save", "v", gtk_ifactory_cb, 0 },
{ "/Debug/Debug Toggle Selection", "q", gtk_ifactory_cb, 0 },
{ "/Debug/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Debug Debug Robot", "R", gtk_ifactory_cb, 0 },
{ "/Debug/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Show Content Quality", ".", gtk_ifactory_cb, 0 },
{ "/_Debug", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Branch>" },
{ "/Debug/Visual Debugging", "V", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Reflow Test", "R", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Dump Content", "C", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Dump Frames", "F", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Dump Views", "V", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Dump Style Sheets", "S", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Dump Style Contexts", "T", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Show Content Size", "z", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Show Frame Size", "a", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Show Style Size", "y", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Debug Save", "v", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/Debug Toggle Selection", "q", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Debug Debug Robot", "R", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
{ "/Debug/sep1", nsnull, (GtkItemFactoryCallback)gtk_ifactory_cb, 0, "<Separator>" },
{ "/Debug/Show Content Quality", ".", (GtkItemFactoryCallback)gtk_ifactory_cb, 0 },
};
void CreateViewerMenus(GtkWidget *aParent, gpointer aCallback)
{
GtkItemFactory *item_factory;
int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", NULL);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", nsnull);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, nsnull);
/*
gtk_box_pack_start (GTK_BOX (aParent),
gtk_item_factory_get_widget (item_factory,

View File

@ -19,6 +19,7 @@
// Force references to all of the symbols that we want exported from
// the dll that are located in the .lib files we link with
#include "nscore.h"
#include <gtk/gtk.h>
GtkWidget *gAppContext;

View File

@ -34,7 +34,7 @@ public:
virtual ~nsButton();
// nsISupports
NS_DECL_ISUPPORTS;
NS_DECL_ISUPPORTS
// nsIButton part
NS_IMETHOD SetLabel(const nsString& aText);

View File

@ -44,7 +44,7 @@ nsComboBox::nsComboBox() : nsWidget(), nsIListWidget(), nsIComboBox()
mMultiSelect = PR_FALSE;
mBackground = NS_RGB(124, 124, 124);
mItems = NULL;
mItems = nsnull;
mNumItems = 0;
}

View File

@ -169,7 +169,7 @@ PRBool nsListBox::RemoveItemAt(PRInt32 aPosition)
PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
{
PRBool result = PR_FALSE;
char *text = NULL;
char *text = nsnull;
gtk_clist_get_text(GTK_CLIST(mCList),aPosition,0,&text);
if (text) {
@ -333,7 +333,7 @@ NS_METHOD nsListBox::Deselect()
NS_METHOD nsListBox::CreateNative(GtkWidget *parentWindow)
{
// to handle scrolling
mWidget = gtk_scrolled_window_new (NULL, NULL);
mWidget = gtk_scrolled_window_new (nsnull, nsnull);
gtk_widget_set_name(mWidget, "nsListBox");
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (mWidget),
GTK_POLICY_AUTOMATIC,

View File

@ -58,15 +58,15 @@ nsMenu::~nsMenu()
//-------------------------------------------------------------------------
GtkWidget *nsMenu::GetNativeParent()
{
void * voidData;
GtkWidget * voidData;
if (nsnull != mMenuParent) {
mMenuParent->GetNativeData(voidData);
} else if (nsnull != mMenuBarParent) {
mMenuBarParent->GetNativeData(voidData);
} else {
return NULL;
return nsnull;
}
return static_cast<GtkWidget*>(voidData);
return (GtkWidget*)voidData;
}
@ -154,7 +154,7 @@ NS_METHOD nsMenu::AddItem(nsIMenuItem * aMenuItem)
NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu)
{
nsString Label;
GtkWidget *item=NULL, *parentmenu=NULL, *newmenu=NULL;
GtkWidget *item=nsnull, *parentmenu=nsnull, *newmenu=nsnull;
char *labelStr;
void *voidData=NULL;

View File

@ -101,7 +101,7 @@ GtkWidget *nsMenuItem::GetNativeParent()
} else if (nsnull != mPopUpParent) {
mPopUpParent->GetNativeData(voidData);
} else {
return NULL;
return nsnull;
}
return GTK_WIDGET(voidData);
}

View File

@ -76,7 +76,7 @@ nsresult nsRadioButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
//-------------------------------------------------------------------------
NS_METHOD nsRadioButton::CreateNative(GtkWidget *parentWindow)
{
mWidget = gtk_radio_button_new(NULL);
mWidget = gtk_radio_button_new(nsnull);
gtk_widget_set_name(mWidget, "nsRadioButton");
return NS_OK;

View File

@ -95,7 +95,7 @@ NS_METHOD nsTextHelper::SetText(const nsString& aText, PRUint32& aActualSize)
if (GTK_IS_ENTRY(mWidget)) {
gtk_entry_set_text(GTK_ENTRY(mWidget), buf);
} else if (GTK_IS_TEXT(mWidget)) {
gtk_text_insert(GTK_TEXT(mWidget), NULL, NULL, NULL, buf, aActualSize);
gtk_text_insert(GTK_TEXT(mWidget), nsnull, nsnull, nsnull, buf, aActualSize);
}
NS_FREE_STR_BUF(buf);

View File

@ -178,8 +178,8 @@ static void set_icon (GdkWindow * w)
att.y = 0;
att.visual = gdk_rgb_get_visual ();
att.colormap = gdk_rgb_get_cmap ();
ic_win = gdk_window_new (NULL, &att, GDK_WA_VISUAL | GDK_WA_COLORMAP);
gdk_window_set_icon (w, ic_win, NULL, NULL);
ic_win = gdk_window_new (nsnull, &att, GDK_WA_VISUAL | GDK_WA_COLORMAP);
gdk_window_set_icon (w, ic_win, nsnull, nsnull);
pmap = gdk_pixmap_create_from_xpm_d(w, &mask, 0, mozilla_icon_xpm);
gdk_window_set_back_pixmap (ic_win, pmap, FALSE);
gdk_window_clear (ic_win);

View File

@ -227,7 +227,7 @@ void nsHTTreeDataModel::GetTitleBarText(nsString& text) const
nsIImage* nsHTTreeDataModel::GetTitleBGImage() const
{
// cast away const because we can't use mutable
nsHTTreeDataModel* self = const_cast<nsHTTreeDataModel*>(this);
nsHTTreeDataModel* self = NS_CONST_CAST(nsHTTreeDataModel*,this);
nsString url("http://www.shadowland.org/images/ancient_glyphs.jpg");
if (mTitleBGRequest == nsnull)
@ -238,7 +238,7 @@ nsIImage* nsHTTreeDataModel::GetTitleBGImage() const
nsIImage* nsHTTreeDataModel::GetControlStripBGImage() const
{
// cast away const because we can't use mutable
nsHTTreeDataModel* self = const_cast<nsHTTreeDataModel*>(this);
nsHTTreeDataModel* self = NS_CONST_CAST(nsHTTreeDataModel*,this);
nsString url("http://www.shadowland.org/images/minute_bumps.jpg");
if (mControlStripBGRequest == nsnull)
@ -249,7 +249,7 @@ nsIImage* nsHTTreeDataModel::GetControlStripBGImage() const
nsIImage* nsHTTreeDataModel::GetColumnHeaderBGImage() const
{
// cast away const because we can't use mutable
nsHTTreeDataModel* self = const_cast<nsHTTreeDataModel*>(this);
nsHTTreeDataModel* self = NS_CONST_CAST(nsHTTreeDataModel*,this);
nsString url("http://www.shadowland.org/images/tapestry.jpg");
if (mColumnHeaderBGRequest == nsnull)

View File

@ -88,7 +88,7 @@ void nsHTTreeItem::GetItemStyle(nsIDeviceContext* dc, nsTreeItemStyleInfo& style
nsIImage* nsHTTreeItem::GetTriggerImage() const
{
// cast away const because we can't use mutable
nsHTTreeItem* self = const_cast<nsHTTreeItem*>(this);
nsHTTreeItem* self = NS_CONST_CAST(nsHTTreeItem*,this);
// TODO: Really read in these properties
nsString openTriggerURL("http://www.shadowland.org/client/images/overlay.gif");
@ -114,7 +114,7 @@ nsIImage* nsHTTreeItem::GetTriggerImage() const
nsIImage* nsHTTreeItem::GetIconImage() const
{
// cast away const because we can't use mutable
nsHTTreeItem* self = const_cast<nsHTTreeItem*>(this);
nsHTTreeItem* self = NS_CONST_CAST(nsHTTreeItem*,this);
nsString openIconURL("http://www.shadowland.org/CLIENT/IMAGES/OpenRead.gif");
nsString closedIconURL("http://www.shadowland.org/CLIENT/IMAGES/ClosedRead.gif");
@ -136,7 +136,7 @@ nsIImage* nsHTTreeItem::GetIconImage() const
nsIImage* nsHTTreeItem::GetBackgroundImage() const
{
// cast away const because we can't use mutable
nsHTTreeItem* self = const_cast<nsHTTreeItem*>(this);
nsHTTreeItem* self = NS_CONST_CAST(nsHTTreeItem*,this);
nsString bgURL("http://www.shadowland.org/images/chalk.jpg");
if (mBackgroundRequest == nsnull)