wxMac should use /src/mac/carbon/spinctrl.cpp, applied some sizing
layout fixes to that file, removed wxMac specific parts from the generic wxSpinCtrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
16
Makefile.in
16
Makefile.in
@@ -2738,6 +2738,7 @@ COND_TOOLKIT_MAC___GUI_SRC_OBJECTS = \
|
|||||||
monodll_settings.o \
|
monodll_settings.o \
|
||||||
monodll_slider.o \
|
monodll_slider.o \
|
||||||
monodll_spinbutt.o \
|
monodll_spinbutt.o \
|
||||||
|
monodll_spinctrl.o \
|
||||||
monodll_statbmp.o \
|
monodll_statbmp.o \
|
||||||
monodll_statbox.o \
|
monodll_statbox.o \
|
||||||
monodll_statbrma.o \
|
monodll_statbrma.o \
|
||||||
@@ -3593,6 +3594,7 @@ COND_TOOLKIT_MAC___GUI_SRC_OBJECTS_1 = \
|
|||||||
monolib_settings.o \
|
monolib_settings.o \
|
||||||
monolib_slider.o \
|
monolib_slider.o \
|
||||||
monolib_spinbutt.o \
|
monolib_spinbutt.o \
|
||||||
|
monolib_spinctrl.o \
|
||||||
monolib_statbmp.o \
|
monolib_statbmp.o \
|
||||||
monolib_statbox.o \
|
monolib_statbox.o \
|
||||||
monolib_statbrma.o \
|
monolib_statbrma.o \
|
||||||
@@ -4620,6 +4622,7 @@ COND_TOOLKIT_MAC___GUI_SRC_OBJECTS_2 = \
|
|||||||
coredll_settings.o \
|
coredll_settings.o \
|
||||||
coredll_slider.o \
|
coredll_slider.o \
|
||||||
coredll_spinbutt.o \
|
coredll_spinbutt.o \
|
||||||
|
coredll_spinctrl.o \
|
||||||
coredll_statbmp.o \
|
coredll_statbmp.o \
|
||||||
coredll_statbox.o \
|
coredll_statbox.o \
|
||||||
coredll_statbrma.o \
|
coredll_statbrma.o \
|
||||||
@@ -5344,6 +5347,7 @@ COND_TOOLKIT_MAC___GUI_SRC_OBJECTS_3 = \
|
|||||||
corelib_settings.o \
|
corelib_settings.o \
|
||||||
corelib_slider.o \
|
corelib_slider.o \
|
||||||
corelib_spinbutt.o \
|
corelib_spinbutt.o \
|
||||||
|
corelib_spinctrl.o \
|
||||||
corelib_statbmp.o \
|
corelib_statbmp.o \
|
||||||
corelib_statbox.o \
|
corelib_statbox.o \
|
||||||
corelib_statbrma.o \
|
corelib_statbrma.o \
|
||||||
@@ -10058,6 +10062,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
|||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(MONODLL_ODEP)
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(MONODLL_ODEP)
|
||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monodll_spinctrl.o: $(srcdir)/src/mac/carbon/spinctrl.cpp $(MONODLL_ODEP)
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||||
|
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(MONODLL_ODEP)
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(MONODLL_ODEP)
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
|
||||||
|
|
||||||
@@ -12983,6 +12990,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
|||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(MONOLIB_ODEP)
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(MONOLIB_ODEP)
|
||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monolib_spinctrl.o: $(srcdir)/src/mac/carbon/spinctrl.cpp $(MONOLIB_ODEP)
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||||
|
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(MONOLIB_ODEP)
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(MONOLIB_ODEP)
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
|
||||||
|
|
||||||
@@ -16178,6 +16188,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
|
|||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@coredll_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(COREDLL_ODEP)
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@coredll_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(COREDLL_ODEP)
|
||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@coredll_spinctrl.o: $(srcdir)/src/mac/carbon/spinctrl.cpp $(COREDLL_ODEP)
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
||||||
|
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(COREDLL_ODEP)
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(COREDLL_ODEP)
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $<
|
||||||
|
|
||||||
@@ -18596,6 +18609,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
|
|||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@corelib_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(CORELIB_ODEP)
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@corelib_spinctrl.o: $(srcdir)/src/msw/spinctrl.cpp $(CORELIB_ODEP)
|
||||||
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@corelib_spinctrl.o: $(srcdir)/src/mac/carbon/spinctrl.cpp $(CORELIB_ODEP)
|
||||||
|
@COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
||||||
|
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(CORELIB_ODEP)
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_spinctrl.o: $(srcdir)/src/os2/spinctrl.cpp $(CORELIB_ODEP)
|
||||||
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
@COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $<
|
||||||
|
|
||||||
|
@@ -1624,6 +1624,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
src/mac/carbon/settings.cpp
|
src/mac/carbon/settings.cpp
|
||||||
src/mac/carbon/slider.cpp
|
src/mac/carbon/slider.cpp
|
||||||
src/mac/carbon/spinbutt.cpp
|
src/mac/carbon/spinbutt.cpp
|
||||||
|
src/mac/carbon/spinctrl.cpp
|
||||||
src/mac/carbon/statbmp.cpp
|
src/mac/carbon/statbmp.cpp
|
||||||
src/mac/carbon/statbox.cpp
|
src/mac/carbon/statbox.cpp
|
||||||
src/mac/carbon/statbrma.cpp
|
src/mac/carbon/statbrma.cpp
|
||||||
|
@@ -64,7 +64,7 @@ protected:
|
|||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/generic/spinctlg.h"
|
#include "wx/generic/spinctlg.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/generic/spinctlg.h"
|
#include "wx/mac/spinctrl.h"
|
||||||
#elif defined(__WXCOCOA__)
|
#elif defined(__WXCOCOA__)
|
||||||
#include "wx/generic/spinctlg.h"
|
#include "wx/generic/spinctlg.h"
|
||||||
#endif // platform
|
#endif // platform
|
||||||
|
@@ -28,8 +28,10 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__)) || \
|
// There are port-specific versions for MSW, GTK, OS/2 and Mac, so exclude the
|
||||||
defined(__WXMAC__) || defined(__WXUNIVERSAL__)
|
// contents of this file in those cases
|
||||||
|
#if !(defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || \
|
||||||
|
defined(__WXMAC__)) || defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
@@ -45,11 +47,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// the margin between the text control and the spin
|
// the margin between the text control and the spin
|
||||||
#ifdef __WXMAC__
|
|
||||||
static const wxCoord MARGIN = 4;
|
|
||||||
#else
|
|
||||||
static const wxCoord MARGIN = 2;
|
static const wxCoord MARGIN = 2;
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxSpinCtrlText: text control used by spin control
|
// wxSpinCtrlText: text control used by spin control
|
||||||
@@ -189,15 +187,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_btn->SetRange(min, max);
|
m_btn->SetRange(min, max);
|
||||||
m_btn->SetValue(initial);
|
m_btn->SetValue(initial);
|
||||||
#ifdef __WXMAC__
|
|
||||||
wxSize csize = size ;
|
|
||||||
if ( size.y == -1 ) {
|
|
||||||
csize.y = m_text->GetSize().y;
|
|
||||||
}
|
|
||||||
SetBestSize(csize);
|
|
||||||
#else
|
|
||||||
SetBestSize(size);
|
SetBestSize(size);
|
||||||
#endif
|
|
||||||
|
|
||||||
// have to disable this window to avoid interfering it with message
|
// have to disable this window to avoid interfering it with message
|
||||||
// processing to the text and the button... but pretend it is enabled to
|
// processing to the text and the button... but pretend it is enabled to
|
||||||
@@ -208,9 +198,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
// we don't even need to show this window itself - and not doing it avoids
|
// we don't even need to show this window itself - and not doing it avoids
|
||||||
// that it overwrites the text control
|
// that it overwrites the text control
|
||||||
wxControl::Show(FALSE);
|
wxControl::Show(FALSE);
|
||||||
#ifndef __WXMAC__
|
|
||||||
m_isShown = TRUE;
|
m_isShown = TRUE;
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,24 +8,19 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||||
#pragma implementation "spinctlg.h"
|
#pragma implementation "spinctrl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/textctrl.h"
|
|
||||||
#endif //WX_PRECOMP
|
|
||||||
|
|
||||||
#if wxUSE_SPINCTRL
|
#if wxUSE_SPINCTRL
|
||||||
|
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
#include "wx/spinctrl.h"
|
#include "wx/spinctrl.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
|
|
||||||
|
|
||||||
#include "wx/spinctrl.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -44,6 +39,9 @@ public:
|
|||||||
: wxTextCtrl(spin , -1, value)
|
: wxTextCtrl(spin , -1, value)
|
||||||
{
|
{
|
||||||
m_spin = spin;
|
m_spin = spin;
|
||||||
|
|
||||||
|
// remove the default minsize, the spinctrl will have one instead
|
||||||
|
SetSizeHints(-1,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -88,14 +86,21 @@ public:
|
|||||||
: wxSpinButton(spin )
|
: wxSpinButton(spin )
|
||||||
{
|
{
|
||||||
m_spin = spin;
|
m_spin = spin;
|
||||||
|
|
||||||
SetWindowStyle(style | wxSP_VERTICAL);
|
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
|
||||||
|
SetSizeHints(-1,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnSpinButton(wxSpinEvent& eventSpin)
|
void OnSpinButton(wxSpinEvent& eventSpin)
|
||||||
{
|
{
|
||||||
#if defined(__WXMAC__) || defined(__WXMOTIF__)
|
|
||||||
m_spin->SetTextValue(eventSpin.GetPosition());
|
m_spin->SetTextValue(eventSpin.GetPosition());
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId());
|
wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId());
|
||||||
@@ -103,10 +108,6 @@ protected:
|
|||||||
event.SetInt(eventSpin.GetPosition());
|
event.SetInt(eventSpin.GetPosition());
|
||||||
|
|
||||||
m_spin->GetEventHandler()->ProcessEvent(event);
|
m_spin->GetEventHandler()->ProcessEvent(event);
|
||||||
#else
|
|
||||||
m_spin->SetTextValue(eventSpin.GetPosition());
|
|
||||||
eventSpin.Skip();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -173,7 +174,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
if ( size.y == -1 ) {
|
if ( size.y == -1 ) {
|
||||||
csize.y = m_text->GetSize().y ;
|
csize.y = m_text->GetSize().y ;
|
||||||
}
|
}
|
||||||
DoSetSize(pos.x , pos.y , csize.x, csize.y);
|
SetBestSize(csize);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,7 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
|
|
||||||
wxCoord wText = width - sizeBtn.x;
|
wxCoord wText = width - sizeBtn.x;
|
||||||
m_text->SetSize(0, 0, wText, height);
|
m_text->SetSize(0, 0, wText, height);
|
||||||
m_btn->SetSize(0 + wText + MARGIN, 0, -1, -1);
|
m_btn->SetSize(0 + wText + MARGIN, 0, -1, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user