]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/statbmp.h
wxPalette unified. Source cleaning.
[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
2bda0e17 15#include "wx/control.h"
916d0b61 16#include "wx/icon.h"
4304b42f 17#include "wx/bitmap.h"
2bda0e17 18
ef359b43 19extern WXDLLEXPORT_DATA(const wxChar*) wxStaticBitmapNameStr;
2bda0e17 20
9e3e0821 21// a control showing an icon or a bitmap
1e6feb95 22class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
2bda0e17 23{
06b57134 24public:
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); }
9e3e0821
VZ
52
53 // assert failure is provoked by an attempt to get an icon from bitmap or
54 // vice versa
1e6feb95 55 wxIcon GetIcon() const
46a5e01e
VZ
56 {
57 wxASSERT_MSG( m_isIcon, _T("no icon in this wxStaticBitmap") );
58
59 return *(wxIcon *)m_image;
60 }
61
1e6feb95 62 wxBitmap GetBitmap() const
46a5e01e
VZ
63 {
64 wxASSERT_MSG( !m_isIcon, _T("no bitmap in this wxStaticBitmap") );
65
66 return *(wxBitmap *)m_image;
67 }
68
69 // implementation only from now on
70 // -------------------------------
9e3e0821 71
06b57134 72protected:
65bc172c 73 virtual wxBorder GetDefaultBorder() const;
9d17ee60 74 virtual wxSize DoGetBestSize() const;
46a5e01e 75 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
6d167489 76
46a5e01e 77 // ctor/dtor helpers
57f4f925 78 void Init() { m_isIcon = true; m_image = NULL; }
9e3e0821
VZ
79 void Free();
80
57f4f925 81 // true if icon/bitmap is valid
9e3e0821
VZ
82 bool ImageIsOk() const;
83
4004f41e 84 void SetImage(const wxGDIImage* image);
d8bffc13 85 void SetImageNoCopy( wxGDIImage* image );
6d167489 86
9e3e0821
VZ
87 // we can have either an icon or a bitmap
88 bool m_isIcon;
6d167489 89 wxGDIImage *m_image;
1e6feb95
VZ
90
91private:
92 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
22f3361e 93 DECLARE_NO_COPY_CLASS(wxStaticBitmap)
2bda0e17
KB
94};
95
96#endif
bbcdf8bc 97 // _WX_STATBMP_H_