]> git.saurik.com Git - wxWidgets.git/blame - src/motif/control.cpp
libpng vulnerability CAN-2004-0421
[wxWidgets.git] / src / motif / control.cpp
CommitLineData
4bb6408c
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.cpp
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
dfe1eee3 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
14f355c2 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
4bb6408c
JS
13#pragma implementation "control.h"
14#endif
15
f6045f99
GD
16#include "wx/defs.h"
17
4bb6408c 18#include "wx/control.h"
dfe1eee3 19#include "wx/panel.h"
02e8b2f9
JS
20#include "wx/utils.h"
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{
40 m_backgroundColour = *wxWHITE;
41 m_foregroundColour = *wxBLACK;
31528cd3 42
a4294b78 43 m_inSetValue = FALSE;
4bb6408c
JS
44}
45
5a2155ef 46bool wxControl::Create( wxWindow *parent,
0148fe1e
VZ
47 wxWindowID id,
48 const wxPoint &pos,
49 const wxSize &size,
50 long style,
51 const wxValidator& validator,
52 const wxString &name)
53{
5a2155ef 54 bool ret = wxWindow::Create(parent, id, pos, size, style, name);
674ac8b9
VZ
55
56#if wxUSE_VALIDATORS
0148fe1e 57 SetValidator(validator);
0148fe1e 58#endif
5a2155ef
BJ
59
60 return ret;
674ac8b9 61}
0148fe1e 62
ec75d791
MB
63bool wxControl::CreateControl(wxWindow *parent,
64 wxWindowID id,
65 const wxPoint& pos,
66 const wxSize& size,
67 long style,
68 const wxValidator& validator,
69 const wxString& name)
70{
71 if( !wxControlBase::CreateControl( parent, id, pos, size, style,
72 validator, name ) )
73 return FALSE;
74
75 m_backgroundColour = parent->GetBackgroundColour();
76 m_foregroundColour = parent->GetForegroundColour();
77 m_font = parent->GetFont();
78
79 return TRUE;
80}
81
4bb6408c
JS
82void wxControl::SetLabel(const wxString& label)
83{
a4294b78
JS
84 Widget widget = (Widget) GetLabelWidget() ;
85 if (!widget)
86 return;
dfe1eee3 87
ed0c2af3 88 wxXmString label_str(wxStripMenuCodes(label));
dfe1eee3 89
a4294b78 90 XtVaSetValues (widget,
ea19087e 91 XmNlabelString, label_str(),
2d120f83
JS
92 XmNlabelType, XmSTRING,
93 NULL);
4bb6408c
JS
94}
95
96wxString wxControl::GetLabel() const
97{
a4294b78
JS
98 Widget widget = (Widget) GetLabelWidget() ;
99 if (!widget)
100 return wxEmptyString;
dfe1eee3 101
88793548 102 XmString text = NULL;
a4294b78 103 XtVaGetValues (widget,
2d120f83
JS
104 XmNlabelString, &text,
105 NULL);
dfe1eee3 106
da494b40 107 return wxXmStringToString( text );
4bb6408c
JS
108}
109
31528cd3 110bool wxControl::ProcessCommand(wxCommandEvent & event)
4bb6408c 111{
31528cd3 112 return GetEventHandler()->ProcessEvent(event);
4bb6408c 113}