]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e6feb95 VZ |
2 | // Name: wx/msw/statbmp.h |
3 | // Purpose: wxStaticBitmap class for wxMSW | |
2bda0e17 KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_STATBMP_H_ |
13 | #define _WX_STATBMP_H_ | |
2bda0e17 | 14 | |
2bda0e17 | 15 | #include "wx/control.h" |
916d0b61 | 16 | #include "wx/icon.h" |
4304b42f | 17 | #include "wx/bitmap.h" |
2bda0e17 | 18 | |
53a2db12 | 19 | extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[]; |
2bda0e17 | 20 | |
9e3e0821 | 21 | // a control showing an icon or a bitmap |
53a2db12 | 22 | class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase |
2bda0e17 | 23 | { |
06b57134 | 24 | public: |
9e3e0821 VZ |
25 | wxStaticBitmap() { Init(); } |
26 | ||
27 | wxStaticBitmap(wxWindow *parent, | |
28 | wxWindowID id, | |
6d167489 | 29 | const wxGDIImage& label, |
9e3e0821 VZ |
30 | const wxPoint& pos = wxDefaultPosition, |
31 | const wxSize& size = wxDefaultSize, | |
32 | long style = 0, | |
33 | const wxString& name = wxStaticBitmapNameStr) | |
06b57134 | 34 | { |
46a5e01e VZ |
35 | Init(); |
36 | ||
06b57134 VZ |
37 | Create(parent, id, label, pos, size, style, name); |
38 | } | |
9e3e0821 VZ |
39 | |
40 | bool Create(wxWindow *parent, | |
41 | wxWindowID id, | |
6d167489 | 42 | const wxGDIImage& label, |
9e3e0821 VZ |
43 | const wxPoint& pos = wxDefaultPosition, |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = 0, | |
46 | const wxString& name = wxStaticBitmapNameStr); | |
47 | ||
48 | virtual ~wxStaticBitmap() { Free(); } | |
49 | ||
1e6feb95 VZ |
50 | virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); } |
51 | virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); } | |
a44fb285 VZ |
52 | virtual wxBitmap GetBitmap() const; |
53 | virtual wxIcon GetIcon() const; | |
46a5e01e | 54 | |
6f02a879 | 55 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; |
9e3e0821 | 56 | |
a047aff2 JS |
57 | // returns true if the platform should explicitly apply a theme border |
58 | virtual bool CanApplyThemeBorder() const { return false; } | |
59 | ||
06b57134 | 60 | protected: |
ae4375b8 | 61 | virtual wxSize DoGetBestClientSize() const; |
6d167489 | 62 | |
46a5e01e | 63 | // ctor/dtor helpers |
3dece6c4 | 64 | void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; } |
9e3e0821 VZ |
65 | void Free(); |
66 | ||
57f4f925 | 67 | // true if icon/bitmap is valid |
9e3e0821 VZ |
68 | bool ImageIsOk() const; |
69 | ||
4004f41e | 70 | void SetImage(const wxGDIImage* image); |
d8bffc13 | 71 | void SetImageNoCopy( wxGDIImage* image ); |
6d167489 | 72 | |
9eb2347d | 73 | #ifndef __WXWINCE__ |
a73a4ab7 VZ |
74 | // draw the bitmap ourselves here if the OS can't do it correctly (if it |
75 | // can we leave it to it) | |
76 | void DoPaintManually(wxPaintEvent& event); | |
9eb2347d | 77 | #endif // !__WXWINCE__ |
a73a4ab7 | 78 | |
05942059 | 79 | void WXHandleSize(wxSizeEvent& event); |
a73a4ab7 | 80 | |
9e3e0821 VZ |
81 | // we can have either an icon or a bitmap |
82 | bool m_isIcon; | |
6d167489 | 83 | wxGDIImage *m_image; |
4fe41ce6 | 84 | |
3dece6c4 | 85 | // handle used in last call to STM_SETIMAGE |
4fe41ce6 | 86 | WXHANDLE m_currentHandle; |
1e6feb95 VZ |
87 | |
88 | private: | |
89 | DECLARE_DYNAMIC_CLASS(wxStaticBitmap) | |
05942059 | 90 | wxDECLARE_EVENT_TABLE(); |
c0c133e1 | 91 | wxDECLARE_NO_COPY_CLASS(wxStaticBitmap); |
2bda0e17 KB |
92 | }; |
93 | ||
94 | #endif | |
bbcdf8bc | 95 | // _WX_STATBMP_H_ |