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