]> git.saurik.com Git - wxWidgets.git/blame - src/motif/statbmp.cpp
removed a condition (l. 124) that always eval to true
[wxWidgets.git] / src / motif / statbmp.cpp
CommitLineData
4bb6408c
JS
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
31528cd3 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "statbmp.h"
14#endif
15
16#include "wx/statbmp.h"
17
338dd992
JJ
18#ifdef __VMS__
19#pragma message disable nosimpint
20#endif
a4294b78
JS
21#include <Xm/Xm.h>
22#include <Xm/Label.h>
23#include <Xm/LabelG.h>
24#include <Xm/RowColumn.h>
338dd992
JJ
25#ifdef __VMS__
26#pragma message enable nosimpint
27#endif
a4294b78 28
3096bd2f 29#include "wx/motif/private.h"
a4294b78 30
4bb6408c 31IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
4bb6408c
JS
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);
0d57be45
JS
46 m_backgroundColour = parent->GetBackgroundColour();
47 m_foregroundColour = parent->GetForegroundColour();
4bb6408c
JS
48 if (parent) parent->AddChild(this);
49
50 if ( id == -1 )
31528cd3 51 m_windowId = (int)NewControlId();
4bb6408c 52 else
31528cd3 53 m_windowId = id;
4bb6408c
JS
54
55 m_windowStyle = style;
56
a4294b78
JS
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
da175b2c 73 m_font = parent->GetFont();
4b5f3fe6
JS
74 ChangeFont(FALSE);
75
a4294b78
JS
76 SetCanAddEventHandler(TRUE);
77 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
78
0d57be45 79 ChangeBackgroundColour ();
a4294b78
JS
80
81 return TRUE;
82}
83
84wxStaticBitmap::~wxStaticBitmap()
85{
86 SetBitmap(wxNullBitmap);
4bb6408c
JS
87}
88
4bb6408c
JS
89void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
90{
91 m_messageBitmap = bitmap;
92
a4294b78
JS
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,
31528cd3 105 NULL);
a4294b78
JS
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,
1a3ac83f 117 XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
a4294b78
JS
118 NULL);
119 }
4bb6408c
JS
120}
121
4b5f3fe6 122void wxStaticBitmap::ChangeFont(bool keepOriginalSize)
0d57be45 123{
4b5f3fe6 124 wxWindow::ChangeFont(keepOriginalSize);
0d57be45
JS
125}
126
127void wxStaticBitmap::ChangeBackgroundColour()
128{
321db4b6 129 wxWindow::ChangeBackgroundColour();
0d57be45
JS
130}
131
132void wxStaticBitmap::ChangeForegroundColour()
133{
321db4b6 134 wxWindow::ChangeForegroundColour();
0d57be45
JS
135}
136