]> git.saurik.com Git - wxWidgets.git/blob - src/common/ctrlcmn.cpp
OnEnter/OnDragOver API update (compiles, links, somewhat runs under wxGTK)
[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 const wxValidator& validator,
46 const wxString& name)
47 {
48 // even if it's possible to create controls without parents in some port,
49 // it should surely be discouraged because it doesn't work at all under
50 // Windows
51 wxCHECK_MSG( parent, FALSE, wxT("all controls must have parents") );
52
53 if ( !CreateBase(parent, id, pos, size, style, validator, name) )
54 return FALSE;
55
56 parent->AddChild(this);
57
58 return TRUE;
59 }
60
61 // inherit colour and font settings from the parent window
62 void wxControlBase::InheritAttributes()
63 {
64 SetBackgroundColour(GetParent()->GetBackgroundColour());
65 SetForegroundColour(GetParent()->GetForegroundColour());
66 SetFont(GetParent()->GetFont());
67 }
68
69 void wxControlBase::Command(wxCommandEvent& event)
70 {
71 (void)ProcessEvent(event);
72 }