Allow the pulldown menus to be used on Mac
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Thu, 6 Mar 2008 16:55:36 +0000 (16:55 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Thu, 6 Mar 2008 16:55:36 +0000 (16:55 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7152 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/ctl/ctlMenuToolbar.cpp
pgadmin/frm/plugins.cpp
pgadmin/include/pgAdmin3.h

index b67d3306f6b2dd62d8ac1f0b6d74d87724eca68d..8fc1f988c58500ef837cd89f8a0c9a13abd86a81 100644 (file)
@@ -24,8 +24,7 @@ WX_DEFINE_LIST(ctlMenuToolList);
 \r
 /* XPM */\r
 static char *pulldown_xpm[] = {\r
-/* columns rows colors chars-per-pixel */\r
-"16 15 2 1",\r
+"16 16 2 1",\r
 ". c Black",\r
 "  c None",\r
 /* pixels */\r
@@ -35,6 +34,7 @@ static char *pulldown_xpm[] = {
 "                ",\r
 "                ",\r
 "                ",\r
+"     .......    ",\r
 "      .....     ",\r
 "       ...      ",\r
 "        .       ",\r
@@ -59,15 +59,20 @@ void ctlMenuButton::Create(wxWindow *window, wxToolBar *toolBar, int ID, wxMenu
     wxSize pulldownSize;\r
 \r
 #ifdef __WXMSW__\r
-    pulldownSize.Set(12,15);\r
+    pulldownSize.Set(12,16);\r
 #else\r
 #ifdef __WXGTK__\r
-    pulldownSize.Set(18,15);\r
+    pulldownSize.Set(18,16);\r
+#else\r
+// The pulldown doesn't currently work on wxMac under AUI with native toolbars.\r
+// This should be revisited when the long-awaited wxAuiToolbar arrives. See\r
+// wxWidgets bug no. 1742682\r
+#if (wxMAC_USE_NATIVE_TOOLBAR == 0)\r
+    pulldownSize.Set(10,16);\r
 #else\r
-//    pulldownSize.Set(16,15);\r
-// The pulldown doesn't currently work on wxMac.\r
     pulldownSize.Set(0,0);\r
 #endif\r
+#endif\r
 #endif\r
 \r
     m_toolBar = toolBar;\r
index af578ad894bb3f7dc91b970d11e3495958363123..59ddc51ff17ca4ca7cdda92266704fdc07ea7328 100644 (file)
@@ -306,17 +306,32 @@ pluginButtonMenuFactory::pluginButtonMenuFactory(menuFactoryList *list, wxMenu *
 \r
     if (toolbar)\r
     {\r
+        // The pulldown doesn't currently work on wxMac under AUI with native toolbars.\r
+        // This should be revisited when the long-awaited wxAuiToolbar arrives. See\r
+        // wxWidgets bug no. 1742682\r
+        // In the Mac case, use appropriately modified text for the button.\r
+#if defined(__WXMAC__) && (wxMAC_USE_NATIVE_TOOLBAR == 1)\r
+        toolbar->AddTool(id, _("Execute Plugin"), wxBitmap(plugins_xpm), _("Select a plugin."));\r
+        pulldownButton = toolbar->AddMenuPulldownTool(MNU_PLUGINBUTTONLIST, wxT("Execute Plugin"), wxT("Select a plugin."), popupmenu); \r
+#else\r
         toolbar->AddTool(id, _("Plugins"), wxBitmap(plugins_xpm), _("Execute the last used plugin."));\r
         pulldownButton = toolbar->AddMenuPulldownTool(MNU_PLUGINBUTTONLIST, wxT("Execute Plugin"), wxT("Select a plugin."), popupmenu); \r
+#endif\r
     }\r
 }\r
 \r
 // Call the last plugin used, or popup the menu if this is the first time\r
 wxWindow *pluginButtonMenuFactory::StartDialog(frmMain *form, pgObject *obj)\r
 {\r
+    // The pulldown doesn't currently work on wxMac under AUI with native toolbars.\r
+    // This should be revisited when the long-awaited wxAuiToolbar arrives. See\r
+    // wxWidgets bug no. 1742682\r
+    // In the Mac case we always popup the menu.\r
+#if !(defined(__WXMAC__) && (wxMAC_USE_NATIVE_TOOLBAR == 1))\r
     if (form->GetLastPluginUtility())\r
         return form->GetLastPluginUtility()->StartDialog(form, obj);\r
     else\r
+#endif\r
     {\r
         wxMouseEvent evt;\r
         pulldownButton->DoProcessLeftClick(evt);\r
index 28e6fb1a432c9574c4075c4fab34de74af0ff13a..4aabc6f3b1518f6cfe1683532fdbc6508effb55f 100644 (file)
 #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