]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/statbmp.h
wxMenu::callback stuff taken inside WXWIN_COMPATIBILITY_2 (everybody should
[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"
2bda0e17 21
32c1cda2 22WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
2bda0e17 23
9e3e0821 24// a control showing an icon or a bitmap
06b57134 25class WXDLLEXPORT wxStaticBitmap : public wxControl
2bda0e17 26{
bfc6fde4 27 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
2bda0e17 28
06b57134 29public:
9e3e0821
VZ
30 wxStaticBitmap() { Init(); }
31
32 wxStaticBitmap(wxWindow *parent,
33 wxWindowID id,
34 const wxBitmap& label,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 long style = 0,
38 const wxString& name = wxStaticBitmapNameStr)
06b57134
VZ
39 {
40 Create(parent, id, label, pos, size, style, name);
41 }
9e3e0821
VZ
42
43 bool Create(wxWindow *parent,
44 wxWindowID id,
45 const wxBitmap& label,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = 0,
49 const wxString& name = wxStaticBitmapNameStr);
50
51 virtual ~wxStaticBitmap() { Free(); }
52
53 virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
06b57134 54 virtual void SetBitmap(const wxBitmap& bitmap);
9e3e0821
VZ
55
56 // assert failure is provoked by an attempt to get an icon from bitmap or
57 // vice versa
58 const wxIcon& GetIcon() const
59 { wxASSERT( m_isIcon ); return *m_image.icon; }
60 const wxBitmap& GetBitmap() const
61 { wxASSERT( !m_isIcon ); return *m_image.bitmap; }
62
06b57134
VZ
63 // overriden base class virtuals
64 virtual bool AcceptsFocus() const { return FALSE; }
9e3e0821
VZ
65
66 // IMPLEMENTATION
9e3e0821 67#ifdef __WIN16__
06b57134
VZ
68 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
69 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
9e3e0821 70#endif // __WIN16__
2bda0e17 71
06b57134 72protected:
9e3e0821
VZ
73 void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
74 void Free();
75
76 // TRUE if icon/bitmap is valid
77 bool ImageIsOk() const;
78
79 // we can have either an icon or a bitmap
80 bool m_isIcon;
81 union
82 {
83 wxIcon *icon;
84 wxBitmap *bitmap;
85 } m_image;
86
4438caf4 87 virtual wxSize DoGetBestSize();
2bda0e17
KB
88};
89
90#endif
bbcdf8bc 91 // _WX_STATBMP_H_