]> git.saurik.com Git - wxWidgets.git/blob - src/common/ctrlcmn.cpp
wxChoice/wxComboBox background colour change (to get back to where we were);
[wxWidgets.git] / src / common / ctrlcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: ctrlcmn.cpp
3 // Purpose: wxControl common interface
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__
21 #pragma implementation "controlbase.h"
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
31 #ifndef WX_PRECOMP
32 #include "wx/control.h"
33 #include "wx/log.h"
34 #endif
35
36 // ============================================================================
37 // implementation
38 // ============================================================================
39
40 bool wxControlBase::CreateControl(wxWindowBase *parent,
41 wxWindowID id,
42 const wxPoint& pos,
43 const wxSize& size,
44 long style,
45 #if wxUSE_VALIDATORS
46 const wxValidator& validator,
47 #endif
48 const wxString& name)
49 {
50 // even if it's possible to create controls without parents in some port,
51 // it should surely be discouraged because it doesn't work at all under
52 // Windows
53 wxCHECK_MSG( parent, FALSE, wxT("all controls must have parents") );
54
55 if ( !CreateBase(parent, id, pos, size, style, validator, name) )
56 return FALSE;
57
58 parent->AddChild(this);
59
60 return TRUE;
61 }
62
63 // inherit colour and font settings from the parent window
64 void wxControlBase::InheritAttributes()
65 {
66 SetBackgroundColour(GetParent()->GetBackgroundColour());
67 SetForegroundColour(GetParent()->GetForegroundColour());
68 SetFont(GetParent()->GetFont());
69 }
70
71 void wxControlBase::Command(wxCommandEvent& event)
72 {
73 (void)ProcessEvent(event);
74 }