]> git.saurik.com Git - wxWidgets.git/blame - src/motif/stattext.cpp
added wxUSE_TOOLBAR_SIMPLE setting, enabled wxLongLong in configure by default
[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
JS
31#if !USE_SHARED_LIBRARY
32IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
33#endif
34
35bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
36 const wxString& label,
37 const wxPoint& pos,
38 const wxSize& size,
39 long style,
40 const wxString& name)
41{
a4294b78
JS
42 SetName(name);
43 if (parent) parent->AddChild(this);
4bb6408c 44
0d57be45
JS
45 m_backgroundColour = parent->GetBackgroundColour();
46 m_foregroundColour = parent->GetForegroundColour();
4bb6408c 47
a4294b78 48 if ( id == -1 )
31528cd3 49 m_windowId = (int)NewControlId();
a4294b78 50 else
31528cd3 51 m_windowId = id;
4bb6408c 52
a4294b78 53 m_windowStyle = style;
da175b2c 54 m_font = parent->GetFont();
4bb6408c 55
7a4b8f27 56#if 0 // gcc 2.95 doesn't like this apparently
a4294b78 57 char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
7a4b8f27
MB
58#endif
59
a4294b78 60 Widget parentWidget = (Widget) parent->GetClientWidget();
02e8b2f9 61
7a4b8f27 62#if 0 // gcc 2.95 doesn't like this apparently
8cbd2bde
JS
63 // Use XmStringCreateLtoR(), since XmStringCreateSimple
64 // doesn't obey separators.
65// XmString text = XmStringCreateSimple (label1);
66 XmString text = XmStringCreateLtoR (label1, XmSTRING_DEFAULT_CHARSET);
7a4b8f27
MB
67#endif // 0
68
69 XmString text = XmStringCreateLtoR ((char *)(const char*)label, XmSTRING_DEFAULT_CHARSET);
70
da175b2c 71 XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
ea57084d 72
a4294b78 73 m_mainWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
02e8b2f9
JS
74 xmLabelWidgetClass,
75 parentWidget,
ea57084d 76 XmNfontList, fontList,
02e8b2f9
JS
77 XmNlabelString, text,
78 XmNalignment,
79 ((style & wxALIGN_RIGHT) ? XmALIGNMENT_END :
80 ((style & wxALIGN_CENTRE) ? XmALIGNMENT_CENTER :
81 XmALIGNMENT_BEGINNING)),
82 NULL);
83
a4294b78 84 XmStringFree (text);
02e8b2f9 85
a4294b78
JS
86 SetCanAddEventHandler(TRUE);
87 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
02e8b2f9 88
0d57be45 89 ChangeBackgroundColour ();
4bb6408c 90
a4294b78 91 return TRUE;
4bb6408c
JS
92}
93
4b5f3fe6 94void wxStaticText::ChangeFont(bool keepOriginalSize)
0d57be45 95{
4b5f3fe6 96 wxWindow::ChangeFont(keepOriginalSize);
0d57be45
JS
97}
98
99void wxStaticText::ChangeBackgroundColour()
100{
321db4b6 101 wxWindow::ChangeBackgroundColour();
0d57be45
JS
102}
103
104void wxStaticText::ChangeForegroundColour()
105{
321db4b6 106 wxWindow::ChangeForegroundColour();
0d57be45
JS
107}
108