-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
- m_macIsUserPane = false;
-#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