Version: 3.3.4
Loading...
Searching...
No Matches
wxSVGAttributes Class Reference

#include <wx/dcsvg.h>

Detailed Description

Helper class for building a set of SVG and ARIA attributes to attach to an accessible group in the output of wxSVGFileDC.

ARIA (Accessible Rich Internet Applications) is a W3C specification of attributes that describe the content to assistive technology such as screen readers.

The class exposes a chainable builder API so multiple attributes can be specified inline. The resulting object is passed to wxSVGFileDC::BeginAccessibleGroup() or to the wxSVGAccessibleGroup RAII helper.

Example:

dc.BeginAccessibleGroup(
wxSVGAttributes().Role("img").AriaLabel("Quarterly sales"),
"Quarterly sales",
"Bar chart showing revenue for Q1-Q4 2026.");
// ... drawing commands ...
dc.EndAccessibleGroup();
wxSVGAttributes & Role(const wxString &role)
Sets the role attribute, which classifies the element for assistive technology.
wxSVGAttributes & AriaLabel(const wxString &label)
Sets the aria-label attribute: a short accessible name read aloud by screen readers.
wxSVGAttributes()
Default constructor creates an empty set of attributes.

Library:  wxCore
Category:  Device Contexts
Since
3.3.3

Public Member Functions

 wxSVGAttributes ()
 Default constructor creates an empty set of attributes.
wxSVGAttributes & Role (const wxString &role)
 Sets the role attribute, which classifies the element for assistive technology.
wxString GetRole () const
 Returns the role attribute.
wxSVGAttributes & AriaLabel (const wxString &label)
 Sets the aria-label attribute: a short accessible name read aloud by screen readers.
wxString GetAriaLabel () const
 Returns the aria-label attribute.
wxSVGAttributes & AriaLabelledBy (const wxString &id)
 Sets the aria-labelledby attribute: instead of supplying a name inline, points at the id of another element whose text content provides the accessible name.
wxString GetAriaLabelledBy () const
 Returns the aria-labelledby attribute.
wxSVGAttributes & AriaDescribedBy (const wxString &id)
 Sets the aria-describedby attribute: points at the id of another element whose text content provides a longer description, announced after the accessible name.
wxString GetAriaDescribedBy () const
 Returns the aria-describedby attribute.
wxSVGAttributes & AriaHidden (bool hidden=true)
 Sets the aria-hidden attribute.
bool IsAriaHidden () const
 Returns true if the aria-hidden attribute is set to "true".
wxSVGAttributes & AriaDetails (const wxString &id)
 Sets the aria-details attribute: points at the id of another element containing extended information about this one (e.g., a data table describing a chart).
wxString GetAriaDetails () const
 Returns the aria-details attribute.
wxSVGAttributes & AriaRoleDescription (const wxString &desc)
 Sets the aria-roledescription attribute: a human-readable, optionally localized phrase that replaces the default spoken role (for example "pie chart" instead of "graphic").
wxString GetAriaRoleDescription () const
 Returns the aria-roledescription attribute.
wxSVGAttributes & Id (const wxString &id)
 Sets the id attribute, giving the element a unique identifier other attributes (such as aria-labelledby) or stylesheets can reference.
wxString GetId () const
 Returns the id attribute.
wxSVGAttributes & Class (const wxString &classname)
 Sets the class attribute, used to associate the element with one or more CSS classes for styling the SVG output.
wxString GetClass () const
 Returns the class attribute.
wxSVGAttributes & Add (const wxString &name, const wxString &value)
 Adds or updates an arbitrary attribute.
wxString GetAttribute (const wxString &name) const
 Returns the value of the attribute with the given name.
bool IsEmpty () const
 Returns true if no attributes have been set.

Constructor & Destructor Documentation

◆ wxSVGAttributes()

wxSVGAttributes::wxSVGAttributes ( )

Default constructor creates an empty set of attributes.

Member Function Documentation

◆ Add()

wxSVGAttributes & wxSVGAttributes::Add ( const wxString & name,
const wxString & value )

Adds or updates an arbitrary attribute.

If name is already set, its value is replaced; otherwise a new entry is appended.

◆ AriaDescribedBy()

wxSVGAttributes & wxSVGAttributes::AriaDescribedBy ( const wxString & id)

Sets the aria-describedby attribute: points at the id of another element whose text content provides a longer description, announced after the accessible name.

◆ AriaDetails()

wxSVGAttributes & wxSVGAttributes::AriaDetails ( const wxString & id)

Sets the aria-details attribute: points at the id of another element containing extended information about this one (e.g., a data table describing a chart).

◆ AriaHidden()

wxSVGAttributes & wxSVGAttributes::AriaHidden ( bool hidden = true)

Sets the aria-hidden attribute.

The default hidden value of true is the common case (hide decorative content from assistive technology). Passing false is only meaningful when overriding an inherited aria-hidden="true" on an ancestor.

◆ AriaLabel()

wxSVGAttributes & wxSVGAttributes::AriaLabel ( const wxString & label)

Sets the aria-label attribute: a short accessible name read aloud by screen readers.

Use when no visible text label exists.

◆ AriaLabelledBy()

wxSVGAttributes & wxSVGAttributes::AriaLabelledBy ( const wxString & id)

Sets the aria-labelledby attribute: instead of supplying a name inline, points at the id of another element whose text content provides the accessible name.

◆ AriaRoleDescription()

wxSVGAttributes & wxSVGAttributes::AriaRoleDescription ( const wxString & desc)

Sets the aria-roledescription attribute: a human-readable, optionally localized phrase that replaces the default spoken role (for example "pie chart" instead of "graphic").

◆ Class()

wxSVGAttributes & wxSVGAttributes::Class ( const wxString & classname)

Sets the class attribute, used to associate the element with one or more CSS classes for styling the SVG output.

◆ GetAriaDescribedBy()

wxString wxSVGAttributes::GetAriaDescribedBy ( ) const

Returns the aria-describedby attribute.

Since
3.3.3

◆ GetAriaDetails()

wxString wxSVGAttributes::GetAriaDetails ( ) const

Returns the aria-details attribute.

Since
3.3.3

◆ GetAriaLabel()

wxString wxSVGAttributes::GetAriaLabel ( ) const

Returns the aria-label attribute.

Since
3.3.3

◆ GetAriaLabelledBy()

wxString wxSVGAttributes::GetAriaLabelledBy ( ) const

Returns the aria-labelledby attribute.

Since
3.3.3

◆ GetAriaRoleDescription()

wxString wxSVGAttributes::GetAriaRoleDescription ( ) const

Returns the aria-roledescription attribute.

Since
3.3.3

◆ GetAttribute()

wxString wxSVGAttributes::GetAttribute ( const wxString & name) const

Returns the value of the attribute with the given name.

Returns an empty string if the attribute is not set.

Since
3.3.3

◆ GetClass()

wxString wxSVGAttributes::GetClass ( ) const

Returns the class attribute.

Since
3.3.3

◆ GetId()

wxString wxSVGAttributes::GetId ( ) const

Returns the id attribute.

Since
3.3.3

◆ GetRole()

wxString wxSVGAttributes::GetRole ( ) const

Returns the role attribute.

Since
3.3.3

◆ Id()

wxSVGAttributes & wxSVGAttributes::Id ( const wxString & id)

Sets the id attribute, giving the element a unique identifier other attributes (such as aria-labelledby) or stylesheets can reference.

◆ IsAriaHidden()

bool wxSVGAttributes::IsAriaHidden ( ) const

Returns true if the aria-hidden attribute is set to "true".

Since
3.3.3

◆ IsEmpty()

bool wxSVGAttributes::IsEmpty ( ) const

Returns true if no attributes have been set.

◆ Role()

wxSVGAttributes & wxSVGAttributes::Role ( const wxString & role)

Sets the role attribute, which classifies the element for assistive technology.

Common SVG values include "img" (the subtree is a single graphical image), "graphics-document", and "graphics-symbol".