Files
wxWidgets/src/motif/control.cpp
Jouk Jansen 338dd99216 Committing in .
Modifications to get rid of warnings on VMS

 Modified Files:
 	wxWindows/include/wx/utils.h wxWindows/src/common/date.cpp
 	wxWindows/src/common/datstrm.cpp
 	wxWindows/src/common/gdicmn.cpp wxWindows/src/common/image.cpp
 	wxWindows/src/common/object.cpp
 	wxWindows/src/common/sckipc.cpp
 	wxWindows/src/common/txtstrm.cpp
 	wxWindows/src/generic/fontdlgg.cpp
 	wxWindows/src/generic/listctrl.cpp
 	wxWindows/src/generic/scrolwin.cpp
 	wxWindows/src/generic/splitter.cpp wxWindows/src/motif/app.cpp
 	wxWindows/src/motif/bitmap.cpp
 	wxWindows/src/motif/bmpbuttn.cpp
 	wxWindows/src/motif/button.cpp
 	wxWindows/src/motif/checkbox.cpp
 	wxWindows/src/motif/choice.cpp wxWindows/src/motif/clipbrd.cpp
 	wxWindows/src/motif/colour.cpp
 	wxWindows/src/motif/combobox.cpp
 	wxWindows/src/motif/control.cpp wxWindows/src/motif/cursor.cpp
 	wxWindows/src/motif/dataobj.cpp
 	wxWindows/src/motif/dcclient.cpp
 	wxWindows/src/motif/dcmemory.cpp
 	wxWindows/src/motif/dcscreen.cpp
 	wxWindows/src/motif/dialog.cpp wxWindows/src/motif/filedlg.cpp
 	wxWindows/src/motif/font.cpp wxWindows/src/motif/frame.cpp
 	wxWindows/src/motif/gauge.cpp wxWindows/src/motif/icon.cpp
 	wxWindows/src/motif/listbox.cpp wxWindows/src/motif/mdi.cpp
 	wxWindows/src/motif/menu.cpp wxWindows/src/motif/menuitem.cpp
 	wxWindows/src/motif/msgdlg.cpp wxWindows/src/motif/palette.cpp
 	wxWindows/src/motif/radiobox.cpp
 	wxWindows/src/motif/radiobut.cpp
 	wxWindows/src/motif/region.cpp
 	wxWindows/src/motif/scrolbar.cpp
 	wxWindows/src/motif/settings.cpp
 	wxWindows/src/motif/slider.cpp wxWindows/src/motif/statbmp.cpp
 	wxWindows/src/motif/statbox.cpp
 	wxWindows/src/motif/stattext.cpp
 	wxWindows/src/motif/textctrl.cpp wxWindows/src/motif/timer.cpp
 	wxWindows/src/motif/toolbar.cpp wxWindows/src/motif/utils.cpp
 	wxWindows/src/motif/window.cpp wxWindows/src/unix/fontutil.cpp
 	wxWindows/src/unix/utilsunx.cpp
 ----------------------------------------------------------------------


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1999-11-18 14:30:10 +00:00

116 lines
2.4 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: control.cpp
// Purpose: wxControl class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "control.h"
#endif
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/utils.h"
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxWindow)
END_EVENT_TABLE()
#endif
// Item members
wxControl::wxControl()
{
m_backgroundColour = *wxWHITE;
m_foregroundColour = *wxBLACK;
#if WXWIN_COMPATIBILITY
m_callback = 0;
#endif // WXWIN_COMPATIBILITY
m_inSetValue = FALSE;
}
wxControl::~wxControl()
{
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
if (panel)
{
if (panel->GetDefaultItem() == this)
panel->SetDefaultItem((wxButton*) NULL);
}
}
void wxControl::SetLabel(const wxString& label)
{
Widget widget = (Widget) GetLabelWidget() ;
if (!widget)
return;
wxStripMenuCodes((char*) (const char*) label, wxBuffer);
XmString text = XmStringCreateSimple (wxBuffer);
XtVaSetValues (widget,
XmNlabelString, text,
XmNlabelType, XmSTRING,
NULL);
XmStringFree (text);
}
wxString wxControl::GetLabel() const
{
Widget widget = (Widget) GetLabelWidget() ;
if (!widget)
return wxEmptyString;
XmString text;
char *s;
XtVaGetValues (widget,
XmNlabelString, &text,
NULL);
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
{
wxString str(s);
XtFree (s);
XmStringFree(text);
return str;
}
else
{
// XmStringFree(text);
return wxEmptyString;
}
}
bool wxControl::ProcessCommand(wxCommandEvent & event)
{
#if WXWIN_COMPATIBILITY
if ( m_callback )
{
(void)(*m_callback)(this, event);
return TRUE;
}
else
#endif // WXWIN_COMPATIBILITY
return GetEventHandler()->ProcessEvent(event);
}