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