1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/statbmp.h
3 // Purpose: wxStaticBitmap class for Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STATBMP_H_
13 #define _WX_STATBMP_H_
15 #include "wx/control.h"
17 #include "wx/bitmap.h"
19 WXDLLEXPORT_DATA(extern const wxChar
) wxStaticBitmapNameStr
[];
21 // a control showing an icon or a bitmap
22 class WXDLLEXPORT wxStaticBitmap
: public wxStaticBitmapBase
25 wxStaticBitmap() { Init(); }
27 wxStaticBitmap(wxWindow
*parent
,
29 const wxGDIImage
& label
,
30 const wxPoint
& pos
= wxDefaultPosition
,
31 const wxSize
& size
= wxDefaultSize
,
33 const wxString
& name
= wxStaticBitmapNameStr
)
37 Create(parent
, id
, label
, pos
, size
, style
, name
);
40 bool Create(wxWindow
*parent
,
42 const wxGDIImage
& label
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
46 const wxString
& name
= wxStaticBitmapNameStr
);
48 virtual ~wxStaticBitmap() { Free(); }
50 virtual void SetIcon(const wxIcon
& icon
) { SetImage(&icon
); }
51 virtual void SetBitmap(const wxBitmap
& bitmap
) { SetImage(&bitmap
); }
53 // assert failure is provoked by an attempt to get an icon from bitmap or
55 wxIcon
GetIcon() const
57 wxASSERT_MSG( m_isIcon
, _T("no icon in this wxStaticBitmap") );
59 return *(wxIcon
*)m_image
;
62 wxBitmap
GetBitmap() const
64 wxASSERT_MSG( !m_isIcon
, _T("no bitmap in this wxStaticBitmap") );
66 return *(wxBitmap
*)m_image
;
69 // implementation only from now on
70 // -------------------------------
72 // implement base class virtuals
73 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
76 virtual wxBorder
GetDefaultBorder() const;
77 virtual wxSize
DoGetBestSize() const;
78 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
81 void Init() { m_isIcon
= TRUE
; m_image
= NULL
; }
84 // TRUE if icon/bitmap is valid
85 bool ImageIsOk() const;
87 void SetImage(const wxGDIImage
* image
);
88 void SetImageNoCopy( wxGDIImage
* image
);
90 // we can have either an icon or a bitmap
95 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)
96 DECLARE_NO_COPY_CLASS(wxStaticBitmap
)