Rename wxEllipsizeFlags elements to avoid confusion with wxEllipsizeMode.

We shouldn't use the same "wxELLIPSIZE_" prefix for two different enums, so
use wxELLIPSIZE_FLAGS one for wxEllipsizeFlags (they should be used less often
than wxEllipsizeMode so it's better to keep the short prefix for the latter).

Also add wxELLIPSIZE_FLAGS_NONE flag.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-16 21:32:51 +00:00
parent 73b1b99623
commit 355ce7adea
5 changed files with 35 additions and 21 deletions

View File

@@ -31,10 +31,12 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[];
enum wxEllipsizeFlags
{
wxELLIPSIZE_PROCESS_MNEMONICS = 1,
wxELLIPSIZE_EXPAND_TAB = 2,
wxELLIPSIZE_FLAGS_NONE = 0,
wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1,
wxELLIPSIZE_FLAGS_EXPAND_TABS = 2,
wxELLIPSIZE_DEFAULT_FLAGS = wxELLIPSIZE_PROCESS_MNEMONICS|wxELLIPSIZE_EXPAND_TAB
wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS |
wxELLIPSIZE_FLAGS_EXPAND_TABS
};
enum wxEllipsizeMode
@@ -115,7 +117,7 @@ public:
// replaces parts of the (multiline) string with ellipsis if needed
static wxString Ellipsize(const wxString& label, const wxDC& dc,
wxEllipsizeMode mode, int maxWidth,
int flags = wxELLIPSIZE_DEFAULT_FLAGS);
int flags = wxELLIPSIZE_FLAGS_DEFAULT);
// get the string without mnemonic characters ('&')
static wxString GetLabelText(const wxString& label);

View File

@@ -11,21 +11,33 @@
*/
enum wxEllipsizeFlags
{
/// With this flag when calculating the size of the passed string, mnemonics
/// characters (see wxControl::SetLabel) will be automatically reduced to a
/// single character.
/// This leads to correct calculations only if the string passed to Ellipsize()
/// will be used with wxControl::SetLabel. If you don't want ampersand to
/// be interpreted as mnemonics (e.g. because you use wxControl::SetLabelText)
/// then don't use this flag.
wxELLIPSIZE_PROCESS_MNEMONICS = 1,
/// No special flags.
wxELLIPSIZE_FLAGS_NONE = 0,
/// This flag tells wxControl::Ellipsize to calculate the width of tab
/// characters @c '\\t' as 6 spaces.
wxELLIPSIZE_EXPAND_TAB = 2,
/**
Take mnemonics into account when calculating the text width.
With this flag when calculating the size of the passed string,
mnemonics characters (see wxControl::SetLabel) will be automatically
reduced to a single character. This leads to correct calculations only
if the string passed to Ellipsize() will be used with
wxControl::SetLabel. If you don't want ampersand to be interpreted as
mnemonics (e.g. because you use wxControl::SetLabelText) then don't use
this flag.
*/
wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1,
/**
Expand tabs in spaces when calculating the text width.
This flag tells wxControl::Ellipsize() to calculate the width of tab
characters @c '\\t' as 6 spaces.
*/
wxELLIPSIZE_FLAGS_EXPAND_TABS = 2,
/// The default flags for wxControl::Ellipsize.
wxELLIPSIZE_DEFAULT_FLAGS = wxELLIPSIZE_PROCESS_MNEMONICS|wxELLIPSIZE_EXPAND_TAB
wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS|
wxELLIPSIZE_FLAGS_EXPAND_TABS
};
@@ -96,7 +108,7 @@ public:
*/
static wxString Ellipsize(const wxString& label, const wxDC& dc,
wxEllipsizeMode mode, int maxWidth,
int flags = wxELLIPSIZE_DEFAULT_FLAGS);
int flags = wxELLIPSIZE_FLAGS_DEFAULT);
/**
Returns the control's text.

View File

@@ -412,7 +412,7 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc,
}
}
// we need to remove mnemonics from the label for correct calculations
else if ( *pc == wxS('&') && (flags & wxELLIPSIZE_PROCESS_MNEMONICS) != 0 )
else if ( *pc == wxS('&') && (flags & wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS) )
{
// pc+1 is safe: at worst we'll be at end()
wxString::const_iterator next = pc + 1;
@@ -421,7 +421,7 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc,
//else: remove this ampersand
}
// we need also to expand tabs to properly calc their size
else if ( *pc == wxS('\t') && (flags & wxELLIPSIZE_EXPAND_TAB) != 0 )
else if ( *pc == wxS('\t') && (flags & wxELLIPSIZE_FLAGS_EXPAND_TABS) )
{
// Windows natively expands the TABs to 6 spaces. Do the same:
curLine += wxS(" ");

View File

@@ -248,7 +248,7 @@ void wxStatusBarGeneric::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int
text = wxControl::Ellipsize(text, dc,
ellmode,
maxWidth,
wxELLIPSIZE_EXPAND_TAB);
wxELLIPSIZE_FLAGS_EXPAND_TABS);
// Ellipsize() will do something only if necessary
// update the ellipsization status for this pane; this is used later to

View File

@@ -316,7 +316,7 @@ void wxStatusBar::DoUpdateStatusText(int nField)
*m_pDC,
ellmode,
maxWidth,
wxELLIPSIZE_EXPAND_TAB);
wxELLIPSIZE_FLAGS_EXPAND_TABS);
// update the ellipsization status for this pane; this is used later to
// decide whether a tooltip should be shown or not for this pane