added wxBU_NOTEXT style to allow creating bitmap buttons with stock id not showing the label, as it was possible before

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-06-17 22:13:46 +00:00
parent 6e7d2550ce
commit a21175918e
6 changed files with 50 additions and 19 deletions

View File

@@ -126,7 +126,8 @@ bool wxButton::Create(wxWindow *parent,
// create either a standard button with text label (which may still contain
// an image under GTK+ 2.6+) or a bitmap-only button if we don't have any
// label
const bool useLabel = !label.empty() || wxIsStockID(id);
const bool
useLabel = !(style & wxBU_NOTEXT) && (!label.empty() || wxIsStockID(id));
if ( useLabel )
{
m_widget = gtk_button_new_with_mnemonic("");
@@ -237,6 +238,10 @@ void wxButton::SetLabel( const wxString &lbl )
wxControl::SetLabel(label);
// don't use label if it was explicitly disabled
if ( HasFlag(wxBU_NOTEXT) )
return;
if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
{
const char *stock = wxGetStockGtkID(m_windowId);
@@ -410,7 +415,7 @@ void wxButton::GTKDoShowBitmap(const wxBitmap& bitmap)
wxASSERT_MSG( bitmap.IsOk(), "invalid bitmap" );
GtkWidget *image;
if ( GetLabel().empty() )
if ( DontShowLabel() )
{
image = GTK_BIN(m_widget)->child;
}
@@ -450,7 +455,7 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which)
switch ( which )
{
case State_Normal:
if ( GetLabel().empty() )
if ( DontShowLabel() )
{
// we only have the bitmap in this button, never remove it but
// do invalidate the best size when the bitmap (and presumably