Remove remaining unused carbon implementation code.

Remove code and files which should have already been removed in 5ba67c67e4.
This commit is contained in:
Tobias Taschner
2016-03-04 14:28:56 +01:00
parent d0d4018748
commit 1125dd8c12
9 changed files with 0 additions and 1756 deletions

View File

@@ -13209,7 +13209,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \
monodll_carbon_gdiobj.o \
monodll_carbon_icon.o \
monodll_carbon_app.o \
monodll_carbon_combobox.o \
monodll_carbon_control.o \
monodll_carbon_dataobj.o \
monodll_carbon_dcclient.o \
@@ -13354,7 +13353,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \
monolib_carbon_gdiobj.o \
monolib_carbon_icon.o \
monolib_carbon_app.o \
monolib_carbon_combobox.o \
monolib_carbon_control.o \
monolib_carbon_dataobj.o \
monolib_carbon_dcclient.o \
@@ -13499,7 +13497,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \
coredll_carbon_gdiobj.o \
coredll_carbon_icon.o \
coredll_carbon_app.o \
coredll_carbon_combobox.o \
coredll_carbon_control.o \
coredll_carbon_dataobj.o \
coredll_carbon_dcclient.o \
@@ -13629,7 +13626,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \
corelib_carbon_gdiobj.o \
corelib_carbon_icon.o \
corelib_carbon_app.o \
corelib_carbon_combobox.o \
corelib_carbon_control.o \
corelib_carbon_dataobj.o \
corelib_carbon_dcclient.o \
@@ -19314,12 +19310,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_carbon_control.o: $(srcdir)/src/osx/carbon/control.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/control.cpp
@@ -24141,12 +24131,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_carbon_control.o: $(srcdir)/src/osx/carbon/control.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/carbon/control.cpp
@@ -29022,12 +29006,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_carbon_control.o: $(srcdir)/src/osx/carbon/control.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/control.cpp
@@ -32415,12 +32393,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_app.o: $(srcdir)/src/osx/carbon/app.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/app.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_combobox.o: $(srcdir)/src/osx/carbon/combobox.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/combobox.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_carbon_control.o: $(srcdir)/src/osx/carbon/control.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/control.cpp

View File

@@ -2275,7 +2275,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/carbon/gdiobj.cpp
src/osx/carbon/icon.cpp
src/osx/carbon/app.cpp
src/osx/carbon/combobox.cpp
src/osx/carbon/control.cpp
src/osx/carbon/dataobj.cpp
src/osx/carbon/dcclient.cpp

View File

@@ -2117,7 +2117,6 @@ OSX_COMMON_SRC =
src/osx/carbon/gdiobj.cpp
src/osx/carbon/icon.cpp
src/osx/carbon/app.cpp
src/osx/carbon/combobox.cpp
src/osx/carbon/control.cpp
src/osx/carbon/dataobj.cpp
src/osx/carbon/dcclient.cpp

View File

@@ -2027,9 +2027,6 @@
BAFF04F1680F32DA988EB03D /* stockitem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B180290089B139F18B0C7BBA /* stockitem.cpp */; };
BAFF04F1680F32DA988EB03E /* stockitem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B180290089B139F18B0C7BBA /* stockitem.cpp */; };
BAFF04F1680F32DA988EB03F /* stockitem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B180290089B139F18B0C7BBA /* stockitem.cpp */; };
BB31D65BA1253A1CB64CE9D2 /* combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A3F26F539473705AA82411D /* combobox.cpp */; };
BB31D65BA1253A1CB64CE9D3 /* combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A3F26F539473705AA82411D /* combobox.cpp */; };
BB31D65BA1253A1CB64CE9D4 /* combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A3F26F539473705AA82411D /* combobox.cpp */; };
BB6FE851028C3DE7A070C213 /* convauto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20B922D61CDB3CCEB59A5194 /* convauto.cpp */; };
BB6FE851028C3DE7A070C214 /* convauto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20B922D61CDB3CCEB59A5194 /* convauto.cpp */; };
BB6FE851028C3DE7A070C215 /* convauto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20B922D61CDB3CCEB59A5194 /* convauto.cpp */; };
@@ -4272,7 +4269,6 @@
7A1CE0B28CB73F90AE92B5AB /* richtooltipcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = richtooltipcmn.cpp; path = ../../src/common/richtooltipcmn.cpp; sourceTree = "<group>"; };
7A24E9101688368296C21EBE /* gzclose.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = gzclose.c; path = ../../src/zlib/gzclose.c; sourceTree = "<group>"; };
7A34C5BBBA543DC0A50DE1B6 /* event.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = event.cpp; path = ../../src/common/event.cpp; sourceTree = "<group>"; };
7A3F26F539473705AA82411D /* combobox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = combobox.cpp; path = ../../src/osx/carbon/combobox.cpp; sourceTree = "<group>"; };
7AF8F8A78A5130DCB4D46729 /* LexCmake.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexCmake.cxx; path = ../../src/stc/scintilla/lexers/LexCmake.cxx; sourceTree = "<group>"; };
7B389A14D6BF3AFD8CCE0807 /* protocol.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = protocol.cpp; path = ../../src/common/protocol.cpp; sourceTree = "<group>"; };
7BA6ADD758693BD180D3275B /* treebase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = treebase.cpp; path = ../../src/common/treebase.cpp; sourceTree = "<group>"; };
@@ -5326,7 +5322,6 @@
377056CEB1FC3EEB8526E7A6 /* gdiobj.cpp */,
F5DAF1F49F0F3F41A427A21D /* icon.cpp */,
757B31FCCA1F381C95B30DF8 /* app.cpp */,
7A3F26F539473705AA82411D /* combobox.cpp */,
12363D1F50FE301DAEE7F04A /* control.cpp */,
271B4B77622B3411A7BF6634 /* dataobj.cpp */,
B17772732159304AA7312D72 /* dcclient.cpp */,
@@ -7527,7 +7522,6 @@
692FCCABFB963696AFC1E124 /* gdiobj.cpp in Sources */,
01D4C5F2147F3942A7CE91AC /* icon.cpp in Sources */,
B0E94A59C83637C09FAAE71E /* app.cpp in Sources */,
BB31D65BA1253A1CB64CE9D4 /* combobox.cpp in Sources */,
EB52C6A91594381393294500 /* control.cpp in Sources */,
45AB45C6B24A3983B22E56A7 /* dataobj.cpp in Sources */,
D088E7DDE38C31DC9C9B3419 /* dcclient.cpp in Sources */,
@@ -8201,7 +8195,6 @@
692FCCABFB963696AFC1E123 /* gdiobj.cpp in Sources */,
01D4C5F2147F3942A7CE91AB /* icon.cpp in Sources */,
B0E94A59C83637C09FAAE71D /* app.cpp in Sources */,
BB31D65BA1253A1CB64CE9D3 /* combobox.cpp in Sources */,
EB52C6A915943813932944FF /* control.cpp in Sources */,
45AB45C6B24A3983B22E56A6 /* dataobj.cpp in Sources */,
D088E7DDE38C31DC9C9B3418 /* dcclient.cpp in Sources */,
@@ -9410,7 +9403,6 @@
692FCCABFB963696AFC1E122 /* gdiobj.cpp in Sources */,
01D4C5F2147F3942A7CE91AA /* icon.cpp in Sources */,
B0E94A59C83637C09FAAE71C /* app.cpp in Sources */,
BB31D65BA1253A1CB64CE9D2 /* combobox.cpp in Sources */,
EB52C6A915943813932944FE /* control.cpp in Sources */,
45AB45C6B24A3983B22E56A5 /* dataobj.cpp in Sources */,
D088E7DDE38C31DC9C9B3417 /* dcclient.cpp in Sources */,

View File

@@ -605,7 +605,6 @@
BAA75384DA82370298672333 /* helpctrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42E433D1700631A8907B8227 /* helpctrl.cpp */; };
BAAB6B1D80A33843A8436B10 /* appunix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B40E0F6AA0273ACD9BDEAD72 /* appunix.cpp */; };
BAFF04F1680F32DA988EB03D /* stockitem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B180290089B139F18B0C7BBA /* stockitem.cpp */; };
BB31D65BA1253A1CB64CE9D2 /* combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A3F26F539473705AA82411D /* combobox.cpp */; };
BB6FE851028C3DE7A070C213 /* convauto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20B922D61CDB3CCEB59A5194 /* convauto.cpp */; };
BBAABF3C693E37D3B0FF2502 /* colrdlgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 66AC0EA493AB3B6A86DAE174 /* colrdlgg.cpp */; };
BCD81FD3D1EC305F801E1C1B /* sckipc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F6E23CCDC1932BC985EFBD2 /* sckipc.cpp */; };
@@ -1246,7 +1245,6 @@
7A1CE0B28CB73F90AE92B5AB /* richtooltipcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = richtooltipcmn.cpp; path = ../../src/common/richtooltipcmn.cpp; sourceTree = "<group>"; };
7A24E9101688368296C21EBE /* gzclose.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = gzclose.c; path = ../../src/zlib/gzclose.c; sourceTree = "<group>"; };
7A34C5BBBA543DC0A50DE1B6 /* event.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = event.cpp; path = ../../src/common/event.cpp; sourceTree = "<group>"; };
7A3F26F539473705AA82411D /* combobox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = combobox.cpp; path = ../../src/osx/carbon/combobox.cpp; sourceTree = "<group>"; };
7AF8F8A78A5130DCB4D46729 /* LexCmake.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexCmake.cxx; path = ../../src/stc/scintilla/lexers/LexCmake.cxx; sourceTree = "<group>"; };
7B389A14D6BF3AFD8CCE0807 /* protocol.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = protocol.cpp; path = ../../src/common/protocol.cpp; sourceTree = "<group>"; };
7BA6ADD758693BD180D3275B /* treebase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = treebase.cpp; path = ../../src/common/treebase.cpp; sourceTree = "<group>"; };
@@ -1972,7 +1970,6 @@
377056CEB1FC3EEB8526E7A6 /* gdiobj.cpp */,
F5DAF1F49F0F3F41A427A21D /* icon.cpp */,
757B31FCCA1F381C95B30DF8 /* app.cpp */,
7A3F26F539473705AA82411D /* combobox.cpp */,
12363D1F50FE301DAEE7F04A /* control.cpp */,
271B4B77622B3411A7BF6634 /* dataobj.cpp */,
B17772732159304AA7312D72 /* dcclient.cpp */,
@@ -3023,7 +3020,6 @@
692FCCABFB963696AFC1E122 /* gdiobj.cpp in Sources */,
01D4C5F2147F3942A7CE91AA /* icon.cpp in Sources */,
B0E94A59C83637C09FAAE71C /* app.cpp in Sources */,
BB31D65BA1253A1CB64CE9D2 /* combobox.cpp in Sources */,
EB52C6A915943813932944FE /* control.cpp in Sources */,
45AB45C6B24A3983B22E56A5 /* dataobj.cpp in Sources */,
D088E7DDE38C31DC9C9B3417 /* dcclient.cpp in Sources */,

View File

@@ -161,13 +161,6 @@ protected:
WXGLPixelFormat m_glFormat;
wxGLAttributes m_GLAttrs;
#if wxOSX_USE_CARBON
bool m_macCanvasIsShown,
m_needsUpdate;
WXGLContext m_dummyContext;
GLint m_bufferName;
#endif
wxDECLARE_EVENT_TABLE();
wxDECLARE_CLASS(wxGLCanvas);
};

View File

@@ -1,668 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/osx/carbon/combobox.cpp
// Purpose: wxComboBox class
// Author: Stefan Csomor, Dan "Bud" Keith (composite combobox)
// Modified by:
// Created: 1998-01-01
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#if wxUSE_COMBOBOX && wxOSX_USE_CARBON
#include "wx/combobox.h"
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/menu.h"
#include "wx/containr.h"
#include "wx/toplevel.h"
#include "wx/textctrl.h"
#endif
#include "wx/osx/private.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// the margin between the text control and the choice
// margin should be bigger on OS X due to blue highlight
// around text control.
static const wxCoord MARGIN = 4;
// this is the border a focus rect on OSX is needing
static const int TEXTFOCUSBORDER = 3 ;
// ----------------------------------------------------------------------------
// wxComboBoxText: text control forwards events to combobox
// ----------------------------------------------------------------------------
class wxComboBoxText : public wxTextCtrl
{
public:
wxComboBoxText( wxComboBox * cb )
: wxTextCtrl( cb , 1 )
{
m_cb = cb;
}
protected:
void OnChar( wxKeyEvent& event )
{
// Allows processing the tab key to go to the next control
if (event.GetKeyCode() == WXK_TAB)
{
wxNavigationKeyEvent NavEvent;
NavEvent.SetEventObject(this);
NavEvent.SetDirection(!event.ShiftDown());
NavEvent.SetWindowChange(false);
// Get the parent of the combo and have it process the navigation?
if (m_cb->GetParent()->HandleWindowEvent(NavEvent))
return;
}
// send the event to the combobox class in case the user has bound EVT_CHAR
wxKeyEvent kevt(event);
kevt.SetEventObject(m_cb);
if (m_cb->HandleWindowEvent(kevt))
// If the event was handled and not skipped then we're done
return;
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_TEXT_ENTER, m_cb->GetId());
event.SetString( GetValue() );
event.SetInt( m_cb->GetSelection() );
event.SetEventObject( m_cb );
// This will invoke the dialog default action,
// such as the clicking the default button.
if (!m_cb->HandleWindowEvent( event ))
{
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
if ( tlw && tlw->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event( wxEVT_BUTTON, def->GetId() );
event.SetEventObject(def);
def->Command(event);
}
}
return;
}
}
event.Skip();
}
void OnKeyUp( wxKeyEvent& event )
{
event.SetEventObject(m_cb);
event.SetId(m_cb->GetId());
if (! m_cb->HandleWindowEvent(event))
event.Skip();
}
void OnKeyDown( wxKeyEvent& event )
{
event.SetEventObject(m_cb);
event.SetId(m_cb->GetId());
if (! m_cb->HandleWindowEvent(event))
event.Skip();
}
void OnText( wxCommandEvent& event )
{
event.SetEventObject(m_cb);
event.SetId(m_cb->GetId());
if (! m_cb->HandleWindowEvent(event))
event.Skip();
}
void OnFocus( wxFocusEvent& event )
{
// in case the textcontrol gets the focus we propagate
// it to the parent's handlers.
wxFocusEvent evt2(event.GetEventType(),m_cb->GetId());
evt2.SetEventObject(m_cb);
m_cb->GetEventHandler()->ProcessEvent(evt2);
event.Skip();
}
private:
wxComboBox *m_cb;
wxDECLARE_EVENT_TABLE();
};
wxBEGIN_EVENT_TABLE(wxComboBoxText, wxTextCtrl)
EVT_KEY_DOWN(wxComboBoxText::OnKeyDown)
EVT_CHAR(wxComboBoxText::OnChar)
EVT_KEY_UP(wxComboBoxText::OnKeyUp)
EVT_SET_FOCUS(wxComboBoxText::OnFocus)
EVT_KILL_FOCUS(wxComboBoxText::OnFocus)
EVT_TEXT(wxID_ANY, wxComboBoxText::OnText)
wxEND_EVENT_TABLE()
class wxComboBoxChoice : public wxChoice
{
public:
wxComboBoxChoice( wxComboBox *cb, int style )
: wxChoice( cb , 1 , wxDefaultPosition , wxDefaultSize , 0 , NULL , style & (wxCB_SORT) )
{
m_cb = cb;
}
int GetPopupWidth() const
{
switch ( GetWindowVariant() )
{
case wxWINDOW_VARIANT_NORMAL :
case wxWINDOW_VARIANT_LARGE :
return 24 ;
default :
return 21 ;
}
}
protected:
void OnChoice( wxCommandEvent& e )
{
wxString s = e.GetString();
m_cb->DelegateChoice( s );
wxCommandEvent event2(wxEVT_COMBOBOX, m_cb->GetId() );
event2.SetInt(m_cb->GetSelection());
event2.SetEventObject(m_cb);
event2.SetString(m_cb->GetStringSelection());
m_cb->ProcessCommand(event2);
// For consistency with MSW and GTK, also send a text updated event
// After all, the text is updated when a selection is made
wxCommandEvent TextEvent( wxEVT_TEXT, m_cb->GetId() );
TextEvent.SetString( m_cb->GetStringSelection() );
TextEvent.SetEventObject( m_cb );
m_cb->ProcessCommand( TextEvent );
}
virtual wxSize DoGetBestSize() const
{
wxSize sz = wxChoice::DoGetBestSize() ;
if (! m_cb->HasFlag(wxCB_READONLY) )
sz.x = GetPopupWidth() ;
return sz ;
}
private:
wxComboBox *m_cb;
friend class wxComboBox;
wxDECLARE_EVENT_TABLE();
};
wxBEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice)
wxEND_EVENT_TABLE()
wxComboBox::~wxComboBox()
{
// 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
wxDELETE(m_text);
wxDELETE(m_choice);
}
// ----------------------------------------------------------------------------
// geometry
// ----------------------------------------------------------------------------
wxSize wxComboBox::DoGetBestSize() const
{
if (!m_choice && !m_text)
return GetSize();
wxSize size = m_choice->GetBestSize();
if ( m_text != NULL )
{
wxSize sizeText = m_text->GetBestSize();
if (sizeText.y + 2 * TEXTFOCUSBORDER > size.y)
size.y = sizeText.y + 2 * TEXTFOCUSBORDER;
size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN;
size.x += TEXTFOCUSBORDER ;
}
else
{
// clipping is too tight
size.y += 1 ;
}
return size;
}
void wxComboBox::DoMoveWindow(int x, int y, int width, int height)
{
wxControl::DoMoveWindow( x, y, width , height );
if ( m_text == NULL )
{
// we might not be fully constructed yet, therefore watch out...
if ( m_choice )
m_choice->SetSize(0, 0 , width, -1);
}
else
{
wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN;
m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1);
wxSize tSize = m_text->GetSize();
wxSize cSize = m_choice->GetSize();
int yOffset = ( tSize.y + 2 * TEXTFOCUSBORDER - cSize.y ) / 2;
// put it at an inset of 1 to have outer area shadows drawn as well
m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , yOffset, m_choice->GetPopupWidth() , -1);
}
}
// ----------------------------------------------------------------------------
// operations forwarded to the subcontrols
// ----------------------------------------------------------------------------
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
return false;
if (m_text)
m_text->Enable(enable);
return true;
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
return false;
return true;
}
void wxComboBox::DelegateTextChanged( const wxString& value )
{
SetStringSelection( value );
}
void wxComboBox::DelegateChoice( const wxString& value )
{
SetStringSelection( value );
}
bool wxComboBox::Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator,
const wxString& name)
{
if ( !Create( parent, id, value, pos, size, 0, NULL,
style, validator, name ) )
return false;
Append(choices);
return true;
}
bool wxComboBox::Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
int n,
const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
validator, name) )
{
return false;
}
wxSize csize = size;
if ( style & wxCB_READONLY )
{
m_text = NULL;
}
else
{
m_text = new wxComboBoxText(this);
if ( size.y == -1 )
{
csize.y = m_text->GetSize().y ;
csize.y += 2 * TEXTFOCUSBORDER ;
}
}
m_choice = new wxComboBoxChoice(this, style );
DoSetSize(pos.x, pos.y, csize.x, csize.y);
Append( n, choices );
// Needed because it is a wxControlWithItems
SetInitialSize(size);
SetStringSelection(value);
return true;
}
void wxComboBox::EnableTextChangedEvents(bool enable)
{
if ( m_text )
m_text->ForwardEnableTextChangedEvents(enable);
}
wxString wxComboBox::DoGetValue() const
{
wxCHECK_MSG( m_text, wxString(), "can't be called for read-only combobox" );
return m_text->GetValue();
}
wxString wxComboBox::GetValue() const
{
wxString result;
if ( m_text == NULL )
result = m_choice->GetString( m_choice->GetSelection() );
else
result = m_text->GetValue();
return result;
}
unsigned int wxComboBox::GetCount() const
{
return m_choice->GetCount() ;
}
void wxComboBox::SetValue(const wxString& value)
{
if ( HasFlag(wxCB_READONLY) )
SetStringSelection( value ) ;
else
m_text->SetValue( value );
}
void wxComboBox::WriteText(const wxString& text)
{
m_text->WriteText(text);
}
void wxComboBox::GetSelection(long *from, long *to) const
{
m_text->GetSelection(from, to);
}
// Clipboard operations
void wxComboBox::Copy()
{
if ( m_text != NULL )
m_text->Copy();
}
void wxComboBox::Cut()
{
if ( m_text != NULL )
m_text->Cut();
}
void wxComboBox::Paste()
{
if ( m_text != NULL )
m_text->Paste();
}
void wxComboBox::SetEditable(bool editable)
{
if ( ( m_text == NULL ) && editable )
{
m_text = new wxComboBoxText( this );
}
else if ( !editable )
{
wxDELETE(m_text);
}
int currentX, currentY;
GetPosition( &currentX, &currentY );
int currentW, currentH;
GetSize( &currentW, &currentH );
DoMoveWindow( currentX, currentY, currentW, currentH );
}
void wxComboBox::SetInsertionPoint(long pos)
{
if ( m_text )
m_text->SetInsertionPoint(pos);
}
void wxComboBox::SetInsertionPointEnd()
{
if ( m_text )
m_text->SetInsertionPointEnd();
}
long wxComboBox::GetInsertionPoint() const
{
if ( m_text )
return m_text->GetInsertionPoint();
return 0;
}
wxTextPos wxComboBox::GetLastPosition() const
{
if ( m_text )
return m_text->GetLastPosition();
return 0;
}
void wxComboBox::Replace(long from, long to, const wxString& value)
{
if ( m_text )
m_text->Replace(from,to,value);
}
void wxComboBox::Remove(long from, long to)
{
if ( m_text )
m_text->Remove(from,to);
}
void wxComboBox::SetSelection(long from, long to)
{
if ( m_text )
m_text->SetSelection(from,to);
}
int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData,
wxClientDataType type)
{
return m_choice->DoInsertItems(items, pos, clientData, type);
}
void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
return m_choice->DoSetItemClientData( n , clientData ) ;
}
void* wxComboBox::DoGetItemClientData(unsigned int n) const
{
return m_choice->DoGetItemClientData( n ) ;
}
wxClientDataType wxComboBox::GetClientDataType() const
{
return m_choice->GetClientDataType();
}
void wxComboBox::SetClientDataType(wxClientDataType clientDataItemsType)
{
m_choice->SetClientDataType(clientDataItemsType);
}
void wxComboBox::DoDeleteOneItem(unsigned int n)
{
m_choice->DoDeleteOneItem( n );
}
void wxComboBox::DoClear()
{
m_choice->DoClear();
}
int wxComboBox::GetSelection() const
{
return m_choice->GetSelection();
}
void wxComboBox::SetSelection(int n)
{
m_choice->SetSelection( n );
if ( m_text != NULL )
m_text->SetValue(n != wxNOT_FOUND ? GetString(n) : wxString(wxEmptyString));
}
int wxComboBox::FindString(const wxString& s, bool bCase) const
{
return m_choice->FindString( s, bCase );
}
wxString wxComboBox::GetString(unsigned int n) const
{
return m_choice->GetString( n );
}
wxString wxComboBox::GetStringSelection() const
{
int sel = GetSelection();
if (sel != wxNOT_FOUND)
return wxString(this->GetString((unsigned int)sel));
else
return wxEmptyString;
}
void wxComboBox::SetString(unsigned int n, const wxString& s)
{
m_choice->SetString( n , s );
}
bool wxComboBox::IsEditable() const
{
return m_text != NULL && !HasFlag(wxCB_READONLY);
}
void wxComboBox::Undo()
{
if (m_text != NULL)
m_text->Undo();
}
void wxComboBox::Redo()
{
if (m_text != NULL)
m_text->Redo();
}
void wxComboBox::SelectAll()
{
if (m_text != NULL)
m_text->SelectAll();
}
bool wxComboBox::CanCopy() const
{
if (m_text != NULL)
return m_text->CanCopy();
else
return false;
}
bool wxComboBox::CanCut() const
{
if (m_text != NULL)
return m_text->CanCut();
else
return false;
}
bool wxComboBox::CanPaste() const
{
if (m_text != NULL)
return m_text->CanPaste();
else
return false;
}
bool wxComboBox::CanUndo() const
{
if (m_text != NULL)
return m_text->CanUndo();
else
return false;
}
bool wxComboBox::CanRedo() const
{
if (m_text != NULL)
return m_text->CanRedo();
else
return false;
}
bool wxComboBox::OSXHandleClicked( double WXUNUSED(timestampsec) )
{
/*
For consistency with other platforms, clicking in the text area does not constitute a selection
wxCommandEvent event(wxEVT_COMBOBOX, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
event.SetString(GetStringSelection());
ProcessCommand(event);
*/
return true ;
}
wxTextWidgetImpl* wxComboBox::GetTextPeer() const
{
if (m_text)
return m_text->GetTextPeer();
return NULL;
}
#endif // wxUSE_COMBOBOX && wxOSX_USE_CARBON

View File

@@ -1,783 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/osx/carbon/combobxc.cpp
// Purpose: wxComboBox class using HIView ComboBox
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#include "wx/combobox.h"
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/menu.h"
#endif
#include "wx/osx/uma.h"
#if TARGET_API_MAC_OSX
#ifndef __HIVIEW__
#include <HIToolbox/HIView.h>
#endif
#endif
#if TARGET_API_MAC_OSX
#define USE_HICOMBOBOX 1 //use hi combobox define
#else
#define USE_HICOMBOBOX 0
#endif
static int nextPopUpMenuId = 1000;
MenuHandle NewUniqueMenu()
{
MenuHandle handle = NewMenu( nextPopUpMenuId , "\pMenu" );
nextPopUpMenuId++;
return handle;
}
#if USE_HICOMBOBOX
static const EventTypeSpec eventList[] =
{
{ kEventClassTextField , kEventTextAccepted } ,
};
static pascal OSStatus wxMacComboBoxEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr;
wxComboBox* cb = (wxComboBox*) data;
wxMacCarbonEvent cEvent( event );
switch( cEvent.GetClass() )
{
case kEventClassTextField :
switch( cEvent.GetKind() )
{
case kEventTextAccepted :
{
wxCommandEvent event( wxEVT_COMBOBOX, cb->GetId() );
event.SetInt( cb->GetSelection() );
event.SetString( cb->GetStringSelection() );
event.SetEventObject( cb );
cb->HandleWindowEvent( event );
}
break;
default :
break;
}
break;
default :
break;
}
return result;
}
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacComboBoxEventHandler )
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// the margin between the text control and the choice
static const wxCoord MARGIN = 2;
#if TARGET_API_MAC_OSX
static const int POPUPWIDTH = 24;
#else
static const int POPUPWIDTH = 18;
#endif
static const int POPUPHEIGHT = 23;
// ----------------------------------------------------------------------------
// wxComboBoxText: text control forwards events to combobox
// ----------------------------------------------------------------------------
class wxComboBoxText : public wxTextCtrl
{
public:
wxComboBoxText( wxComboBox * cb )
: wxTextCtrl( cb , 1 )
{
m_cb = cb;
}
protected:
void OnChar( wxKeyEvent& event )
{
if ( event.GetKeyCode() == WXK_RETURN )
{
wxString value = GetValue();
if ( m_cb->GetCount() == 0 )
{
// make Enter generate "selected" event if there is only one item
// in the combobox - without it, it's impossible to select it at
// all!
wxCommandEvent event( wxEVT_COMBOBOX, m_cb->GetId() );
event.SetInt( 0 );
event.SetString( value );
event.SetEventObject( m_cb );
m_cb->HandleWindowEvent( event );
}
else
{
// add the item to the list if it's not there yet
if ( m_cb->FindString(value) == wxNOT_FOUND )
{
m_cb->Append(value);
m_cb->SetStringSelection(value);
// and generate the selected event for it
wxCommandEvent event( wxEVT_COMBOBOX, m_cb->GetId() );
event.SetInt( m_cb->GetCount() - 1 );
event.SetString( value );
event.SetEventObject( m_cb );
m_cb->HandleWindowEvent( event );
}
// This will invoke the dialog default action, such
// as the clicking the default button.
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
if ( tlw && tlw->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
event.SetEventObject(def);
def->Command(event);
return;
}
}
return;
}
}
event.Skip();
}
private:
wxComboBox *m_cb;
wxDECLARE_EVENT_TABLE();
};
wxBEGIN_EVENT_TABLE(wxComboBoxText, wxTextCtrl)
EVT_CHAR( wxComboBoxText::OnChar)
wxEND_EVENT_TABLE()
class wxComboBoxChoice : public wxChoice
{
public:
wxComboBoxChoice(wxComboBox *cb, int style)
: wxChoice( cb , 1 )
{
m_cb = cb;
}
protected:
void OnChoice( wxCommandEvent& e )
{
wxString s = e.GetString();
m_cb->DelegateChoice( s );
wxCommandEvent event2(wxEVT_COMBOBOX, m_cb->GetId() );
event2.SetInt(m_cb->GetSelection());
event2.SetEventObject(m_cb);
event2.SetString(m_cb->GetStringSelection());
m_cb->ProcessCommand(event2);
}
virtual wxSize DoGetBestSize() const
{
wxSize sz = wxChoice::DoGetBestSize();
sz.x = POPUPWIDTH;
return sz;
}
private:
wxComboBox *m_cb;
wxDECLARE_EVENT_TABLE();
};
wxBEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice)
wxEND_EVENT_TABLE()
wxComboBox::~wxComboBox()
{
// 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
wxDELETE( m_text );
wxDELETE( m_choice );
}
// ----------------------------------------------------------------------------
// geometry
// ----------------------------------------------------------------------------
wxSize wxComboBox::DoGetBestSize() const
{
#if USE_HICOMBOBOX
return wxControl::DoGetBestSize();
#else
wxSize size = m_choice->GetBestSize();
if ( m_text != NULL )
{
wxSize sizeText = m_text->GetBestSize();
size.x = POPUPWIDTH + sizeText.x + MARGIN;
}
return size;
#endif
}
void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
#if USE_HICOMBOBOX
wxControl::DoMoveWindow(x, y, width, height);
#else
height = POPUPHEIGHT;
wxControl::DoMoveWindow(x, y, width, height);
if ( m_text == NULL )
{
// we might not be fully constructed yet, therefore watch out...
if ( m_choice )
m_choice->SetSize(0, 0 , width, wxDefaultCoord);
}
else
{
wxCoord wText = width - POPUPWIDTH - MARGIN;
m_text->SetSize(0, 0, wText, height);
m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord);
}
#endif
}
// ----------------------------------------------------------------------------
// operations forwarded to the subcontrols
// ----------------------------------------------------------------------------
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
return false;
return true;
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
return false;
return true;
}
void wxComboBox::SetFocus()
{
#if USE_HICOMBOBOX
wxControl::SetFocus();
#else
if ( m_text != NULL) {
m_text->SetFocus();
}
#endif
}
void wxComboBox::DelegateTextChanged( const wxString& value )
{
SetStringSelection( value );
}
void wxComboBox::DelegateChoice( const wxString& value )
{
SetStringSelection( value );
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator,
const wxString& name)
{
wxCArrayString chs( choices );
return Create( parent, id, value, pos, size, chs.GetCount(),
chs.GetStrings(), style, validator, name );
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
int n, const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
m_text = NULL;
m_choice = NULL;
#if USE_HICOMBOBOX
DontCreatePeer();
#endif
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
return false;
}
#if USE_HICOMBOBOX
Rect bounds = wxMacGetBoundsForControl( this , pos , size );
HIRect hiRect;
hiRect.origin.x = 20; //bounds.left;
hiRect.origin.y = 25; //bounds.top;
hiRect.size.width = 120;// bounds.right - bounds.left;
hiRect.size.height = 24;
//For some reason, this code causes the combo box not to be displayed at all.
//hiRect.origin.x = bounds.left;
//hiRect.origin.y = bounds.top;
//hiRect.size.width = bounds.right - bounds.left;
//hiRect.size.height = bounds.bottom - bounds.top;
//printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom);
//printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height);
m_peer = new wxMacControl(this);
verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, m_peer->GetControlRefAddr() ) );
m_peer->SetMinimum( 0 );
m_peer->SetMaximum( 100);
if ( n > 0 )
m_peer->SetValue( 1 );
MacPostControlCreate(pos,size);
Append( choices[ i ] );
HIViewSetVisible( m_peer->GetControlRef(), true );
SetSelection(0);
EventHandlerRef comboEventHandler;
InstallControlEventHandler( m_peer->GetControlRef(), GetwxMacComboBoxEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
(EventHandlerRef *)&comboEventHandler);
#else
m_choice = new wxComboBoxChoice(this, style );
m_choice->SetMinSize( wxSize( POPUPWIDTH , POPUPHEIGHT ) );
wxSize csize = size;
if ( style & wxCB_READONLY )
{
m_text = NULL;
}
else
{
m_text = new wxComboBoxText(this);
if ( size.y == wxDefaultCoord ) {
csize.y = m_text->GetSize().y;
}
}
DoSetSize(pos.x, pos.y, csize.x, csize.y);
m_choice->Append( n, choices );
SetInitialSize(csize); // Needed because it is a wxControlWithItems
#endif
return true;
}
wxString wxComboBox::GetValue() const
{
#if USE_HICOMBOBOX
CFStringRef myString;
HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)GetSelection(), &myString );
return wxMacCFStringHolder( myString, GetFont().GetEncoding() ).AsString();
#else
wxString result;
if ( m_text == NULL )
{
result = m_choice->GetString( m_choice->GetSelection() );
}
else
{
result = m_text->GetValue();
}
return result;
#endif
}
void wxComboBox::SetValue(const wxString& value)
{
#if USE_HICOMBOBOX
#else
int s = FindString (value);
if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
{
m_choice->Append(value);
}
SetStringSelection( value );
#endif
}
// Clipboard operations
void wxComboBox::Copy()
{
if ( m_text != NULL )
{
m_text->Copy();
}
}
void wxComboBox::Cut()
{
if ( m_text != NULL )
{
m_text->Cut();
}
}
void wxComboBox::Paste()
{
if ( m_text != NULL )
{
m_text->Paste();
}
}
void wxComboBox::SetEditable(bool editable)
{
if ( ( m_text == NULL ) && editable )
{
m_text = new wxComboBoxText( this );
}
else if ( !editable )
{
wxDELETE(m_text);
}
int currentX, currentY;
GetPosition( &currentX, &currentY );
int currentW, currentH;
GetSize( &currentW, &currentH );
DoMoveWindow( currentX, currentY, currentW, currentH );
}
void wxComboBox::SetInsertionPoint(long pos)
{
// TODO
}
void wxComboBox::SetInsertionPointEnd()
{
// TODO
}
long wxComboBox::GetInsertionPoint() const
{
// TODO
return 0;
}
wxTextPos wxComboBox::GetLastPosition() const
{
// TODO
return 0;
}
void wxComboBox::Replace(long from, long to, const wxString& value)
{
// TODO
}
void wxComboBox::Remove(long from, long to)
{
// TODO
}
void wxComboBox::SetSelection(long from, long to)
{
// TODO
}
int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData, wxClientDataType type)
{
#if USE_HICOMBOBOX
const unsigned int count = items.GetCount();
for ( unsigned int i = 0; i < count; ++i, ++pos )
{
HIComboBoxInsertTextItemAtIndex(m_peer->GetControlRef(),
(CFIndex)pos,
wxMacCFStringHolder(items[i],
GetFont().GetEncoding()));
AssignNewItemClientData(pos, clientData, i, type);
}
//SetControl32BitMaximum( m_peer->GetControlRef(), GetCount() );
return pos - 1;
#else
return m_choice->DoInsertItems( items, pos, clientData, type );
#endif
}
void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
#if USE_HICOMBOBOX
return; //TODO
#else
return m_choice->DoSetItemClientData( n , clientData );
#endif
}
void* wxComboBox::DoGetItemClientData(unsigned int n) const
{
#if USE_HICOMBOBOX
return NULL; //TODO
#else
return m_choice->DoGetItemClientData( n );
#endif
}
unsigned int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX
return (unsigned int) HIComboBoxGetItemCount( m_peer->GetControlRef() );
#else
return m_choice->GetCount();
#endif
}
void wxComboBox::DoDeleteOneItem(unsigned int n)
{
#if USE_HICOMBOBOX
HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), (CFIndex)n );
#else
m_choice->Delete( n );
#endif
}
void wxComboBox::DoClear()
{
#if USE_HICOMBOBOX
for ( CFIndex i = GetCount() - 1; i >= 0; ++ i )
verify_noerr( HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), i ) );
m_peer->SetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag,CFSTR(""));
#else
m_choice->Clear();
#endif
}
int wxComboBox::GetSelection() const
{
#if USE_HICOMBOBOX
return FindString( GetStringSelection() );
#else
return m_choice->GetSelection();
#endif
}
void wxComboBox::SetSelection(int n)
{
#if USE_HICOMBOBOX
SetControl32BitValue( m_peer->GetControlRef() , n + 1 );
#else
m_choice->SetSelection( n );
if ( m_text != NULL )
{
m_text->SetValue(GetString(n));
}
#endif
}
int wxComboBox::FindString(const wxString& s, bool bCase) const
{
#if USE_HICOMBOBOX
for( unsigned int i = 0 ; i < GetCount() ; i++ )
{
if (GetString(i).IsSameAs(s, bCase) )
return i ;
}
return wxNOT_FOUND;
#else
return m_choice->FindString( s, bCase );
#endif
}
wxString wxComboBox::GetString(unsigned int n) const
{
#if USE_HICOMBOBOX
CFStringRef itemText;
HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)n, &itemText );
return wxMacCFStringHolder(itemText).AsString();
#else
return m_choice->GetString( n );
#endif
}
wxString wxComboBox::GetStringSelection() const
{
#if USE_HICOMBOBOX
return wxMacCFStringHolder(m_peer->GetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag)).AsString();
#else
int sel = GetSelection ();
if (sel != wxNOT_FOUND)
return wxString(this->GetString((unsigned int)sel));
else
return wxEmptyString;
#endif
}
void wxComboBox::SetString(unsigned int n, const wxString& s)
{
#if USE_HICOMBOBOX
verify_noerr ( HIComboBoxInsertTextItemAtIndex( m_peer->GetControlRef(), (CFIndex) n,
wxMacCFStringHolder(s, GetFont().GetEncoding()) ) );
verify_noerr ( HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), (CFIndex) n + 1 ) );
#else
m_choice->SetString( n , s );
#endif
}
bool wxComboBox::IsEditable() const
{
#if USE_HICOMBOBOX
// TODO
return !HasFlag(wxCB_READONLY);
#else
return m_text != NULL && !HasFlag(wxCB_READONLY);
#endif
}
void wxComboBox::Undo()
{
#if USE_HICOMBOBOX
// TODO
#else
if (m_text != NULL)
m_text->Undo();
#endif
}
void wxComboBox::Redo()
{
#if USE_HICOMBOBOX
// TODO
#else
if (m_text != NULL)
m_text->Redo();
#endif
}
void wxComboBox::SelectAll()
{
#if USE_HICOMBOBOX
// TODO
#else
if (m_text != NULL)
m_text->SelectAll();
#endif
}
bool wxComboBox::CanCopy() const
{
#if USE_HICOMBOBOX
// TODO
return false;
#else
if (m_text != NULL)
return m_text->CanCopy();
else
return false;
#endif
}
bool wxComboBox::CanCut() const
{
#if USE_HICOMBOBOX
// TODO
return false;
#else
if (m_text != NULL)
return m_text->CanCut();
else
return false;
#endif
}
bool wxComboBox::CanPaste() const
{
#if USE_HICOMBOBOX
// TODO
return false;
#else
if (m_text != NULL)
return m_text->CanPaste();
else
return false;
#endif
}
bool wxComboBox::CanUndo() const
{
#if USE_HICOMBOBOX
// TODO
return false;
#else
if (m_text != NULL)
return m_text->CanUndo();
else
return false;
#endif
}
bool wxComboBox::CanRedo() const
{
#if USE_HICOMBOBOX
// TODO
return false;
#else
if (m_text != NULL)
return m_text->CanRedo();
else
return false;
#endif
}
bool wxComboBox::OSXHandleClicked( double timestampsec )
{
wxCommandEvent event(wxEVT_COMBOBOX, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
event.SetString(GetStringSelection());
ProcessCommand(event);
return true;
}

View File

@@ -1,256 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/osx/carbon/dirmac.cpp
// Purpose: wxDir implementation for Mac
// Author: Stefan Csomor
// Modified by:
// Created: 08.12.99
// Copyright: (c) 1999 Stefan Csomor <csomor@advanced.ch>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/dir.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
#endif // PCH
#include "wx/filename.h"
#include "wx/osx/private.h"
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// this class stores everything we need to enumerate the files
class wxDirData
{
public:
wxDirData(const wxString& dirname);
~wxDirData();
void Close() ;
void SetFileSpec(const wxString& filespec) { m_filespec = filespec; }
void SetFlags(int flags) { m_flags = flags; }
bool Read(wxString *filename); // reads the next
void Rewind() ;
const wxString& GetName() const { return m_dirname; }
private:
FSIterator m_iterator ;
wxString m_dirname;
wxString m_filespec;
int m_flags;
};
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxDirData
// ----------------------------------------------------------------------------
wxDirData::wxDirData(const wxString& dirname)
: m_dirname(dirname)
{
// throw away the trailing slashes
size_t n = m_dirname.length();
wxCHECK_RET( n, wxT("empty dir name in wxDir") );
while ( n > 0 && wxIsPathSeparator(m_dirname[--n]) )
;
m_dirname.Truncate(n + 1);
m_iterator = NULL ;
}
wxDirData::~wxDirData()
{
Close() ;
}
void wxDirData::Close()
{
if ( m_iterator )
{
FSCloseIterator( m_iterator ) ;
m_iterator = NULL ;
}
}
void wxDirData::Rewind()
{
Close() ;
}
bool wxDirData::Read(wxString *filename)
{
wxString result;
OSStatus err = noErr ;
if ( NULL == m_iterator )
{
FSRef dirRef;
err = wxMacPathToFSRef( m_dirname , &dirRef ) ;
if ( err == noErr )
{
err = FSOpenIterator(&dirRef, kFSIterateFlat, &m_iterator);
}
if ( err )
{
Close() ;
return false ;
}
}
wxString name ;
wxString lowerfilespec = m_filespec.Lower();
while( noErr == err )
{
HFSUniStr255 uniname ;
FSRef fileRef;
FSCatalogInfo catalogInfo;
ItemCount fetched = 0;
err = FSGetCatalogInfoBulk( m_iterator, 1, &fetched, NULL, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo , &catalogInfo , &fileRef, NULL, &uniname );
// expected error codes
if ( errFSNoMoreItems == err )
return false ;
if ( afpAccessDenied == err )
return false ;
if ( noErr != err )
break ;
name = wxMacHFSUniStrToString( &uniname ) ;
wxString lowername = name.Lower();
if ( ( name == wxT(".") || name == wxT("..") ) && !(m_flags & wxDIR_DOTDOT) )
continue;
if ( ( name[0U] == '.' ) && !(m_flags & wxDIR_HIDDEN ) )
continue ;
if ( (((FileInfo*)&catalogInfo.finderInfo)->finderFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN ) )
continue ;
// its a dir and we don't want it
if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) && !(m_flags & wxDIR_DIRS) )
continue ;
// its a file but we don't want it
if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) == 0 && !(m_flags & wxDIR_FILES ) )
continue ;
if ( m_filespec.empty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
{
}
else if ( !wxMatchWild(lowerfilespec, lowername , false) )
{
continue ;
}
break ;
}
if ( err != noErr )
{
return false ;
}
*filename = name ;
return true;
}
// ----------------------------------------------------------------------------
// wxDir construction/destruction
// ----------------------------------------------------------------------------
wxDir::wxDir(const wxString& dirname)
{
m_data = NULL;
(void)Open(dirname);
}
bool wxDir::Open(const wxString& dirname)
{
delete m_data;
m_data = new wxDirData(dirname);
return true;
}
bool wxDir::IsOpened() const
{
return m_data != NULL;
}
wxString wxDir::GetName() const
{
wxString name;
if ( m_data )
{
name = m_data->GetName();
if ( !name.empty() && (name.Last() == wxT('/')) )
{
// chop off the last (back)slash
name.Truncate(name.length() - 1);
}
}
return name;
}
wxDir::~wxDir()
{
wxDELETE(m_data);
}
// ----------------------------------------------------------------------------
// wxDir enumerating
// ----------------------------------------------------------------------------
bool wxDir::GetFirst(wxString *filename,
const wxString& filespec,
int flags) const
{
wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") );
m_data->Rewind();
m_data->SetFileSpec(filespec);
m_data->SetFlags(flags);
return GetNext(filename);
}
bool wxDir::GetNext(wxString *filename) const
{
wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") );
wxCHECK_MSG( filename, false, wxT("bad pointer in wxDir::GetNext()") );
return m_data->Read(filename);
}