]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticBitmap
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "statbmp.h"
16 #include "wx/statbmp.h"
19 #pragma message disable nosimpint
23 #include <Xm/LabelG.h>
24 #include <Xm/RowColumn.h>
26 #pragma message enable nosimpint
29 #include "wx/motif/private.h"
31 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
37 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
38 const wxBitmap
& bitmap
,
44 m_messageBitmap
= bitmap
;
46 m_backgroundColour
= parent
->GetBackgroundColour();
47 m_foregroundColour
= parent
->GetForegroundColour();
48 if (parent
) parent
->AddChild(this);
51 m_windowId
= (int)NewControlId();
55 m_windowStyle
= style
;
57 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
59 m_mainWidget
= (WXWidget
) XtVaCreateManagedWidget ("staticBitmap",
61 xmLabelGadgetClass
, parentWidget
,
63 xmLabelWidgetClass
, parentWidget
,
65 XmNalignment
, XmALIGNMENT_BEGINNING
,
68 XtVaSetValues ((Widget
) m_mainWidget
,
69 XmNlabelPixmap
, (Pixmap
) ((wxBitmap
&)bitmap
).GetLabelPixmap (m_mainWidget
),
70 XmNlabelType
, XmPIXMAP
,
73 m_font
= parent
->GetFont();
76 SetCanAddEventHandler(TRUE
);
77 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
79 ChangeBackgroundColour ();
84 wxStaticBitmap::~wxStaticBitmap()
86 SetBitmap(wxNullBitmap
);
89 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
91 m_messageBitmap
= bitmap
;
93 Widget widget
= (Widget
) m_mainWidget
;
94 int x
, y
, w1
, h1
, w2
, h2
;
100 w2
= bitmap
.GetWidth();
101 h2
= bitmap
.GetHeight();
102 XtVaSetValues (widget
,
103 XmNlabelPixmap
, ((wxBitmap
&)bitmap
).GetLabelPixmap (widget
),
104 XmNlabelType
, XmPIXMAP
,
108 if (! (w1
== w2
) && (h1
== h2
))
109 SetSize(x
, y
, w2
, h2
);
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
,
122 void wxStaticBitmap::ChangeFont(bool keepOriginalSize
)
124 wxWindow::ChangeFont(keepOriginalSize
);
127 void wxStaticBitmap::ChangeBackgroundColour()
129 wxWindow::ChangeBackgroundColour();
132 void wxStaticBitmap::ChangeForegroundColour()
134 wxWindow::ChangeForegroundColour();