]> git.saurik.com Git - wxWidgets.git/blame - src/motif/stattext.cpp
Fixed remaining int vs. long warnings.
[wxWidgets.git] / src / motif / stattext.cpp
CommitLineData
4bb6408c
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: stattext.cpp
3// Purpose: wxStaticText
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
31528cd3 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "stattext.h"
14#endif
15
16#include "wx/app.h"
17#include "wx/stattext.h"
18
19#include <stdio.h>
20
338dd992
JJ
21#ifdef __VMS__
22#pragma message disable nosimpint
23#endif
02e8b2f9
JS
24#include <Xm/Label.h>
25#include <Xm/LabelG.h>
26#include <Xm/PushBG.h>
338dd992
JJ
27#ifdef __VMS__
28#pragma message enable nosimpint
29#endif
02e8b2f9 30
4bb6408c 31IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
4bb6408c
JS
32
33bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
34 const wxString& label,
35 const wxPoint& pos,
36 const wxSize& size,
37 long style,
38 const wxString& name)
39{
a4294b78
JS
40 SetName(name);
41 if (parent) parent->AddChild(this);
4bb6408c 42
0d57be45
JS
43 m_backgroundColour = parent->GetBackgroundColour();
44 m_foregroundColour = parent->GetForegroundColour();
4bb6408c 45
a4294b78 46 if ( id == -1 )
31528cd3 47 m_windowId = (int)NewControlId();
a4294b78 48 else
31528cd3 49 m_windowId = id;
4bb6408c 50
a4294b78 51 m_windowStyle = style;
da175b2c 52 m_font = parent->GetFont();
4bb6408c 53
7a4b8f27 54#if 0 // gcc 2.95 doesn't like this apparently
a4294b78 55 char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
7a4b8f27
MB
56#endif
57
a4294b78 58 Widget parentWidget = (Widget) parent->GetClientWidget();
02e8b2f9 59
7a4b8f27 60#if 0 // gcc 2.95 doesn't like this apparently
8cbd2bde
JS
61 // Use XmStringCreateLtoR(), since XmStringCreateSimple
62 // doesn't obey separators.
63// XmString text = XmStringCreateSimple (label1);
64 XmString text = XmStringCreateLtoR (label1, XmSTRING_DEFAULT_CHARSET);
7a4b8f27
MB
65#endif // 0
66
67 XmString text = XmStringCreateLtoR ((char *)(const char*)label, XmSTRING_DEFAULT_CHARSET);
68
da175b2c 69 XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
ea57084d 70
a4294b78 71 m_mainWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
02e8b2f9
JS
72 xmLabelWidgetClass,
73 parentWidget,
ea57084d 74 XmNfontList, fontList,
02e8b2f9
JS
75 XmNlabelString, text,
76 XmNalignment,
77 ((style & wxALIGN_RIGHT) ? XmALIGNMENT_END :
78 ((style & wxALIGN_CENTRE) ? XmALIGNMENT_CENTER :
79 XmALIGNMENT_BEGINNING)),
80 NULL);
81
a4294b78 82 XmStringFree (text);
02e8b2f9 83
a4294b78
JS
84 SetCanAddEventHandler(TRUE);
85 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
02e8b2f9 86
0d57be45 87 ChangeBackgroundColour ();
4bb6408c 88
a4294b78 89 return TRUE;
4bb6408c
JS
90}
91
4b5f3fe6 92void wxStaticText::ChangeFont(bool keepOriginalSize)
0d57be45 93{
4b5f3fe6 94 wxWindow::ChangeFont(keepOriginalSize);
0d57be45
JS
95}
96
97void wxStaticText::ChangeBackgroundColour()
98{
321db4b6 99 wxWindow::ChangeBackgroundColour();
0d57be45
JS
100}
101
102void wxStaticText::ChangeForegroundColour()
103{
321db4b6 104 wxWindow::ChangeForegroundColour();
0d57be45
JS
105}
106