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