Allow wxApp::MacOpenFile, MacPrintFile, MacNewFile, and MacReopenApp

to be overridden in Python.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26164 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-03-10 03:19:51 +00:00
parent ec656cfe29
commit 26eac43ed1
3 changed files with 78 additions and 32 deletions

View File

@@ -80,6 +80,9 @@ Updated wx.lib.calendar with many fixes and enhancements from Joerg
Added wx.Display and wx.VideoMode. Added wx.Display and wx.VideoMode.
AppleEvents can be handled by overriding wx.App methods MacOpenFile,
MacPrintFile, MacNewFile, and MacReopenApp.

View File

@@ -579,6 +579,11 @@ public:
#endif #endif
// virtual int FilterEvent(wxEvent& event); // This one too???? // virtual int FilterEvent(wxEvent& event); // This one too????
// For catching Apple Events
virtual void MacOpenFile(const wxString &fileName);
virtual void MacPrintFile(const wxString &fileName);
virtual void MacNewFile();
virtual void MacReopenApp();
static bool GetMacSupportPCMenuShortcuts(); static bool GetMacSupportPCMenuShortcuts();
static long GetMacAboutMenuItemId(); static long GetMacAboutMenuItemId();

View File

@@ -244,6 +244,44 @@ void wxPyApp::OnAssert(const wxChar *file,
} }
#endif #endif
// For catching Apple Events
void wxPyApp::MacOpenFile(const wxString &fileName)
{
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "MacOpenFile")) {
PyObject* s = wx2PyString(fileName);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
Py_DECREF(s);
}
wxPyEndBlockThreads();
}
void wxPyApp::MacPrintFile(const wxString &fileName)
{
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "MacPrintFile")) {
PyObject* s = wx2PyString(fileName);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
Py_DECREF(s);
}
wxPyEndBlockThreads();
}
void wxPyApp::MacNewFile()
{
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "MacNewFile"))
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
wxPyEndBlockThreads();
}
void wxPyApp::MacReopenApp()
{
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "MacReopenApp"))
wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
wxPyEndBlockThreads();
}
/*static*/ /*static*/