]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/preferences.mm
first attempt at adding the minimal set needed for dead-key support, see #15345
[wxWidgets.git] / src / osx / cocoa / preferences.mm
index 28d80e3129533cfbf827e8ee4d3adc98a11c2450..7b51732bf0ab39276344bdc79ba4c8d1d3dd6361 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     Native OS X implementation of wxPreferencesEditor.
 // Author:      Vaclav Slavik
 // Created:     2013-02-19
 // Purpose:     Native OS X implementation of wxPreferencesEditor.
 // Author:      Vaclav Slavik
 // Created:     2013-02-19
-// RCS-ID:      $Id$
 // Copyright:   (c) 2013 Vaclav Slavik <vslavik@fastmail.fm>
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) 2013 Vaclav Slavik <vslavik@fastmail.fm>
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -23,6 +22,8 @@
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
+#if wxUSE_PREFERENCES_EDITOR
+
 #include "wx/private/preferences.h"
 
 #ifdef wxHAS_PREF_EDITOR_NATIVE
 #include "wx/private/preferences.h"
 
 #ifdef wxHAS_PREF_EDITOR_NATIVE
@@ -54,8 +55,8 @@ wxBitmap wxStockPreferencesPage::GetLargeIcon() const
 class wxCocoaPrefsWindow : public wxFrame
 {
 public:
 class wxCocoaPrefsWindow : public wxFrame
 {
 public:
-    wxCocoaPrefsWindow()
-        : wxFrame(NULL, wxID_ANY, _("Preferences"),
+    wxCocoaPrefsWindow(const wxString& title)
+        : wxFrame(NULL, wxID_ANY, title,
                   wxDefaultPosition, wxDefaultSize,
                   wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX)),
           m_toolbarRealized(false),
                   wxDefaultPosition, wxDefaultSize,
                   wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX)),
           m_toolbarRealized(false),
@@ -129,6 +130,7 @@ private:
         {
             info->win = info->page->CreateWindow(this);
             info->win->Hide();
         {
             info->win = info->page->CreateWindow(this);
             info->win->Hide();
+            info->win->Fit();
             // fill the page with data using wxEVT_INIT_DIALOG/TransferDataToWindow:
             info->win->InitDialog();
         }
             // fill the page with data using wxEVT_INIT_DIALOG/TransferDataToWindow:
             info->win->InitDialog();
         }
@@ -191,7 +193,8 @@ private:
 class wxCocoaPreferencesEditorImpl : public wxPreferencesEditorImpl
 {
 public:
 class wxCocoaPreferencesEditorImpl : public wxPreferencesEditorImpl
 {
 public:
-    wxCocoaPreferencesEditorImpl() : m_win(NULL)
+    wxCocoaPreferencesEditorImpl(const wxString& title)
+        : m_win(NULL), m_title(title)
     {
     }
 
     {
     }
 
@@ -232,17 +235,27 @@ private:
     wxCocoaPrefsWindow* GetWin()
     {
         if ( !m_win )
     wxCocoaPrefsWindow* GetWin()
     {
         if ( !m_win )
-            m_win = new wxCocoaPrefsWindow();
+        {
+            if ( m_title.empty() )
+                m_title = _("Preferences");
+
+            m_win = new wxCocoaPrefsWindow(m_title);
+        }
+
         return m_win;
     }
 
     wxWeakRef<wxCocoaPrefsWindow> m_win;
         return m_win;
     }
 
     wxWeakRef<wxCocoaPrefsWindow> m_win;
+
+    wxString m_title;
 };
 
 /*static*/
 };
 
 /*static*/
-wxPreferencesEditorImpl* wxPreferencesEditorImpl::Create()
+wxPreferencesEditorImpl* wxPreferencesEditorImpl::Create(const wxString& title)
 {
 {
-    return new wxCocoaPreferencesEditorImpl();
+    return new wxCocoaPreferencesEditorImpl(title);
 }
 
 #endif // wxHAS_PREF_EDITOR_NATIVE
 }
 
 #endif // wxHAS_PREF_EDITOR_NATIVE
+
+#endif // wxUSE_PREFERENCES_EDITOR