// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
- // Allows processing the tab key to go to the next control
- if (event.GetKeyCode() == WXK_TAB)
- {
- wxNavigationKeyEvent NavEvent;
- NavEvent.SetEventObject(this);
- NavEvent.SetDirection(true);
- NavEvent.SetWindowChange(false);
-
- // Get the parent of the combo and have it process the navigation?
- if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
+ // Allows processing the tab key to go to the next control
+ if (event.GetKeyCode() == WXK_TAB)
+ {
+ wxNavigationKeyEvent NavEvent;
+ NavEvent.SetEventObject(this);
+ NavEvent.SetDirection(true);
+ NavEvent.SetWindowChange(false);
+
+ // Get the parent of the combo and have it process the navigation?
+ if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
// but this is less complicated than dealing with idle-ness, and is much better than nothing
void OnKeyUp( wxKeyEvent& event )
{
// but this is less complicated than dealing with idle-ness, and is much better than nothing
void OnKeyUp( wxKeyEvent& event )
{
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_cb->GetId());
event.SetString( GetValue() );
event.SetEventObject( m_cb );
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_cb->GetId());
event.SetString( GetValue() );
event.SetEventObject( m_cb );
-void wxComboBox::DoMoveWindow(int x, int y, int width, int height)
+void wxComboBox::DoMoveWindow(int x, int y, int width, int height)
{
wxControl::DoMoveWindow(x, y, width , height );
{
wxControl::DoMoveWindow(x, y, width , height );
m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1 );
// put it at an inset of 1 to have outer area shadows drawn as well
m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , TEXTFOCUSBORDER, m_choice->GetPopupWidth() , -1);
m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1 );
// put it at an inset of 1 to have outer area shadows drawn as well
m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , TEXTFOCUSBORDER, m_choice->GetPopupWidth() , -1);
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
DoSetSize(pos.x, pos.y, csize.x, csize.y);
DoSetSize(pos.x, pos.y, csize.x, csize.y);
for ( int i = 0 ; i < n ; i++ )
{
m_choice->DoAppend( choices[ i ] );
}
SetBestSize(size); // Needed because it is a wxControlWithItems
for ( int i = 0 ; i < n ; i++ )
{
m_choice->DoAppend( choices[ i ] );
}
SetBestSize(size); // Needed because it is a wxControlWithItems
- int s = FindString (sel);
- if (s > -1)
- {
- SetSelection (s);
- return TRUE;
- }
+ 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();
- m_choice->SetString( n , s ) ;
+ 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;
{
/* For consistency with other platforms, clicking in the text area does not constitute a selection
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
event.SetString(GetStringSelection());
{
/* For consistency with other platforms, clicking in the text area does not constitute a selection
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
event.SetString(GetStringSelection());