]>
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 #if !USE_SHARED_LIBRARY
32 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
39 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
40 const wxBitmap
& bitmap
,
46 m_messageBitmap
= bitmap
;
48 m_backgroundColour
= parent
->GetBackgroundColour();
49 m_foregroundColour
= parent
->GetForegroundColour();
50 if (parent
) parent
->AddChild(this);
53 m_windowId
= (int)NewControlId();
57 m_windowStyle
= style
;
59 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
61 m_mainWidget
= (WXWidget
) XtVaCreateManagedWidget ("staticBitmap",
63 xmLabelGadgetClass
, parentWidget
,
65 xmLabelWidgetClass
, parentWidget
,
67 XmNalignment
, XmALIGNMENT_BEGINNING
,
70 XtVaSetValues ((Widget
) m_mainWidget
,
71 XmNlabelPixmap
, (Pixmap
) ((wxBitmap
&)bitmap
).GetLabelPixmap (m_mainWidget
),
72 XmNlabelType
, XmPIXMAP
,
75 m_font
= parent
->GetFont();
78 SetCanAddEventHandler(TRUE
);
79 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
81 ChangeBackgroundColour ();
86 wxStaticBitmap::~wxStaticBitmap()
88 SetBitmap(wxNullBitmap
);
91 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
93 m_messageBitmap
= bitmap
;
95 Widget widget
= (Widget
) m_mainWidget
;
96 int x
, y
, w1
, h1
, w2
, h2
;
102 w2
= bitmap
.GetWidth();
103 h2
= bitmap
.GetHeight();
104 XtVaSetValues (widget
,
105 XmNlabelPixmap
, ((wxBitmap
&)bitmap
).GetLabelPixmap (widget
),
106 XmNlabelType
, XmPIXMAP
,
110 if (! (w1
== w2
) && (h1
== h2
))
111 SetSize(x
, y
, w2
, h2
);
115 // Null bitmap: must not use current pixmap
116 // since it is no longer valid.
117 XtVaSetValues (widget
,
118 XmNlabelType
, XmSTRING
,
119 XmNlabelPixmap
, XmUNSPECIFIED_PIXMAP
,
124 void wxStaticBitmap::ChangeFont(bool keepOriginalSize
)
126 wxWindow::ChangeFont(keepOriginalSize
);
129 void wxStaticBitmap::ChangeBackgroundColour()
131 wxWindow::ChangeBackgroundColour();
134 void wxStaticBitmap::ChangeForegroundColour()
136 wxWindow::ChangeForegroundColour();