]> git.saurik.com Git - wxWidgets.git/blame - src/common/choiccmn.cpp
Fix memory leak by letting the base class version handle the
[wxWidgets.git] / src / common / choiccmn.cpp
CommitLineData
2d61b48d
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: common/choiccmn.cpp
3// Purpose: common (to all ports) wxChoice functions
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 26.07.99
7// RCS-ID: $Id$
77ffb593
JS
8// Copyright: (c) wxWidgets team
9// Licence: wxWidgets licence
2d61b48d
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
14f355c2 20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
1b68e0b5 21 #pragma implementation "choicebase.h"
2d61b48d
VZ
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
1e6feb95
VZ
31#if wxUSE_CHOICE
32
2d61b48d
VZ
33#ifndef WX_PRECOMP
34 #include "wx/choice.h"
2d61b48d
VZ
35#endif
36
37// ============================================================================
38// implementation
39// ============================================================================
40
799ea011
GD
41wxChoiceBase::~wxChoiceBase()
42{
43 // this destructor is required for Darwin
44}
45
2d61b48d 46// ----------------------------------------------------------------------------
6c8a980f 47// selection
2d61b48d
VZ
48// ----------------------------------------------------------------------------
49
6c8a980f 50bool wxChoiceBase::SetStringSelection(const wxString& s)
2d61b48d 51{
6c8a980f
VZ
52 int sel = FindString(s);
53 wxCHECK_MSG( sel != -1, FALSE,
54 wxT("invalid string in wxChoice::SetStringSelection") );
2d61b48d 55
6c8a980f 56 Select(sel);
2d61b48d
VZ
57
58 return TRUE;
59}
60
61// ----------------------------------------------------------------------------
6c8a980f 62// misc
2d61b48d
VZ
63// ----------------------------------------------------------------------------
64
6c8a980f 65void wxChoiceBase::Command(wxCommandEvent& event)
2d61b48d 66{
6c8a980f
VZ
67 SetSelection(event.m_commandInt);
68 (void)ProcessEvent(event);
2d61b48d 69}
1e6feb95
VZ
70
71#endif // wxUSE_CHOICE
72