]> git.saurik.com Git - wxWidgets.git/blame - src/univ/choice.cpp
Rework the wxCusor ctor taking wx stock number to provide as many cursors as
[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
34IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
35
36BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
a290fa5a 37 EVT_COMBOBOX(wxID_ANY, wxChoice::OnComboBox)
926592a8
VS
38END_EVENT_TABLE()
39
584ad2a3
MB
40wxChoice::wxChoice(wxWindow *parent, wxWindowID id,
41 const wxPoint& pos,
42 const wxSize& size,
43 const wxArrayString& choices,
44 long style,
45 const wxValidator& validator,
46 const wxString& name)
47{
48 Create(parent, id, pos, size, choices, style, validator, name);
49}
50
51bool wxChoice::Create(wxWindow *parent, wxWindowID id,
52 const wxPoint& pos,
53 const wxSize& size,
54 const wxArrayString& choices,
55 long style,
56 const wxValidator& validator,
57 const wxString& name)
58{
59 wxCArrayString chs(choices);
60
61 return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
62 style, validator, name);
63}
64
926592a8
VS
65bool wxChoice::Create(wxWindow *parent, wxWindowID id,
66 const wxPoint& pos,
67 const wxSize& size,
68 int n, const wxString choices[],
61fef19b 69 long WXUNUSED(style),
926592a8
VS
70 const wxValidator& validator,
71 const wxString& name)
72{
73 wxString value;
74 if ( n )
75 value = choices[0];
76 return wxComboBox::Create(parent, id, value,
77 pos, size, n, choices,
78 wxCB_READONLY, validator, name);
79}
80
81
82void wxChoice::OnComboBox(wxCommandEvent& event)
83{
84 if ( event.GetId() == GetId() )
85 {
86 event.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED);
87 event.Skip();
88 GetEventHandler()->ProcessEvent(event);
89 }
90 else
91 event.Skip();
92}
93
94#endif // wxUSE_CHOICE