]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/ctrlcmn.cpp
Replaced an old ifndef FWD_ONLY_CURSORS with the new wxODBC_FWD_ONLY_CURSORS setup...
[wxWidgets.git] / src / common / ctrlcmn.cpp
... / ...
CommitLineData
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
40bool wxControlBase::CreateControl(wxWindowBase *parent,
41 wxWindowID id,
42 const wxPoint& pos,
43 const wxSize& size,
44 long style,
45#if wxUSE_VALIDATORS
46# if defined(__VISAGECPP__)
47 const wxValidator* validator,
48# else
49 const wxValidator& validator,
50# endif
51#endif
52 const wxString& name)
53{
54 // even if it's possible to create controls without parents in some port,
55 // it should surely be discouraged because it doesn't work at all under
56 // Windows
57 wxCHECK_MSG( parent, FALSE, wxT("all controls must have parents") );
58
59 if ( !CreateBase(parent, id, pos, size, style, validator, name) )
60 return FALSE;
61
62 parent->AddChild(this);
63
64 return TRUE;
65}
66
67// inherit colour and font settings from the parent window
68void wxControlBase::InheritAttributes()
69{
70 SetBackgroundColour(GetParent()->GetBackgroundColour());
71 SetForegroundColour(GetParent()->GetForegroundColour());
72 SetFont(GetParent()->GetFont());
73}
74
75void wxControlBase::Command(wxCommandEvent& event)
76{
77 (void)ProcessEvent(event);
78}