Commit | Line | Data |
---|---|---|
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$ | |
8 | // Copyright: (c) wxWindows team | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #ifdef __GNUG__ | |
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 | ||
41 | // ---------------------------------------------------------------------------- | |
6c8a980f | 42 | // selection |
2d61b48d VZ |
43 | // ---------------------------------------------------------------------------- |
44 | ||
6c8a980f | 45 | bool wxChoiceBase::SetStringSelection(const wxString& s) |
2d61b48d | 46 | { |
6c8a980f VZ |
47 | int sel = FindString(s); |
48 | wxCHECK_MSG( sel != -1, FALSE, | |
49 | wxT("invalid string in wxChoice::SetStringSelection") ); | |
2d61b48d | 50 | |
6c8a980f | 51 | Select(sel); |
2d61b48d VZ |
52 | |
53 | return TRUE; | |
54 | } | |
55 | ||
56 | // ---------------------------------------------------------------------------- | |
6c8a980f | 57 | // misc |
2d61b48d VZ |
58 | // ---------------------------------------------------------------------------- |
59 | ||
6c8a980f | 60 | void wxChoiceBase::Command(wxCommandEvent& event) |
2d61b48d | 61 | { |
6c8a980f VZ |
62 | SetSelection(event.m_commandInt); |
63 | (void)ProcessEvent(event); | |
2d61b48d | 64 | } |
1e6feb95 VZ |
65 | |
66 | #endif // wxUSE_CHOICE | |
67 |