Back to index

lightning-sunbird  0.9+nobinonly
nsOS2Main.cpp
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Mozilla OS/2 libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * John Fairhurst, <john_fairhurst@iname.com>.
00018  * Portions created by the Initial Developer are Copyright (C) 1999
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either of the GNU General Public License Version 2 or later (the "GPL"),
00025  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK *****
00036  * This Original Code has been modified by IBM Corporation.
00037  * Modifications made by IBM described herein are
00038  * Copyright (c) International Business Machines
00039  * Corporation, 2000
00040  *
00041  * Modifications to Mozilla code or documentation
00042  * identified per MPL Section 3.3
00043  *
00044  * Date         Modified by     Description of modification
00045  * 04/05/2000  IBM Corp.       Fixed undefined identifier.
00046  *                              
00047  *
00048  */
00049 
00050 #define INCL_PM
00051 #define INCL_DOS
00052 #include <os2.h>
00053 
00054 #include "nsViewerApp.h"
00055 #include "nsBrowserWindow.h"
00056 #include "nsIAppShell.h"
00057 #include "resources.h"
00058 
00059    // OS2TODO
00060 #define IDM_VIEWERBAR  40990
00061 
00062 nsNativeBrowserWindow::nsNativeBrowserWindow() {}
00063 nsNativeBrowserWindow::~nsNativeBrowserWindow() {}
00064 
00065 nsresult
00066 nsNativeBrowserWindow::InitNativeWindow()
00067 {
00068        // override to do something special with platform native windows
00069   return NS_OK;
00070 }
00071 
00072 nsresult nsNativeBrowserWindow::CreateMenuBar(PRInt32 aWidth)
00073 {
00074    HWND hwnd = (HWND)mWindow->GetNativeData(NS_NATIVE_WIDGET);
00075    HWND hwndFrame = WinQueryWindow( hwnd, QW_PARENT);
00076    HWND hwndMenu = WinLoadMenu( hwndFrame, 0, IDM_VIEWERBAR);
00077    WinSendMsg( hwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_MENU), 0);
00078    return NS_OK; 
00079 }
00080 
00081 nsresult
00082 nsNativeBrowserWindow::GetMenuBarHeight(PRInt32 * aHeightOut)
00083 {
00084   NS_ASSERTION(nsnull != aHeightOut,"null out param.");
00085 
00086   *aHeightOut = 0;
00087 
00088   return NS_OK;
00089 }
00090 
00091 nsEventStatus nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
00092 {
00093    return nsBrowserWindow::DispatchMenuItem(aID);
00094 }
00095 
00096 nsNativeViewerApp::nsNativeViewerApp()
00097 {
00098 }
00099 
00100 nsNativeViewerApp::~nsNativeViewerApp()
00101 {
00102 }
00103 
00104 int nsNativeViewerApp::Run()
00105 {
00106   OpenWindow();
00107 
00108   mAppShell->Run();
00109 
00110   return 0;
00111 }
00112 
00113 int main(int argc, char **argv)
00114 {
00115    nsViewerApp* app = new nsNativeViewerApp;
00116    NS_ADDREF(app);
00117    app->Initialize(argc, argv);
00118    app->Run();
00119    NS_RELEASE(app);
00120 
00121    return 0;
00122 }