]> git.saurik.com Git - wxWidgets.git/commitdiff
now MSW stuff is complete
authorKarsten Ballüder <ballueder@usa.net>
Wed, 20 May 1998 14:21:00 +0000 (14:21 +0000)
committerKarsten Ballüder <ballueder@usa.net>
Wed, 20 May 1998 14:21:00 +0000 (14:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

118 files changed:
include/wx/msw/ctl3d/ctl3d.h [new file with mode: 0644]
include/wx/msw/ole/droptgt.h [new file with mode: 0644]
include/wx/msw/ole/oleutils.h [new file with mode: 0644]
include/wx/msw/ole/uuid.h [new file with mode: 0644]
samples/joytest/chart.ico [new file with mode: 0644]
samples/joytest/gun.wav [new file with mode: 0644]
samples/joytest/joytest.cpp [new file with mode: 0644]
samples/joytest/joytest.def [new file with mode: 0644]
samples/joytest/joytest.h [new file with mode: 0644]
samples/joytest/joytest.ico [new file with mode: 0644]
samples/joytest/joytest.rc [new file with mode: 0644]
samples/joytest/makefile.b32 [new file with mode: 0644]
samples/joytest/makefile.bcc [new file with mode: 0644]
samples/joytest/makefile.dos [new file with mode: 0644]
samples/joytest/makefile.g95 [new file with mode: 0644]
samples/joytest/makefile.nt [new file with mode: 0644]
samples/joytest/makefile.sc [new file with mode: 0644]
samples/joytest/makefile.unx [new file with mode: 0644]
samples/joytest/makefile.wat [new file with mode: 0644]
samples/joytest/mondrian.ico [new file with mode: 0644]
samples/mfc/makefile.b32 [new file with mode: 0644]
samples/mfc/makefile.bcc [new file with mode: 0644]
samples/mfc/makefile.dos [new file with mode: 0644]
samples/mfc/makefile.nt [new file with mode: 0644]
samples/mfc/makefile.wat [new file with mode: 0644]
samples/mfc/mfctest.cpp [new file with mode: 0644]
samples/mfc/mfctest.def [new file with mode: 0644]
samples/mfc/mfctest.h [new file with mode: 0644]
samples/mfc/mfctest.ico [new file with mode: 0644]
samples/mfc/mfctest.rc [new file with mode: 0644]
samples/mfc/resource.h [new file with mode: 0644]
samples/mfc/stdafx.h [new file with mode: 0644]
samples/nativdlg/aiai.ico [new file with mode: 0644]
samples/nativdlg/dialog1.rc [new file with mode: 0644]
samples/nativdlg/makefile.b32 [new file with mode: 0644]
samples/nativdlg/makefile.bcc [new file with mode: 0644]
samples/nativdlg/makefile.dos [new file with mode: 0644]
samples/nativdlg/makefile.g95 [new file with mode: 0644]
samples/nativdlg/makefile.nt [new file with mode: 0644]
samples/nativdlg/makefile.sc [new file with mode: 0644]
samples/nativdlg/makefile.unx [new file with mode: 0644]
samples/nativdlg/makefile.vms [new file with mode: 0644]
samples/nativdlg/makefile.wat [new file with mode: 0644]
samples/nativdlg/nativdlg.cpp [new file with mode: 0644]
samples/nativdlg/nativdlg.def [new file with mode: 0644]
samples/nativdlg/nativdlg.h [new file with mode: 0644]
samples/nativdlg/nativdlg.rc [new file with mode: 0644]
samples/nativdlg/resource.h [new file with mode: 0644]
samples/ownerdrw/bell.bmp [new file with mode: 0644]
samples/ownerdrw/makefile.b32 [new file with mode: 0644]
samples/ownerdrw/makefile.dos [new file with mode: 0644]
samples/ownerdrw/makefile.g95 [new file with mode: 0644]
samples/ownerdrw/makefile.nt [new file with mode: 0644]
samples/ownerdrw/mondrian.ico [new file with mode: 0644]
samples/ownerdrw/nosound.bmp [new file with mode: 0644]
samples/ownerdrw/ownerdrw.cpp [new file with mode: 0644]
samples/ownerdrw/ownerdrw.def [new file with mode: 0644]
samples/ownerdrw/ownerdrw.rc [new file with mode: 0644]
samples/ownerdrw/sound.bmp [new file with mode: 0644]
samples/regtest/key1.ico [new file with mode: 0644]
samples/regtest/key2.ico [new file with mode: 0644]
samples/regtest/key3.ico [new file with mode: 0644]
samples/regtest/makefile.g95 [new file with mode: 0644]
samples/regtest/makefile.nt [new file with mode: 0644]
samples/regtest/registry.ico [new file with mode: 0644]
samples/regtest/regtest.cpp [new file with mode: 0644]
samples/regtest/regtest.rc [new file with mode: 0644]
samples/regtest/value1.ico [new file with mode: 0644]
samples/regtest/value2.ico [new file with mode: 0644]
samples/taskbar/makefile.b32 [new file with mode: 0644]
samples/taskbar/makefile.bcc [new file with mode: 0644]
samples/taskbar/makefile.dos [new file with mode: 0644]
samples/taskbar/makefile.g95 [new file with mode: 0644]
samples/taskbar/makefile.nt [new file with mode: 0644]
samples/taskbar/mondrian.ico [new file with mode: 0644]
samples/taskbar/tbtest.cpp [new file with mode: 0644]
samples/taskbar/tbtest.def [new file with mode: 0644]
samples/taskbar/tbtest.h [new file with mode: 0644]
samples/taskbar/tbtest.rc [new file with mode: 0644]
src/msw/ctl3d/borland/makefile.b32 [new file with mode: 0644]
src/msw/ctl3d/borland/makefile.bcc [new file with mode: 0644]
src/msw/ctl3d/ctl3d.dll [new file with mode: 0644]
src/msw/ctl3d/ctl3d32.dll [new file with mode: 0644]
src/msw/ctl3d/ctl3dv2.dll [new file with mode: 0644]
src/msw/ctl3d/msvc/ctl3d.h [new file with mode: 0644]
src/msw/ctl3d/msvc/ctl3d.lib [new file with mode: 0644]
src/msw/ctl3d/msvc/ctl3dv2.lib [new file with mode: 0644]
src/msw/ctl3d/readme.txt [new file with mode: 0644]
src/msw/ctl3d/wat32/import32.zip [new file with mode: 0644]
src/msw/ctl3d/wat386/ctl3d.h [new file with mode: 0644]
src/msw/ctl3d/wat386/ctl3d32.c [new file with mode: 0644]
src/msw/ctl3d/wat386/ctl3d32.lnk [new file with mode: 0644]
src/msw/ctl3d/wat386/ctl3d32.obj [new file with mode: 0644]
src/msw/ctl3d/wat386/ctl3d32.txt [new file with mode: 0644]
src/msw/ctl3d/wat386/makefile.wat [new file with mode: 0644]
src/msw/ole/droptgt.cpp [new file with mode: 0644]
src/msw/ole/oleutils.cpp [new file with mode: 0644]
src/msw/ole/uuid.cpp [new file with mode: 0644]
utils/nplugin/docs/notes.txt [new file with mode: 0644]
utils/nplugin/lib/dummy [new file with mode: 0644]
utils/nplugin/samples/gui/gui.cpp [new file with mode: 0644]
utils/nplugin/samples/gui/gui.h [new file with mode: 0644]
utils/nplugin/samples/gui/makefile.nt [new file with mode: 0644]
utils/nplugin/samples/gui/npgui32.def [new file with mode: 0644]
utils/nplugin/samples/gui/npgui32.rc [new file with mode: 0644]
utils/nplugin/samples/simple/makefile.nt [new file with mode: 0644]
utils/nplugin/samples/simple/npsimple32.def [new file with mode: 0644]
utils/nplugin/samples/simple/npsimple32.rc [new file with mode: 0644]
utils/nplugin/samples/simple/simple.cpp [new file with mode: 0644]
utils/nplugin/src/makefile.nt [new file with mode: 0644]
utils/nplugin/src/npapi.h [new file with mode: 0644]
utils/nplugin/src/npapp.cpp [new file with mode: 0644]
utils/nplugin/src/npapp.h [new file with mode: 0644]
utils/nplugin/src/npframe.cpp [new file with mode: 0644]
utils/nplugin/src/npframe.h [new file with mode: 0644]
utils/nplugin/src/npshell.cpp [new file with mode: 0644]
utils/nplugin/src/npupp.h [new file with mode: 0644]
utils/nplugin/src/npwin.cpp [new file with mode: 0644]

diff --git a/include/wx/msw/ctl3d/ctl3d.h b/include/wx/msw/ctl3d/ctl3d.h
new file mode 100644 (file)
index 0000000..de7e67a
--- /dev/null
@@ -0,0 +1,61 @@
+/*-----------------------------------------------------------------------
+|      CTL3D.DLL
+|      
+|      Adds 3d effects to Windows controls
+|
+|      See ctl3d.doc for info
+|              
+-----------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+BOOL WINAPI Ctl3dSubclassDlg(HWND, WORD);
+BOOL WINAPI Ctl3dSubclassDlgEx(HWND, DWORD);
+WORD WINAPI Ctl3dGetVer(void);
+BOOL WINAPI Ctl3dEnabled(void);
+HBRUSH WINAPI Ctl3dCtlColor(HDC, LONG);        // ARCHAIC, use Ctl3dCtlColorEx
+HBRUSH WINAPI Ctl3dCtlColorEx(UINT wm, WPARAM wParam, LPARAM lParam);
+BOOL WINAPI Ctl3dColorChange(void);
+BOOL WINAPI Ctl3dSubclassCtl(HWND);
+LONG WINAPI Ctl3dDlgFramePaint(HWND, UINT, WPARAM, LPARAM);
+
+BOOL WINAPI Ctl3dAutoSubclass(HANDLE);
+
+BOOL WINAPI Ctl3dRegister(HANDLE);
+BOOL WINAPI Ctl3dUnregister(HANDLE);
+
+//begin DBCS: far east short cut key support
+VOID WINAPI Ctl3dWinIniChange(void);
+//end DBCS
+
+
+/* Ctl3dSubclassDlg3d flags */
+#define CTL3D_BUTTONS          0x0001
+#define CTL3D_LISTBOXES                0x0002          
+#define CTL3D_EDITS                    0x0004  
+#define CTL3D_COMBOS                   0x0008          
+#define CTL3D_STATICTEXTS      0x0010          
+#define CTL3D_STATICFRAMES     0x0020
+
+#define CTL3D_NODLGWINDOW       0x00010000
+#define CTL3D_ALL                              0xffff
+
+#define WM_DLGBORDER (WM_USER+3567)
+/* WM_DLGBORDER *(int FAR *)lParam return codes */
+#define CTL3D_NOBORDER         0
+#define CTL3D_BORDER                   1
+
+#define WM_DLGSUBCLASS (WM_USER+3568)
+/* WM_DLGSUBCLASS *(int FAR *)lParam return codes */
+#define CTL3D_NOSUBCLASS       0
+#define CTL3D_SUBCLASS         1
+
+/* Resource ID for 3dcheck.bmp (for .lib version of ctl3d) */
+#define CTL3D_3DCHECK 26567
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/wx/msw/ole/droptgt.h b/include/wx/msw/ole/droptgt.h
new file mode 100644 (file)
index 0000000..518a39c
--- /dev/null
@@ -0,0 +1,113 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        ole/droptgt.h
+// Purpose:     declaration of the wxDropTarget class
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     06.03.98
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// prolog
+// ============================================================================
+#ifndef   _OLEDROPTGT_H
+#define   _OLEDROPTGT_H
+
+#ifdef __GNUG__
+#pragma interface "droptgt.h"
+#endif
+
+#if !USE_DRAG_AND_DROP
+  #error  "You should #define USE_DRAG_AND_DROP to 1 to compile this file!"
+#endif  //WX_DRAG_DROP
+
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+class  wxIDropTarget;
+struct IDataObject;
+
+typedef unsigned short wxDataFormat;
+
+// ----------------------------------------------------------------------------
+// An instance of the class wxDropTarget may be associated with any wxWindow
+// derived object via SetDropTarget() function. If this is done, the virtual
+// methods of wxDropTarget are called when something is dropped on the window.
+// 
+// Note that wxDropTarget is an abstract base class (ABC) and you should derive
+// your own class from it implementing pure virtual function in order to use it
+// (all of them, including protected ones which are called by the class itself)
+// ----------------------------------------------------------------------------
+class WXDLLEXPORT wxDropTarget
+{
+public:
+  // ctor & dtor
+  wxDropTarget();
+  virtual ~wxDropTarget();
+
+  // normally called by wxWindow on window creation/destruction, but might be
+  // called `manually' as well. Register() returns true on success.
+  bool Register(WXHWND hwnd);
+  void Revoke(WXHWND hwnd);
+
+  // do we accept this kind of data?
+  virtual bool IsAcceptedData(IDataObject *pIDataSource) const;
+
+  // called when mouse enters/leaves the window: might be used to give
+  // some visual feedback to the user
+  virtual void OnEnter() { }
+  virtual void OnLeave() { }
+
+  // this function is called when data is dropped.
+  // (x, y) are the coordinates of the drop
+  virtual bool OnDrop(long x, long y, const void *pData) = 0;
+
+protected:
+  // Override these to indicate what kind of data you support: the first
+  // format to which data can be converted is used. The classes below show
+  // how it can be done in the simplest cases.
+    // how many different (clipboard) formats do you support?
+  virtual size_t GetFormatCount() const = 0;
+    // return the n-th supported format
+  virtual wxDataFormat GetFormat(size_t n) const = 0;
+
+private:
+  wxIDropTarget    *m_pIDropTarget; // the pointer to COM interface
+};
+
+// ----------------------------------------------------------------------------
+// A simple wxDropTarget derived class for text data: you only need to
+// override OnDropText() to get something working
+// ----------------------------------------------------------------------------
+class WXDLLEXPORT wxTextDropTarget : public wxDropTarget
+{
+public:
+  virtual bool OnDrop(long x, long y, const void *pData);
+  virtual bool OnDropText(long x, long y, const char *psz) = 0;
+
+protected:
+  virtual size_t GetFormatCount() const;
+  virtual wxDataFormat GetFormat(size_t n) const;
+};
+
+// ----------------------------------------------------------------------------
+// A drop target which accepts files (dragged from File Manager or Explorer)
+// ----------------------------------------------------------------------------
+class WXDLLEXPORT wxFileDropTarget : public wxDropTarget
+{
+public:
+  virtual bool OnDrop(long x, long y, const void *pData);
+
+  // params: the number of files and the array of file names
+  virtual bool OnDropFiles(long x, long y, 
+                           size_t nFiles, const char * const aszFiles[]) = 0;
+
+protected:
+  virtual size_t GetFormatCount() const;
+  virtual wxDataFormat GetFormat(size_t n) const;
+};
+
+// ============================================================================
+#endif  //_OLEDROPTGT_H
\ No newline at end of file
diff --git a/include/wx/msw/ole/oleutils.h b/include/wx/msw/ole/oleutils.h
new file mode 100644 (file)
index 0000000..1430abb
--- /dev/null
@@ -0,0 +1,145 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        oleutils.h
+// Purpose:     OLE helper routines, OLE debugging support &c
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     19.02.1998
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef   _OLEUTILS_H
+#define   _OLEUTILS_H
+
+#ifdef __GNUG__
+#pragma interface "oleutils.h"
+#endif
+
+// ============================================================================
+// General purpose functions and macros
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// misc helper functions/macros
+// ----------------------------------------------------------------------------
+
+// release the interface pointer (if !NULL)
+inline void ReleaseInterface(IUnknown *pIUnk)
+{
+  if ( pIUnk != NULL )
+    pIUnk->Release();
+}
+
+// release the interface pointer (if !NULL) and make it NULL
+#define   RELEASE_AND_NULL(p)   if ( (p) != NULL ) { p->Release(); p = NULL; };
+
+// return TRUE if the iid is in the array
+bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount);
+
+// ============================================================================
+// IUnknown implementation helpers
+// ============================================================================
+
+/*
+   The most dumb implementation of IUnknown methods. We don't support 
+   aggregation nor containment, but for 99% of cases this simple
+   implementation is quite enough.
+
+   Usage is trivial: here is all you should have
+   1) DECLARE_IUNKNOWN_METHOS in your (IUnknown derived!) class declaration
+   2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you
+      support (at least all for which you intent to return 'this' from QI,
+      i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else
+   3) IMPLEMENT_IUNKNOWN_METHOS somewhere also
+
+   These macros are quite simple: AddRef and Release are trivial and QI does
+   lookup in a static member array of IIDs and returns 'this' if it founds
+   the requested interface in it or E_NOINTERFACE if not.
+ */
+
+// declare the methods and the member variable containing reference count
+// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE
+// and friends (see below)
+#define   DECLARE_IUNKNOWN_METHODS                                            \
+  public:                                                                     \
+    STDMETHODIMP          QueryInterface(REFIID, void **);                    \
+    STDMETHODIMP_(ULONG)  AddRef();                                           \
+    STDMETHODIMP_(ULONG)  Release();                                          \
+  private:                                                                    \
+    static  const IID    *ms_aIids[];                                         \
+    ULONG                 m_cRef
+
+// macros for declaring supported interfaces
+// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)!
+#define BEGIN_IID_TABLE(cname)  const IID *cname::ms_aIids[] = {
+#define ADD_IID(iid)                                             &IID_I##iid,
+#define END_IID_TABLE                                          }
+
+// implementation is as straightforward as possible
+// Parameter:  classname - the name of the class
+#define   IMPLEMENT_IUNKNOWN_METHODS(classname)                               \
+  STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv)             \
+  {                                                                           \
+    wxLogQueryInterface(#classname, riid);                                    \
+                                                                              \
+    if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) {                  \
+      *ppv = this;                                                            \
+      AddRef();                                                               \
+                                                                              \
+      return S_OK;                                                            \
+    }                                                                         \
+    else {                                                                    \
+      *ppv = NULL;                                                            \
+                                                                              \
+      return (HRESULT) E_NOINTERFACE;                                                   \
+    }                                                                         \
+  }                                                                           \
+                                                                              \
+  STDMETHODIMP_(ULONG) classname::AddRef()                                    \
+  {                                                                           \
+    wxLogAddRef(#classname, m_cRef);                                          \
+                                                                              \
+    return ++m_cRef;                                                          \
+  }                                                                           \
+                                                                              \
+  STDMETHODIMP_(ULONG) classname::Release()                                   \
+  {                                                                           \
+    wxLogRelease(#classname, m_cRef);                                         \
+                                                                              \
+    if ( --m_cRef == 0 ) {                                                    \
+      delete this;                                                            \
+      return 0;                                                               \
+    }                                                                         \
+    else                                                                      \
+      return m_cRef;                                                          \
+  }
+
+// ============================================================================
+// Debugging support
+// ============================================================================
+
+#ifdef  __DEBUG__
+
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+// All OLE specific log functions have DebugTrace level (as LogTrace)
+// ----------------------------------------------------------------------------
+
+// tries to translate riid into a symbolic name, if possible
+void wxLogQueryInterface(const char *szInterface, REFIID riid);
+
+// these functions print out the new value of reference counter
+void wxLogAddRef (const char *szInterface, ULONG cRef);
+void wxLogRelease(const char *szInterface, ULONG cRef);
+
+#else   //!DEBUG
+  #define   wxLogQueryInterface(szInterface, riid)
+  #define   wxLogAddRef(szInterface, cRef)
+  #define   wxLogRelease(szInterface, cRef)
+#endif  //DEBUG
+
+#endif  //_OLEUTILS_H
\ No newline at end of file
diff --git a/include/wx/msw/ole/uuid.h b/include/wx/msw/ole/uuid.h
new file mode 100644 (file)
index 0000000..a970267
--- /dev/null
@@ -0,0 +1,91 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        ole/uuid.h
+// Purpose:     encapsulates an UUID with some added helper functions
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     11.07.97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+//
+// Notes:       you should link your project with RPCRT4.LIB!
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef   _OLEUUID_H
+#define   _OLEUUID_H
+
+#ifdef __GNUG__
+#pragma interface "uuid.h"
+#endif
+
+// ------------------------------------------------------------------
+// UUID (Universally Unique IDentifier) definition
+// ------------------------------------------------------------------
+
+// ----- taken from RPC.H
+#ifndef UUID_DEFINED            // in some cases RPC.H will be already
+  #ifdef  __WIN32__             // included, so avoid redefinition
+    typedef struct                
+    {
+      unsigned long   Data1;
+      unsigned short  Data2;
+      unsigned short  Data3;
+      unsigned char   Data4[8];
+    } UUID;                     // UUID = GUID = CLSID = LIBID = IID
+  #else   // WIN16
+    #error "Don't know about UUIDs on this platform"
+  #endif  // WIN32
+#endif  // UUID_DEFINED
+
+#ifndef GUID_DEFINED
+  typedef UUID GUID;
+  #define UUID_DEFINED          // prevent redefinition
+#endif  // GUID_DEFINED
+
+typedef unsigned char uchar;
+
+// ------------------------------------------------------------------
+// a class to store UUID and it's string representation
+// ------------------------------------------------------------------
+
+// uses RPC functions to create/convert Universally Unique Identifiers
+class Uuid
+{
+private:
+  UUID  m_uuid;
+  uchar *m_pszUuid;   // this string is alloc'd and freed by RPC 
+  char  *m_pszCForm;  // this string is allocated in Set/Create
+
+  void  UuidToCForm();
+
+  // function used to set initial state by all ctors
+  void  Init() { m_pszUuid = NULL; m_pszCForm = NULL; }
+
+public:
+  // ctors & dtor
+  Uuid()                 { Init();            }
+  Uuid(const char *pc)   { Init(); Set(pc);   }
+  Uuid(const UUID &uuid) { Init(); Set(uuid); }
+ ~Uuid();
+
+  // copy ctor and assignment operator needed for this class
+  Uuid(const Uuid& uuid);
+  Uuid& operator=(const Uuid& uuid);
+
+  // create a brand new UUID
+  void Create();
+
+  // set value of UUID 
+  bool Set(const char *pc);   // from a string, returns true if ok
+  void Set(const UUID& uuid); // from another UUID (never fails)
+
+  // accessors
+  operator const UUID*() const { return &m_uuid;             }
+  operator const char*() const { return (char *)(m_pszUuid); }
+
+  // return string representation of the UUID in the C form
+  // (as in DEFINE_GUID macro)
+  const char *CForm() const    { return m_pszCForm;          }
+};
+
+#endif    // _OLEUUID_H
\ No newline at end of file
diff --git a/samples/joytest/chart.ico b/samples/joytest/chart.ico
new file mode 100644 (file)
index 0000000..16d4a58
Binary files /dev/null and b/samples/joytest/chart.ico differ
diff --git a/samples/joytest/gun.wav b/samples/joytest/gun.wav
new file mode 100644 (file)
index 0000000..8cb037d
Binary files /dev/null and b/samples/joytest/gun.wav differ
diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp
new file mode 100644 (file)
index 0000000..6ec7c6f
--- /dev/null
@@ -0,0 +1,171 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        joytest.cpp
+// Purpose:     Joystick sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Markus Holzem
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <wx/msw/wave.h>
+#include <wx/msw/joystick.h>
+
+#include "joytest.h"
+
+MyFrame *frame = NULL;
+
+IMPLEMENT_APP(MyApp)
+
+// For drawing lines in a canvas
+long xpos = -1;
+long ypos = -1;
+
+int winNumber = 1;
+
+// Initialise this in OnInit, not statically
+bool MyApp::OnInit(void)
+{
+  wxJoystick stick(wxJOYSTICK1);
+  if (!stick.IsOk())
+  {
+    wxMessageBox("No joystick detected!");
+    return FALSE;
+  }
+  m_fire.Create("gun.wav");
+
+  m_maxX = stick.GetXMax();
+  m_maxY = stick.GetYMax();
+
+  // Create the main frame window
+
+  frame = new MyFrame(NULL, "Joystick Demo", wxPoint(0, 0), wxSize(500, 400),
+   wxDEFAULT_FRAME | wxHSCROLL | wxVSCROLL);
+
+  // Give it an icon (this is ignored in MDI mode: uses resources)
+#ifdef __WINDOWS__
+  frame->SetIcon(wxIcon("joyicon"));
+#endif
+#ifdef __X__
+  frame->SetIcon(wxIcon("joyicon.xbm"));
+#endif
+
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu;
+
+  file_menu->Append(JOYTEST_QUIT, "&Exit");
+
+  wxMenu *help_menu = new wxMenu;
+  help_menu->Append(JOYTEST_ABOUT, "&About");
+
+  wxMenuBar *menu_bar = new wxMenuBar;
+
+  menu_bar->Append(file_menu, "&File");
+  menu_bar->Append(help_menu, "&Help");
+
+  // Associate the menu bar with the frame
+  frame->SetMenuBar(menu_bar);
+
+  frame->CreateStatusBar();
+
+  frame->Show(TRUE);
+
+  SetTopWindow(frame);
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
+       EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent)
+END_EVENT_TABLE()
+
+// Define a constructor for my canvas
+MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
+ wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER)
+{
+    wxJoystick joystick(wxJOYSTICK1);
+    joystick.SetCapture(this);
+}
+
+MyCanvas::~MyCanvas(void)
+{
+    wxJoystick joystick(wxJOYSTICK1);
+    joystick.ReleaseCapture();
+}
+
+void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
+{
+  wxClientDC dc(this);
+
+  wxPoint pt(event.GetPosition());
+
+  // Scale to canvas size
+  int cw, ch;
+  GetSize(&cw, &ch);
+
+  pt.x = (long) (((double)pt.x/(double)wxGetApp().m_maxX) * cw);
+  pt.y = (long) (((double)pt.y/(double)wxGetApp().m_maxY) * ch);
+
+  if (xpos > -1 && ypos > -1 && event.IsMove() && event.ButtonIsDown())
+  {
+    dc.SetPen(*wxBLACK_PEN);
+    dc.DrawLine(xpos, ypos, pt.x, pt.y);
+  }
+  xpos = pt.x;
+  ypos = pt.y;
+
+  char buf[100];
+  if (event.ButtonDown())
+    sprintf(buf, "Joystick (%ld, %ld) Fire!", pt.x, pt.y);
+  else
+    sprintf(buf, "Joystick (%ld, %ld)", pt.x, pt.y);
+  frame->SetStatusText(buf);
+
+  if (event.ButtonDown() && wxGetApp().m_fire.IsOk())
+  {
+    wxGetApp().m_fire.Play();
+  }
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+  EVT_MENU(JOYTEST_QUIT, MyFrame::OnQuit)
+END_EVENT_TABLE()
+
+MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
+const long style):
+  wxFrame(parent, -1, title, pos, size, style)
+{
+  canvas = new MyCanvas(this);
+}
+
+MyFrame::~MyFrame(void)
+{
+}
+
+void MyFrame::OnQuit(wxCommandEvent& event)
+{
+      Close(TRUE);
+}
+
+void MyFrame::OnActivate(wxActivateEvent& event)
+{
+  if (event.GetActive() && canvas)
+    canvas->SetFocus();
+}
+
+bool MyFrame::OnClose(void)
+{
+  return TRUE;
+}
\ No newline at end of file
diff --git a/samples/joytest/joytest.def b/samples/joytest/joytest.def
new file mode 100644 (file)
index 0000000..501f2b2
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         Joytest
+DESCRIPTION  'Joystick Test Program'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     6000
+STACKSIZE    48000
diff --git a/samples/joytest/joytest.h b/samples/joytest/joytest.h
new file mode 100644 (file)
index 0000000..68c4f68
--- /dev/null
@@ -0,0 +1,51 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        joytest.cpp
+// Purpose:     Joystick sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Markus Holzem
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// Define a new application
+class MyApp: public wxApp
+{
+  public:
+    bool OnInit(void);
+
+    // Joystick max values
+    int     m_maxX;
+    int     m_maxY;
+
+    wxWave  m_fire;
+};
+
+DECLARE_APP(MyApp)
+
+class MyCanvas: public wxScrolledWindow
+{
+  public:
+    MyCanvas(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
+    ~MyCanvas(void);
+    void OnJoystickEvent(wxJoystickEvent& event);
+
+    DECLARE_EVENT_TABLE()
+};
+
+class MyFrame: public wxFrame
+{
+  public:
+    MyCanvas *canvas;
+    MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
+    ~MyFrame(void);
+    bool OnClose(void);
+    void OnActivate(wxActivateEvent& event);
+    void OnQuit(wxCommandEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+#define JOYTEST_QUIT        1
+#define JOYTEST_ABOUT       2
diff --git a/samples/joytest/joytest.ico b/samples/joytest/joytest.ico
new file mode 100644 (file)
index 0000000..2dc1bde
Binary files /dev/null and b/samples/joytest/joytest.ico differ
diff --git a/samples/joytest/joytest.rc b/samples/joytest/joytest.rc
new file mode 100644 (file)
index 0000000..8138605
--- /dev/null
@@ -0,0 +1,5 @@
+aaaa                    ICON    "mondrian.ico"
+joyicon                 ICON    "mondrian.ico"
+
+#include "wx/msw/wx.rc"
+
diff --git a/samples/joytest/makefile.b32 b/samples/joytest/makefile.b32
new file mode 100644 (file)
index 0000000..d889d44
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.b32
+# Author:      Patrick Halke
+# Created:     1995
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds 32bit MDI example.
+
+# WXWIN and BCCDIR are set by parent make
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) cw32 import32
+
+TARGET=joytest
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = joytest.obj
+
+$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+c0w32.obj $(OBJECTS)
+$(TARGET)
+nul
+$(LIBS)
+$(TARGET).def
+!
+        brc32 -K $(TARGET).res
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+joytest.obj:      joytest.$(SRCSUFF) joytest.h
+
+$(TARGET).res :      $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
+
+
diff --git a/samples/joytest/makefile.bcc b/samples/joytest/makefile.bcc
new file mode 100644 (file)
index 0000000..230ea4a
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds joytest example (DOS).
+
+!if "$(BCCDIR)" == ""
+!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
+!endif
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makebcc.env
+
+THISDIR = $(WXDIR)\samples\joytest
+WXLIB = $(WXDIR)\lib\wx.lib
+LIBS=$(WXLIB) mathwl cwl import
+INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
+CFG=$(WXDIR)\src\wxwin.cfg
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -O2
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+HEADERS = joytest.h
+SOURCES = joytest.$(SRCSUFF)
+OBJECTS = joytest.obj
+
+joytest:    joytest.exe
+
+all:    joytest.exe
+
+joytest.exe:      $(WXLIB) joytest.obj joytest.def joytest.res
+        tlink $(LINKFLAGS) @&&!
+c0wl.obj joytest.obj
+joytest
+nul
+$(LIBS)
+joytest.def
+!
+        rc -30 -K joytest.res
+
+.$(SRCSUFF).obj:
+       bcc $(CPPFLAGS) -c {$< }
+
+joytest.obj:      joytest.$(SRCSUFF)
+
+joytest.res :      joytest.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa joytest
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
diff --git a/samples/joytest/makefile.dos b/samples/joytest/makefile.dos
new file mode 100644 (file)
index 0000000..b2ddbcf
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds joytest example (DOS).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\makemsc.env
+
+THISDIR = $(WXDIR)\samples\joytest
+INC=/I$(WXDIR)\include
+
+HEADERS = joytest.h
+SOURCES = joytest.$(SRCSUFF)
+OBJECTS = joytest.obj
+
+all:    joytest.exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos clean
+        cd $(THISDIR)
+
+
+joytest.exe:      $(WXDIR)\src\msw\dummy.obj $(WXLIB) joytest.obj joytest.def joytest.res
+        link $(LINKFLAGS) @<<
+$(WXDIR)\src\msw\dummy.obj joytest.obj,
+joytest,
+NUL,
+$(LIBS),
+joytest.def
+;
+<<
+        rc -K joytest.res
+
+joytest.obj:      joytest.h joytest.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+joytest.res :      joytest.rc $(WXDIR)\include\wx\msw\wx.rc
+    rc -r /i$(WXDIR)\include joytest
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/joytest/makefile.g95 b/samples/joytest/makefile.g95
new file mode 100644 (file)
index 0000000..8eef77f
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for joytest example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/joytest.$(OBJSUFF) $(OBJDIR)/joytest_resources.$(OBJSUFF)
+
+all:    $(OBJDIR) joytest$(GUISUFFIX)
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+joytest$(GUISUFFIX): $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o joytest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/joytest.$(OBJSUFF):        joytest.$(SRCSUFF) joytest.h
+       $(CC) -c $(CPPFLAGS) -o $@ joytest.$(SRCSUFF)
+
+$(OBJDIR)/joytest_resources.o:  joytest.rc
+       $(RESCOMP) -i joytest.rc -o $(OBJDIR)/joytest_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) joytest$(GUISUFFIX).exe core *.res *.rsc
diff --git a/samples/joytest/makefile.nt b/samples/joytest/makefile.nt
new file mode 100644 (file)
index 0000000..ca7ec0c
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds joytest example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+WXUSINGDLL=0
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\joytest
+PROGRAM=joytest
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/joytest/makefile.sc b/samples/joytest/makefile.sc
new file mode 100644 (file)
index 0000000..bcdcb11
--- /dev/null
@@ -0,0 +1,37 @@
+;    Last change:  JS   12 Apr 98   10:45 am
+# Symantec C++ makefile for joytest example
+# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makesc.env
+
+WXLIB = $(WXDIR)\lib\wx.lib
+INCDIR = $(WXDIR)\include
+MSWINC = $(INCDIR)\msw
+BASEINC = $(INCDIR)\base
+
+CC=sc
+RC=rc
+CFLAGS = -o -ml -W -Dwx_msw
+LDFLAGS = -ml -W
+
+INCLUDE=$(BASEINC);$(MSWINC)
+
+LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
+
+.$(SRCSUFF).obj:
+       *$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
+
+.rc.res:
+       *$(RC) -r -I$(INCLUDE) $<
+
+joytest.exe: joytest.obj joytest.def joytest.res
+       *$(CC) $(LDFLAGS) -o$@ joytest.obj joytest.def $(LIBS)
+       *$(RC) -k joytest.res
+
+clean:
+        -del *.obj
+       -del *.exe
+       -del *.res
+       -del *.map
+       -del *.rws
diff --git a/samples/joytest/makefile.unx b/samples/joytest/makefile.unx
new file mode 100644 (file)
index 0000000..c415642
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for joytest example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/make.env
+
+OBJECTS = $(OBJDIR)/joytest.$(OBJSUFF)
+
+.SUFFIXES:
+
+all:    $(OBJDIR) joytest$(GUISUFFIX)
+
+wx:
+#      cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx
+motif:
+       $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
+
+xview:
+       $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
+
+hp:
+       $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
+         XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+joytest$(GUISUFFIX): $(OBJDIR)/joytest.$(OBJSUFF) $(WXLIB)
+       $(CC) $(LDFLAGS) -o joytest$(GUISUFFIX) $(OBJDIR)/joytest.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
+
+$(OBJDIR)/joytest.$(OBJSUFF):        joytest.$(SRCSUFF) joytest.h
+       $(CC) -c $(CPPFLAGS) -o $@ joytest.$(SRCSUFF)
+
+clean_motif:
+       $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
+
+clean_ol:
+       $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
+
+clean_hp:
+       $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
+
+cleanany:
+       rm -f $(OBJECTS) joytest$(GUISUFFIX) core
diff --git a/samples/joytest/makefile.wat b/samples/joytest/makefile.wat
new file mode 100644 (file)
index 0000000..d009dcb
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Makefile for WATCOM
+#
+# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
+# 8 Nov 1994
+#
+
+WXDIR = ..\.. 
+
+!include $(WXDIR)\src\makewat.env
+
+WXLIB = $(WXDIR)\lib
+NAME = joytest
+LNK = $(name).lnk
+OBJS = $(name).obj
+
+all:    $(name).exe
+
+$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
+    wlink @$(LNK)
+    $(BINDCOMMAND) $(name).res
+
+$(name).res :      $(name).rc $(WXDIR)\include\msw\wx.rc
+     $(RC) $(RESFLAGS1) $(name).rc
+
+$(LNK) : makefile.wat
+    %create $(LNK)
+    @%append $(LNK) debug all
+    @%append $(LNK) system $(LINKOPTION)
+    @%append $(LNK) $(MINDATA)
+    @%append $(LNK) $(MAXDATA)
+    @%append $(LNK) $(STACK)
+    @%append $(LNK) name $(name)
+    @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
+    @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
+    @for %i in ($(OBJS)) do @%append $(LNK) file %i
+
+thing: .SYMBOLIC
+    echo $(WATLIBDIR)
+
+clean:   .SYMBOLIC
+    -erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
+
diff --git a/samples/joytest/mondrian.ico b/samples/joytest/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/samples/joytest/mondrian.ico differ
diff --git a/samples/mfc/makefile.b32 b/samples/mfc/makefile.b32
new file mode 100644 (file)
index 0000000..9f09938
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# File:                makefile.bcc
+# Author:       Andre Beltman
+# Created:      1995
+# Updated:     
+# Copyright:    (c) 1995, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds mfc example (DOS).
+
+# WXWIN and BCCDIR are set by parent make
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXINC = $(WXDIR)\include\msw
+WXBASESRC = $(WXDIR)\src\base
+WXBASEINC = $(WXDIR)\include\base
+WXLIB = $(WXLIBDIR)\wx32.lib
+FAFALIB = $(WXLIBDIR)\fafa.lib
+ITSYLIB = $(WXLIBDIR)\itsy.lib
+XPMLIB = $(WXLIBDIR)\xpm.lib
+DIBLIB = $(WXLIBDIR)\dib.lib
+GAUGELIB = $(WXLIBDIR)\gauge.lib
+WXTREELIB = $(WXLIBDIR)\wxtree.lib
+RCPARSERLIB = $(WXLIBDIR)\rcparser.lib
+PROLOGLIB = $(WXLIBDIR)\prologio.lib
+LIBS=$(WXLIB) cw32 import32 ctl3d32 $(FAFALIB) $(ITSYLIB) $(DIBLIB)\
+  $(XPMLIB) $(PROLOGLIB) $(RCPARSERLIB) $(GAUGELIB) $(WXTREELIB)
+
+TARGET=hello
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = hello.obj
+
+$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+c0w32.obj $(OBJECTS)
+$(TARGET)
+nul
+$(LIBS)
+$(TARGET).def
+!
+        brc32 -K $(TARGET).res
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+hello.obj:      hello.$(SRCSUFF)
+
+$(TARGET).res :      $(TARGET).rc $(WXDIR)\include\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa $(TARGET)
+
+clean:
+        -erase *.obj *.exe *.res *.map *.rws
+
diff --git a/samples/mfc/makefile.bcc b/samples/mfc/makefile.bcc
new file mode 100644 (file)
index 0000000..6e2059d
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds mfc example (DOS).
+
+!if "$(BCCDIR)" == ""
+!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
+!endif
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makebcc.env
+
+THISDIR = $(WXDIR)\samples\mfc
+WXLIB = $(WXDIR)\lib\wx.lib
+
+LIBS=$(WXLIB) mathwl cwl import
+INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
+CFG=$(WXDIR)\src\wxwin.cfg
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -O2
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+HEADERS = hello.h
+SOURCES = hello.$(SRCSUFF)
+OBJECTS = hello.obj
+
+hello:    hello.exe
+
+all:    hello.exe
+
+hello.exe:      $(WXLIB) hello.obj hello.def hello.res
+        tlink $(LINKFLAGS) @&&!
+c0wl.obj hello.obj
+hello
+nul
+$(LIBS)
+hello.def
+!
+        rc -30 -K hello.res
+
+.$(SRCSUFF).obj:
+       bcc $(CPPFLAGS) -c {$< }
+
+hello.obj:      hello.$(SRCSUFF)
+
+hello.res :      hello.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa hello
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
diff --git a/samples/mfc/makefile.dos b/samples/mfc/makefile.dos
new file mode 100644 (file)
index 0000000..93934fd
--- /dev/null
@@ -0,0 +1,89 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds MFC compatibility example (DOS).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\makemsc.env
+
+THISDIR = $(WXDIR)\samples\mfc
+WXLIB = $(WXDIR)\lib\wx.lib
+MFCINC = c:\msvc\mfc\include
+LIBS=lafxcwD $(WXLIB) oldnames libw llibcew commdlg ddeml shell mmsystem  # mfcoleui compobj storage ole2 ole2disp
+#LIBS=lafxcwD llibcew libw commdlg shell
+INC=-I$(MFCINC) -I$(WXDIR)\include\base -I$(WXDIR)\include\msw
+DUMMY=$(WXDIR)\src\msw\dummy.obj
+
+# Set this to nothing if using MS C++ 7
+ZOPTION=/Z7
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+PRECOMP = # /YuWX_PREC.H /Fp$(WXDIR)\src\msw\wx.pch
+
+!if "$(FINAL)" == "0"
+CPPFLAGS=/D_DEBUG /AL /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) $(PRECOMP) /Dwx_msw
+#CPPFLAGS=/AL /Zp /GA /G2 /Gyf /Od /W3 $(INC) /D_DEBUG
+LINKFLAGS=/NOD /CO /NOE /ONERROR:NOEXE /SEG:256 /STACK:12000
+!else
+CPPFLAGS=/AL /W3 /G2sw $(INC) /Ox $(PRECOMP) /Dwx_msw
+LINKFLAGS=/NOD /NOE /ONERROR:NOEXE /SEG:256
+!endif
+
+HEADERS = hello.h
+SOURCES = hello.$(SRCSUFF)
+OBJECTS = hello.obj
+
+hello:    hello.exe
+
+all:    wx hello.exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos clean
+        cd $(THISDIR)
+
+
+hello.exe:      $(DUMMY) $(WXLIB) hello.obj hello.def hello.res
+        link $(LINKFLAGS) @<<
+$(DUMMY) hello.obj,
+hello,
+NUL,
+$(LIBS),
+hello.def
+;
+<<
+        rc -31 -K hello.res
+
+hello.obj:      hello.h hello.$(SRCSUFF) $(DUMMY)
+        cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+hello.res :      hello.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /i$(MFCINC) /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa hello
+
+clean:
+        -erase *.obj
+        -erase *.sbr
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.pdb
diff --git a/samples/mfc/makefile.nt b/samples/mfc/makefile.nt
new file mode 100644 (file)
index 0000000..3564096
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds MFC/wxWin example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+EXTRALIBS=# mfc42.lib
+EXTRAINC=-Ig:\DevStudio\mfc\include
+EXTRAFLAGS=/D_AFXDLL
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\mfc
+PROGRAM=mfctest
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+clean:
+        -erase *.obj
+        -erase *.sbr
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.pdb
+
diff --git a/samples/mfc/makefile.wat b/samples/mfc/makefile.wat
new file mode 100644 (file)
index 0000000..0958ed9
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Makefile for WATCOM
+#
+# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
+# 8 Nov 1994
+#
+
+WXDIR = ..\.. 
+
+!include $(WXDIR)\src\makewat.env
+
+WXLIB = $(WXDIR)\lib
+NAME = hello
+LNK = $(name).lnk
+OBJS = $(name).obj 
+
+# Required for multi-threaded MFC apps
+EXTRACPPFLAGS = -bm -oaxt-zp4-ei-xs-zo-w3-bm-bt=nt -d_WINDOWS -d_MBCS
+refmain = _wstart2_
+
+
+PRECOMP=
+
+all:    $(name).exe
+
+$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
+    wlink @$(LNK)
+    $(BINDCOMMAND) -d_MBCS $(name).res
+
+$(name).res :      $(name).rc $(WXDIR)\include\msw\wx.rc
+     $(RC) $(RESFLAGS1) $(name).rc
+
+$(LNK) : makefile.wat
+    %create $(LNK)
+    @%append $(LNK) debug all
+    @%append $(LNK) system $(LINKOPTION)
+    @%append $(LNK) $(MINDATA)
+    @%append $(LNK) $(MAXDATA)
+    @%append $(LNK) $(STACK)
+    @%append $(LNK) name $(name)
+    @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
+    @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
+    @for %i in ($(OBJS)) do @%append $(LNK) file %i
+
+clean:   .SYMBOLIC
+    -erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
+
diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp
new file mode 100644 (file)
index 0000000..cbbcd34
--- /dev/null
@@ -0,0 +1,408 @@
+// hello.cpp : Defines the class behaviors for the application.
+//           Hello is a simple program which consists of a main window
+//           and an "About" dialog which can be invoked by a menu choice.
+//           It is intended to serve as a starting-point for new
+//           applications.
+//
+// This is a part of the Microsoft Foundation Classes C++ library.
+// Copyright (C) 1992 Microsoft Corporation
+// All rights reserved.
+//
+// This source code is only intended as a supplement to the
+// Microsoft Foundation Classes Reference and Microsoft
+// WinHelp documentation provided with the library.
+// See these sources for detailed information regarding the
+// Microsoft Foundation Classes product.
+
+// *** MODIFIED BY JULIAN SMART TO DEMONSTRATE CO-EXISTANCE WITH wxWINDOWS ***
+//
+// This sample pops up an initial wxWindows frame, with a menu item
+// that allows a new MFC window to be created. Note that CDummyWindow
+// is a class that allows a wxWindows window to be seen as a CWnd
+// for the purposes of specifying a valid main window to the
+// MFC initialisation.
+//
+// You can easily modify this code so that an MFC window pops up
+// initially as the main frame, and allows wxWindows frames to be
+// created subsequently:
+//
+// (1) Make MyApp::OnInit return NULL, not create a window.
+// (2) Restore the MFC code to create a window in InitInstance, and remove
+//     creation of CDummyWindow.
+//
+// IMPORTANT NOTE: to compile this sample, you must first edit
+// wx/src/msw/wx_main.cc, set NOWINMAIN to 1, and remake wxWindows
+// (it only needs to recompile wx_main.cc).
+// This eliminates the duplicate WinMain function which MFC implements.
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#ifdef new
+#undef new
+#endif
+
+#include "stdafx.h"
+
+#ifdef DrawText
+#undef DrawText
+#endif
+
+#include "resource.h"
+
+#include "mfctest.h"
+
+#include "wx/wx.h"
+
+/////////////////////////////////////////////////////////////////////////////
+
+// theApp:
+// Just creating this application object runs the whole application.
+//
+CTheApp theApp;
+
+// wxWindows elements
+
+// Define a new application type
+class MyApp: public wxApp
+{ public:
+    bool OnInit(void);
+    wxFrame *CreateFrame(void);
+ };
+
+DECLARE_APP(MyApp)
+
+class MyCanvas: public wxScrolledWindow
+{
+  public:
+    MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
+    void OnPaint(wxPaintEvent& event);
+    void OnMouseEvent(wxMouseEvent& event);
+DECLARE_EVENT_TABLE()
+};
+
+class MyChild: public wxFrame
+{
+  public:
+    MyCanvas *canvas;
+    MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
+    ~MyChild(void);
+    Bool OnClose(void);
+
+    void OnQuit(wxCommandEvent& event);
+    void OnNew(wxCommandEvent& event);
+    void OnActivate(wxActivateEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+// For drawing lines in a canvas
+long xpos = -1;
+long ypos = -1;
+
+// Initialise this in OnInit, not statically
+wxPen *red_pen;
+wxFont *small_font;
+
+// ID for the menu quit command
+#define HELLO_QUIT 1
+#define HELLO_NEW  2
+
+DECLARE_APP(MyApp)
+IMPLEMENT_APP(MyApp)
+
+/////////////////////////////////////////////////////////////////////////////
+
+// CMainWindow constructor:
+// Create the window with the appropriate style, size, menu, etc.
+//
+CMainWindow::CMainWindow()
+{
+       LoadAccelTable( "MainAccelTable" );
+       Create( NULL, "Hello Foundation Application",
+               WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" );
+}
+
+// OnPaint:
+// This routine draws the string "Hello, Windows!" in the center of the
+// client area.  It is called whenever Windows sends a WM_PAINT message.
+// Note that creating a CPaintDC automatically does a BeginPaint and
+// an EndPaint call is done when it is destroyed at the end of this
+// function.  CPaintDC's constructor needs the window (this).
+//
+void CMainWindow::OnPaint()
+{
+       CString s = "Hello, Windows!";
+       CPaintDC dc( this );
+       CRect rect;
+
+       GetClientRect( rect );
+       dc.SetTextAlign( TA_BASELINE | TA_CENTER );
+       dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) );
+       dc.SetBkMode(TRANSPARENT);
+       dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ),
+                               s, s.GetLength() );
+}
+
+// OnAbout:
+// This member function is called when a WM_COMMAND message with an
+// IDM_ABOUT code is received by the CMainWindow class object.  The
+// message map below is responsible for this routing.
+//
+// We create a ClDialog object using the "AboutBox" resource (see
+// hello.rc), and invoke it.
+//
+void CMainWindow::OnAbout()
+{
+       CDialog about( "AboutBox", this );
+       about.DoModal();
+}
+
+void CMainWindow::OnTest()
+{
+  wxMessageBox("This is a wxWindows message box.\nWe're about to create a new wxWindows frame.", "wxWindows", wxOK);
+  wxGetApp().CreateFrame();
+}
+
+// CMainWindow message map:
+// Associate messages with member functions.
+//
+// It is implied that the ON_WM_PAINT macro expects a member function
+// "void OnPaint()".
+//
+// It is implied that members connected with the ON_COMMAND macro
+// receive no arguments and are void of return type, e.g., "void OnAbout()".
+//
+BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd )
+       //{{AFX_MSG_MAP( CMainWindow )
+       ON_WM_PAINT()
+       ON_COMMAND( IDM_ABOUT, OnAbout )
+       ON_COMMAND( IDM_TEST, OnTest )
+       //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CTheApp
+
+// InitInstance:
+// When any CTheApp object is created, this member function is automatically
+// called.  Any data may be set up at this point.
+//
+// Also, the main window of the application should be created and shown here.
+// Return TRUE if the initialization is successful.
+//
+BOOL CTheApp::InitInstance()
+{
+       TRACE( "HELLO WORLD\n" );
+
+       SetDialogBkColor();     // hook gray dialogs (was default in MFC V1)
+
+    wxEntry((WXHINSTANCE) m_hInstance, (WXHINSTANCE) m_hPrevInstance, m_lpCmdLine, m_nCmdShow, FALSE);
+
+/*
+       m_pMainWnd = new CMainWindow();
+       m_pMainWnd->ShowWindow( m_nCmdShow );
+       m_pMainWnd->UpdateWindow();
+*/
+
+    if (wxTheApp && wxTheApp->GetTopWindow())
+    {
+        m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND());
+    }
+
+       return TRUE;
+}
+
+int CTheApp::ExitInstance()
+{
+  wxApp::CleanUp();
+
+  return CWinApp::ExitInstance();
+}
+
+// Override this to provide wxWindows message loop
+// compatibility
+
+BOOL CTheApp::PreTranslateMessage(MSG *msg)
+{
+  if (wxTheApp && wxTheApp->ProcessMessage((WXMSG*) msg))
+    return TRUE;
+  else
+    return CWinApp::PreTranslateMessage(msg);
+}
+
+BOOL CTheApp::OnIdle(LONG lCount)
+{
+    if (wxTheApp)
+        return wxTheApp->ProcessIdle();
+    else
+        return FALSE;
+}
+
+/*********************************************************************
+ * wxWindows elements
+ ********************************************************************/
+bool MyApp::OnInit(void)
+{
+  // Don't exit app when the top level frame is deleted
+//  SetExitOnFrameDelete(FALSE);
+  
+  // Create a red pen
+  red_pen = new wxPen("RED", 3, wxSOLID);
+
+  // Create a small font
+  small_font = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
+
+  wxFrame* frame = CreateFrame();
+  return TRUE;
+}
+
+wxFrame *MyApp::CreateFrame(void)
+{
+      MyChild *subframe = new MyChild(NULL, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300),
+                             wxDEFAULT_FRAME);
+
+      subframe->SetTitle("wxWindows canvas frame");
+
+      // Give it a status line
+      subframe->CreateStatusBar();
+
+      // Make a menubar
+      wxMenu *file_menu = new wxMenu;
+
+      file_menu->Append(HELLO_NEW, "&New MFC Window");
+      file_menu->Append(HELLO_QUIT, "&Close");
+
+      wxMenuBar *menu_bar = new wxMenuBar;
+
+      menu_bar->Append(file_menu, "&File");
+
+      // Associate the menu bar with the frame
+      subframe->SetMenuBar(menu_bar);
+
+      int width, height;
+      subframe->GetClientSize(&width, &height);
+
+      MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
+      wxCursor *cursor = new wxCursor(wxCURSOR_PENCIL);
+      canvas->SetCursor(cursor);
+      subframe->canvas = canvas;
+
+      // Give it scrollbars
+//      canvas->SetScrollbars(20, 20, 50, 50, 4, 4);
+
+      subframe->Show(TRUE);
+      // Return the main frame window
+      return subframe;
+}
+
+BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
+    EVT_PAINT(MyCanvas::OnPaint)
+    EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
+END_EVENT_TABLE()
+
+// Define a constructor for my canvas
+MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
+ wxScrolledWindow(parent, -1, pos, size)
+{
+}
+
+// Define the repainting behaviour
+void MyCanvas::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+
+    dc.SetFont(small_font);
+    dc.SetPen(wxGREEN_PEN);
+    dc.DrawLine(0, 0, 200, 200);
+    dc.DrawLine(200, 0, 0, 200);
+
+    dc.SetBrush(wxCYAN_BRUSH);
+    dc.SetPen(wxRED_PEN);
+    dc.DrawRectangle(100, 100, 100, 50);
+    dc.DrawRoundedRectangle(150, 150, 100, 50, 20);
+
+    dc.DrawEllipse(250, 250, 100, 50);
+    dc.DrawSpline(50, 200, 50, 100, 200, 10);
+    dc.DrawLine(50, 230, 200, 230);
+    dc.DrawText("This is a test string", 50, 230);
+}
+
+// This implements a tiny doodling program! Drag the mouse using
+// the left button.
+void MyCanvas::OnMouseEvent(wxMouseEvent& event)
+{
+    wxClientDC dc(this);
+    dc.SetPen(wxBLACK_PEN);
+    long x, y;
+    event.Position(&x, &y);
+    if (xpos > -1 && ypos > -1 && event.Dragging())
+    {
+        dc.DrawLine(xpos, ypos, x, y);
+    }
+    xpos = x;
+    ypos = y;
+}
+
+BEGIN_EVENT_TABLE(MyChild, wxFrame)
+    EVT_MENU(HELLO_QUIT, MyChild::OnQuit)
+    EVT_MENU(HELLO_NEW, MyChild::OnNew)
+    EVT_ACTIVATE(MyChild::OnActivate)
+END_EVENT_TABLE()
+
+MyChild::MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style):
+  wxFrame(frame, -1, title, pos, size, style)
+{
+  canvas = NULL;
+}
+
+MyChild::~MyChild(void)
+{
+}
+
+void MyChild::OnQuit(wxCommandEvent& event)
+{
+    Close(TRUE);
+}
+
+void MyChild::OnNew(wxCommandEvent& event)
+{
+    CMainWindow *mainWin = new CMainWindow();
+    mainWin->ShowWindow( TRUE );
+    mainWin->UpdateWindow();
+}
+void MyChild::OnActivate(wxActivateEvent& event)
+{
+  if (event.GetActive() && canvas)
+    canvas->SetFocus();
+}
+
+Bool MyChild::OnClose(void)
+{
+  return TRUE;
+}
+
+
+// Dummy MFC window for specifying a valid main window to MFC, using
+// a wxWindows HWND.
+CDummyWindow::CDummyWindow(HWND hWnd):CWnd()
+{
+  Attach(hWnd);
+}
+
+// Don't let the CWnd destructor delete the HWND
+CDummyWindow::~CDummyWindow(void)
+{
+  Detach();
+}
+
diff --git a/samples/mfc/mfctest.def b/samples/mfc/mfctest.def
new file mode 100644 (file)
index 0000000..7c741d1
--- /dev/null
@@ -0,0 +1,21 @@
+; hello.def : Declares the module parameters for the application.
+;
+; This is a part of the Microsoft Foundation Classes C++ library.
+; Copyright (C) 1992 Microsoft Corporation
+; All rights reserved.
+;
+; This source code is only intended as a supplement to the
+; Microsoft Foundation Classes Reference and Microsoft
+; WinHelp documentation provided with the library.
+; See these sources for detailed information regarding the
+; Microsoft Foundation Classes product.
+
+NAME         Hello
+DESCRIPTION  'Hello Microsoft Foundation Classes Windows Application'
+
+EXETYPE      WINDOWS
+
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+
+HEAPSIZE     1024
diff --git a/samples/mfc/mfctest.h b/samples/mfc/mfctest.h
new file mode 100644 (file)
index 0000000..038a08c
--- /dev/null
@@ -0,0 +1,66 @@
+// hello.h : Declares the class interfaces for the application.
+//         Hello is a simple program which consists of a main window
+//         and an "About" dialog which can be invoked by a menu choice.
+//         It is intended to serve as a starting-point for new
+//         applications.
+//
+// This is a part of the Microsoft Foundation Classes C++ library.
+// Copyright (C) 1992 Microsoft Corporation
+// All rights reserved.
+//
+// This source code is only intended as a supplement to the
+// Microsoft Foundation Classes Reference and Microsoft
+// WinHelp documentation provided with the library.
+// See these sources for detailed information regarding the
+// Microsoft Foundation Classes product.
+
+#ifndef __MFCTEST_H__
+#define __MFCTEST_H__
+
+/////////////////////////////////////////////////////////////////////////////
+
+// CMainWindow:
+// See hello.cpp for the code to the member functions and the message map.
+//
+class CMainWindow : public CFrameWnd
+{
+public:
+       CMainWindow();
+
+       //{{AFX_MSG( CMainWindow )
+       afx_msg void OnPaint();
+       afx_msg void OnAbout();
+       afx_msg void OnTest();
+       //}}AFX_MSG
+
+       DECLARE_MESSAGE_MAP()
+};
+
+// A dummy CWnd pointing to a wxWindow's HWND
+class CDummyWindow: public CWnd
+{
+  public:
+    CDummyWindow(HWND hWnd);
+    ~CDummyWindow(void);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+// CTheApp:
+// See hello.cpp for the code to the InitInstance member function.
+//
+class CTheApp : public CWinApp
+{
+public:
+       BOOL InitInstance();
+    int ExitInstance();
+
+    // Override this to provide wxWindows message loop
+    // compatibility
+    BOOL PreTranslateMessage(MSG *msg);
+    BOOL OnIdle(LONG lCount);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // __MFCTEST_H__
diff --git a/samples/mfc/mfctest.ico b/samples/mfc/mfctest.ico
new file mode 100644 (file)
index 0000000..331b675
Binary files /dev/null and b/samples/mfc/mfctest.ico differ
diff --git a/samples/mfc/mfctest.rc b/samples/mfc/mfctest.rc
new file mode 100644 (file)
index 0000000..7c5da8b
--- /dev/null
@@ -0,0 +1,108 @@
+//Microsoft App Studio generated resource script.
+//
+#include "wx/msw/wx.rc"
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+AFX_IDI_STD_FRAME       ICON    DISCARDABLE     "MFCTEST.ICO"
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+MAINMENU MENU DISCARDABLE 
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "&Test wxWindows",         IDM_TEST
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About Hello...\tF1",         IDM_ABOUT
+    END
+END
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+MAINACCELTABLE ACCELERATORS MOVEABLE PURE 
+BEGIN
+    VK_F1,          IDM_ABOUT,              VIRTKEY 
+END
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+ABOUTBOX DIALOG DISCARDABLE  34, 22, 144, 75
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About Hello"
+FONT 8, "Helv"
+BEGIN
+    CTEXT           "Microsoft Windows",IDC_STATIC,0,5,144,8
+    CTEXT           "Microsoft Foundation Classes",IDC_STATIC,0,14,144,8
+    CTEXT           "Hello, Windows!",IDC_STATIC,0,23,144,8
+    CTEXT           "Version 2.0",IDC_STATIC,0,36,144,8
+    DEFPUSHBUTTON   "OK",IDOK,56,53,32,14,WS_GROUP
+END
+
+#ifdef APSTUDIO_INVOKED
+//////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef APSTUDIO_INVOKED
+////////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/samples/mfc/resource.h b/samples/mfc/resource.h
new file mode 100644 (file)
index 0000000..e20ad76
--- /dev/null
@@ -0,0 +1,18 @@
+//{{NO_DEPENDENCIES}}
+// App Studio generated include file.
+// Used by HELLO.RC
+//
+#define IDM_ABOUT                       100
+#define IDM_TEST                        101
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE        110
+#define _APS_NEXT_COMMAND_VALUE         32768
+#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_SYMED_VALUE           112
+#endif
+#endif
diff --git a/samples/mfc/stdafx.h b/samples/mfc/stdafx.h
new file mode 100644 (file)
index 0000000..5b9f153
--- /dev/null
@@ -0,0 +1,12 @@
+// This is a part of the Microsoft Foundation Classes C++ library.
+// Copyright (C) 1992 Microsoft Corporation
+// All rights reserved.
+//
+// This source code is only intended as a supplement to the
+// Microsoft Foundation Classes Reference and Microsoft
+// WinHelp documentation provided with the library.
+// See these sources for detailed information regarding the
+// Microsoft Foundation Classes product.
+
+
+#include <afxwin.h>
diff --git a/samples/nativdlg/aiai.ico b/samples/nativdlg/aiai.ico
new file mode 100644 (file)
index 0000000..a3db656
Binary files /dev/null and b/samples/nativdlg/aiai.ico differ
diff --git a/samples/nativdlg/dialog1.rc b/samples/nativdlg/dialog1.rc
new file mode 100644 (file)
index 0000000..412338a
--- /dev/null
@@ -0,0 +1,142 @@
+//Microsoft Developer Studio generated resource script.
+//
+
+#ifndef __WINDOWS__
+#define __WINDOWS__
+#endif
+
+#ifndef __WIN32__
+#define __WIN32__
+#endif
+
+#ifndef __WIN95__
+#define __WIN95__
+#endif
+
+#ifdef __MINGW32__
+#define wxID_OK                 5100
+#define wxID_CANCEL             5101
+#define wxID_APPLY              5102
+#define wxID_YES                5103
+#define wxID_NO                 5104
+/* #include <wx/msw/gnuwin32/winresrc.h> */
+#else
+#include <wx/defs.h>
+/* #include <windows.h> */
+#endif
+
+#include "resource.h"
+
+#ifndef __MINGW32__
+#include <commctrl.h>
+#endif
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+// #include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.K.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+dialog1 DIALOG DISCARDABLE  0, 0, 271, 172
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Test Dialog"
+FONT 8, "MS Sans Serif"
+BEGIN
+    DEFPUSHBUTTON   "OK",wxID_OK,214,7,50,14
+    PUSHBUTTON      "Cancel",wxID_CANCEL,214,24,50,14
+    GROUPBOX        "wxStaticBox",IDC_STATIC,7,7,198,158
+    EDITTEXT        IDC_EDIT1,64,23,125,14,ES_AUTOHSCROLL
+    LTEXT           "wxStaticText",IDC_STATIC,13,25,42,8
+    CONTROL         "wxCheckBox",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,14,47,57,10
+    COMBOBOX        IDC_COMBO1,83,46,48,30,CBS_DROPDOWN | CBS_SORT | 
+                    WS_VSCROLL | WS_TABSTOP
+    CONTROL         "wxRadioButton",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,
+                    141,47,64,10
+    LISTBOX         IDC_LIST1,14,69,86,40,LBS_SORT | LBS_NOINTEGRALHEIGHT | 
+                    WS_VSCROLL | WS_TABSTOP
+    SCROLLBAR       IDC_SCROLLBAR1,111,71,76,11
+    CONTROL         "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | 
+                    TBS_NOTICKS | WS_TABSTOP,10,116,100,15
+    CONTROL         "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,111,90,
+                    10,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE 
+BEGIN
+    dialog1, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 264
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 165
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // English (U.K.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/samples/nativdlg/makefile.b32 b/samples/nativdlg/makefile.b32
new file mode 100644 (file)
index 0000000..7c55473
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds 32bit nativdlg example.
+
+# WXWIN and BCCDIR are set by parent make
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) cw32 import32
+
+TARGET=nativdlg
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = nativdlg.obj
+
+$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+c0w32.obj $(OBJECTS)
+$(TARGET)
+nul
+$(LIBS)
+$(TARGET).def
+!
+        brc32 -K $(TARGET).res
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+nativdlg.obj:  nativdlg.$(SRCSUFF) nativdlg.h # dialog1.wxr
+
+$(TARGET).res :      $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /D__WINDOWS__ /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
+
+
diff --git a/samples/nativdlg/makefile.bcc b/samples/nativdlg/makefile.bcc
new file mode 100644 (file)
index 0000000..19ad9c2
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds resource example (DOS).
+
+!if "$(BCCDIR)" == ""
+!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
+!endif
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+THISDIR = $(WXDIR)\samples\resource
+WXLIB = $(WXDIR)\lib\wx.lib
+
+LIBS=$(WXLIB) mathwl cwl import
+INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
+CFG=$(WXDIR)\src\wxwin.cfg
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -O2
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+HEADERS = resource.h
+SOURCES = resource.cc
+OBJECTS = resource.obj
+
+resource:    resource.exe
+
+all:    resource.exe
+
+resource.exe:      $(WXLIB) resource.obj resource.def resource.res
+        tlink $(LINKFLAGS) @&&!
+c0wl.obj resource.obj
+resource
+nul
+$(LIBS)
+resource.def
+!
+        rc -30 -K resource.res
+
+.cc.obj:
+       bcc $(CPPFLAGS) -c {$< }
+
+resource.obj:      resource.cc
+
+resource.res :      resource.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa resource
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
diff --git a/samples/nativdlg/makefile.dos b/samples/nativdlg/makefile.dos
new file mode 100644 (file)
index 0000000..6096ca8
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds resource example (DOS).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\makemsc.env
+
+THISDIR = $(WXDIR)\samples\resource
+WXLIB = $(WXDIR)\lib\wx.lib
+LIBS=$(WXLIB) oldnames libw llibcew commdlg ddeml shell mmsystem
+INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
+DUMMY=$(WXDIR)\src\msw\dummy.obj
+
+# Set this to nothing if using MS C++ 7
+ZOPTION=/Z7
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+PRECOMP = /YuWX_PREC.H /Fp$(WXDIR)\src\msw\wx.pch
+
+!if "$(FINAL)" == "0"
+CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od $(INC) $(PRECOMP) /Dwx_msw
+LINKFLAGS=/NOD /CO /ONERROR:NOEXE /SEG:256
+!else
+CPPFLAGS=/AL /W3 /G2sw $(INC) /Ox $(PRECOMP) /Dwx_msw
+LINKFLAGS=/NOD /ONERROR:NOEXE /SEG:256
+!endif
+
+HEADERS = resource.h
+SOURCES = resource.$(SRCSUFF)
+OBJECTS = resource.obj
+
+resource:    resource.exe
+
+all:    wx resource.exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos clean
+        cd $(THISDIR)
+
+
+resource.exe:      $(DUMMY) $(WXLIB) resource.obj resource.def resource.res
+        link $(LINKFLAGS) @<<
+$(DUMMY) resource.obj,
+resource,
+NUL,
+$(LIBS),
+resource.def
+;
+<<
+        rc -31 -K resource.res
+
+resource.obj:      resource.h resource.$(SRCSUFF) dialog1.wxr $(DUMMY)
+        cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+resource.res :      resource.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa resource
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/nativdlg/makefile.g95 b/samples/nativdlg/makefile.g95
new file mode 100644 (file)
index 0000000..018f915
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# File:                makefile.g95
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for nativdlg example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS=$(OBJDIR)/nativdlg.$(OBJSUFF) $(OBJDIR)/nativdlg_resources.$(OBJSUFF)
+
+all:   $(OBJDIR) nativdlg$(GUISUFFIX)
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+$(OBJDIR)/nativdlg.$(OBJSUFF):        nativdlg.$(SRCSUFF) nativdlg.h
+       $(CC) -c $(CPPFLAGS) -o $@ nativdlg.$(SRCSUFF)
+
+nativdlg$(GUISUFFIX): $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o nativdlg$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/nativdlg_resources.o:  nativdlg.rc
+       $(RESCOMP) -i nativdlg.rc -o $(OBJDIR)/nativdlg_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) nativdlg$(GUISUFFIX).exe core *.rsc *.res
+
diff --git a/samples/nativdlg/makefile.nt b/samples/nativdlg/makefile.nt
new file mode 100644 (file)
index 0000000..0826149
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds nativdlg example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\nativdlg
+PROGRAM=nativdlg
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc dialog1.rc
+    $(rc) -r /i$(WXDIR)\include /D__WINDOWS__ -fo$@ $(PROGRAM).rc
+
+
+clean:
+        -erase *.obj
+        -erase *.sbr
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.pdb
+
diff --git a/samples/nativdlg/makefile.sc b/samples/nativdlg/makefile.sc
new file mode 100644 (file)
index 0000000..235c8f8
--- /dev/null
@@ -0,0 +1,35 @@
+# Symantec C++ makefile for hello example
+# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
+
+WXDIR = $(WXWIN)
+WXLIB = $(WXDIR)\lib\wx.lib
+INCDIR = $(WXDIR)\include
+MSWINC = $(INCDIR)\msw
+BASEINC = $(INCDIR)\base
+
+CC=sc
+RC=rc
+CFLAGS = -o -ml -W -Dwx_msw
+LDFLAGS = -ml -W
+
+INCLUDE=$(BASEINC);$(MSWINC)
+
+LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
+
+.cc.obj:
+       *$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
+
+.rc.res:
+       *$(RC) -r -I$(INCLUDE) $<
+
+hello.exe: hello.obj hello.def hello.res
+       *$(CC) $(LDFLAGS) -o$@ hello.obj hello.def $(LIBS)
+        *$(RC) -k hello.res
+
+clean:
+        -del *.obj
+       -del *.exe
+       -del *.res
+       -del *.map
+       -del *.rws
+
diff --git a/samples/nativdlg/makefile.unx b/samples/nativdlg/makefile.unx
new file mode 100644 (file)
index 0000000..1967b5e
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for resource example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/make.env
+
+OBJECTS=$(OBJDIR)/resource.$(OBJSUFF)
+
+.SUFFIXES:
+
+all:   $(OBJDIR) resource$(GUISUFFIX)
+
+wxmotif:
+       cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
+
+wxxview:
+       cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
+
+wxhp:
+       cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp
+
+# For SGI, include -lPW on your LDLIBS
+motif: wxmotif
+       $(MAKE) -f makefile.unx all GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
+
+xview: wxxview
+       $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' LDLIBS='$(XVIEWLDLIBS)'
+
+hp:    wxhp
+       $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC OPT='' DEBUG='$(DEBUG)' WARN='-w' \
+           XINCLUDE='$(HPXINCLUDE)' \
+           XLIB='$(HPXLIB)' \
+           XVIEW_LINK='' \
+           LDLIBS='$(HPLDLIBS)'
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+resource$(GUISUFFIX): $(OBJDIR)/resource.$(OBJSUFF) $(WXLIB)
+       $(CC) $(LDFLAGS) -o resource$(GUISUFFIX) $(OBJDIR)/resource.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS)
+
+$(OBJDIR)/resource.$(OBJSUFF):        resource.$(SRCSUFF) resource.h
+       $(CC) -c $(CPPFLAGS) -o $@ resource.$(SRCSUFF)
+
+clean_motif:
+       $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
+
+clean_ol:
+       $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
+
+clean_hp:
+       $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
+
+cleanany:
+       rm -f $(OBJECTS) resource$(GUISUFFIX) core
+
+wxclean_ol:
+       cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_ol
+
+wxclean_motif:
+       cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_motif
+
+wxclean_hp:
+       cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_hp
+
diff --git a/samples/nativdlg/makefile.vms b/samples/nativdlg/makefile.vms
new file mode 100644 (file)
index 0000000..1ef109f
--- /dev/null
@@ -0,0 +1,38 @@
+#************************************************************************
+# Makefile for HELLO under VMS
+# by Stefan Hammes
+# (incomplete) update history:
+# 11.04.95
+#************************************************************************
+
+#************************************************************************
+# Definition section
+# (cave: definitions and includes must begin with ',')
+#************************************************************************
+
+APPOPTS = 
+APPDEFS = 
+APPINCS = 
+
+#************************************************************************
+# Module section
+#************************************************************************
+
+# Name of main module
+MAIN = hello
+
+# Object modules of the application.
+OBJS = hello.obj
+
+.include [--.src]makevms.env
+
+# main dependency
+$(MAIN).exe : $(MAIN).$(OBJ)
+    $(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(MAIN).$(OBJ),$(WXLIB)/lib,$(OPTSFILE)/option
+    - purge *.exe
+
+#************************************************************************
+# Header file depedencies following
+#************************************************************************
+hello.obj : hello.cc hello.h
+
diff --git a/samples/nativdlg/makefile.wat b/samples/nativdlg/makefile.wat
new file mode 100644 (file)
index 0000000..0ad7f98
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Makefile for WATCOM
+#
+# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
+# 8 Nov 1994
+#
+
+WXDIR = ..\.. 
+
+!include $(WXDIR)\src\makewat.env
+
+WXLIB = $(WXDIR)\lib
+NAME = hello
+LNK = $(name).lnk
+OBJS = $(name).obj 
+
+PRECOMP=
+
+all:    $(name).exe
+
+$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
+    wlink @$(LNK)
+    $(BINDCOMMAND) $(name).res
+
+$(name).res :      $(name).rc $(WXDIR)\include\msw\wx.rc
+     $(RC) $(RESFLAGS1) $(name).rc
+
+$(LNK) : makefile.wat
+    %create $(LNK)
+    @%append $(LNK) debug all
+    @%append $(LNK) system $(LINKOPTION)
+    @%append $(LNK) $(MINDATA)
+    @%append $(LNK) $(MAXDATA)
+    @%append $(LNK) $(STACK)
+    @%append $(LNK) name $(name)
+    @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
+    @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
+    @for %i in ($(OBJS)) do @%append $(LNK) file %i
+
+clean:   .SYMBOLIC
+    -erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
+
diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp
new file mode 100644 (file)
index 0000000..32d24f8
--- /dev/null
@@ -0,0 +1,130 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        nativdlg.cpp
+// Purpose:     Native Windows dialog sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Markus Holzem
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/resource.h"
+
+#include <ctype.h>
+#include "nativdlg.h"
+#include "resource.h"
+
+// Declare two frames
+MyFrame   *frame = NULL;
+
+IMPLEMENT_APP(MyApp)
+
+// Testing of ressources
+MyApp::MyApp()
+{
+}
+
+bool MyApp::OnInit(void)
+{
+  // Create the main frame window
+  frame = new MyFrame(NULL, -1, "wxWindows Native Dialog Sample", wxPoint(0, 0), wxSize(300, 250));
+
+  // Give it a status line
+  frame->CreateStatusBar(2);
+
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu;
+
+  file_menu->Append(RESOURCE_TEST1, "&Dialog box test",                "Test dialog box resource");
+  file_menu->Append(RESOURCE_QUIT, "E&xit",                "Quit program");
+
+  wxMenuBar *menu_bar = new wxMenuBar;
+
+  menu_bar->Append(file_menu, "&File");
+
+  // Associate the menu bar with the frame
+  frame->SetMenuBar(menu_bar);
+
+  // Make a panel
+  frame->panel = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, "MyMainFrame");
+  frame->Show(TRUE);
+
+  // Return the main frame window
+  SetTopWindow(frame);
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+       EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
+       EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1)
+END_EVENT_TABLE()
+
+// Define my frame constructor
+MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size):
+  wxFrame(parent, id, title, pos, size)
+{
+  panel = NULL;
+}
+
+void MyFrame::OnQuit(wxCommandEvent& event)
+{
+       Close(TRUE);
+}
+
+void MyFrame::OnTest1(wxCommandEvent& event)
+{
+      MyDialog *dialog = new MyDialog;
+      if (dialog->LoadNativeDialog(this, dialog1))
+      {
+/*
+        wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("multitext3", dialog);
+        if (text)
+          text->SetValue("wxWindows resource demo");
+*/
+        dialog->SetModal(TRUE);
+        dialog->ShowModal();
+      }
+      dialog->Close(TRUE);
+}
+
+bool MyFrame::OnClose(void)
+{
+  Show(FALSE);
+
+  return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyDialog, wxDialog)
+       EVT_BUTTON(wxID_OK, MyDialog::OnOk)
+       EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel)
+END_EVENT_TABLE()
+
+
+void MyDialog::OnOk(wxCommandEvent& event)
+{
+  EndModal(wxID_OK);
+}
+
+void MyDialog::OnCancel(wxCommandEvent& event)
+{
+  EndModal(wxID_CANCEL);
+}
+
+
diff --git a/samples/nativdlg/nativdlg.def b/samples/nativdlg/nativdlg.def
new file mode 100644 (file)
index 0000000..49791b5
--- /dev/null
@@ -0,0 +1,9 @@
+NAME         Resource
+DESCRIPTION  'Resource'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    16192
+
diff --git a/samples/nativdlg/nativdlg.h b/samples/nativdlg/nativdlg.h
new file mode 100644 (file)
index 0000000..25688ea
--- /dev/null
@@ -0,0 +1,47 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        nativdlg.h
+// Purpose:     Native Windows dialog sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart and Markus Holzem
+// Licence:    wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+// Define a new application
+class MyApp: public wxApp
+{
+  public:
+    MyApp(void) ;
+    bool OnInit(void);
+};
+
+class MyFrame: public wxFrame
+{
+  public:
+    wxWindow *panel;
+    MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size);
+    bool OnClose(void);
+    void OnQuit(wxCommandEvent& event);
+    void OnTest1(wxCommandEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+class MyDialog : public wxDialog
+{
+  public:
+    void OnOk(wxCommandEvent& event);
+    void OnCancel(wxCommandEvent& event);
+
+ DECLARE_EVENT_TABLE()
+};
+
+#define RESOURCE_QUIT       4
+#define RESOURCE_TEST1      2
+
diff --git a/samples/nativdlg/nativdlg.rc b/samples/nativdlg/nativdlg.rc
new file mode 100644 (file)
index 0000000..db18d16
--- /dev/null
@@ -0,0 +1,4 @@
+#include "wx/msw/wx.rc"
+
+#include "dialog1.rc"
+
diff --git a/samples/nativdlg/resource.h b/samples/nativdlg/resource.h
new file mode 100644 (file)
index 0000000..a71bf84
--- /dev/null
@@ -0,0 +1,25 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by dialog1.rc
+//
+#define dialog1                         101
+#define IDC_EDIT1                       1000
+#define IDC_CHECK1                      1001
+#define IDC_COMBO1                      1003
+#define IDC_RADIO1                      1005
+#define IDC_LIST1                       1006
+#define IDC_SCROLLBAR1                  1007
+#define IDC_SLIDER1                     1008
+#define IDC_SPIN1                       1009
+#define IDC_STATIC                      -1
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        102
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1010
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/samples/ownerdrw/bell.bmp b/samples/ownerdrw/bell.bmp
new file mode 100644 (file)
index 0000000..279b827
Binary files /dev/null and b/samples/ownerdrw/bell.bmp differ
diff --git a/samples/ownerdrw/makefile.b32 b/samples/ownerdrw/makefile.b32
new file mode 100644 (file)
index 0000000..7713537
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds ownerdrw example (DOS).
+
+# WXWIN and BCCDIR are set by parent make
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXINC = $(WXDIR)\include\msw
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) cw32 import32
+
+TARGET=ownerdrw
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = ownerdrw.obj
+
+$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+c0w32.obj $(OBJECTS)
+$(TARGET)
+nul
+$(LIBS)
+$(TARGET).def
+!
+        brc32 -K $(TARGET).res
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+ownerdrw.obj:      ownerdrw.$(SRCSUFF)
+
+$(TARGET).res :      $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
+
diff --git a/samples/ownerdrw/makefile.dos b/samples/ownerdrw/makefile.dos
new file mode 100644 (file)
index 0000000..71c7268
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds ownerdrw example (DOS).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\makemsc.env
+
+THISDIR = $(WXDIR)\samples\ownerdrw
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+HEADERS =
+SOURCES = ownerdrw.$(SRCSUFF)
+OBJECTS = ownerdrw.obj
+
+all:    ownerdrw.exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos clean
+        cd $(THISDIR)
+
+ownerdrw.exe:      $(WXDIR)\src\msw\dummy.obj $(WXLIB) ownerdrw.obj ownerdrw.def ownerdrw.res
+        link $(LINKFLAGS) @<<
+ownerdrw.obj $(WXDIR)\src\msw\dummy.obj,
+ownerdrw,
+NUL,
+$(LIBS),
+ownerdrw.def
+;
+<<
+        rc -K ownerdrw.res
+
+ownerdrw.obj:      ownerdrw.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+ownerdrw.res :      ownerdrw.rc $(WXDIR)\include\wx\msw\wx.rc
+    rc -r /i$(WXDIR)\include ownerdrw
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/ownerdrw/makefile.g95 b/samples/ownerdrw/makefile.g95
new file mode 100644 (file)
index 0000000..c821885
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for ownerdrw example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/ownerdrw.$(OBJSUFF) $(OBJDIR)/ownerdrw_resources.$(OBJSUFF)
+
+all:    $(OBJDIR) ownerdrw$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+ownerdrw$(GUISUFFIX)$(EXESUFF):        $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o ownerdrw$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/ownerdrw.$(OBJSUFF): ownerdrw.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ ownerdrw.$(SRCSUFF)
+
+$(OBJDIR)/ownerdrw_resources.o:  ownerdrw.rc
+       $(RESCOMP) -i ownerdrw.rc -o $(OBJDIR)/ownerdrw_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) ownerdrw$(GUISUFFIX).exe core *.rsc *.res
diff --git a/samples/ownerdrw/makefile.nt b/samples/ownerdrw/makefile.nt
new file mode 100644 (file)
index 0000000..5976dad
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds ownerdrw example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+WXUSINGDLL=0
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\ownerdrw
+PROGRAM=ownerdrw
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/ownerdrw/mondrian.ico b/samples/ownerdrw/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/samples/ownerdrw/mondrian.ico differ
diff --git a/samples/ownerdrw/nosound.bmp b/samples/ownerdrw/nosound.bmp
new file mode 100644 (file)
index 0000000..722e2e4
Binary files /dev/null and b/samples/ownerdrw/nosound.bmp differ
diff --git a/samples/ownerdrw/ownerdrw.cpp b/samples/ownerdrw/ownerdrw.cpp
new file mode 100644 (file)
index 0000000..2e039f2
--- /dev/null
@@ -0,0 +1,293 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        ownerdrw.cpp
+// Purpose:     Owner-draw sample, for Windows
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     13.11.97
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// headers & declarations
+// ============================================================================
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+  #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+  #include "wx/wx.h"
+#endif
+
+#include  "wx/ownerdrw.h"
+#include  "wx/menuitem.h"
+#include  "wx/msw/checklst.h"
+
+// Define a new application type
+class OwnerDrawnApp: public wxApp
+{
+public:
+  bool OnInit();
+};
+
+// Define a new frame type
+class OwnerDrawnFrame : public wxFrame
+{
+public:
+  // ctor & dtor
+  OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
+  ~OwnerDrawnFrame();
+
+  // notifications
+  void OnQuit             (wxCommandEvent& event);
+  void OnAbout            (wxCommandEvent& event);
+  void OnListboxSelect    (wxCommandEvent& event);
+  void OnCheckboxToggle   (wxCommandEvent& event);
+  void OnListboxDblClick  (wxCommandEvent& event);
+  bool OnClose            ()                        { return TRUE; }
+
+  DECLARE_EVENT_TABLE()
+
+private:
+  void InitMenu();
+
+  wxCheckListBox *m_pListBox;
+};
+
+enum 
+{ 
+  Menu_Quit = 1, 
+  Menu_First = 100,
+  Menu_Test1, Menu_Test2, Menu_Test3, 
+  Menu_Bitmap, Menu_Bitmap2, 
+  Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3,
+  Control_First = 1000,
+  Control_Listbox, Control_Listbox2,
+};
+
+BEGIN_EVENT_TABLE(OwnerDrawnFrame, wxFrame)
+  EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit)
+  EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect)
+  EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle)
+  EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 
+              OwnerDrawnFrame::OnListboxDblClick)
+END_EVENT_TABLE()
+
+IMPLEMENT_APP(OwnerDrawnApp);
+
+// init our app: create windows
+bool OwnerDrawnApp::OnInit(void)
+{
+  OwnerDrawnFrame *pFrame = new OwnerDrawnFrame(NULL, "wxWindows Ownerdraw Sample",
+                                                50, 50, 450, 340);
+  SetTopWindow(pFrame);
+
+  return TRUE;
+}
+
+// create the menu bar for the main frame
+void OwnerDrawnFrame::InitMenu()
+{
+  // Make a menubar
+  wxMenu *file_menu = new wxMenu,
+         *sub_menu  = new wxMenu;
+
+  // vars used for menu construction
+  wxMenuItem *pItem;
+  wxFont fontLarge(18, wxROMAN, wxNORMAL, wxBOLD, FALSE),
+         fontUlined(12, wxDEFAULT, wxNORMAL, wxNORMAL, TRUE),
+         fontItalic(12, wxMODERN, wxITALIC, wxBOLD, FALSE),
+         // should be at least of the size of bitmaps
+         fontBmp(14, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
+
+  // sorry for my artistic skills...
+  wxBitmap bmpBell("bell"), bmpSound("sound"), bmpNoSound("nosound");
+
+  // construct submenu
+  pItem = new wxMenuItem(sub_menu, Menu_Sub1, "Submenu &first", "large", TRUE);
+  pItem->SetFont(fontLarge);
+  sub_menu->Append(pItem);
+  
+  pItem = new wxMenuItem(sub_menu, Menu_Sub2, "Submenu &second", "italic", TRUE);
+  pItem->SetFont(fontItalic);
+  sub_menu->Append(pItem);
+  
+  pItem = new wxMenuItem(sub_menu, Menu_Sub3, "Submenu &third", "underlined", TRUE);
+  pItem->SetFont(fontUlined);
+  sub_menu->Append(pItem);
+  
+  // construct menu
+  pItem = new wxMenuItem(file_menu, Menu_Test1, "&Uncheckable", "red item");
+  pItem->SetFont(*wxITALIC_FONT);
+  pItem->SetTextColour(wxColor(255, 0, 0));
+  pItem->SetMarginWidth(23);
+  file_menu->Append(pItem);
+
+  pItem = new wxMenuItem(file_menu, Menu_Test2, "&Checkable", "checkable item", TRUE);
+  pItem->SetFont(*wxSMALL_FONT);
+  file_menu->Append(pItem);
+  file_menu->Check(Menu_Test2, TRUE);
+
+  pItem = new wxMenuItem(file_menu, Menu_Test3, "&Disabled", "disabled item");
+  pItem->SetFont(*wxNORMAL_FONT);
+  file_menu->Append(pItem);
+  file_menu->Enable(Menu_Test3, FALSE);
+
+  file_menu->AppendSeparator();
+
+  pItem = new wxMenuItem(file_menu, Menu_Bitmap, "&Bell", "check/uncheck me!", TRUE);
+  pItem->SetFont(fontBmp);
+  pItem->SetBitmaps(bmpBell);
+  file_menu->Append(pItem);
+
+  pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und", "icon changes!", TRUE);
+  pItem->SetFont(fontBmp);
+  pItem->SetBitmaps(bmpSound, bmpNoSound);
+  file_menu->Append(pItem);
+
+  file_menu->AppendSeparator();
+
+  pItem = new wxMenuItem(file_menu, Menu_Submenu, "&Sub menu", "", TRUE, sub_menu);
+  pItem->SetFont(*wxSWISS_FONT);
+  file_menu->Append(pItem);
+
+  file_menu->AppendSeparator();
+  file_menu->Append(Menu_Quit, "&Quit", "Normal item");
+
+  wxMenuBar *menu_bar = new wxMenuBar;
+
+  menu_bar->Append(file_menu, "&File");
+  SetMenuBar(menu_bar);
+}
+
+// main frame constructor
+OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
+         : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
+{
+  // set the icon
+  SetIcon(wxIcon("mondrian"));
+
+  // create the menu
+  InitMenu();
+
+  // make a panel with some controls
+  wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0), 
+                                wxSize(400, 200), wxTAB_TRAVERSAL);
+
+  // check list box
+  static const char* aszChoices[] = { "Hello", "world", "and", 
+                                      "goodbye", "cruel", "world",
+                                      "-------", "owner-drawn", "listbox" };
+
+  wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
+  uint ui;
+  for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
+    astrChoices[ui] = aszChoices[ui];
+
+  m_pListBox = new wxCheckListBox
+                   (                                             
+                     pPanel,             // parent               
+                     Control_Listbox,    // control id           
+                     wxPoint(10, 10),    // listbox poistion     
+                     wxSize(200, 200),   // listbox size         
+                     WXSIZEOF(aszChoices), // number of strings    
+                     astrChoices         // array of strings
+                   );                                            
+                                                                            
+  delete [] astrChoices;
+
+  for ( ui = 0; ui < WXSIZEOF(aszChoices); ui += 2 ) {
+    m_pListBox->GetItem(ui)->SetBackgroundColour(wxColor(200, 200, 200));
+  }
+
+  m_pListBox->Check(2);
+
+  // normal (but owner-drawn) listbox
+  static const char* aszColors[] = { "Red", "Blue", "Pink",
+                                     "Green", "Yellow", 
+                                     "Black", "Violet"  };
+  struct { uint r, g, b; } aColors[] = { {255,0,0}, {0,0,255}, {255,128,192},
+                                        {0,255,0}, {255,255,128}, 
+                                        {0,0,0}, {128,0,255} };
+  astrChoices = new wxString[WXSIZEOF(aszColors)];
+  for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ )
+    astrChoices[ui] = aszColors[ui];
+
+  wxListBox *pListBox = new wxListBox
+                           (                                             
+                             pPanel,              // parent               
+                             Control_Listbox2,    // control id           
+                             wxPoint(220, 10),    // listbox poistion     
+                             wxDefaultSize,       // listbox size         
+                             WXSIZEOF(aszColors),   // number of strings    
+                             astrChoices,         // array of strings
+                             wxLB_OWNERDRAW,      // owner-drawn
+                             wxDefaultValidator,  // 
+                             wxListBoxNameStr
+                           );
+
+  for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ ) {
+    pListBox->GetItem(ui)->SetTextColour(wxColor(aColors[ui].r,
+                                                aColors[ui].g, 
+                                                aColors[ui].b));
+    // yellow on white is horrible...
+    if ( ui == 4 )
+      pListBox->GetItem(ui)->SetBackgroundColour(wxColor(0, 0, 0));
+    
+  }
+
+  // create the status line
+  const int widths[] = { -1, 60 };
+  CreateStatusBar(2);
+  SetStatusWidths(2, widths);
+  SetStatusText("no selection", 0);
+
+  Show(TRUE);
+}
+
+OwnerDrawnFrame::~OwnerDrawnFrame()
+{
+}
+
+void OwnerDrawnFrame::OnQuit(wxCommandEvent& event)
+{
+  Close(TRUE);
+}
+
+void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
+{
+  wxMessageDialog dialog(this, "Demo of owner-drawn controls\n"
+                         "About wxOwnerDrawn", wxYES_NO | wxCANCEL);
+  dialog.ShowModal();
+}
+
+void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
+{
+  wxString strSelection;
+  uint nSel = event.GetSelection();
+  strSelection.sprintf("item %d selected (%schecked)", nSel,
+                       m_pListBox->IsChecked(nSel) ? "" : "not ");
+  SetStatusText(strSelection);
+}
+
+void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
+{
+  wxString strSelection;
+  strSelection.sprintf("item %d double clicked", m_pListBox->GetSelection());
+  wxMessageDialog dialog(this, strSelection);
+  dialog.ShowModal();
+}
+
+void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
+{
+  wxString strSelection;
+  uint nItem = event.GetInt();
+  strSelection.sprintf("item %d was %schecked", nItem,
+                       m_pListBox->IsChecked(nItem) ? "" : "un");
+  SetStatusText(strSelection);
+}
\ No newline at end of file
diff --git a/samples/ownerdrw/ownerdrw.def b/samples/ownerdrw/ownerdrw.def
new file mode 100644 (file)
index 0000000..6f2236c
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         OWNERDRW
+DESCRIPTION  'Owner-draw sample'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4048
+STACKSIZE    16000
diff --git a/samples/ownerdrw/ownerdrw.rc b/samples/ownerdrw/ownerdrw.rc
new file mode 100644 (file)
index 0000000..bbc00bd
--- /dev/null
@@ -0,0 +1,6 @@
+mondrian ICON   "mondrian.ico"
+bell BITMAP "bell.bmp"
+sound BITMAP "sound.bmp"
+nosound BITMAP "nosound.bmp"
+#include "wx/msw/wx.rc"
+
diff --git a/samples/ownerdrw/sound.bmp b/samples/ownerdrw/sound.bmp
new file mode 100644 (file)
index 0000000..26f5f18
Binary files /dev/null and b/samples/ownerdrw/sound.bmp differ
diff --git a/samples/regtest/key1.ico b/samples/regtest/key1.ico
new file mode 100644 (file)
index 0000000..57a5209
Binary files /dev/null and b/samples/regtest/key1.ico differ
diff --git a/samples/regtest/key2.ico b/samples/regtest/key2.ico
new file mode 100644 (file)
index 0000000..082ff47
Binary files /dev/null and b/samples/regtest/key2.ico differ
diff --git a/samples/regtest/key3.ico b/samples/regtest/key3.ico
new file mode 100644 (file)
index 0000000..0cbb4c3
Binary files /dev/null and b/samples/regtest/key3.ico differ
diff --git a/samples/regtest/makefile.g95 b/samples/regtest/makefile.g95
new file mode 100644 (file)
index 0000000..5dc5b47
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for regtest example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/regtest.$(OBJSUFF) $(OBJDIR)/regtest_resources.$(OBJSUFF)
+
+all:    $(OBJDIR) regtest$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+regtest$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o regtest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/regtest.$(OBJSUFF):  regtest.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ regtest.$(SRCSUFF)
+
+$(OBJDIR)/regtest_resources.o:  regtest.rc
+       $(RESCOMP) -i regtest.rc -o $(OBJDIR)/regtest_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) regtest$(GUISUFFIX).exe core *.rsc *.res
diff --git a/samples/regtest/makefile.nt b/samples/regtest/makefile.nt
new file mode 100644 (file)
index 0000000..df589af
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds regtest example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+WXUSINGDLL=0
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\regtest
+PROGRAM=regtest
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/regtest/registry.ico b/samples/regtest/registry.ico
new file mode 100644 (file)
index 0000000..3ebfa3a
Binary files /dev/null and b/samples/regtest/registry.ico differ
diff --git a/samples/regtest/regtest.cpp b/samples/regtest/regtest.cpp
new file mode 100644 (file)
index 0000000..c9396bf
--- /dev/null
@@ -0,0 +1,834 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        registry.cpp
+// Purpose:     wxRegKey class demo
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     03.04.98
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+#include "wx/wxprec.h"
+
+#ifdef  __BORLANDC__
+  #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+  #include "wx/wx.h"
+#endif
+
+#include "wx/log.h"
+#include "wx/treectrl.h"
+#include "wx/msw/registry.h"
+
+// ----------------------------------------------------------------------------
+// application type
+// ----------------------------------------------------------------------------
+class RegApp : public wxApp
+{ 
+public:
+  bool OnInit(void);
+};
+
+// ----------------------------------------------------------------------------
+// image list with registry icons
+// ----------------------------------------------------------------------------
+class RegImageList : public wxImageList
+{
+public:
+  enum Icon
+  {
+    Root,
+    ClosedKey,
+    OpenedKey,
+    TextValue,
+    BinaryValue,
+  };
+
+  RegImageList();
+};
+
+// ----------------------------------------------------------------------------
+// our control
+// ----------------------------------------------------------------------------
+class RegTreeCtrl : public wxTreeCtrl
+{
+public:
+  // ctor & dtor
+  RegTreeCtrl(wxWindow *parent, wxWindowID id);
+  virtual ~RegTreeCtrl();
+
+  // notifications
+  void OnDeleteItem   (wxTreeEvent& event);
+  void OnItemExpanding(wxTreeEvent& event);
+  void OnSelChanged   (wxTreeEvent& event);
+
+  void OnRightClick   (wxMouseEvent& event);
+  void OnChar         (wxKeyEvent& event);
+
+  // forwarded notifications (by the frame)
+  void OnMenuTest();
+
+  // operations
+  void DeleteSelected();
+  void CreateNewKey(const wxString& strName);
+  void CreateNewTextValue(const wxString& strName);
+  void CreateNewBinaryValue(const wxString& strName);
+
+  // information
+  bool IsKeySelected() const;
+
+  DECLARE_EVENT_TABLE();
+
+private:
+  // array of children of the node
+  struct TreeNode;
+  WX_DEFINE_ARRAY(TreeNode *, TreeChildren);
+  
+  // structure describing a registry key/value
+  struct TreeNode
+  {
+    RegTreeCtrl  *m_pTree;     // must be !NULL
+    TreeNode     *m_pParent;    // NULL only for the root node
+    long          m_id;         // the id of the tree control item
+    wxString      m_strName;    // name of the key/value
+    TreeChildren  m_aChildren;  // array of subkeys/values
+    bool          m_bKey;       // key or value?
+    wxRegKey     *m_pKey;       // only may be !NULL if m_bKey == true
+    long          m_lDummy;     // dummy subkey (to make expansion possible)
+
+    // ctor
+    TreeNode() { m_lDummy = 0; }
+
+    // trivial accessors
+    long      Id()     const { return m_id;              }
+    bool      IsRoot() const { return m_pParent == NULL; }
+    bool      IsKey()  const { return m_bKey;            }
+    TreeNode *Parent() const { return m_pParent;         }
+
+    // notifications
+    bool OnExpand();
+    void OnCollapse();
+
+    // operations
+    void Refresh() { OnCollapse(); OnExpand(); }
+    void AddDummy();
+    void DestroyChildren();
+    const char *FullName() const;
+
+    // get the associated key: make sure the pointer is !NULL
+    wxRegKey& Key() { if ( !m_pKey ) OnExpand(); return *m_pKey; }
+
+    // dtor deletes all children
+    ~TreeNode();
+  };
+
+  wxMenu      *m_pMenuPopup;
+  TreeNode    *m_pRoot;
+  wxImageList *m_imageList;
+
+  TreeNode *GetNode(const wxTreeEvent& event)
+    { return (TreeNode *)GetItemData(event.m_item.m_itemId); }
+
+public:
+  // create a new node and insert it to the tree
+  TreeNode *InsertNewTreeNode(TreeNode *pParent, 
+                              const wxString& strName,
+                              int idImage = RegImageList::ClosedKey,
+                              const wxString *pstrValue = NULL);
+  // add standard registry keys
+  void AddStdKeys();
+};
+
+// ----------------------------------------------------------------------------
+// the main window of our application
+// ----------------------------------------------------------------------------
+class RegFrame : public wxFrame
+{ 
+public:
+  // ctor & dtor
+  RegFrame(wxFrame *parent, char *title, int x, int y, int w, int h);
+  virtual ~RegFrame(void);
+    
+  // callbacks
+  void OnQuit (wxCommandEvent& event);
+  void OnAbout(wxCommandEvent& event);
+  void OnTest (wxCommandEvent& event);
+
+  void OnExpand  (wxCommandEvent& event);
+  void OnCollapse(wxCommandEvent& event);
+  void OnToggle  (wxCommandEvent& event);
+
+  void OnDelete   (wxCommandEvent& event);
+  void OnNewKey   (wxCommandEvent& event);
+  void OnNewText  (wxCommandEvent& event);
+  void OnNewBinary(wxCommandEvent& event);
+
+  bool OnClose  () { return TRUE; }
+
+  DECLARE_EVENT_TABLE();
+
+private:
+  RegTreeCtrl *m_treeCtrl;
+};
+
+// ----------------------------------------------------------------------------
+// various ids
+// ----------------------------------------------------------------------------
+
+enum
+{
+  Menu_Quit     = 100,
+  Menu_About,
+  Menu_Test,
+  Menu_Expand,
+  Menu_Collapse,
+  Menu_Toggle,
+  Menu_New,
+  Menu_NewKey,  
+  Menu_NewText, 
+  Menu_NewBinary,
+  Menu_Delete,
+
+  Ctrl_RegTree  = 200,
+};
+
+// ----------------------------------------------------------------------------
+// event tables
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(RegFrame, wxFrame)
+  EVT_MENU(Menu_Test,     RegFrame::OnTest)
+  EVT_MENU(Menu_About,    RegFrame::OnAbout)
+  EVT_MENU(Menu_Quit,     RegFrame::OnQuit)
+  EVT_MENU(Menu_Expand,   RegFrame::OnExpand)
+  EVT_MENU(Menu_Collapse, RegFrame::OnCollapse)
+  EVT_MENU(Menu_Toggle,   RegFrame::OnToggle)
+  EVT_MENU(Menu_Delete,   RegFrame::OnDelete)
+  EVT_MENU(Menu_NewKey,   RegFrame::OnNewKey)
+  EVT_MENU(Menu_NewText,  RegFrame::OnNewText)
+  EVT_MENU(Menu_NewBinary,RegFrame::OnNewBinary)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(RegTreeCtrl, wxTreeCtrl)
+  EVT_TREE_DELETE_ITEM   (Ctrl_RegTree, RegTreeCtrl::OnDeleteItem)
+  EVT_TREE_ITEM_EXPANDING(Ctrl_RegTree, RegTreeCtrl::OnItemExpanding)
+  EVT_TREE_SEL_CHANGED   (Ctrl_RegTree, RegTreeCtrl::OnSelChanged)
+
+  EVT_CHAR      (RegTreeCtrl::OnChar)
+  EVT_RIGHT_DOWN(RegTreeCtrl::OnRightClick)
+END_EVENT_TABLE()
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// create the "registry operations" menu
+wxMenu *CreateRegistryMenu()
+{
+  wxMenu *pMenuNew = new wxMenu;
+  pMenuNew->Append(Menu_NewKey,    "&Key",          "Create a new key");
+  pMenuNew->AppendSeparator();
+  pMenuNew->Append(Menu_NewText,   "&Text value",   "Create a new text value");
+  pMenuNew->Append(Menu_NewBinary, "&Binary value", "Create a new binary value");
+
+  wxMenu *pMenuReg = new wxMenu;
+  pMenuReg->Append(Menu_New, "&New", pMenuNew);
+  pMenuReg->Append(Menu_Delete,   "&Delete...", "Delete selected key/value");
+  pMenuReg->AppendSeparator();
+  pMenuReg->Append(Menu_Expand,   "&Expand",    "Expand current key");
+  pMenuReg->Append(Menu_Collapse, "&Collapse",  "Collapse current key");
+  pMenuReg->Append(Menu_Toggle,   "&Toggle",    "Toggle current key");
+
+  return pMenuReg;
+}
+
+// ----------------------------------------------------------------------------
+// application class
+// ----------------------------------------------------------------------------
+IMPLEMENT_APP(RegApp)
+
+// `Main program' equivalent, creating windows and returning main app frame
+bool RegApp::OnInit()
+{
+  // create the main frame window and show it
+  RegFrame *frame = new RegFrame(NULL, "wxRegKey Test", 50, 50, 600, 350);
+  frame->Show(true);
+  
+  SetTopWindow(frame);
+
+  return true;
+}
+
+// ----------------------------------------------------------------------------
+// RegFrame
+// ----------------------------------------------------------------------------
+
+RegFrame::RegFrame(wxFrame *parent, char *title, int x, int y, int w, int h)
+        : wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h))
+{
+  // this reduces flicker effects
+  SetBackgroundColour(wxColour(255, 255, 255));
+
+  // set the icon
+  // ------------
+  SetIcon(wxIcon("app_icon"));
+
+  // create menu
+  // -----------
+  wxMenu *pMenuFile = new wxMenu;
+  pMenuFile->Append(Menu_Test, "Te&st", "Test key creation");
+  pMenuFile->AppendSeparator();
+  pMenuFile->Append(Menu_About, "&About...", "Show an extraordinarly beautiful dialog");
+  pMenuFile->AppendSeparator();
+  pMenuFile->Append(Menu_Quit,  "E&xit", "Quit this program");
+
+  wxMenuBar *pMenu = new wxMenuBar;
+  pMenu->Append(pMenuFile, "&File");
+  pMenu->Append(CreateRegistryMenu(),  "&Registry");
+  SetMenuBar(pMenu);
+
+  // create child controls
+  // ---------------------
+  m_treeCtrl = new RegTreeCtrl(this, Ctrl_RegTree);
+
+  // create the status line
+  // ----------------------
+  int aWidths[2];
+  aWidths[0] = 200;
+  aWidths[1] = -1;
+  CreateStatusBar(2);
+  SetStatusWidths(2, aWidths);
+}
+
+RegFrame::~RegFrame(void)
+{
+}
+
+void RegFrame::OnQuit(wxCommandEvent& event)
+{
+  Close(TRUE);
+}
+
+void RegFrame::OnAbout(wxCommandEvent& event)
+{
+  wxMessageDialog dialog(this, "wxRegistry sample\n(c) 1998 Vadim Zeitlin",
+                         "About wxRegistry", wxOK);
+
+  dialog.ShowModal();
+}
+
+void RegFrame::OnTest(wxCommandEvent& event)
+{
+  m_treeCtrl->OnMenuTest();
+}
+
+void RegFrame::OnExpand(wxCommandEvent& event)
+{
+  m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_EXPAND);
+}
+
+void RegFrame::OnCollapse(wxCommandEvent& event)
+{
+  m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_COLLAPSE);
+}
+
+void RegFrame::OnToggle(wxCommandEvent& event)
+{
+  m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_TOGGLE);
+}
+
+void RegFrame::OnDelete(wxCommandEvent& event)
+{
+  m_treeCtrl->DeleteSelected();
+}
+
+void RegFrame::OnNewKey(wxCommandEvent& event)
+{
+  if ( m_treeCtrl->IsKeySelected() ) {
+    m_treeCtrl->CreateNewKey(
+      wxGetTextFromUser("Enter the name of the new key"));
+  }
+}
+
+void RegFrame::OnNewText(wxCommandEvent& event)
+{
+  if ( m_treeCtrl->IsKeySelected() ) {
+    m_treeCtrl->CreateNewTextValue(
+      wxGetTextFromUser("Enter the name for the new text value"));
+  }
+}
+
+void RegFrame::OnNewBinary(wxCommandEvent& event)
+{
+  if ( m_treeCtrl->IsKeySelected() ) {
+    m_treeCtrl->CreateNewBinaryValue(
+      wxGetTextFromUser("Enter the name for the new binary value"));
+  }
+}
+
+// ----------------------------------------------------------------------------
+// RegImageList
+// ----------------------------------------------------------------------------
+RegImageList::RegImageList() : wxImageList(16, 16, TRUE)
+{
+  // should be in sync with enum RegImageList::RegIcon
+  static const char *aszIcons[] = { "key1","key2","key3","value1","value2" };
+  wxString str = "icon_";
+  for ( uint n = 0; n < WXSIZEOF(aszIcons); n++ ) {
+    Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE));
+  }
+}
+
+// ----------------------------------------------------------------------------
+// RegTreeCtrl
+// ----------------------------------------------------------------------------
+
+// create a new tree item and insert it into the tree
+RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(TreeNode *pParent, 
+                                                      const wxString& strName,
+                                                      int idImage,
+                                                      const wxString *pstrValue)
+{
+  // create new item & insert it
+  TreeNode *pNewNode = new TreeNode;
+  pNewNode->m_pTree  = this;
+  pNewNode->m_pParent = pParent;
+  pNewNode->m_strName = strName;
+  pNewNode->m_bKey    = pstrValue == NULL;
+  pNewNode->m_pKey    = NULL;
+  pNewNode->m_id      = InsertItem(pParent ? pParent->m_id : 0, 
+                                   pNewNode->IsKey() ? strName : *pstrValue,
+                                   idImage);
+
+  wxASSERT_MSG( pNewNode->m_id, "can't create tree control item!");
+
+  // save the pointer in the item
+  if ( !SetItemData(pNewNode->m_id, (long)pNewNode) ) {
+    wxFAIL_MSG("can't store item's data in tree control!");
+  }
+
+  // add it to the list of parent's children
+  if ( pParent != NULL ) {
+    pParent->m_aChildren.Add(pNewNode);
+  }
+
+  // force the [+] button (@@@ not very elegant...)
+  if ( pNewNode->IsKey() )
+    pNewNode->AddDummy();
+
+  return pNewNode;
+}
+
+RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id)
+           : wxTreeCtrl(parent, id, wxDefaultPosition, wxDefaultSize, 
+                        wxTR_HAS_BUTTONS | wxSUNKEN_BORDER)
+{
+  // create the image list
+  // ---------------------
+  m_imageList = new RegImageList;
+  SetImageList(m_imageList, wxIMAGE_LIST_NORMAL);
+
+  // create root keys
+  // ----------------
+  m_pRoot = InsertNewTreeNode(NULL, "Registry Root", RegImageList::Root);
+
+  // create popup menu
+  // -----------------
+  m_pMenuPopup = CreateRegistryMenu();
+}
+
+RegTreeCtrl::~RegTreeCtrl()
+{
+  delete m_pMenuPopup;
+  delete m_pRoot;
+  delete m_imageList;
+}
+
+void RegTreeCtrl::AddStdKeys()
+{
+  for ( uint ui = 0; ui < wxRegKey::nStdKeys; ui++ ) {
+    InsertNewTreeNode(m_pRoot, wxRegKey::GetStdKeyName(ui));
+  }
+}
+
+// ----------------------------------------------------------------------------
+// notifications
+// ----------------------------------------------------------------------------
+
+void RegTreeCtrl::OnRightClick(wxMouseEvent& event)
+{
+  int iFlags;
+  long lId = HitTest(wxPoint(event.GetX(), event.GetY()), iFlags);
+  if ( iFlags & wxTREE_HITTEST_ONITEMLABEL ) {
+    // popup menu only if an item was clicked
+    wxASSERT( lId != 0 );
+    SelectItem(lId);
+    PopupMenu(m_pMenuPopup, event.GetX(), event.GetY());
+  }
+}
+
+
+void RegTreeCtrl::OnDeleteItem(wxTreeEvent& event)
+{
+}
+
+// test the key creation functions
+void RegTreeCtrl::OnMenuTest()
+{
+  long lId = GetSelection();
+  TreeNode *pNode = (TreeNode *)GetItemData(lId);
+
+  wxCHECK( pNode != NULL );
+
+  if ( pNode->IsRoot() ) {
+    wxLogError("Can't create a subkey under the root key.");
+    return;
+  }
+  if ( !pNode->IsKey() ) {
+    wxLogError("Can't create a subkey under a value!");
+    return;
+  }
+
+  wxRegKey key1(pNode->Key(), "key1");
+  if ( key1.Create() ) {
+    wxRegKey key2a(key1, "key2a"), key2b(key1, "key2b");
+    if ( key2a.Create() && key2b.Create() ) {
+      // put some values under the newly created keys
+      key1.SetValue("first_term", "10");
+      key1.SetValue("second_term", "7");
+      key2a = "this is the unnamed value";
+      key2b.SetValue("sum", 17);
+
+      // refresh tree
+      pNode->Refresh();
+      wxLogStatus("Test keys successfully added.");
+      return;
+    }
+  }
+  
+  wxLogError("Creation of test keys failed.");
+}
+
+void RegTreeCtrl::OnChar(wxKeyEvent& event)
+{
+  if ( event.KeyCode() == WXK_DELETE )
+    DeleteSelected();
+  else
+    wxTreeCtrl::OnChar(event);
+}
+
+void RegTreeCtrl::OnSelChanged(wxTreeEvent& event)
+{
+  wxFrame *pFrame = (wxFrame *)(wxWindow::GetParent());
+  pFrame->SetStatusText(GetNode(event)->FullName(), 1);
+}
+
+void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)
+{
+  TreeNode *pNode = GetNode(event);
+  bool bExpanding = event.m_code == wxTREE_EXPAND_EXPAND;
+
+  // expansion might take some time
+  wxSetCursor(*wxHOURGLASS_CURSOR);
+  wxLogStatus("Working...");
+  wxYield();  // to give the status line a chance to refresh itself
+
+  if ( pNode->IsKey() ) {
+    if ( bExpanding ) {
+      // expanding: add subkeys/values
+      if ( !pNode->OnExpand() )
+        return;
+    }
+    else {
+      // collapsing: clean up
+      pNode->OnCollapse();
+    }
+
+    // change icon for non root key
+    if ( !pNode->IsRoot() ) {
+      int idIcon = bExpanding ? RegImageList::OpenedKey 
+                              : RegImageList::ClosedKey;
+      SetItemImage(pNode->Id(), idIcon, idIcon);
+    }
+  }
+
+  wxLogStatus("Ok");
+  wxSetCursor(*wxSTANDARD_CURSOR);
+}
+
+// ----------------------------------------------------------------------------
+// TreeNode implementation
+// ----------------------------------------------------------------------------
+bool RegTreeCtrl::TreeNode::OnExpand()
+{
+  // remove dummy item
+  if ( m_lDummy != 0 )
+    m_pTree->DeleteItem(m_lDummy);
+
+  if ( IsRoot() ) {
+    // we're the root key
+    m_pTree->AddStdKeys();
+    return true;
+  }
+
+  if ( Parent()->IsRoot() ) {
+    // we're a standard key
+    m_pKey = new wxRegKey(m_strName);
+  }
+  else {
+    // we're a normal key
+    m_pKey = new wxRegKey(*(Parent()->m_pKey), m_strName);
+  }
+
+  if ( !m_pKey->Open() ) {
+    m_lDummy = 0;
+    wxLogError("The key '%s' can't be opened.", FullName());
+    return false;
+  }
+
+  // enumeration variables
+  long l;
+  wxString str;
+  bool bCont;
+
+  // enumerate all subkeys
+  bCont = m_pKey->GetFirstKey(str, l);
+  while ( bCont ) {
+    m_pTree->InsertNewTreeNode(this, str, RegImageList::ClosedKey);
+    bCont = m_pKey->GetNextKey(str, l);
+  }
+
+  // enumerate all values
+  bCont = m_pKey->GetFirstValue(str, l);
+  while ( bCont ) {
+    wxString strItem;
+    if (str.IsEmpty())
+        strItem = "<default>";
+    else
+        strItem = str;
+    strItem += " = ";
+
+    // determine the appropriate icon
+    RegImageList::Icon icon;
+    switch ( m_pKey->GetValueType(str) ) {
+      case wxRegKey::Type_String:
+      case wxRegKey::Type_Expand_String:
+      case wxRegKey::Type_Multi_String:
+        {
+          wxString strValue;
+          icon = RegImageList::TextValue;
+          m_pKey->QueryValue(str, strValue);
+          strItem += strValue;
+        }
+        break;
+
+      case wxRegKey::Type_None:
+        // @@ handle the error...
+        icon = RegImageList::BinaryValue;
+        break;
+
+      case wxRegKey::Type_Dword:
+        {
+          char szBuf[128];
+          long l;
+          m_pKey->QueryValue(str, &l);
+          sprintf(szBuf, "%lx", l);
+          strItem += szBuf;
+        }
+
+        // fall through
+
+      default:
+        icon = RegImageList::BinaryValue;
+    }
+
+    m_pTree->InsertNewTreeNode(this, str, icon, &strItem);
+    bCont = m_pKey->GetNextValue(str, l);
+  }
+
+  return true;
+}
+
+void RegTreeCtrl::TreeNode::OnCollapse()
+{
+  bool bHasChildren = !m_aChildren.IsEmpty();
+  DestroyChildren();
+  if ( bHasChildren )
+    AddDummy();
+  else
+    m_lDummy = 0;
+
+  delete m_pKey;
+  m_pKey = NULL;
+}
+
+void RegTreeCtrl::TreeNode::AddDummy()
+{
+  // insert dummy item forcing appearance of [+] button
+  m_lDummy = m_pTree->InsertItem(Id(), "");
+}
+
+void RegTreeCtrl::TreeNode::DestroyChildren()
+{
+  // destroy all children
+  uint nCount = m_aChildren.Count();
+  for ( uint n = 0; n < nCount; n++ ) {
+    long lId = m_aChildren[n]->Id();
+    delete m_aChildren[n];
+    m_pTree->DeleteItem(lId);
+  }
+
+  m_aChildren.Empty();
+}
+
+RegTreeCtrl::TreeNode::~TreeNode()
+{
+  DestroyChildren();
+
+  delete m_pKey;
+}
+
+const char *RegTreeCtrl::TreeNode::FullName() const
+{
+  static wxString s_strName;
+
+  if ( IsRoot() ) {
+    return "Registry Root";
+  }
+  else {
+    // our own registry key might not (yet) exist or we might be a value, 
+    // so just use the parent's and concatenate
+    s_strName = Parent()->FullName();
+    s_strName << '\\' << m_strName;
+
+    return s_strName;
+  }
+}
+
+// ----------------------------------------------------------------------------
+// operations on RegTreeCtrl
+// ----------------------------------------------------------------------------
+
+void RegTreeCtrl::DeleteSelected()
+{
+  long lCurrent = GetSelection(),
+       lParent  = GetParent(lCurrent);
+
+  if ( lParent == 0 ) {
+    wxLogError("Can't delete root key.");
+    return;
+  }
+
+  TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent),
+           *pParent  = (TreeNode *)GetItemData(lParent);
+
+  wxCHECK ( pCurrent && pParent );
+
+  if ( pParent->IsRoot() ) {
+    wxLogError("Can't delete standard key.");
+    return;
+  }
+
+  if ( pCurrent->IsKey() ) {
+    if ( wxMessageBox("Do you really want to delete this key?",
+                      "Confirmation", 
+                      wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
+      return;
+    }
+
+    // must close key before deleting it
+    pCurrent->OnCollapse();
+
+    if ( pParent->Key().DeleteKey(pCurrent->m_strName) )
+      pParent->Refresh();
+  }
+  else {
+    if ( wxMessageBox("Do you really want to delete this value?",
+                      "Confirmation", 
+                      wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
+      return;
+    }
+
+    if ( pParent->Key().DeleteValue(pCurrent->m_strName) )
+      pParent->Refresh();
+  }
+}
+
+void RegTreeCtrl::CreateNewKey(const wxString& strName)
+{
+  long lCurrent = GetSelection();
+  TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
+
+  wxCHECK( pCurrent != NULL );
+  
+  wxASSERT( pCurrent->IsKey() );  // check must have been done before
+
+  if ( pCurrent->IsRoot() ) {
+    wxLogError("Can't create a new key under the root key.");
+    return;
+  }
+
+  wxRegKey key(pCurrent->Key(), strName);
+  if ( key.Create() )
+    pCurrent->Refresh();
+}
+
+void RegTreeCtrl::CreateNewTextValue(const wxString& strName)
+{
+  long lCurrent = GetSelection();
+  TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
+
+  wxCHECK( pCurrent != NULL );
+  
+  wxASSERT( pCurrent->IsKey() );  // check must have been done before
+
+  if ( pCurrent->IsRoot() ) {
+    wxLogError("Can't create a new value under the root key.");
+    return;
+  }
+
+  if ( pCurrent->Key().SetValue(strName, "") )
+    pCurrent->Refresh();
+}
+
+void RegTreeCtrl::CreateNewBinaryValue(const wxString& strName)
+{
+  long lCurrent = GetSelection();
+  TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
+
+  wxCHECK( pCurrent != NULL );
+  
+  wxASSERT( pCurrent->IsKey() );  // check must have been done before
+
+  if ( pCurrent->IsRoot() ) {
+    wxLogError("Can't create a new value under the root key.");
+    return;
+  }
+
+  if ( pCurrent->Key().SetValue(strName, 0) )
+    pCurrent->Refresh();
+}
+
+bool RegTreeCtrl::IsKeySelected() const
+{
+  long lCurrent = GetSelection();
+  TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
+
+  wxCHECK_RET( pCurrent != NULL, false );
+
+  return pCurrent->IsKey();
+}
\ No newline at end of file
diff --git a/samples/regtest/regtest.rc b/samples/regtest/regtest.rc
new file mode 100644 (file)
index 0000000..8d688bb
--- /dev/null
@@ -0,0 +1,9 @@
+#include "wx/msw/wx.rc"
+
+app_icon       ICON "registry.ico"
+icon_key1      ICON "key1.ico"
+icon_key2      ICON "key2.ico"
+icon_key3      ICON "key3.ico"
+icon_value1    ICON "value1.ico"
+icon_value2    ICON "value2.ico"
+
diff --git a/samples/regtest/value1.ico b/samples/regtest/value1.ico
new file mode 100644 (file)
index 0000000..d03a5d0
Binary files /dev/null and b/samples/regtest/value1.ico differ
diff --git a/samples/regtest/value2.ico b/samples/regtest/value2.ico
new file mode 100644 (file)
index 0000000..343fd1a
Binary files /dev/null and b/samples/regtest/value2.ico differ
diff --git a/samples/taskbar/makefile.b32 b/samples/taskbar/makefile.b32
new file mode 100644 (file)
index 0000000..497d911
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds tab example
+
+# WXWIN and BCCDIR are set by parent make
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makeb32.env
+
+WXLIBDIR = $(WXDIR)\lib
+WXINC = $(WXDIR)\include\msw
+WXLIB = $(WXLIBDIR)\wx32.lib
+LIBS=$(WXLIB) cw32 import32 ole2w32
+
+TARGET=tbtest
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS =
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = tbtest.obj
+
+$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res
+  tlink32 $(LINKFLAGS) @&&!
+c0w32.obj $(OBJECTS)
+$(TARGET)
+nul
+$(LIBS)
+$(TARGET).def
+!
+        brc32 -K $(TARGET).res
+
+.$(SRCSUFF).obj:
+       bcc32 $(CPPFLAGS) -c {$< }
+
+.c.obj:
+       bcc32 $(CPPFLAGS) -P- -c {$< }
+
+tbtest.obj:      tbtest.$(SRCSUFF)
+
+$(TARGET).res :      $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
+    brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
+
diff --git a/samples/taskbar/makefile.bcc b/samples/taskbar/makefile.bcc
new file mode 100644 (file)
index 0000000..aa2c61b
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# File:                makefile.bcc
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds tbtest example (DOS).
+
+!if "$(BCCDIR)" == ""
+!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
+!endif
+
+!if "$(WXWIN)" == ""
+!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
+!endif
+
+WXDIR = $(WXWIN)
+!include $(WXDIR)\src\makebcc.env
+
+THISDIR = $(WXDIR)\samples\taskbar
+WXLIB = $(WXDIR)\lib\wx.lib
+LIBS=$(WXLIB) mathwl cwl import
+INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw
+CFG=$(WXDIR)\src\wxwin.cfg
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+!if "$(FINAL)" == "0"
+LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -Od
+DEBUG_FLAGS= -v
+!else
+LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
+OPT = -O2
+DEBUG_FLAGS=
+!endif
+CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
+
+OBJECTS = tbtest.obj
+
+tbtest:    tbtest.exe
+
+all:    tbtest.exe
+
+tbtest.exe:    $(WXLIB) tbtest.obj tbtest.def tbtest.res
+        tlink $(LINKFLAGS) @&&!
+c0wl.obj tbtest.obj
+tbtest
+nul
+$(LIBS)
+tbtest.def
+!
+        rc -31 -K tbtest.res
+
+.$(SRCSUFF).obj:
+       bcc $(CPPFLAGS) -c {$< }
+
+tbtest.obj:      tbtest.$(SRCSUFF)
+
+tbtest.res :      tbtest.rc $(WXDIR)\include\msw\wx.rc
+    rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa tbtest
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.rws
diff --git a/samples/taskbar/makefile.dos b/samples/taskbar/makefile.dos
new file mode 100644 (file)
index 0000000..1872f14
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# File:                makefile.dos
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds taskbar example (DOS).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+WXDIR = $(WXWIN)
+
+!include $(WXDIR)\src\makemsc.env
+
+THISDIR = $(WXDIR)\samples\taskbar
+
+!ifndef FINAL
+FINAL=0
+!endif
+
+HEADERS =
+SOURCES = tbtest.$(SRCSUFF)
+OBJECTS = tbtest.obj
+
+all:    tbtest.exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.dos clean
+        cd $(THISDIR)
+
+tbtest.exe:      $(WXDIR)\src\msw\dummy.obj $(WXLIB) tbtest.obj tbtest.def tbtest.res
+        link $(LINKFLAGS) @<<
+tbtest.obj $(WXDIR)\src\msw\dummy.obj,
+tbtest,
+NUL,
+$(LIBS),
+tbtest.def
+;
+<<
+        rc -K tbtest.res
+
+tbtest.obj:      tbtest.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+tbtest.res :      tbtest.rc $(WXDIR)\include\wx\msw\wx.rc
+    rc -r /i$(WXDIR)\include tbtest
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/taskbar/makefile.g95 b/samples/taskbar/makefile.g95
new file mode 100644 (file)
index 0000000..a26fef6
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# File:                makefile.unx
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for taskbar example
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/tbtest.$(OBJSUFF) $(OBJDIR)/tbtest_resources.$(OBJSUFF)
+
+all:    $(OBJDIR) tbtest$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+tbtest$(GUISUFFIX)$(EXESUFF):  $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o tbtest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/tbtest.$(OBJSUFF):   tbtest.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ tbtest.$(SRCSUFF)
+
+$(OBJDIR)/tbtest_resources.o:  tbtest.rc
+       $(RESCOMP) -i tbtest.rc -o $(OBJDIR)/tbtest_resources.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) tbtest$(GUISUFFIX).exe core *.rsc *.res
diff --git a/samples/taskbar/makefile.nt b/samples/taskbar/makefile.nt
new file mode 100644 (file)
index 0000000..459749a
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds tab example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+WXUSINGDLL=0
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\samples\taskbar
+PROGRAM=tbtest
+
+OBJECTS = $(PROGRAM).obj
+
+$(PROGRAM):    $(PROGRAM).exe
+
+all:    wx $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(PROGRAM).exe:      $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
+       $(link) @<<
+-out:$(PROGRAM).exe
+$(LINKFLAGS)
+$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
+$(LIBS)
+<<
+
+
+$(PROGRAM).obj:      $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
diff --git a/samples/taskbar/mondrian.ico b/samples/taskbar/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/samples/taskbar/mondrian.ico differ
diff --git a/samples/taskbar/tbtest.cpp b/samples/taskbar/tbtest.cpp
new file mode 100644 (file)
index 0000000..7618108
--- /dev/null
@@ -0,0 +1,120 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        tbtest.cpp
+// Purpose:     wxTaskBarIcon demo
+// Author:      Julian Smart
+// Modified by:
+// Created:     01/02/97
+// RCS-ID:      $Id$
+// Copyright:   (c)
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx.h"
+#endif
+
+#include "wx/msw/taskbar.h"
+#include "tbtest.h"
+
+// Declare two frames
+MyDialog   *dialog = NULL;
+
+IMPLEMENT_APP(MyApp)
+
+bool MyApp::OnInit(void)
+{
+    wxIcon icon("mondrian_icon");
+
+    if (!m_taskBarIcon.SetIcon(icon, "wxTaskBarIcon Sample"))
+        wxMessageBox("Could not set icon.");
+
+    // Create the main frame window
+    dialog = new MyDialog(NULL, -1, "wxTaskBarIcon Test Dialog", wxPoint(-1, -1), wxSize(365, 290), wxDIALOG_MODELESS|wxDEFAULT_DIALOG_STYLE);
+
+    dialog->Show(TRUE);
+
+    return TRUE;
+}
+
+BEGIN_EVENT_TABLE(MyDialog, wxDialog)
+    EVT_BUTTON(wxID_OK, MyDialog::OnOK)
+    EVT_BUTTON(wxID_EXIT, MyDialog::OnExit)
+END_EVENT_TABLE()
+
+MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
+    const wxPoint& pos, const wxSize& size, const long windowStyle):
+  wxDialog(parent, id, title, pos, size, windowStyle)
+{
+    Init();
+}
+
+void MyDialog::OnOK(wxCommandEvent& event)
+{
+    Show(FALSE);
+}
+
+void MyDialog::OnExit(wxCommandEvent& event)
+{
+    Close(TRUE);
+}
+
+void MyDialog::OnCloseWindow(wxCloseEvent& event)
+{
+    Destroy();
+}
+
+void MyDialog::Init(void)
+{
+  int dialogWidth = 365;
+  int dialogHeight = 290;
+
+  wxStaticText* stat = new wxStaticText(this, -1, "Press OK to hide me, Exit to quit.",
+    wxPoint(10, 20));
+  
+  wxStaticText* stat2 = new wxStaticText(this, -1, "Double-click on the taskbar icon to show me again.",
+    wxPoint(10, 40));
+
+  wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(100, 230), wxSize(80, 25));
+  wxButton *exitButton = new wxButton(this, wxID_EXIT, "Exit", wxPoint(185, 230), wxSize(80, 25));
+  okButton->SetDefault();
+  this->Centre(wxBOTH);
+}
+
+// Overridables
+void MyTaskBarIcon::OnMouseMove(void)
+{
+}
+
+void MyTaskBarIcon::OnLButtonDown(void)
+{
+}
+
+void MyTaskBarIcon::OnLButtonUp(void)
+{
+}
+
+void MyTaskBarIcon::OnRButtonDown(void)
+{
+}
+
+void MyTaskBarIcon::OnRButtonUp(void)
+{
+}
+
+void MyTaskBarIcon::OnLButtonDClick(void)
+{
+    dialog->Show(TRUE);
+}
+
+void MyTaskBarIcon::OnRButtonDClick(void)
+{
+}
+
+
diff --git a/samples/taskbar/tbtest.def b/samples/taskbar/tbtest.def
new file mode 100644 (file)
index 0000000..db80cc8
--- /dev/null
@@ -0,0 +1,8 @@
+NAME         TBTest
+DESCRIPTION  'wxTaskBarIcon test'
+EXETYPE      WINDOWS
+STUB         'WINSTUB.EXE'
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     1024
+STACKSIZE    16192
diff --git a/samples/taskbar/tbtest.h b/samples/taskbar/tbtest.h
new file mode 100644 (file)
index 0000000..a1a01e3
--- /dev/null
@@ -0,0 +1,50 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        tbtest.h
+// Purpose:     wxTaskBarIcon sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     01/02/97
+// RCS-ID:      $Id$
+// Copyright:   (c)
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+class MyTaskBarIcon: public wxTaskBarIcon
+{
+public:
+       MyTaskBarIcon() {};
+
+    virtual void OnMouseMove(void);
+    virtual void OnLButtonDown(void);
+    virtual void OnLButtonUp(void);
+    virtual void OnRButtonDown(void);
+    virtual void OnRButtonUp(void);
+    virtual void OnLButtonDClick(void);
+    virtual void OnRButtonDClick(void);
+};
+
+
+// Define a new application
+class MyApp: public wxApp
+{
+public:
+    bool OnInit(void);
+protected:
+    MyTaskBarIcon   m_taskBarIcon;
+};
+
+class MyDialog: public wxDialog
+{
+public:
+    MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
+        const wxPoint& pos, const wxSize& size, const long windowStyle = wxDEFAULT_DIALOG_STYLE);
+
+    void OnOK(wxCommandEvent& event);
+    void OnExit(wxCommandEvent& event);
+    void OnCloseWindow(wxCloseEvent& event);
+    void Init(void);
+
+DECLARE_EVENT_TABLE()
+};
+
+
diff --git a/samples/taskbar/tbtest.rc b/samples/taskbar/tbtest.rc
new file mode 100644 (file)
index 0000000..a05f210
--- /dev/null
@@ -0,0 +1,3 @@
+mondrian_icon ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
diff --git a/src/msw/ctl3d/borland/makefile.b32 b/src/msw/ctl3d/borland/makefile.b32
new file mode 100644 (file)
index 0000000..1783689
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# File:                makefile.b32
+# Author:       Andre Beltman
+# Created:     1995
+# Updated:     
+# Copyright:    (c) 1995, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Imports 32bit ctl3d library for Windows 95
+# and Borland C++ 4.x
+
+WXDIR = $(WXWIN)
+WXLIB = $(WXDIR)\lib
+
+LIBTARGET= $(WXLIB)\ctl3d32.lib
+
+all:    $(LIBTARGET)
+
+$(LIBTARGET):
+       erase $(LIBTARGET)
+        implib $(LIBTARGET) ..\ctl3d32.dll
+
+clean:
+        -erase $(LIBTARGET)
diff --git a/src/msw/ctl3d/borland/makefile.bcc b/src/msw/ctl3d/borland/makefile.bcc
new file mode 100644 (file)
index 0000000..6a0bcdb
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# File:                makefile.b32
+# Author:       Andre Beltman
+# Created:     1995
+# Updated:     
+# Copyright:    (c) 1995, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Imports ctl3d library
+# and Borland C++ 4.x
+
+WXDIR = $(WXWIN)
+WXLIB = $(WXDIR)\lib
+
+LIBTARGET= $(WXLIB)\ctl3dv2.lib
+
+all:    $(LIBTARGET)
+
+$(LIBTARGET):
+       erase $(LIBTARGET)
+        implib $(LIBTARGET) ..\ctl3dv2.dll
+
+clean:
+        -erase $(LIBTARGET)
diff --git a/src/msw/ctl3d/ctl3d.dll b/src/msw/ctl3d/ctl3d.dll
new file mode 100644 (file)
index 0000000..74f3db7
Binary files /dev/null and b/src/msw/ctl3d/ctl3d.dll differ
diff --git a/src/msw/ctl3d/ctl3d32.dll b/src/msw/ctl3d/ctl3d32.dll
new file mode 100644 (file)
index 0000000..a4d26ed
Binary files /dev/null and b/src/msw/ctl3d/ctl3d32.dll differ
diff --git a/src/msw/ctl3d/ctl3dv2.dll b/src/msw/ctl3d/ctl3dv2.dll
new file mode 100644 (file)
index 0000000..7db141d
Binary files /dev/null and b/src/msw/ctl3d/ctl3dv2.dll differ
diff --git a/src/msw/ctl3d/msvc/ctl3d.h b/src/msw/ctl3d/msvc/ctl3d.h
new file mode 100644 (file)
index 0000000..de7e67a
--- /dev/null
@@ -0,0 +1,61 @@
+/*-----------------------------------------------------------------------
+|      CTL3D.DLL
+|      
+|      Adds 3d effects to Windows controls
+|
+|      See ctl3d.doc for info
+|              
+-----------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+BOOL WINAPI Ctl3dSubclassDlg(HWND, WORD);
+BOOL WINAPI Ctl3dSubclassDlgEx(HWND, DWORD);
+WORD WINAPI Ctl3dGetVer(void);
+BOOL WINAPI Ctl3dEnabled(void);
+HBRUSH WINAPI Ctl3dCtlColor(HDC, LONG);        // ARCHAIC, use Ctl3dCtlColorEx
+HBRUSH WINAPI Ctl3dCtlColorEx(UINT wm, WPARAM wParam, LPARAM lParam);
+BOOL WINAPI Ctl3dColorChange(void);
+BOOL WINAPI Ctl3dSubclassCtl(HWND);
+LONG WINAPI Ctl3dDlgFramePaint(HWND, UINT, WPARAM, LPARAM);
+
+BOOL WINAPI Ctl3dAutoSubclass(HANDLE);
+
+BOOL WINAPI Ctl3dRegister(HANDLE);
+BOOL WINAPI Ctl3dUnregister(HANDLE);
+
+//begin DBCS: far east short cut key support
+VOID WINAPI Ctl3dWinIniChange(void);
+//end DBCS
+
+
+/* Ctl3dSubclassDlg3d flags */
+#define CTL3D_BUTTONS          0x0001
+#define CTL3D_LISTBOXES                0x0002          
+#define CTL3D_EDITS                    0x0004  
+#define CTL3D_COMBOS                   0x0008          
+#define CTL3D_STATICTEXTS      0x0010          
+#define CTL3D_STATICFRAMES     0x0020
+
+#define CTL3D_NODLGWINDOW       0x00010000
+#define CTL3D_ALL                              0xffff
+
+#define WM_DLGBORDER (WM_USER+3567)
+/* WM_DLGBORDER *(int FAR *)lParam return codes */
+#define CTL3D_NOBORDER         0
+#define CTL3D_BORDER                   1
+
+#define WM_DLGSUBCLASS (WM_USER+3568)
+/* WM_DLGSUBCLASS *(int FAR *)lParam return codes */
+#define CTL3D_NOSUBCLASS       0
+#define CTL3D_SUBCLASS         1
+
+/* Resource ID for 3dcheck.bmp (for .lib version of ctl3d) */
+#define CTL3D_3DCHECK 26567
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/msw/ctl3d/msvc/ctl3d.lib b/src/msw/ctl3d/msvc/ctl3d.lib
new file mode 100644 (file)
index 0000000..2bd74e2
Binary files /dev/null and b/src/msw/ctl3d/msvc/ctl3d.lib differ
diff --git a/src/msw/ctl3d/msvc/ctl3dv2.lib b/src/msw/ctl3d/msvc/ctl3dv2.lib
new file mode 100644 (file)
index 0000000..9d40989
Binary files /dev/null and b/src/msw/ctl3d/msvc/ctl3dv2.lib differ
diff --git a/src/msw/ctl3d/readme.txt b/src/msw/ctl3d/readme.txt
new file mode 100644 (file)
index 0000000..58c656b
--- /dev/null
@@ -0,0 +1,31 @@
+
+CTL3D
+-----
+
+CTL3D gives 3D controls to 16-bit Windows 3.1 applications.
+Its use in wxWindows is controlled by the CTL3D symbol
+in include/base/wx_setup.h.
+
+If using a 16-bit compiler, copy ctl3dv2.lib to your compiler
+library directory, and remember to distribute ctl3dv2.dll
+with your applications. The DLL should be copied to
+windows/system and DELETED from the application installation
+directory.
+
+If using Watcom C++ in 386 mode, things are slightly more complex: you need
+to link with Patrick Halke's ctl3d32.obj which provides an interface
+from 32-bits to the 16-bit CTL3DV2 library. Link your application
+with ctl3d32.obj file instead of ctl3dv2.lib, distributing
+ctl3dv2.dll as above.
+
+ctl3d.dll           ; Version 1 of the CTL3D library DLL: obsolete
+ctl3dv2.dll         ; Version 2 of the CTL3D library DLL
+readme.txt          ; This file
+
+msvc/ctl3d.h        ; Header file for either version of CTL3D
+msvc/ctl3d.lib      ; Import library for 16-bit compilers
+watcom/import32.zip ; Import libraries for Watcom WIN32 compilation
+wat386/             ; Source & objects for Watcom 386 object file to
+                    ; interface 16<->32 bit modes
+borland/            ; Makefiles for making import libraries for Borland
+
diff --git a/src/msw/ctl3d/wat32/import32.zip b/src/msw/ctl3d/wat32/import32.zip
new file mode 100644 (file)
index 0000000..69f318c
Binary files /dev/null and b/src/msw/ctl3d/wat32/import32.zip differ
diff --git a/src/msw/ctl3d/wat386/ctl3d.h b/src/msw/ctl3d/wat386/ctl3d.h
new file mode 100644 (file)
index 0000000..de7e67a
--- /dev/null
@@ -0,0 +1,61 @@
+/*-----------------------------------------------------------------------
+|      CTL3D.DLL
+|      
+|      Adds 3d effects to Windows controls
+|
+|      See ctl3d.doc for info
+|              
+-----------------------------------------------------------------------*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+BOOL WINAPI Ctl3dSubclassDlg(HWND, WORD);
+BOOL WINAPI Ctl3dSubclassDlgEx(HWND, DWORD);
+WORD WINAPI Ctl3dGetVer(void);
+BOOL WINAPI Ctl3dEnabled(void);
+HBRUSH WINAPI Ctl3dCtlColor(HDC, LONG);        // ARCHAIC, use Ctl3dCtlColorEx
+HBRUSH WINAPI Ctl3dCtlColorEx(UINT wm, WPARAM wParam, LPARAM lParam);
+BOOL WINAPI Ctl3dColorChange(void);
+BOOL WINAPI Ctl3dSubclassCtl(HWND);
+LONG WINAPI Ctl3dDlgFramePaint(HWND, UINT, WPARAM, LPARAM);
+
+BOOL WINAPI Ctl3dAutoSubclass(HANDLE);
+
+BOOL WINAPI Ctl3dRegister(HANDLE);
+BOOL WINAPI Ctl3dUnregister(HANDLE);
+
+//begin DBCS: far east short cut key support
+VOID WINAPI Ctl3dWinIniChange(void);
+//end DBCS
+
+
+/* Ctl3dSubclassDlg3d flags */
+#define CTL3D_BUTTONS          0x0001
+#define CTL3D_LISTBOXES                0x0002          
+#define CTL3D_EDITS                    0x0004  
+#define CTL3D_COMBOS                   0x0008          
+#define CTL3D_STATICTEXTS      0x0010          
+#define CTL3D_STATICFRAMES     0x0020
+
+#define CTL3D_NODLGWINDOW       0x00010000
+#define CTL3D_ALL                              0xffff
+
+#define WM_DLGBORDER (WM_USER+3567)
+/* WM_DLGBORDER *(int FAR *)lParam return codes */
+#define CTL3D_NOBORDER         0
+#define CTL3D_BORDER                   1
+
+#define WM_DLGSUBCLASS (WM_USER+3568)
+/* WM_DLGSUBCLASS *(int FAR *)lParam return codes */
+#define CTL3D_NOSUBCLASS       0
+#define CTL3D_SUBCLASS         1
+
+/* Resource ID for 3dcheck.bmp (for .lib version of ctl3d) */
+#define CTL3D_3DCHECK 26567
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/msw/ctl3d/wat386/ctl3d32.c b/src/msw/ctl3d/wat386/ctl3d32.c
new file mode 100644 (file)
index 0000000..67f8450
--- /dev/null
@@ -0,0 +1,285 @@
+/*
+ * File:       ctl3d32.c
+ * Purpose:    32bit interface to CTL3D functions for Watcom C/C++
+ * Author:     Patrick Halke
+ * Created:    1995
+ * Updated:    
+ * Copyright:  (c) 1995
+ */
+
+#include <malloc.h>
+
+#include <windows.h>
+
+#include "ctl3d.h"
+
+#if defined(__WINDOWS_386__)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#undef FAR
+#define FAR
+
+#define INDIR_INT INDIR_WORD
+#define INDIR_UINT INDIR_WORD
+#define INDIR_WPARAM INDIR_UINT
+#define INDIR_LPARAM INDIR_DWORD
+#define INDIR_LONG INDIR_DWORD
+#define INDIR_ULONG INDIR_DWORD
+
+#ifdef STRICT
+#define INDIR_HANDLE INDIR_PTR
+#define INDIR_HWND INDIR_PTR
+#define INDIR_HDC INDIR_PTR
+#else
+#define INDIR_HANDLE INDIR_UINT
+#define INDIR_HWND INDIR_UINT
+#define INDIR_HDC INDIR_UINT
+#endif
+
+typedef struct tagCTL3DFUNCTIONS {
+    HINSTANCE  dll;
+    /* Function Handles */
+    HINDIR     _Ctl3dSubclassDlg;
+    HINDIR     _Ctl3dSubclassDlgEx;
+    HINDIR     _Ctl3dGetVer;
+    HINDIR     _Ctl3dEnabled;
+    HINDIR     _Ctl3dCtlColor;
+    HINDIR     _Ctl3dCtlColorEx;
+    HINDIR     _Ctl3dColorChange;
+    HINDIR     _Ctl3dSubclassCtl;
+    HINDIR     _Ctl3dDlgFramePaint;
+    HINDIR     _Ctl3dAutoSubclass;
+    HINDIR     _Ctl3dRegister;
+    HINDIR     _Ctl3dUnregister;
+    HINDIR     _Ctl3dWinIniChange;
+} CTL3DFUNCTIONS;
+
+static CTL3DFUNCTIONS  Ctl3dFunc = { 0 };
+
+static BOOL load_functions( CTL3DFUNCTIONS* functions )
+{
+    FARPROC            proc;
+    HINSTANCE          dll;
+
+    dll = LoadLibrary( "CTL3D.DLL" );
+    if( dll < HINSTANCE_ERROR ) {
+       return( FALSE );
+    }
+
+    /* Function thunks */
+    
+    proc = GetProcAddress(dll, "Ctl3dSubclassDlg");
+    functions->_Ctl3dSubclassDlg = GetIndirectFunctionHandle( proc,
+       INDIR_HWND,
+       INDIR_WORD,
+       INDIR_ENDLIST );
+    
+    proc = GetProcAddress( dll, "Ctl3dSubclassDlgEx" );
+    functions->_Ctl3dSubclassDlgEx = GetIndirectFunctionHandle( proc,
+       INDIR_HWND,
+       INDIR_DWORD,
+       INDIR_ENDLIST );
+    
+    proc = GetProcAddress( dll, "Ctl3dGetVer" );
+    functions->_Ctl3dGetVer = GetIndirectFunctionHandle( proc,
+       INDIR_ENDLIST );
+    
+    proc = GetProcAddress( dll, "Ctl3dEnabled" );
+    functions->_Ctl3dEnabled = GetIndirectFunctionHandle( proc,
+       INDIR_ENDLIST );
+    
+    proc = GetProcAddress( dll, "Ctl3dCtlColor" );
+    functions->_Ctl3dCtlColor = GetIndirectFunctionHandle( proc,
+       INDIR_HDC,
+       INDIR_LONG,
+       INDIR_ENDLIST );
+    
+    proc = GetProcAddress( dll, "Ctl3dCtlColorEx" );
+    functions->_Ctl3dCtlColorEx = GetIndirectFunctionHandle( proc,
+       INDIR_UINT,
+       INDIR_WPARAM,
+       INDIR_LPARAM,
+       INDIR_ENDLIST );
+
+    proc = GetProcAddress( dll, "Ctl3dColorChange" );
+    functions->_Ctl3dColorChange = GetIndirectFunctionHandle( proc,
+       INDIR_ENDLIST );
+
+    proc = GetProcAddress( dll, "Ctl3dSubclassCtl" );
+    functions->_Ctl3dSubclassCtl = GetIndirectFunctionHandle( proc,
+       INDIR_HWND,
+       INDIR_ENDLIST );
+  
+    proc = GetProcAddress( dll, "Ctl3dDlgFramePaint" );
+    functions->_Ctl3dDlgFramePaint = GetIndirectFunctionHandle( proc,
+       INDIR_HWND,
+       INDIR_UINT,
+       INDIR_WPARAM,
+       INDIR_LPARAM,
+       INDIR_ENDLIST );
+  
+    proc = GetProcAddress( dll, "Ctl3dAutoSubclass" );
+    functions->_Ctl3dAutoSubclass = GetIndirectFunctionHandle( proc,
+       INDIR_HANDLE,
+       INDIR_ENDLIST );
+  
+    proc = GetProcAddress( dll, "Ctl3dRegister" );
+    functions->_Ctl3dRegister = GetIndirectFunctionHandle( proc,
+       INDIR_HANDLE,
+       INDIR_ENDLIST );
+  
+    proc = GetProcAddress( dll, "Ctl3dUnregister" );
+    functions->_Ctl3dUnregister = GetIndirectFunctionHandle( proc,
+       INDIR_HANDLE,
+       INDIR_ENDLIST );
+  
+    proc = GetProcAddress( dll, "Ctl3dWinIniChange" );
+    functions->_Ctl3dWinIniChange = GetIndirectFunctionHandle( proc,
+       INDIR_ENDLIST );
+
+    functions->dll = dll;
+    return( TRUE );
+}
+
+static void unload_functions( CTL3DFUNCTIONS * functions )
+{
+    FreeLibrary( functions->dll );
+    functions->dll = 0;
+}
+
+/* Function Definitions */
+
+BOOL WINAPI Ctl3dSubclassDlg(HWND hwnd, WORD w)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dSubclassDlg,
+                                     hwnd, w);
+}
+
+BOOL WINAPI Ctl3dSubclassDlgEx(HWND hwnd, DWORD dw)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dSubclassDlgEx,
+                                     hwnd, dw);
+}
+
+WORD WINAPI Ctl3dGetVer(void)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+      return FALSE;
+  
+  return (WORD)InvokeIndirectFunction(Ctl3dFunc._Ctl3dGetVer);
+}
+
+BOOL WINAPI Ctl3dEnabled(void)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+      return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dEnabled);
+}
+
+HBRUSH WINAPI Ctl3dCtlColor(HDC hdc, LONG l)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (HBRUSH)InvokeIndirectFunction(Ctl3dFunc._Ctl3dCtlColor,
+                                       hdc, l);
+}
+
+HBRUSH WINAPI Ctl3dCtlColorEx(UINT ui, WPARAM wp, LPARAM lp)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (HBRUSH)InvokeIndirectFunction(Ctl3dFunc._Ctl3dCtlColorEx,
+                                       ui, wp, lp);
+}
+
+BOOL WINAPI Ctl3dColorChange(void)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dColorChange);
+}
+
+BOOL WINAPI Ctl3dSubclassCtl(HWND hwnd)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dSubclassCtl,
+                                     hwnd);
+}
+
+LONG WINAPI Ctl3dDlgFramePaint(HWND hwnd, UINT ui, WPARAM wp, LPARAM lp)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (LONG)InvokeIndirectFunction(Ctl3dFunc._Ctl3dDlgFramePaint,
+                                     hwnd, ui, wp, lp);
+}
+
+BOOL WINAPI Ctl3dAutoSubclass(HANDLE hnd)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dAutoSubclass,
+                                     hnd);
+}
+
+BOOL WINAPI Ctl3dRegister(HANDLE hnd)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dRegister,
+                                     hnd);
+}
+
+BOOL WINAPI Ctl3dUnregister(HANDLE hnd)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+    return FALSE;
+  
+  return (BOOL)InvokeIndirectFunction(Ctl3dFunc._Ctl3dUnregister,
+                                     hnd);
+}
+
+VOID WINAPI Ctl3dWinIniChange(void)
+{
+  if (!Ctl3dFunc.dll)
+    if (!load_functions(&Ctl3dFunc))
+      return;
+  
+  InvokeIndirectFunction(Ctl3dFunc._Ctl3dWinIniChange);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __WINDOWS_386__
diff --git a/src/msw/ctl3d/wat386/ctl3d32.lnk b/src/msw/ctl3d/wat386/ctl3d32.lnk
new file mode 100644 (file)
index 0000000..2ada8d2
--- /dev/null
@@ -0,0 +1 @@
++-ctl3d32.obj
diff --git a/src/msw/ctl3d/wat386/ctl3d32.obj b/src/msw/ctl3d/wat386/ctl3d32.obj
new file mode 100644 (file)
index 0000000..2fe3045
Binary files /dev/null and b/src/msw/ctl3d/wat386/ctl3d32.obj differ
diff --git a/src/msw/ctl3d/wat386/ctl3d32.txt b/src/msw/ctl3d/wat386/ctl3d32.txt
new file mode 100644 (file)
index 0000000..8e6b8b6
--- /dev/null
@@ -0,0 +1,11 @@
+Using this package should be no big problem. You only need to change your
+wx_setup.h for including the CTL3D stuff, compile ctl3d32.c and add
+ctl3d32.obj to wx.lib (or just link it with your application).
+
+Please send bug reports to 'patrick@zaphod.ruhr.de'.
+
+
+Good luck
+
+- patrick
+
diff --git a/src/msw/ctl3d/wat386/makefile.wat b/src/msw/ctl3d/wat386/makefile.wat
new file mode 100644 (file)
index 0000000..1f08584
--- /dev/null
@@ -0,0 +1,23 @@
+CC     = wcc386
+CXX    = wpp386
+LIB     = wlib
+IFLAGS  = -i=..\\..\\include\\base;..\\..\\include\\msw
+CFLAGS  = $(IFLAGS) -zq -zW -w1 -d2 -ot -3 -dwx_msw
+
+WXDIR   = ..\\..
+LIBTARGET = $(WXDIR)\\lib\\wx.lib
+
+C_SRCS = ctl3d32.c
+
+OBJECTS = $(C_SRCS:.c=.obj) $(CC_SRCS:.cc=.obj)
+
+.c.obj:
+       $(CC) $(CFLAGS) $<
+
+.cc.obj:
+       $(CXX) $(CFLAGS) $< 
+
+all: $(OBJECTS) $(LIBTARGET)
+
+$(LIBTARGET): $(OBJECTS)
+       $(LIB) /P=256 $(LIBTARGET) @ctl3d32.lnk
diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp
new file mode 100644 (file)
index 0000000..7ff8923
--- /dev/null
@@ -0,0 +1,459 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        ole/droptgt.cpp
+// Purpose:     wxDropTarget implementation
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// Declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+#pragma implementation "droptgt.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#define IN_WX_MAIN_CPP
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include  <wx/setup.h>
+
+#if USE_DRAG_AND_DROP
+
+#include  <wx/log.h>
+
+#ifdef __WIN32__
+#ifndef __GNUWIN32__
+#include  <shlobj.h>            // for DROPFILES structure
+#endif
+#else
+#include <shellapi.h>
+#endif
+
+#include  <wx/msw/ole/droptgt.h>
+
+#ifndef __WIN32__
+#include <ole2.h>
+#include <olestd.h>
+#endif
+
+#include  <wx/msw/ole/oleutils.h>
+
+// ----------------------------------------------------------------------------
+// IDropTarget interface: forward all interesting things to wxDropTarget
+// (the name is unfortunate, but wx_I_DropTarget is not at all the same thing
+//  as wxDropTarget which is 'public' class, while this one is private)
+// ----------------------------------------------------------------------------
+
+class wxIDropTarget : public IDropTarget
+{
+public:
+  wxIDropTarget(wxDropTarget *p);
+ ~wxIDropTarget();
+
+  // IDropTarget methods
+  STDMETHODIMP DragEnter(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
+  STDMETHODIMP DragOver(DWORD, POINTL, LPDWORD);
+  STDMETHODIMP DragLeave(void);
+  STDMETHODIMP Drop(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
+
+  // @@ we assume that if QueryGetData() returns S_OK, than we can really
+  //    get data in this format, so we remember here the format for which
+  //    QueryGetData() succeeded
+  void SetSupportedFormat(wxDataFormat cfFormat) { m_cfFormat = cfFormat; }
+
+  DECLARE_IUNKNOWN_METHODS;
+
+protected:
+  IDataObject   *m_pIDataObject;  // !NULL between DragEnter and DragLeave/Drop
+  wxDropTarget  *m_pTarget;       // the real target (we're just a proxy)
+
+  wxDataFormat   m_cfFormat;      // the format in which to ask for data
+
+private:
+  static inline DWORD GetDropEffect(DWORD flags);
+};
+
+// ============================================================================
+// wxIDropTarget implementation
+// ============================================================================
+
+// Name    : static wxDropTarget::GetDropEffect
+// Purpose : determine the drop operation from keyboard/mouse state.
+// Returns : DWORD combined from DROPEFFECT_xxx constants 
+// Params  : [in] DWORD flags       kbd & mouse flags as passed to
+//                                  IDropTarget methods
+// Notes   : We do "move" normally and "copy" if <Ctrl> is pressed,
+//           which is the standard behaviour (currently there is no 
+//           way to redefine it)
+DWORD wxIDropTarget::GetDropEffect(DWORD flags)
+{
+  return flags & MK_CONTROL ? DROPEFFECT_COPY : DROPEFFECT_MOVE;
+}
+
+wxIDropTarget::wxIDropTarget(wxDropTarget *pTarget)
+{ 
+  m_cRef         = 0; 
+  m_pTarget      = pTarget;
+  m_cfFormat     = 0;
+  m_pIDataObject = NULL; 
+}
+
+wxIDropTarget::~wxIDropTarget() 
+{ 
+}
+
+BEGIN_IID_TABLE(wxIDropTarget)
+  ADD_IID(Unknown)
+  ADD_IID(DropTarget)
+END_IID_TABLE;
+
+IMPLEMENT_IUNKNOWN_METHODS(wxIDropTarget)
+
+#if 0
+  STDMETHODIMP wxIDropTarget::QueryInterface(REFIID riid, void **ppv)
+  {                                                                           
+//    wxLogQueryInterface(wxIDropTarget, riid);                                    
+                                                                              
+    if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) {                  
+      *ppv = this;
+      AddRef();                                                               
+                                                                              
+      return S_OK;                                                            
+    }                                                                         
+    else {                                                                    
+      *ppv = NULL;                                                            
+                                                                              
+      return (HRESULT) E_NOINTERFACE;
+    }                                                                         
+  }                                                                           
+                                                                              
+  STDMETHODIMP_(ULONG) wxIDropTarget::AddRef()                                    
+  {                                                                           
+    wxLogAddRef(wxIDropTarget, m_cRef);                                          
+                                                                              
+    return ++m_cRef;                                                          
+  }                                                                           
+                                                                              
+  STDMETHODIMP_(ULONG) wxIDropTarget::Release()                                   
+  {                                                                           
+    wxLogRelease(wxIDropTarget, m_cRef);                                         
+                                                                              
+    if ( --m_cRef == 0 ) {                                                    
+      delete this;                                                            
+      return 0;                                                               
+    }                                                                         
+    else                                                                      
+      return m_cRef;                                                          
+  }
+#endif
+
+// Name    : wxIDropTarget::DragEnter
+// Purpose : Called when the mouse enters the window (dragging something)
+// Returns : S_OK
+// Params  : [in] IDataObject *pIDataSource : source data
+//           [in] DWORD        grfKeyState  : kbd & mouse state
+//           [in] POINTL       pt           : mouse coordinates
+//           [out]DWORD       *pdwEffect    : effect flag
+// Notes   : 
+STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
+                                      DWORD        grfKeyState,
+                                      POINTL       pt,
+                                      DWORD       *pdwEffect)
+{
+  wxLogDebug("IDropTarget::DragEnter");
+
+  wxASSERT( m_pIDataObject == NULL );
+
+  if ( !m_pTarget->IsAcceptedData(pIDataSource) ) {
+    // we don't accept this kind of data
+    *pdwEffect = DROPEFFECT_NONE;
+
+    return S_OK;
+  }
+
+  // @@ should check the point also?
+  
+  *pdwEffect = GetDropEffect(grfKeyState);
+
+  // get hold of the data object
+  m_pIDataObject = pIDataSource;
+  m_pIDataObject->AddRef();
+
+  // give some visual feedback
+  m_pTarget->OnEnter();
+
+  return S_OK;
+}
+
+// Name    : wxIDropTarget::DragOver
+// Purpose : Indicates that the mouse was moved inside the window represented
+//           by this drop target.
+// Returns : S_OK
+// Params  : [in] DWORD   grfKeyState     kbd & mouse state
+//           [in] POINTL  pt              mouse coordinates
+//           [out]LPDWORD pdwEffect       effect flag
+// Notes   : We're called on every WM_MOUSEMOVE, so this function should be 
+//           very efficient.
+STDMETHODIMP wxIDropTarget::DragOver(DWORD   grfKeyState,
+                                     POINTL  pt,
+                                     LPDWORD pdwEffect)
+{
+  // there are too many of them... wxLogDebug("IDropTarget::DragOver");
+
+  *pdwEffect = m_pIDataObject == NULL ? DROPEFFECT_NONE 
+                                      : GetDropEffect(grfKeyState);
+  return S_OK;
+}
+
+// Name    : wxIDropTarget::DragLeave
+// Purpose : Informs the drop target that the operation has left its window.
+// Returns : S_OK
+// Notes   : good place to do any clean-up
+STDMETHODIMP wxIDropTarget::DragLeave()
+{
+  wxLogDebug("IDropTarget::DragLeave");
+
+  // remove the UI feedback
+  m_pTarget->OnLeave();
+
+  // release the held object
+  RELEASE_AND_NULL(m_pIDataObject);
+    
+  return S_OK;
+}
+
+// Name    : wxIDropTarget::Drop
+// Purpose : Instructs the drop target to paste data that was just now 
+//           dropped on it.
+// Returns : S_OK
+// Params  : [in] IDataObject *pIDataSource     the data to paste
+//           [in] DWORD        grfKeyState      kbd & mouse state
+//           [in] POINTL       pt               where the drop occured?
+//           [ouy]DWORD       *pdwEffect        operation effect
+// Notes   : 
+STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource, 
+                                 DWORD        grfKeyState, 
+                                 POINTL       pt, 
+                                 DWORD       *pdwEffect)
+{
+  wxLogDebug("IDropTarget::Drop");
+
+  // @@ I don't know why there is this parameter, but so far I assume
+  //    that it's the same we've already got in DragEnter
+  wxASSERT( m_pIDataObject == pIDataSource );
+
+  STGMEDIUM stm;
+  *pdwEffect = DROPEFFECT_NONE; 
+  
+  // should be set by SetSupportedFormat() call
+  wxASSERT( m_cfFormat != 0 );
+
+  FORMATETC fmtMemory;
+  fmtMemory.cfFormat  = m_cfFormat;
+  fmtMemory.ptd       = NULL; 
+  fmtMemory.dwAspect  = DVASPECT_CONTENT;
+  fmtMemory.lindex    = -1;
+  fmtMemory.tymed     = TYMED_HGLOBAL;  // @@@@ to add other media
+
+  HRESULT hr = pIDataSource->GetData(&fmtMemory, &stm);
+  if ( SUCCEEDED(hr) ) {
+    if ( stm.hGlobal != NULL ) {
+      if ( m_pTarget->OnDrop(pt.x, pt.y, GlobalLock(stm.hGlobal)) )
+        *pdwEffect = GetDropEffect(grfKeyState);
+      //else: DROPEFFECT_NONE
+
+      GlobalUnlock(stm.hGlobal);
+      ReleaseStgMedium(&stm);
+    }
+  }
+  else
+  {
+    // wxLogApiError("GetData", hr);
+  }
+
+  // release the held object
+  RELEASE_AND_NULL(m_pIDataObject);
+
+  return S_OK;
+}
+
+// ============================================================================
+// wxDropTarget implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// ctor/dtor
+// ----------------------------------------------------------------------------
+
+wxDropTarget::wxDropTarget()
+{
+  // create an IDropTarget implementation which will notify us about 
+  // d&d operations.
+  m_pIDropTarget = new wxIDropTarget(this);
+  m_pIDropTarget->AddRef();
+}
+
+wxDropTarget::~wxDropTarget()
+{
+  ReleaseInterface(m_pIDropTarget);
+}
+
+// ----------------------------------------------------------------------------
+// [un]register drop handler
+// ----------------------------------------------------------------------------
+
+bool wxDropTarget::Register(WXHWND hwnd)
+{
+  HRESULT hr = ::CoLockObjectExternal(m_pIDropTarget, TRUE, FALSE);
+  if ( FAILED(hr) ) {
+    // wxLogApiError("CoLockObjectExternal", hr);
+    return FALSE;
+  }
+
+  hr = ::RegisterDragDrop((HWND) hwnd, m_pIDropTarget);
+  if ( FAILED(hr) ) {
+    ::CoLockObjectExternal(m_pIDropTarget, FALSE, FALSE);
+
+    // wxLogApiError("RegisterDragDrop", hr);
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+void wxDropTarget::Revoke(WXHWND hwnd)
+{
+  HRESULT hr = ::RevokeDragDrop((HWND) hwnd);
+
+  if ( FAILED(hr) )
+  {
+    // wxLogApiError("RevokeDragDrop", hr);
+  }
+
+  ::CoLockObjectExternal(m_pIDropTarget, FALSE, TRUE);
+}
+
+// ----------------------------------------------------------------------------
+// determine if we accept data of this type
+// ----------------------------------------------------------------------------
+bool wxDropTarget::IsAcceptedData(IDataObject *pIDataSource) const
+{
+  // this strucutre describes a data of any type (first field will be
+  // changing) being passed through global memory block.
+  static FORMATETC s_fmtMemory = { 
+    0,
+    NULL, 
+    DVASPECT_CONTENT, 
+    -1, 
+    TYMED_HGLOBAL 
+  };
+
+  // cycle thorugh all supported formats
+  for ( size_t n = 0; n < GetFormatCount(); n++ ) {
+    s_fmtMemory.cfFormat = GetFormat(n);
+    // @ don't use SUCCEEDED macro here: QueryGetData returns 1 (whatever it
+    //   means) for file drag and drop
+    if ( pIDataSource->QueryGetData(&s_fmtMemory) == S_OK ) {
+      // remember this format: we'll later ask for data in it
+      m_pIDropTarget->SetSupportedFormat(s_fmtMemory.cfFormat);
+      return TRUE;
+    }
+  }
+
+  return FALSE;
+}
+
+// ============================================================================
+// wxTextDropTarget
+// ============================================================================
+
+bool wxTextDropTarget::OnDrop(long x, long y, const void *pData)
+{
+  return OnDropText(x, y, (const char *)pData);
+}
+
+size_t wxTextDropTarget::GetFormatCount() const
+{
+  return 1;
+}
+
+wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
+{
+  return CF_TEXT;
+}
+
+// ============================================================================
+// wxFileDropTarget
+// ============================================================================
+
+bool wxFileDropTarget::OnDrop(long x, long y, const void *pData)
+{
+  // the documentation states that the first member of DROPFILES structure
+  // is a "DWORD offset of double NUL terminated file list". What they mean by 
+  // this (I wonder if you see it immediately) is that the list starts at
+  // ((char *)&(pDropFiles.pFiles)) + pDropFiles.pFiles. We're also advised to
+  // use DragQueryFile to work with this structure, but not told where and how
+  // to get HDROP.
+  HDROP hdrop = (HDROP)pData;   // @@ it works, but I'm not sure about it
+
+  // get number of files (magic value -1)
+  UINT nFiles = ::DragQueryFile(hdrop, -1, NULL, 0);
+  
+  // for each file get the length, allocate memory and then get the name
+  char **aszFiles = new char *[nFiles];
+  UINT len, n;
+  for ( n = 0; n < nFiles; n++ ) {
+    // +1 for terminating NUL
+    len = ::DragQueryFile(hdrop, n, NULL, 0) + 1;
+
+    aszFiles[n] = new char[len];
+
+    UINT len2 = ::DragQueryFile(hdrop, n, aszFiles[n], len);
+    if ( len2 != len - 1 ) {
+      wxLogDebug("In wxFileDropTarget::OnDrop DragQueryFile returned %d "
+                 "characters, %d expected.", len2, len - 1);
+    }
+  }
+
+  bool bResult = OnDropFiles(x, y, nFiles, (const char**) aszFiles);
+
+  // free memory
+  for ( n = 0; n < nFiles; n++ ) {
+    delete [] aszFiles[n];
+  }
+  delete [] aszFiles;
+
+  return bResult;
+}
+
+size_t wxFileDropTarget::GetFormatCount() const
+{
+  return 1;
+}
+
+wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
+{
+#ifdef __WIN32__
+  return CF_HDROP;
+#else
+  // TODO: how to implement this in WIN16?
+  return CF_TEXT;
+#endif
+}
+
+#endif
+ // USE_DRAG_AND_DROP
diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp
new file mode 100644 (file)
index 0000000..39165f2
--- /dev/null
@@ -0,0 +1,193 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        ole/oleutils.cpp
+// Purpose:     implementation of OLE helper functions
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     19.02.98
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// Declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+#pragma implementation "oleutils.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#define IN_WX_MAIN_CPP
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include  <wx/setup.h>
+
+#if USE_DRAG_AND_DROP
+
+#include  <wx/log.h>
+
+#include <windows.h>
+
+// OLE
+#include  <wx/msw/ole/uuid.h>
+#include  <wx/msw/ole/oleutils.h>
+
+#ifndef __BORLANDC__
+#include  <docobj.h>
+#endif
+
+// ============================================================================
+// Implementation
+// ============================================================================
+
+// return TRUE if the iid is in the array
+bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount)
+{
+  for ( size_t i = 0; i < nCount; i++ ) {
+    if ( riid == *aIids[i] )
+      return TRUE;
+  }
+
+  return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// Debug support
+// ----------------------------------------------------------------------------
+
+#ifdef  __DEBUG__
+
+const char *GetIidName(REFIID riid)
+{
+  // an association between symbolic name and numeric value of an IID
+  struct KNOWN_IID {
+    const IID  *pIid;
+    const char *szName;
+  };
+
+  // construct the table containing all known interfaces
+  #define ADD_KNOWN_IID(name) { &IID_I##name, #name }
+
+  static const KNOWN_IID aKnownIids[] = {
+    ADD_KNOWN_IID(AdviseSink),
+    ADD_KNOWN_IID(AdviseSink2),
+    ADD_KNOWN_IID(BindCtx),
+    ADD_KNOWN_IID(ClassFactory),
+    ADD_KNOWN_IID(ContinueCallback),
+    ADD_KNOWN_IID(EnumOleDocumentViews),
+    ADD_KNOWN_IID(OleCommandTarget),
+    ADD_KNOWN_IID(OleDocument),
+    ADD_KNOWN_IID(OleDocumentSite),
+    ADD_KNOWN_IID(OleDocumentView),
+    ADD_KNOWN_IID(Print),
+    ADD_KNOWN_IID(DataAdviseHolder),
+    ADD_KNOWN_IID(DataObject),
+    ADD_KNOWN_IID(Debug),
+    ADD_KNOWN_IID(DebugStream),
+    ADD_KNOWN_IID(DfReserved1),
+    ADD_KNOWN_IID(DfReserved2),
+    ADD_KNOWN_IID(DfReserved3),
+    ADD_KNOWN_IID(Dispatch),
+    ADD_KNOWN_IID(DropSource),
+    ADD_KNOWN_IID(DropTarget),
+    ADD_KNOWN_IID(EnumCallback),
+    ADD_KNOWN_IID(EnumFORMATETC),
+    ADD_KNOWN_IID(EnumGeneric),
+    ADD_KNOWN_IID(EnumHolder),
+    ADD_KNOWN_IID(EnumMoniker),
+    ADD_KNOWN_IID(EnumOLEVERB),
+    ADD_KNOWN_IID(EnumSTATDATA),
+    ADD_KNOWN_IID(EnumSTATSTG),
+    ADD_KNOWN_IID(EnumString),
+    ADD_KNOWN_IID(EnumUnknown),
+    ADD_KNOWN_IID(EnumVARIANT),
+    ADD_KNOWN_IID(ExternalConnection),
+    ADD_KNOWN_IID(InternalMoniker),
+    ADD_KNOWN_IID(LockBytes),
+    ADD_KNOWN_IID(Malloc),
+    ADD_KNOWN_IID(Marshal),
+    ADD_KNOWN_IID(MessageFilter),
+    ADD_KNOWN_IID(Moniker),
+    ADD_KNOWN_IID(OleAdviseHolder),
+    ADD_KNOWN_IID(OleCache),
+    ADD_KNOWN_IID(OleCache2),
+    ADD_KNOWN_IID(OleCacheControl),
+    ADD_KNOWN_IID(OleClientSite),
+    ADD_KNOWN_IID(OleContainer),
+    ADD_KNOWN_IID(OleInPlaceActiveObject),
+    ADD_KNOWN_IID(OleInPlaceFrame),
+    ADD_KNOWN_IID(OleInPlaceObject),
+    ADD_KNOWN_IID(OleInPlaceSite),
+    ADD_KNOWN_IID(OleInPlaceUIWindow),
+    ADD_KNOWN_IID(OleItemContainer),
+    ADD_KNOWN_IID(OleLink),
+    ADD_KNOWN_IID(OleManager),
+    ADD_KNOWN_IID(OleObject),
+    ADD_KNOWN_IID(OlePresObj),
+    ADD_KNOWN_IID(OleWindow),
+    ADD_KNOWN_IID(PSFactory),
+    ADD_KNOWN_IID(ParseDisplayName),
+    ADD_KNOWN_IID(Persist),
+    ADD_KNOWN_IID(PersistFile),
+    ADD_KNOWN_IID(PersistStorage),
+    ADD_KNOWN_IID(PersistStream),
+    ADD_KNOWN_IID(ProxyManager),
+    ADD_KNOWN_IID(RootStorage),
+    ADD_KNOWN_IID(RpcChannel),
+    ADD_KNOWN_IID(RpcProxy),
+    ADD_KNOWN_IID(RpcStub),
+    ADD_KNOWN_IID(RunnableObject),
+    ADD_KNOWN_IID(RunningObjectTable),
+    ADD_KNOWN_IID(StdMarshalInfo),
+    ADD_KNOWN_IID(Storage),
+    ADD_KNOWN_IID(Stream),
+    ADD_KNOWN_IID(StubManager),
+    ADD_KNOWN_IID(Unknown),
+    ADD_KNOWN_IID(ViewObject),
+    ADD_KNOWN_IID(ViewObject2),
+  };
+
+  // don't clobber preprocessor name space
+  #undef ADD_KNOWN_IID
+
+  // try to find the interface in the table
+  for ( uint ui = 0; ui < WXSIZEOF(aKnownIids); ui++ ) {
+    if ( riid == *aKnownIids[ui].pIid ) {
+      return aKnownIids[ui].szName;
+    }
+  }
+
+  // unknown IID, just transform to string
+  static Uuid s_uuid;
+  s_uuid.Set(riid);
+  return s_uuid;
+}
+
+void wxLogQueryInterface(const char *szInterface, REFIID riid)
+{
+  wxLogTrace("%s::QueryInterface (iid = %s)", szInterface, GetIidName(riid));
+}
+
+void wxLogAddRef(const char *szInterface, ULONG cRef)
+{
+  wxLogTrace("After %s::AddRef: m_cRef = %d", szInterface, cRef + 1);
+}
+
+void wxLogRelease(const char *szInterface, ULONG cRef)
+{
+  wxLogTrace("After %s::Release: m_cRef = %d", szInterface, cRef - 1);
+}
+
+#endif  //DEBUG
+
+#endif
+  // USE_DRAG_AND_DROP
diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp
new file mode 100644 (file)
index 0000000..31e73a2
--- /dev/null
@@ -0,0 +1,153 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        ole/uuid.cpp
+// Purpose:     implements Uuid class, see uuid.h for details
+// Author:      Vadim Zeitlin
+// Modified by: 
+// Created:     12.09.96
+// RCS-ID:      $Id$
+// Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence:     wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// Declarations
+// ============================================================================
+
+#ifdef __GNUG__
+#pragma implementation "uuid.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#define IN_WX_MAIN_CPP
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+#pragma hdrstop
+#endif
+
+#include  <wx/setup.h>
+
+#if USE_DRAG_AND_DROP
+
+// standard headers
+#include  <rpc.h>                       // UUID related functions
+
+#include  <wx/msw/ole/uuid.h>
+
+
+
+// ============================================================================
+// Implementation
+// ============================================================================
+
+// length of UUID in C format
+#define   UUID_CSTRLEN  100     // real length is 66
+
+// copy ctor
+Uuid::Uuid(const Uuid& uuid)
+{
+  // bitwise copy Ok for UUIDs 
+  m_uuid = uuid.m_uuid;              
+
+  // force the string to be allocated by RPC
+  // (we free it later with RpcStringFree)
+  UuidToString(&m_uuid, &m_pszUuid);
+
+  // allocate new buffer
+  m_pszCForm = new char[UUID_CSTRLEN];
+  // and fill it
+  memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN);
+}
+
+// assignment operator
+Uuid& Uuid::operator=(const Uuid& uuid)
+{
+  m_uuid = uuid.m_uuid;
+
+  // force the string to be allocated by RPC
+  // (we free it later with RpcStringFree)
+  UuidToString(&m_uuid, &m_pszUuid);
+
+  // allocate new buffer if not done yet
+  if ( !m_pszCForm )
+    m_pszCForm = new char[UUID_CSTRLEN];
+
+  // and fill it
+  memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN);
+
+  return *this;
+}
+
+// dtor
+Uuid::~Uuid() 
+{ 
+  // this string must be allocated by RPC!
+  // (otherwise you get a debug breakpoint deep inside RPC DLL)
+  if ( m_pszUuid ) 
+    RpcStringFree(&m_pszUuid);
+
+  // perhaps we should just use a static buffer and not bother
+  // with new and delete?
+  if ( m_pszCForm )
+    delete [] m_pszCForm;
+}
+
+// update string representation of new UUID
+void Uuid::Set(const UUID &uuid)
+{
+  m_uuid = uuid;
+
+  // get string representation
+  UuidToString(&m_uuid, &m_pszUuid);
+
+  // cache UUID in C format
+  UuidToCForm();
+}
+
+// create a new UUID
+void Uuid::Create()
+{
+  UUID uuid;
+
+  // can't fail
+  UuidCreate(&uuid);
+  
+  Set(uuid);
+}
+
+// set the value
+bool Uuid::Set(const char *pc)
+{
+  // get UUID from string
+  if ( UuidFromString((uchar *)pc, &m_uuid) != RPC_S_OK)
+    // failed: probably invalid string
+    return FALSE;
+
+  // transform it back to string to normalize it
+  UuidToString(&m_uuid, &m_pszUuid);
+
+  // update m_pszCForm
+  UuidToCForm();
+
+  return TRUE;
+}
+
+// stores m_uuid in m_pszCForm in a format required by
+// DEFINE_GUID macro: i.e. something like
+//  0x7D8A2281L,0x4C61,0x11D0,0xBA,0xBD,0x00,0x00,0xC0,0x18,0xBA,0x27
+// m_pszUuid is of the form (no, it's not quite the same UUID :-)
+//  6aadc650-67b0-11d0-bac8-0000c018ba27
+void Uuid::UuidToCForm()
+{
+  if ( m_pszCForm == NULL )
+    m_pszCForm = new char[UUID_CSTRLEN];
+
+  wsprintf(m_pszCForm, "0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X,"
+           "0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X",
+           m_uuid.Data1, m_uuid.Data2, m_uuid.Data3,
+           m_uuid.Data4[1], m_uuid.Data4[2], m_uuid.Data4[3], m_uuid.Data4[4],
+           m_uuid.Data4[5], m_uuid.Data4[6], m_uuid.Data4[7], m_uuid.Data4[8]);
+}
+
+#endif
+  // USE_DRAG_AND_DROP
diff --git a/utils/nplugin/docs/notes.txt b/utils/nplugin/docs/notes.txt
new file mode 100644 (file)
index 0000000..ee3d141
--- /dev/null
@@ -0,0 +1,32 @@
+Notes about plugins
+
+
+ I have users that want to visit my pages with tclets, but they do not
+    have the plugin. What can I do?
+
+       Add a pluginspage=http://www.sunlabs.com/tcl/plugin/ name=value
+       pair to the embed statement. This will cause Navigator to find
+       the plugin for your user and suggest they install it. The user
+       is then prompted to download and install the plugin, and then she
+       has to restart the browser and revisit your page. Very inconvenient
+       and only slightly better than giving your users the broken image
+       icon. Netscape says they are working on a more automatic solution.
+
+
+
+
+14. Your demos work just fine, but when I visit my own pages with tclets in
+    them, at http://www.myserver.com/~mypages/mypage.html, I still get the
+    broken image icon. Why doesn't it work for me?
+
+       This is likely because your web server -- the program that sends
+       the pages to your browser when you click on a URL -- is not
+       sending the right mime-type when it sends the '.tcl' file. You
+       can work around this by adding a type=application/x-tcl name=value
+       pair to the embed statement, which will cause Navigator to infer
+       that it should use the Tcl plugin anyways. A better solution is
+       to ask your system administrator to configure the web server to
+       send the mime type application/x-tcl when it sends files with a
+       '.tcl' extension. Nearly all web servers in the world nowadays
+       are already configured to do this, the only ones we are aware of
+       that do not are some older versions of Apache.
diff --git a/utils/nplugin/lib/dummy b/utils/nplugin/lib/dummy
new file mode 100644 (file)
index 0000000..bfdf726
--- /dev/null
@@ -0,0 +1 @@
+I'm just here to force the creation of a LIB directory.
diff --git a/utils/nplugin/samples/gui/gui.cpp b/utils/nplugin/samples/gui/gui.cpp
new file mode 100644 (file)
index 0000000..3ae118f
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * File:       simple.cpp
+ * Purpose:    Minimal wxWindows plugin
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:    
+ * Copyright:   (c) Julian Smart
+ */
+
+/* static const char sccsid[] = "%W% %G%"; */
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <fstream.h>
+
+#include "NPApp.h"
+#include "NPFrame.h"
+
+#define ID_HELLO    10
+
+// Define a new application type
+class MyApp: public wxPluginApp
+{ public:
+    virtual wxFrame *OnInit(void);
+    virtual wxPluginFrame* OnNewInstance(const wxPluginData& data);
+};
+
+// Define a new frame type
+class MyFrame: public wxPluginFrame
+{ public:
+    MyFrame(const wxPluginData& data);
+    
+ public:
+    // Let's paint directly onto the 'frame'; we don't need a subwindow
+    void OnPaint(wxPaintEvent& event);
+    void OnMouseEvent(wxMouseEvent& event);
+    void OnHello(wxCommandEvent& event);
+
+    // Called when the file has been downloaded
+    virtual void OnNPNewFile(NPStream *stream, const wxString& fname);
+
+    void CentreStrings(wxDC& dc);
+
+   DECLARE_EVENT_TABLE()
+
+ protected:
+    wxStringList    m_strings;
+    float           m_xpos;
+    float           m_ypos;
+};
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+       EVT_SIZE(MyFrame::OnSize)
+       EVT_PAINT(MyFrame::OnPaint)
+       EVT_MOUSE_EVENTS(MyFrame::OnMouseEvent)
+       EVT_BUTTON(ID_HELLO, MyFrame::OnHello)
+END_EVENT_TABLE()
+
+IMPLEMENT_APP(MyApp)
+
+// No app initialisation necessary, and for a plugin there is no
+// top frame.
+wxFrame *MyApp::OnInit(void)
+{
+    return NULL;
+}
+
+// Called whenever a new plugin instance is called. We could check
+// various things here in 'data' but we won't bother.
+wxPluginFrame* MyApp::OnNewInstance(const wxPluginData& data)
+{
+    // Implicitly added to list of plugin frames
+    return new MyFrame(data);
+}
+
+// My frame constructor
+MyFrame::MyFrame(const wxPluginData& data):
+  wxPluginFrame(data)
+{
+    m_xpos = -1;
+    m_ypos = -1;
+
+    wxMenuBar *menuBar = new wxMenuBar;
+    wxMenu *menu = new wxMenu;
+    menu->Append(1, "E&xit");
+    menuBar->Append(menu, "&File");
+
+    SetMenuBar(menuBar);
+
+    new wxTextCtrl(this, -1, "", wxPoint(10, 30), wxSize(200, 25), wxSUNKEN_BORDER);
+    new wxButton(this, ID_HELLO, "Hello", wxPoint(10, 70));
+}
+
+void MyFrame::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+
+    dc.SetBrush(*wxCYAN_BRUSH);
+    dc.SetPen(*wxRED_PEN);
+
+    int w, h;
+    GetClientSize(&w, &h);
+
+    dc.DrawRectangle(0, 0, w, h);
+
+    wxFont swissFont(10, wxSWISS, wxNORMAL, wxNORMAL);
+    dc.SetFont(swissFont);
+    dc.SetBackgroundMode(wxTRANSPARENT);
+
+    CentreStrings(dc);
+}
+
+// Called when the file has been downloaded
+void MyFrame::OnNPNewFile(NPStream *stream, const wxString& fname)
+{
+    ifstream str(fname);
+    char buf[201];
+
+    while ( !str.eof() )
+    {
+        buf[0] = 0;
+        str.getline(buf, 200);
+
+        if ( buf[0] != 0 )
+            m_strings.Add(buf);
+    }
+    Refresh();
+}
+
+void MyFrame::CentreStrings(wxDC& dc)
+{
+    int y = 5;
+    int cw, ch;
+    GetClientSize(&cw, &ch);
+
+    wxNode *node = m_strings.First();
+    while ( node )
+    {
+        char *s = (char *)node->Data();
+        float w, h;
+        dc.GetTextExtent(s, &w, &h);
+
+        int x = wxMax(0, (cw - w)/2);
+        dc.DrawText(s, x, y);
+
+        y += h + (h/2);
+
+        node = node->Next();
+    }
+}
+
+// This implements a tiny doodling program. Drag the mouse using
+// the left button.
+void MyFrame::OnMouseEvent(wxMouseEvent& event)
+{
+  float x, y;
+  event.Position(&x, &y);
+  wxClientDC dc(this);
+
+  if (m_xpos > -1 && m_ypos > -1 && event.Dragging() && event.LeftIsDown())
+  {
+    dc.SetPen(wxBLACK_PEN);
+    dc.SetBrush(wxTRANSPARENT_BRUSH);
+    dc.DrawLine(m_xpos, m_ypos, x, y);
+  }
+  m_xpos = x;
+  m_ypos = y;
+}
+
+void MyFrame::OnHello(wxCommandEvent& event)
+{
+    wxMessageBox("Hello!");
+}
diff --git a/utils/nplugin/samples/gui/gui.h b/utils/nplugin/samples/gui/gui.h
new file mode 100644 (file)
index 0000000..01e46d6
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * File:       gui.h
+ * Purpose:    wxWindows plugin with a few GUI elements
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:    
+ * Copyright:   (c) Julian Smart
+ */
+
+#ifndef __GUIH__
+#define __GUIH__
+
+// Define a new application type
+class MyApp: public wxPluginApp
+{ public:
+    virtual wxFrame *OnInit(void);
+    virtual wxPluginFrame* OnNewInstance(const wxPluginData& data);
+};
+
+class MyApp;
+class MyFrame;
+class MyCanvas;
+
+class MyFrame: public wxPluginFrame
+{
+public:
+       MyFrame(const wxPluginData& data);
+       virtual ~MyFrame();
+
+       void OldOnMenuCommand(int id);
+
+private:
+       wxMenu*         fileMenu;
+       wxMenuBar*      menuBar;
+       MyCanvas*       leftCanvas;
+       MyCanvas*       rightCanvas;
+    wxSplitterWindow* splitter;
+};
+
+class MyCanvas: public wxScrolledWindow
+{
+public:
+       MyCanvas(wxWindow* parent, int x, int y, int w, int h);
+       virtual ~MyCanvas();
+
+       void OnPaint(wxPaintEvent& event);
+
+DECLARE_EVENT_TABLE()
+};
+
+// ID for the menu quit command
+#define SPLIT_QUIT          1
+#define SPLIT_HORIZONTAL    2
+#define SPLIT_VERTICAL      3
+#define SPLIT_UNSPLIT       4
+
+
+#endif
+
diff --git a/utils/nplugin/samples/gui/makefile.nt b/utils/nplugin/samples/gui/makefile.nt
new file mode 100644 (file)
index 0000000..2487d04
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1997
+# Updated:     
+# Copyright:   (c) 1997, Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile : Builds gui plugin example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+# Application is a DLL
+DLL=1
+
+EXTRAINC=/I$(WXDIR)\utils\nplugin\src
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\utils\nplugin\examples\gui
+PROGRAM=npgui32
+PLUGINLIB=$(WXDIR)\utils\nplugin\lib\nplugin.lib
+
+OBJECTS = gui.obj
+
+all:    $(PROGRAM).dll
+
+$(PROGRAM):    $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt dllnp FINAL=$(FINAL)
+        cd $(THISDIR)
+
+# Update the dynamic link library
+
+$(PROGRAM).dll: $(DUMMYOBJ) $(OBJECTS) $(WXDIR)\lib\wx.lib $(PLUGINLIB) $(PROGRAM).res $(PROGRAM).def
+    $(link) $(LINKFLAGS) \
+    -out:$(PROGRAM).dll   \
+    -def:$(PROGRAM).def \
+    $(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res $(WXDIR)\lib\wx.lib $(PLUGINLIB) \
+    $(guilibsdll) msvcrt.lib shell32.lib comctl32.lib ctl3d32.lib
+
+gui.obj:      gui.$(SRCSUFF) gui.h $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+copy:
+       copy npgui32.dll "c:\program files\Netscape\Navigator\program\plugins"
+       copy npgui32.dll "c:\program files\Internet Explorer\plugins"
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
+        -erase *.dll
+        -erase *.exp
+        -erase *.lib
+        -erase *.ilk
diff --git a/utils/nplugin/samples/gui/npgui32.def b/utils/nplugin/samples/gui/npgui32.def
new file mode 100644 (file)
index 0000000..1107bb9
--- /dev/null
@@ -0,0 +1,9 @@
+LIBRARY   NPGUI32
+
+CODE     PRELOAD MOVEABLE DISCARDABLE
+DATA     PRELOAD SINGLE
+
+EXPORTS
+       NP_GetEntryPoints   @1
+       NP_Initialize       @2
+       NP_Shutdown         @3
diff --git a/utils/nplugin/samples/gui/npgui32.rc b/utils/nplugin/samples/gui/npgui32.rc
new file mode 100644 (file)
index 0000000..cafee45
--- /dev/null
@@ -0,0 +1,44 @@
+#include "wx/msw/wx.rc"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "CompanyName",     "Julian Smart\0"
+            VALUE "FileDescription", "wxWindows GUI example plugin file\0"
+            VALUE "FileVersion",     "0.0.0.1\0"
+            VALUE "InternalName",    "wxWindows GUI Plugin\0"
+            VALUE "LegalCopyright",  "Copyright Julian Smart 1997\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename","npgui32.dll\0"
+            VALUE "ProductName",     "wxWindows GUI Plugin Sample\0"
+            VALUE "ProductVersion",  "0.0.0.1\0"
+            VALUE "MIMEType",        "wxgui/mime-type\0"
+            VALUE "FileExtents",     "gui\0"
+            VALUE "FileOpenName",    "wxWindows GUI (*.gui)\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
+END
+
diff --git a/utils/nplugin/samples/simple/makefile.nt b/utils/nplugin/samples/simple/makefile.nt
new file mode 100644 (file)
index 0000000..66e55ee
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1997
+# Updated:     
+# Copyright:   (c) 1997, Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile : Builds simple plugin example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+# Application is a DLL
+DLL=1
+
+EXTRAINC=/I$(WXDIR)\utils\nplugin\src
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+THISDIR = $(WXDIR)\utils\nplugin\smples\simple
+PROGRAM=npsimple32
+PLUGINLIB=$(WXDIR)\utils\nplugin\lib\nplugin.lib
+
+OBJECTS = simple.obj
+
+all:    $(PROGRAM).dll
+
+$(PROGRAM):    $(PROGRAM).exe
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt dllnp FINAL=$(FINAL)
+        cd $(THISDIR)
+
+# Update the dynamic link library
+
+$(PROGRAM).dll: $(DUMMYOBJ) $(OBJECTS) $(WXDIR)\lib\wx.lib $(PLUGINLIB) $(PROGRAM).res $(PROGRAM).def
+    $(link) $(LINKFLAGS) \
+    -out:$(PROGRAM).dll   \
+    -def:$(PROGRAM).def \
+    $(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res $(WXDIR)\lib\wx.lib $(PLUGINLIB) \
+    $(guilibsdll) msvcrt.lib shell32.lib comctl32.lib ctl3d32.lib
+
+simple.obj:      simple.$(SRCSUFF) $(DUMMYOBJ)
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+$(PROGRAM).res :      $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
+    $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
+
+copy:
+       copy npsimple32.dll "c:\program files\Netscape\Navigator\program\plugins"
+       copy npsimple32.dll "c:\program files\Internet Explorer\plugins"
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
+        -erase *.dll
+        -erase *.exp
+        -erase *.lib
+        -erase *.ilk
diff --git a/utils/nplugin/samples/simple/npsimple32.def b/utils/nplugin/samples/simple/npsimple32.def
new file mode 100644 (file)
index 0000000..e3af311
--- /dev/null
@@ -0,0 +1,9 @@
+LIBRARY   NPSIMPLE32
+
+CODE     PRELOAD MOVEABLE DISCARDABLE
+DATA     PRELOAD SINGLE
+
+EXPORTS
+       NP_GetEntryPoints   @1
+       NP_Initialize       @2
+       NP_Shutdown         @3
diff --git a/utils/nplugin/samples/simple/npsimple32.rc b/utils/nplugin/samples/simple/npsimple32.rc
new file mode 100644 (file)
index 0000000..f2d4903
--- /dev/null
@@ -0,0 +1,44 @@
+#include "wx/msw/wx.rc"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "CompanyName",     "Julian Smart\0"
+            VALUE "FileDescription", "wxWindows simple example plugin file\0"
+            VALUE "FileVersion",     "0.0.0.1\0"
+            VALUE "InternalName",    "wxWindows Simple Plugin\0"
+            VALUE "LegalCopyright",  "Copyright Julian Smart 1997\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename","npsimple32.dll\0"
+            VALUE "ProductName",     "wxWindows Simple Plugin Sample\0"
+            VALUE "ProductVersion",  "0.0.0.1\0"
+            VALUE "MIMEType",        "wxsimple/mime-type\0"
+            VALUE "FileExtents",     "smp\0"
+            VALUE "FileOpenName",    "wxWindows Simple (*.smp)\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
+END
+
diff --git a/utils/nplugin/samples/simple/simple.cpp b/utils/nplugin/samples/simple/simple.cpp
new file mode 100644 (file)
index 0000000..137e7b0
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * File:       simple.cpp
+ * Purpose:    Minimal wxWindows plugin
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:    
+ * Copyright:   (c) Julian Smart
+ */
+
+/* static const char sccsid[] = "%W% %G%"; */
+
+#ifdef __GNUG__
+#pragma implementation
+#pragma interface
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <fstream.h>
+
+#include "NPApp.h"
+#include "NPFrame.h"
+
+// Define a new application type
+class MyApp: public wxPluginApp
+{ public:
+    virtual wxFrame *OnInit(void);
+    virtual wxPluginFrame* OnNewInstance(const wxPluginData& data);
+};
+
+// Define a new frame type
+class MyFrame: public wxPluginFrame
+{ public:
+    MyFrame(const wxPluginData& data);
+    
+ public:
+    // Let's paint directly onto the 'frame'; we don't need a subwindow
+    void OnPaint(wxPaintEvent& event);
+    void OnDraw(wxDC& dc);
+    void OnMouseEvent(wxMouseEvent& event);
+
+    // Called when the file has been downloaded
+    virtual void OnNPNewFile(NPStream *stream, const wxString& fname);
+
+    void CentreStrings(wxDC& dc);
+
+   DECLARE_EVENT_TABLE()
+
+ protected:
+    wxStringList    m_strings;
+    long            m_xpos;
+    long            m_ypos;
+};
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+       EVT_SIZE(MyFrame::OnSize)
+       EVT_PAINT(MyFrame::OnPaint)
+       EVT_MOUSE_EVENTS(MyFrame::OnMouseEvent)
+END_EVENT_TABLE()
+
+IMPLEMENT_APP(MyApp)
+
+// No app initialisation necessary, and for a plugin there is no
+// top frame.
+wxFrame *MyApp::OnInit(void)
+{
+    return NULL;
+}
+
+// Called whenever a new plugin instance is called. We could check
+// various things here in 'data' but we won't bother.
+wxPluginFrame* MyApp::OnNewInstance(const wxPluginData& data)
+{
+    // Implicitly added to list of plugin frames
+    return new MyFrame(data);
+}
+
+// My frame constructor
+MyFrame::MyFrame(const wxPluginData& data):
+  wxPluginFrame(data)
+{
+    m_xpos = -1;
+    m_ypos = -1;
+}
+
+void MyFrame::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+
+    OnDraw(dc);
+}
+
+void MyFrame::OnDraw(wxDC& dc)
+{
+    dc.SetBrush(*wxCYAN_BRUSH);
+    dc.SetPen(*wxRED_PEN);
+
+    int w, h;
+    GetClientSize(&w, &h);
+
+    dc.DrawRectangle(0, 0, w, h);
+
+    wxFont swissFont(10, wxSWISS, wxNORMAL, wxNORMAL);
+    dc.SetFont(swissFont);
+    dc.SetBackgroundMode(wxTRANSPARENT);
+
+    CentreStrings(dc);
+}
+
+// Called when the file has been downloaded
+void MyFrame::OnNPNewFile(NPStream *stream, const wxString& fname)
+{
+    ifstream str(fname);
+    char buf[201];
+
+    while ( !str.eof() )
+    {
+        buf[0] = 0;
+        str.getline(buf, 200);
+
+        if ( buf[0] != 0 )
+            m_strings.Add(buf);
+    }
+    Refresh();
+}
+
+void MyFrame::CentreStrings(wxDC& dc)
+{
+    int y = 5;
+    int cw, ch;
+    GetClientSize(&cw, &ch);
+
+    wxNode *node = m_strings.First();
+    while ( node )
+    {
+        char *s = (char *)node->Data();
+        long w, h;
+        dc.GetTextExtent(s, &w, &h);
+
+        int x = wxMax(0, (cw - w)/2);
+        dc.DrawText(s, x, y);
+
+        y += h + (h/2);
+
+        node = node->Next();
+    }
+}
+
+// This implements a tiny doodling program. Drag the mouse using
+// the left button.
+void MyFrame::OnMouseEvent(wxMouseEvent& event)
+{
+  long x, y;
+  event.Position(&x, &y);
+  wxClientDC dc(this);
+
+  if (m_xpos > -1 && m_ypos > -1 && event.Dragging() && event.LeftIsDown())
+  {
+    dc.SetPen(wxBLACK_PEN);
+    dc.SetBrush(wxTRANSPARENT_BRUSH);
+    dc.DrawLine(m_xpos, m_ypos, x, y);
+  }
+  m_xpos = x;
+  m_ypos = y;
+}
+
diff --git a/utils/nplugin/src/makefile.nt b/utils/nplugin/src/makefile.nt
new file mode 100644 (file)
index 0000000..b3e4491
--- /dev/null
@@ -0,0 +1,78 @@
+#
+# File:                makefile.nt
+# Author:      Julian Smart
+# Created:     1993
+# Updated:     
+# Copyright:   (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile : Builds controls example (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+# Application is a DLL
+DLL=1
+
+!include $(WXDIR)\src\ntwxwin.mak
+
+PLUGINDIR = $(WXDIR)\utils\nplugin
+THISDIR = $(PLUGINDIR)\src
+LIBTARGET=$(PLUGINDIR)\lib\nplugin.lib
+
+OBJECTS = npwin.obj npshell.obj NPFrame.obj NPApp.obj
+
+all:    $(LIBTARGET)
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.nt clean
+        cd $(THISDIR)
+
+$(LIBTARGET): $(OBJECTS)
+       -erase $(LIBTARGET)
+       $(implib) @<<
+-out:$(LIBTARGET)
+-machine:$(CPU)
+$(OBJECTS)
+<<
+
+npwin.obj:      npwin.cpp npapi.h npupp.h
+        $(cc) @<<
+$(CPPFLAGS2) /c /Tp $*.$(SRCSUFF)
+<<
+
+npshell.obj:      npshell.cpp npapi.h NPApp.h NPFrame.h
+        $(cc) @<<
+$(CPPFLAGS2) /c /Tp $*.$(SRCSUFF)
+<<
+
+NPFrame.obj:      NPFrame.cpp NPFrame.h NPApp.h npapi.h
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+NPApp.obj:      NPApp.cpp NPApp.h NPFrame.h npapi.h
+        $(cc) @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
+<<
+
+clean:
+        -erase *.obj
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.sbr
+        -erase *.pdb
+        -erase *.dll
+        -erase *.exp
+        -erase *.ilk
+        -erase $(LIBTARGET)
diff --git a/utils/nplugin/src/npapi.h b/utils/nplugin/src/npapi.h
new file mode 100644 (file)
index 0000000..bbb631c
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ *  npapi.h $Revision$
+ *  Netscape client plug-in API spec
+ */
+
+#ifndef _NPAPI_H_
+#define _NPAPI_H_
+
+
+/* XXX this needs to get out of here */
+#if defined(__MWERKS__)
+#ifndef XP_MAC
+#define XP_MAC
+#endif
+#endif
+
+
+/*
+ *  Version constants
+ */
+
+#define NP_VERSION_MAJOR 0
+#define NP_VERSION_MINOR 6
+
+
+
+/* 
+ *  Basic types
+ */
+#ifndef _UINT16
+typedef unsigned short uint16;
+#endif
+#ifndef _UINT32
+typedef unsigned long uint32;
+#endif
+#ifndef _INT16
+typedef short int16;
+#endif
+#ifndef _INT32
+typedef long int32;
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+#ifndef TRUE
+#define TRUE (1)
+#endif
+#ifndef NULL
+#define NULL (0L)
+#endif
+
+typedef unsigned char   NPBool;
+typedef void*           NPEvent;
+typedef int16           NPError;
+typedef char*           NPMIMEType;
+
+
+/*
+ *  NPP is a plug-in's opaque instance handle
+ */
+typedef struct _NPP
+{
+    void*   pdata;                /* plug-in private data */
+    void*   ndata;                /* netscape private data */
+} NPP_t;
+
+typedef NPP_t*  NPP;
+
+
+
+typedef struct _NPStream
+{
+    void*       pdata;                /* plug-in private data */
+    void*       ndata;                /* netscape private data */
+    const char* url;
+    uint32      end;
+    uint32      lastmodified;
+} NPStream;
+
+typedef struct _NPByteRange
+{
+    int32                   offset;                /* negative offset means from the end */
+    uint32                  length;
+    struct _NPByteRange*    next;
+} NPByteRange;
+
+
+typedef struct _NPSavedData
+{
+    int32   len;
+    void*   buf;
+} NPSavedData;
+
+
+
+typedef struct _NPRect
+{
+    uint16  top;
+    uint16  left;
+    uint16  bottom;
+    uint16  right;
+} NPRect;
+
+typedef struct _NPWindow 
+{
+    void*   window;                 /* platform specific window handle */
+    uint32  x;                      /* position of top left corner relative to a netscape page */
+    uint32  y;                   
+    uint32  width;                  /* maximum window size */
+    uint32  height;
+    NPRect  clipRect;               /* clipping rectangle in port coordinates */
+} NPWindow;
+
+
+
+typedef struct _NPFullPrint
+{
+    NPBool      pluginPrinted;      /* Set TRUE if plugin handled fullscreen printing */
+    NPBool      printOne;           /* TRUE if plugin should print one copy to default printer */
+    void*       platformPrint;      /* Platform-specific printing info */
+} NPFullPrint;
+
+typedef struct _NPEmbedPrint
+{
+    NPWindow    window;
+    void*       platformPrint;      /* Platform-specific printing info */
+} NPEmbedPrint;
+
+typedef struct _NPPrint
+{
+    uint16              mode;       /* NP_FULL or NP_EMBED */
+    union
+    {
+        NPFullPrint     fullPrint;  /* if mode is NP_FULL */
+        NPEmbedPrint    embedPrint; /* if mode is NP_EMBED */
+    } print;
+} NPPrint;
+
+
+
+
+#ifdef XP_MAC
+
+/*
+ *  Mac-specific structures and definitions.
+ */
+#include <Quickdraw.h>
+#include <Events.h>
+
+typedef struct NP_Port
+{
+    CGrafPtr    port;           /* Grafport */
+    int32       portx;          /* position inside the topmost window */
+    int32       porty;
+} NP_Port;
+
+/*
+ *  Non-standard event types that can be passed to HandleEvent
+ */
+#define getFocusEvent       (osEvt + 16)
+#define loseFocusEvent      (osEvt + 17)
+#define adjustCursorEvent   (osEvt + 18)
+
+#endif /* XP_MAC */
+
+
+
+
+#define NP_EMBED        1
+#define NP_FULL         2
+#define NP_BACKGROUND   3
+
+#define NP_NORMAL       1
+#define NP_SEEK         2
+#define NP_ASFILE       3
+
+#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
+
+
+/*
+ *  Error and reason code definitions.
+ */
+
+#define NP_NOERR  0
+#define NP_EINVAL 1
+#define NP_EABORT 2
+
+#define NPERR_BASE                      0
+#define NPERR_NO_ERROR                  (NPERR_BASE + 0)
+#define NPERR_GENERIC_ERROR             (NPERR_BASE + 1)
+#define NPERR_INVALID_INSTANCE_ERROR    (NPERR_BASE + 2)
+#define NPERR_INVALID_FUNCTABLE_ERROR   (NPERR_BASE + 3)
+#define NPERR_MODULE_LOAD_FAILED_ERROR  (NPERR_BASE + 4)
+#define NPERR_OUT_OF_MEMORY_ERROR       (NPERR_BASE + 5)
+#define NPERR_INVALID_PLUGIN_ERROR      (NPERR_BASE + 6)
+#define NPERR_INVALID_PLUGIN_DIR_ERROR  (NPERR_BASE + 7)
+#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
+
+#define NPRES_BASE                      0
+#define NPRES_NETWORK_ERR               (NPRES_BASE + 0)
+#define NPRES_USER_BREAK                (NPRES_BASE + 1)
+#define NPRES_DONE                      (NPRES_BASE + 3)
+
+
+
+/*
+ *  Function prototypes.
+ *  Functions beginning with 'NPP' are functions provided by the plugin that Netscape will call.
+ *  Functions beginning with 'NPN' are functions provided by Netscape that the plugin will call.
+ */
+
+#if defined(_WINDOWS) && !defined(__WIN32__)
+#define NP_LOADDS  _loadds
+#else
+#define NP_LOADDS
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+NPError               NPP_Initialize(void);
+void                  NPP_Shutdown(void);
+NPError     NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
+NPError     NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
+NPError     NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
+NPError     NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+NPError     NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason);
+int32       NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
+int32       NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+void        NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void        NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
+int16                 NPP_HandleEvent(NPP instance, void* event);
+
+void        NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor);
+NPError     NPN_GetURL(NPP instance, const char* url, const char* window);
+NPError     NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
+NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
+NPError     NPN_NewStream(NPP instance, NPMIMEType type, NPStream* stream);
+int32       NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
+NPError     NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason);
+void        NPN_Status(NPP instance, const char* message);
+const char* NPN_UserAgent(NPP instance);
+void*       NPN_MemAlloc(uint32 size);
+void        NPN_MemFree(void* ptr);
+uint32      NPN_MemFlush(uint32 size);
+void           NPN_ReloadPlugins(NPBool reloadPages);
+
+#ifdef __cplusplus
+}  /* end extern "C" */
+#endif
+
+
+#endif /* _NPAPI_H_ */
+
diff --git a/utils/nplugin/src/npapp.cpp b/utils/nplugin/src/npapp.cpp
new file mode 100644 (file)
index 0000000..e9c4302
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * File:       NPApp.cc
+ * Purpose:    wxPluginApp implementation
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:
+ * Copyright:   (c) Julian Smart
+ */
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#include "NPApp.h"
+#include "NPFrame.h"
+
+#include <windows.h>
+
+IMPLEMENT_ABSTRACT_CLASS(wxPluginApp, wxApp)
+
+wxPluginApp *wxGetPluginApp(void)
+{
+    if ( wxTheApp && wxTheApp->IsKindOf(CLASSINFO(wxPluginApp)))
+        return (wxPluginApp *)wxTheApp;
+    else
+        return NULL;
+}
+
+wxPluginApp::wxPluginApp(void)
+{
+  m_data.m_argc = NULL;
+  m_data.m_argn = NULL;
+  m_data.m_argv = NULL;
+  m_data.m_type = 0;
+  m_data.m_instance = 0;
+  m_data.m_mode = 0;
+  m_data.m_window = 0;
+}
+
+wxPluginApp::~wxPluginApp(void)
+{
+    if ( m_data.m_argn )
+        delete[] m_data.m_argn;
+    if ( m_data.m_argv )
+        delete[] m_data.m_argv;
+}
+
+// Add a frame
+void wxPluginApp::AddFrame(wxPluginFrame *frame)
+{
+    m_frames.Append(frame);
+}
+
+// Remove a frame
+void wxPluginApp::RemoveFrame(wxPluginFrame *frame)
+{
+    m_frames.DeleteObject(frame);
+}
+
+// Find a frame given a NP instance
+wxPluginFrame *wxPluginApp::FindFrame(NPP instance)
+{
+    wxNode *node = m_frames.First();
+    while ( node )
+    {
+        wxPluginFrame *frame = (wxPluginFrame *)node->Data();
+        if ( frame->GetInstance() == instance )
+        {
+            return frame;
+        }
+        node = node->Next();
+    }
+    return NULL;
+}
+
+void wxPluginApp::SetAttributeValues(const int n, char *argn[], char *argv[])
+{
+    if ( m_data.m_argn )
+        delete[] m_data.m_argn;
+    if ( m_data.m_argv )
+        delete[] m_data.m_argv;
+
+    m_data.m_argc = n;
+
+    m_data.m_argn = new wxString[n];
+    m_data.m_argv = new wxString[n];
+    int i;
+    for ( i = 0; i < n ; i ++)
+    {
+        m_data.m_argn[i] = argn[i];
+        m_data.m_argv[i] = argv[i];
+    }
+}
+
+///////////////////////////////////////////////////////////////
+// Netscape Plugin API calls routed via wxPluginApp
+
+NPError   wxPluginApp::NPP_Destroy(NPP instance, NPSavedData** save)
+{
+    wxPluginFrame *frame = FindFrame(instance);
+    if ( frame )
+    {
+        frame->OnClose();
+        delete frame;
+    }
+    return NPERR_NO_ERROR;
+}
+
+NPError   wxPluginApp::NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason)
+{
+   return NPERR_NO_ERROR;
+}
+
+/*
+jref      wxPluginApp::NPP_GetJavaClass(void)
+{
+   return 0;
+}
+*/
+
+NPError   wxPluginApp::NPP_Initialize(void)
+{
+    static int init = FALSE;
+
+    if ( init == TRUE )
+        MessageBox(NULL, "wxPluginApp::NPP_Initialize:\nabout to call wxEntry for 2nd time!!!", "wxPlugin", MB_OK);
+
+    wxEntry((WXHINSTANCE) GetModuleHandle(NULL));
+
+    init = TRUE;
+
+//    MessageBox(NULL, "wxPluginApp::NPP_Initialize: have called wxEntry", "wxPlugin", MB_OK);
+    return NPERR_NO_ERROR;
+}
+
+NPError   wxPluginApp::NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
+                        int16 argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+//    MessageBox(NULL, "wxPluginApp::NPP_New", "wxPlugin", MB_OK);
+
+    // Save values so frame can be created in first NPP_SetWindow
+    if ( m_data.m_instance != 0 )
+    {
+        MessageBox(NULL, "wxPluginApp::NPP_New: whoops, 2 NPP_New calls in succession without NPP_SetWindow.\n Need to modify my code!", "wxPlugin", MB_OK);
+        return NPERR_NO_ERROR;
+    }
+
+    m_data.m_instance = instance;
+    m_data.m_type = pluginType;
+    m_data.m_mode = mode;
+
+    SetAttributeValues(argc, argn, argv);
+
+    // Unfortunately, we may get a stream event before we've got a valid window
+    // handle, so we just have to go ahead and create a new instance.
+    wxPluginFrame *frame = OnNewInstance(m_data);
+
+    m_data.m_instance = NULL;
+    m_data.m_window = NULL;
+    delete[] m_data.m_argv;
+    delete[] m_data.m_argn;
+    m_data.m_argv = NULL;
+    m_data.m_argn = NULL;
+
+    return NPERR_NO_ERROR;
+}
+
+NPError   wxPluginApp::NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream,
+                        NPBool seekable, uint16* stype)
+{
+    // By default, we want to receive a file instead of a stream.
+    wxPluginFrame *frame = FindFrame(instance);
+    if ( frame )
+    {
+        return frame->OnNPNewStream(type, stream, seekable, stype);
+    }
+    return NPERR_NO_ERROR;
+}
+
+void wxPluginApp::NPP_Print(NPP instance, NPPrint* printInfo)
+{
+    if (instance == NULL)
+        return;
+
+    wxPluginFrame *frame = FindFrame(instance);
+    if ( frame )
+    {
+        frame->OnNPPrint(printInfo);
+    }
+}
+
+NPError      wxPluginApp::NPP_SetWindow(NPP instance, NPWindow* window)
+{
+//    MessageBox(NULL, "wxPluginApp::NPP_SetWindow", "wxPlugin", MB_OK);
+
+    if ( window )
+        wxDebugMsg("%d\n", (int) window->window);
+
+    wxPluginFrame *frame = FindFrame(instance);
+    if ( frame )
+    {
+        frame->SetNPWindow(window);
+    }
+    else
+    {
+#if 0
+        // No such frame: must make it.
+        if ( m_data.m_instance == NULL )
+        {
+            MessageBox(NULL, "wxPluginApp::NPP_SetWindow: whoops, no data to create window. SetWindow called in funny order?", "wxPlugin", MB_OK);
+            return NPERR_NO_ERROR;
+        }
+
+        if ( window->window == NULL )
+        {
+            // We're receiving a NULL window before we've even received
+            // a valid window. Ignore this silly thing.
+            return NPERR_NO_ERROR;
+        }
+
+        m_data.m_window = window;
+        m_data.m_instance = instance;
+
+//        wxPluginFrame *frame = OnNewInstance(m_data);
+
+        m_data.m_instance = NULL;
+        m_data.m_window = NULL;
+        delete[] m_data.m_argv;
+        delete[] m_data.m_argn;
+        m_data.m_argv = NULL;
+        m_data.m_argn = NULL;
+#endif
+    }
+    return NPERR_NO_ERROR;
+}
+
+void      wxPluginApp::NPP_Shutdown(void)
+{
+    // Clean up wxWindows
+    CleanUp();
+}
+
+void      wxPluginApp::NPP_StreamAsFile(NPP instance, NPStream* stream, const char *fname)
+{
+    wxPluginFrame *frame = FindFrame(instance);
+    if ( frame )
+    {
+        wxString str(fname);
+        frame->OnNPNewFile(stream, str);
+    }
+}
+
+/*
+void      wxPluginApp::NPP_URLNotify(NPP instance, const char* url, NPReason reason,
+                        void* notifyData)
+{
+}
+*/
+
+int32     wxPluginApp::NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
+                        void* buf)
+{
+    return len;              // The number of bytes accepted
+}
+
+static int32 STREAMBUFSIZE = 0X0FFFFFFF;   // If we are reading from a file in NPAsFile
+                                    // mode so we can take any size stream in our
+                                    // write call (since we ignore it)
+
+int32     wxPluginApp::NPP_WriteReady(NPP instance, NPStream* stream)
+{
+    return STREAMBUFSIZE;   // Number of bytes ready to accept in NPP_Write()
+}
+
diff --git a/utils/nplugin/src/npapp.h b/utils/nplugin/src/npapp.h
new file mode 100644 (file)
index 0000000..238a612
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * File:       NPApp.h
+ * Purpose:    wxPluginApp declaration
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:    
+ * Copyright:   (c) Julian Smart
+ */
+
+#ifndef __PLUGINAPP__
+#define __PLUGINAPP__
+
+#include "wx/wx.h"
+#include "npapi.h"
+
+class wxPluginFrame;
+
+// Data passed to OnNewInstance
+class wxPluginData
+{
+public:
+    NPP         m_instance;
+    NPMIMEType  m_type;
+    NPWindow*   m_window;
+    int         m_mode;
+    int         m_argc;
+    wxString*   m_argn;
+    wxString*   m_argv;
+};
+
+class WXDLLEXPORT wxPluginApp: public wxApp
+{
+  DECLARE_ABSTRACT_CLASS(wxPluginApp)
+
+public:
+  wxPluginApp(void);
+  ~wxPluginApp(void);
+
+  // Find a frame given a NP instance
+  wxPluginFrame *FindFrame(NPP instance);
+
+  // Add a frame
+  void AddFrame(wxPluginFrame *frame);
+
+  // Remove a frame
+  void RemoveFrame(wxPluginFrame *frame);
+
+  // Set attribute/values for the last instance
+  void SetAttributeValues(const int n, char *argn[], char *argv[]);
+
+  ///////////////////////////////////////////////////////////////
+  // Higher-level API than NP API
+  virtual wxPluginFrame *OnNewInstance(const wxPluginData& data) = 0;
+
+  ///////////////////////////////////////////////////////////////
+  // Netscape Plugin API calls routed via wxPluginApp
+
+  virtual NPError   NPP_Destroy(NPP instance, NPSavedData** save);
+  virtual NPError   NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason);
+//  virtual jref      NPP_GetJavaClass(void);
+  virtual NPError   NPP_Initialize(void);
+  virtual NPError   NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
+                        int16 argc, char* argn[], char* argv[], NPSavedData* saved);
+  virtual NPError   NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream,
+                        NPBool seekable, uint16* stype);
+  virtual void      NPP_Print(NPP instance, NPPrint* platformPrint);
+  virtual NPError   NPP_SetWindow(NPP instance, NPWindow* window);
+  virtual void      NPP_Shutdown(void);
+  virtual void      NPP_StreamAsFile(NPP instance, NPStream* stream, const char *fname);
+/*
+  virtual void      NPP_URLNotify(NPP instance, const char* url, NPReason reason,
+                        void* notifyData);
+*/
+  virtual int32     NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
+                        void* buf);
+  virtual int32     NPP_WriteReady(NPP instance, NPStream* stream);
+
+protected:
+
+  // List of plugin frames
+  wxList        m_frames;
+
+  // Temporary NPP_New arguments so we can wait until NPP_SetWindow is called
+  // before creating a frame
+  wxPluginData  m_data;
+};
+
+wxPluginApp *wxGetPluginApp(void);
+
+#endif
+
diff --git a/utils/nplugin/src/npframe.cpp b/utils/nplugin/src/npframe.cpp
new file mode 100644 (file)
index 0000000..e3e3f63
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * File:       NPFrame.cc
+ * Purpose:    wxPluginFrame implementation
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:
+ * Copyright:   (c) Julian Smart
+ */
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/frame.h"
+#endif
+
+#include "wx/dcprint.h"
+
+#include "NPFrame.h"
+#include "NPApp.h"
+
+#include <windows.h>
+
+extern wxList wxModelessWindows;
+extern char wxFrameClassName[];
+
+IMPLEMENT_DYNAMIC_CLASS(wxPluginFrame, wxFrame)
+
+wxPluginFrame::wxPluginFrame(void)
+{
+    m_npWindow = NULL;
+    m_npInstance = NULL;
+    m_nAttributes = 0;
+    m_names = NULL;
+    m_values = NULL;
+}
+
+bool wxPluginFrame::Create(const wxPluginData& data)
+{
+    SetName("pluginFrame");
+
+    m_npWindow = NULL;
+    m_npInstance = NULL;
+    m_nAttributes = 0;
+    m_names = NULL;
+    m_values = NULL;
+    m_npWindow = data.m_window;
+    m_npInstance = data.m_instance;
+
+    SetAttributeValues(data.m_argc, data.m_argn, data.m_argv);
+    SetNPWindow(data.m_window);
+
+    wxModelessWindows.Append(this);
+
+    if (wxTheApp->IsKindOf(CLASSINFO(wxPluginApp)))
+    {
+        ((wxPluginApp *)wxTheApp)->AddFrame(this);
+    }
+    return TRUE;
+}
+
+wxPluginFrame::~wxPluginFrame(void)
+{
+    if (wxTheApp->IsKindOf(CLASSINFO(wxPluginApp)))
+    {
+        ((wxPluginApp *)wxTheApp)->RemoveFrame(this);
+    }
+
+    if ( GetHWND() )
+        UnsubclassWin();
+    m_hWnd = 0;
+
+    if ( m_names )
+        delete[] m_names;
+    if ( m_values )
+        delete[] m_values;
+}
+
+// Get size *available for subwindows* i.e. excluding menu bar etc.
+// For XView, this is the same as GetSize
+void wxPluginFrame::GetClientSize(int *x, int *y) const
+{
+    if ( !m_hWnd )
+    {
+        *x = 0; *y = 0;
+        return;
+    }
+    wxFrame::GetClientSize(x, y);
+}
+
+// Set the client size (i.e. leave the calculation of borders etc.
+// to wxWindows)
+void wxPluginFrame::SetClientSize(const int width, const int height)
+{
+    if ( !m_hWnd )
+        return ;
+
+    wxFrame::SetClientSize(width, height);
+}
+
+void wxPluginFrame::GetSize(int *width, int *height) const
+{
+    if ( !m_hWnd )
+    {
+        *width = 0; *height = 0;
+        return;
+    }
+    wxFrame::GetSize(width, height);
+}
+
+void wxPluginFrame::GetPosition(int *x, int *y) const
+{
+    if ( !m_hWnd )
+    {
+        *x = 0; *y = 0;
+        return;
+    }
+    wxFrame::GetPosition(x, y);
+}
+
+void wxPluginFrame::SetAttributeValues(const int n, const char *argn[], const char *argv[])
+{
+    if ( m_names )
+        delete[] m_names;
+    if ( m_values )
+        delete[] m_values;
+
+    m_nAttributes = n;
+
+    m_names = new wxString[n];
+    m_values = new wxString[n];
+    int i;
+    for ( i = 0; i < n ; i ++)
+    {
+        m_names[i] = argn[i];
+        m_values[i] = argv[i];
+    }
+}
+
+void wxPluginFrame::SetAttributeValues(const int n, const wxString* argn, const wxString* argv)
+{
+    if ( m_names )
+        delete[] m_names;
+    if ( m_values )
+        delete[] m_values;
+
+    m_nAttributes = n;
+
+    m_names = new wxString[n];
+    m_values = new wxString[n];
+    int i;
+    for ( i = 0; i < n ; i ++)
+    {
+        m_names[i] = argn[i];
+        m_values[i] = argv[i];
+    }
+}
+
+void wxPluginFrame::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
+{
+    // Can't allow app to set the size.
+    return;
+}
+
+// Sets and subclasses the platform-specific window handle
+bool wxPluginFrame::SetNPWindow(NPWindow *window)
+{
+    if ( !window || !window->window)
+    {
+        if ( m_hWnd )
+        {
+            wxMessageBox("Unsubclassing window prematurely");
+            UnsubclassWin();
+            m_hWnd = 0;
+        }
+        m_npWindow = NULL;
+    }
+    else
+    {
+        if ( m_hWnd )
+        {
+            if ( m_hWnd == (WXHWND) window->window )
+            {
+                // Does this mean a resize?
+                return TRUE;
+            }
+        }
+
+        m_npWindow = window;
+        m_hWnd = (WXHWND) window->window;
+        SubclassWin(m_hWnd);
+        m_windowId = ::GetWindowLong((HWND) m_hWnd, GWL_ID);
+    }
+    return TRUE;
+}
+
+NPError wxPluginFrame::OnNPNewStream(NPMIMEType type, NPStream *stream, bool seekable, uint16* stype)
+{
+    *stype = NP_ASFILE;
+    return NPERR_NO_ERROR;
+}
+
+void wxPluginFrame::OnNPNewFile(NPStream *stream, const wxString& fname)
+{
+}
+
+void wxPluginFrame::OnNPPrint(NPPrint* printInfo)
+{
+        if (printInfo->mode == NP_FULL)
+        {
+            //
+            // *Developers*: If your plugin would like to take over
+            // printing completely when it is in full-screen mode,
+            // set printInfo->pluginPrinted to TRUE and print your
+            // plugin as you see fit.  If your plugin wants Netscape
+            // to handle printing in this case, set printInfo->pluginPrinted
+            // to FALSE (the default) and do nothing.  If you do want
+            // to handle printing yourself, printOne is true if the
+            // print button (as opposed to the print menu) was clicked.
+            // On the Macintosh, platformPrint is a THPrint; on Windows,
+            // platformPrint is a structure (defined in npapi.h) containing
+            // the printer name, port, etc.
+            //
+            void* platformPrint = printInfo->print.fullPrint.platformPrint;
+            NPBool printOne = printInfo->print.fullPrint.printOne;
+            
+            printInfo->print.fullPrint.pluginPrinted = FALSE; // Do the default
+        
+        }
+        else    // If not fullscreen, we must be embedded
+        {
+            //
+            // *Developers*: If your plugin is embedded, or is full-screen
+            // but you returned false in pluginPrinted above, NPP_Print
+            // will be called with mode == NP_EMBED.  The NPWindow
+            // in the printInfo gives the location and dimensions of
+            // the embedded plugin on the printed page.  On the Macintosh,
+            // platformPrint is the printer port; on Windows, platformPrint
+            // is the handle to the printing device context.
+            //
+            NPWindow* printWindow = &(printInfo->print.embedPrint.window);
+            void* platformPrint = printInfo->print.embedPrint.platformPrint;
+
+            HDC hDC = (HDC) platformPrint;
+            wxRectangle rect;
+            rect.x = printWindow->x;
+            rect.y = printWindow->y;
+            rect.width = printWindow->width;
+            rect.height = printWindow->height;
+
+                       int saveIt = ::SaveDC(hDC);
+
+            wxPrinterDC *printerDC = new wxPrinterDC((WXHDC) hDC);
+
+            OnPrint(*printerDC, rect);
+
+            printerDC->SetHDC(0);
+                       delete printerDC;
+
+                       ::RestoreDC(hDC, saveIt);
+        }
+ }
+
+void wxPluginFrame::OnPrint(wxPrinterDC& dc, wxRectangle& rect)
+{
+    // We must do some transformations here
+       RECT winRect;
+/*
+       winRect.left = rect.x;
+       winRect.top = rect.y;
+       winRect.right = rect.x + rect.right;
+       winRect.bottom = rect.y + rect.height;
+*/
+       POINT winPoint[2];
+       winPoint[0].x = rect.x;
+       winPoint[0].y = rect.y;
+       winPoint[1].x = rect.x + rect.width;
+       winPoint[1].y = rect.y + rect.height;
+
+       if (!LPtoDP((HDC) dc.GetHDC(), winPoint, 2))
+               wxMessageBox("LPtoDP failed.");
+
+    OnDraw(dc);
+}
+
+void wxPluginFrame::OnDraw(wxDC& dc)
+{
+}
+
diff --git a/utils/nplugin/src/npframe.h b/utils/nplugin/src/npframe.h
new file mode 100644 (file)
index 0000000..23a45da
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * File:       NPFrame.h
+ * Purpose:    wxPluginFrame declaration
+ * Author:     Julian Smart
+ * Created:    1997
+ * Updated:    
+ * Copyright:   (c) Julian Smart
+ */
+
+#ifndef __PLUGINFRAME__
+#define __PLUGINFRAME__
+
+#include "wx/frame.h"
+#include "NPApp.h"
+#include "npapi.h"
+
+WXDLLEXPORT extern const char *wxFrameNameStr;
+
+class wxPrinterDC;
+class WXDLLEXPORT wxPluginFrame: public wxFrame
+{
+  DECLARE_DYNAMIC_CLASS(wxPluginFrame)
+
+public:
+  wxPluginFrame(void);
+  inline wxPluginFrame(const wxPluginData& data)
+  {
+      m_npWindow = NULL;
+      m_npInstance = NULL;
+      m_nAttributes = 0;
+      m_names = NULL;
+      m_values = NULL;
+
+      Create(data);
+  }
+
+  ~wxPluginFrame(void);
+
+  bool Create(const wxPluginData& data);
+
+  // Sets and subclasses the platform-specific window handle
+  virtual bool SetNPWindow(NPWindow *window);
+  inline NPWindow *GetNPWindow(void) { return m_npWindow; }
+
+  void SetClientSize(const int width, const int height);
+  void GetClientSize(int *width, int *height) const;
+
+  void GetSize(int *width, int *height) const ;
+  void GetPosition(int *x, int *y) const ;
+  void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO);
+
+  // Accessors
+  inline int GetAttributeCount(void) const { return m_nAttributes; }
+  inline wxString GetAttributeName(const int n) { return m_names[n]; }
+  inline wxString GetAttributeValue(const int n) { return m_values[n]; }
+
+  void SetAttributeValues(const int n, const char* argn[], const char *argv[]);
+  void SetAttributeValues(const int n, const wxString* argn, const wxString* argv);
+  inline void SetInstance(const NPP instance) { m_npInstance = instance; };
+  inline NPP GetInstance(void) { return m_npInstance; }
+
+  // Overridables: low-level
+  virtual NPError OnNPNewStream(NPMIMEType type, NPStream *stream, bool seekable, uint16* stype);
+  virtual void OnNPNewFile(NPStream *stream, const wxString& fname);
+  virtual void OnNPPrint(NPPrint* printInfo);
+
+  // Overridables: high-level
+  virtual void OnPrint(wxPrinterDC& dc, wxRectangle& rect);
+  virtual void OnDraw(wxDC& dc);
+
+protected:
+
+  wxString*     m_names;
+  wxString*     m_values;
+  int           m_nAttributes;
+  NPP           m_npInstance;
+  NPWindow*     m_npWindow;
+};
+
+#endif
+
diff --git a/utils/nplugin/src/npshell.cpp b/utils/nplugin/src/npshell.cpp
new file mode 100644 (file)
index 0000000..fa04005
--- /dev/null
@@ -0,0 +1,278 @@
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+//
+// npshell.cpp
+//
+// This file defines a "shell" plugin that plugin developers can use
+// as the basis for a real plugin.  This shell just provides empty
+// implementations of all functions that the plugin can implement
+// that will be called by Netscape (the NPP_xxx methods defined in 
+// npapi.h). 
+//
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+#ifndef _NPAPI_H_
+#include "npapi.h"
+#endif
+
+#include <windows.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "NPApp.h"
+
+//
+// Instance state information about the plugin.
+//
+// *Developers*: Use this struct to hold per-instance
+//               information that you'll need in the
+//               various functions in this file.
+//
+typedef struct _PluginInstance
+{
+    NPWindow*       fWindow;
+    uint16          fMode;
+    
+} PluginInstance;
+
+
+
+//------------------------------------------------------------------------------------
+// NPP_Initialize:
+//------------------------------------------------------------------------------------
+NPError NPP_Initialize(void)
+{
+//    MessageBox(NULL, "NPP_Initialize", "NPTest", MB_OK);
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_Initialize();
+    else
+        return NPERR_NO_ERROR;
+}
+
+
+//------------------------------------------------------------------------------------
+// NPP_Shutdown:
+//------------------------------------------------------------------------------------
+void NPP_Shutdown(void)
+{
+//    MessageBox(NULL, "NPP_Shutdown", "wxPlugin", MB_OK);
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        app->NPP_Shutdown();
+}
+
+
+//------------------------------------------------------------------------------------
+// NPP_New:
+//------------------------------------------------------------------------------------
+NPError NP_LOADDS
+NPP_New(NPMIMEType pluginType,
+                NPP instance,
+                uint16 mode,
+                int16 argc,
+                char* argn[],
+                char* argv[],
+                NPSavedData* saved)
+{
+//    MessageBox(NULL, "NPP_New", "NPTest", MB_OK);
+
+    if (instance == NULL)
+        return NPERR_INVALID_INSTANCE_ERROR;
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
+    else
+        return NPERR_NO_ERROR;
+}
+
+//------------------------------------------------------------------------------------
+// NPP_Destroy:
+//------------------------------------------------------------------------------------
+NPError NP_LOADDS
+NPP_Destroy(NPP instance, NPSavedData** save)
+{
+//    MessageBox(NULL, "NPP_Destroy", "NPTest", MB_OK);
+
+    if (instance == NULL)
+        return NPERR_INVALID_INSTANCE_ERROR;
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_Destroy(instance, save);
+    else
+        return NPERR_NO_ERROR;
+}
+
+
+//------------------------------------------------------------------------------------
+// NPP_SetWindow:
+//------------------------------------------------------------------------------------
+NPError NP_LOADDS
+NPP_SetWindow(NPP instance, NPWindow* window)
+{
+//    MessageBox(NULL, "NPP_SetWindow", "NPTest", MB_OK);
+
+    if (instance == NULL)
+        return NPERR_INVALID_INSTANCE_ERROR;
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_SetWindow(instance, window);
+    else
+        return NPERR_NO_ERROR;
+}
+
+
+//------------------------------------------------------------------------------------
+// NPP_NewStream:
+//------------------------------------------------------------------------------------
+NPError NP_LOADDS
+NPP_NewStream(NPP instance,
+                            NPMIMEType type,
+                            NPStream *stream, 
+                            NPBool seekable,
+                            uint16 *stype)
+{
+//    MessageBox(NULL, "NPP_NewStream", "NPTest", MB_OK);
+
+    if (instance == NULL)
+        return NPERR_INVALID_INSTANCE_ERROR;
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_NewStream(instance, type, stream, seekable, stype);
+    else
+        return NPERR_NO_ERROR;
+}
+
+
+
+//
+// *Developers*: 
+// These next 2 functions are directly relevant in a plug-in which handles the
+// data in a streaming manner.  If you want zero bytes because no buffer space
+// is YET available, return 0.  As long as the stream has not been written
+// to the plugin, Navigator will continue trying to send bytes.  If the plugin
+// doesn't want them, just return some large number from NPP_WriteReady(), and
+// ignore them in NPP_Write().  For a NP_ASFILE stream, they are still called
+// but can safely be ignored using this strategy.
+//
+
+static int32 STREAMBUFSIZE = 0X0FFFFFFF;   // If we are reading from a file in NPAsFile
+                                    // mode so we can take any size stream in our
+                                    // write call (since we ignore it)
+
+//------------------------------------------------------------------------------------
+// NPP_WriteReady:
+//------------------------------------------------------------------------------------
+int32 NP_LOADDS
+NPP_WriteReady(NPP instance, NPStream *stream)
+{
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_WriteReady(instance, stream);
+    else
+        return STREAMBUFSIZE;
+
+    return STREAMBUFSIZE;   // Number of bytes ready to accept in NPP_Write()
+}
+
+
+
+//------------------------------------------------------------------------------------
+// NPP_Write:
+//------------------------------------------------------------------------------------
+int32 NP_LOADDS
+NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
+{
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_Write(instance, stream, offset, len, buffer);
+    else
+        return len;              // The number of bytes accepted
+}
+
+
+
+//------------------------------------------------------------------------------------
+// NPP_DestroyStream:
+//------------------------------------------------------------------------------------
+NPError NP_LOADDS
+NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason)
+{
+    if (instance == NULL)
+        return NPERR_INVALID_INSTANCE_ERROR;
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        return app->NPP_DestroyStream(instance, stream, reason);
+    else
+        return NPERR_NO_ERROR;
+}
+
+
+//------------------------------------------------------------------------------------
+// NPP_StreamAsFile:
+//------------------------------------------------------------------------------------
+void NP_LOADDS
+NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname)
+{
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        app->NPP_StreamAsFile(instance, stream, fname);
+}
+
+
+
+//------------------------------------------------------------------------------------
+// NPP_Print:
+//------------------------------------------------------------------------------------
+void NP_LOADDS
+NPP_Print(NPP instance, NPPrint* printInfo)
+{
+    if (printInfo == NULL)   // trap invalid parm
+        return;
+    if ( instance == NULL )
+        return;
+
+    wxPluginApp *app = wxGetPluginApp();
+    if ( app )
+        app->NPP_Print(instance, printInfo);
+}
+
+
+//------------------------------------------------------------------------------------
+// NPP_HandleEvent:
+// Mac-only.
+//------------------------------------------------------------------------------------
+int16 NPP_HandleEvent(NPP instance, void* event)
+{
+    NPBool eventHandled = FALSE;
+    if (instance == NULL)
+        return eventHandled;
+        
+    PluginInstance* This = (PluginInstance*) instance->pdata;
+    
+    //
+    // *Developers*: The "event" passed in is a Macintosh
+    // EventRecord*.  The event.what field can be any of the
+    // normal Mac event types, or one of the following additional
+    // types defined in npapi.h: getFocusEvent, loseFocusEvent,
+    // adjustCursorEvent.  The focus events inform your plugin
+    // that it will become, or is no longer, the recepient of
+    // key events.  If your plugin doesn't want to receive key
+    // events, return false when passed at getFocusEvent.  The
+    // adjustCursorEvent is passed repeatedly when the mouse is
+    // over your plugin; if your plugin doesn't want to set the
+    // cursor, return false.  Handle the standard Mac events as
+    // normal.  The return value for all standard events is currently
+    // ignored except for the key event: for key events, only return
+    // true if your plugin has handled that particular key event. 
+    //
+    
+    return eventHandled;
+}
+
diff --git a/utils/nplugin/src/npupp.h b/utils/nplugin/src/npupp.h
new file mode 100644 (file)
index 0000000..1c352d2
--- /dev/null
@@ -0,0 +1,799 @@
+/*
+ *  npupp.h $Revision$
+ *  function call mecahnics needed by platform specific glue code.
+ */
+
+
+#ifndef _NPUPP_H_
+#define _NPUPP_H_
+
+#ifndef GENERATINGCFM
+#define GENERATINGCFM 0
+#endif
+
+#ifndef _NPAPI_H_
+#include "npapi.h"
+#endif
+
+/******************************************************************************************
+   plug-in function table macros
+               for each function in and out of the plugin API we define
+                    typedef NPP_FooUPP
+                                       #define NewNPP_FooProc
+                                       #define CallNPP_FooProc
+                       for mac, define the UPP magic for PPC/68K calling
+ *******************************************************************************************/
+
+
+/* NPP_Initialize */
+
+#if GENERATINGCFM
+typedef UniversalProcPtr NPP_InitializeUPP;
+
+enum {
+       uppNPP_InitializeProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))              
+               | RESULT_SIZE(SIZE_CODE(0))
+};
+
+#define NewNPP_InitializeProc(FUNC)            \
+               (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
+#define CallNPP_InitializeProc(FUNC)           \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
+               
+#else
+
+typedef void (*NPP_InitializeUPP)(void);
+#define NewNPP_InitializeProc(FUNC)            \
+               ((NPP_InitializeUPP) (FUNC))
+#define CallNPP_InitializeProc(FUNC)           \
+               (*(FUNC))()
+
+#endif
+
+
+/* NPP_Shutdown */
+
+#if GENERATINGCFM
+typedef UniversalProcPtr NPP_ShutdownUPP;
+
+enum {
+       uppNPP_ShutdownProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))              
+               | RESULT_SIZE(SIZE_CODE(0))
+};
+
+#define NewNPP_ShutdownProc(FUNC)              \
+               (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
+#define CallNPP_ShutdownProc(FUNC)             \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
+               
+#else
+
+typedef void (*NPP_ShutdownUPP)(void);
+#define NewNPP_ShutdownProc(FUNC)              \
+               ((NPP_ShutdownUPP) (FUNC))
+#define CallNPP_ShutdownProc(FUNC)             \
+               (*(FUNC))()
+
+#endif
+
+
+/* NPP_New */
+
+#if GENERATINGCFM
+typedef UniversalProcPtr NPP_NewUPP;
+
+enum {
+       uppNPP_NewProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16)))
+               | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16)))
+               | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
+               | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
+               | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+
+#define NewNPP_NewProc(FUNC)           \
+               (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
+#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
+                                                                  (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+#else
+
+typedef NPError        (*NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
+#define NewNPP_NewProc(FUNC)           \
+               ((NPP_NewUPP) (FUNC))
+#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7)                \
+               (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+
+#endif
+
+
+/* NPP_Destroy */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_DestroyUPP;
+enum {
+       uppNPP_DestroyProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_DestroyProc(FUNC)               \
+               (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
+#define CallNPP_DestroyProc(FUNC, ARG1, ARG2)          \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
+#else
+
+typedef NPError        (*NPP_DestroyUPP)(NPP instance, NPSavedData** save);
+#define NewNPP_DestroyProc(FUNC)               \
+               ((NPP_DestroyUPP) (FUNC))
+#define CallNPP_DestroyProc(FUNC, ARG1, ARG2)          \
+               (*(FUNC))((ARG1), (ARG2))
+
+#endif
+
+
+/* NPP_SetWindow */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_SetWindowUPP;
+enum {
+       uppNPP_SetWindowProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_SetWindowProc(FUNC)             \
+               (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
+#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2)                \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
+
+#else
+
+typedef NPError        (*NPP_SetWindowUPP)(NPP instance, NPWindow* window);
+#define NewNPP_SetWindowProc(FUNC)             \
+               ((NPP_SetWindowUPP) (FUNC))
+#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2)                \
+               (*(FUNC))((ARG1), (ARG2))
+
+#endif
+
+
+/* NPP_NewStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_NewStreamUPP;
+enum {
+       uppNPP_NewStreamProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
+               | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_NewStreamProc(FUNC)             \
+               (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
+#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5)              \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
+#else
+
+typedef NPError        (*NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+#define NewNPP_NewStreamProc(FUNC)             \
+               ((NPP_NewStreamUPP) (FUNC))
+#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
+               (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
+#endif
+
+
+/* NPP_DestroyStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_DestroyStreamUPP;
+enum {
+       uppNPP_DestroyStreamProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPError)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_DestroyStreamProc(FUNC)         \
+               (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
+#define CallNPP_DestroyStreamProc(FUNC,  NPParg, NPStreamPtr, NPErrorArg)              \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPErrorArg))
+
+#else
+
+typedef NPError        (*NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPError reason);
+#define NewNPP_DestroyStreamProc(FUNC)         \
+               ((NPP_DestroyStreamUPP) (FUNC))
+#define CallNPP_DestroyStreamProc(FUNC,  NPParg, NPStreamPtr, NPErrorArg)              \
+               (*(FUNC))((NPParg), (NPStreamPtr), (NPErrorArg))
+
+#endif
+
+
+/* NPP_WriteReady */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_WriteReadyUPP;
+enum {
+       uppNPP_WriteReadyProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
+};
+#define NewNPP_WriteReadyProc(FUNC)            \
+               (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
+#define CallNPP_WriteReadyProc(FUNC,  NPParg, NPStreamPtr)             \
+               (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
+
+#else
+
+typedef int32 (*NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
+#define NewNPP_WriteReadyProc(FUNC)            \
+               ((NPP_WriteReadyUPP) (FUNC))
+#define CallNPP_WriteReadyProc(FUNC,  NPParg, NPStreamPtr)             \
+               (*(FUNC))((NPParg), (NPStreamPtr))
+
+#endif
+
+
+/* NPP_Write */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_WriteUPP;
+enum {
+       uppNPP_WriteProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
+               | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32)))
+               | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
+};
+#define NewNPP_WriteProc(FUNC)         \
+               (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
+#define CallNPP_WriteProc(FUNC,  NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr)            \
+               (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
+
+#else
+
+typedef int32 (*NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+#define NewNPP_WriteProc(FUNC)         \
+               ((NPP_WriteUPP) (FUNC))
+#define CallNPP_WriteProc(FUNC,  NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr)            \
+               (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
+
+#endif
+
+
+/* NPP_StreamAsFile */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_StreamAsFileUPP;
+enum {
+       uppNPP_StreamAsFileProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
+               | RESULT_SIZE(SIZE_CODE(0))
+};
+#define NewNPP_StreamAsFileProc(FUNC)          \
+               (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
+#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3)               \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
+
+#else
+
+typedef void (*NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
+#define NewNPP_StreamAsFileProc(FUNC)          \
+               ((NPP_StreamAsFileUPP) (FUNC))
+#define CallNPP_StreamAsFileProc(FUNC,  ARG1, ARG2, ARG3)              \
+               (*(FUNC))((ARG1), (ARG2), (ARG3))
+#endif
+
+
+/* NPP_Print */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_PrintUPP;
+enum {
+       uppNPP_PrintProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *)))
+               | RESULT_SIZE(SIZE_CODE(0))
+};
+#define NewNPP_PrintProc(FUNC)         \
+               (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
+#define CallNPP_PrintProc(FUNC,  NPParg, voidPtr)              \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
+
+#else
+
+typedef void (*NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
+#define NewNPP_PrintProc(FUNC)         \
+               ((NPP_PrintUPP) (FUNC))
+#define CallNPP_PrintProc(FUNC,  NPParg, NPPrintArg)           \
+               (*(FUNC))((NPParg), (NPPrintArg))
+
+#endif
+
+
+/* NPP_HandleEvent */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_HandleEventUPP;
+enum {
+       uppNPP_HandleEventProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(int16)))
+};
+#define NewNPP_HandleEventProc(FUNC)           \
+               (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
+#define CallNPP_HandleEventProc(FUNC,  NPParg, voidPtr)                \
+               (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
+
+#else
+
+typedef int16 (*NPP_HandleEventUPP)(NPP instance, void* event);
+#define NewNPP_HandleEventProc(FUNC)           \
+               ((NPP_HandleEventUPP) (FUNC))
+#define CallNPP_HandleEventProc(FUNC,  NPParg, voidPtr)                \
+               (*(FUNC))((NPParg), (voidPtr))
+
+#endif
+
+
+
+
+/*
+ *  Netscape entry points
+ */
+
+
+/* NPN_GetUrl */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_GetURLUPP;
+enum {
+       uppNPN_GetURLProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_GetURLProc(FUNC)                \
+               (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
+#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
+#else
+
+typedef NPError        (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
+#define NewNPN_GetURLProc(FUNC)                \
+               ((NPN_GetURLUPP) (FUNC))
+#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3)             \
+               (*(FUNC))((ARG1), (ARG2), (ARG3))
+#endif
+
+
+/* NPN_PostUrl */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_PostURLUPP;
+enum {
+       uppNPN_PostURLProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
+               | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
+               | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
+               | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_PostURLProc(FUNC)               \
+               (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
+#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
+#else
+
+typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
+#define NewNPN_PostURLProc(FUNC)               \
+               ((NPN_PostURLUPP) (FUNC))
+#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
+               (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
+#endif
+
+
+/* NPN_RequestRead */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_RequestReadUPP;
+enum {
+       uppNPN_RequestReadProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_RequestReadProc(FUNC)           \
+               (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
+#define CallNPN_RequestReadProc(FUNC,  stream, range)          \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
+
+#else
+
+typedef NPError        (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
+#define NewNPN_RequestReadProc(FUNC)           \
+               ((NPN_RequestReadUPP) (FUNC))
+#define CallNPN_RequestReadProc(FUNC, stream, range)           \
+               (*(FUNC))((stream), (range))
+
+#endif
+
+
+/* NPN_NewStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_NewStreamUPP;
+enum {
+       uppNPN_NewStreamProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
+               | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16*)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_NewStreamProc(FUNC)             \
+               (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
+#define CallNPN_NewStreamProc(FUNC, npp, type, stream)         \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (stream)) 
+
+#else
+
+typedef NPError        (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream);
+#define NewNPN_NewStreamProc(FUNC)             \
+               ((NPN_NewStreamUPP) (FUNC))
+#define CallNPN_NewStreamProc(FUNC, npp, type, stream)         \
+               (*(FUNC))((npp), (type), (stream))
+
+#endif
+
+
+/* NPN_Write */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_WriteUPP;
+enum {
+       uppNPN_WriteProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
+               | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
+};
+#define NewNPN_WriteProc(FUNC)         \
+               (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
+#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer)              \
+               (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))      
+
+#else
+
+typedef int32 (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
+#define NewNPN_WriteProc(FUNC)         \
+               ((NPN_WriteUPP) (FUNC))
+#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer)              \
+               (*(FUNC))((npp), (stream), (len), (buffer))
+
+#endif
+
+
+/* NPN_DestroyStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_DestroyStreamUPP;
+enum {
+       uppNPN_DestroyStreamProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPError)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_DestroyStreamProc(FUNC)         \
+               (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
+#define CallNPN_DestroyStreamProc(FUNC, npp, stream, err)              \
+               (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (err))      
+
+#else
+
+typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPError reason);
+#define NewNPN_DestroyStreamProc(FUNC)         \
+               ((NPN_DestroyStreamUPP) (FUNC))
+#define CallNPN_DestroyStreamProc(FUNC, npp, stream, err)              \
+               (*(FUNC))((npp), (stream), (err))
+
+#endif
+
+
+/* NPN_Status */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_StatusUPP;
+enum {
+       uppNPN_StatusProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
+};
+
+#define NewNPN_StatusProc(FUNC)                \
+               (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
+#define CallNPN_StatusProc(FUNC, npp, msg)             \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))  
+
+#else
+
+typedef void (*NPN_StatusUPP)(NPP instance, const char* message);
+#define NewNPN_StatusProc(FUNC)                \
+               ((NPN_StatusUPP) (FUNC))
+#define CallNPN_StatusProc(FUNC, npp, msg)             \
+               (*(FUNC))((npp), (msg)) 
+
+#endif
+
+
+/* NPN_UserAgent */
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_UserAgentUPP;
+enum {
+        uppNPN_UserAgentProcInfo = kThinkCStackBased
+                | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+                | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
+};
+
+#define NewNPN_UserAgentProc(FUNC)              \
+                (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
+#define CallNPN_UserAgentProc(FUNC, ARG1)               \
+                (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
+
+#else
+
+typedef const char*    (*NPN_UserAgentUPP)(NPP instance);
+#define NewNPN_UserAgentProc(FUNC)              \
+                ((NPN_UserAgentUPP) (FUNC))
+#define CallNPN_UserAgentProc(FUNC, ARG1)               \
+                (*(FUNC))((ARG1))
+
+#endif
+
+
+/* NPN_MemAlloc */
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_MemAllocUPP;
+enum {
+       uppNPN_MemAllocProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
+};
+
+#define NewNPN_MemAllocProc(FUNC)              \
+               (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
+#define CallNPN_MemAllocProc(FUNC, ARG1)               \
+               (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1))     
+
+#else
+
+typedef void* (*NPN_MemAllocUPP)(uint32 size);
+#define NewNPN_MemAllocProc(FUNC)              \
+               ((NPN_MemAllocUPP) (FUNC))
+#define CallNPN_MemAllocProc(FUNC, ARG1)               \
+               (*(FUNC))((ARG1))       
+
+#endif
+
+
+/* NPN__MemFree */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_MemFreeUPP;
+enum {
+       uppNPN_MemFreeProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
+};
+
+#define NewNPN_MemFreeProc(FUNC)               \
+               (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
+#define CallNPN_MemFreeProc(FUNC, ARG1)                \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
+
+#else
+
+typedef void (*NPN_MemFreeUPP)(void* ptr);
+#define NewNPN_MemFreeProc(FUNC)               \
+               ((NPN_MemFreeUPP) (FUNC))
+#define CallNPN_MemFreeProc(FUNC, ARG1)                \
+               (*(FUNC))((ARG1))       
+
+#endif
+
+
+/* NPN_MemFlush */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_MemFlushUPP;
+enum {
+       uppNPN_MemFlushProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(uint32)))
+};
+
+#define NewNPN_MemFlushProc(FUNC)              \
+               (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
+#define CallNPN_MemFlushProc(FUNC, ARG1)               \
+               (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))    
+
+#else
+
+typedef uint32 (*NPN_MemFlushUPP)(uint32 size);
+#define NewNPN_MemFlushProc(FUNC)              \
+               ((NPN_MemFlushUPP) (FUNC))
+#define CallNPN_MemFlushProc(FUNC, ARG1)               \
+               (*(FUNC))((ARG1))       
+
+#endif
+
+
+
+/* NPN_ReloadPlugins */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_ReloadPluginsUPP;
+enum {
+       uppNPN_ReloadPluginsProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool)))
+               | RESULT_SIZE(SIZE_CODE(0))
+};
+
+#define NewNPN_ReloadPluginsProc(FUNC)         \
+               (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
+#define CallNPN_ReloadPluginsProc(FUNC, ARG1)          \
+               (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1)) 
+
+#else
+
+typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages);
+#define NewNPN_ReloadPluginsProc(FUNC)         \
+               ((NPN_ReloadPluginsUPP) (FUNC))
+#define CallNPN_ReloadPluginsProc(FUNC, ARG1)          \
+               (*(FUNC))((ARG1))       
+
+#endif
+
+
+
+
+/******************************************************************************************
+ * The actual plugin function table definitions
+ *******************************************************************************************/
+
+typedef struct _NPPluginFuncs {
+       uint16 size;
+       uint16 version;
+    NPP_NewUPP newp;
+    NPP_DestroyUPP destroy;
+    NPP_SetWindowUPP setwindow;
+    NPP_NewStreamUPP newstream;
+    NPP_DestroyStreamUPP destroystream;
+       NPP_StreamAsFileUPP asfile;
+    NPP_WriteReadyUPP writeready;
+    NPP_WriteUPP write;
+    NPP_PrintUPP print;
+    NPP_HandleEventUPP event;
+} NPPluginFuncs;
+
+typedef struct _NPNetscapeFuncs {
+       uint16 size;
+       uint16 version;
+    NPN_GetURLUPP geturl;
+    NPN_PostURLUPP posturl;
+    NPN_RequestReadUPP requestread;
+    NPN_NewStreamUPP newstream;
+    NPN_WriteUPP write;
+    NPN_DestroyStreamUPP destroystream;
+    NPN_StatusUPP status;
+    NPN_UserAgentUPP uagent;
+       NPN_MemAllocUPP memalloc;
+       NPN_MemFreeUPP memfree;
+       NPN_MemFlushUPP memflush;
+       NPN_ReloadPluginsUPP reloadplugins;
+} NPNetscapeFuncs;
+
+
+
+#ifdef XP_MAC
+/******************************************************************************************
+ * Mac platform-specific plugin glue stuff
+ *******************************************************************************************/
+
+/*
+ * Main entry point of the plugin.
+ * This routine will be called when the plugin is loaded. The function
+ * tables are passed in and the plugin fills in the NPPluginFuncs table
+ * and NPPShutdownUPP for Netscape's use.
+ */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_MainEntryUPP;
+enum {
+       uppNPP_MainEntryProcInfo = kThinkCStackBased
+               | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*)))
+               | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*)))
+               | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*)))
+               | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_MainEntryProc(FUNC)             \
+               (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
+#define CallNPP_MainEntryProc(FUNC,  netscapeFunc, pluginFunc, shutdownUPP)            \
+               CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
+
+#else
+
+typedef NPError (*NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
+#define NewNPP_MainEntryProc(FUNC)             \
+               ((NPP_MainEntryUPP) (FUNC))
+#define CallNPP_MainEntryProc(FUNC,  netscapeFunc, pluginFunc, shutdownUPP)            \
+               (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
+
+#endif
+#endif /* MAC */
+
+
+#ifdef _WINDOWS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* plugin meta member functions */
+
+NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs);
+
+NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs);
+
+NPError WINAPI NP_Shutdown();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS */
+
+
+#endif /* _NPUPP_H_ */
+
diff --git a/utils/nplugin/src/npwin.cpp b/utils/nplugin/src/npwin.cpp
new file mode 100644 (file)
index 0000000..f97ef49
--- /dev/null
@@ -0,0 +1,186 @@
+/* npwin.cpp */
+#include "windows.h"
+
+#include "npapi.h"
+#include "npupp.h"
+
+#ifdef __WIN32__
+    #define NP_EXPORT
+#else
+    #define NP_EXPORT _export
+#endif
+
+static NPNetscapeFuncs* g_pNavigatorFuncs = NULL;
+
+
+/*   PLUGIN DLL entry points   */
+/* These are the Windows specific DLL entry points, not the "normal" plugin
+   entry points.  The "normal" ones are in NPSHELL.CPP
+*/
+
+/* fills in the func table used by Navigator to call entry points in
+   plugin DLL.  Note that these entry points ensure that DS is loaded
+   by using the NP_LOADDS macro, when compiling for Win16
+*/
+NPError WINAPI NP_EXPORT NP_GetEntryPoints(NPPluginFuncs* pFuncs)
+{
+    /* trap a NULL ptr */
+    if(pFuncs == NULL)
+        return NPERR_INVALID_FUNCTABLE_ERROR;
+
+    /* if the plugin's function table is smaller than the plugin expects,
+       then they are incompatible, and should return an error */
+    if(pFuncs->size < sizeof NPPluginFuncs)
+        return NPERR_INVALID_FUNCTABLE_ERROR;
+
+    pFuncs->version       = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
+    pFuncs->newp          = NPP_New;
+    pFuncs->destroy       = NPP_Destroy;
+    pFuncs->setwindow     = NPP_SetWindow;
+    pFuncs->newstream     = NPP_NewStream;
+    pFuncs->destroystream = NPP_DestroyStream;
+    pFuncs->asfile        = NPP_StreamAsFile;
+    pFuncs->writeready    = NPP_WriteReady;
+    pFuncs->write         = NPP_Write;
+    pFuncs->print         = NPP_Print;
+    pFuncs->event         = NULL;       /* reserved */
+
+    return NPERR_NO_ERROR;
+}
+
+/* called immediately after the plugin DLL is loaded
+*/
+NPError WINAPI NP_EXPORT NP_Initialize(NPNetscapeFuncs* pFuncs)
+{
+    /* trap a NULL ptr */
+    if(pFuncs == NULL)
+        return NPERR_INVALID_FUNCTABLE_ERROR;
+
+    g_pNavigatorFuncs = pFuncs; /* save it for future reference */
+
+    /* if the plugin's major ver level is lower than the Navigator's,
+       then they are incompatible, and should return an error */
+    if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
+        return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+    /* if the Navigator's function table is smaller than the plugin expects,
+       then they are incompatible, and should return an error */
+    if(pFuncs->size < sizeof NPNetscapeFuncs)
+        return NPERR_INVALID_FUNCTABLE_ERROR;
+
+    return NPP_Initialize();
+}
+
+/* called immediately before the plugin DLL is unloaded
+*/
+NPError WINAPI NP_EXPORT NP_Shutdown()
+{
+    NPP_Shutdown();
+
+    g_pNavigatorFuncs = NULL;
+
+    return NPERR_NO_ERROR;
+}
+
+
+/*    NAVIGATOR Entry points    */
+
+/* These entry points expect to be called from within the plugin.  The
+   noteworthy assumption is that DS has already been set to point to the
+   plugin's DLL data segment.  Don't call these functions from outside
+   the plugin without ensuring DS is set to the DLLs data segment first,
+   typically using the NP_LOADDS macro
+*/
+
+/* returns the major/minor version numbers of the Plugin API for the plugin
+   and the Navigator
+*/
+void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
+{
+    *plugin_major   = NP_VERSION_MAJOR;
+    *plugin_minor   = NP_VERSION_MINOR;
+    *netscape_major = HIBYTE(g_pNavigatorFuncs->version);
+    *netscape_minor = LOBYTE(g_pNavigatorFuncs->version);
+}
+
+/* causes the specified URL to be fetched and streamed in
+*/
+NPError NPN_GetURL(NPP instance, const char *url, const char *window)
+{
+    return g_pNavigatorFuncs->geturl(instance, url, window);
+}
+
+NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file)
+{
+    return g_pNavigatorFuncs->posturl(instance, url, window, len, buf, file);
+}
+
+/* Requests that a number of bytes be provided on a stream.  Typically
+   this would be used if a stream was in "pull" mode.  An optional
+   position can be provided for streams which are seekable.
+*/
+NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
+{
+    return g_pNavigatorFuncs->requestread(stream, rangeList);
+}
+
+/* Creates a new stream of data from the plug-in to be interpreted
+   by Netscape in the current window.
+*/
+NPError NPN_NewStream(NPP instance, NPMIMEType type, NPStream *stream)
+{
+    return g_pNavigatorFuncs->newstream(instance, type, stream);
+}
+
+/* Provides len bytes of data.
+*/
+int32 NPN_Write(NPP instance, NPStream *stream,
+                int32 len, void *buffer)
+{
+    return g_pNavigatorFuncs->write(instance, stream, len, buffer);
+}
+
+/* Closes a stream object.  
+reason indicates why the stream was closed.
+*/
+NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
+{
+    return g_pNavigatorFuncs->destroystream(instance, stream, reason);
+}
+
+/* Provides a text status message in the Netscape client user interface
+*/
+void NPN_Status(NPP instance, const char *message)
+{
+    g_pNavigatorFuncs->status(instance, message);
+}
+
+/* returns the user agent string of Navigator, which contains version info
+*/
+const char* NPN_UserAgent(NPP instance)
+{
+    return g_pNavigatorFuncs->uagent(instance);
+}
+
+/* allocates memory from the Navigator's memory space.  Necessary so that
+   saved instance data may be freed by Navigator when exiting.
+*/
+void* NPN_MemAlloc(uint32 size)
+{
+    return g_pNavigatorFuncs->memalloc(size);
+}
+
+/* reciprocal of MemAlloc() above
+*/
+void NPN_MemFree(void* ptr)
+{
+    g_pNavigatorFuncs->memfree(ptr);
+}
+
+/* private function to Netscape.  do not use!
+*/
+void NPN_ReloadPlugins(NPBool reloadPages)
+{
+    g_pNavigatorFuncs->reloadplugins(reloadPages);
+}
+