Extract wxSTOCK_WITHOUT_ELLIPSIS from wxSTOCK_FOR_BUTTON.
Make it possible to use this flag on its own, without wxSTOCK_WITH_MNEMONIC which is also part of wxSTOCK_FOR_BUTTON. This can be useful for e.g. toolbar buttons. Closes #11681, #11682. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,9 +35,13 @@ enum wxStockLabelQueryFlag
|
|||||||
wxSTOCK_WITH_MNEMONIC = 1,
|
wxSTOCK_WITH_MNEMONIC = 1,
|
||||||
wxSTOCK_WITH_ACCELERATOR = 2,
|
wxSTOCK_WITH_ACCELERATOR = 2,
|
||||||
|
|
||||||
// return label for button, not menu item: notice that this always included
|
// by default, stock items text is returned with ellipsis, if appropriate,
|
||||||
// wxSTOCK_WITH_MNEMONIC as buttons should use mnemonics
|
// this flag allows to avoid having it
|
||||||
wxSTOCK_FOR_BUTTON = 5
|
wxSTOCK_WITHOUT_ELLIPSIS = 4,
|
||||||
|
|
||||||
|
// return label for button, not menu item: buttons should always use
|
||||||
|
// mnemonics and never use ellipsis
|
||||||
|
wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns label that should be used for given stock UI element (e.g. "&OK"
|
// Returns label that should be used for given stock UI element (e.g. "&OK"
|
||||||
|
@@ -24,7 +24,7 @@ enum wxStockLabelQueryFlag
|
|||||||
/**
|
/**
|
||||||
Request the label with mnemonics character.
|
Request the label with mnemonics character.
|
||||||
|
|
||||||
E.g. "&Print...".
|
E.g. "&Print...".
|
||||||
*/
|
*/
|
||||||
wxSTOCK_WITH_MNEMONIC = 1,
|
wxSTOCK_WITH_MNEMONIC = 1,
|
||||||
|
|
||||||
@@ -36,6 +36,20 @@ enum wxStockLabelQueryFlag
|
|||||||
*/
|
*/
|
||||||
wxSTOCK_WITH_ACCELERATOR = 2,
|
wxSTOCK_WITH_ACCELERATOR = 2,
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the label without any ellipsis at the end.
|
||||||
|
|
||||||
|
By default, stock items text is returned with ellipsis, if appropriate,
|
||||||
|
this flag allows to avoid having it. So using the same example as
|
||||||
|
above, the returned string would be "Print" or "&Print" if
|
||||||
|
wxSTOCK_WITH_MNEMONIC were also used.
|
||||||
|
|
||||||
|
This flag can't be combined with wxSTOCK_WITH_ACCELERATOR.
|
||||||
|
|
||||||
|
@since 2.9.1
|
||||||
|
*/
|
||||||
|
wxSTOCK_WITHOUT_ELLIPSIS = 4,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the label appropriate for a button and not a menu item.
|
Return the label appropriate for a button and not a menu item.
|
||||||
|
|
||||||
@@ -45,8 +59,10 @@ enum wxStockLabelQueryFlag
|
|||||||
wxID_PRINT when this flag is used is "&Print".
|
wxID_PRINT when this flag is used is "&Print".
|
||||||
|
|
||||||
This flag can't be combined with wxSTOCK_WITH_ACCELERATOR.
|
This flag can't be combined with wxSTOCK_WITH_ACCELERATOR.
|
||||||
|
|
||||||
|
@since 2.9.1
|
||||||
*/
|
*/
|
||||||
wxSTOCK_FOR_BUTTON = 5
|
wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @addtogroup group_funcmacro_misc */
|
/** @addtogroup group_funcmacro_misc */
|
||||||
|
@@ -205,16 +205,17 @@ wxString wxGetStockLabel(wxWindowID id, long flags)
|
|||||||
|
|
||||||
#undef STOCKITEM
|
#undef STOCKITEM
|
||||||
|
|
||||||
// we assume that buttons use the same labels as menu items but unlike them
|
if ( flags & wxSTOCK_WITHOUT_ELLIPSIS )
|
||||||
// they should never use ellipsis
|
|
||||||
if ( (flags & wxSTOCK_FOR_BUTTON) == wxSTOCK_FOR_BUTTON )
|
|
||||||
{
|
{
|
||||||
wxString baseLabel;
|
wxString baseLabel;
|
||||||
if ( stockLabel.EndsWith("...", &baseLabel) )
|
if ( stockLabel.EndsWith("...", &baseLabel) )
|
||||||
stockLabel = baseLabel;
|
stockLabel = baseLabel;
|
||||||
|
|
||||||
|
// accelerators only make sense for the menu items which should have
|
||||||
|
// ellipsis too while wxSTOCK_WITHOUT_ELLIPSIS is mostly useful for
|
||||||
|
// buttons which shouldn't have accelerators in their labels
|
||||||
wxASSERT_MSG( !(flags & wxSTOCK_WITH_ACCELERATOR),
|
wxASSERT_MSG( !(flags & wxSTOCK_WITH_ACCELERATOR),
|
||||||
"button labels never use accelerators" );
|
"labels without ellipsis shouldn't use accelerators" );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
Reference in New Issue
Block a user