From: dpage Date: Thu, 6 Mar 2008 16:55:36 +0000 (+0000) Subject: Allow the pulldown menus to be used on Mac X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=e074cdcccff5d9bb57918b347e89057fe648de11;p=users%2Fquan74%2Fpgadmin-import.git Allow the pulldown menus to be used on Mac git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7152 a7884b65-44f6-0310-8a51-81a127f17b15 --- diff --git a/pgadmin/ctl/ctlMenuToolbar.cpp b/pgadmin/ctl/ctlMenuToolbar.cpp index b67d3306f..8fc1f988c 100644 --- a/pgadmin/ctl/ctlMenuToolbar.cpp +++ b/pgadmin/ctl/ctlMenuToolbar.cpp @@ -24,8 +24,7 @@ WX_DEFINE_LIST(ctlMenuToolList); /* XPM */ static char *pulldown_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 2 1", +"16 16 2 1", ". c Black", " c None", /* pixels */ @@ -35,6 +34,7 @@ static char *pulldown_xpm[] = { " ", " ", " ", +" ....... ", " ..... ", " ... ", " . ", @@ -59,15 +59,20 @@ void ctlMenuButton::Create(wxWindow *window, wxToolBar *toolBar, int ID, wxMenu wxSize pulldownSize; #ifdef __WXMSW__ - pulldownSize.Set(12,15); + pulldownSize.Set(12,16); #else #ifdef __WXGTK__ - pulldownSize.Set(18,15); + pulldownSize.Set(18,16); +#else +// The pulldown doesn't currently work on wxMac under AUI with native toolbars. +// This should be revisited when the long-awaited wxAuiToolbar arrives. See +// wxWidgets bug no. 1742682 +#if (wxMAC_USE_NATIVE_TOOLBAR == 0) + pulldownSize.Set(10,16); #else -// pulldownSize.Set(16,15); -// The pulldown doesn't currently work on wxMac. pulldownSize.Set(0,0); #endif +#endif #endif m_toolBar = toolBar; diff --git a/pgadmin/frm/plugins.cpp b/pgadmin/frm/plugins.cpp index af578ad89..59ddc51ff 100644 --- a/pgadmin/frm/plugins.cpp +++ b/pgadmin/frm/plugins.cpp @@ -306,17 +306,32 @@ pluginButtonMenuFactory::pluginButtonMenuFactory(menuFactoryList *list, wxMenu * if (toolbar) { + // The pulldown doesn't currently work on wxMac under AUI with native toolbars. + // This should be revisited when the long-awaited wxAuiToolbar arrives. See + // wxWidgets bug no. 1742682 + // In the Mac case, use appropriately modified text for the button. +#if defined(__WXMAC__) && (wxMAC_USE_NATIVE_TOOLBAR == 1) + toolbar->AddTool(id, _("Execute Plugin"), wxBitmap(plugins_xpm), _("Select a plugin.")); + pulldownButton = toolbar->AddMenuPulldownTool(MNU_PLUGINBUTTONLIST, wxT("Execute Plugin"), wxT("Select a plugin."), popupmenu); +#else toolbar->AddTool(id, _("Plugins"), wxBitmap(plugins_xpm), _("Execute the last used plugin.")); pulldownButton = toolbar->AddMenuPulldownTool(MNU_PLUGINBUTTONLIST, wxT("Execute Plugin"), wxT("Select a plugin."), popupmenu); +#endif } } // Call the last plugin used, or popup the menu if this is the first time wxWindow *pluginButtonMenuFactory::StartDialog(frmMain *form, pgObject *obj) { + // The pulldown doesn't currently work on wxMac under AUI with native toolbars. + // This should be revisited when the long-awaited wxAuiToolbar arrives. See + // wxWidgets bug no. 1742682 + // In the Mac case we always popup the menu. +#if !(defined(__WXMAC__) && (wxMAC_USE_NATIVE_TOOLBAR == 1)) if (form->GetLastPluginUtility()) return form->GetLastPluginUtility()->StartDialog(form, obj); else +#endif { wxMouseEvent evt; pulldownButton->DoProcessLeftClick(evt); diff --git a/pgadmin/include/pgAdmin3.h b/pgadmin/include/pgAdmin3.h index 28e6fb1a4..4aabc6f3b 100644 --- a/pgadmin/include/pgAdmin3.h +++ b/pgadmin/include/pgAdmin3.h @@ -48,6 +48,12 @@ #error wxWidgets must be compiled with Unicode support to build pgAdmin. #endif +#ifdef __WXMAC__ +#if (wxMAC_USE_NATIVE_TOOLBAR == 1) +#warning *** wxMAC_USE_NATIVE_TOOLBAR is enabled in wxWidgets. Toolbar pulldown menus will be disabled in this build. +#endif +#endif + const float SERVER_MIN_VERSION = 7.3f; // Some redefines for modern Microsoft compilers