]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/statbmp.h
Corrected wxlistBox, wxRadioBox, wxComboBox and
[wxWidgets.git] / include / wx / msw / statbmp.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbmp.h
3// Purpose: wxStaticBitmap class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
9e3e0821 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_STATBMP_H_
13#define _WX_STATBMP_H_
2bda0e17
KB
14
15#ifdef __GNUG__
06b57134 16 #pragma interface "statbmp.h"
2bda0e17
KB
17#endif
18
19#include "wx/control.h"
20
32c1cda2 21WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
2bda0e17 22
9e3e0821 23// a control showing an icon or a bitmap
06b57134 24class WXDLLEXPORT wxStaticBitmap : public wxControl
2bda0e17 25{
bfc6fde4 26 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
2bda0e17 27
06b57134 28public:
9e3e0821
VZ
29 wxStaticBitmap() { Init(); }
30
31 wxStaticBitmap(wxWindow *parent,
32 wxWindowID id,
33 const wxBitmap& label,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = 0,
37 const wxString& name = wxStaticBitmapNameStr)
06b57134
VZ
38 {
39 Create(parent, id, label, pos, size, style, name);
40 }
9e3e0821
VZ
41
42 bool Create(wxWindow *parent,
43 wxWindowID id,
44 const wxBitmap& label,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = 0,
48 const wxString& name = wxStaticBitmapNameStr);
49
50 virtual ~wxStaticBitmap() { Free(); }
51
52 virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
06b57134 53 virtual void SetBitmap(const wxBitmap& bitmap);
9e3e0821
VZ
54
55 // assert failure is provoked by an attempt to get an icon from bitmap or
56 // vice versa
57 const wxIcon& GetIcon() const
58 { wxASSERT( m_isIcon ); return *m_image.icon; }
59 const wxBitmap& GetBitmap() const
60 { wxASSERT( !m_isIcon ); return *m_image.bitmap; }
61
06b57134
VZ
62 // overriden base class virtuals
63 virtual bool AcceptsFocus() const { return FALSE; }
9e3e0821
VZ
64
65 // IMPLEMENTATION
9e3e0821 66#ifdef __WIN16__
06b57134
VZ
67 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
68 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
9e3e0821 69#endif // __WIN16__
2bda0e17 70
06b57134 71protected:
9e3e0821
VZ
72 void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
73 void Free();
74
75 // TRUE if icon/bitmap is valid
76 bool ImageIsOk() const;
77
78 // we can have either an icon or a bitmap
79 bool m_isIcon;
80 union
81 {
82 wxIcon *icon;
83 wxBitmap *bitmap;
84 } m_image;
85
4438caf4 86 virtual wxSize DoGetBestSize();
2bda0e17
KB
87};
88
89#endif
bbcdf8bc 90 // _WX_STATBMP_H_