]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/control.cpp
fixed bug introduced by my previous GtkUpdateSize() commit
[wxWidgets.git] / src / gtk / control.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.cpp
3// Purpose:
4// Author: Robert Roebling
dbf858b5 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling, Julian Smart and Vadim Zeitlin
32c77a71 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation "control.h"
12#endif
13
1e6feb95
VZ
14#include "wx/defs.h"
15
16#if wxUSE_CONTROLS
17
c801d85f
KB
18#include "wx/control.h"
19
071a2d78 20#include <gtk/gtk.h>
034be888 21
c801d85f
KB
22//-----------------------------------------------------------------------------
23// wxControl
24//-----------------------------------------------------------------------------
25
9abe166a 26IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
c801d85f 27
31528cd3 28wxControl::wxControl()
c801d85f 29{
b292e2f5 30 m_needParent = TRUE;
6de97a3b 31}
c801d85f 32
04165bec 33bool wxControl::Create( wxWindow *parent,
31528cd3
VZ
34 wxWindowID id,
35 const wxPoint &pos,
36 const wxSize &size,
37 long style,
8d772832 38 const wxValidator& validator,
04165bec 39 const wxString &name )
8d772832 40{
04165bec
RR
41 bool ret = wxWindow::Create(parent, id, pos, size, style, name);
42
43#if wxUSE_VALIDATORS
8d772832 44 SetValidator(validator);
8d772832
RD
45#endif
46
04165bec
RR
47 return ret;
48}
49
c801d85f
KB
50void wxControl::SetLabel( const wxString &label )
51{
d9ea011f 52 m_label.Empty();
223d09f6 53 for ( const wxChar *pc = label; *pc != wxT('\0'); pc++ )
b292e2f5 54 {
223d09f6 55 if ( *pc == wxT('&') )
31528cd3 56 {
b292e2f5 57 pc++; // skip it
32c77a71 58#if 0 // it would be unused anyhow for now - kbd interface not done yet
223d09f6 59 if ( *pc != wxT('&') ) m_chAccel = *pc;
32c77a71 60#endif
b292e2f5
RR
61 }
62 m_label << *pc;
32c77a71 63 }
6de97a3b 64}
c801d85f 65
9abe166a 66wxString wxControl::GetLabel() const
c801d85f 67{
b292e2f5 68 return m_label;
6de97a3b 69}
c801d85f
KB
70
71
f68586e5
VZ
72wxSize wxControl::DoGetBestSize() const
73{
0279e844
RR
74 // Do not return any arbitrary default value...
75 wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
76
f68586e5 77 GtkRequisition req;
33720b2d
RR
78 req.width = 2;
79 req.height = 2;
2afa14f2 80 (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
f68586e5
VZ
81 (m_widget, &req );
82
83 return wxSize(req.width, req.height);
84}
85
1e6feb95
VZ
86#endif // wxUSE_CONTROLS
87