]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/statbmp.h
Disabled memory tracing code for mingw32,
[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"
916d0b61 20#include "wx/icon.h"
4304b42f 21#include "wx/bitmap.h"
2bda0e17 22
32c1cda2 23WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
2bda0e17 24
9e3e0821 25// a control showing an icon or a bitmap
06b57134 26class WXDLLEXPORT wxStaticBitmap : public wxControl
2bda0e17 27{
bfc6fde4 28 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
2bda0e17 29
06b57134 30public:
9e3e0821
VZ
31 wxStaticBitmap() { Init(); }
32
33 wxStaticBitmap(wxWindow *parent,
34 wxWindowID id,
6d167489 35 const wxGDIImage& label,
9e3e0821
VZ
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 long style = 0,
39 const wxString& name = wxStaticBitmapNameStr)
06b57134
VZ
40 {
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
4004f41e
VZ
54 void SetIcon(const wxIcon& icon) { SetImage(&icon); }
55 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
59 const wxIcon& GetIcon() const
6d167489 60 { wxASSERT( m_isIcon ); return *(wxIcon *)m_image; }
9e3e0821 61 const wxBitmap& GetBitmap() const
6d167489 62 { wxASSERT( !m_isIcon ); return *(wxBitmap *)m_image; }
9e3e0821 63
06b57134
VZ
64 // overriden base class virtuals
65 virtual bool AcceptsFocus() const { return FALSE; }
9e3e0821
VZ
66
67 // IMPLEMENTATION
9e3e0821 68#ifdef __WIN16__
06b57134 69 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
9e3e0821 70#endif // __WIN16__
d1e418ea 71 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
2bda0e17 72
06b57134 73protected:
6d167489
VZ
74 virtual wxSize DoGetBestSize() const;
75
76 void Init() { m_isIcon = TRUE; m_image = NULL; }
9e3e0821
VZ
77 void Free();
78
79 // TRUE if icon/bitmap is valid
80 bool ImageIsOk() const;
81
4004f41e 82 void SetImage(const wxGDIImage* image);
6d167489 83
9e3e0821
VZ
84 // we can have either an icon or a bitmap
85 bool m_isIcon;
6d167489 86 wxGDIImage *m_image;
2bda0e17
KB
87};
88
89#endif
bbcdf8bc 90 // _WX_STATBMP_H_