]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/motif/statbmp.cpp
2 warnings from Solaris build log fixed
[wxWidgets.git] / src / motif / statbmp.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbmp.cpp
3// Purpose: wxStaticBitmap
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "statbmp.h"
14#endif
15
16#include "wx/statbmp.h"
17
18#ifdef __VMS__
19#pragma message disable nosimpint
20#endif
21#include <Xm/Xm.h>
22#include <Xm/Label.h>
23#include <Xm/LabelG.h>
24#include <Xm/RowColumn.h>
25#ifdef __VMS__
26#pragma message enable nosimpint
27#endif
28
29#include "wx/motif/private.h"
30
31IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
32
33/*
34 * wxStaticBitmap
35 */
36
37bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
38 const wxBitmap& bitmap,
39 const wxPoint& pos,
40 const wxSize& size,
41 long style,
42 const wxString& name)
43{
44 m_messageBitmap = bitmap;
45 SetName(name);
46 m_backgroundColour = parent->GetBackgroundColour();
47 m_foregroundColour = parent->GetForegroundColour();
48 if (parent) parent->AddChild(this);
49
50 if ( id == -1 )
51 m_windowId = (int)NewControlId();
52 else
53 m_windowId = id;
54
55 m_windowStyle = style;
56
57 Widget parentWidget = (Widget) parent->GetClientWidget();
58
59 m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("staticBitmap",
60#if USE_GADGETS
61 xmLabelGadgetClass, parentWidget,
62#else
63 xmLabelWidgetClass, parentWidget,
64#endif
65 XmNalignment, XmALIGNMENT_BEGINNING,
66 NULL);
67
68 XtVaSetValues ((Widget) m_mainWidget,
69 XmNlabelPixmap, (Pixmap) ((wxBitmap&)bitmap).GetLabelPixmap (m_mainWidget),
70 XmNlabelType, XmPIXMAP,
71 NULL);
72
73 m_font = parent->GetFont();
74 ChangeFont(FALSE);
75
76 SetCanAddEventHandler(TRUE);
77 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
78
79 ChangeBackgroundColour ();
80
81 return TRUE;
82}
83
84wxStaticBitmap::~wxStaticBitmap()
85{
86 SetBitmap(wxNullBitmap);
87}
88
89void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
90{
91 m_messageBitmap = bitmap;
92
93 Widget widget = (Widget) m_mainWidget;
94 int x, y, w1, h1, w2, h2;
95
96 GetPosition(&x, &y);
97
98 if (bitmap.Ok())
99 {
100 w2 = bitmap.GetWidth();
101 h2 = bitmap.GetHeight();
102 XtVaSetValues (widget,
103 XmNlabelPixmap, ((wxBitmap&)bitmap).GetLabelPixmap (widget),
104 XmNlabelType, XmPIXMAP,
105 NULL);
106 GetSize(&w1, &h1);
107
108 if (! (w1 == w2) && (h1 == h2))
109 SetSize(x, y, w2, h2);
110 }
111 else
112 {
113 // Null bitmap: must not use current pixmap
114 // since it is no longer valid.
115 XtVaSetValues (widget,
116 XmNlabelType, XmSTRING,
117 XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
118 NULL);
119 }
120}
121
122void wxStaticBitmap::ChangeFont(bool keepOriginalSize)
123{
124 wxWindow::ChangeFont(keepOriginalSize);
125}
126
127void wxStaticBitmap::ChangeBackgroundColour()
128{
129 wxWindow::ChangeBackgroundColour();
130}
131
132void wxStaticBitmap::ChangeForegroundColour()
133{
134 wxWindow::ChangeForegroundColour();
135}
136