]> git.saurik.com Git - wxWidgets.git/blame - src/univ/choice.cpp
reSWIGged
[wxWidgets.git] / src / univ / choice.cpp
CommitLineData
926592a8
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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
14f355c2 20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
926592a8
VS
21 #pragma implementation "univchoice.h"
22#endif
23
24#include "wx/wxprec.h"
25
26#ifdef __BORLANDC__
27 #pragma hdrstop
28#endif
29
30#if wxUSE_CHOICE
31
32#ifndef WX_PRECOMP
33 #include "wx/choice.h"
34#endif
35
36IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
37
38BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
39 EVT_COMBOBOX(-1, wxChoice::OnComboBox)
40END_EVENT_TABLE()
41
1169a919
JS
42wxChoice::wxChoice()
43{
44}
45
46wxChoice::wxChoice(wxWindow *parent,
47 wxWindowID id,
48 const wxPoint& pos,
49 const wxSize& size,
50 int n,
51 const wxString choices[],
52 long style,
53 const wxValidator& validator,
54 const wxString& name)
55{
56 Create(parent, id, pos, size, n, choices, style, validator, name);
57}
58
926592a8
VS
59bool wxChoice::Create(wxWindow *parent, wxWindowID id,
60 const wxPoint& pos,
61 const wxSize& size,
62 int n, const wxString choices[],
61fef19b 63 long WXUNUSED(style),
926592a8
VS
64 const wxValidator& validator,
65 const wxString& name)
66{
67 wxString value;
68 if ( n )
69 value = choices[0];
70 return wxComboBox::Create(parent, id, value,
71 pos, size, n, choices,
72 wxCB_READONLY, validator, name);
73}
74
75
76void wxChoice::OnComboBox(wxCommandEvent& event)
77{
78 if ( event.GetId() == GetId() )
79 {
80 event.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED);
81 event.Skip();
82 GetEventHandler()->ProcessEvent(event);
83 }
84 else
85 event.Skip();
86}
87
88#endif // wxUSE_CHOICE