Add new wxCommandLinkButton class.

A command link button wraps a native MSW control under recent Windows versions
and is implemented generically as a simple bitmap button elsewhere.

In the future, GTK implementation should allow using a different font for the
button label and its note.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65327 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-08-17 14:48:50 +00:00
parent dd71bfb992
commit 3571e1add4
37 changed files with 1291 additions and 76 deletions

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/generic/commandlinkbuttong.cpp
// Purpose: wxGenericCommandLinkButton
// Author: Rickard Westerlund
// Created: 2010-06-23
// RCS-ID: $Id$
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_COMMANDLINKBUTTON
#include "wx/commandlinkbutton.h"
#include "wx/artprov.h"
#if wxUSE_EXTENDED_RTTI
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCommandLinkButton, wxButton, "wx/commandlinkbutton.h")
#else
wxIMPLEMENT_DYNAMIC_CLASS(wxCommandLinkButton, wxButton)
#endif // wxUSE_EXTENDED_RTTI
// ----------------------------------------------------------------------------
// Generic command link button
// ----------------------------------------------------------------------------
bool wxGenericCommandLinkButton::Create(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel,
const wxString& note,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name)
{
if ( !wxButton::Create(parent,
id,
mainLabel + '\n' + note,
pos,
size,
style,
validator,
name) )
return false;
if ( !HasNativeBitmap() )
SetDefaultBitmap();
return true;
}
void wxGenericCommandLinkButton::SetDefaultBitmap()
{
SetBitmap(wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_BUTTON));
}
#endif // wxUSE_COMMANDLINKBUTTON