예제 #1
0
/* static */
wxString wxStaticTextBase::GetLabelText(const wxString& label)
{
    wxString ret = RemoveMarkup(label);
        // always remove the markup (this function is static 
        // and cannot check for wxST_MARKUP presence/absence)

    return RemoveMnemonics(ret);
}
예제 #2
0
wxString wxStaticTextBase::GetLabelText() const
{
    wxString ret(GetLabel());

    if (HasFlag(wxST_MARKUP))
        ret = RemoveMarkup(ret);
    return RemoveMnemonics(ret);
}
예제 #3
0
bool wxControlBase::DoSetLabelMarkup(const wxString& markup)
{
    const wxString label = RemoveMarkup(markup);
    if ( label.empty() && !markup.empty() )
        return false;

    SetLabel(label);

    return true;
}
예제 #4
0
wxString wxStaticTextBase::GetLabelWithoutMarkup() const
{
    wxString ret(m_labelOrig);

    if (HasFlag(wxST_MARKUP))
        ret = RemoveMarkup(ret);

    // unlike GetLabelText() we don't remove the mnemonics here!
    return ret;
}
예제 #5
0
bool wxStaticText::DoSetLabelMarkup(const wxString& markup)
{
    const wxString stripped = RemoveMarkup(markup);
    if ( stripped.empty() && !markup.empty() )
        return false;

    m_labelOrig = stripped;

    GTKDoSetLabel(&wxStaticText::GTKSetLabelWithMarkupForLabel, markup);

    return true;
}
예제 #6
0
bool wxButton::DoSetLabelMarkup(const wxString& markup)
{
    wxCHECK_MSG( m_widget != NULL, false, "invalid button" );

    const wxString stripped = RemoveMarkup(markup);
    if ( stripped.empty() && !markup.empty() )
        return false;

    wxControl::SetLabel(stripped);

    GtkLabel * const label = GTKGetLabel();
    wxCHECK_MSG( label, false, "no label in this button?" );

    GTKSetLabelWithMarkupForLabel(label, markup);

    return true;
}
예제 #7
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

    // this call will save the label in m_labelOrig and set it into this window
    // (through wxWindow::SetLabel)
    m_labelOrig = label;

#ifdef SS_ENDELLIPSIS
    if ( styleReal & SS_ENDELLIPSIS )
        DoSetLabel(RemoveMarkup(label));
    else
#endif // SS_ENDELLIPSIS
        DoSetLabel(GetEllipsizedLabelWithoutMarkup());

    // 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);
    }
}
예제 #8
0
wxString wxStaticTextBase::GetEllipsizedLabelWithoutMarkup() const
{
    // this function should be used only by ports which do not support
    // ellipsis in static texts: we first remove markup (which cannot
    // be handled safely by Ellipsize()) and then ellipsize the result.

    wxString ret(m_labelOrig);

    // the order of the following two blocks is important!

    if (HasFlag(wxST_MARKUP))
        ret = RemoveMarkup(ret);

    if (IsEllipsized())
        ret = Ellipsize(ret);

    return ret;
}
예제 #9
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
    )
    {
        // remove markup
        wxString str(label);
        if (HasFlag(wxST_MARKUP))
            str = RemoveMarkup(label);

        // and leave ellipsization to the OS
        DoSetLabel(str);
    }
    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();
}
예제 #10
0
/*static*/
wxString wxStaticTextBase::GetLabelText(const wxString& label)
{
    // remove markup
    wxString ret = RemoveMarkup(label);
    return RemoveMnemonics(ret);
}