Back to index

lightning-sunbird  0.9+nobinonly
nsWidgetDefs.h
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 the GNU General Public License Version 2 or later (the "GPL"), or
00025  * 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 
00037 #ifndef _nswidgetdefs_h
00038 #define _nswidgetdefs_h
00039 
00040 // OS/2 defines; for user messages & warp4 stuff, plus module-global data
00041 
00042 #include "nsIWidget.h"
00043 #include "nsVoidArray.h"
00044 
00045 #define INCL_PM
00046 #define INCL_NLS
00047 #define INCL_DOS
00048 #define INCL_WINSTDFILE
00049 #define INCL_DOSERRORS
00050 #include <os2.h>
00051 
00052 // TODO: The following two headers are required for their typedefs, although it
00053 //  would be best to only include <uconv.h>.  For EMX, we actually want to
00054 //  include 'uniapi.h', but that results in an error without the #define
00055 #include <uconv.h>
00056 #define UNICHAR_TYPE_DEFINED    // work around for EMX multiple typedef issue
00057 #include <unikbd.h> 
00058 
00059 #ifndef MAX_PATH
00060 #define MAX_PATH CCHMAXPATH
00061 #endif
00062 
00063 #ifndef OPENFILENAME
00064 /* OPENFILENAME struct flags
00065  */
00066 
00067 #define OFN_READONLY                 0x00000001
00068 #define OFN_OVERWRITEPROMPT          0x00000002
00069 #define OFN_HIDEREADONLY             0x00000004
00070 #define OFN_NOCHANGEDIR              0x00000008
00071 #define OFN_SHOWHELP                 0x00000010
00072 #define OFN_ENABLEHOOK               0x00000020
00073 #define OFN_ENABLETEMPLATE           0x00000040
00074 #define OFN_ENABLETEMPLATEHANDLE     0x00000080
00075 #define OFN_NOVALIDATE               0x00000100
00076 #define OFN_ALLOWMULTISELECT         0x00000200
00077 #define OFN_EXTENSIONDIFFERENT       0x00000400
00078 #define OFN_PATHMUSTEXIST            0x00000800
00079 #define OFN_FILEMUSTEXIST            0x00001000
00080 #define OFN_CREATEPROMPT             0x00002000
00081 #define OFN_SHAREAWARE               0x00004000
00082 #define OFN_NOREADONLYRETURN         0x00008000
00083 #define OFN_NOTESTFILECREATE         0x00010000
00084 #define OFN_NONETWORKBUTTON          0x00020000
00085 #define OFN_NOLONGNAMES              0x00040000
00086 
00087 typedef struct _tagOFN {
00088    ULONG                             lStructSize;
00089    HWND                              hwndOwner;
00090    HMODULE                           hInstance;
00091    PCSZ                              lpstrFilter;
00092    PSZ                               lpstrCustomFilter;
00093    ULONG                             nMaxCustFilter;
00094    ULONG                             nFilterIndex;
00095    PSZ                               lpstrFile;
00096    ULONG                             nMaxFile;
00097    PSZ                               lpstrFileTitle;
00098    ULONG                             nMaxFileTitle;
00099    PCSZ                              lpstrInitialDir;
00100    PCSZ                              lpstrTitle;
00101    ULONG                             Flags;
00102    USHORT                            nFileOffset;
00103    USHORT                            nFileExtension;
00104    PCSZ                              lpstrDefExt;
00105    ULONG                             lCustData;
00106    PFN                               lpfnHook;
00107    PCSZ                              lpTemplateName;
00108 } OPENFILENAME, *POPENFILENAME, *LPOPENFILENAME;
00109 
00110 extern "C" BOOL APIENTRY DaxOpenSave(BOOL, LONG *, LPOPENFILENAME, PFNWP);
00111 #endif
00112 
00113 #define SUPPORT_NON_XPFE /* support for viewer.exe */
00114 
00115 class nsDragService;
00116 class nsIAppShell;
00117 
00118 // messages - here to avoid duplication
00119 #define WMU_CALLMETHOD   (WM_USER + 1)
00120 #define WMU_SENDMSG      (WM_USER + 2)
00121 
00122 // MP1 is "LONG lIndex", MP2 is reserved
00123 #define WMU_SHOW_TOOLTIP (WM_USER + 3)
00124 
00125 // MP1 & MP2 both reserved
00126 #define WMU_HIDE_TOOLTIP (WM_USER + 4)
00127 
00128 // DRM_MOZILLA messages
00129 
00130 // WMU_GETFLAVOURLEN
00131 //
00132 // mp1 - ULONG ulItemID       Item ID from DRAGITEM
00133 // mp2 - HATOM hAtomFlavour   Atom in the system table for the data flavour
00134 //
00135 // returns - ULONG ulSize     Size in bytes of transfer data, 0 for error
00136 //
00137 #define WMU_GETFLAVOURLEN  (WM_USER + 5)
00138 
00139 typedef struct _WZDROPXFER
00140 {
00141    ATOM hAtomFlavour;
00142    CHAR data[1];
00143 } WZDROPXFER, *PWZDROPXFER;
00144 
00145 // WMU_GETFLAVOURDATA
00146 //
00147 // mp1 - ULONG       ulItemID     Item ID from DRAGITEM
00148 // mp2 - PWZDROPXFER pvData       Pointer to buffer to put data.
00149 //                                Must DosFreeMem().
00150 //
00151 // returns - BOOL bSuccess    TRUE ok, FALSE error occurred.
00152 
00153 #define WMU_GETFLAVOURDATA (WM_USER + 6)
00154 
00155 #define WinIsKeyDown(vk) ((WinGetKeyState(HWND_DESKTOP,vk) & 0x8000) ? PR_TRUE : PR_FALSE)
00156 
00157 // Tab control uses messages from TABM_BASE, which is currently (WM_USER+50).
00158 // See tabapi.h for details.
00159 
00160 // MP2 is the other window.
00161 #ifndef WM_MOUSEENTER
00162 #define WM_MOUSEENTER   0x041E
00163 #endif
00164 #ifndef WM_MOUSELEAVE
00165 #define WM_MOUSELEAVE   0x041F
00166 #endif
00167 
00168 #ifndef WM_FOCUSCHANGED
00169 #define WM_FOCUSCHANGED 0x000E
00170 #endif
00171 
00172 #ifndef FCF_CLOSEBUTTON // defined in the Merlin toolkit
00173 #define FCF_CLOSEBUTTON 0x04000000L
00174 #endif
00175 
00176 #ifndef FCF_DIALOGBOX
00177 #define FCF_DIALOGBOX   0x40000000L
00178 #endif
00179 
00180 #ifndef DRT_URL
00181 #define DRT_URL "UniformResourceLocator"
00182 #endif
00183 
00184 #define BASE_CONTROL_STYLE WS_TABSTOP
00185 
00186 #define NS_MIT_END ((const PRUint32) MIT_END)
00187 
00188 // A common pattern in widget is the 'Get/SetLabel' methods.  These macros
00189 // can be used to fill in implementations who derive from nsWindow and just
00190 // want to call WinSet/QueryWindowText.
00191 
00192 #define NS_DECL_LABEL                           \
00193    NS_IMETHOD SetLabel( const nsString &aText); \
00194    NS_IMETHOD GetLabel( nsString &aBuffer);
00195 
00196 #define NS_IMPL_LABEL(_clsname)                        \
00197    nsresult _clsname::SetLabel( const nsString &aText) \
00198    {                                                   \
00199       SetTitle( aText);                                \
00200       return NS_OK;                                    \
00201    }                                                   \
00202                                                        \
00203    nsresult _clsname::GetLabel( nsString &aBuffer)     \
00204    {                                                   \
00205       PRUint32 dummy;                                  \
00206       GetWindowText( aBuffer, &dummy);                 \
00207       return NS_OK;                                    \
00208    }
00209 
00210 // can be used as an lvalue too.
00211 #define lastchar(s) *((s) + strlen((s)) - 1)
00212 
00213 #endif