else if (mClassID.Equals(kCTimer)) {  inst = (nsISupports*)(nsITimer*) new nsTimer();  }  else if (mClassID.Equals(kCTimerManager)) {  inst = (nsISupports*)(nsITimerQueue*) new nsTimerManager();  }
nsresult nsWidgetFactory::CreateInstance( nsISupports* aOuter,                                          const nsIID &aIID,                                            void **aResult)  {      if (aResult == NULL) {          return NS_ERROR_NULL_POINTER;      }      *aResult = NULL;      if (nsnull != aOuter) {        return NS_ERROR_NO_AGGREGATION;    }    nsISupports *inst = nsnull;    if (mClassID.Equals(kCWindow)) {        inst = (nsISupports*)(nsBaseWidget*)new nsWindow();    }    else if (mClassID.Equals(kCChild)) {        inst = (nsISupports*)(nsBaseWidget*)new ChildWindow();    }    else if (mClassID.Equals(kCButton)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsButton();    }    else if (mClassID.Equals(kCCheckButton)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsCheckButton();    }    else if (mClassID.Equals(kCCombobox)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsComboBox();    }    else if (mClassID.Equals(kCRadioButton)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsRadioButton();    }    else if (mClassID.Equals(kCFileOpen)) {        inst = (nsISupports*)new nsFileWidget();    }    else if (mClassID.Equals(kCListbox)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsListBox();    }    else if (mClassID.Equals(kCHorzScrollbar)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsScrollbar(PR_FALSE);    }    else if (mClassID.Equals(kCVertScrollbar)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsScrollbar(PR_TRUE);    }    else if (mClassID.Equals(kCTextArea)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsTextAreaWidget();    }    else if (mClassID.Equals(kCTextField)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsTextWidget();    }    else if (mClassID.Equals(kCAppShell)) {        inst = (nsISupports*)new nsAppShell();    }    else if (mClassID.Equals(kCToolkit)) {        inst = (nsISupports*)new nsToolkit();    }    else if (mClassID.Equals(kCLookAndFeel)) {        inst = (nsISupports*)new nsLookAndFeel();    }    else if (mClassID.Equals(kCLabel)) {        inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsLabel();    }    else if (mClassID.Equals(kCMenuBar)) {        inst = (nsISupports*)(nsIMenuBar*)new nsMenuBar();    }    else if (mClassID.Equals(kCMenu)) {        inst = (nsISupports*)(nsIMenu*)new nsMenu();    }    else if (mClassID.Equals(kCMenuItem)) {        inst = (nsISupports*)(nsIMenuItem*)new nsMenuItem();    }    else if (mClassID.Equals(kCContextMenu)) {        inst = (nsISupports*)(nsIContextMenu*)new nsContextMenu();    }    else if (mClassID.Equals(kCPopUpMenu)) {        inst = (nsISupports*)new nsPopUpMenu();    }    else if (mClassID.Equals(kCSound)) {    	nsISound* aSound = nsnull;    	NS_NewSound(&aSound);        inst = (nsISupports*) aSound;    }    else if (mClassID.Equals(kCFileSpecWithUI))    	inst = (nsISupports*) (nsIFileSpecWithUI *) new nsFileSpecWithUIImpl;    else if (mClassID.Equals(kCTransferable)) {        inst = (nsISupports*)new nsTransferable();    }    else if (mClassID.Equals(kCXIFFormatConverter)) {        inst = (nsISupports*)new nsXIFFormatConverter();    }    else if (mClassID.Equals(kCClipboard)) {        inst = (nsISupports*)(nsBaseClipboard *)new nsClipboard();    }    else if (mClassID.Equals(kCDragService)) {        inst = (nsISupports*)(nsIDragService *)new nsDragService();    }    else if (mClassID.Equals(kCFontRetrieverService)) {        inst = (nsISupports*)(nsIFontRetrieverService *)new nsFontRetrieverService();    }	/* */      if (inst == NULL) {          return NS_ERROR_OUT_OF_MEMORY;      }      NS_ADDREF(inst);  // Stabilize        nsresult res = inst->QueryInterface(aIID, aResult);    NS_RELEASE(inst); // Destabilize and avoid leaks. Avoid calling delete <interface pointer>      return res;  }  