]> git.saurik.com Git - wxWidgets.git/blame - src/stubs/control.cpp
Added #include wx/dcclient.h and wx/settings.h for Vadims new code under
[wxWidgets.git] / src / stubs / control.cpp
CommitLineData
93cf77c0
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.cpp
3// Purpose: wxControl class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "control.h"
14#endif
15
16#include "wx/control.h"
17
18#if !USE_SHARED_LIBRARY
19IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
20
21BEGIN_EVENT_TABLE(wxControl, wxWindow)
22END_EVENT_TABLE()
23#endif
24
25// Item members
26wxControl::wxControl()
27{
28 m_backgroundColour = *wxWHITE;
29 m_foregroundColour = *wxBLACK;
30 m_callback = 0;
31}
32
33wxControl::~wxControl()
34{
35 // If we delete an item, we should initialize the parent panel,
36 // because it could now be invalid.
37 wxWindow *parent = (wxWindow *)GetParent();
38 if (parent)
39 {
34138703 40 if (parent->GetDefaultItem() == (wxButton*) this)
93cf77c0
JS
41 parent->SetDefaultItem(NULL);
42 }
43}
44
45void wxControl::SetLabel(const wxString& label)
46{
47 // TODO
48}
49
50wxString wxControl::GetLabel() const
51{
52 // TODO
53 return wxString("");
54}
55
93cf77c0
JS
56void wxControl::ProcessCommand (wxCommandEvent & event)
57{
58 // Tries:
59 // 1) A callback function (to become obsolete)
60 // 2) OnCommand, starting at this window and working up parent hierarchy
61 // 3) OnCommand then calls ProcessEvent to search the event tables.
62 if (m_callback)
63 {
64 (void) (*(m_callback)) (*this, event);
65 }
66 else
67 {
68 GetEventHandler()->OnCommand(*this, event);
69 }
70}
71
93cf77c0
JS
72void wxControl::Centre (int direction)
73{
74 int x, y, width, height, panel_width, panel_height, new_x, new_y;
75
76 wxWindow *parent = (wxWindow *) GetParent ();
77 if (!parent)
78 return;
79
80 parent->GetClientSize (&panel_width, &panel_height);
81 GetSize (&width, &height);
82 GetPosition (&x, &y);
83
84 new_x = x;
85 new_y = y;
86
87 if (direction & wxHORIZONTAL)
88 new_x = (int) ((panel_width - width) / 2);
89
90 if (direction & wxVERTICAL)
91 new_y = (int) ((panel_height - height) / 2);
92
93 SetSize (new_x, new_y, width, height);
94}
95