1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-06-26 20:59:19 +00:00
|
|
|
// Name: wx/msw/statbmp.h
|
|
|
|
// Purpose: wxStaticBitmap class for wxMSW
|
1998-05-20 14:12:05 +00:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_STATBMP_H_
|
|
|
|
#define _WX_STATBMP_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
#include "wx/control.h"
|
1999-08-22 20:16:23 +00:00
|
|
|
#include "wx/icon.h"
|
1999-12-02 14:47:49 +00:00
|
|
|
#include "wx/bitmap.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[];
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-03-24 23:35:16 +00:00
|
|
|
// a control showing an icon or a bitmap
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-01-31 23:30:33 +00:00
|
|
|
public:
|
1999-03-24 23:35:16 +00:00
|
|
|
wxStaticBitmap() { Init(); }
|
|
|
|
|
|
|
|
wxStaticBitmap(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
1999-11-24 12:30:56 +00:00
|
|
|
const wxGDIImage& label,
|
1999-03-24 23:35:16 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr)
|
1999-01-31 23:30:33 +00:00
|
|
|
{
|
2002-12-21 14:35:18 +00:00
|
|
|
Init();
|
|
|
|
|
1999-01-31 23:30:33 +00:00
|
|
|
Create(parent, id, label, pos, size, style, name);
|
|
|
|
}
|
1999-03-24 23:35:16 +00:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
1999-11-24 12:30:56 +00:00
|
|
|
const wxGDIImage& label,
|
1999-03-24 23:35:16 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr);
|
|
|
|
|
|
|
|
virtual ~wxStaticBitmap() { Free(); }
|
|
|
|
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE { SetImage(&icon); }
|
|
|
|
virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE { SetImage(&bitmap); }
|
|
|
|
virtual wxBitmap GetBitmap() const wxOVERRIDE;
|
|
|
|
virtual wxIcon GetIcon() const wxOVERRIDE;
|
2002-12-21 14:35:18 +00:00
|
|
|
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE;
|
1999-03-24 23:35:16 +00:00
|
|
|
|
2007-08-07 19:22:43 +00:00
|
|
|
// returns true if the platform should explicitly apply a theme border
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
|
2007-08-07 19:22:43 +00:00
|
|
|
|
1999-01-31 23:30:33 +00:00
|
|
|
protected:
|
2016-09-23 14:59:11 +00:00
|
|
|
virtual wxSize DoGetBestClientSize() const wxOVERRIDE;
|
1999-11-24 12:30:56 +00:00
|
|
|
|
2002-12-21 14:35:18 +00:00
|
|
|
// ctor/dtor helpers
|
2014-03-14 19:22:31 +00:00
|
|
|
void Init();
|
1999-03-24 23:35:16 +00:00
|
|
|
void Free();
|
|
|
|
|
2004-09-04 01:53:42 +00:00
|
|
|
// true if icon/bitmap is valid
|
1999-03-24 23:35:16 +00:00
|
|
|
bool ImageIsOk() const;
|
|
|
|
|
2000-02-02 00:52:06 +00:00
|
|
|
void SetImage(const wxGDIImage* image);
|
2001-11-06 21:16:02 +00:00
|
|
|
void SetImageNoCopy( wxGDIImage* image );
|
1999-11-24 12:30:56 +00:00
|
|
|
|
2008-01-06 00:51:38 +00:00
|
|
|
// draw the bitmap ourselves here if the OS can't do it correctly (if it
|
|
|
|
// can we leave it to it)
|
|
|
|
void DoPaintManually(wxPaintEvent& event);
|
|
|
|
|
2013-02-09 00:35:54 +00:00
|
|
|
void WXHandleSize(wxSizeEvent& event);
|
2008-01-06 00:51:38 +00:00
|
|
|
|
1999-03-24 23:35:16 +00:00
|
|
|
// we can have either an icon or a bitmap
|
|
|
|
bool m_isIcon;
|
1999-11-24 12:30:56 +00:00
|
|
|
wxGDIImage *m_image;
|
2006-01-19 07:37:18 +00:00
|
|
|
|
2006-01-17 16:08:59 +00:00
|
|
|
// handle used in last call to STM_SETIMAGE
|
2006-01-19 07:37:18 +00:00
|
|
|
WXHANDLE m_currentHandle;
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
private:
|
2014-03-14 19:22:31 +00:00
|
|
|
// Flag indicating whether we own m_currentHandle, i.e. should delete it.
|
|
|
|
bool m_ownsCurrentHandle;
|
|
|
|
|
2014-03-14 19:22:26 +00:00
|
|
|
// Replace the image at the native control level with the given HBITMAP or
|
|
|
|
// HICON (which can be 0) and destroy the previous image if necessary.
|
|
|
|
void MSWReplaceImageHandle(WXLPARAM handle);
|
|
|
|
|
2014-03-14 19:22:31 +00:00
|
|
|
// Delete the current handle only if we own it.
|
|
|
|
void DeleteCurrentHandleIfNeeded();
|
|
|
|
|
|
|
|
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap);
|
2013-02-09 00:35:54 +00:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxStaticBitmap);
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_STATBMP_H_
|