]> git.saurik.com Git - wxWidgets.git/blame - src/univ/control.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / univ / control.cpp
CommitLineData
1e6feb95
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/univ/control.cpp
3// Purpose: universal wxControl: adds handling of mnemonics
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 14.08.00
442b35b5 7// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 8// Licence: wxWindows licence
1e6feb95
VZ
9/////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
1e6feb95
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19#include "wx/wxprec.h"
20
21#ifdef __BORLANDC__
22 #pragma hdrstop
23#endif
24
25#if wxUSE_CONTROLS
26
93fbbe07
WS
27#include "wx/control.h"
28
1e6feb95
VZ
29#ifndef WX_PRECOMP
30 #include "wx/app.h"
1e6feb95
VZ
31 #include "wx/dcclient.h"
32#endif
33
34#include "wx/univ/renderer.h"
35#include "wx/univ/inphand.h"
36#include "wx/univ/theme.h"
37
38// ============================================================================
39// implementation
40// ============================================================================
41
42IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
43
44BEGIN_EVENT_TABLE(wxControl, wxControlBase)
23645bfa 45 WX_EVENT_TABLE_INPUT_CONSUMER(wxControl)
1e6feb95
VZ
46END_EVENT_TABLE()
47
23645bfa
VS
48WX_FORWARD_TO_INPUT_CONSUMER(wxControl)
49
1e6feb95
VZ
50// ----------------------------------------------------------------------------
51// creation
52// ----------------------------------------------------------------------------
53
54void wxControl::Init()
55{
56 m_indexAccel = -1;
1e6feb95
VZ
57}
58
59bool wxControl::Create(wxWindow *parent,
60 wxWindowID id,
61 const wxPoint& pos,
62 const wxSize& size,
63 long style,
64 const wxValidator& validator,
65 const wxString& name)
66{
e441e1f4 67 if ( !wxControlBase::Create(parent, id, pos, size, style, validator, name) )
2387541f
VZ
68 {
69 // underlying window creation failed?
a290fa5a 70 return false;
2387541f 71 }
1e6feb95 72
a290fa5a 73 return true;
1e6feb95
VZ
74}
75
76// ----------------------------------------------------------------------------
77// mnemonics handling
78// ----------------------------------------------------------------------------
79
1e6feb95 80void wxControl::SetLabel(const wxString& label)
39bc0347
VZ
81{
82 // save original label
83 wxControlBase::SetLabel(label);
84
85 UnivDoSetLabel(label);
86}
87
88void wxControl::UnivDoSetLabel(const wxString& label)
1e6feb95
VZ
89{
90 wxString labelOld = m_label;
91 m_indexAccel = FindAccelIndex(label, &m_label);
92
93 if ( m_label != labelOld )
94 {
95 Refresh();
96 }
97}
98
1e6feb95 99#endif // wxUSE_CONTROLS