- SetName(name);
-#if wxUSE_VALIDATORS
- SetValidator(validator);
-#endif
- if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetBackgroundColour()) ;
- SetForegroundColour(parent->GetForegroundColour()) ;
-
- m_windowStyle = style;
-
- if ( id == -1 )
- m_windowId = (int)NewControlId();
- else
- m_windowId = id;
-
- int x = pos.x;
- int y = pos.y;
- int width = size.x;
- int height = size.y;
-// TODO:
-/*
- long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |
- CBS_NOINTEGRALHEIGHT;
-
- if (m_windowStyle & wxCB_READONLY)
- msStyle |= CBS_DROPDOWNLIST;
- else if (m_windowStyle & wxCB_SIMPLE)
- msStyle |= CBS_SIMPLE; // A list (shown always) and edit control
- else
- msStyle |= CBS_DROPDOWN;
-
- if (m_windowStyle & wxCB_SORT)
- msStyle |= CBS_SORT;
-
- bool want3D;
- WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
-
- // Even with extended styles, need to combine with WS_BORDER
- // for them to look right.
- if ( want3D || wxStyleHasBorder(m_windowStyle) )
- msStyle |= WS_BORDER;
-
- m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("COMBOBOX"), NULL,
- msStyle,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
- wxGetInstance(), NULL);
-
- wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create combobox") );
-
- // Subclass again for purposes of dialog editing mode
- SubclassWin(m_hWnd);
-
- SetFont(parent->GetFont());
- int i;
- for (i = 0; i < n; i++)
- {
- Append(choices[i]);
- }
-
- SetSelection(i);
-
- SetSize(x, y, width, height);
- if ( !value.IsEmpty() )
- {
- SetValue(value);
- }
-*/
- return TRUE;
-}
-
-void wxComboBox::SetValue(const wxString& value)
+ long lSel = -1L;
+ wxString sValue;
+
+ switch (uParam)
+ {
+ case CBN_LBSELECT:
+ if (GetSelection() > -1)
+ {
+ wxCommandEvent vEvent( wxEVT_COMMAND_COMBOBOX_SELECTED
+ ,GetId()
+ );
+
+ vEvent.SetInt(GetSelection());
+ vEvent.SetEventObject(this);
+ vEvent.SetString((char*)GetStringSelection().c_str());
+ ProcessCommand(vEvent);
+ }
+ break;
+
+ case CBN_EFCHANGE:
+ {
+ wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED
+ ,GetId()
+ );
+
+ if (lSel == -1L)
+ sValue = GetValue();
+ else
+ SetValue(sValue);
+ vEvent.SetString((char*)GetValue().c_str());
+ vEvent.SetEventObject(this);
+ ProcessCommand(vEvent);
+ }
+ break;
+ }
+ //
+ // There is no return value for the CBN_ notifications, so always return
+ // FALSE from here to pass the message to DefWindowProc()
+ //
+ return FALSE;
+} // end of wxComboBox::OS2Command
+
+bool wxComboBox::Create(
+ wxWindow* pParent
+, wxWindowID vId
+, const wxString& rsValue
+, const wxPoint& rPos
+, const wxSize& rSize
+, int n
+, const wxString asChoices[]
+, long lStyle
+, const wxValidator& rValidator
+, const wxString& rsName
+)