Added static accessors for wxPython for some of the s_mac* members of
wxApp on Mac. They are no-ops for the other platforms. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,6 +46,22 @@ constants being added to Python. Added code to wx.py to test for the
|
|||||||
existence of the new constants and to create suitable values if not
|
existence of the new constants and to create suitable values if not
|
||||||
present.
|
present.
|
||||||
|
|
||||||
|
Added some static wxApp functions that help with integration with the
|
||||||
|
Mac UI. They are no-ops on other platforms so it doesn't hurt to
|
||||||
|
always call them. The functions are:
|
||||||
|
|
||||||
|
wxApp_GetMacDefaultEncodingIsPC
|
||||||
|
wxApp_GetMacSupportPCMenuShortcuts
|
||||||
|
wxApp_GetMacAboutMenuItemId
|
||||||
|
wxApp_GetMacPreferencesMenuItemId
|
||||||
|
wxApp_GetMacExitMenuItemId
|
||||||
|
wxApp_GetMacHelpMenuTitleName
|
||||||
|
wxApp_SetMacDefaultEncodingIsPC
|
||||||
|
wxApp_SetMacSupportPCMenuShortcuts
|
||||||
|
wxApp_SetMacAboutMenuItemId
|
||||||
|
wxApp_SetMacPreferencesMenuItemId
|
||||||
|
wxApp_SetMacExitMenuItemId
|
||||||
|
wxApp_SetMacHelpMenuTitleName
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -279,6 +279,7 @@ class wxPythonDemo(wxFrame):
|
|||||||
exitID = wxNewId()
|
exitID = wxNewId()
|
||||||
menu.Append(exitID, 'E&xit\tAlt-X', 'Get the heck outta here!')
|
menu.Append(exitID, 'E&xit\tAlt-X', 'Get the heck outta here!')
|
||||||
EVT_MENU(self, exitID, self.OnFileExit)
|
EVT_MENU(self, exitID, self.OnFileExit)
|
||||||
|
wxApp_SetMacExitMenuItemId(exitID)
|
||||||
self.mainmenu.Append(menu, '&File')
|
self.mainmenu.Append(menu, '&File')
|
||||||
|
|
||||||
# Make a Demo menu
|
# Make a Demo menu
|
||||||
@@ -302,6 +303,7 @@ class wxPythonDemo(wxFrame):
|
|||||||
menu.Append(findnextID, 'Find &Next\tF3', 'Find Next')
|
menu.Append(findnextID, 'Find &Next\tF3', 'Find Next')
|
||||||
menu.AppendSeparator()
|
menu.AppendSeparator()
|
||||||
menu.Append(helpID, '&About\tCtrl-H', 'wxPython RULES!!!')
|
menu.Append(helpID, '&About\tCtrl-H', 'wxPython RULES!!!')
|
||||||
|
wxApp_SetMacAboutMenuItemId(helpID)
|
||||||
EVT_MENU(self, helpID, self.OnHelpAbout)
|
EVT_MENU(self, helpID, self.OnHelpAbout)
|
||||||
EVT_MENU(self, findID, self.OnHelpFind)
|
EVT_MENU(self, findID, self.OnHelpFind)
|
||||||
EVT_MENU(self, findnextID, self.OnFindNext)
|
EVT_MENU(self, findnextID, self.OnFindNext)
|
||||||
|
@@ -847,6 +847,21 @@ class wxApp(wxPyApp):
|
|||||||
sys.stdout, sys.stderr = self.saveStdio
|
sys.stdout, sys.stderr = self.saveStdio
|
||||||
|
|
||||||
|
|
||||||
|
# change from wxPyApp_ to wxApp_
|
||||||
|
wxApp_GetMacDefaultEncodingIsPC = wxc.wxPyApp_GetMacDefaultEncodingIsPC
|
||||||
|
wxApp_GetMacSupportPCMenuShortcuts = wxc.wxPyApp_GetMacSupportPCMenuShortcuts
|
||||||
|
wxApp_GetMacAboutMenuItemId = wxc.wxPyApp_GetMacAboutMenuItemId
|
||||||
|
wxApp_GetMacPreferencesMenuItemId = wxc.wxPyApp_GetMacPreferencesMenuItemId
|
||||||
|
wxApp_GetMacExitMenuItemId = wxc.wxPyApp_GetMacExitMenuItemId
|
||||||
|
wxApp_GetMacHelpMenuTitleName = wxc.wxPyApp_GetMacHelpMenuTitleName
|
||||||
|
wxApp_SetMacDefaultEncodingIsPC = wxc.wxPyApp_SetMacDefaultEncodingIsPC
|
||||||
|
wxApp_SetMacSupportPCMenuShortcuts = wxc.wxPyApp_SetMacSupportPCMenuShortcuts
|
||||||
|
wxApp_SetMacAboutMenuItemId = wxc.wxPyApp_SetMacAboutMenuItemId
|
||||||
|
wxApp_SetMacPreferencesMenuItemId = wxc.wxPyApp_SetMacPreferencesMenuItemId
|
||||||
|
wxApp_SetMacExitMenuItemId = wxc.wxPyApp_SetMacExitMenuItemId
|
||||||
|
wxApp_SetMacHelpMenuTitleName = wxc.wxPyApp_SetMacHelpMenuTitleName
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxPySimpleApp(wxApp):
|
class wxPySimpleApp(wxApp):
|
||||||
|
@@ -222,6 +222,105 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
bool wxPyApp::GetMacDefaultEncodingIsPC() {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
return s_macDefaultEncodingIsPC;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
bool wxPyApp::GetMacSupportPCMenuShortcuts() {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
return s_macSupportPCMenuShortcuts;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
long wxPyApp::GetMacAboutMenuItemId() {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
return s_macAboutMenuItemId;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
long wxPyApp::GetMacPreferencesMenuItemId() {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
return s_macPreferencesMenuItemId;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
long wxPyApp::GetMacExitMenuItemId() {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
return s_macExitMenuItemId;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
wxString wxPyApp::GetMacHelpMenuTitleName() {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
return s_macHelpMenuTitleName;
|
||||||
|
#else
|
||||||
|
return wxEmptyString;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
void wxPyApp::SetMacDefaultEncodingIsPC(bool val) {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
s_macDefaultEncodingIsPC = val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
void wxPyApp::SetMacSupportPCMenuShortcuts(bool val) {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
s_macSupportPCMenuShortcuts = val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
void wxPyApp::SetMacAboutMenuItemId(long val) {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
s_macAboutMenuItemId = val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
void wxPyApp::SetMacPreferencesMenuItemId(long val) {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
s_macPreferencesMenuItemId = val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
void wxPyApp::SetMacExitMenuItemId(long val) {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
s_macExitMenuItemId = val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
void wxPyApp::SetMacHelpMenuTitleName(const wxString& val) {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
s_macHelpMenuTitleName = val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -434,9 +434,24 @@ public:
|
|||||||
const wxChar *cond,
|
const wxChar *cond,
|
||||||
const wxChar *msg);
|
const wxChar *msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// virtual int FilterEvent(wxEvent& event); // This one too????
|
// virtual int FilterEvent(wxEvent& event); // This one too????
|
||||||
|
|
||||||
|
|
||||||
|
static bool GetMacDefaultEncodingIsPC();
|
||||||
|
static bool GetMacSupportPCMenuShortcuts();
|
||||||
|
static long GetMacAboutMenuItemId();
|
||||||
|
static long GetMacPreferencesMenuItemId();
|
||||||
|
static long GetMacExitMenuItemId();
|
||||||
|
static wxString GetMacHelpMenuTitleName();
|
||||||
|
|
||||||
|
static void SetMacDefaultEncodingIsPC(bool val);
|
||||||
|
static void SetMacSupportPCMenuShortcuts(bool val);
|
||||||
|
static void SetMacAboutMenuItemId(long val);
|
||||||
|
static void SetMacPreferencesMenuItemId(long val);
|
||||||
|
static void SetMacExitMenuItemId(long val);
|
||||||
|
static void SetMacHelpMenuTitleName(const wxString& val);
|
||||||
|
|
||||||
|
|
||||||
PYPRIVATE;
|
PYPRIVATE;
|
||||||
int m_assertMode;
|
int m_assertMode;
|
||||||
};
|
};
|
||||||
|
@@ -120,6 +120,21 @@ public:
|
|||||||
|
|
||||||
int GetAssertMode();
|
int GetAssertMode();
|
||||||
void SetAssertMode(int mode);
|
void SetAssertMode(int mode);
|
||||||
|
|
||||||
|
|
||||||
|
static bool GetMacDefaultEncodingIsPC();
|
||||||
|
static bool GetMacSupportPCMenuShortcuts();
|
||||||
|
static long GetMacAboutMenuItemId();
|
||||||
|
static long GetMacPreferencesMenuItemId();
|
||||||
|
static long GetMacExitMenuItemId();
|
||||||
|
static wxString GetMacHelpMenuTitleName();
|
||||||
|
|
||||||
|
static void SetMacDefaultEncodingIsPC(bool val);
|
||||||
|
static void SetMacSupportPCMenuShortcuts(bool val);
|
||||||
|
static void SetMacAboutMenuItemId(long val);
|
||||||
|
static void SetMacPreferencesMenuItemId(long val);
|
||||||
|
static void SetMacExitMenuItemId(long val);
|
||||||
|
static void SetMacHelpMenuTitleName(const wxString& val);
|
||||||
};
|
};
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
Reference in New Issue
Block a user