/////////////////////////////////////////////////////////////////////////////
// Name: region.cpp
-// Purpose: Region handling for wxWindows/MGL
+// Purpose: Region handling for wxWidgets/MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "region.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/region.h"
#include "wx/gdicmn.h"
#include "wx/thread.h"
+#include "wx/module.h"
#include <mgraph.hpp>
// wxRegionIterator //
///////////////////////////////////////////////////////////////////////////////
+#if wxUSE_THREADS
+static wxMutex *gs_mutexIterator;
+
+class wxMglRegionModule : public wxModule
+{
+public:
+ virtual bool OnInit()
+ {
+ gs_mutexIterator = new wxMutex();
+ return TRUE;
+ }
+ virtual void OnExit()
+ {
+ wxDELETE(gs_mutexIterator);
+ }
+
+ DECLARE_DYNAMIC_CLASS(wxMglRegionModule)
+};
+IMPLEMENT_DYNAMIC_CLASS(wxMglRegionModule, wxModule)
+#endif
+
/*
* Initialize empty iterator
*/
if (!region.Empty())
{
- wxMutexGuiEnter();
+#if wxUSE_THREADS
+ wxMutexLocker(*gs_mutexIterator);
+#endif
gs_rectList = &m_rects;
M_REGION_OF(region).traverse(wxMGL_region_callback);
- wxMutexGuiLeave();
m_currentNode = m_rects.GetFirst();
}
}