]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/gizmos/statpict.h
Semicolon removed for Borland
[wxWidgets.git] / contrib / include / wx / gizmos / statpict.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statpict.h
3 // Purpose: wxStaticPicture class
4 // Author: Wade Brainerd
5 // Modified by:
6 // Created: 2003-05-01
7 // RCS-ID:
8 // Copyright: (c) Wade Brainerd
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_STATPICT_H_
13 #define _WX_STATPICT_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "statpict.h"
17 #endif
18
19 #include "wx/control.h"
20
21 #include "wx/icon.h"
22 #include "wx/bitmap.h"
23 #include "wx/image.h"
24
25 enum
26 {
27 wxSCALE_HORIZONTAL = 0x1,
28 wxSCALE_VERTICAL = 0x2,
29 wxSCALE_UNIFORM = 0x4,
30 wxSCALE_CUSTOM = 0x8
31 };
32
33 //WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
34 extern const wxChar* wxStaticPictureNameStr;
35
36 class /*WXDLLEXPORT*/ wxStaticPicture : public wxControl
37 {
38 DECLARE_DYNAMIC_CLASS(wxStaticPicture)
39
40 public:
41 wxStaticPicture() {}
42
43 wxStaticPicture( wxWindow* parent, wxWindowID id,
44 const wxBitmap& label,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = 0,
48 const wxString& name = wxStaticPictureNameStr )
49 {
50 Create( parent, id, label, pos, size, style, name );
51 }
52
53 bool Create( wxWindow* parent, wxWindowID id,
54 const wxBitmap& label,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = 0,
58 const wxString& name = wxStaticPictureNameStr );
59
60 virtual void Command(wxCommandEvent& WXUNUSED(event)) {}
61 virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event)) {return true;}
62 void OnPaint(wxPaintEvent& event);
63
64 void SetBitmap( const wxBitmap& bmp );
65
66 wxBitmap GetBitmap() const
67 {
68 return Bitmap;
69 }
70
71 // Icon interface for compatibility with wxStaticBitmap.
72 void SetIcon( const wxIcon& icon )
73 {
74 wxBitmap bmp;
75 bmp.CopyFromIcon( icon );
76 SetBitmap( bmp );
77 }
78
79 wxIcon GetIcon() const
80 {
81 wxIcon icon;
82 icon.CopyFromBitmap( Bitmap );
83 return icon;
84 }
85
86 void SetAlignment( int align )
87 {
88 Align = align;
89 }
90
91 int GetAlignment() const
92 {
93 return Align;
94 }
95
96 void SetScale( int scale )
97 {
98 Scale = scale;
99 }
100
101 int GetScale() const
102 {
103 return Scale;
104 }
105
106 void SetCustomScale( float sx, float sy )
107 {
108 ScaleX = sx;
109 ScaleY = sy;
110 }
111
112 void GetCustomScale( float* sx, float* sy ) const
113 {
114 *sx = ScaleX;
115 *sy = ScaleY;
116 }
117
118 protected:
119 wxBitmap Bitmap;
120
121 int Align;
122
123 int Scale;
124 float ScaleX;
125 float ScaleY;
126
127 #ifndef __WXMSW__
128 // When scaling is enabled, measures are taken to improve performance on non-Windows platforms.
129 // - The original bitmap is stored as a wxImage, because conversion from wxBitmap to wxImage is slow.
130 // - The latest scaled bitmap is cached, this improves performance when the control is repainted
131 // but the size hasn't changed (overlapping windows, movement, etc).
132 wxImage OriginalImage;
133 float LastScaleX;
134 float LastScaleY;
135 wxBitmap ScaledBitmap;
136 #endif
137
138 DECLARE_EVENT_TABLE()
139 };
140
141 #endif // #ifndef _WX_STATPICT_H_