]> git.saurik.com Git - wxWidgets.git/commitdiff
Renames to avoid object files with duplicate filenames. (Should we just make everythi...
authorKevin Ollivier <kevino@theolliviers.com>
Thu, 4 Sep 2008 07:19:28 +0000 (07:19 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Thu, 4 Sep 2008 07:19:28 +0000 (07:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/checklst.cpp [deleted file]
src/osx/checklst_osx.cpp [new file with mode: 0644]
src/osx/radiobox.cpp [deleted file]
src/osx/radiobox_osx.cpp [new file with mode: 0644]
src/osx/spinctrl.cpp [deleted file]
src/osx/spinctrl_osx.cpp [new file with mode: 0644]
src/osx/toplevel.cpp [deleted file]
src/osx/toplevel_osx.cpp [new file with mode: 0644]

diff --git a/src/osx/checklst.cpp b/src/osx/checklst.cpp
deleted file mode 100644 (file)
index 574d9ec..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        src/osx/checklst.cpp
-// Purpose:     implementation of wxCheckListBox class
-// Author:      Stefan Csomor
-// Modified by:
-// Created:     1998-01-01
-// RCS-ID:      $Id$
-// Copyright:   (c) Stefan Csomor
-// Licence:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-//
-// new DataBrowser-based version
-
-
-#include "wx/wxprec.h"
-
-#if wxUSE_CHECKLISTBOX
-
-#include "wx/checklst.h"
-
-#ifndef WX_PRECOMP
-    #include "wx/arrstr.h"
-#endif
-
-#include "wx/osx/private.h"
-
-IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
-
-BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
-END_EVENT_TABLE()
-void wxCheckListBox::Init()
-{
-}
-
-bool wxCheckListBox::Create(
-    wxWindow *parent,
-    wxWindowID id,
-    const wxPoint &pos,
-    const wxSize &size,
-    const wxArrayString& choices,
-    long style,
-    const wxValidator& validator,
-    const wxString &name )
-{
-    wxCArrayString chs( choices );
-
-    return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), style, validator, name );
-}
-
-bool wxCheckListBox::Create(
-   wxWindow *parent,
-   wxWindowID id,
-   const wxPoint& pos,
-   const wxSize& size,
-   int n,
-   const wxString choices[],
-   long style,
-   const wxValidator& validator,
-   const wxString& name )
-{
-    m_macIsUserPane = false;
-
-    wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
-                  wxT("only one of listbox selection modes can be specified") );
-
-    if ( !wxCheckListBoxBase::Create( parent, id, pos, size, n, choices, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
-        return false;
-
-    int colwidth = 30;
-    // TODO adapt the width according to the window variant
-    m_checkColumn = GetListPeer()->InsertCheckColumn(0, wxEmptyString, true, wxALIGN_CENTER, colwidth);
-
-    return true;
-}
-
-// ----------------------------------------------------------------------------
-// wxCheckListBox functions
-// ----------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------
-// wxCheckListBox functions
-// ----------------------------------------------------------------------------
-
-bool wxCheckListBox::IsChecked(unsigned int n) const
-{
-    wxCHECK_MSG( IsValid(n), false,
-                 _T("invalid index in wxCheckListBox::IsChecked") );
-
-    return m_checks[n] != 0;
-}
-
-void wxCheckListBox::Check(unsigned int n, bool check)
-{
-    wxCHECK_RET( IsValid(n),
-                 _T("invalid index in wxCheckListBox::Check") );
-
-    // intermediate var is needed to avoid compiler warning with VC++
-    bool isChecked = m_checks[n] != 0;
-    if ( check != isChecked )
-    {
-        m_checks[n] = check;
-
-        GetListPeer()->UpdateLine(n);
-    }
-}
-
-void wxCheckListBox::GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
-{
-    if ( col == m_checkColumn )
-        value.Set( IsChecked( n ) );
-    else
-        wxListBox::GetValueCallback( n, col, value );
-}
-
-void wxCheckListBox::SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
-{
-    if ( col == m_checkColumn )
-    {
-        Check( n, value.GetIntValue() );
-        
-        wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() );
-        event.SetInt( n );
-        event.SetEventObject( this );
-        HandleWindowEvent( event );
-    }
-}
-
-
-
-// ----------------------------------------------------------------------------
-// methods forwarded to wxListBox
-// ----------------------------------------------------------------------------
-
-void wxCheckListBox::OnItemInserted(unsigned int pos)
-{
-    m_checks.Insert(false, pos );
-}
-
-void wxCheckListBox::DoDeleteOneItem(unsigned int n)
-{
-    wxListBox::DoDeleteOneItem(n);
-
-    m_checks.RemoveAt(n);
-}
-
-void wxCheckListBox::DoClear()
-{
-    m_checks.Empty();
-}
-
-#endif // wxUSE_CHECKLISTBOX
diff --git a/src/osx/checklst_osx.cpp b/src/osx/checklst_osx.cpp
new file mode 100644 (file)
index 0000000..574d9ec
--- /dev/null
@@ -0,0 +1,152 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/checklst.cpp
+// Purpose:     implementation of wxCheckListBox class
+// Author:      Stefan Csomor
+// Modified by:
+// Created:     1998-01-01
+// RCS-ID:      $Id$
+// Copyright:   (c) Stefan Csomor
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+//
+// new DataBrowser-based version
+
+
+#include "wx/wxprec.h"
+
+#if wxUSE_CHECKLISTBOX
+
+#include "wx/checklst.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/arrstr.h"
+#endif
+
+#include "wx/osx/private.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
+
+BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
+END_EVENT_TABLE()
+void wxCheckListBox::Init()
+{
+}
+
+bool wxCheckListBox::Create(
+    wxWindow *parent,
+    wxWindowID id,
+    const wxPoint &pos,
+    const wxSize &size,
+    const wxArrayString& choices,
+    long style,
+    const wxValidator& validator,
+    const wxString &name )
+{
+    wxCArrayString chs( choices );
+
+    return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), style, validator, name );
+}
+
+bool wxCheckListBox::Create(
+   wxWindow *parent,
+   wxWindowID id,
+   const wxPoint& pos,
+   const wxSize& size,
+   int n,
+   const wxString choices[],
+   long style,
+   const wxValidator& validator,
+   const wxString& name )
+{
+    m_macIsUserPane = false;
+
+    wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
+                  wxT("only one of listbox selection modes can be specified") );
+
+    if ( !wxCheckListBoxBase::Create( parent, id, pos, size, n, choices, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
+        return false;
+
+    int colwidth = 30;
+    // TODO adapt the width according to the window variant
+    m_checkColumn = GetListPeer()->InsertCheckColumn(0, wxEmptyString, true, wxALIGN_CENTER, colwidth);
+
+    return true;
+}
+
+// ----------------------------------------------------------------------------
+// wxCheckListBox functions
+// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+// wxCheckListBox functions
+// ----------------------------------------------------------------------------
+
+bool wxCheckListBox::IsChecked(unsigned int n) const
+{
+    wxCHECK_MSG( IsValid(n), false,
+                 _T("invalid index in wxCheckListBox::IsChecked") );
+
+    return m_checks[n] != 0;
+}
+
+void wxCheckListBox::Check(unsigned int n, bool check)
+{
+    wxCHECK_RET( IsValid(n),
+                 _T("invalid index in wxCheckListBox::Check") );
+
+    // intermediate var is needed to avoid compiler warning with VC++
+    bool isChecked = m_checks[n] != 0;
+    if ( check != isChecked )
+    {
+        m_checks[n] = check;
+
+        GetListPeer()->UpdateLine(n);
+    }
+}
+
+void wxCheckListBox::GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
+{
+    if ( col == m_checkColumn )
+        value.Set( IsChecked( n ) );
+    else
+        wxListBox::GetValueCallback( n, col, value );
+}
+
+void wxCheckListBox::SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
+{
+    if ( col == m_checkColumn )
+    {
+        Check( n, value.GetIntValue() );
+        
+        wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() );
+        event.SetInt( n );
+        event.SetEventObject( this );
+        HandleWindowEvent( event );
+    }
+}
+
+
+
+// ----------------------------------------------------------------------------
+// methods forwarded to wxListBox
+// ----------------------------------------------------------------------------
+
+void wxCheckListBox::OnItemInserted(unsigned int pos)
+{
+    m_checks.Insert(false, pos );
+}
+
+void wxCheckListBox::DoDeleteOneItem(unsigned int n)
+{
+    wxListBox::DoDeleteOneItem(n);
+
+    m_checks.RemoveAt(n);
+}
+
+void wxCheckListBox::DoClear()
+{
+    m_checks.Empty();
+}
+
+#endif // wxUSE_CHECKLISTBOX
diff --git a/src/osx/radiobox.cpp b/src/osx/radiobox.cpp
deleted file mode 100644 (file)
index 6ad4a13..0000000
+++ /dev/null
@@ -1,515 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        src/osx/radiobox.cpp
-// Purpose:     wxRadioBox
-// Author:      Stefan Csomor
-// Modified by: JS Lair (99/11/15) first implementation
-// Created:     1998-01-01
-// RCS-ID:      $Id$
-// Copyright:   (c) Stefan Csomor
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#include "wx/wxprec.h"
-
-#if wxUSE_RADIOBOX
-
-#include "wx/radiobox.h"
-
-#ifndef WX_PRECOMP
-    #include "wx/radiobut.h"
-    #include "wx/arrstr.h"
-#endif
-
-#include "wx/osx/private.h"
-
-IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
-
-
-BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
-    EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton )
-END_EVENT_TABLE()
-
-
-void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
-{
-    if ( outer.IsChecked() )
-    {
-        wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId );
-        int i = GetSelection() ;
-        event.SetInt(i);
-        event.SetString(GetString(i));
-        event.SetEventObject( this );
-        ProcessCommand(event);
-    }
-}
-
-wxRadioBox::wxRadioBox()
-{
-    m_noItems = 0;
-    m_noRowsOrCols = 0;
-    m_radioButtonCycle = NULL;
-}
-
-wxRadioBox::~wxRadioBox()
-{
-    m_isBeingDeleted = true;
-
-    wxRadioButton *next, *current;
-
-    current = m_radioButtonCycle->NextInCycle();
-    if (current != NULL)
-    {
-        while (current != m_radioButtonCycle)
-        {
-            next = current->NextInCycle();
-            delete current;
-
-            current = next;
-        }
-
-        delete current;
-    }
-}
-
-// Create the radiobox for two-step construction
-
-bool wxRadioBox::Create( wxWindow *parent,
-    wxWindowID id, const wxString& label,
-    const wxPoint& pos, const wxSize& size,
-    const wxArrayString& choices,
-    int majorDim, long style,
-    const wxValidator& val, const wxString& name )
-{
-    wxCArrayString chs(choices);
-
-    return Create(
-        parent, id, label, pos, size, chs.GetCount(),
-        chs.GetStrings(), majorDim, style, val, name);
-}
-
-bool wxRadioBox::Create( wxWindow *parent,
-    wxWindowID id, const wxString& label,
-    const wxPoint& pos, const wxSize& size,
-    int n, const wxString choices[],
-    int majorDim, long style,
-    const wxValidator& val, const wxString& name )
-{
-    m_macIsUserPane = false ;
-
-    if ( !wxControl::Create( parent, id, pos, size, style, val, name ) )
-        return false;
-
-    int i;
-
-    m_noItems = (unsigned int)n;
-    m_noRowsOrCols = majorDim;
-    m_radioButtonCycle = NULL;
-
-    SetMajorDim( majorDim == 0 ? n : majorDim, style );
-
-    m_labelOrig = m_label = label;
-
-    m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() );
-
-    for (i = 0; i < n; i++)
-    {
-        wxRadioButton *radBtn = new wxRadioButton(
-            this,
-            wxID_ANY,
-            GetLabelText(choices[i]),
-            wxPoint( 5, 20 * i + 10 ),
-            wxDefaultSize,
-            i == 0 ? wxRB_GROUP : 0 );
-
-        if ( i == 0 )
-            m_radioButtonCycle = radBtn;
-//        m_radioButtonCycle = radBtn->AddInCycle( m_radioButtonCycle );
-    }
-
-    SetSelection( 0 );
-    MacPostControlCreate( pos, size );
-
-    return true;
-}
-
-// Enables or disables the entire radiobox
-//
-bool wxRadioBox::Enable(bool enable)
-{
-    wxRadioButton *current;
-
-    if (!wxControl::Enable( enable ))
-        return false;
-
-    current = m_radioButtonCycle;
-    for (unsigned int i = 0; i < m_noItems; i++)
-    {
-        current->Enable( enable );
-        current = current->NextInCycle();
-    }
-
-    return true;
-}
-
-// Enables or disables an given button
-//
-bool wxRadioBox::Enable(unsigned int item, bool enable)
-{
-    if (!IsValid( item ))
-        return false;
-
-    unsigned int i = 0;
-    wxRadioButton *current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return current->Enable( enable );
-}
-
-bool wxRadioBox::IsItemEnabled(unsigned int item) const
-{
-    if (!IsValid( item ))
-        return false;
-
-    unsigned int i = 0;
-    wxRadioButton *current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return current->IsEnabled();
-}
-
-// Returns the radiobox label
-//
-wxString wxRadioBox::GetLabel() const
-{
-    return wxControl::GetLabel();
-}
-
-// Returns the label for the given button
-//
-wxString wxRadioBox::GetString(unsigned int item) const
-{
-    wxRadioButton *current;
-
-    if (!IsValid( item ))
-        return wxEmptyString;
-
-    unsigned int i = 0;
-    current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return current->GetLabel();
-}
-
-// Returns the zero-based position of the selected button
-//
-int wxRadioBox::GetSelection() const
-{
-    int i;
-    wxRadioButton *current;
-
-    i = 0;
-    current = m_radioButtonCycle;
-    while (!current->GetValue())
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return i;
-}
-
-// Sets the radiobox label
-//
-void wxRadioBox::SetLabel(const wxString& label)
-{
-    return wxControl::SetLabel( label );
-}
-
-// Sets the label of a given button
-//
-void wxRadioBox::SetString(unsigned int item,const wxString& label)
-{
-    if (!IsValid( item ))
-        return;
-
-    unsigned int i = 0;
-    wxRadioButton *current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return current->SetLabel( label );
-}
-
-// Sets a button by passing the desired position. This does not cause
-// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
-//
-void wxRadioBox::SetSelection(int item)
-{
-    int i;
-    wxRadioButton *current;
-
-    if (!IsValid( item ))
-        return;
-
-    i = 0;
-    current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    current->SetValue( true );
-}
-
-// Shows or hides the entire radiobox
-//
-bool wxRadioBox::Show(bool show)
-{
-    wxRadioButton *current;
-
-    current = m_radioButtonCycle;
-    for (unsigned int i=0; i<m_noItems; i++)
-    {
-        current->Show( show );
-        current = current->NextInCycle();
-    }
-
-    wxControl::Show( show );
-
-    return true;
-}
-
-// Shows or hides the given button
-//
-bool wxRadioBox::Show(unsigned int item, bool show)
-{
-    if (!IsValid( item ))
-        return false;
-
-    unsigned int i = 0;
-    wxRadioButton *current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return current->Show( show );
-}
-
-bool wxRadioBox::IsItemShown(unsigned int item) const
-{
-    if (!IsValid( item ))
-        return false;
-
-    unsigned int i = 0;
-    wxRadioButton *current = m_radioButtonCycle;
-    while (i != item)
-    {
-        i++;
-        current = current->NextInCycle();
-    }
-
-    return current->IsShown();
-}
-
-
-// Simulates the effect of the user issuing a command to the item
-//
-void wxRadioBox::Command( wxCommandEvent& event )
-{
-    SetSelection( event.GetInt() );
-    ProcessCommand( event );
-}
-
-// Sets the selected button to receive keyboard input
-//
-void wxRadioBox::SetFocus()
-{
-    wxRadioButton *current;
-
-    current = m_radioButtonCycle;
-    while (!current->GetValue())
-    {
-        current = current->NextInCycle();
-    }
-
-    current->SetFocus();
-}
-
-// Simulates the effect of the user issuing a command to the item
-//
-#define RADIO_SIZE 20
-
-void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
-{
-    int i;
-    wxRadioButton *current;
-
-    // define the position
-
-    int x_current, y_current;
-    int x_offset, y_offset;
-    int widthOld, heightOld;
-
-    GetSize( &widthOld, &heightOld );
-    GetPosition( &x_current, &y_current );
-
-    x_offset = x;
-    y_offset = y;
-    if (!(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-    {
-        if (x == wxDefaultCoord)
-            x_offset = x_current;
-        if (y == wxDefaultCoord)
-            y_offset = y_current;
-    }
-
-    // define size
-    int charWidth, charHeight;
-    int maxWidth, maxHeight;
-    int eachWidth[128], eachHeight[128];
-    int totWidth, totHeight;
-
-    GetTextExtent(
-        wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
-        &charWidth, &charHeight );
-
-    charWidth /= 52;
-
-    maxWidth = -1;
-    maxHeight = -1;
-    for (unsigned int i = 0 ; i < m_noItems; i++)
-    {
-        GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i] );
-        eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
-        eachHeight[i] = (int)((3 * eachHeight[i]) / 2);
-
-        if (maxWidth < eachWidth[i])
-            maxWidth = eachWidth[i];
-        if (maxHeight < eachHeight[i])
-            maxHeight = eachHeight[i];
-    }
-
-    totHeight = GetRowCount() * maxHeight;
-    totWidth  = GetColumnCount() * (maxWidth + charWidth);
-
-    wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
-
-    // change the width / height only when specified
-    if ( width == wxDefaultCoord )
-    {
-        if ( sizeFlags & wxSIZE_AUTO_WIDTH )
-            width = sz.x;
-        else
-            width = widthOld;
-    }
-
-    if ( height == wxDefaultCoord )
-    {
-        if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
-            height = sz.y;
-        else
-            height = heightOld;
-    }
-
-    wxControl::DoSetSize( x_offset, y_offset, width, height, wxSIZE_AUTO );
-
-    // arrange radio buttons
-    int x_start, y_start;
-
-    x_start = 0;
-    y_start = 0;
-
-    x_offset = x_start;
-    y_offset = y_start;
-
-    current = m_radioButtonCycle;
-    for (i = 0 ; i < (int)m_noItems; i++)
-    {
-        // not to do for the zero button!
-        if ((i > 0) && ((i % GetMajorDim()) == 0))
-        {
-            if (m_windowStyle & wxRA_SPECIFY_ROWS)
-            {
-                x_offset += maxWidth + charWidth;
-                y_offset = y_start;
-            }
-            else
-            {
-                x_offset = x_start;
-                y_offset += maxHeight ; //+ charHeight / 2
-            }
-        }
-
-        current->SetSize( x_offset, y_offset, eachWidth[i], eachHeight[i]);
-        current = current->NextInCycle();
-
-        if (m_windowStyle & wxRA_SPECIFY_ROWS)
-            y_offset += maxHeight ; // + charHeight / 2
-        else
-            x_offset += maxWidth + charWidth;
-    }
-}
-
-wxSize wxRadioBox::DoGetBestSize() const
-{
-    int charWidth, charHeight;
-    int maxWidth, maxHeight;
-    int eachWidth, eachHeight;
-    int totWidth, totHeight;
-
-    wxFont font = GetFont(); // GetParent()->GetFont()
-    GetTextExtent(
-        wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
-        &charWidth, &charHeight, NULL, NULL, &font );
-
-    charWidth /= 52;
-
-    maxWidth = -1;
-    maxHeight = -1;
-
-    for (unsigned int i = 0 ; i < m_noItems; i++)
-    {
-        GetTextExtent(GetString(i), &eachWidth, &eachHeight, NULL, NULL, &font );
-        eachWidth  = (int)(eachWidth + RADIO_SIZE);
-        eachHeight = (int)((3 * eachHeight) / 2);
-        if (maxWidth < eachWidth)
-            maxWidth = eachWidth;
-        if (maxHeight < eachHeight)
-            maxHeight = eachHeight;
-    }
-
-    totHeight = GetRowCount() * maxHeight;
-    totWidth  = GetColumnCount() * (maxWidth + charWidth);
-
-    wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) );
-    totWidth = sz.x;
-    totHeight = sz.y;
-
-    // handle radio box title as well
-    GetTextExtent( GetLabel(), &eachWidth, NULL );
-    eachWidth  = (int)(eachWidth + RADIO_SIZE) +  3 * charWidth;
-    if (totWidth < eachWidth)
-        totWidth = eachWidth;
-
-    return wxSize( totWidth, totHeight );
-}
-
-#endif // wxUSE_RADIOBOX
diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp
new file mode 100644 (file)
index 0000000..6ad4a13
--- /dev/null
@@ -0,0 +1,515 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/radiobox.cpp
+// Purpose:     wxRadioBox
+// Author:      Stefan Csomor
+// Modified by: JS Lair (99/11/15) first implementation
+// Created:     1998-01-01
+// RCS-ID:      $Id$
+// Copyright:   (c) Stefan Csomor
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#if wxUSE_RADIOBOX
+
+#include "wx/radiobox.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/radiobut.h"
+    #include "wx/arrstr.h"
+#endif
+
+#include "wx/osx/private.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
+
+
+BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
+    EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton )
+END_EVENT_TABLE()
+
+
+void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
+{
+    if ( outer.IsChecked() )
+    {
+        wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId );
+        int i = GetSelection() ;
+        event.SetInt(i);
+        event.SetString(GetString(i));
+        event.SetEventObject( this );
+        ProcessCommand(event);
+    }
+}
+
+wxRadioBox::wxRadioBox()
+{
+    m_noItems = 0;
+    m_noRowsOrCols = 0;
+    m_radioButtonCycle = NULL;
+}
+
+wxRadioBox::~wxRadioBox()
+{
+    m_isBeingDeleted = true;
+
+    wxRadioButton *next, *current;
+
+    current = m_radioButtonCycle->NextInCycle();
+    if (current != NULL)
+    {
+        while (current != m_radioButtonCycle)
+        {
+            next = current->NextInCycle();
+            delete current;
+
+            current = next;
+        }
+
+        delete current;
+    }
+}
+
+// Create the radiobox for two-step construction
+
+bool wxRadioBox::Create( wxWindow *parent,
+    wxWindowID id, const wxString& label,
+    const wxPoint& pos, const wxSize& size,
+    const wxArrayString& choices,
+    int majorDim, long style,
+    const wxValidator& val, const wxString& name )
+{
+    wxCArrayString chs(choices);
+
+    return Create(
+        parent, id, label, pos, size, chs.GetCount(),
+        chs.GetStrings(), majorDim, style, val, name);
+}
+
+bool wxRadioBox::Create( wxWindow *parent,
+    wxWindowID id, const wxString& label,
+    const wxPoint& pos, const wxSize& size,
+    int n, const wxString choices[],
+    int majorDim, long style,
+    const wxValidator& val, const wxString& name )
+{
+    m_macIsUserPane = false ;
+
+    if ( !wxControl::Create( parent, id, pos, size, style, val, name ) )
+        return false;
+
+    int i;
+
+    m_noItems = (unsigned int)n;
+    m_noRowsOrCols = majorDim;
+    m_radioButtonCycle = NULL;
+
+    SetMajorDim( majorDim == 0 ? n : majorDim, style );
+
+    m_labelOrig = m_label = label;
+
+    m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() );
+
+    for (i = 0; i < n; i++)
+    {
+        wxRadioButton *radBtn = new wxRadioButton(
+            this,
+            wxID_ANY,
+            GetLabelText(choices[i]),
+            wxPoint( 5, 20 * i + 10 ),
+            wxDefaultSize,
+            i == 0 ? wxRB_GROUP : 0 );
+
+        if ( i == 0 )
+            m_radioButtonCycle = radBtn;
+//        m_radioButtonCycle = radBtn->AddInCycle( m_radioButtonCycle );
+    }
+
+    SetSelection( 0 );
+    MacPostControlCreate( pos, size );
+
+    return true;
+}
+
+// Enables or disables the entire radiobox
+//
+bool wxRadioBox::Enable(bool enable)
+{
+    wxRadioButton *current;
+
+    if (!wxControl::Enable( enable ))
+        return false;
+
+    current = m_radioButtonCycle;
+    for (unsigned int i = 0; i < m_noItems; i++)
+    {
+        current->Enable( enable );
+        current = current->NextInCycle();
+    }
+
+    return true;
+}
+
+// Enables or disables an given button
+//
+bool wxRadioBox::Enable(unsigned int item, bool enable)
+{
+    if (!IsValid( item ))
+        return false;
+
+    unsigned int i = 0;
+    wxRadioButton *current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return current->Enable( enable );
+}
+
+bool wxRadioBox::IsItemEnabled(unsigned int item) const
+{
+    if (!IsValid( item ))
+        return false;
+
+    unsigned int i = 0;
+    wxRadioButton *current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return current->IsEnabled();
+}
+
+// Returns the radiobox label
+//
+wxString wxRadioBox::GetLabel() const
+{
+    return wxControl::GetLabel();
+}
+
+// Returns the label for the given button
+//
+wxString wxRadioBox::GetString(unsigned int item) const
+{
+    wxRadioButton *current;
+
+    if (!IsValid( item ))
+        return wxEmptyString;
+
+    unsigned int i = 0;
+    current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return current->GetLabel();
+}
+
+// Returns the zero-based position of the selected button
+//
+int wxRadioBox::GetSelection() const
+{
+    int i;
+    wxRadioButton *current;
+
+    i = 0;
+    current = m_radioButtonCycle;
+    while (!current->GetValue())
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return i;
+}
+
+// Sets the radiobox label
+//
+void wxRadioBox::SetLabel(const wxString& label)
+{
+    return wxControl::SetLabel( label );
+}
+
+// Sets the label of a given button
+//
+void wxRadioBox::SetString(unsigned int item,const wxString& label)
+{
+    if (!IsValid( item ))
+        return;
+
+    unsigned int i = 0;
+    wxRadioButton *current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return current->SetLabel( label );
+}
+
+// Sets a button by passing the desired position. This does not cause
+// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
+//
+void wxRadioBox::SetSelection(int item)
+{
+    int i;
+    wxRadioButton *current;
+
+    if (!IsValid( item ))
+        return;
+
+    i = 0;
+    current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    current->SetValue( true );
+}
+
+// Shows or hides the entire radiobox
+//
+bool wxRadioBox::Show(bool show)
+{
+    wxRadioButton *current;
+
+    current = m_radioButtonCycle;
+    for (unsigned int i=0; i<m_noItems; i++)
+    {
+        current->Show( show );
+        current = current->NextInCycle();
+    }
+
+    wxControl::Show( show );
+
+    return true;
+}
+
+// Shows or hides the given button
+//
+bool wxRadioBox::Show(unsigned int item, bool show)
+{
+    if (!IsValid( item ))
+        return false;
+
+    unsigned int i = 0;
+    wxRadioButton *current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return current->Show( show );
+}
+
+bool wxRadioBox::IsItemShown(unsigned int item) const
+{
+    if (!IsValid( item ))
+        return false;
+
+    unsigned int i = 0;
+    wxRadioButton *current = m_radioButtonCycle;
+    while (i != item)
+    {
+        i++;
+        current = current->NextInCycle();
+    }
+
+    return current->IsShown();
+}
+
+
+// Simulates the effect of the user issuing a command to the item
+//
+void wxRadioBox::Command( wxCommandEvent& event )
+{
+    SetSelection( event.GetInt() );
+    ProcessCommand( event );
+}
+
+// Sets the selected button to receive keyboard input
+//
+void wxRadioBox::SetFocus()
+{
+    wxRadioButton *current;
+
+    current = m_radioButtonCycle;
+    while (!current->GetValue())
+    {
+        current = current->NextInCycle();
+    }
+
+    current->SetFocus();
+}
+
+// Simulates the effect of the user issuing a command to the item
+//
+#define RADIO_SIZE 20
+
+void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{
+    int i;
+    wxRadioButton *current;
+
+    // define the position
+
+    int x_current, y_current;
+    int x_offset, y_offset;
+    int widthOld, heightOld;
+
+    GetSize( &widthOld, &heightOld );
+    GetPosition( &x_current, &y_current );
+
+    x_offset = x;
+    y_offset = y;
+    if (!(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    {
+        if (x == wxDefaultCoord)
+            x_offset = x_current;
+        if (y == wxDefaultCoord)
+            y_offset = y_current;
+    }
+
+    // define size
+    int charWidth, charHeight;
+    int maxWidth, maxHeight;
+    int eachWidth[128], eachHeight[128];
+    int totWidth, totHeight;
+
+    GetTextExtent(
+        wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+        &charWidth, &charHeight );
+
+    charWidth /= 52;
+
+    maxWidth = -1;
+    maxHeight = -1;
+    for (unsigned int i = 0 ; i < m_noItems; i++)
+    {
+        GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i] );
+        eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
+        eachHeight[i] = (int)((3 * eachHeight[i]) / 2);
+
+        if (maxWidth < eachWidth[i])
+            maxWidth = eachWidth[i];
+        if (maxHeight < eachHeight[i])
+            maxHeight = eachHeight[i];
+    }
+
+    totHeight = GetRowCount() * maxHeight;
+    totWidth  = GetColumnCount() * (maxWidth + charWidth);
+
+    wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
+
+    // change the width / height only when specified
+    if ( width == wxDefaultCoord )
+    {
+        if ( sizeFlags & wxSIZE_AUTO_WIDTH )
+            width = sz.x;
+        else
+            width = widthOld;
+    }
+
+    if ( height == wxDefaultCoord )
+    {
+        if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
+            height = sz.y;
+        else
+            height = heightOld;
+    }
+
+    wxControl::DoSetSize( x_offset, y_offset, width, height, wxSIZE_AUTO );
+
+    // arrange radio buttons
+    int x_start, y_start;
+
+    x_start = 0;
+    y_start = 0;
+
+    x_offset = x_start;
+    y_offset = y_start;
+
+    current = m_radioButtonCycle;
+    for (i = 0 ; i < (int)m_noItems; i++)
+    {
+        // not to do for the zero button!
+        if ((i > 0) && ((i % GetMajorDim()) == 0))
+        {
+            if (m_windowStyle & wxRA_SPECIFY_ROWS)
+            {
+                x_offset += maxWidth + charWidth;
+                y_offset = y_start;
+            }
+            else
+            {
+                x_offset = x_start;
+                y_offset += maxHeight ; //+ charHeight / 2
+            }
+        }
+
+        current->SetSize( x_offset, y_offset, eachWidth[i], eachHeight[i]);
+        current = current->NextInCycle();
+
+        if (m_windowStyle & wxRA_SPECIFY_ROWS)
+            y_offset += maxHeight ; // + charHeight / 2
+        else
+            x_offset += maxWidth + charWidth;
+    }
+}
+
+wxSize wxRadioBox::DoGetBestSize() const
+{
+    int charWidth, charHeight;
+    int maxWidth, maxHeight;
+    int eachWidth, eachHeight;
+    int totWidth, totHeight;
+
+    wxFont font = GetFont(); // GetParent()->GetFont()
+    GetTextExtent(
+        wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+        &charWidth, &charHeight, NULL, NULL, &font );
+
+    charWidth /= 52;
+
+    maxWidth = -1;
+    maxHeight = -1;
+
+    for (unsigned int i = 0 ; i < m_noItems; i++)
+    {
+        GetTextExtent(GetString(i), &eachWidth, &eachHeight, NULL, NULL, &font );
+        eachWidth  = (int)(eachWidth + RADIO_SIZE);
+        eachHeight = (int)((3 * eachHeight) / 2);
+        if (maxWidth < eachWidth)
+            maxWidth = eachWidth;
+        if (maxHeight < eachHeight)
+            maxHeight = eachHeight;
+    }
+
+    totHeight = GetRowCount() * maxHeight;
+    totWidth  = GetColumnCount() * (maxWidth + charWidth);
+
+    wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) );
+    totWidth = sz.x;
+    totHeight = sz.y;
+
+    // handle radio box title as well
+    GetTextExtent( GetLabel(), &eachWidth, NULL );
+    eachWidth  = (int)(eachWidth + RADIO_SIZE) +  3 * charWidth;
+    if (totWidth < eachWidth)
+        totWidth = eachWidth;
+
+    return wxSize( totWidth, totHeight );
+}
+
+#endif // wxUSE_RADIOBOX
diff --git a/src/osx/spinctrl.cpp b/src/osx/spinctrl.cpp
deleted file mode 100644 (file)
index 3d2ed85..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        src/osx/carbon/spinbutt.cpp
-// Purpose:     wxSpinCtrl
-// Author:      Robert
-// Modified by: Mark Newsam (Based on GTK file)
-// RCS-ID:      $Id$
-// Copyright:   (c) Robert Roebling
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#include "wx/wxprec.h"
-
-#if wxUSE_SPINCTRL
-
-#include "wx/spinctrl.h"
-
-#ifndef WX_PRECOMP
-    #include "wx/textctrl.h"
-    #include "wx/containr.h"
-#endif
-
-#include "wx/spinbutt.h"
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// the focus rect around a text may have 4 pixels in each direction
-// we handle these problems right now in an extended vis region of a window
-static const wxCoord TEXTBORDER = 4 ;
-// the margin between the text control and the spin
-// HIG says 2px between text and stepper control,
-// but a value of 3 leads to the same look as the
-// spin controls in Apple's apps
-static const wxCoord MARGIN = 3;
-
-// ----------------------------------------------------------------------------
-// wxSpinCtrlText: text control used by spin control
-// ----------------------------------------------------------------------------
-
-class wxSpinCtrlText : public wxTextCtrl
-{
-public:
-    wxSpinCtrlText(wxSpinCtrl *spin, const wxString& value)
-        : wxTextCtrl(spin , wxID_ANY, value, wxDefaultPosition, wxSize(40, wxDefaultCoord))
-    {
-        m_spin = spin;
-
-        // remove the default minsize, the spinctrl will have one instead
-        SetMinSize(wxDefaultSize);
-    }
-
-    bool ProcessEvent(wxEvent &event)
-    {
-        // Hand button down events to wxSpinCtrl. Doesn't work.
-        if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event ))
-            return true;
-
-        return wxTextCtrl::ProcessEvent( event );
-    }
-
-protected:
-     void OnKillFocus(wxFocusEvent& WXUNUSED(event))
-     {
-         long l;
-         if ( !GetValue().ToLong(&l) )
-         {
-             // not a number at all
-             return;
-         }
-
-         // is within range
-         if (l < m_spin->GetMin())
-             l = m_spin->GetMin();
-         if (l > m_spin->GetMax())
-             l = m_spin->GetMax();
-
-         // Update text control
-         wxString str;
-         str.Printf( wxT("%d"), (int)l );
-         if (str != GetValue())
-             SetValue( str );
-
-         if (l != m_spin->m_oldValue)
-         {
-             // set value in spin button
-             // does that trigger an event?
-             m_spin->m_btn->SetValue( l );
-
-             // if not
-             wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId());
-             event.SetEventObject(m_spin);
-             event.SetInt(l);
-             m_spin->HandleWindowEvent(event);
-
-             m_spin->m_oldValue = l;
-         }
-    }
-
-    void OnTextChange(wxCommandEvent& event)
-    {
-        int val;
-        if ( m_spin->GetTextValue(&val) )
-        {
-            m_spin->GetSpinButton()->SetValue(val);
-
-            // If we're already processing a text update from m_spin,
-            // don't send it again, since we could end up recursing
-            // infinitely.
-            if (event.GetId() == m_spin->GetId())
-            {
-                event.Skip();
-                return;
-            }
-
-            // Send event that the text was manually changed
-            wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_spin->GetId());
-            event.SetEventObject(m_spin);
-            event.SetString(m_spin->GetText()->GetValue());
-            event.SetInt(val);
-
-            m_spin->HandleWindowEvent(event);
-        }
-
-        event.Skip();
-    }
-
-private:
-    wxSpinCtrl *m_spin;
-
-    DECLARE_EVENT_TABLE()
-};
-
-BEGIN_EVENT_TABLE(wxSpinCtrlText, wxTextCtrl)
-    EVT_TEXT(wxID_ANY, wxSpinCtrlText::OnTextChange)
-    EVT_KILL_FOCUS( wxSpinCtrlText::OnKillFocus)
-END_EVENT_TABLE()
-
-// ----------------------------------------------------------------------------
-// wxSpinCtrlButton: spin button used by spin control
-// ----------------------------------------------------------------------------
-
-class wxSpinCtrlButton : public wxSpinButton
-{
-public:
-    wxSpinCtrlButton(wxSpinCtrl *spin, int style)
-        : wxSpinButton(spin )
-    {
-        m_spin = spin;
-        SetWindowStyle(style | wxSP_VERTICAL);
-
-        // TODO: The spin button gets truncated a little bit due to size
-        // differences so change it's default size a bit.  SMALL still gets a
-        // bit truncated, but MINI seems to be too small...  Readdress this
-        // when the textctrl issues are all sorted out.
-        //SetWindowVariant(wxWINDOW_VARIANT_SMALL);
-
-        // remove the default minsize, the spinctrl will have one instead
-        SetMinSize(wxDefaultSize);
-    }
-
-protected:
-    void OnSpinButton(wxSpinEvent& eventSpin)
-    {
-        int pos = eventSpin.GetPosition();
-        m_spin->SetTextValue(pos);
-
-        wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId());
-        event.SetEventObject(m_spin);
-        event.SetInt(pos);
-
-        m_spin->HandleWindowEvent(event);
-
-        m_spin->m_oldValue = pos;
-    }
-
-private:
-    wxSpinCtrl *m_spin;
-
-    DECLARE_EVENT_TABLE()
-};
-
-BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton)
-    EVT_SPIN(wxID_ANY, wxSpinCtrlButton::OnSpinButton)
-END_EVENT_TABLE()
-
-IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
-
-BEGIN_EVENT_TABLE(wxSpinCtrl, wxControl)
-    WX_EVENT_TABLE_CONTROL_CONTAINER(wxSpinCtrl)
-END_EVENT_TABLE()
-
-WX_DELEGATE_TO_CONTROL_CONTAINER(wxSpinCtrl, wxControl)
-
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// wxSpinCtrl creation
-// ----------------------------------------------------------------------------
-
-void wxSpinCtrl::Init()
-{
-    m_text = NULL;
-    m_btn = NULL;
-    WX_INIT_CONTROL_CONTAINER();
-}
-
-bool wxSpinCtrl::Create(wxWindow *parent,
-                        wxWindowID id,
-                        const wxString& value,
-                        const wxPoint& pos,
-                        const wxSize& size,
-                        long style,
-                        int min,
-                        int max,
-                        int initial,
-                        const wxString& name)
-{
-    m_macIsUserPane = true;
-    if ( !wxControl::Create(parent, id, pos, size, style,
-                            wxDefaultValidator, name) )
-    {
-        return false;
-    }
-
-    // the string value overrides the numeric one (for backwards compatibility
-    // reasons and also because it is simpler to satisfy the string value which
-    // comes much sooner in the list of arguments and leave the initial
-    // parameter unspecified)
-    if ( !value.empty() )
-    {
-        long l;
-        if ( value.ToLong(&l) )
-            initial = l;
-    }
-
-    wxSize csize = size ;
-    m_text = new wxSpinCtrlText(this, value);
-    m_btn = new wxSpinCtrlButton(this, style);
-
-    m_btn->SetRange(min, max);
-    m_btn->SetValue(initial);
-    // make it different
-    m_oldValue = GetMin()-1;
-
-    if ( size.x == wxDefaultCoord ){
-        csize.x = m_text->GetSize().x + MARGIN + m_btn->GetSize().x ;
-    }
-
-    if ( size.y == wxDefaultCoord ) {
-        csize.y = m_text->GetSize().y + 2 * TEXTBORDER ; //allow for text border highlights
-        if ( m_btn->GetSize().y > csize.y )
-            csize.y = m_btn->GetSize().y ;
-    }
-
-    //SetSize(csize);
-
-    //MacPostControlCreate(pos, csize);
-    SetInitialSize(csize);
-
-    return true;
-}
-
-wxSpinCtrl::~wxSpinCtrl()
-{
-    // delete the controls now, don't leave them alive even though they would
-    // still be eventually deleted by our parent - but it will be too late, the
-    // user code expects them to be gone now
-    delete m_text;
-    m_text = NULL ;
-    delete m_btn;
-    m_btn = NULL ;
-}
-
-// ----------------------------------------------------------------------------
-// geometry
-// ----------------------------------------------------------------------------
-
-wxSize wxSpinCtrl::DoGetBestSize() const
-{
-    if (!m_btn || !m_text)
-        return GetSize();
-
-    wxSize sizeBtn = m_btn->GetBestSize(),
-           sizeText = m_text->GetBestSize();
-
-    sizeText.y += 2 * TEXTBORDER ;
-    sizeText.x += 2 * TEXTBORDER ;
-
-    int height;
-    if (sizeText.y > sizeBtn.y)
-        height = sizeText.y;
-    else
-        height = sizeBtn.y;
-
-    return wxSize(sizeBtn.x + sizeText.x + MARGIN, height );
-}
-
-void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height)
-{
-    // position the subcontrols inside the client area
-    wxSize sizeBtn = m_btn->GetSize();
-    wxSize sizeText = m_text->GetSize();
-
-    wxControl::DoMoveWindow(x, y, width, height);
-
-    wxCoord wText = width - sizeBtn.x - MARGIN - 2 * TEXTBORDER;
-
-    m_text->SetSize(TEXTBORDER, (height - sizeText.y) / 2, wText, -1);
-    m_btn->SetSize(0 + wText + MARGIN + TEXTBORDER , (height - sizeBtn.y) / 2 , -1, -1 );
-}
-
-// ----------------------------------------------------------------------------
-// operations forwarded to the subcontrols
-// ----------------------------------------------------------------------------
-
-bool wxSpinCtrl::Enable(bool enable)
-{
-    if ( !wxControl::Enable(enable) )
-        return false;
-    return true;
-}
-
-bool wxSpinCtrl::Show(bool show)
-{
-    if ( !wxControl::Show(show) )
-        return false;
-    return true;
-}
-
-// ----------------------------------------------------------------------------
-// value and range access
-// ----------------------------------------------------------------------------
-
-bool wxSpinCtrl::GetTextValue(int *val) const
-{
-    long l;
-    if ( !m_text->GetValue().ToLong(&l) )
-    {
-        // not a number at all
-        return false;
-    }
-
-    if ( l < GetMin() || l > GetMax() )
-    {
-        // out of range
-        return false;
-    }
-
-    *val = l;
-
-    return true;
-}
-
-int wxSpinCtrl::GetValue() const
-{
-    return m_btn ? m_btn->GetValue() : 0;
-}
-
-int wxSpinCtrl::GetMin() const
-{
-    return m_btn ? m_btn->GetMin() : 0;
-}
-
-int wxSpinCtrl::GetMax() const
-{
-    return m_btn ? m_btn->GetMax() : 0;
-}
-
-// ----------------------------------------------------------------------------
-// changing value and range
-// ----------------------------------------------------------------------------
-
-void wxSpinCtrl::SetTextValue(int val)
-{
-    wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetTextValue") );
-
-    m_text->SetValue(wxString::Format(_T("%d"), val));
-
-    // select all text
-    m_text->SetSelection(0, -1);
-
-    // and give focus to the control!
-    // m_text->SetFocus();    Why???? TODO.
-}
-
-void wxSpinCtrl::SetValue(int val)
-{
-    wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetValue") );
-
-    SetTextValue(val);
-
-    m_btn->SetValue(val);
-    m_oldValue = val;
-}
-
-void wxSpinCtrl::SetValue(const wxString& text)
-{
-    wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetValue") );
-
-    long val;
-    if ( text.ToLong(&val) && ((val > INT_MIN) && (val < INT_MAX)) )
-    {
-        SetValue((int)val);
-    }
-    else // not a number at all or out of range
-    {
-        m_text->SetValue(text);
-        m_text->SetSelection(0, -1);
-    }
-}
-
-void wxSpinCtrl::SetRange(int min, int max)
-{
-    wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetRange") );
-
-    m_btn->SetRange(min, max);
-}
-
-void wxSpinCtrl::SetSelection(long from, long to)
-{
-    // if from and to are both -1, it means (in wxWidgets) that all text should
-    // be selected
-    if ( (from == -1) && (to == -1) )
-    {
-        from = 0;
-    }
-    m_text->SetSelection(from, to);
-}
-
-#endif // wxUSE_SPINCTRL
diff --git a/src/osx/spinctrl_osx.cpp b/src/osx/spinctrl_osx.cpp
new file mode 100644 (file)
index 0000000..3d2ed85
--- /dev/null
@@ -0,0 +1,434 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/carbon/spinbutt.cpp
+// Purpose:     wxSpinCtrl
+// Author:      Robert
+// Modified by: Mark Newsam (Based on GTK file)
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#if wxUSE_SPINCTRL
+
+#include "wx/spinctrl.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/textctrl.h"
+    #include "wx/containr.h"
+#endif
+
+#include "wx/spinbutt.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// the focus rect around a text may have 4 pixels in each direction
+// we handle these problems right now in an extended vis region of a window
+static const wxCoord TEXTBORDER = 4 ;
+// the margin between the text control and the spin
+// HIG says 2px between text and stepper control,
+// but a value of 3 leads to the same look as the
+// spin controls in Apple's apps
+static const wxCoord MARGIN = 3;
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrlText: text control used by spin control
+// ----------------------------------------------------------------------------
+
+class wxSpinCtrlText : public wxTextCtrl
+{
+public:
+    wxSpinCtrlText(wxSpinCtrl *spin, const wxString& value)
+        : wxTextCtrl(spin , wxID_ANY, value, wxDefaultPosition, wxSize(40, wxDefaultCoord))
+    {
+        m_spin = spin;
+
+        // remove the default minsize, the spinctrl will have one instead
+        SetMinSize(wxDefaultSize);
+    }
+
+    bool ProcessEvent(wxEvent &event)
+    {
+        // Hand button down events to wxSpinCtrl. Doesn't work.
+        if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event ))
+            return true;
+
+        return wxTextCtrl::ProcessEvent( event );
+    }
+
+protected:
+     void OnKillFocus(wxFocusEvent& WXUNUSED(event))
+     {
+         long l;
+         if ( !GetValue().ToLong(&l) )
+         {
+             // not a number at all
+             return;
+         }
+
+         // is within range
+         if (l < m_spin->GetMin())
+             l = m_spin->GetMin();
+         if (l > m_spin->GetMax())
+             l = m_spin->GetMax();
+
+         // Update text control
+         wxString str;
+         str.Printf( wxT("%d"), (int)l );
+         if (str != GetValue())
+             SetValue( str );
+
+         if (l != m_spin->m_oldValue)
+         {
+             // set value in spin button
+             // does that trigger an event?
+             m_spin->m_btn->SetValue( l );
+
+             // if not
+             wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId());
+             event.SetEventObject(m_spin);
+             event.SetInt(l);
+             m_spin->HandleWindowEvent(event);
+
+             m_spin->m_oldValue = l;
+         }
+    }
+
+    void OnTextChange(wxCommandEvent& event)
+    {
+        int val;
+        if ( m_spin->GetTextValue(&val) )
+        {
+            m_spin->GetSpinButton()->SetValue(val);
+
+            // If we're already processing a text update from m_spin,
+            // don't send it again, since we could end up recursing
+            // infinitely.
+            if (event.GetId() == m_spin->GetId())
+            {
+                event.Skip();
+                return;
+            }
+
+            // Send event that the text was manually changed
+            wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_spin->GetId());
+            event.SetEventObject(m_spin);
+            event.SetString(m_spin->GetText()->GetValue());
+            event.SetInt(val);
+
+            m_spin->HandleWindowEvent(event);
+        }
+
+        event.Skip();
+    }
+
+private:
+    wxSpinCtrl *m_spin;
+
+    DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(wxSpinCtrlText, wxTextCtrl)
+    EVT_TEXT(wxID_ANY, wxSpinCtrlText::OnTextChange)
+    EVT_KILL_FOCUS( wxSpinCtrlText::OnKillFocus)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrlButton: spin button used by spin control
+// ----------------------------------------------------------------------------
+
+class wxSpinCtrlButton : public wxSpinButton
+{
+public:
+    wxSpinCtrlButton(wxSpinCtrl *spin, int style)
+        : wxSpinButton(spin )
+    {
+        m_spin = spin;
+        SetWindowStyle(style | wxSP_VERTICAL);
+
+        // TODO: The spin button gets truncated a little bit due to size
+        // differences so change it's default size a bit.  SMALL still gets a
+        // bit truncated, but MINI seems to be too small...  Readdress this
+        // when the textctrl issues are all sorted out.
+        //SetWindowVariant(wxWINDOW_VARIANT_SMALL);
+
+        // remove the default minsize, the spinctrl will have one instead
+        SetMinSize(wxDefaultSize);
+    }
+
+protected:
+    void OnSpinButton(wxSpinEvent& eventSpin)
+    {
+        int pos = eventSpin.GetPosition();
+        m_spin->SetTextValue(pos);
+
+        wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId());
+        event.SetEventObject(m_spin);
+        event.SetInt(pos);
+
+        m_spin->HandleWindowEvent(event);
+
+        m_spin->m_oldValue = pos;
+    }
+
+private:
+    wxSpinCtrl *m_spin;
+
+    DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton)
+    EVT_SPIN(wxID_ANY, wxSpinCtrlButton::OnSpinButton)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
+
+BEGIN_EVENT_TABLE(wxSpinCtrl, wxControl)
+    WX_EVENT_TABLE_CONTROL_CONTAINER(wxSpinCtrl)
+END_EVENT_TABLE()
+
+WX_DELEGATE_TO_CONTROL_CONTAINER(wxSpinCtrl, wxControl)
+
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxSpinCtrl creation
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::Init()
+{
+    m_text = NULL;
+    m_btn = NULL;
+    WX_INIT_CONTROL_CONTAINER();
+}
+
+bool wxSpinCtrl::Create(wxWindow *parent,
+                        wxWindowID id,
+                        const wxString& value,
+                        const wxPoint& pos,
+                        const wxSize& size,
+                        long style,
+                        int min,
+                        int max,
+                        int initial,
+                        const wxString& name)
+{
+    m_macIsUserPane = true;
+    if ( !wxControl::Create(parent, id, pos, size, style,
+                            wxDefaultValidator, name) )
+    {
+        return false;
+    }
+
+    // the string value overrides the numeric one (for backwards compatibility
+    // reasons and also because it is simpler to satisfy the string value which
+    // comes much sooner in the list of arguments and leave the initial
+    // parameter unspecified)
+    if ( !value.empty() )
+    {
+        long l;
+        if ( value.ToLong(&l) )
+            initial = l;
+    }
+
+    wxSize csize = size ;
+    m_text = new wxSpinCtrlText(this, value);
+    m_btn = new wxSpinCtrlButton(this, style);
+
+    m_btn->SetRange(min, max);
+    m_btn->SetValue(initial);
+    // make it different
+    m_oldValue = GetMin()-1;
+
+    if ( size.x == wxDefaultCoord ){
+        csize.x = m_text->GetSize().x + MARGIN + m_btn->GetSize().x ;
+    }
+
+    if ( size.y == wxDefaultCoord ) {
+        csize.y = m_text->GetSize().y + 2 * TEXTBORDER ; //allow for text border highlights
+        if ( m_btn->GetSize().y > csize.y )
+            csize.y = m_btn->GetSize().y ;
+    }
+
+    //SetSize(csize);
+
+    //MacPostControlCreate(pos, csize);
+    SetInitialSize(csize);
+
+    return true;
+}
+
+wxSpinCtrl::~wxSpinCtrl()
+{
+    // delete the controls now, don't leave them alive even though they would
+    // still be eventually deleted by our parent - but it will be too late, the
+    // user code expects them to be gone now
+    delete m_text;
+    m_text = NULL ;
+    delete m_btn;
+    m_btn = NULL ;
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxSpinCtrl::DoGetBestSize() const
+{
+    if (!m_btn || !m_text)
+        return GetSize();
+
+    wxSize sizeBtn = m_btn->GetBestSize(),
+           sizeText = m_text->GetBestSize();
+
+    sizeText.y += 2 * TEXTBORDER ;
+    sizeText.x += 2 * TEXTBORDER ;
+
+    int height;
+    if (sizeText.y > sizeBtn.y)
+        height = sizeText.y;
+    else
+        height = sizeBtn.y;
+
+    return wxSize(sizeBtn.x + sizeText.x + MARGIN, height );
+}
+
+void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height)
+{
+    // position the subcontrols inside the client area
+    wxSize sizeBtn = m_btn->GetSize();
+    wxSize sizeText = m_text->GetSize();
+
+    wxControl::DoMoveWindow(x, y, width, height);
+
+    wxCoord wText = width - sizeBtn.x - MARGIN - 2 * TEXTBORDER;
+
+    m_text->SetSize(TEXTBORDER, (height - sizeText.y) / 2, wText, -1);
+    m_btn->SetSize(0 + wText + MARGIN + TEXTBORDER , (height - sizeBtn.y) / 2 , -1, -1 );
+}
+
+// ----------------------------------------------------------------------------
+// operations forwarded to the subcontrols
+// ----------------------------------------------------------------------------
+
+bool wxSpinCtrl::Enable(bool enable)
+{
+    if ( !wxControl::Enable(enable) )
+        return false;
+    return true;
+}
+
+bool wxSpinCtrl::Show(bool show)
+{
+    if ( !wxControl::Show(show) )
+        return false;
+    return true;
+}
+
+// ----------------------------------------------------------------------------
+// value and range access
+// ----------------------------------------------------------------------------
+
+bool wxSpinCtrl::GetTextValue(int *val) const
+{
+    long l;
+    if ( !m_text->GetValue().ToLong(&l) )
+    {
+        // not a number at all
+        return false;
+    }
+
+    if ( l < GetMin() || l > GetMax() )
+    {
+        // out of range
+        return false;
+    }
+
+    *val = l;
+
+    return true;
+}
+
+int wxSpinCtrl::GetValue() const
+{
+    return m_btn ? m_btn->GetValue() : 0;
+}
+
+int wxSpinCtrl::GetMin() const
+{
+    return m_btn ? m_btn->GetMin() : 0;
+}
+
+int wxSpinCtrl::GetMax() const
+{
+    return m_btn ? m_btn->GetMax() : 0;
+}
+
+// ----------------------------------------------------------------------------
+// changing value and range
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::SetTextValue(int val)
+{
+    wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetTextValue") );
+
+    m_text->SetValue(wxString::Format(_T("%d"), val));
+
+    // select all text
+    m_text->SetSelection(0, -1);
+
+    // and give focus to the control!
+    // m_text->SetFocus();    Why???? TODO.
+}
+
+void wxSpinCtrl::SetValue(int val)
+{
+    wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetValue") );
+
+    SetTextValue(val);
+
+    m_btn->SetValue(val);
+    m_oldValue = val;
+}
+
+void wxSpinCtrl::SetValue(const wxString& text)
+{
+    wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetValue") );
+
+    long val;
+    if ( text.ToLong(&val) && ((val > INT_MIN) && (val < INT_MAX)) )
+    {
+        SetValue((int)val);
+    }
+    else // not a number at all or out of range
+    {
+        m_text->SetValue(text);
+        m_text->SetSelection(0, -1);
+    }
+}
+
+void wxSpinCtrl::SetRange(int min, int max)
+{
+    wxCHECK_RET( m_btn, _T("invalid call to wxSpinCtrl::SetRange") );
+
+    m_btn->SetRange(min, max);
+}
+
+void wxSpinCtrl::SetSelection(long from, long to)
+{
+    // if from and to are both -1, it means (in wxWidgets) that all text should
+    // be selected
+    if ( (from == -1) && (to == -1) )
+    {
+        from = 0;
+    }
+    m_text->SetSelection(from, to);
+}
+
+#endif // wxUSE_SPINCTRL
diff --git a/src/osx/toplevel.cpp b/src/osx/toplevel.cpp
deleted file mode 100644 (file)
index 1886e98..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Name:        src/osx/toplevel.cpp
-// Purpose:     implements wxTopLevelWindow for Mac
-// Author:      Stefan Csomor
-// Modified by:
-// Created:     24.09.01
-// RCS-ID:      $Id$
-// Copyright:   (c) 2001-2004 Stefan Csomor
-// License:     wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-    #pragma hdrstop
-#endif
-
-#include "wx/toplevel.h"
-
-#ifndef WX_PRECOMP
-    #include "wx/app.h"
-    #include "wx/frame.h"
-    #include "wx/string.h"
-    #include "wx/log.h"
-    #include "wx/intl.h"
-    #include "wx/settings.h"
-    #include "wx/strconv.h"
-    #include "wx/control.h"
-#endif //WX_PRECOMP
-
-#include "wx/tooltip.h"
-#include "wx/dnd.h"
-
-#if wxUSE_SYSTEM_OPTIONS
-    #include "wx/sysopt.h"
-#endif
-
-// for targeting OSX
-#include "wx/osx/private.h"
-
-// ============================================================================
-// wxTopLevelWindowMac implementation
-// ============================================================================
-
-BEGIN_EVENT_TABLE(wxTopLevelWindowMac, wxTopLevelWindowBase)
-END_EVENT_TABLE()
-
-// ----------------------------------------------------------------------------
-// wxTopLevelWindowMac creation
-// ----------------------------------------------------------------------------
-
-
-void wxTopLevelWindowMac::Init()
-{
-    m_iconized =
-    m_maximizeOnShow = false;
-}
-
-bool wxTopLevelWindowMac::Create(wxWindow *parent,
-                                 wxWindowID id,
-                                 const wxString& title,
-                                 const wxPoint& pos,
-                                 const wxSize& size,
-                                 long style,
-                                 const wxString& name)
-{
-    if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) )
-        return false;
-
-    wxWindow::SetLabel( title ) ;
-    m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
-    wxTopLevelWindows.Append(this);
-
-    return true;
-}
-
-wxTopLevelWindowMac::~wxTopLevelWindowMac()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-// wxTopLevelWindowMac maximize/minimize
-// ----------------------------------------------------------------------------
-
-void wxTopLevelWindowMac::Maximize(bool maximize)
-{
-    if ( IsMaximized() != maximize )
-        m_nowpeer->Maximize(maximize);
-}
-
-bool wxTopLevelWindowMac::IsMaximized() const
-{
-    return m_nowpeer->IsMaximized();
-}
-
-void wxTopLevelWindowMac::Iconize(bool iconize)
-{
-    if ( IsIconized() != iconize )
-        m_nowpeer->Iconize(iconize);
-}
-
-bool wxTopLevelWindowMac::IsIconized() const
-{
-    return m_nowpeer->IsIconized();
-}
-
-void wxTopLevelWindowMac::Restore()
-{
-    if ( IsMaximized() )
-        Maximize(false);
-    else if ( IsIconized() )
-        Iconize(false);
-}
-
-// ----------------------------------------------------------------------------
-// wxTopLevelWindowMac misc
-// ----------------------------------------------------------------------------
-
-wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
-{
-    return wxPoint(0, 0) ;
-}
-
-void wxTopLevelWindowMac::SetTitle(const wxString& title)
-{
-    wxWindow::SetLabel( title ) ;
-    m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
-}
-
-wxString wxTopLevelWindowMac::GetTitle() const
-{
-    return wxWindow::GetLabel();
-}
-
-bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
-{
-    return m_nowpeer->ShowFullScreen(show, style);
-}
-
-bool wxTopLevelWindowMac::IsFullScreen() const
-{
-    return m_nowpeer->IsFullScreen();
-}
-
-void wxTopLevelWindowMac::RequestUserAttention(int flags)
-{
-    return m_nowpeer->RequestUserAttention(flags);
-}
diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp
new file mode 100644 (file)
index 0000000..1886e98
--- /dev/null
@@ -0,0 +1,158 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/toplevel.cpp
+// Purpose:     implements wxTopLevelWindow for Mac
+// Author:      Stefan Csomor
+// Modified by:
+// Created:     24.09.01
+// RCS-ID:      $Id$
+// Copyright:   (c) 2001-2004 Stefan Csomor
+// License:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#include "wx/toplevel.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/frame.h"
+    #include "wx/string.h"
+    #include "wx/log.h"
+    #include "wx/intl.h"
+    #include "wx/settings.h"
+    #include "wx/strconv.h"
+    #include "wx/control.h"
+#endif //WX_PRECOMP
+
+#include "wx/tooltip.h"
+#include "wx/dnd.h"
+
+#if wxUSE_SYSTEM_OPTIONS
+    #include "wx/sysopt.h"
+#endif
+
+// for targeting OSX
+#include "wx/osx/private.h"
+
+// ============================================================================
+// wxTopLevelWindowMac implementation
+// ============================================================================
+
+BEGIN_EVENT_TABLE(wxTopLevelWindowMac, wxTopLevelWindowBase)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMac creation
+// ----------------------------------------------------------------------------
+
+
+void wxTopLevelWindowMac::Init()
+{
+    m_iconized =
+    m_maximizeOnShow = false;
+}
+
+bool wxTopLevelWindowMac::Create(wxWindow *parent,
+                                 wxWindowID id,
+                                 const wxString& title,
+                                 const wxPoint& pos,
+                                 const wxSize& size,
+                                 long style,
+                                 const wxString& name)
+{
+    if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) )
+        return false;
+
+    wxWindow::SetLabel( title ) ;
+    m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
+    wxTopLevelWindows.Append(this);
+
+    return true;
+}
+
+wxTopLevelWindowMac::~wxTopLevelWindowMac()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMac maximize/minimize
+// ----------------------------------------------------------------------------
+
+void wxTopLevelWindowMac::Maximize(bool maximize)
+{
+    if ( IsMaximized() != maximize )
+        m_nowpeer->Maximize(maximize);
+}
+
+bool wxTopLevelWindowMac::IsMaximized() const
+{
+    return m_nowpeer->IsMaximized();
+}
+
+void wxTopLevelWindowMac::Iconize(bool iconize)
+{
+    if ( IsIconized() != iconize )
+        m_nowpeer->Iconize(iconize);
+}
+
+bool wxTopLevelWindowMac::IsIconized() const
+{
+    return m_nowpeer->IsIconized();
+}
+
+void wxTopLevelWindowMac::Restore()
+{
+    if ( IsMaximized() )
+        Maximize(false);
+    else if ( IsIconized() )
+        Iconize(false);
+}
+
+// ----------------------------------------------------------------------------
+// wxTopLevelWindowMac misc
+// ----------------------------------------------------------------------------
+
+wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
+{
+    return wxPoint(0, 0) ;
+}
+
+void wxTopLevelWindowMac::SetTitle(const wxString& title)
+{
+    wxWindow::SetLabel( title ) ;
+    m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
+}
+
+wxString wxTopLevelWindowMac::GetTitle() const
+{
+    return wxWindow::GetLabel();
+}
+
+bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
+{
+    return m_nowpeer->ShowFullScreen(show, style);
+}
+
+bool wxTopLevelWindowMac::IsFullScreen() const
+{
+    return m_nowpeer->IsFullScreen();
+}
+
+void wxTopLevelWindowMac::RequestUserAttention(int flags)
+{
+    return m_nowpeer->RequestUserAttention(flags);
+}