Files
wxWidgets/src/common/addremovectrl.cpp
Vadim Zeitlin 7f857efc2c Fix DLL declaration of wxAddRemoveCtrlNameStr.
The control, and its name string, are in the "adv" library, not "core".

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2015-02-09 12:10:39 +00:00

93 lines
2.8 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: src/common/addremovectrl.cpp
// Purpose: wxAddRemoveCtrl implementation.
// Author: Vadim Zeitlin
// Created: 2015-01-29
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_ADDREMOVECTRL
#ifndef WX_PRECOMP
#endif // WX_PRECOMP
#include "wx/addremovectrl.h"
#include "wx/private/addremovectrl.h"
// ============================================================================
// wxAddRemoveCtrl implementation
// ============================================================================
// ----------------------------------------------------------------------------
// common part
// ----------------------------------------------------------------------------
extern
WXDLLIMPEXP_DATA_ADV(const char) wxAddRemoveCtrlNameStr[] = "wxAddRemoveCtrl";
bool
wxAddRemoveCtrl::Create(wxWindow* parent,
wxWindowID winid,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
if ( !wxPanel::Create(parent, winid, pos, size, style, name) )
return false;
// We don't do anything here, the buttons are created when we're given the
// adaptor to use them with in SetAdaptor().
return true;
}
wxAddRemoveCtrl::~wxAddRemoveCtrl()
{
delete m_impl;
}
void wxAddRemoveCtrl::SetAdaptor(wxAddRemoveAdaptor* adaptor)
{
wxCHECK_RET( !m_impl, wxS("should be only called once") );
wxCHECK_RET( adaptor, wxS("should have a valid adaptor") );
wxWindow* const ctrlItems = adaptor->GetItemsCtrl();
wxCHECK_RET( ctrlItems, wxS("should have a valid items control") );
m_impl = new wxAddRemoveImpl(adaptor, this, ctrlItems);
}
void
wxAddRemoveCtrl::SetButtonsToolTips(const wxString& addtip,
const wxString& removetip)
{
wxCHECK_RET( m_impl, wxS("can only be called after SetAdaptor()") );
m_impl->SetButtonsToolTips(addtip, removetip);
}
wxSize wxAddRemoveCtrl::DoGetBestClientSize() const
{
return m_impl ? m_impl->GetBestClientSize() : wxDefaultSize;
}
#endif // wxUSE_ADDREMOVECTRL