]> git.saurik.com Git - wxWidgets.git/blame - src/motif/stattext.cpp
Changes to WXDLLEXPORT keyword position for VC++ 6.0; changed
[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
9// Licence: wxWindows licence
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
02e8b2f9
JS
21#include <Xm/Label.h>
22#include <Xm/LabelG.h>
23#include <Xm/PushBG.h>
24
4bb6408c
JS
25#if !USE_SHARED_LIBRARY
26IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
27#endif
28
29bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
30 const wxString& label,
31 const wxPoint& pos,
32 const wxSize& size,
33 long style,
34 const wxString& name)
35{
a4294b78
JS
36 SetName(name);
37 if (parent) parent->AddChild(this);
4bb6408c 38
0d57be45
JS
39 m_backgroundColour = parent->GetBackgroundColour();
40 m_foregroundColour = parent->GetForegroundColour();
4bb6408c 41
a4294b78
JS
42 if ( id == -1 )
43 m_windowId = (int)NewControlId();
44 else
45 m_windowId = id;
4bb6408c 46
a4294b78 47 m_windowStyle = style;
ea57084d 48 m_windowFont = parent->GetFont();
4bb6408c 49
a4294b78 50 char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
02e8b2f9 51
a4294b78 52 Widget parentWidget = (Widget) parent->GetClientWidget();
02e8b2f9 53
a4294b78 54 XmString text = XmStringCreateSimple (label1);
02e8b2f9 55
ea57084d
JS
56 XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
57
a4294b78 58 m_mainWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
02e8b2f9
JS
59 xmLabelWidgetClass,
60 parentWidget,
ea57084d 61 XmNfontList, fontList,
02e8b2f9
JS
62 XmNlabelString, text,
63 XmNalignment,
64 ((style & wxALIGN_RIGHT) ? XmALIGNMENT_END :
65 ((style & wxALIGN_CENTRE) ? XmALIGNMENT_CENTER :
66 XmALIGNMENT_BEGINNING)),
67 NULL);
68
a4294b78 69 XmStringFree (text);
02e8b2f9 70
a4294b78
JS
71 SetCanAddEventHandler(TRUE);
72 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
02e8b2f9 73
0d57be45 74 ChangeBackgroundColour ();
4bb6408c 75
a4294b78 76 return TRUE;
4bb6408c
JS
77}
78
4b5f3fe6 79void wxStaticText::ChangeFont(bool keepOriginalSize)
0d57be45 80{
4b5f3fe6 81 wxWindow::ChangeFont(keepOriginalSize);
0d57be45
JS
82}
83
84void wxStaticText::ChangeBackgroundColour()
85{
321db4b6 86 wxWindow::ChangeBackgroundColour();
0d57be45
JS
87}
88
89void wxStaticText::ChangeForegroundColour()
90{
321db4b6 91 wxWindow::ChangeForegroundColour();
0d57be45
JS
92}
93