#include "wx/settings.h"
#endif
+#include "wx/private/markupparser.h"
+
const char wxControlNameStr[] = "control";
// ============================================================================
#endif // wxUSE_RADIOBTN
}
+wxSize wxControlBase::DoGetSizeFromTextSize(int WXUNUSED(xlen),
+ int WXUNUSED(ylen)) const
+{
+ return wxSize(-1, -1);
+}
+
/* static */
wxString wxControlBase::GetLabelText(const wxString& label)
{
return attrs;
}
+// ----------------------------------------------------------------------------
+// wxControl markup support
+// ----------------------------------------------------------------------------
+
+#if wxUSE_MARKUP
+
+/* static */
+wxString wxControlBase::RemoveMarkup(const wxString& markup)
+{
+ return wxMarkupParser::Strip(markup);
+}
+
+bool wxControlBase::DoSetLabelMarkup(const wxString& markup)
+{
+ const wxString label = RemoveMarkup(markup);
+ if ( label.empty() && !markup.empty() )
+ return false;
+
+ SetLabel(label);
+
+ return true;
+}
+
+#endif // wxUSE_MARKUP
+
// ----------------------------------------------------------------------------
// wxControlBase - ellipsization code
// ----------------------------------------------------------------------------
// add this (ellipsized) row to the rest of the label
ret << curLine;
if ( pc == label.end() )
- {
- // NOTE: this is the return which always exits the function
- return ret;
- }
- else
- {
- ret << *pc;
- curLine.clear();
- }
+ break;
+
+ ret << *pc;
+ curLine.clear();
}
// we need to remove mnemonics from the label for correct calculations
else if ( *pc == wxS('&') && (flags & wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS) )
}
}
- // this return would generate a
- // warning C4702: unreachable code
- // with MSVC since the function always exits from inside the loop
- //return ret;
+ return ret;
}
-
-
// ----------------------------------------------------------------------------
// wxStaticBitmap
// ----------------------------------------------------------------------------
{
wxSize best;
wxBitmap bmp = GetBitmap();
- if ( bmp.Ok() )
+ if ( bmp.IsOk() )
best = wxSize(bmp.GetWidth(), bmp.GetHeight());
else
// this is completely arbitrary