]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/statbmp.h
day_of_week fix to wxDate, wxRect additions
[wxWidgets.git] / include / wx / msw / statbmp.h
... / ...
CommitLineData
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$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_STATBMP_H_
13#define _WX_STATBMP_H_
14
15#ifdef __GNUG__
16 #pragma interface "statbmp.h"
17#endif
18
19#include "wx/control.h"
20
21WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr;
22
23// a control showing an icon or a bitmap
24class WXDLLEXPORT wxStaticBitmap : public wxControl
25{
26 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
27
28public:
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)
38 {
39 Create(parent, id, label, pos, size, style, name);
40 }
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); }
53 virtual void SetBitmap(const wxBitmap& bitmap);
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
62 // overriden base class virtuals
63 virtual bool AcceptsFocus() const { return FALSE; }
64
65 // IMPLEMENTATION
66#ifdef __WIN16__
67 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
68 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
69#endif // __WIN16__
70
71protected:
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
86 virtual void DoSetSize(int x, int y,
87 int width, int height,
88 int sizeFlags = wxSIZE_AUTO);
89};
90
91#endif
92 // _WX_STATBMP_H_