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