]> git.saurik.com Git - wxWidgets.git/commitdiff
Added Delete member to wxStringHashTable in order to implement
authorJulian Smart <julian@anthemion.co.uk>
Wed, 5 Jun 2002 21:06:18 +0000 (21:06 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 5 Jun 2002 21:06:18 +0000 (21:06 +0000)
wxHelpProvider::RemoveHelp, which is now called from ~wxWindowBase.
Without cleaning up the hash tables, reused window addresses will cause
the CS help to fail rather comically over time.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/html/faqgen.htm
docs/html/faqgtk.htm
docs/html/faqmac.htm
docs/html/platform.htm
include/wx/cshelp.h
include/wx/hash.h
src/common/cshelp.cpp
src/common/hash.cpp

index d7fad5bc1913a1c13e9e093d6661b185937d5e5c..43776e0578d1ed52468a0737679d1e7fa5010eb3 100644 (file)
@@ -1,4 +1,3 @@
-
 <HTML>
 
 <HEAD>
@@ -31,6 +30,7 @@ See also <a href="faq.htm">top-level FAQ page</a>.
 <li><a href="#specific">How does wxWindows 2 support platform-specific features?</a></li>
 <li><a href="#stl">Does wxWindows use STL? or the standard string class?</a></li>
 <li><a href="#richedit">Is there a rich edit/markup widget for wxWindows 2?</a></ li>
+<li><a href="#exceptions">How to use C++ exceptions with wxWindows?</a></ li>
 <li><a href="#dev">How is wxWindows 2 being developed?</a></li>
 <li><a href="#distrib">How is wxWindows 2 distributed?</a></li>
 <li><a href="#future">What are the plans for the future?</a></li>
@@ -172,6 +172,34 @@ no wxWindows wrapper for these (but text attribute functions are being added in
 
 <P>
 
+<h3><a name="exceptions">How to use C++ exceptions with wxWindows?</a></h3>
+
+wxWindows library itself is unfortunately <i>not</i> exception-safe (as its
+initial version predates, by far, the addition of the exceptions to the C++
+language). However you can still use the exceptions in your own code and use
+the other libraries using the exceptions for the error reporting together with
+wxWindows.
+
+<p>
+There are a few issues to keep in mind, though:
+<ul>
+    <li>You shouldn&#39;t let the exceptions propagate through wxWindows code,
+        in particular you should always catch the exceptions thrown by the
+        functions called from an event handler in the handler itself and not
+        let them propagate upwards to wxWindows.
+
+    <li>You may need to ensure that the compiler support for the exceptions is
+        enabled as, considering that wxWindows itself doesn&#39;t use the
+        exceptions and turning their support on results in the library size
+        augmentation of 10% to 20%, it is turned off by default for a few
+        compilers. Moreover, for gcc (or at least its mingw version) you must
+        also turn on the RTTI support to be able to use the exceptions, so you
+        should use <tt>--disable-no_rtti --disable-no_exceptions</tt> options
+        when configuring the library (attention to the double negation).
+</ul>
+
+<p>
+
 <H3><a name="dev">How is wxWindows 2 being developed?</a></H3>
 
 We are using the <a href="cvs.htm">CVS</a> system to develop and maintain wxWindows. This allows
index e89b148d986d5f0fb311e41431bea50c7dca695b..54bbdb5c10d3d10e9e46783c0421d448f32c5ada 100644 (file)
@@ -28,6 +28,8 @@ See also <a href="faq.htm">top-level FAQ page</a>.
 <li><a href="#gnome">Does wxGTK have GNOME support?</a></li>
 <li><a href="#redhat">Warning about GTK libraries supplied with RedHat</a></li>
 <li><a href="#wxgtk">What is wxWindows 2 for GTK?</a></li>
+<li><a href="#bincompat">What range of Intel Linux platforms will a given application binary be usable on?</li>
+
 <hr>
 
 wxWindows 2 for GTK is a port of wxWindows to the <a href="http://www.gimp.org/gtk" target=_top>GTK+ toolkit</a>,
@@ -53,6 +55,17 @@ the client will get notified twice, first getting a LOST event and then a CONNEC
 This problem can be solved by updating GTK with an official distribution of the library.
 <P>
 
+<h3><a name="bincompat">What range of Intel Linux platforms will a given application binary be usable on?</h3>
+
+Robert Roebling replies:<P>
+
+"The important thing is the libc version that your app
+is linked against. The most recent version is 2.2.5
+and programs linked against it will not run with version
+2.1.X so that you will fare best if you compile your app
+on a 2.1.X system. It will then run on practically all
+Linux distros (if you link you app statically against
+the image libraries and std C++ lib)."
 
 </font>
 
index 61fa399ff670d557e5031c7ffe00454429192fdc..722f83ca557948899bf7973890cad5c897b15729 100644 (file)
@@ -25,10 +25,10 @@ See also <a href="faq.htm">top-level FAQ page</a>.
 <hr>
 <h3>List of questions in this category</h3>
 <ul>
-<li><a href="#release">When is wxMac 2.x due to be released?</a></li>
+<li><a href="#release">Where should I download wxMac from?</a></li>
 <li><a href="#macplat">Which Mac platforms are supported?</a></li>
 <li><a href="#macosx">How is the Mac OS X port different from the Classic Mac OS port?</a></li>
-<li><a href="#macclassic">How are improvements to the Classic Mac OS port integra ted into the Mac OS X port?</a></li>
+<li><a href="#macclassic">How are improvements to the Classic Mac OS port integrated into the Mac OS X port?</a></li>
 <li><a href="#compilers">What compilers are supported?</a></li>
 <li><a href="#filetypes">How does CVS handle file types/creators under Mac OS 8.x /9.x?</a></li>
 <li><a href="#filetypesx">How does CVS handle file types/creators under Mac OS X? </a></li>
@@ -39,24 +39,15 @@ See also <a href="faq.htm">top-level FAQ page</a>.
 <li><a href="#aboutmenu">How does wxMac support the standard Apple About menu item and Help menu?</a></li>
 </ul>
 <hr>
-<h3><a name="release">When is wxMac 2.x due to be released?</a></h3>
 
-There is a <a href="dl_mac2.htm">preview</a> available.
-The author of this port is <a href="mailto:csomor@advancedconcepts.ch">Stefan Csomor</a>.
-<P>
-
-<table border=0 cellpadding=5>
-<tr>
-<td bgcolor="#004080">
-<font face="Arial, Lucida Sans, Helvetica">
-<font size=2>
-Please note that the version of wxMac in CVS is more robust and nearly feature-complete compared with the packaged 2.0 release.
-Until a new release is made, it is recommended that you download the wxMac 2.3.1 <a href="dl_mac2.htm#dev">development snapshot</a> or the sources from the <a href="cvs.htm">CVS trunk</a>.
-</font>
-</font></td>
-</tr>
-</table>
+<h3><a name="release">Where should I download wxMac from?</a></h3>
 
+Please see the <a href="dl_mac2.htm">downloads page</a>.
+The version of wxMac in CVS advances quickly so it is recommended that you download the
+the sources from the <a href="cvs.htm">CVS trunk</a>.
+There is also a wxMac 2.3.1 <a href="dl_mac2.htm#dev">development snapshot</a>.
+<P>
+The author of this port is <a href="mailto:csomor@advancedconcepts.ch">Stefan Csomor</a>.
 <P>
 
 <h3><a name="macplat">Which Mac platforms are supported?</a></h3>
index 2bab78399c6f095e22c65a873362a1de68329f81..f9c96fc26b52727ddff39c32c45321732e90e5b1 100644 (file)
@@ -1,4 +1,3 @@
-
 <html>
 <head>
    <title>Platforms supported by wxWindows 2.x</title>
@@ -118,10 +117,15 @@ often don&#39;t work.
 </tr>
 
 <tr>
-<td bgcolor="#F0F0F0" align=center valign=center rowspan=3>IRIX</td>
-     <td>wxGTK</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td><br></td><td>You may need to use <tt>--disable-catch_segvs</tt> if you get compiler error in utilsunx.cpp</td>
-<tr> <td>wxMotif with MIPSPro 7.30</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>David Marshall</td><td>On IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2</td>
-<tr> <td>wxMotif with "CC -mips3 -n32"</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Ian</td><td>You need to set LD_LIBRARYN32_PATH</td>
+<td bgcolor="#F0F0F0" align=center valign=center rowspan=6>IRIX</td>
+<tr> <td bgcolor="#fafafa" colspan=5>
+         Note that all entries use MIPSPro 7.3 compiler on IRIX 6.5.9 with <tt>-mips3 -n32</tt> flags if not mentioned otherwise.
+         Also note that you need to set <tt>LD_LIBRARYN32_PATH</tt> under IRIX to run wxWindows programs.
+     </td>
+<tr> <td>wxGTK 2.2</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Ian</td><td>You may need to use <tt>--disable-catch_segvs</tt> if you get compiler error in utilsunx.cpp</td>
+<tr> <td>wxGTK 2.3</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Carl Godkin</td><td><br></td>
+<tr> <td rowspan=2>wxMotif</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>David Marshall</td><td>On IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2</td>
+<tr> <td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Ian</td><td><br></td>
 </tr>
 
 <tr>
index e53d48efccbdfc31cd528711db66e193a85fc1f9..d72a3d92547e0307a98048e2605b7647c61345f4 100644 (file)
@@ -124,6 +124,9 @@ public:
     // the application, for example)
     virtual void AddHelp(wxWindowID id, const wxString& text);
 
+    // removes the association
+    virtual void RemoveHelp(wxWindowBase* window);
+
     // virtual dtor for any base class
     virtual ~wxHelpProvider();
 
@@ -142,6 +145,7 @@ public:
     virtual bool ShowHelp(wxWindowBase *window);
     virtual void AddHelp(wxWindowBase *window, const wxString& text);
     virtual void AddHelp(wxWindowID id, const wxString& text);
+    virtual void RemoveHelp(wxWindowBase* window);
 
 protected:
     // we use 2 hashes for storing the help strings associated with windows
index 557238d6a410a0aead0bc2b7a4b27895edb184a8..a42138a438ba540fa39d39ec84937fa73f8952c1 100644 (file)
@@ -127,6 +127,9 @@ public:
     // and the wasFound is set to FALSE if not NULL
     wxString Get(long key, bool *wasFound = NULL) const;
 
+    // remove the item, returning TRUE if the item was found and deleted
+    bool Delete(long key) const;
+
     // clean up
     void Destroy();
 
index 43ebbef496ae20f7df9c44ce255f0904e39ed6bf..18b62f6f6613f48c7fd29330fe2501b56963b19d 100644 (file)
@@ -301,6 +301,11 @@ void wxHelpProvider::AddHelp(wxWindowID WXUNUSED(id),
 {
 }
 
+// removes the association
+void wxHelpProvider::RemoveHelp(wxWindowBase* WXUNUSED(window))
+{
+}
+
 wxHelpProvider::~wxHelpProvider()
 {
 }
@@ -329,6 +334,12 @@ void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text)
     m_hashIds.Put(id, text);
 }
 
+// removes the association
+void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window)
+{
+    m_hashWindows.Delete((long)window);
+}
+
 bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window)
 {
 #if wxUSE_TIPWINDOW
index 1c268e7c97c6c1897933073d8873ee00fbc8c9ef..50d99ed1b29b99026cf5bd3eee83baeb169f5d70 100644 (file)
@@ -310,6 +310,30 @@ wxString wxStringHashTable::Get(long key, bool *wasFound) const
     return _T("");
 }
 
+bool wxStringHashTable::Delete(long key) const
+{
+    wxCHECK_MSG( m_hashSize, FALSE, _T("must call Create() first") );
+
+    size_t slot = (size_t)abs((int)(key % (long)m_hashSize));
+
+    wxArrayLong *keys = m_keys[slot];
+    if ( keys )
+    {
+        size_t count = keys->GetCount();
+        for ( size_t n = 0; n < count; n++ )
+        {
+            if ( keys->Item(n) == key )
+            {
+                keys.RemoveAt(n);
+                m_values[slot]->RemoveAt(n);
+                return TRUE;
+            }
+        }
+    }
+
+    return FALSE;
+}
+
 // ----------------------------------------------------------------------------
 // old not type safe wxHashTable
 // ----------------------------------------------------------------------------