]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/statbmp.h
we don't need to use solid colour for background drawing when we're inside notebook...
[wxWidgets.git] / include / wx / msw / statbmp.h
CommitLineData
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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
06b57134 16 #pragma interface "statbmp.h"
2bda0e17
KB
17#endif
18
19#include "wx/control.h"
916d0b61 20#include "wx/icon.h"
4304b42f 21#include "wx/bitmap.h"
2bda0e17 22
ef359b43 23extern WXDLLEXPORT_DATA(const wxChar*) wxStaticBitmapNameStr;
2bda0e17 24
9e3e0821 25// a control showing an icon or a bitmap
1e6feb95 26class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
2bda0e17 27{
06b57134 28public:
9e3e0821
VZ
29 wxStaticBitmap() { Init(); }
30
31 wxStaticBitmap(wxWindow *parent,
32 wxWindowID id,
6d167489 33 const wxGDIImage& label,
9e3e0821
VZ
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = 0,
37 const wxString& name = wxStaticBitmapNameStr)
06b57134 38 {
46a5e01e
VZ
39 Init();
40
06b57134
VZ
41 Create(parent, id, label, pos, size, style, name);
42 }
9e3e0821
VZ
43
44 bool Create(wxWindow *parent,
45 wxWindowID id,
6d167489 46 const wxGDIImage& label,
9e3e0821
VZ
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = 0,
50 const wxString& name = wxStaticBitmapNameStr);
51
52 virtual ~wxStaticBitmap() { Free(); }
53
1e6feb95
VZ
54 virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); }
55 virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); }
9e3e0821
VZ
56
57 // assert failure is provoked by an attempt to get an icon from bitmap or
58 // vice versa
1e6feb95 59 wxIcon GetIcon() const
46a5e01e
VZ
60 {
61 wxASSERT_MSG( m_isIcon, _T("no icon in this wxStaticBitmap") );
62
63 return *(wxIcon *)m_image;
64 }
65
1e6feb95 66 wxBitmap GetBitmap() const
46a5e01e
VZ
67 {
68 wxASSERT_MSG( !m_isIcon, _T("no bitmap in this wxStaticBitmap") );
69
70 return *(wxBitmap *)m_image;
71 }
72
73 // implementation only from now on
74 // -------------------------------
9e3e0821 75
06b57134 76protected:
65bc172c 77 virtual wxBorder GetDefaultBorder() const;
9d17ee60 78 virtual wxSize DoGetBestSize() const;
46a5e01e 79 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
6d167489 80
46a5e01e 81 // ctor/dtor helpers
57f4f925 82 void Init() { m_isIcon = true; m_image = NULL; }
9e3e0821
VZ
83 void Free();
84
57f4f925 85 // true if icon/bitmap is valid
9e3e0821
VZ
86 bool ImageIsOk() const;
87
4004f41e 88 void SetImage(const wxGDIImage* image);
d8bffc13 89 void SetImageNoCopy( wxGDIImage* image );
6d167489 90
9e3e0821
VZ
91 // we can have either an icon or a bitmap
92 bool m_isIcon;
6d167489 93 wxGDIImage *m_image;
1e6feb95
VZ
94
95private:
96 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
22f3361e 97 DECLARE_NO_COPY_CLASS(wxStaticBitmap)
2bda0e17
KB
98};
99
100#endif
bbcdf8bc 101 // _WX_STATBMP_H_