]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/statbmp.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / msw / statbmp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/statbmp.h
3 // Purpose: wxStaticBitmap class for wxMSW
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_STATBMP_H_
12 #define _WX_STATBMP_H_
13
14 #include "wx/control.h"
15 #include "wx/icon.h"
16 #include "wx/bitmap.h"
17
18 extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[];
19
20 // a control showing an icon or a bitmap
21 class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase
22 {
23 public:
24 wxStaticBitmap() { Init(); }
25
26 wxStaticBitmap(wxWindow *parent,
27 wxWindowID id,
28 const wxGDIImage& label,
29 const wxPoint& pos = wxDefaultPosition,
30 const wxSize& size = wxDefaultSize,
31 long style = 0,
32 const wxString& name = wxStaticBitmapNameStr)
33 {
34 Init();
35
36 Create(parent, id, label, pos, size, style, name);
37 }
38
39 bool Create(wxWindow *parent,
40 wxWindowID id,
41 const wxGDIImage& label,
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
49 virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); }
50 virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); }
51 virtual wxBitmap GetBitmap() const;
52 virtual wxIcon GetIcon() const;
53
54 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
55
56 // returns true if the platform should explicitly apply a theme border
57 virtual bool CanApplyThemeBorder() const { return false; }
58
59 protected:
60 virtual wxSize DoGetBestClientSize() const;
61
62 // ctor/dtor helpers
63 void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; }
64 void Free();
65
66 // true if icon/bitmap is valid
67 bool ImageIsOk() const;
68
69 void SetImage(const wxGDIImage* image);
70 void SetImageNoCopy( wxGDIImage* image );
71
72 #ifndef __WXWINCE__
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);
76 #endif // !__WXWINCE__
77
78 void WXHandleSize(wxSizeEvent& event);
79
80 // we can have either an icon or a bitmap
81 bool m_isIcon;
82 wxGDIImage *m_image;
83
84 // handle used in last call to STM_SETIMAGE
85 WXHANDLE m_currentHandle;
86
87 private:
88 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
89 wxDECLARE_EVENT_TABLE();
90 wxDECLARE_NO_COPY_CLASS(wxStaticBitmap);
91 };
92
93 #endif
94 // _WX_STATBMP_H_