]> git.saurik.com Git - wxWidgets.git/blame - src/motif/control.cpp
correct wxDateTime DST begin/end computations for years > 2006 in USA (closes #10425)
[wxWidgets.git] / src / motif / control.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
7520f3da 2// Name: src/motif/control.cpp
4bb6408c
JS
3// Purpose: wxControl class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
1248b41f
MB
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
4bb6408c 15#include "wx/control.h"
de6185e2
WS
16
17#ifndef WX_PRECOMP
18 #include "wx/utils.h"
8e609c82 19 #include "wx/panel.h"
de6185e2
WS
20#endif
21
338dd992
JJ
22#ifdef __VMS__
23#pragma message disable nosimpint
24#endif
02e8b2f9 25#include <Xm/Xm.h>
338dd992
JJ
26#ifdef __VMS__
27#pragma message enable nosimpint
28#endif
4bb6408c 29
ea19087e
JS
30#include "wx/motif/private.h"
31
4bb6408c
JS
32IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
33
34BEGIN_EVENT_TABLE(wxControl, wxWindow)
35END_EVENT_TABLE()
4bb6408c
JS
36
37// Item members
38wxControl::wxControl()
39{
0c02f070 40 m_inSetValue = false;
4bb6408c
JS
41}
42
5a2155ef 43bool wxControl::Create( wxWindow *parent,
0148fe1e
VZ
44 wxWindowID id,
45 const wxPoint &pos,
46 const wxSize &size,
47 long style,
48 const wxValidator& validator,
49 const wxString &name)
50{
5a2155ef 51 bool ret = wxWindow::Create(parent, id, pos, size, style, name);
674ac8b9
VZ
52
53#if wxUSE_VALIDATORS
0148fe1e 54 SetValidator(validator);
0148fe1e 55#endif
5a2155ef
BJ
56
57 return ret;
674ac8b9 58}
0148fe1e 59
ec75d791
MB
60bool wxControl::CreateControl(wxWindow *parent,
61 wxWindowID id,
62 const wxPoint& pos,
63 const wxSize& size,
64 long style,
65 const wxValidator& validator,
66 const wxString& name)
67{
68 if( !wxControlBase::CreateControl( parent, id, pos, size, style,
69 validator, name ) )
0c02f070 70 return false;
ec75d791 71
0c02f070 72 return true;
ec75d791
MB
73}
74
4bb6408c
JS
75void wxControl::SetLabel(const wxString& label)
76{
a4294b78
JS
77 Widget widget = (Widget) GetLabelWidget() ;
78 if (!widget)
79 return;
dfe1eee3 80
32cd189d 81 wxXmString label_str(GetLabelText(label));
dfe1eee3 82
a4294b78 83 XtVaSetValues (widget,
ea19087e 84 XmNlabelString, label_str(),
2d120f83
JS
85 XmNlabelType, XmSTRING,
86 NULL);
4bb6408c
JS
87}
88
89wxString wxControl::GetLabel() const
90{
a4294b78
JS
91 Widget widget = (Widget) GetLabelWidget() ;
92 if (!widget)
93 return wxEmptyString;
dfe1eee3 94
88793548 95 XmString text = NULL;
a4294b78 96 XtVaGetValues (widget,
2d120f83
JS
97 XmNlabelString, &text,
98 NULL);
dfe1eee3 99
da494b40 100 return wxXmStringToString( text );
4bb6408c
JS
101}
102
31528cd3 103bool wxControl::ProcessCommand(wxCommandEvent & event)
4bb6408c 104{
937013e0 105 return HandleWindowEvent(event);
4bb6408c 106}
0c02f070
MB
107
108wxSize wxControl::DoGetBestSize() const
109{
110 Widget w = (Widget)GetTopWidget();
111
112 // Do not return any arbitrary default value...
113 wxASSERT_MSG (w, wxT("DoGetBestSize called before creation"));
114
115 XtWidgetGeometry preferred;
116 XtQueryGeometry (w, NULL, &preferred);
117
118 return wxSize(preferred.width, preferred.height);
119}