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
// 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);
*/
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,
-
- /// This flag tells wxControl::Ellipsize to calculate the width of tab
- /// characters @c '\\t' as 6 spaces.
- wxELLIPSIZE_EXPAND_TAB = 2,
+ /// No special flags.
+ wxELLIPSIZE_FLAGS_NONE = 0,
+
+ /**
+ 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
};
*/
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.
}
}
// 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;
//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(" ");