// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "combobox.h"
#endif
+#include "wx/wxprec.h"
+
#include "wx/combobox.h"
#include "wx/button.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
#if TARGET_API_MAC_OSX
#ifndef __HIVIEW__
- #include <HIToolbox/HIView.h>
+ #include <HIToolbox/HIView.h>
#endif
#endif
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
-#endif
// composite combobox implementation by Dan "Bud" Keith bud@otsys.com
event.SetEventObject(def);
def->Command(event);
return ;
- }
+ }
}
return;
};
BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
- EVT_CHOICE(-1, wxComboBoxChoice::OnChoice)
+ EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice)
END_EVENT_TABLE()
wxComboBox::~wxComboBox()
wxSize wxComboBox::DoGetBestSize() const
{
#if USE_HICOMBOBOX
- return wxControl::DoGetBestSize();
+ return wxControl::DoGetBestSize();
#else
wxSize size = m_choice->GetBestSize();
void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
#if USE_HICOMBOBOX
- wxControl::DoMoveWindow(x, y, width, height);
+ wxControl::DoMoveWindow(x, y, width, height);
#else
height = POPUPHEIGHT;
{
// we might not be fully constructed yet, therefore watch out...
if ( m_choice )
- m_choice->SetSize(0, 0 , width, -1);
+ 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, -1);
+ m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord);
}
#endif
}
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
void wxComboBox::SetFocus()
{
#if USE_HICOMBOBOX
- wxControl::SetFocus();
+ wxControl::SetFocus();
#else
if ( m_text != NULL) {
m_text->SetFocus();
m_text = NULL;
m_choice = NULL;
#if USE_HICOMBOBOX
- m_macIsUserPane = FALSE ;
+ m_macIsUserPane = false ;
#endif
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
- return FALSE;
+ return false;
}
#if USE_HICOMBOBOX
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
//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() ;
+ //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 ) );
else
{
m_text = new wxComboBoxText(this);
- if ( size.y == -1 ) {
+ if ( size.y == wxDefaultCoord ) {
csize.y = m_text->GetSize().y ;
}
}
SetBestSize(csize); // Needed because it is a wxControlWithItems
#endif
- return TRUE;
+ return true;
}
wxString wxComboBox::GetValue() const
return 0;
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
// TODO
return 0;
int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX
- return (int) HIComboBoxGetItemCount( *m_peer );
+ return (int) HIComboBoxGetItemCount( *m_peer );
#else
- return m_choice->GetCount() ;
+ return m_choice->GetCount() ;
#endif
}
#if USE_HICOMBOBOX
for( int i = 0 ; i < GetCount() ; i++ )
{
- if ( GetString( i ).IsSameAs(s, FALSE) )
+ if ( GetString( i ).IsSameAs(s, false) )
return i ;
}
return wxNOT_FOUND ;
#endif
}
-bool wxComboBox::SetStringSelection(const wxString& sel)
-{
- int s = FindString (sel);
- if (s > -1)
- {
- SetSelection (s);
- return TRUE;
- }
- else
- return FALSE;
-}
-
void wxComboBox::SetString(int n, const wxString& s)
{
#if USE_HICOMBOBOX
bool wxComboBox::IsEditable() const
{
#if USE_HICOMBOBOX
- // TODO
- return !HasFlag(wxCB_READONLY);
+ // TODO
+ return !HasFlag(wxCB_READONLY);
#else
- return m_text != NULL && !HasFlag(wxCB_READONLY);
+ return m_text != NULL && !HasFlag(wxCB_READONLY);
#endif
}
void wxComboBox::Undo()
{
#if USE_HICOMBOBOX
- // TODO
+ // TODO
#else
if (m_text != NULL)
m_text->Undo();
void wxComboBox::Redo()
{
#if USE_HICOMBOBOX
- // TODO
+ // TODO
#else
if (m_text != NULL)
m_text->Redo();
void wxComboBox::SelectAll()
{
#if USE_HICOMBOBOX
- // TODO
+ // TODO
#else
if (m_text != NULL)
m_text->SelectAll();
bool wxComboBox::CanCopy() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanCopy();
bool wxComboBox::CanCut() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanCut();
bool wxComboBox::CanPaste() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanPaste();
bool wxComboBox::CanUndo() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanUndo();
bool wxComboBox::CanRedo() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanRedo();
ProcessCommand(event);
return noErr ;
}
-