зеркало из https://github.com/mozilla/pjs.git
Motif Ressurection. Thanks to Daniel Roberts <zuperdee@yahoo.com> for
doing the painful job of identifying everything that is missing and stubbing it out.
This commit is contained in:
Родитель
c12d89666a
Коммит
3e8c2fcd3e
|
@ -604,3 +604,89 @@ NS_IMETHODIMP nsDeviceContextMotif::EndPage(void)
|
|||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextMotif::GetSystemAttribute(nsSystemAttrID anID,
|
||||
SystemAttrStruct * aInfo) const
|
||||
{
|
||||
nsresult status = NS_OK;
|
||||
|
||||
switch (anID) {
|
||||
//---------
|
||||
// Colors
|
||||
//---------
|
||||
case eSystemAttr_Color_WindowBackground:
|
||||
*aInfo->mColor = NS_RGB(255,255,255);
|
||||
break;
|
||||
case eSystemAttr_Color_WindowForeground:
|
||||
*aInfo->mColor = NS_RGB(0,0,0);
|
||||
break;
|
||||
case eSystemAttr_Color_WidgetBackground:
|
||||
*aInfo->mColor = NS_RGB(255,255,255);
|
||||
break;
|
||||
case eSystemAttr_Color_WidgetForeground:
|
||||
*aInfo->mColor = NS_RGB(0,0,0);
|
||||
break;
|
||||
case eSystemAttr_Color_WidgetSelectBackground:
|
||||
*aInfo->mColor = NS_RGB(255,255,255);
|
||||
break;
|
||||
case eSystemAttr_Color_WidgetSelectForeground:
|
||||
*aInfo->mColor = NS_RGB(0,0,0);
|
||||
break;
|
||||
case eSystemAttr_Color_Widget3DHighlight:
|
||||
*aInfo->mColor = NS_RGB(0xa0,0xa0,0xa0);
|
||||
break;
|
||||
case eSystemAttr_Color_Widget3DShadow:
|
||||
*aInfo->mColor = NS_RGB(0x40,0x40,0x40);
|
||||
break;
|
||||
case eSystemAttr_Color_TextBackground:
|
||||
*aInfo->mColor = NS_RGB(255,255,255);
|
||||
break;
|
||||
case eSystemAttr_Color_TextForeground:
|
||||
*aInfo->mColor = NS_RGB(0,0,0);
|
||||
break;
|
||||
case eSystemAttr_Color_TextSelectBackground:
|
||||
*aInfo->mColor = NS_RGB(255,255,255);
|
||||
break;
|
||||
case eSystemAttr_Color_TextSelectForeground:
|
||||
*aInfo->mColor = NS_RGB(0,0,0);
|
||||
break;
|
||||
//---------
|
||||
// Size
|
||||
//---------
|
||||
case eSystemAttr_Size_ScrollbarHeight:
|
||||
aInfo->mSize = 20;
|
||||
break;
|
||||
case eSystemAttr_Size_ScrollbarWidth:
|
||||
aInfo->mSize = 20;
|
||||
break;
|
||||
case eSystemAttr_Size_WindowTitleHeight:
|
||||
aInfo->mSize = 0;
|
||||
break;
|
||||
case eSystemAttr_Size_WindowBorderWidth:
|
||||
// aInfo->mSize = style->klass->xthickness;
|
||||
aInfo->mSize = 1;
|
||||
break;
|
||||
case eSystemAttr_Size_WindowBorderHeight:
|
||||
// aInfo->mSize = style->klass->ythickness;
|
||||
aInfo->mSize = 1;
|
||||
break;
|
||||
case eSystemAttr_Size_Widget3DBorder:
|
||||
aInfo->mSize = 4;
|
||||
break;
|
||||
//---------
|
||||
// Fonts
|
||||
//---------
|
||||
case eSystemAttr_Font_Caption:
|
||||
case eSystemAttr_Font_Icon:
|
||||
case eSystemAttr_Font_Menu:
|
||||
case eSystemAttr_Font_MessageBox:
|
||||
case eSystemAttr_Font_SmallCaption:
|
||||
case eSystemAttr_Font_StatusBar:
|
||||
case eSystemAttr_Font_Tooltips:
|
||||
case eSystemAttr_Font_Widget:
|
||||
status = NS_ERROR_FAILURE;
|
||||
break;
|
||||
} // switch
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ TOOLKIT_CPPSRCS_gtk := \
|
|||
|
||||
TOOLKIT_CPPSRCS_motif := \
|
||||
nsMotifMenu.cpp \
|
||||
nsUnixMain.cpp
|
||||
nsMotifMain.cpp
|
||||
|
||||
TOOLKIT_CPPSRCS_photon := \
|
||||
nsPhMain.cpp \
|
||||
nsPhMenu.cpp
|
||||
|
||||
|
||||
TOOLKIT_CPPSRCS_xlib := \
|
||||
nsXlibMain.cpp
|
||||
|
||||
|
|
|
@ -15,26 +15,13 @@
|
|||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsViewerApp.h"
|
||||
#include "nsBrowserWindow.h"
|
||||
#include "nsMotifMenu.h"
|
||||
#include "nsIImageManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "plevent.h"
|
||||
|
||||
XtAppContext gAppContext; // XXX This should be changed
|
||||
static nsNativeViewerApp* gTheApp;
|
||||
PLEventQueue* gUnixMainEventQueue = nsnull;
|
||||
|
||||
extern void nsWebShell_SetUnixEventQueue(PLEventQueue* aEventQueue);
|
||||
|
||||
static void nsUnixEventProcessorCallback(XtPointer aClosure, int* aFd, XtIntervalId *aId)
|
||||
{
|
||||
NS_ASSERTION(*aFd==PR_GetEventQueueSelectFD(gUnixMainEventQueue), "Error in nsUnixMain.cpp:nsUnixEventProcessCallback");
|
||||
PR_ProcessPendingEvents(gUnixMainEventQueue);
|
||||
}
|
||||
|
||||
nsNativeViewerApp::nsNativeViewerApp()
|
||||
{
|
||||
|
@ -47,34 +34,6 @@ nsNativeViewerApp::~nsNativeViewerApp()
|
|||
int
|
||||
nsNativeViewerApp::Run()
|
||||
{
|
||||
// Setup event queue for dispatching
|
||||
// asynchronous posts of form data + clicking on links.
|
||||
// Lifted from cmd/xfe/mozilla.c
|
||||
nsresult rv = nsnull;
|
||||
#ifdef OLD_EVENT_QUEUE
|
||||
gUnixMainEventQueue = PR_CreateEventQueue("viewer-event-queue", PR_GetCurrentThread());
|
||||
if (nsnull == gUnixMainEventQueue) {
|
||||
// Force an assertion
|
||||
NS_ASSERTION("Can not create an event loop", PR_FALSE);
|
||||
}
|
||||
|
||||
// XXX Setup webshell's event queue. This should be changed
|
||||
nsWebShell_SetUnixEventQueue(gUnixMainEventQueue);
|
||||
#else
|
||||
if (nsnull == mEventQService) {
|
||||
NS_ASSERTION("No event queue service available", PR_FALSE);
|
||||
return -1;
|
||||
}
|
||||
rv = mEventQService->GetThreadEventQueue(PR_GetCurrentThread(), &gUnixMainEventQueue);
|
||||
if (NS_OK != rv) {
|
||||
NS_ASSERTION("Could not obtain thread event queue", PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
#endif /* OLD_EVENT_QUEUE */
|
||||
XtAppAddInput(gAppContext, PR_GetEventQueueSelectFD(gUnixMainEventQueue),
|
||||
(XtPointer)(XtInputReadMask), nsUnixEventProcessorCallback, 0);
|
||||
|
||||
OpenWindow();
|
||||
mAppShell->Run();
|
||||
return 0;
|
||||
|
@ -90,18 +49,24 @@ nsNativeBrowserWindow::~nsNativeBrowserWindow()
|
|||
{
|
||||
}
|
||||
|
||||
static void MenuProc(PRUint32 aId)
|
||||
nsresult
|
||||
nsNativeBrowserWindow::InitNativeWindow()
|
||||
{
|
||||
// XXX our menus are horked: we can't support multiple windows!
|
||||
nsBrowserWindow* bw = (nsBrowserWindow*)
|
||||
nsBrowserWindow::gBrowsers.ElementAt(0);
|
||||
bw->DispatchMenuItem(aId);
|
||||
// override to do something special with platform native windows
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void MenuProc(PRUint32 aID)
|
||||
{
|
||||
// return nsBrowserWindow::DispatchMenuItem(aID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNativeBrowserWindow::CreateMenuBar(PRInt32 aWidth)
|
||||
{
|
||||
CreateViewerMenus(XtParent((Widget)mWindow->GetNativeData(NS_NATIVE_WIDGET)), MenuProc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -111,9 +76,11 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
|
|||
// Dispatch motif-only menu code goes here
|
||||
|
||||
// Dispatch xp menu items
|
||||
return nsBrowserWindow::DispatchMenuItem(aID);
|
||||
// return nsBrowserWindow::DispatchMenuItem(aID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
@ -128,5 +95,3 @@ int main(int argc, char **argv)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -41,38 +41,54 @@
|
|||
#include "nsMenu.h"
|
||||
#include "nsMenuItem.h"
|
||||
#include "nsPopUpMenu.h"
|
||||
// #include "nsTabWidget.h"
|
||||
// #include "nsFontRetrieverService.h"
|
||||
|
||||
// Drag & Drop, Clipboard
|
||||
// #include "nsClipboard.h"
|
||||
#include "nsTransferable.h"
|
||||
#include "nsXIFFormatConverter.h"
|
||||
|
||||
// #include "nsDragService.h"
|
||||
// #include "nsDragSource.h"
|
||||
// #include "nsDragTarget.h"
|
||||
// #include "nsDraggedObject.h"
|
||||
|
||||
static NS_DEFINE_IID(kCWindow, NS_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kCChild, NS_CHILD_CID);
|
||||
static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID);
|
||||
static NS_DEFINE_IID(kCHorzScrollbarCID, NS_HORZSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCVertScrollbarCID, NS_VERTSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCCheckButtonCID, NS_CHECKBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCRadioButtonCID, NS_RADIOBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCTextWidgetCID, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kCTextAreaWidgetCID, NS_TEXTAREA_CID);
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCButtonCID, NS_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCListBoxCID, NS_LISTBOX_CID);
|
||||
static NS_DEFINE_IID(kCComboBoxCID, NS_COMBOBOX_CID);
|
||||
static NS_DEFINE_IID(kCLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kCButton, NS_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCCheckButton, NS_CHECKBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCCombobox, NS_COMBOBOX_CID);
|
||||
static NS_DEFINE_IID(kCFileOpen, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCListbox, NS_LISTBOX_CID);
|
||||
static NS_DEFINE_IID(kCRadioButton, NS_RADIOBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCHorzScrollbar, NS_HORZSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCVertScrollbar, NS_VERTSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCTextArea, NS_TEXTAREA_CID);
|
||||
static NS_DEFINE_IID(kCTextField, NS_TEXTFIELD_CID);
|
||||
// static NS_DEFINE_IID(kCTabWidget, NS_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCTooltipWidget, NS_TOOLTIPWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCAppShell, NS_APPSHELL_CID);
|
||||
static NS_DEFINE_IID(kCToolkit, NS_TOOLKIT_CID);
|
||||
static NS_DEFINE_IID(kCLookAndFeel, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kCDialog, NS_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCLabel, NS_LABEL_CID);
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIWidget, NS_IWIDGET_IID);
|
||||
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
static NS_DEFINE_IID(kIButton, NS_IBUTTON_IID);
|
||||
static NS_DEFINE_IID(kICheckButton, NS_ICHECKBUTTON_IID);
|
||||
static NS_DEFINE_IID(kIScrollbar, NS_ISCROLLBAR_IID);
|
||||
static NS_DEFINE_IID(kIFileWidget, NS_IFILEWIDGET_IID);
|
||||
static NS_DEFINE_IID(kIListBox, NS_ILISTBOX_IID);
|
||||
|
||||
static NS_DEFINE_IID(kCMenuBar, NS_MENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCMenu, NS_MENU_CID);
|
||||
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
|
||||
static NS_DEFINE_IID(kCPopUpMenu, NS_POPUPMENU_CID);
|
||||
static NS_DEFINE_IID(kCFontRetrieverService, NS_FONTRETRIEVERSERVICE_CID);
|
||||
|
||||
// Drag & Drop, Clipboard
|
||||
static NS_DEFINE_IID(kCDataObj, NS_DATAOBJ_CID);
|
||||
static NS_DEFINE_IID(kCClipboard, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_IID(kCTransferable, NS_TRANSFERABLE_CID);
|
||||
static NS_DEFINE_IID(kCDataFlavor, NS_DATAFLAVOR_CID);
|
||||
static NS_DEFINE_IID(kCXIFFormatConverter, NS_XIFFORMATCONVERTER_CID);
|
||||
// static NS_DEFINE_IID(kCDragService, NS_DRAGSERVICE_CID);
|
||||
// static NS_DEFINE_IID(kCDragSource, NS_DRAGSOURCE_CID);
|
||||
// static NS_DEFINE_IID(kCDragTarget, NS_DRAGTARGET_CID);
|
||||
// static NS_DEFINE_IID(kCDraggedObject, NS_DRAGGEDOBJECT_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
@ -92,7 +108,7 @@ public:
|
|||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
nsWidgetFactory(const nsCID &aClass);
|
||||
~nsWidgetFactory();
|
||||
virtual ~nsWidgetFactory();
|
||||
private:
|
||||
nsCID mClassID;
|
||||
|
||||
|
@ -102,33 +118,36 @@ private:
|
|||
|
||||
nsWidgetFactory::nsWidgetFactory(const nsCID &aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
nsWidgetFactory::~nsWidgetFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "Reference count not zero in destructor");
|
||||
}
|
||||
|
||||
nsresult nsWidgetFactory::QueryInterface(const nsIID &aIID,
|
||||
void **aInstancePtr)
|
||||
void **aResult)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
if (NULL == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(kIFactoryIID)) {
|
||||
*aInstancePtr = (void*)(nsWidgetFactory*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
*aResult = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsWidgetFactory*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
*aResult = (void *)(nsISupports *)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = (void *)(nsIFactory *)this;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
if (*aResult == NULL) {
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsWidgetFactory)
|
||||
|
@ -142,56 +161,69 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
if (nsnull != aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
if (aIID.Equals(kCWindow)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsWindow();
|
||||
}
|
||||
else if ( mClassID.Equals(kCCheckButtonCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsCheckButton();
|
||||
}
|
||||
else if ( mClassID.Equals(kCButtonCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCVertScrollbarCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsScrollbar(PR_TRUE);
|
||||
}
|
||||
else if (mClassID.Equals(kCHorzScrollbarCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsScrollbar(PR_FALSE);
|
||||
}
|
||||
else if (mClassID.Equals(kCTextWidgetCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsTextWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCTextAreaWidgetCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsTextAreaWidget();
|
||||
}
|
||||
else if ( mClassID.Equals(kCRadioButtonCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsRadioButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCListBoxCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsListBox();
|
||||
}
|
||||
else if (mClassID.Equals(kCComboBoxCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsComboBox();
|
||||
}
|
||||
else if (mClassID.Equals(kCFileWidgetCID)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsFileWidget();
|
||||
}
|
||||
else if (aIID.Equals(kIWidget)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsWindow();
|
||||
if (mClassID.Equals(kCWindow)) {
|
||||
inst = (nsISupports *)new nsWindow();
|
||||
}
|
||||
else if (mClassID.Equals(kCChild)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new ChildWindow();
|
||||
inst = (nsISupports *)new ChildWindow();
|
||||
}
|
||||
else if (mClassID.Equals(kCButton)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCCheckButton)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsCheckButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCCombobox)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsComboBox();
|
||||
}
|
||||
else if (mClassID.Equals(kCRadioButton)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsRadioButton();
|
||||
}
|
||||
else if (mClassID.Equals(kCFileOpen)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsFileWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCListbox)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsListBox();
|
||||
}
|
||||
else if (mClassID.Equals(kCHorzScrollbar)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsScrollbar(PR_FALSE);
|
||||
}
|
||||
else if (mClassID.Equals(kCVertScrollbar)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsScrollbar(PR_TRUE);
|
||||
}
|
||||
else if (mClassID.Equals(kCTextArea)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsTextAreaWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCTextField)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsTextWidget();
|
||||
}
|
||||
// else if (mClassID.Equals(kCTabWidget)) {
|
||||
// inst = (nsISupports*)(nsIWidget *)new nsTabWidget();
|
||||
// }
|
||||
else if (mClassID.Equals(kCTooltipWidget)) {
|
||||
// no tooltips??
|
||||
// inst = (nsISupports*)(nsIWidget *)new nsTooltipWidget();
|
||||
}
|
||||
else if (mClassID.Equals(kCAppShell)) {
|
||||
inst = (nsISupports*)new nsAppShell();
|
||||
}
|
||||
else if (mClassID.Equals(kCToolkit)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsToolkit();
|
||||
}
|
||||
else if (mClassID.Equals(kCLookAndFeel)) {
|
||||
inst = (nsISupports*)(nsIWidget *)new nsLookAndFeel();
|
||||
}
|
||||
else if (mClassID.Equals(kCDialog)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsDialog();
|
||||
inst = (nsISupports*)(nsIWidget *)new nsDialog();
|
||||
}
|
||||
else if (mClassID.Equals(kCLabel)) {
|
||||
inst = (nsISupports *)(nsIWidget *)new nsLabel();
|
||||
inst = (nsISupports*)(nsIWidget *)new nsLabel();
|
||||
}
|
||||
else if (mClassID.Equals(kCMenuBar)) {
|
||||
inst = (nsISupports*)(nsIMenuBar *)new nsMenuBar();
|
||||
|
@ -205,40 +237,40 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
|
|||
else if (mClassID.Equals(kCPopUpMenu)) {
|
||||
inst = (nsISupports*)new nsPopUpMenu();
|
||||
}
|
||||
else if (mClassID.Equals(kCLookAndFeelCID)) {
|
||||
nsLookAndFeel *laf = new nsLookAndFeel();
|
||||
if (laf == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = laf->QueryInterface(aIID, aResult);
|
||||
if (res != NS_OK) {
|
||||
delete laf;
|
||||
}
|
||||
return res;
|
||||
else if (mClassID.Equals(kCTransferable)) {
|
||||
inst = (nsISupports*)new nsTransferable();
|
||||
}
|
||||
else if (mClassID.Equals(kCAppShellCID)) {
|
||||
nsAppShell *appInst = new nsAppShell();
|
||||
if (appInst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = appInst->QueryInterface(aIID, aResult);
|
||||
if (res != NS_OK) {
|
||||
delete appInst;
|
||||
}
|
||||
return res;
|
||||
// else if (mClassID.Equals(kCClipboard)) {
|
||||
// inst = (nsISupports*)new nsClipboard();
|
||||
// }
|
||||
else if (mClassID.Equals(kCXIFFormatConverter)) {
|
||||
inst = (nsISupports*)new nsXIFFormatConverter();
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
// else if (mClassID.Equals(kCFontRetrieverService)) {
|
||||
// inst = (nsISupports*)(nsIFontRetrieverService *) new nsFontRetrieverService();
|
||||
// }
|
||||
#if 0
|
||||
else if (mClassID.Equals(kCDragService)) {
|
||||
inst = (nsISupports*)new nsDragService();
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
printf("nsWidgetFactory::CreateInstance(), unhandled class.\n");
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
delete inst;
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
||||
|
|
|
@ -18,10 +18,29 @@
|
|||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsICmdLineService.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef LINUX
|
||||
#define DO_THE_EDITRES_THING
|
||||
#endif
|
||||
|
||||
#ifdef DO_THE_EDITRES_THING
|
||||
#include <X11/Xmu/Editres.h>
|
||||
#endif
|
||||
|
||||
extern XtAppContext gAppContext;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// XPCOM CIDs
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
|
||||
|
||||
//XtAppContext nsAppShell::gAppContext = NULL;
|
||||
|
||||
|
||||
|
@ -37,7 +56,6 @@ NS_IMPL_ISUPPORTS(nsAppShell,kIAppShellIID);
|
|||
NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
|
||||
{
|
||||
mDispatchListener = aDispatchListener;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -47,13 +65,45 @@ NS_METHOD nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener)
|
|||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsAppShell::Create(int* argc, char ** argv)
|
||||
NS_METHOD nsAppShell::Create(int* bac, char ** bav)
|
||||
{
|
||||
char *home=nsnull;
|
||||
char *path=nsnull;
|
||||
|
||||
int argc = bac ? *bac : 0;
|
||||
char **argv = bav;
|
||||
|
||||
#if 1
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsICmdLineService, cmdLineArgs, kCmdLineServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = cmdLineArgs->GetArgc(&argc);
|
||||
if(NS_FAILED(rv))
|
||||
argc = bac ? *bac : 0;
|
||||
|
||||
rv = cmdLineArgs->GetArgv(&argv);
|
||||
if(NS_FAILED(rv))
|
||||
argv = bav;
|
||||
}
|
||||
#endif
|
||||
|
||||
XtSetLanguageProc(NULL, NULL, NULL);
|
||||
mTopLevel = XtVaAppInitialize(&mAppContext, "nsAppShell", NULL,
|
||||
0, argc, argv, NULL, NULL);
|
||||
|
||||
mTopLevel = XtAppInitialize(&mAppContext, // app_context_return
|
||||
"nsAppShell", // application_class
|
||||
NULL, // options
|
||||
0, // num_options
|
||||
&argc,
|
||||
argv,
|
||||
NULL, // fallback_resources
|
||||
NULL, // args
|
||||
0); // num_args
|
||||
|
||||
// XXX This is BAD -- needs to be fixed
|
||||
gAppContext = mAppContext;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -63,18 +113,147 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv)
|
|||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// static void event_processor_callback(gpointer data,
|
||||
// gint source,
|
||||
// GdkInputCondition condition)
|
||||
// {
|
||||
// nsIEventQueue *eventQueue = (nsIEventQueue*)data;
|
||||
// eventQueue->ProcessPendingEvents();
|
||||
// }
|
||||
|
||||
static void nsUnixEventProcessorCallback(XtPointer aClosure,
|
||||
int * aFd,
|
||||
XtIntervalId * aId)
|
||||
{
|
||||
// NS_ASSERTION(*aFd==PR_GetEventQueueSelectFD(gUnixMainEventQueue), "Error in nsUnixMain.cpp:nsUnixEventProcessCallback");
|
||||
// PR_ProcessPendingEvents(gUnixMainEventQueue);
|
||||
|
||||
nsIEventQueue *eventQueue = (nsIEventQueue*) aClosure;
|
||||
eventQueue->ProcessPendingEvents();
|
||||
}
|
||||
|
||||
// NS_METHOD nsAppShell::Run()
|
||||
// {
|
||||
// XtRealizeWidget(mTopLevel);
|
||||
|
||||
// XEvent event;
|
||||
// for (;;) {
|
||||
// XtAppNextEvent(mAppContext, &event);
|
||||
// XtDispatchEvent(&event);
|
||||
// if (mDispatchListener)
|
||||
// mDispatchListener->AfterDispatch();
|
||||
// }
|
||||
|
||||
// return NS_OK;
|
||||
// }
|
||||
|
||||
|
||||
NS_METHOD nsAppShell::Run()
|
||||
{
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsIEventQueue * EQueue = nsnull;
|
||||
|
||||
// Get the event queue service
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ASSERTION("Could not obtain event queue service", PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Got the event queue from the service\n");
|
||||
#endif /* DEBUG */
|
||||
|
||||
//Get the event queue for the thread.
|
||||
rv = eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
|
||||
|
||||
// If a queue already present use it.
|
||||
if (EQueue)
|
||||
goto done;
|
||||
|
||||
// Create the event queue for the thread
|
||||
rv = eventQService->CreateThreadEventQueue();
|
||||
if (NS_OK != rv) {
|
||||
NS_ASSERTION("Could not create the thread event queue", PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
//Get the event queue for the thread
|
||||
rv = eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &EQueue);
|
||||
if (NS_OK != rv) {
|
||||
NS_ASSERTION("Could not obtain the thread event queue", PR_FALSE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
done:
|
||||
printf("Calling gdk_input_add with event queue\n");
|
||||
|
||||
XtAppAddInput(gAppContext,
|
||||
EQueue->GetEventQueueSelectFD(),
|
||||
(XtPointer)(XtInputReadMask),
|
||||
nsUnixEventProcessorCallback,
|
||||
0);
|
||||
|
||||
// gdk_input_add(EQueue->GetEventQueueSelectFD(),
|
||||
// GDK_INPUT_READ,
|
||||
// event_processor_callback,
|
||||
// EQueue);
|
||||
// gtk_main();
|
||||
|
||||
XtRealizeWidget(mTopLevel);
|
||||
|
||||
#ifdef DO_THE_EDITRES_THING
|
||||
XtAddEventHandler(mTopLevel,
|
||||
(EventMask) 0,
|
||||
True,
|
||||
(XtEventHandler) _XEditResCheckMessages,
|
||||
(XtPointer)NULL);
|
||||
#endif
|
||||
|
||||
XEvent event;
|
||||
for (;;) {
|
||||
|
||||
for (;;)
|
||||
{
|
||||
XtAppNextEvent(mAppContext, &event);
|
||||
|
||||
XtDispatchEvent(&event);
|
||||
|
||||
if (mDispatchListener)
|
||||
mDispatchListener->AfterDispatch();
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(EQueue);
|
||||
Release();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//This one put here by ZuperDee.
|
||||
|
||||
NS_METHOD nsAppShell::Spinup()
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::Spindown()
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void * aEvent)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -123,4 +302,9 @@ void* nsAppShell::GetNativeData(PRUint32 aDataType)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD nsAppShell::EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget,
|
||||
PRBool *aForWindow)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -42,14 +42,19 @@ class nsAppShell : public nsIAppShell
|
|||
|
||||
// nsIAppShellInterface
|
||||
NS_IMETHOD Create(int* argc, char ** argv);
|
||||
NS_IMETHOD Run();
|
||||
NS_IMETHOD Run();
|
||||
NS_IMETHOD Spinup();
|
||||
NS_IMETHOD Spindown();
|
||||
NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent);
|
||||
NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent);
|
||||
NS_IMETHOD Exit();
|
||||
NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener);
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget,
|
||||
PRBool *aForWindow);
|
||||
|
||||
// Public global
|
||||
//static XtAppContext gAppContext;
|
||||
};
|
||||
|
||||
#endif // nsAppShell_h__
|
||||
|
||||
|
|
|
@ -182,6 +182,24 @@ PRBool nsFileWidget::Show()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
nsFileDlgResults nsFileWidget::GetFile(class nsIWidget *, const class nsString &, class nsFileSpec &)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
nsFileDlgResults nsFileWidget::GetFolder(class nsIWidget *, const class nsString &, class nsFileSpec &)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
nsFileDlgResults nsFileWidget::PutFile(class nsIWidget *, const class nsString &, class nsFileSpec &)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Convert filter titles + filters into a Windows filter string
|
||||
|
@ -217,6 +235,12 @@ NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,const nsString a
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
NS_METHOD nsFileWidget::GetSelectedType(PRInt16& theType)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get the file + path
|
||||
|
@ -235,13 +259,23 @@ NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
|||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
{
|
||||
mDefault = aString;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -67,14 +67,20 @@ class nsFileWidget : public nsWindow, public nsIFileWidget
|
|||
void *aInitData = nsnull);
|
||||
|
||||
// nsIFileWidget part
|
||||
virtual PRBool Show();
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
NS_IMETHOD SetDefaultString(const nsString& aString);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,
|
||||
virtual PRBool Show();
|
||||
virtual nsFileDlgResults GetFile(class nsIWidget *, const class nsString &, class nsFileSpec &);
|
||||
virtual nsFileDlgResults GetFolder(class nsIWidget *, const class nsString &, class nsFileSpec &);
|
||||
virtual nsFileDlgResults PutFile(class nsIWidget *, const class nsString &, class nsFileSpec &);
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
NS_IMETHOD SetDefaultString(const nsString& aString);
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory);
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,
|
||||
const nsString aTitles[],
|
||||
const nsString aFilters[]);
|
||||
NS_IMETHOD OnOk();
|
||||
NS_IMETHOD OnCancel();
|
||||
NS_IMETHOD GetSelectedType(PRInt16& theType);
|
||||
NS_IMETHOD OnOk();
|
||||
NS_IMETHOD OnCancel();
|
||||
|
||||
protected:
|
||||
PRBool mIOwnEventLoop;
|
||||
|
|
|
@ -72,7 +72,7 @@ NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
|
|||
break;
|
||||
case eColor_TextSelectBackground:
|
||||
res = NS_RGB(0x00,0x00,0x80);
|
||||
aColor;
|
||||
break;
|
||||
case eColor_TextSelectForeground:
|
||||
aColor = NS_RGB(0xff,0xff,0xff);
|
||||
break;
|
||||
|
@ -117,4 +117,8 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
|
||||
{
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "nsMenu.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIMenuBar.h"
|
||||
#include "nsIMenuItem.h"
|
||||
#include "nsIMenuListener.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsStringUtil.h"
|
||||
|
@ -142,23 +144,15 @@ Widget nsMenu::GetNativeParent()
|
|||
// Create the proper widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::Create(nsIMenuBar *aParent, const nsString &aLabel)
|
||||
//NS_METHOD nsMenu::Create(nsIMenuBar * aParent, const nsString &aLabel)
|
||||
NS_METHOD nsMenu::Create(nsISupports * aParent, const nsString &aLabel)
|
||||
{
|
||||
mMenuBarParent = aParent;
|
||||
NS_ADDREF(mMenuBarParent);
|
||||
Create(GetNativeParent(), aLabel);
|
||||
NS_ASSERTION(0, "nsIMenu has changed. fix me!");
|
||||
//aParent->AddMenu(this);
|
||||
return NS_OK;
|
||||
}
|
||||
// FIXME: This needs to be fixed. This doesn't work at all. --ZuperDee
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::Create(nsIMenu *aParent, const nsString &aLabel)
|
||||
{
|
||||
mMenuParent = aParent;
|
||||
NS_ADDREF(mMenuParent);
|
||||
Create(GetNativeParent(), aLabel);
|
||||
NS_ASSERTION(0, "nsIMenu has changed. fix me!");
|
||||
// mMenuBarParent = aParent;
|
||||
// NS_ADDREF(mMenuBarParent);
|
||||
// Create(GetNativeParent(), aLabel);
|
||||
// NS_ASSERTION(0, "nsIMenu has changed. fix me!");
|
||||
//aParent->AddMenu(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -184,7 +178,7 @@ NS_METHOD nsMenu::GetLabel(nsString &aText)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::SetLabel(nsString &aText)
|
||||
NS_METHOD nsMenu::SetLabel(const nsString &aText)
|
||||
{
|
||||
mLabel = aText;
|
||||
|
||||
|
@ -192,7 +186,7 @@ NS_METHOD nsMenu::SetLabel(nsString &aText)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::AddItem(const nsString &aText)
|
||||
NS_METHOD nsMenu::AddItem(nsISupports* aItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -231,19 +225,13 @@ NS_METHOD nsMenu::GetItemCount(PRUint32 &aCount)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem)
|
||||
NS_METHOD nsMenu::GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName)
|
||||
NS_METHOD nsMenu::InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -266,15 +254,66 @@ NS_METHOD nsMenu::RemoveAll()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::GetNativeData(void *& aData)
|
||||
NS_METHOD nsMenu::GetNativeData(void ** aData)
|
||||
{
|
||||
aData = (void *)mMenu;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenu::AddMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::RemoveMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::SetDOMNode(nsIDOMNode * aMenuNode)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::SetDOMElement(nsIDOMElement * aMenuElement)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenu::SetWebShell(nsIWebShell * aWebShell)
|
||||
{
|
||||
//FIXME: Need to implement. --ZuperDee
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
nsEventStatus nsMenu::MenuConstruct(const struct nsMenuEvent & aMenuEvent, nsIWidget * aParentWindow, void * menubarNode, void * aWebShell)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
// FIXME: Need to implement. --ZuperDee
|
||||
nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
|
|
@ -20,12 +20,11 @@
|
|||
#define nsMenu_h__
|
||||
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "Xm/Xm.h"
|
||||
#include "nsXtManageWidget.h"
|
||||
|
||||
#include "nsIMenuListener.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
|
||||
/**
|
||||
|
@ -40,29 +39,41 @@ public:
|
|||
virtual ~nsMenu();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
// nsIMenuListener methods
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menuNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
NS_IMETHOD Create(nsIMenuBar * aParent, const nsString &aLabel);
|
||||
NS_IMETHOD Create(nsIMenu * aParent, const nsString &aLabel);
|
||||
// NS_IMETHOD Create(nsIMenuBar * aParent, const nsString &aLabel);
|
||||
|
||||
// nsIMenu Methods
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel);
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent);
|
||||
NS_IMETHOD GetLabel(nsString &aText);
|
||||
NS_IMETHOD SetLabel(nsString &aText);
|
||||
NS_IMETHOD AddItem(const nsString &aText);
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD AddItem(nsISupports* aItem);
|
||||
NS_IMETHOD AddMenuItem(nsIMenuItem * aMenuItem);
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu);
|
||||
NS_IMETHOD AddSeparator();
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount);
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem);
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem);
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName);
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem);
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem);
|
||||
NS_IMETHOD InsertSeparator(const PRUint32 aCount);
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aCount);
|
||||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD GetNativeData(void** aData);
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode);
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement);
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell);
|
||||
|
||||
protected:
|
||||
void Create(Widget aParent, const nsString &aLabel);
|
||||
|
|
|
@ -68,6 +68,30 @@ nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent)
|
|||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuConstruct(
|
||||
const nsMenuEvent& aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menubarNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuBar::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsMenuBar constructor
|
||||
|
|
|
@ -41,10 +41,17 @@ public:
|
|||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
virtual nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
virtual nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
virtual nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent& aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menubarNode,
|
||||
void * aWebShell);
|
||||
virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD Create(nsIWidget * aParent);
|
||||
|
||||
// nsIMenuBar Methods
|
||||
|
|
|
@ -258,8 +258,118 @@ NS_METHOD nsMenuItem::GetNativeData(void *& aData)
|
|||
//-------------------------------------------------------------------------
|
||||
// nsIMenuListener interface
|
||||
//-------------------------------------------------------------------------
|
||||
nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
nsEventStatus nsMenuItem::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
// FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
// FIXME: This was here before, and not created by me... But still looks
|
||||
// like it needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
// FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menubarNode,
|
||||
void * aWebShell)
|
||||
{
|
||||
// FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus nsMenuItem::MenuDestruct(const nsMenuEvent & aMenuEvent)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
NS_METHOD nsMenuItem::Create(nsISupports * aParent,
|
||||
const nsString & aLabel,
|
||||
PRBool isSeparator)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetEnabled(PRBool aIsEnabled)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetEnabled(PRBool *aIsEnabled)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetChecked(PRBool aIsEnabled)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetChecked(PRBool *aIsEnabled)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::AddMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::RemoveMenuListener(nsIMenuListener * aMenuListener)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::IsSeparator(PRBool & aIsSep)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetCommand(const nsString & aStrCmd)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::DoCommand()
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetDOMElement(nsIDOMElement * aDOMElement)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::GetDOMElement(nsIDOMElement ** aDOMElement)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
NS_METHOD nsMenuItem::SetWebShell(nsIWebShell * aWebShell)
|
||||
{
|
||||
//FIXME: This needs to be implemented. --ZuperDee
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
|
|
@ -59,9 +59,33 @@ public:
|
|||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
|
||||
// nsIMenuListener interface
|
||||
nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
|
||||
nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent);
|
||||
nsEventStatus MenuConstruct(
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
nsIWidget * aParentWindow,
|
||||
void * menubarNode,
|
||||
void * aWebShell);
|
||||
nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent);
|
||||
|
||||
// nsIMenuItem interface (put here by ZuperDee)
|
||||
NS_IMETHOD Create(nsISupports * aParent,
|
||||
const nsString & aLabel,
|
||||
PRBool isSeparator);
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled);
|
||||
NS_IMETHOD GetEnabled(PRBool *aIsEnabled);
|
||||
NS_IMETHOD SetChecked(PRBool aIsEnabled);
|
||||
NS_IMETHOD GetChecked(PRBool *aIsEnabled);
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener);
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep);
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd);
|
||||
NS_IMETHOD DoCommand();
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement);
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement);
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell);
|
||||
|
||||
protected:
|
||||
void Create(nsIWidget * aMBParent, Widget aParent,
|
||||
const nsString &aLabel, PRUint32 aCommand);
|
||||
|
|
|
@ -1223,6 +1223,12 @@ NS_METHOD nsWindow::AddEventListener(nsIEventListener * aListener)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Needs to be implemented. --ZuperDee
|
||||
NS_METHOD nsWindow::AddMenuListener(nsIMenuListener * aListener)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus) {
|
||||
|
@ -1374,12 +1380,13 @@ PRBool nsWindow::OnPaint(nsPaintEvent &event)
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
// FIXME: Needs to be implemented?? Looks like a stub to me...
|
||||
NS_METHOD nsWindow::BeginResizingChildren(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Needs to be implemented?? Looks like a stub to me...
|
||||
NS_METHOD nsWindow::EndResizingChildren(void)
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -1590,12 +1597,12 @@ extern "C" void nsWindow_ResizeWidget(Widget w)
|
|||
NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD nsWindow::ShowMenuBar(PRBool aShow)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD nsWindow::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
{
|
||||
|
@ -1620,6 +1627,11 @@ NS_METHOD nsWindow::GetClientBounds(nsRect &aRect)
|
|||
return GetBounds(aRect);
|
||||
}
|
||||
|
||||
// FIXME: Needs to be implemented. --ZuperDee
|
||||
NS_METHOD nsWindow::SetVerticalScrollbar(nsIWidget * aScrollbar)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the border width and height
|
||||
|
@ -1654,3 +1666,9 @@ NS_METHOD nsWindow::Paint(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// FIXME: Needs to be implemented. --ZuperDee
|
||||
NS_METHOD nsWindow::EnableFileDrop(PRBool aEnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -126,16 +126,19 @@ public:
|
|||
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
|
||||
NS_IMETHOD AddMouseListener(nsIMouseListener * aListener);
|
||||
NS_IMETHOD AddEventListener(nsIEventListener * aListener);
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aListener);
|
||||
NS_IMETHOD BeginResizingChildren(void);
|
||||
NS_IMETHOD EndResizingChildren(void);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar);
|
||||
NS_IMETHOD GetClientBounds(nsRect &aRect);
|
||||
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect);
|
||||
NS_IMETHOD EnableFileDrop(PRBool aEnable);
|
||||
|
||||
|
||||
virtual PRBool IsChild() { return(PR_FALSE); };
|
||||
|
|
Загрузка…
Ссылка в новой задаче