void wxStaticText::SetLabel(
  const wxString&                   rsLabel
)
{
    m_labelOrig = rsLabel;       // save original label

    // OS/2 does not support neither ellipsize nor markup in static text:
    DoSetLabel(rsLabel);
    DoSetLabel(GetEllipsizedLabelWithoutMarkup());

    //
    // Adjust the size of the window to fit to the label unless autoresizing is
    // disabled
    //
    if (!(GetWindowStyle() & wxST_NO_AUTORESIZE) &&
        !IsEllipsized())
    {
        wxCoord                     vX;
        wxCoord                     vY;
        wxCoord                     vWidth;
        wxCoord                     vHeight;

        GetPosition(&vX, &vY);
        GetSize(&vWidth, &vHeight);
        if (!(vX == -1 && vY == -1 && vWidth == -1 && vHeight == -1))
            DoSetSize(vX, vY, vWidth, vHeight, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
        else
            DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
    }
} // end of wxStaticText::SetLabel
Example #2
0
void wxStaticText::SetLabel(const wxString& label)
{
    m_labelOrig = label;

    // middle/end ellipsization is handled by the OS:
    if ( HasFlag(wxST_ELLIPSIZE_END) || HasFlag(wxST_ELLIPSIZE_MIDDLE)
#if wxOSX_USE_COCOA // Cocoa has all three modes
         || HasFlag(wxST_ELLIPSIZE_START)
#endif
    )
    {
        // leave ellipsization to the OS
        DoSetLabel(GetLabelWithoutMarkup());
    }
    else // not supported natively
    {
        DoSetLabel(GetEllipsizedLabelWithoutMarkup());
    }

    if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) &&
         !IsEllipsized() )  // don't resize if we adjust to current size
    {
        InvalidateBestSize();
        SetSize( GetBestSize() );
    }

    Refresh();

    // we shouldn't need forced updates
    // Update();
}
Example #3
0
void wxStaticText::SetLabel(const wxString& label)
{
    m_labelOrig = label;       // save original label

    // Motif does not support ellipsized labels natively
    DoSetLabel(GetEllipsizedLabel());
}
void wxStaticText::SetLabel(const wxString& label)
{
    m_labelOrig = label;       // save original label

    // Motif does not support neither ellipsize nor markup in static text:
    DoSetLabel(GetEllipsizedLabelWithoutMarkup());
}
Example #5
0
void wxGenericStaticText::SetLabel(const wxString& label)
{
    wxControl::SetLabel(label);
    DoSetLabel(GetEllipsizedLabelWithoutMarkup());
    if ( !HasFlag(wxST_NO_AUTORESIZE) && !IsEllipsized() )
        InvalidateBestSize();
    Refresh();
}
Example #6
0
void wxStaticText::SetLabel(const wxString& label)
{
#ifdef SS_ENDELLIPSIS
    long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE);
    if ( HasFlag(wxST_ELLIPSIZE_END) &&
          wxGetOsVersion() == wxOS_WINDOWS_NT )
    {
        // adding SS_ENDELLIPSIS or SS_ENDELLIPSIS "disables" the correct
        // newline handling in static texts: the newlines in the labels are
        // shown as square. Thus we don't use it even on newer OS when
        // the static label contains a newline.
        if ( label.Contains(wxT('\n')) )
            styleReal &= ~SS_ENDELLIPSIS;
        else
            styleReal |= SS_ENDELLIPSIS;

        ::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
    }
    else // style not supported natively
    {
        styleReal &= ~SS_ENDELLIPSIS;
        ::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
    }
#endif // SS_ENDELLIPSIS

    // save the label in m_labelOrig with both the markup (if any) and
    // the mnemonics characters (if any)
    m_labelOrig = label;

#ifdef SS_ENDELLIPSIS
    if ( styleReal & SS_ENDELLIPSIS )
        DoSetLabel(GetLabel());
    else
#endif // SS_ENDELLIPSIS
        DoSetLabel(GetEllipsizedLabel());

    // adjust the size of the window to fit to the label unless autoresizing is
    // disabled
    if ( !HasFlag(wxST_NO_AUTORESIZE) &&
         !IsEllipsized() )  // if ellipsize is ON, then we don't want to get resized!
    {
        InvalidateBestSize();
        DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord,
                  wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
    }
}
Example #7
0
void wxStaticText::SetLabel(const wxString& str)
{
    // save original label
    m_labelOrig = str;

    // draw as real label the abbreviated version of it
    DoSetLabel(GetEllipsizedLabel());
}
Example #8
0
void wxStaticText::SetLabel(const wxString& label)
{
#ifdef SS_ENDELLIPSIS
    long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE);
    if ( HasFlag(wxST_ELLIPSIZE_END) )
    {
        // adding SS_ENDELLIPSIS or SS_ENDELLIPSIS "disables" the correct
        // newline handling in static texts: the newlines in the labels are
        // shown as square. Thus we don't use it even on newer OS when
        // the static label contains a newline.
        if ( label.Contains(wxT('\n')) )
            styleReal &= ~SS_ENDELLIPSIS;
        else
            styleReal |= SS_ENDELLIPSIS;

        ::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
    }
    else // style not supported natively
    {
        styleReal &= ~SS_ENDELLIPSIS;
        ::SetWindowLong(GetHwnd(), GWL_STYLE, styleReal);
    }
#endif // SS_ENDELLIPSIS

    // save the label in m_labelOrig with both the markup (if any) and
    // the mnemonics characters (if any)
    m_labelOrig = label;

#ifdef SS_ENDELLIPSIS
    if ( styleReal & SS_ENDELLIPSIS )
        DoSetLabel(GetLabel());
    else
#endif // SS_ENDELLIPSIS
        DoSetLabel(GetEllipsizedLabel());

    InvalidateBestSize();

    if ( !IsEllipsized() )  // if ellipsize is ON, then we don't want to get resized!
    {
        AutoResizeIfNecessary();
    }
}
Example #9
0
void wxGenericStaticText::SetLabel(const wxString& label)
{
    wxControl::SetLabel(label);
    DoSetLabel(GetEllipsizedLabel());
    if ( !HasFlag(wxST_NO_AUTORESIZE) && !IsEllipsized() )
        InvalidateBestSize();

#if wxUSE_MARKUP
    if ( m_markupText )
    {
        delete m_markupText;
        m_markupText = NULL;
    }
#endif // wxUSE_MARKUP

    Refresh();
}
Example #10
0
void wxStaticTextBase::UpdateLabel()
{
    if (!IsEllipsized())
        return;

    wxString newlabel = GetEllipsizedLabelWithoutMarkup();

    // we need to touch the "real" label (i.e. the text set inside the control,
    // using port-specific functions) instead of the string returned by GetLabel().
    //
    // In fact, we must be careful not to touch the original label passed to
    // SetLabel() otherwise GetLabel() will behave in a strange way to the user
    // (e.g. returning a "Ver...ing" instead of "Very long string") !
    if (newlabel == DoGetLabel())
        return;
    DoSetLabel(newlabel);
}
Example #11
0
void wxGenericStaticText::SetLabel(const wxString& label)
{
    wxControl::SetLabel(label);
    DoSetLabel(GetEllipsizedLabel());

    AutoResizeIfNecessary();

#if wxUSE_MARKUP
    if ( m_markupText )
    {
        delete m_markupText;
        m_markupText = NULL;
    }
#endif // wxUSE_MARKUP

    Refresh();
}