]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/univ/choice.cpp
Rename delegates to try and stop name clashes, probably with wxWebKitCtrl.
[wxWidgets.git] / src / univ / choice.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/univ/choice.cpp
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)
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#if wxUSE_CHOICE
27
28#include "wx/choice.h"
29
30#ifndef WX_PRECOMP
31 #include "wx/arrstr.h"
32#endif
33
34BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
35 EVT_COMBOBOX(wxID_ANY, wxChoice::OnComboBox)
36END_EVENT_TABLE()
37
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
63bool wxChoice::Create(wxWindow *parent, wxWindowID id,
64 const wxPoint& pos,
65 const wxSize& size,
66 int n, const wxString choices[],
67 long WXUNUSED(style),
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