KiCad PCB EDA Suite
Loading...
Searching...
No Matches
WX_ELLIPSIZED_STATIC_TEXT Class Reference

A version of a wxStaticText control that will request a smaller size than the full string. More...

#include <wx_ellipsized_static_text.h>

Inheritance diagram for WX_ELLIPSIZED_STATIC_TEXT:

Public Member Functions

 WX_ELLIPSIZED_STATIC_TEXT (wxWindow *aParent, wxWindowID aID, const wxString &aLabel, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize, long aStyle=0)
 
void SetMinimumStringLength (const wxString &aString)
 Set the string that is used for determining the requested size of the control.
 

Protected Member Functions

wxSize DoGetBestSize () const override
 

Private Attributes

wxString m_minimumString
 

Detailed Description

A version of a wxStaticText control that will request a smaller size than the full string.

This can be used with the ellipsization styles to ensure that the control will actually ellipsize properly inside sizer elements (since they ask for the best size but GTK reports the best size as being the full string length, even when ellipsization is enabled). This work around is discussed in upstream ticket https://trac.wxwidgets.org/ticket/18992.

Definition at line 37 of file wx_ellipsized_static_text.h.

Constructor & Destructor Documentation

◆ WX_ELLIPSIZED_STATIC_TEXT()

WX_ELLIPSIZED_STATIC_TEXT::WX_ELLIPSIZED_STATIC_TEXT ( wxWindow *  aParent,
wxWindowID  aID,
const wxString &  aLabel,
const wxPoint &  aPos = wxDefaultPosition,
const wxSize &  aSize = wxDefaultSize,
long  aStyle = 0 
)

Definition at line 27 of file wx_ellipsized_static_text.cpp.

Member Function Documentation

◆ DoGetBestSize()

wxSize WX_ELLIPSIZED_STATIC_TEXT::DoGetBestSize ( ) const
overrideprotected

Definition at line 36 of file wx_ellipsized_static_text.cpp.

References KIUI::GetTextSize(), and m_minimumString.

◆ SetMinimumStringLength()

void WX_ELLIPSIZED_STATIC_TEXT::SetMinimumStringLength ( const wxString &  aString)
inline

Set the string that is used for determining the requested size of the control.

The control will return this string length from GetBestSize(), regardless of what string the control is displaying.

Parameters
aStringis the smallest string to display without ellipses

Definition at line 52 of file wx_ellipsized_static_text.h.

References m_minimumString.

Referenced by LAYER_WIDGET::insertLayerRow().

Member Data Documentation

◆ m_minimumString

wxString WX_ELLIPSIZED_STATIC_TEXT::m_minimumString
private

Definition at line 61 of file wx_ellipsized_static_text.h.

Referenced by DoGetBestSize(), and SetMinimumStringLength().


The documentation for this class was generated from the following files: