changed choice to properly inherit from wxChoiceBase , added msg compatible calls to wxStaticBitmap, correct window class attribution (was wrong in carbon)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9462 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -476,7 +476,7 @@ wxPathFormat wxFileName::GetFormat( wxPathFormat format )
|
|||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
format = wxPATH_DOS;
|
format = wxPATH_DOS;
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
format = wxPATH_MAC;
|
format = wxPATH_UNIX; // that's the way the rest of wx' code works right now
|
||||||
#else
|
#else
|
||||||
format = wxPATH_UNIX;
|
format = wxPATH_UNIX;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -30,6 +30,14 @@ wxChoice::~wxChoice()
|
|||||||
DisposeMenu( m_macPopUpMenuHandle ) ;
|
DisposeMenu( m_macPopUpMenuHandle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxChoice::GetCount() const {
|
||||||
|
return m_strings.Count() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxChoice::SetString( int n , const wxString& s ) {
|
||||||
|
m_strings[n] = s ;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
@@ -56,6 +64,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
|
wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
|
||||||
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
||||||
m_strings.Add( choices[i] ) ;
|
m_strings.Add( choices[i] ) ;
|
||||||
|
m_dataArray.Add( NULL );
|
||||||
}
|
}
|
||||||
SetControlMinimum( m_macControl , 0 ) ;
|
SetControlMinimum( m_macControl , 0 ) ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
SetControlMaximum( m_macControl , Number()) ;
|
||||||
@@ -67,28 +76,50 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Append(const wxString& item)
|
int wxChoice::DoAppend(const wxString& item)
|
||||||
{
|
{
|
||||||
Str255 label;
|
Str255 label;
|
||||||
wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
|
wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
|
||||||
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
||||||
m_strings.Add( item ) ;
|
m_strings.Add( item ) ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
m_dataArray.Add( NULL );
|
||||||
|
return m_strings.Count() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Append(const wxString &item, void *client_data)
|
void *wxChoice::DoGetItemClientData(int N) const
|
||||||
{
|
{
|
||||||
|
return (void *)m_dataArray[N];
|
||||||
}
|
}
|
||||||
|
|
||||||
void *wxChoice::GetClientData(int index) const
|
void wxChoice::DoSetItemClientData( int N, void* Client_data )
|
||||||
{
|
{
|
||||||
return NULL;
|
wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
|
||||||
|
|
||||||
|
if ( m_dataArray.GetCount() > N )
|
||||||
|
{
|
||||||
|
m_dataArray[N] = (char*) Client_data ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dataArray.Add( (char*) Client_data ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||||
|
{
|
||||||
|
DoSetItemClientData(n, clientData);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxClientData* wxChoice::DoGetItemClientObject( int N ) const
|
||||||
|
{
|
||||||
|
return (wxClientData *) DoGetItemClientData( N ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
{
|
{
|
||||||
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
|
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
|
||||||
m_strings.Remove( n ) ;
|
m_strings.Remove( n ) ;
|
||||||
|
m_dataArray.Remove( n ) ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
SetControlMaximum( m_macControl , Number()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +130,7 @@ void wxChoice::Clear()
|
|||||||
::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
|
::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
|
||||||
}
|
}
|
||||||
m_strings.Clear() ;
|
m_strings.Clear() ;
|
||||||
|
m_dataArray.Empty() ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
SetControlMaximum( m_macControl , Number()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,35 +169,8 @@ wxString wxChoice::GetString(int n) const
|
|||||||
return m_strings[n] ;
|
return m_strings[n] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
wxControl::SetSize( x,y,width,height,sizeFlags ) ;
|
wxControl::SetSize( x,y,width,height,sizeFlags ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxChoice::GetStringSelection () const
|
|
||||||
{
|
|
||||||
int sel = GetSelection ();
|
|
||||||
if (sel > -1)
|
|
||||||
return wxString(this->GetString (sel));
|
|
||||||
else
|
|
||||||
return wxString("");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxChoice::SetStringSelection (const wxString& s)
|
|
||||||
{
|
|
||||||
int sel = FindString (s);
|
|
||||||
if (sel > -1)
|
|
||||||
{
|
|
||||||
SetSelection (sel);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoice::Command(wxCommandEvent & event)
|
|
||||||
{
|
|
||||||
SetSelection (event.GetInt());
|
|
||||||
ProcessCommand (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -30,6 +30,14 @@ wxChoice::~wxChoice()
|
|||||||
DisposeMenu( m_macPopUpMenuHandle ) ;
|
DisposeMenu( m_macPopUpMenuHandle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxChoice::GetCount() const {
|
||||||
|
return m_strings.Count() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxChoice::SetString( int n , const wxString& s ) {
|
||||||
|
m_strings[n] = s ;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
@@ -56,6 +64,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
|
wxMenuItem::MacBuildMenuString( label , NULL , NULL , choices[i] ,false);
|
||||||
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
||||||
m_strings.Add( choices[i] ) ;
|
m_strings.Add( choices[i] ) ;
|
||||||
|
m_dataArray.Add( NULL );
|
||||||
}
|
}
|
||||||
SetControlMinimum( m_macControl , 0 ) ;
|
SetControlMinimum( m_macControl , 0 ) ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
SetControlMaximum( m_macControl , Number()) ;
|
||||||
@@ -67,28 +76,50 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Append(const wxString& item)
|
int wxChoice::DoAppend(const wxString& item)
|
||||||
{
|
{
|
||||||
Str255 label;
|
Str255 label;
|
||||||
wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
|
wxMenuItem::MacBuildMenuString( label , NULL , NULL , item ,false);
|
||||||
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
AppendMenu( m_macPopUpMenuHandle , label ) ;
|
||||||
m_strings.Add( item ) ;
|
m_strings.Add( item ) ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
m_dataArray.Add( NULL );
|
||||||
|
return m_strings.Count() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Append(const wxString &item, void *client_data)
|
void *wxChoice::DoGetItemClientData(int N) const
|
||||||
{
|
{
|
||||||
|
return (void *)m_dataArray[N];
|
||||||
}
|
}
|
||||||
|
|
||||||
void *wxChoice::GetClientData(int index) const
|
void wxChoice::DoSetItemClientData( int N, void* Client_data )
|
||||||
{
|
{
|
||||||
return NULL;
|
wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
|
||||||
|
|
||||||
|
if ( m_dataArray.GetCount() > N )
|
||||||
|
{
|
||||||
|
m_dataArray[N] = (char*) Client_data ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dataArray.Add( (char*) Client_data ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||||
|
{
|
||||||
|
DoSetItemClientData(n, clientData);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxClientData* wxChoice::DoGetItemClientObject( int N ) const
|
||||||
|
{
|
||||||
|
return (wxClientData *) DoGetItemClientData( N ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
{
|
{
|
||||||
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
|
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
|
||||||
m_strings.Remove( n ) ;
|
m_strings.Remove( n ) ;
|
||||||
|
m_dataArray.Remove( n ) ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
SetControlMaximum( m_macControl , Number()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +130,7 @@ void wxChoice::Clear()
|
|||||||
::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
|
::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
|
||||||
}
|
}
|
||||||
m_strings.Clear() ;
|
m_strings.Clear() ;
|
||||||
|
m_dataArray.Empty() ;
|
||||||
SetControlMaximum( m_macControl , Number()) ;
|
SetControlMaximum( m_macControl , Number()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,35 +169,8 @@ wxString wxChoice::GetString(int n) const
|
|||||||
return m_strings[n] ;
|
return m_strings[n] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
wxControl::SetSize( x,y,width,height,sizeFlags ) ;
|
wxControl::SetSize( x,y,width,height,sizeFlags ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxChoice::GetStringSelection () const
|
|
||||||
{
|
|
||||||
int sel = GetSelection ();
|
|
||||||
if (sel > -1)
|
|
||||||
return wxString(this->GetString (sel));
|
|
||||||
else
|
|
||||||
return wxString("");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxChoice::SetStringSelection (const wxString& s)
|
|
||||||
{
|
|
||||||
int sel = FindString (s);
|
|
||||||
if (sel > -1)
|
|
||||||
{
|
|
||||||
SetSelection (sel);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoice::Command(wxCommandEvent & event)
|
|
||||||
{
|
|
||||||
SetSelection (event.GetInt());
|
|
||||||
ProcessCommand (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user