]> git.saurik.com Git - wxWidgets.git/blame - src/univ/choice.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / univ / choice.cpp
CommitLineData
926592a8 1/////////////////////////////////////////////////////////////////////////////
b36e08d0 2// Name: src/univ/choice.cpp
926592a8
VS
3// Purpose: wxChoice implementation
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 15.12.00
926592a8 7// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 8// Licence: wxWindows licence
926592a8
VS
9/////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
926592a8
VS
19#include "wx/wxprec.h"
20
21#ifdef __BORLANDC__
22 #pragma hdrstop
23#endif
24
25#if wxUSE_CHOICE
26
b36e08d0
WS
27#include "wx/choice.h"
28
926592a8 29#ifndef WX_PRECOMP
584ad2a3 30 #include "wx/arrstr.h"
926592a8
VS
31#endif
32
926592a8 33BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
a290fa5a 34 EVT_COMBOBOX(wxID_ANY, wxChoice::OnComboBox)
926592a8
VS
35END_EVENT_TABLE()
36
584ad2a3
MB
37wxChoice::wxChoice(wxWindow *parent, wxWindowID id,
38 const wxPoint& pos,
39 const wxSize& size,
40 const wxArrayString& choices,
41 long style,
42 const wxValidator& validator,
43 const wxString& name)
44{
45 Create(parent, id, pos, size, choices, style, validator, name);
46}
47
48bool wxChoice::Create(wxWindow *parent, wxWindowID id,
49 const wxPoint& pos,
50 const wxSize& size,
51 const wxArrayString& choices,
52 long style,
53 const wxValidator& validator,
54 const wxString& name)
55{
56 wxCArrayString chs(choices);
57
58 return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
59 style, validator, name);
60}
61
926592a8
VS
62bool wxChoice::Create(wxWindow *parent, wxWindowID id,
63 const wxPoint& pos,
64 const wxSize& size,
65 int n, const wxString choices[],
61fef19b 66 long WXUNUSED(style),
926592a8
VS
67 const wxValidator& validator,
68 const wxString& name)
69{
70 wxString value;
71 if ( n )
72 value = choices[0];
73 return wxComboBox::Create(parent, id, value,
74 pos, size, n, choices,
75 wxCB_READONLY, validator, name);
76}
77
78
79void wxChoice::OnComboBox(wxCommandEvent& event)
80{
81 if ( event.GetId() == GetId() )
82 {
ce7fe42e 83 event.SetEventType(wxEVT_CHOICE);
926592a8
VS
84 event.Skip();
85 GetEventHandler()->ProcessEvent(event);
86 }
87 else
88 event.Skip();
89}
90
91#endif // wxUSE_CHOICE