common implementation files

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55202 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-08-23 12:43:44 +00:00
parent 4df230b81e
commit e53b3d16de
10 changed files with 1737 additions and 0 deletions

86
src/osx/bmpbuttn_osx.cpp Normal file
View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/osx/bmpbuttn_osx.cpp
// Purpose: wxBitmapButton
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id: bmpbuttn.cpp 54820 2008-07-29 20:04:11Z SC $
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#if wxUSE_BMPBUTTON
#include "wx/bmpbuttn.h"
#include "wx/image.h"
#ifndef WX_PRECOMP
#include "wx/dcmemory.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
#include "wx/osx/private.h"
//---------------------------------------------------------------------------
bool wxBitmapButton::Create( wxWindow *parent,
wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name )
{
m_macIsUserPane = false;
// since bitmapbuttonbase is subclass of button calling wxBitmapButtonBase::Create
// essentially creates an additional button
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return false;
if ( style & wxBU_AUTODRAW )
{
m_marginX =
m_marginY = wxDEFAULT_BUTTON_MARGIN;
}
else
{
m_marginX =
m_marginY = 0;
}
m_bmpNormal = bitmap;
m_peer = wxWidgetImpl::CreateBitmapButton( this, parent, id, bitmap, pos, size, style, GetExtraStyle() );
MacPostControlCreate( pos, size );
return true;
}
void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
{
InvalidateBestSize();
m_peer->SetBitmap( bitmap );
}
wxSize wxBitmapButton::DoGetBestSize() const
{
wxSize best;
best.x = 2 * m_marginX;
best.y = 2 * m_marginY;
if ( m_bmpNormal.Ok() )
{
best.x += m_bmpNormal.GetWidth();
best.y += m_bmpNormal.GetHeight();
}
return best;
}
#endif