]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/statbmp.cpp
009d175a64cb20ec2a3f73a808d6fcc8858d00d5
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"
20 #include <Xm/LabelG.h>
21 #include <Xm/RowColumn.h>
23 #include <wx/motif/private.h>
25 #if !USE_SHARED_LIBRARY
26 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
33 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
34 const wxBitmap
& bitmap
,
40 m_messageBitmap
= bitmap
;
42 m_backgroundColour
= parent
->GetBackgroundColour();
43 m_foregroundColour
= parent
->GetForegroundColour();
44 if (parent
) parent
->AddChild(this);
47 m_windowId
= (int)NewControlId();
51 m_windowStyle
= style
;
53 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
55 m_mainWidget
= (WXWidget
) XtVaCreateManagedWidget ("staticBitmap",
57 xmLabelGadgetClass
, parentWidget
,
59 xmLabelWidgetClass
, parentWidget
,
61 XmNalignment
, XmALIGNMENT_BEGINNING
,
64 XtVaSetValues ((Widget
) m_mainWidget
,
65 XmNlabelPixmap
, (Pixmap
) ((wxBitmap
&)bitmap
).GetLabelPixmap (m_mainWidget
),
66 XmNlabelType
, XmPIXMAP
,
69 SetCanAddEventHandler(TRUE
);
70 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
72 SetFont(* parent
->GetFont());
74 ChangeBackgroundColour ();
79 wxStaticBitmap::~wxStaticBitmap()
81 SetBitmap(wxNullBitmap
);
84 void wxStaticBitmap::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
86 wxControl::SetSize(x
, y
, width
, height
, sizeFlags
);
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
, NULL
, // TODO: Does this work?
122 void wxStaticBitmap::ChangeFont()
127 void wxStaticBitmap::ChangeBackgroundColour()
132 void wxStaticBitmap::ChangeForegroundColour()