Add convenient wxST_ELLIPSIZE_MASK constant.

This is simply a combination of all 3 different wxST_ELLIPSIZE_XXX styles and
makes it simpler to test if any of them is specified.

No real changes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2015-02-11 21:16:08 +00:00
parent 52dbc7e6f8
commit 67f2950cb1
3 changed files with 6 additions and 5 deletions

View File

@@ -26,6 +26,9 @@
#define wxST_ELLIPSIZE_MIDDLE 0x0008 #define wxST_ELLIPSIZE_MIDDLE 0x0008
#define wxST_ELLIPSIZE_END 0x0010 #define wxST_ELLIPSIZE_END 0x0010
#define wxST_ELLIPSIZE_MASK \
(wxST_ELLIPSIZE_START | wxST_ELLIPSIZE_MIDDLE | wxST_ELLIPSIZE_END)
extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[];
class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl
@@ -44,9 +47,7 @@ public:
bool IsEllipsized() const bool IsEllipsized() const
{ {
return HasFlag(wxST_ELLIPSIZE_START) || return (GetWindowStyle() & wxST_ELLIPSIZE_MASK) != 0;
HasFlag(wxST_ELLIPSIZE_MIDDLE) ||
HasFlag(wxST_ELLIPSIZE_END);
} }
protected: // functions required for wxST_ELLIPSIZE_* support protected: // functions required for wxST_ELLIPSIZE_* support

View File

@@ -156,7 +156,7 @@ wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer,
[v setBordered:NO]; [v setBordered:NO];
NSLineBreakMode linebreak = NSLineBreakByClipping; NSLineBreakMode linebreak = NSLineBreakByClipping;
if ( ((wxStaticText*)wxpeer)->IsEllipsized() ) if ( style & wxST_ELLIPSIZE_MASK )
{ {
if ( style & wxST_ELLIPSIZE_MIDDLE ) if ( style & wxST_ELLIPSIZE_MIDDLE )
linebreak = NSLineBreakByTruncatingMiddle; linebreak = NSLineBreakByTruncatingMiddle;

View File

@@ -81,7 +81,7 @@ wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer,
v.backgroundColor = [UIColor clearColor]; v.backgroundColor = [UIColor clearColor];
UILineBreakMode linebreak = UILineBreakModeWordWrap; UILineBreakMode linebreak = UILineBreakModeWordWrap;
if ( ((wxStaticText*)wxpeer)->IsEllipsized() ) if ( style & wxST_ELLIPSIZE_MASK )
{ {
if ( style & wxST_ELLIPSIZE_MIDDLE ) if ( style & wxST_ELLIPSIZE_MIDDLE )
linebreak = UILineBreakModeMiddleTruncation; linebreak = UILineBreakModeMiddleTruncation;