20 #ifndef INCLUDED_VCL_LSTBOX_HXX
21 #define INCLUDED_VCL_LSTBOX_HXX
23 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
24 #error "don't use this in new code"
27 #include <config_options.h>
37 #define LISTBOX_APPEND (SAL_MAX_INT32)
38 #define LISTBOX_ENTRY_NOTFOUND (SAL_MAX_INT32)
39 #define LISTBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1)
95 bool mbDDAutoSize : 1;
98 SAL_DLLPRIVATE
void ImplInitListBoxData();
112 using Window::ImplInit;
125 virtual void dispose()
override;
129 virtual void Resize()
override;
146 void AdaptDropDownLineCountToMaximum();
147 void SetDropDownLineCount( sal_uInt16 nLines );
148 sal_uInt16 GetDropDownLineCount()
const;
150 void EnableAutoSize(
bool bAuto );
153 sal_Int32 InsertEntry(
const OUString& rStr, sal_Int32 nPos =
LISTBOX_APPEND );
154 sal_Int32 InsertEntry(
const OUString& rStr,
const Image& rImage, sal_Int32 nPos =
LISTBOX_APPEND );
155 void RemoveEntry( sal_Int32 nPos );
159 sal_Int32 GetEntryPos( std::u16string_view rStr )
const;
160 Image GetEntryImage( sal_Int32 nPos )
const;
161 OUString GetEntry( sal_Int32 nPos )
const;
162 sal_Int32 GetEntryCount()
const;
164 void SelectEntry( std::u16string_view rStr,
bool bSelect =
true );
165 void SelectEntryPos( sal_Int32 nPos,
bool bSelect =
true );
166 void SelectEntriesPos(
const std::vector<sal_Int32>& rPositions,
bool bSelect =
true );
168 sal_Int32 GetSelectedEntryCount()
const;
169 OUString GetSelectedEntry( sal_Int32 nSelIndex = 0 )
const;
170 sal_Int32 GetSelectedEntryPos( sal_Int32 nSelIndex = 0 )
const;
172 bool IsEntryPosSelected( sal_Int32 nPos )
const;
173 void SetNoSelection();
175 void SetEntryData( sal_Int32 nPos,
void* pNewData );
176 void* GetEntryData( sal_Int32 nPos )
const;
188 void SetTopEntry( sal_Int32 nPos );
189 sal_Int32 GetTopEntry()
const;
195 void SetSeparatorPos( sal_Int32 n );
200 sal_Int32 GetSeparatorPos()
const;
205 void AddSeparator( sal_Int32 n );
207 bool IsTravelSelect()
const;
208 bool IsInDropDown()
const;
209 void ToggleDropDown();
211 void EnableMultiSelection(
bool bMulti );
212 bool IsMultiSelectionEnabled()
const;
214 void SetReadOnly(
bool bReadOnly =
true );
221 Size CalcSubEditSize()
const;
222 Size CalcMinimumSize()
const;
224 Size CalcAdjustedSize(
const Size& rPrefSize )
const;
225 Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines )
const;
226 void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines )
const;
228 sal_uInt16 GetDisplayLineCount()
const;
251 void setMaxWidthChars(sal_Int32 nWidth);
253 virtual bool set_property(
const OString &rKey,
const OUString &rValue)
override;
260 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MultiListBox final :
public ListBox
267 #endif // INCLUDED_VCL_LSTBOX_HXX
sal_Int32 m_nMaxWidthChars
virtual const Wallpaper & GetDisplayBackground() const
bool IsDropDownBox() const
virtual FactoryFunction GetUITestFactory() const
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
A widget used to choose from a list of items and which has no entry.
virtual void StateChanged(StateChangedType nStateChange) override
virtual void FillLayoutData() const
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
VclPtr< ImplListBox > mpImplLB
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
this flags lets the item be drawn disabled (e.g.
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
this flag disables a selection of an entry completely.
bool IsAutoSizeEnabled() const
this flag can be used to make an entry multiline capable A normal entry is single line and will there...
virtual bool PreNotify(NotifyEvent &rNEvt)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
virtual void Draw(::OutputDevice *pDev, const Point &rPos, DrawFlags nFlags)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
virtual bool set_property(const OString &rKey, const OUString &rValue)
void SetSelectHdl(const Link< ListBox &, void > &rLink)
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
virtual Size GetOptimalSize() const override
virtual void Resize() override
tools::Long GetIndexForPoint(const Point &rPoint) const
VclPtr< ImplListBoxFloatingWindow > mpFloatWin
VclPtr< ImplWin > mpImplWin
Event to pass information for UserDraw() handling eg. in comboboxes.
Link< ListBox &, void > maSelectHdl
virtual void DataChanged(const DataChangedEvent &rDCEvt)