]>
git.saurik.com Git - wxWidgets.git/blob - src/stubs/control.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "control.h"
16 #include "wx/control.h"
18 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
20 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
24 wxControl::wxControl()
26 m_backgroundColour
= *wxWHITE
;
27 m_foregroundColour
= *wxBLACK
;
31 wxControl::~wxControl()
33 // If we delete an item, we should initialize the parent panel,
34 // because it could now be invalid.
35 wxWindow
*parent
= (wxWindow
*)GetParent();
38 if (parent
->GetDefaultItem() == (wxButton
*) this)
39 parent
->SetDefaultItem(NULL
);
43 void wxControl::SetLabel(const wxString
& label
)
48 wxString
wxControl::GetLabel() const
54 void wxControl::ProcessCommand (wxCommandEvent
& event
)
57 // 1) A callback function (to become obsolete)
58 // 2) OnCommand, starting at this window and working up parent hierarchy
59 // 3) OnCommand then calls ProcessEvent to search the event tables.
62 (void) (*(m_callback
)) (*this, event
);
66 GetEventHandler()->OnCommand(*this, event
);
70 void wxControl::Centre (int direction
)
72 int x
, y
, width
, height
, panel_width
, panel_height
, new_x
, new_y
;
74 wxWindow
*parent
= (wxWindow
*) GetParent ();
78 parent
->GetClientSize (&panel_width
, &panel_height
);
79 GetSize (&width
, &height
);
85 if (direction
& wxHORIZONTAL
)
86 new_x
= (int) ((panel_width
- width
) / 2);
88 if (direction
& wxVERTICAL
)
89 new_y
= (int) ((panel_height
- height
) / 2);
91 SetSize (new_x
, new_y
, width
, height
);