diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in index fec20e7aaec..c8f1ced9227 100644 --- a/widget/src/gtk2/Makefile.in +++ b/widget/src/gtk2/Makefile.in @@ -30,24 +30,29 @@ LIBRARY_NAME = widget_gtk2 EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsWidgetGtk2Module -REQUIRES = +REQUIRES = xpcom \ + string \ + gfx \ + dom CSRCS = CPPSRCS = \ nsWindow.cpp \ nsScrollbar.cpp \ + nsAppShell.cpp \ + nsWidgetFactory.cpp \ $(NULL) SHARED_LIBRARY_LIBS = $(DIST)/lib/libxpwidgets_s.a -EXTRA_DSO_LDOPTS += $(TK_LIBS) - -CFLAGS += $(TK_CFLAGS) -LDFLAGS += $(TK_CFLAGS) +EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) include $(topsrcdir)/config/rules.mk +CFLAGS += $(MOZ_GTK2_CFLAGS) +CXXFLAGS += $(MOZ_GTK2_CFLAGS) + INCLUDES += \ -I$(srcdir)/../xpwidgets \ $(NULL) diff --git a/widget/src/gtk2/nsAppShell.cpp b/widget/src/gtk2/nsAppShell.cpp new file mode 100644 index 00000000000..36ef9f6feef --- /dev/null +++ b/widget/src/gtk2/nsAppShell.cpp @@ -0,0 +1,98 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Christopher Blizzard. + * Portions created by Christopher Blizzard are Copyright (C) + * Christopher Blizzard. All Rights Reserved. + * + * Contributor(s): + * Christopher Blizzard + */ + +#include "nsAppShell.h" + +#include + +static PRBool sInitialized = PR_FALSE; + +nsAppShell::nsAppShell(void) +{ + NS_INIT_REFCNT(); +} + +nsAppShell::~nsAppShell(void) +{ +} + +NS_IMPL_ISUPPORTS1(nsAppShell, nsIAppShell) + +NS_IMETHODIMP +nsAppShell::Create(int *argc, char **argv) +{ + if (sInitialized) + return NS_OK; + + sInitialized = PR_TRUE; + + gtk_init(argc, &argv); + + return NS_OK; +} + +NS_IMETHODIMP +nsAppShell::Run(void) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::Spinup(void) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::Spindown(void) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::ListenToEventQueue(nsIEventQueue *aQueue, PRBool aListen) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::GetNativeEvent(PRBool &aRealEvent, void * &aEvent) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::SetDispatchListener(nsDispatchListener *aDispatchListener) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsAppShell::Exit(void) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} diff --git a/widget/src/gtk2/nsAppShell.h b/widget/src/gtk2/nsAppShell.h index c001e8e930b..402d1305ed3 100644 --- a/widget/src/gtk2/nsAppShell.h +++ b/widget/src/gtk2/nsAppShell.h @@ -18,3 +18,26 @@ * Contributor(s): * Christopher Blizzard */ + +#ifndef nsAppShell_h__ +#define nsAppShell_h__ + +#include "nsIAppShell.h" +#include "nsIEventQueue.h" +#include "nsCOMPtr.h" + +class nsAppShell : public nsIAppShell { + public: + + nsAppShell(); + virtual ~nsAppShell(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIAPPSHELL + + private: + + nsCOMPtr mEventQueue; +}; + +#endif /* nsAppShell_h__ */ diff --git a/widget/src/gtk2/nsWidgetFactory.cpp b/widget/src/gtk2/nsWidgetFactory.cpp new file mode 100644 index 00000000000..7cd4f654aa0 --- /dev/null +++ b/widget/src/gtk2/nsWidgetFactory.cpp @@ -0,0 +1,49 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Christopher Blizzard. + * Portions created by Christopher Blizzard are Copyright (C) + * Christopher Blizzard. All Rights Reserved. + * + * Contributor(s): + * Christopher Blizzard + */ + +#include "nsIGenericFactory.h" +#include "nsWidgetsCID.h" +#include "nsWindow.h" +#include "nsAppShell.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell) + +static nsModuleComponentInfo components[] = +{ + { "Gtk2 Window", + NS_WINDOW_CID, + "@mozilla.org/widget/window/gtk2;1", + nsWindowConstructor }, + { "Gtk2 AppShell", + NS_APPSHELL_CID, + "@mozilla.org/widget/appshell/gtk2;1", + nsAppShellConstructor }, +}; + +PR_STATIC_CALLBACK(void) +nsWidgetGtk2ModuleDtor(nsIModule *aSelf) +{ +} + +NS_IMPL_NSGETMODULE_WITH_DTOR(nsWidgetGtk2Module, + components, + nsWidgetGtk2ModuleDtor)