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