1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: statbmp.h
|
|
|
|
// Purpose: wxStaticBitmap class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-03-24 18:35:16 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_STATBMP_H_
|
|
|
|
#define _WX_STATBMP_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-01-31 18:30:33 -05:00
|
|
|
#pragma interface "statbmp.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
1999-06-10 14:12:13 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-03-24 18:35:16 -05:00
|
|
|
// a control showing an icon or a bitmap
|
1999-01-31 18:30:33 -05:00
|
|
|
class WXDLLEXPORT wxStaticBitmap : public wxControl
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-02-22 06:01:13 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-01-31 18:30:33 -05:00
|
|
|
public:
|
1999-03-24 18:35:16 -05:00
|
|
|
wxStaticBitmap() { Init(); }
|
|
|
|
|
|
|
|
wxStaticBitmap(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxBitmap& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr)
|
1999-01-31 18:30:33 -05:00
|
|
|
{
|
|
|
|
Create(parent, id, label, pos, size, style, name);
|
|
|
|
}
|
1999-03-24 18:35:16 -05:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxBitmap& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr);
|
|
|
|
|
|
|
|
virtual ~wxStaticBitmap() { Free(); }
|
|
|
|
|
|
|
|
virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
|
1999-01-31 18:30:33 -05:00
|
|
|
virtual void SetBitmap(const wxBitmap& bitmap);
|
1999-03-24 18:35:16 -05:00
|
|
|
|
|
|
|
// assert failure is provoked by an attempt to get an icon from bitmap or
|
|
|
|
// vice versa
|
|
|
|
const wxIcon& GetIcon() const
|
|
|
|
{ wxASSERT( m_isIcon ); return *m_image.icon; }
|
|
|
|
const wxBitmap& GetBitmap() const
|
|
|
|
{ wxASSERT( !m_isIcon ); return *m_image.bitmap; }
|
|
|
|
|
1999-01-31 18:30:33 -05:00
|
|
|
// overriden base class virtuals
|
|
|
|
virtual bool AcceptsFocus() const { return FALSE; }
|
1999-03-24 18:35:16 -05:00
|
|
|
|
|
|
|
// IMPLEMENTATION
|
|
|
|
#ifdef __WIN16__
|
1999-01-31 18:30:33 -05:00
|
|
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
|
|
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1999-03-24 18:35:16 -05:00
|
|
|
#endif // __WIN16__
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-01-31 18:30:33 -05:00
|
|
|
protected:
|
1999-03-24 18:35:16 -05:00
|
|
|
void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
|
|
|
|
void Free();
|
|
|
|
|
|
|
|
// TRUE if icon/bitmap is valid
|
|
|
|
bool ImageIsOk() const;
|
|
|
|
|
|
|
|
// we can have either an icon or a bitmap
|
|
|
|
bool m_isIcon;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
wxIcon *icon;
|
|
|
|
wxBitmap *bitmap;
|
|
|
|
} m_image;
|
|
|
|
|
1999-02-22 06:01:13 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_STATBMP_H_
|