]> git.saurik.com Git - wxWidgets.git/commitdiff
Added Net library to contrib
authorJulian Smart <julian@anthemion.co.uk>
Tue, 21 Aug 2001 09:11:20 +0000 (09:11 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 21 Aug 2001 09:11:20 +0000 (09:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

20 files changed:
contrib/configure.in
contrib/include/wx/net/email.h [new file with mode: 0644]
contrib/include/wx/net/msg.h [new file with mode: 0644]
contrib/include/wx/net/smapi.h [new file with mode: 0644]
contrib/include/wx/net/web.h [new file with mode: 0644]
contrib/src/net/Makefile.in [new file with mode: 0644]
contrib/src/net/NetVC.dsp [new file with mode: 0644]
contrib/src/net/NetVC.dsw [new file with mode: 0644]
contrib/src/net/email.cpp [new file with mode: 0644]
contrib/src/net/makefile.b32 [new file with mode: 0644]
contrib/src/net/makefile.g95 [new file with mode: 0644]
contrib/src/net/makefile.vc [new file with mode: 0644]
contrib/src/net/readme.txt [new file with mode: 0644]
contrib/src/net/smapi.cpp [new file with mode: 0644]
contrib/src/net/web.cpp [new file with mode: 0644]
distrib/msw/contrib.rsp
distrib/msw/makefile.rsp
distrib/msw/vc.rsp
docs/latex/wx/wizpage.tex
src/msw/textctrl.cpp

index 2e485da09a54c8d1a93e74d64e0bbbb80f133de2..8a245132fb67e04927b18a89d2ec22e1824469c5 100644 (file)
@@ -47,6 +47,7 @@ AC_OUTPUT([
             src/plot/Makefile
             src/applet/Makefile
             src/fl/Makefile
+            src/net/Makefile
             samples/Makefile
             samples/mmedia/Makefile
             samples/ogl/Makefile
diff --git a/contrib/include/wx/net/email.h b/contrib/include/wx/net/email.h
new file mode 100644 (file)
index 0000000..1c312b4
--- /dev/null
@@ -0,0 +1,43 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        email.h
+// Purpose:     wxEmail: portable email client class
+// Author:      Julian Smart
+// Modified by:
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface "email.h"
+#endif
+
+#ifndef _WX_EMAIL_H_
+#define _WX_EMAIL_H_
+
+#include "wx/net/msg.h"
+
+/*
+ * wxEmail
+ * Miscellaneous email functions
+ */
+
+class wxEmail
+{
+public:
+//// Ctor/dtor
+    wxEmail() {};
+
+//// Operations
+
+    // Send a message.
+    // Specify profile, or leave it to wxWindows to find the current user name
+    static bool Send(wxMailMessage& message, const wxString& profileName = wxEmptyString );
+    
+protected:
+};
+
+
+#endif //_WX_EMAIL_H_
+
diff --git a/contrib/include/wx/net/msg.h b/contrib/include/wx/net/msg.h
new file mode 100644 (file)
index 0000000..ffc7772
--- /dev/null
@@ -0,0 +1,67 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        msg.h
+// Purpose:     wxMailMessage
+// Author:      Julian Smart
+// Modified by:
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface "msg.h"
+#endif
+
+#ifndef _WX_MSG_H_
+#define _WX_MSG_H_
+
+/*
+ * wxMailMessage
+ * Encapsulates an email message
+ */
+
+class wxMailMessage
+{
+public:
+
+    // A common usage
+    wxMailMessage(const wxString& subject, const wxString& to,
+        const wxString& body, const wxString& attachment = wxEmptyString,
+        const wxString& attachmentTitle = wxEmptyString)
+    {
+        m_to.Add(to);
+        m_subject = subject;
+        m_body = body;
+        if (!attachment.IsEmpty())
+        {
+            m_attachments.Add(attachment);
+            m_attachmentTitles.Add(attachmentTitle);
+        }
+    }
+
+    wxMailMessage() {};
+
+//// Accessors
+
+    void AddTo(const wxString& to) { m_to.Add(to); }
+    void AddCc(const wxString& cc) { m_cc.Add(cc); }
+    void AddBcc(const wxString& bcc) { m_bcc.Add(bcc); }
+    void AddAttachment(const wxString& attach, const wxString& title = wxEmptyString)
+    { m_attachments.Add(attach); m_attachmentTitles.Add(title); }
+
+    void SetSubject(const wxString& subject) { m_subject = subject; }
+    void SetBody(const wxString& body) { m_body = body; }
+
+public:
+    wxArrayString  m_to;               //The To: Recipients
+    wxArrayString  m_cc;               //The CC: Recipients
+    wxArrayString  m_bcc;              //The BCC Recipients
+    wxString       m_subject;         //The Subject of the message
+    wxString       m_body;            //The Body of the message
+    wxArrayString  m_attachments;      //Files to attach to the email
+    wxArrayString  m_attachmentTitles; //Titles to use for the email file attachments
+};
+
+#endif // _WX_MSG_H_
+
diff --git a/contrib/include/wx/net/smapi.h b/contrib/include/wx/net/smapi.h
new file mode 100644 (file)
index 0000000..fd1246c
--- /dev/null
@@ -0,0 +1,56 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        smapi.h
+// Purpose:     Simple MAPI classes
+// Author:      PJ Naughter <pjna@naughter.com>
+// Modified by: Julian Smart
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) PJ Naughter
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface "smapi.h"
+#endif
+
+#ifndef _WX_SMAPI_H_
+#define _WX_SMAPI_H_
+
+#include "wx/net/msg.h"
+
+class wxMapiData;
+
+//The class which encapsulates the MAPI connection
+class wxMapiSession
+{
+public:
+    //Constructors / Destructors
+    wxMapiSession();
+    ~wxMapiSession();
+    
+    //Logon / Logoff Methods
+    bool Logon(const wxString& sProfileName, const wxString& sPassword = wxEmptyString, wxWindow* pParentWnd = NULL);
+    bool LoggedOn() const;
+    bool Logoff();
+    
+    //Send a message
+    bool Send(wxMailMessage& message);
+    
+    //General MAPI support
+    bool MapiInstalled() const;
+    
+    //Error Handling
+    long GetLastError() const;
+    
+protected:
+    //Methods
+    void Initialise();
+    void Deinitialise(); 
+    bool Resolve(const wxString& sName, void* lppRecip1);
+
+    wxMapiData* m_data;
+    
+};
+
+
+#endif //_WX_SMAPI_H_
\ No newline at end of file
diff --git a/contrib/include/wx/net/web.h b/contrib/include/wx/net/web.h
new file mode 100644 (file)
index 0000000..ce79f83
--- /dev/null
@@ -0,0 +1,37 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        web.h
+// Purpose:     wxWeb: portable web browser-related class
+// Author:      Julian Smart
+// Modified by:
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma interface "web.h"
+#endif
+
+#ifndef _WX_WEB_H_
+#define _WX_WEB_H_
+
+/*
+ * wxWeb
+ * Miscellaneous web functions
+ */
+
+class wxWeb
+{
+public:
+//// Ctor/dtor
+    wxWeb() {};
+
+//// Operations
+
+protected:
+};
+
+
+#endif //_WX_WEB_H_
+
diff --git a/contrib/src/net/Makefile.in b/contrib/src/net/Makefile.in
new file mode 100644 (file)
index 0000000..b18aa2f
--- /dev/null
@@ -0,0 +1,23 @@
+# $Id$
+
+top_srcdir = @top_srcdir@/..
+top_builddir = ../../..
+libsrc_dir = contrib/src/net
+
+TARGET_LIBNAME=libwx_net
+
+LIBVERSION_CURRENT=1
+LIBVERSION_REVISION=0
+LIBVERSION_AGE=0
+
+HEADER_PATH=$(top_srcdir)/contrib/include/wx
+HEADER_SUBDIR=plot
+
+HEADERS=msg.h email.h web.h
+
+OBJECTS=email.o web.o
+
+APPEXTRADEFS=-I$(top_srcdir)/contrib/include
+
+include $(top_builddir)/src/makelib.env
+
diff --git a/contrib/src/net/NetVC.dsp b/contrib/src/net/NetVC.dsp
new file mode 100644 (file)
index 0000000..6d59a07
--- /dev/null
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="NetVC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=NetVC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "NetVC.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "NetVC.mak" CFG="NetVC - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "NetVC - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "NetVC - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "NetVC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809
+# ADD RSC /l 0x809
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\..\..\lib\net.lib"
+
+!ELSEIF  "$(CFG)" == "NetVC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809
+# ADD RSC /l 0x809
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\..\..\lib\netd.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "NetVC - Win32 Release"
+# Name "NetVC - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\smapi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\email.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\web.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\wx\net\smapi.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\readme.txt
+# End Source File
+# End Target
+# End Project
diff --git a/contrib/src/net/NetVC.dsw b/contrib/src/net/NetVC.dsw
new file mode 100644 (file)
index 0000000..9cf4a63
--- /dev/null
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "NetVC"=.\NetVC.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/contrib/src/net/email.cpp b/contrib/src/net/email.cpp
new file mode 100644 (file)
index 0000000..a4b9c44
--- /dev/null
@@ -0,0 +1,58 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        email.h
+// Purpose:     wxEmail: portable email client class
+// Author:      Julian Smart
+// Modified by:
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "email.h"
+#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/string.h"
+#include "wx/net/email.h"
+
+#ifdef __WXMSW__
+#include "wx/net/smapi.h"
+#endif
+
+// Send a message.
+// Specify profile, or leave it to wxWindows to find the current user name
+
+#ifdef __WXMSW__
+bool wxEmail::Send(wxMailMessage& message, const wxString& profileName)
+{
+    wxASSERT (message.m_to.GetCount() > 0) ;
+
+    wxString profile(profileName);
+    if (profile.IsEmpty())
+        profile = wxGetUserName();
+
+    wxMapiSession session;
+
+    if (!session.MapiInstalled())
+        return FALSE;
+    if (!session.Logon(profile))
+        return FALSE;
+
+    return session.Send(message);
+}
+#else
+#error Send not yet implemented for this platform.
+#endif
+
diff --git a/contrib/src/net/makefile.b32 b/contrib/src/net/makefile.b32
new file mode 100644 (file)
index 0000000..90ca71b
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# File:                makefile.b32
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:
+#
+# Makefile : Builds Net library for 32-bit BC++
+
+WXDIR = $(WXWIN)
+
+LIBTARGET=$(WXDIR)\lib\net.lib
+
+OBJECTS = smapi.obj email.obj web.obj
+
+!include $(WXDIR)\src\makelib.b32
+
diff --git a/contrib/src/net/makefile.g95 b/contrib/src/net/makefile.g95
new file mode 100644 (file)
index 0000000..872df1c
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for wxWindows Net library Cygwin/Mingw32).
+
+WXDIR = ../../..
+
+LIBTARGET=$(WXDIR)/lib/libnet.a
+OBJECTS = smapi.o email.o web.o
+
+include $(WXDIR)/src/makelib.g95
+
diff --git a/contrib/src/net/makefile.vc b/contrib/src/net/makefile.vc
new file mode 100644 (file)
index 0000000..e57d192
--- /dev/null
@@ -0,0 +1,144 @@
+
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     2001
+# Updated:
+# Copyright:   (c) 2001, Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile : Builds net class library (MS VC++).
+# Use FINAL=1 argument to nmake to build final version with no debugging
+# info
+
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+GIZMOSDIR = $(WXDIR)\contrib\src\net
+GIZMOSINC = $(WXDIR)\contrib\include\wx\net
+THISDIR = $(WXDIR)\contrib\src\net
+DOCDIR=$(WXDIR)\contrib\docs
+LOCALDOCDIR=$(WXDIR)\contrib\docs\latex\net
+
+!include $(WXDIR)\src\makevc.env
+
+OBJECTS = $(D)\smapi.obj $(D)\email.obj $(D)\web.obj
+
+LIBTARGET=$(WXDIR)\lib\net$(LIBEXT).lib
+
+all:    $(D) $(LIBTARGET)
+
+$(D) :
+       mkdir $(D)
+
+wx:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.vc FINAL=$(FINAL)
+        cd $(THISDIR)
+
+wxclean:
+        cd $(WXDIR)\src\msw
+        nmake -f makefile.vc clean
+        cd $(THISDIR)
+
+$(LIBTARGET): $(OBJECTS)
+       -erase $(LIBTARGET)
+       $(implib) @<<
+-out:$(LIBTARGET)
+-machine:$(CPU)
+$(OBJECTS)
+<<
+
+$(D)\net.obj:      net.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF)
+<<
+
+clean:
+        -erase $(D)\*.obj
+        -erase *.sbr
+        -erase *.exe
+        -erase *.res
+        -erase *.map
+        -erase *.pdb
+        -erase $(LIBTARGET)
+
+DOCSOURCES=$(LOCALDOCDIR)\net.tex \
+ $(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\
+ $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\intro.tex\
+ $(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex
+
+html: $(DOCDIR)\html\net\net.htm
+htmlhelp: $(DOCDIR)\htmlhelp\net.chm
+htb:   $(DOCDIR)\htb\net.htb
+hlp: $(DOCDIR)\winhelp\net.hlp
+pdfrtf: $(DOCDIR)\pdf\net.rtf
+ps: $(DOCDIR)\ps\net.ps
+
+touchmanual:
+       touch $(LOCALDOCDIR)\net.tex
+
+
+$(DOCDIR)\winhelp\net.hlp:         $(LOCALDOCDIR)\net.rtf $(LOCALDOCDIR)\net.hpj
+        cd $(LOCALDOCDIR)
+        -erase net.ph
+        hc net
+        move net.hlp $(DOCDIR)\winhelp\net.hlp
+        move net.cnt $(DOCDIR)\winhelp\net.cnt
+        cd $(THISDIR)
+
+$(LOCALDOCDIR)\net.rtf: $(DOCSOURCES)
+        cd $(LOCALDOCDIR)
+        -start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\net.tex $(LOCALDOCDIR)\net.rtf -twice -winhelp
+        cd $(THISDIR)
+
+$(DOCDIR)\pdf\net.rtf: $(DOCSOURCES)
+        cd $(LOCALDOCDIR)
+        -copy *.bmp $(DOCDIR)\pdf
+        -start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\net.tex $(DOCDIR)\pdf\net.rtf -twice -rtf
+        cd $(THISDIR)
+
+$(DOCDIR)\html\net\net.htm:         $(DOCSOURCES)
+        cd $(LOCALDOCDIR)
+        -mkdir $(DOCDIR)\html\net
+        copy *.gif $(DOCDIR)\html\net
+        -start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\net.tex $(DOCDIR)\html\net\net.htm -twice -html
+        -erase $(DOCDIR)\html\net\*.con
+        -erase *.con
+        -erase $(DOCDIR)\html\net\*.ref
+        cd $(THISDIR)
+
+$(DOCDIR)\htmlhelp\net.chm: $(DOCDIR)\html\net\net.htm $(DOCDIR)\html\net\net.hhp
+       cd $(DOCDIR)\html\net
+       -hhc net.hhp
+    move net.chm $(DOCDIR)\htmlhelp\net.chm
+       cd $(THISDIR)
+
+# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk
+# files, renamed to htb.
+# This can then be used with e.g. helpview.
+# Optionally, a cached version of the .hhp file can be generated with hhp2cached.
+$(DOCDIR)\htb\net.htb: $(DOCDIR)\html\net\net.htm
+       cd $(DOCDIR)\html\net
+    -erase net.zip net.htb
+    zip net.zip *.htm *.gif *.hhp *.hhc *.hhk
+    -mkdir $(DOCDIR)\htb
+    move net.zip $(DOCDIR)\htb\net.htb
+    cd $(THISDIR)
+
+$(LOCALDOCDIR)\net.dvi:        $(DOCSOURCES)
+       cd $(LOCALDOCDIR)
+        -latex net
+        -latex net
+        -makeindx net
+        -bibtex net
+        -latex net
+        -latex net
+        cd $(THISDIR)
+
+$(WXDIR)\docs\ps\net.ps:       $(LOCALDOCDIR)\net.dvi
+       cd $(LOCALDOCDIR)
+        -dvips32 -o net.ps net
+        move net.ps $(WXDIR)\docs\ps\net.ps
+        cd $(THISDIR)
+
diff --git a/contrib/src/net/readme.txt b/contrib/src/net/readme.txt
new file mode 100644 (file)
index 0000000..1fb7e4f
--- /dev/null
@@ -0,0 +1,10 @@
+Net library
+===========
+
+This is a library of email and other Internet-related functionality.
+
+wxMailMessage          Populate this before sending a message
+wxMapiSession       Encapsulates Simple MAPI functionality on Windows
+wxEmail             Platform-independent mail functions, such as Send
+wxWeb               Platform-independent web functions, such as OpenURL
+
diff --git a/contrib/src/net/smapi.cpp b/contrib/src/net/smapi.cpp
new file mode 100644 (file)
index 0000000..4412ad1
--- /dev/null
@@ -0,0 +1,426 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        smapi.cpp
+// Purpose:     Simple MAPI classes
+// Author:      PJ Naughter <pjna@naughter.com>
+// Modified by: Julian Smart
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) PJ Naughter
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "smapi.h"
+#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/string.h"
+#include "wx/msw/private.h"
+
+#include <mapi.h>
+
+#include "wx/net/smapi.h"
+
+class wxMapiData
+{
+public:
+    wxMapiData()
+    {
+        m_hSession = 0;
+        m_nLastError = 0;
+        m_hMapi = NULL;
+        m_lpfnMAPILogon = NULL;
+        m_lpfnMAPILogoff = NULL;
+        m_lpfnMAPISendMail = NULL;
+        m_lpfnMAPIResolveName = NULL;
+        m_lpfnMAPIFreeBuffer = NULL;
+    }
+
+    //Data
+    LHANDLE             m_hSession; //Mapi Session handle
+    long                m_nLastError; //Last Mapi error value
+    HINSTANCE           m_hMapi; //Instance handle of the MAPI dll
+    LPMAPILOGON         m_lpfnMAPILogon; //MAPILogon function pointer
+    LPMAPILOGOFF        m_lpfnMAPILogoff; //MAPILogoff function pointer
+    LPMAPISENDMAIL      m_lpfnMAPISendMail; //MAPISendMail function pointer
+    LPMAPIRESOLVENAME   m_lpfnMAPIResolveName; //MAPIResolveName function pointer
+    LPMAPIFREEBUFFER    m_lpfnMAPIFreeBuffer; //MAPIFreeBuffer function pointer
+};
+
+
+////////////////////////////////// Implementation /////////////////////////////
+
+wxMapiSession::wxMapiSession()
+{
+    m_data = new wxMapiData;
+    
+    Initialise();
+}
+
+wxMapiSession::~wxMapiSession()
+{
+    //Logoff if logged on
+    Logoff();
+    
+    //Unload the MAPI dll
+    Deinitialise();
+    
+    delete m_data;
+}
+
+void wxMapiSession::Initialise() 
+{
+    //First make sure the "WIN.INI" entry for MAPI is present aswell 
+    //as the MAPI32 dll being present on the system
+    bool bMapiInstalled = (GetProfileInt(_T("MAIL"), _T("MAPI"), 0) != 0) && 
+        (SearchPath(NULL, _T("MAPI32.DLL"), NULL, 0, NULL, NULL) != 0);
+    
+    if (bMapiInstalled)
+    {
+        //Load up the MAPI dll and get the function pointers we are interested in
+        m_data->m_hMapi = ::LoadLibrary(_T("MAPI32.DLL"));
+        if (m_data->m_hMapi)
+        {
+            m_data->m_lpfnMAPILogon = (LPMAPILOGON) GetProcAddress(m_data->m_hMapi, "MAPILogon");
+            m_data->m_lpfnMAPILogoff = (LPMAPILOGOFF) GetProcAddress(m_data->m_hMapi, "MAPILogoff");
+            m_data->m_lpfnMAPISendMail = (LPMAPISENDMAIL) GetProcAddress(m_data->m_hMapi, "MAPISendMail");
+            m_data->m_lpfnMAPIResolveName = (LPMAPIRESOLVENAME) GetProcAddress(m_data->m_hMapi, "MAPIResolveName");
+            m_data->m_lpfnMAPIFreeBuffer = (LPMAPIFREEBUFFER) GetProcAddress(m_data->m_hMapi, "MAPIFreeBuffer");
+            
+            //If any of the functions are not installed then fail the load
+            if (m_data->m_lpfnMAPILogon == NULL ||
+                m_data->m_lpfnMAPILogoff == NULL ||
+                m_data->m_lpfnMAPISendMail == NULL ||
+                m_data->m_lpfnMAPIResolveName == NULL ||
+                m_data->m_lpfnMAPIFreeBuffer == NULL)
+            {
+                wxLogDebug(_T("Failed to get one of the functions pointer in MAPI32.DLL\n"));
+                Deinitialise();
+            }
+        }
+    }
+    else
+        wxLogDebug(_T("Mapi is not installed on this computer\n"));
+}
+
+void wxMapiSession::Deinitialise()
+{
+    if (m_data->m_hMapi)
+    {
+        //Unload the MAPI dll and reset the function pointers to NULL
+        FreeLibrary(m_data->m_hMapi);
+        m_data->m_hMapi = NULL;
+        m_data->m_lpfnMAPILogon = NULL;
+        m_data->m_lpfnMAPILogoff = NULL;
+        m_data->m_lpfnMAPISendMail = NULL;
+        m_data->m_lpfnMAPIResolveName = NULL;
+        m_data->m_lpfnMAPIFreeBuffer = NULL;
+    }
+}
+
+bool wxMapiSession::Logon(const wxString& sProfileName, const wxString& sPassword, wxWindow* pParentWnd)
+{
+    wxASSERT(MapiInstalled()); //MAPI must be installed
+    wxASSERT(m_data->m_lpfnMAPILogon); //Function pointer must be valid
+    
+    //Initialise the function return value
+    bool bSuccess = FALSE;
+    
+    //Just in case we are already logged in
+    Logoff();
+    
+    //Setup the ascii versions of the profile name and password
+    int nProfileLength = sProfileName.Length();
+    int nPasswordLength = sPassword.Length();
+    
+    LPSTR pszProfileName = NULL;
+    LPSTR pszPassword = NULL;
+    if (nProfileLength)
+    {
+//        pszProfileName = T2A((LPTSTR) (LPCTSTR) sProfileName);
+//        pszPassword = T2A((LPTSTR) (LPCTSTR) sPassword);
+        pszProfileName = (LPSTR) sProfileName.c_str();
+        pszPassword = (LPSTR) sPassword.c_str();
+    }
+    
+    //Setup the flags & UIParam parameters used in the MapiLogon call
+    FLAGS flags = 0;
+    ULONG nUIParam = 0;
+    if (nProfileLength == 0)
+    {
+        //No profile name given, then we must interactively request a profile name
+        if (pParentWnd)
+        {
+            nUIParam = (ULONG) (HWND) pParentWnd->GetHWND();
+            flags |= MAPI_LOGON_UI;
+        }
+        else
+        {
+            //No window given, just use the main window of the app as the parent window
+            if (wxTheApp->GetTopWindow())
+            {
+                nUIParam = (ULONG) (HWND) wxTheApp->GetTopWindow()->GetHWND();
+                flags |= MAPI_LOGON_UI;
+            }
+        }
+    }
+    
+    //First try to acquire a new MAPI session using the supplied settings using the MAPILogon functio
+    ULONG nError = m_data->m_lpfnMAPILogon(nUIParam, pszProfileName, pszPassword, flags | MAPI_NEW_SESSION, 0, &m_data->m_hSession);
+    if (nError != SUCCESS_SUCCESS && nError != MAPI_E_USER_ABORT)
+    {
+        //Failed to create a create mapi session, try to acquire a shared mapi session
+        wxLogDebug(_T("Failed to logon to MAPI using a new session, trying to acquire a shared one\n"));
+        nError = m_data->m_lpfnMAPILogon(nUIParam, NULL, NULL, 0, 0, &m_data->m_hSession);
+        if (nError == SUCCESS_SUCCESS)
+        {
+            m_data->m_nLastError = SUCCESS_SUCCESS;
+            bSuccess = TRUE;
+        }
+        else
+        {
+            wxLogDebug(_T("Failed to logon to MAPI using a shared session, Error:%d\n"), nError);
+            m_data->m_nLastError = nError;
+        }
+    }
+    else if (nError == SUCCESS_SUCCESS)
+    {
+        m_data->m_nLastError = SUCCESS_SUCCESS;
+        bSuccess = TRUE;
+    }
+    
+    return bSuccess;
+}
+
+bool wxMapiSession::LoggedOn() const
+{
+    return (m_data->m_hSession != 0);
+}
+
+bool wxMapiSession::MapiInstalled() const
+{
+    return (m_data->m_hMapi != NULL);
+}
+
+bool wxMapiSession::Logoff()
+{
+    wxASSERT(MapiInstalled()); //MAPI must be installed
+    wxASSERT(m_data->m_lpfnMAPILogoff); //Function pointer must be valid
+    
+    //Initialise the function return value
+    bool bSuccess = FALSE;
+    
+    if (m_data->m_hSession)
+    {
+        //Call the MAPILogoff function
+        ULONG nError = m_data->m_lpfnMAPILogoff(m_data->m_hSession, 0, 0, 0); 
+        if (nError != SUCCESS_SUCCESS)
+        {
+            wxLogDebug(_T("Failed in call to MapiLogoff, Error:%d"), nError);
+            m_data->m_nLastError = nError;
+            bSuccess = TRUE;
+        }
+        else
+        {
+            m_data->m_nLastError = SUCCESS_SUCCESS;
+            bSuccess = TRUE;
+        }
+        m_data->m_hSession = 0;
+    }
+    
+    return bSuccess;
+}
+
+bool wxMapiSession::Resolve(const wxString& sName, void* lppRecip1)
+{
+    lpMapiRecipDesc* lppRecip = (lpMapiRecipDesc*) lppRecip1;
+    
+    wxASSERT(MapiInstalled()); //MAPI must be installed
+    wxASSERT(m_data->m_lpfnMAPIResolveName); //Function pointer must be valid
+    wxASSERT(LoggedOn()); //Must be logged on to MAPI
+    wxASSERT(m_data->m_hSession); //MAPI session handle must be valid
+    
+    //Call the MAPIResolveName function
+//    LPSTR lpszAsciiName = T2A((LPTSTR) (LPCTSTR) sName);
+    LPSTR lpszAsciiName = (LPSTR) sName.c_str();
+    ULONG nError = m_data->m_lpfnMAPIResolveName(m_data->m_hSession, 0, lpszAsciiName, 0, 0, lppRecip);
+    if (nError != SUCCESS_SUCCESS)
+    {
+        wxLogDebug(_T("Failed to resolve the name: %s, Error:%d\n"), sName, nError);
+        m_data->m_nLastError = nError;
+    }
+    
+    return (nError == SUCCESS_SUCCESS);
+}
+
+bool wxMapiSession::Send(wxMailMessage& message)
+{
+    wxASSERT(MapiInstalled()); //MAPI must be installed
+    wxASSERT(m_data->m_lpfnMAPISendMail); //Function pointer must be valid
+    wxASSERT(m_data->m_lpfnMAPIFreeBuffer); //Function pointer must be valid
+    wxASSERT(LoggedOn()); //Must be logged on to MAPI
+    wxASSERT(m_data->m_hSession); //MAPI session handle must be valid
+    
+    //Initialise the function return value
+    bool bSuccess = FALSE;  
+    
+    //Create the MapiMessage structure to match the message parameter send into us
+    MapiMessage mapiMessage;
+    ZeroMemory(&mapiMessage, sizeof(mapiMessage));
+    mapiMessage.lpszSubject = (LPSTR) message.m_subject.c_str();
+    mapiMessage.lpszNoteText = (LPSTR) message.m_body.c_str();
+//    mapiMessage.lpszSubject = T2A((LPTSTR) (LPCTSTR) message.m_subject);
+//    mapiMessage.lpszNoteText = T2A((LPTSTR) (LPCTSTR) message.m_body);
+    mapiMessage.nRecipCount = message.m_to.GetCount() + message.m_cc.GetCount() + message.m_bcc.GetCount();
+    wxASSERT(mapiMessage.nRecipCount); //Must have at least 1 recipient!
+    
+    //Allocate the recipients array
+    mapiMessage.lpRecips = new MapiRecipDesc[mapiMessage.nRecipCount];
+    
+    //Setup the "To" recipients
+    int nRecipIndex = 0;
+    int nToSize = message.m_to.GetCount();
+    for (int i=0; i<nToSize; i++)
+    {
+        MapiRecipDesc& recip = mapiMessage.lpRecips[nRecipIndex];
+        ZeroMemory(&recip, sizeof(MapiRecipDesc));
+        recip.ulRecipClass = MAPI_TO;
+        wxString& sName = message.m_to[i];
+
+        //Try to resolve the name
+        lpMapiRecipDesc lpTempRecip;  
+        if (Resolve(sName, (void*) &lpTempRecip))
+        {
+            //Resolve worked, put the resolved name back into the sName
+            sName = lpTempRecip->lpszName;
+            
+            //Don't forget to free up the memory MAPI allocated for us
+            m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
+        }
+        //recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
+        recip.lpszName = (LPSTR) sName.c_str();
+        
+        ++nRecipIndex;
+    }
+    
+    //Setup the "CC" recipients
+    int nCCSize = message.m_cc.GetCount();
+    for (i=0; i<nCCSize; i++)
+    {
+        MapiRecipDesc& recip = mapiMessage.lpRecips[nRecipIndex];
+        ZeroMemory(&recip, sizeof(MapiRecipDesc));
+        recip.ulRecipClass = MAPI_CC;
+        wxString& sName = message.m_cc[i];
+
+        //Try to resolve the name
+        lpMapiRecipDesc lpTempRecip;  
+        if (Resolve(sName, (void*) &lpTempRecip))
+        {
+            //Resolve worked, put the resolved name back into the sName
+            sName = lpTempRecip->lpszName;
+            
+            //Don't forget to free up the memory MAPI allocated for us
+            m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
+        }
+        //recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
+        recip.lpszName = (LPSTR) sName.c_str();
+        
+        ++nRecipIndex;
+    }
+    
+    //Setup the "BCC" recipients
+    int nBCCSize = message.m_bcc.GetCount();
+    for (i=0; i<nBCCSize; i++)
+    {
+        MapiRecipDesc& recip = mapiMessage.lpRecips[nRecipIndex];
+        ZeroMemory(&recip, sizeof(MapiRecipDesc));
+        recip.ulRecipClass = MAPI_BCC;
+        wxString& sName = message.m_bcc[i];
+
+        //Try to resolve the name
+        lpMapiRecipDesc lpTempRecip;  
+        if (Resolve(sName, (void*) &lpTempRecip))
+        {
+            //Resolve worked, put the resolved name back into the sName
+            sName = lpTempRecip->lpszName;
+            
+            //Don't forget to free up the memory MAPI allocated for us
+            m_data->m_lpfnMAPIFreeBuffer(lpTempRecip);
+        }
+        //recip.lpszName = T2A((LPTSTR) (LPCTSTR) sName);
+        recip.lpszName = (LPSTR) sName.c_str();
+        
+        ++nRecipIndex;
+    }
+    
+    //Setup the attachments 
+    int nAttachmentSize = message.m_attachments.GetCount();
+    int nTitleSize = message.m_attachmentTitles.GetCount();
+    if (nTitleSize)
+    { 
+        wxASSERT(nTitleSize == nAttachmentSize); //If you are going to set the attachment titles then you must set 
+        //the attachment title for each attachment
+    }
+    if (nAttachmentSize)
+    {
+        mapiMessage.nFileCount = nAttachmentSize;
+        mapiMessage.lpFiles = new MapiFileDesc[nAttachmentSize];
+        for (i=0; i<nAttachmentSize; i++)
+        {
+            MapiFileDesc& file = mapiMessage.lpFiles[i];
+            ZeroMemory(&file, sizeof(MapiFileDesc));
+            file.nPosition = 0xFFFFFFFF;
+            wxString& sFilename = message.m_attachments[i];
+            //file.lpszPathName = T2A((LPTSTR) (LPCTSTR) sFilename);
+
+            file.lpszPathName = (LPSTR) sFilename.c_str();
+            //file.lpszFileName = file.lpszPathName;
+            file.lpszFileName = NULL;
+
+            if (nTitleSize && !message.m_attachmentTitles[i].IsEmpty())
+            {
+                wxString& sTitle = message.m_attachmentTitles[i];
+                //file.lpszFileName = T2A((LPTSTR) (LPCTSTR) sTitle);
+                file.lpszFileName = (LPSTR) sTitle.c_str();
+            }
+        }
+    }
+    
+    //Do the actual send using MAPISendMail
+    ULONG nError = m_data->m_lpfnMAPISendMail(m_data->m_hSession, 0, &mapiMessage, MAPI_DIALOG, 0);
+    if (nError == SUCCESS_SUCCESS)
+    {
+        bSuccess = TRUE;
+        m_data->m_nLastError = SUCCESS_SUCCESS;
+    }
+    else
+    {
+        wxLogDebug(_T("Failed to send mail message, Error:%d\n"), nError);
+        m_data->m_nLastError = nError;
+    }
+    
+    //Tidy up the Attachements
+    if (nAttachmentSize)
+        delete [] mapiMessage.lpFiles;
+    
+    //Free up the Recipients memory
+    delete [] mapiMessage.lpRecips;
+    
+    return bSuccess;
+}
+
+long wxMapiSession::GetLastError() const
+{
+    return m_data->m_nLastError;
+}
+
diff --git a/contrib/src/net/web.cpp b/contrib/src/net/web.cpp
new file mode 100644 (file)
index 0000000..d398868
--- /dev/null
@@ -0,0 +1,29 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        web.h
+// Purpose:     wxWeb: portable web browser-related class
+// Author:      Julian Smart
+// Modified by:
+// Created:     2001-08-21
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "web.h"
+#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/string.h"
+
+
index 7996a7fb8eabc0e2b76a38f9bbf2a7bb1bfad700..455cdd5c6924612c512f7e66a709aad51c922ff5 100644 (file)
@@ -219,3 +219,10 @@ contrib/src/fl/flVC.dsp
 contrib/src/fl/flVC.dsw
 contrib/include/wx/fl/*.h
 
+contrib/src/net/*.cpp
+contrib/src/net/*.h
+contrib/src/net/make*
+contrib/src/net/NetVC.dsp
+contrib/src/net/NetVC.dsw
+contrib/include/wx/net/*.h
+
index 812d4ffc4510d7e02567a0c68c1fb23850b5840a..dd9f0e448bd16a663e1020cc1efe6fe7f879eb04 100644 (file)
@@ -96,6 +96,8 @@ contrib/src/stc/Makefile.in
 contrib/src/plot/Makefile.in
 contrib/src/gizmos/Makefile.in
 contrib/src/animate/Makefile.in
+contrib/src/fl/Makefile.in
+contrib/src/net/Makefile.in
 
 contrib/samples/Makefile.in
 contrib/samples/canvas/test/Makefile.in
index fdf11f9c2ef1a8be8b80f5f7f0d4a21a2dce296a..da23c9b6f022ad96d44e4fbaef808d9233f9fe5f 100644 (file)
@@ -327,3 +327,19 @@ contrib/src/animate/AnimateVC.dsw
 contrib/samples/animate/AniTestVC.dsp
 contrib/samples/animate/AniTestVC.dsw
 
+contrib/src/fl/flVC.dsp
+contrib/src/fl/flVC.dsw
+contrib/samples/fl/fl_demo1/fl_demo.dsp
+contrib/samples/fl/fl_demo1/fl_demo.dsw
+contrib/samples/fl/fl_demo2/fl_demo.dsp
+contrib/samples/fl/fl_demo2/fl_demo.dsw
+contrib/samples/fl/fl_sample1/fl_demo.dsp
+contrib/samples/fl/fl_sample1/fl_demo.dsw
+contrib/samples/fl/fl_sample2/fl_demo.dsp
+contrib/samples/fl/fl_sample2/fl_demo.dsw
+contrib/samples/fl/fl_sample3/fl_demo.dsp
+contrib/samples/fl/fl_sample3/fl_demo.dsw
+
+contrib/src/net/NetVC.dsp
+contrib/src/net/NetVC.dsw
+
index 2418fe5dd5170d9dd38a7a0c30632bfe1cd4705a..b7a89640bfe3933bf93e44f8d8d0db5e21dcef59 100644 (file)
@@ -16,8 +16,8 @@ know what are the following and preceding pages (which may be {\tt NULL} for the
 first/last page). Except for this extra knowledge, wxWizardPage is just a
 panel, so the controls may be placed directly on it in the usual way.
 
-This class allows to decide what is the orde fo pages in the wizard
-dynamically (during run-time) and so providex maximal flexibility. Usually,
+This class allows the programmer to decide the order of pages in the wizard
+dynamically (during run-time) and so provides maximal flexibility. Usually,
 however, the order of pages is known in advance in which case 
 \helpref{wxWizardPageSimple}{wxwizardpagesimple} class is enough and it is simpler
 to use.
index 391af4da13cb8ad967827a7a459dd8b663e6c485..0de8b105d56145bad059dcec0a3239e9679bf602 100644 (file)
@@ -259,6 +259,11 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         else
         {
             msStyle |= ES_AUTOVSCROLL;
+            // Experimental: this seems to help with the scroll problem. See messages from Jekabs Andrushaitis <j.andrusaitis@konts.lv>
+            // wx-dev list, entitled "[wx-dev] wxMSW-EVT_KEY_DOWN and wxMSW-wxTextCtrl" and "[wx-dev] TextCtrl (RichEdit)"
+            // Unfortunately, showing the selection in blue when the control doesn't have
+            // the focus is non-standard behaviour, and we need to find another workaround.
+            //msStyle |= ES_NOHIDESEL ;
             m_isRich = TRUE;
 
             int ver = wxRichEditModule::GetLoadedVersion();
@@ -614,8 +619,13 @@ void wxTextCtrl::SetInsertionPoint(long pos)
     SendMessage(hWnd, EM_SETSEL, 0, MAKELPARAM(pos, pos));
 #endif // Win32/16
 
-    static const wxChar *nothing = _T("");
-    SendMessage(hWnd, EM_REPLACESEL, 0, (LPARAM)nothing);
+#if wxUSE_RICHEDIT
+    if ( !m_isRich)
+#endif
+    {
+        static const wxChar *nothing = _T("");
+        SendMessage(hWnd, EM_REPLACESEL, 0, (LPARAM)nothing);
+    }
 }
 
 void wxTextCtrl::SetInsertionPointEnd()