s/NULL/nsnull/ in nsGtkEventHandler

use a few macros in nsWidget
This commit is contained in:
pavlov%pavlov.net 1999-04-24 15:00:11 +00:00
Родитель f5389ea30c
Коммит cc5faa7ed9
2 изменённых файлов: 29 добавлений и 21 удалений

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

@ -141,7 +141,7 @@ void InitAllocationEvent(GtkAllocation *aAlloc,
anEvent.eventStructType = NS_SIZE_EVENT;
if (aAlloc != NULL) {
if (aAlloc != nsnull) {
nsRect *foo = new nsRect(aAlloc->x, aAlloc->y, aAlloc->width, aAlloc->height);
anEvent.windowSize = foo;
anEvent.point.x = aAlloc->x;
@ -164,7 +164,7 @@ void InitConfigureEvent(GdkEventConfigure *aConf,
anEvent.eventStructType = NS_SIZE_EVENT;
if (aConf != NULL) {
if (aConf != nsnull) {
/* do we accually need to alloc a new rect, or can we just set the
current one */
nsRect *foo = new nsRect(aConf->x, aConf->y, aConf->width, aConf->height);
@ -189,7 +189,7 @@ void InitExposeEvent(GdkEventExpose *aGEE,
anEvent.eventStructType = NS_PAINT_EVENT;
if (aGEE != NULL) {
if (aGEE != nsnull) {
nsRect *rect = new nsRect(aGEE->area.x, aGEE->area.y,
aGEE->area.width, aGEE->area.height);
anEvent.rect = rect;
@ -203,7 +203,7 @@ void UninitExposeEvent(GdkEventExpose *aGEE,
nsPaintEvent &anEvent,
PRUint32 aEventType)
{
if (aGEE != NULL) {
if (aGEE != nsnull) {
delete anEvent.rect;
}
}
@ -221,7 +221,7 @@ void InitKeyEvent(GdkEventKey *aGEK,
anEvent.eventStructType = NS_KEY_EVENT;
if (aGEK != NULL) {
if (aGEK != nsnull) {
anEvent.keyCode = nsConvertKey(aGEK->keyval) & 0x00FF;
//
// As per joki: as long as we're using ASCII rather than Unicode,
@ -418,7 +418,7 @@ void menu_item_activate_handler(GtkWidget *w, gpointer p)
nsIMenuListener *menuListener = nsnull;
nsIMenuItem *menuItem = (nsIMenuItem *)p;
if (menuItem != NULL) {
if (menuItem != nsnull) {
nsMenuEvent mevent;
mevent.message = NS_MENU_SELECTED;
mevent.eventStructType = NS_MENU_EVENT;
@ -448,7 +448,7 @@ void menu_map_handler(GtkWidget *w, gpointer p)
{
nsIMenuListener *menuListener = nsnull;
nsIMenu *menu = (nsIMenu *)p;
if (menu != NULL) {
if (menu != nsnull) {
nsMenuEvent mevent;
mevent.message = NS_MENU_SELECTED;
mevent.eventStructType = NS_MENU_EVENT;
@ -461,12 +461,13 @@ void menu_map_handler(GtkWidget *w, gpointer p)
nsEventStatus status;
menu->QueryInterface(kIMenuListenerIID, (void**)&menuListener);
if(menuListener) {
menuListener->MenuConstruct(
mevent,
NULL, //parent window
NULL, //menuNode
NULL ); // webshell
nsnull, //parent window
nsnull, //menuNode
nsnull ); // webshell
NS_IF_RELEASE(menuListener);
}
}
@ -475,9 +476,9 @@ void menu_map_handler(GtkWidget *w, gpointer p)
//==============================================================
void menu_unmap_handler(GtkWidget *w, gpointer p)
{
nsIMenuListener *menuListener = NULL;
nsIMenuListener *menuListener = nsnull;
nsIMenu *menu = (nsIMenu *)p;
if (menu != NULL) {
if (menu != nsnull) {
nsMenuEvent mevent;
mevent.message = NS_MENU_SELECTED;
mevent.eventStructType = NS_MENU_EVENT;

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

@ -25,9 +25,22 @@
#include "nsIFontMetrics.h"
#include <gdk/gdkx.h>
#define NSRECT_TO_GDKRECT(ns,gdk) \
PR_BEGIN_MACRO \
gdk.x = ns.x; \
gdk.y = ns.y; \
gdk.width = ns.width; \
gdk.height = ns.height; \
PR_END_MACRO
// BGR, not RGB
#define NSCOLOR_TO_GDKCOLOR(g,n) \
g.red=NS_GET_B(n); \
g.green=NS_GET_G(n); \
g.blue=NS_GET_R(n);
// Taken from nsRenderingContextGTK.cpp
#define NS_TO_GDK_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
nsILookAndFeel *nsWidget::sLookAndFeel = nsnull;
@ -535,10 +548,7 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
if ( aIsSynchronous) {
GdkRectangle nRect;
nRect.width = aRect.width;
nRect.height = aRect.height;
nRect.x = aRect.x;
nRect.y = aRect.y;
NSRECT_TO_GDKRECT(aRect, nRect);
::gtk_widget_draw(mWidget, &nRect);
} else {
mUpdateArea.UnionRect(mUpdateArea, aRect);
@ -563,10 +573,7 @@ NS_METHOD nsWidget::Update(void)
if (mUpdateArea.width && mUpdateArea.height) {
if (!mIsDestroying) {
GdkRectangle nRect;
nRect.width = mUpdateArea.width;
nRect.height = mUpdateArea.height;
nRect.x = mUpdateArea.x;
nRect.y = mUpdateArea.y;
NSRECT_TO_GDKRECT(mUpdateArea,nRect);
#ifdef DEBUG_pavlov
g_print("nsWidget::Update(this=%p): update {%i,%i,%i,%i}\n",
this, mUpdateArea.x, mUpdateArea.y,