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