LibreOffice Module vcl (master) 1
listbox.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_VCL_INC_LISTBOX_HXX
21#define INCLUDED_VCL_INC_LISTBOX_HXX
22
23#include <sal/config.h>
24
25#include <o3tl/safeint.hxx>
26#include <utility>
30#include <vcl/vcllayout.hxx>
31
32#include "glyphid.hxx"
33
34#include <set>
35#include <vector>
36#include <memory>
37
38class ScrollBar;
39class ScrollBarBox;
40
41#define HORZ_SCROLL 4
42#define IMG_TXT_DISTANCE 6
43
45{
50};
51
53{
54 OUString maStr;
61
63
64 ImplEntryType( OUString aStr, Image aImage ) :
65 maStr(std::move( aStr )),
66 maImage(std::move( aImage )),
68 mnHeight( 0 )
69 {
70 mbIsSelected = false;
71 mpUserData = nullptr;
72 }
73
74 ImplEntryType( OUString aStr ) :
75 maStr(std::move( aStr )),
77 mnHeight( 0 )
78 {
79 mbIsSelected = false;
80 mpUserData = nullptr;
81 }
82
84 SalLayoutGlyphs* GetTextGlyphs(const OutputDevice* pOutputDevice);
85};
86
88{
89private:
91 sal_Int32 mnLastSelected;
93 sal_Int32 mnImages;
94
95 sal_Int32 mnMRUCount;
96 sal_Int32 mnMaxMRUCount;
97
100 std::vector<std::unique_ptr<ImplEntryType> > maEntries;
101
102 ImplEntryType* GetEntry( sal_Int32 nPos ) const
103 {
104 if (nPos < 0 || o3tl::make_unsigned(nPos) >= maEntries.size())
105 return nullptr;
106 return maEntries[nPos].get();
107 }
108
109public:
110 ImplEntryList( vcl::Window* pWindow );
112
113 sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort );
114 void RemoveEntry( sal_Int32 nPos );
115 const ImplEntryType* GetEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); }
116 ImplEntryType* GetMutableEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); }
117 void Clear();
118 void dispose();
119
120 sal_Int32 FindMatchingEntry( const OUString& rStr, sal_Int32 nStart, bool bLazy ) const;
121 sal_Int32 FindEntry( std::u16string_view rStr, bool bSearchMRUArea = false ) const;
122
127 tools::Long GetAddedHeight( sal_Int32 nEndIndex, sal_Int32 nBeginIndex ) const;
128 tools::Long GetEntryHeight( sal_Int32 nPos ) const;
129
130 sal_Int32 GetEntryCount() const { return static_cast<sal_Int32>(maEntries.size()); }
131 bool HasImages() const { return mnImages != 0; }
132
133 OUString GetEntryText( sal_Int32 nPos ) const;
134
135 bool HasEntryImage( sal_Int32 nPos ) const;
136 Image GetEntryImage( sal_Int32 nPos ) const;
137
138 void SetEntryData( sal_Int32 nPos, void* pNewData );
139 void* GetEntryData( sal_Int32 nPos ) const;
140
141 void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
142
143 void SelectEntry( sal_Int32 nPos, bool bSelect );
144
145 sal_Int32 GetSelectedEntryCount() const;
146 OUString GetSelectedEntry( sal_Int32 nIndex ) const;
147 sal_Int32 GetSelectedEntryPos( sal_Int32 nIndex ) const;
148 bool IsEntryPosSelected( sal_Int32 nIndex ) const;
149
150 void SetLastSelected( sal_Int32 nPos ) { mnLastSelected = nPos; }
151 sal_Int32 GetLastSelected() const { return mnLastSelected; }
152
153 void SetSelectionAnchor( sal_Int32 nPos ) { mnSelectionAnchor = nPos; }
154 sal_Int32 GetSelectionAnchor() const { return mnSelectionAnchor; }
155
158
159 void SetMRUCount( sal_Int32 n ) { mnMRUCount = n; }
160 sal_Int32 GetMRUCount() const { return mnMRUCount; }
161
162 void SetMaxMRUCount( sal_Int32 n ) { mnMaxMRUCount = n; }
163 sal_Int32 GetMaxMRUCount() const { return mnMaxMRUCount; }
164
167 bool IsEntrySelectable( sal_Int32 nPos ) const;
168
174 sal_Int32 FindFirstSelectable( sal_Int32 nPos, bool bForward = true ) const;
175};
176
178{
179private:
182
184
194
195 sal_Int32 mnCurrentPos;
197
198 std::set< sal_Int32 > maSeparators;
199
201
202 sal_Int32 mnTop;
205
206 sal_uInt16 mnSelectModifier;
207
209 bool mbSort : 1;
210 bool mbTrack : 1;
211 bool mbMulti : 1;
212 bool mbSimpleMode : 1;
213 bool mbTravelSelect : 1;
217 bool mbGrabFocus : 1;
219 bool mbInUserDraw : 1;
220 bool mbReadOnly : 1;
221 bool mbCenter : 1;
222 bool mbRight : 1;
225 bool mbIsDropdown : 1;
226
235
237
238 virtual void KeyInput( const KeyEvent& rKEvt ) override;
239 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
240 virtual void MouseMove( const MouseEvent& rMEvt ) override;
241 virtual void Tracking( const TrackingEvent& rTEvt ) override;
242 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
243 virtual void Resize() override;
244 virtual void GetFocus() override;
245 virtual void LoseFocus() override;
246
247 bool SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift = false, bool bCtrl = false, bool bSelectPosChange = false );
248 void ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos);
249 void ImplDoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
250 void ImplCalcMetrics();
252 void ImplCallSelect();
253
254 void ImplShowFocusRect();
255 void ImplHideFocusRect();
256
257 virtual void StateChanged( StateChangedType nType ) override;
258 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
259
260public:
261 virtual void FillLayoutData() const override;
262
263 ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle );
264 virtual ~ImplListBoxWindow() override;
265 virtual void dispose() override;
266
267 const ImplEntryList& GetEntryList() const { return maEntryList; }
269
270 sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ); // sorts using mbSort
271 sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ); // to insert ignoring mbSort, e.g. mru
272 void RemoveEntry( sal_Int32 nPos );
273 void Clear();
275 sal_Int32 GetCurrentPos() const { return mnCurrentPos; }
276 sal_uInt16 GetDisplayLineCount() const;
277 void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
278
279 void DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText);
280
281 void SelectEntry( sal_Int32 nPos, bool bSelect );
282 void DeselectAll();
283 sal_Int32 GetEntryPosForPoint( const Point& rPoint ) const;
284 sal_Int32 GetLastVisibleEntry() const;
285
286 bool ProcessKeyInput( const KeyEvent& rKEvt );
287
288 void SetTopEntry( sal_Int32 nTop );
289 sal_Int32 GetTopEntry() const { return mnTop; }
292 void ShowProminentEntry( sal_Int32 nEntryPos );
293 using Window::IsVisible;
294 bool IsVisible( sal_Int32 nEntry ) const;
295
296 tools::Long GetLeftIndent() const { return mnLeft; }
297 void SetLeftIndent( tools::Long n );
298 void ScrollHorz( tools::Long nDiff );
299
300 void AllowGrabFocus( bool b ) { mbGrabFocus = b; }
301 bool IsGrabFocusAllowed() const { return mbGrabFocus; }
302
307 void SetSeparatorPos( sal_Int32 n );
312 sal_Int32 GetSeparatorPos() const;
313
317 void AddSeparator( sal_Int32 n ) { maSeparators.insert( n ); }
321 bool isSeparator( const sal_Int32 &n ) const;
322
323 void SetTravelSelect( bool bTravelSelect ) { mbTravelSelect = bTravelSelect; }
324 bool IsTravelSelect() const { return mbTravelSelect; }
325 bool IsTrackingSelect() const { return mbTrackingSelect; }
326
327 void SetUserItemSize( const Size& rSz );
328
329 void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
330 bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
331
332 void EnableMultiSelection( bool bMulti ) { mbMulti = bMulti; }
333 bool IsMultiSelectionEnabled() const { return mbMulti; }
334
335 void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; }
336
337 void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
338 bool IsMouseMoveSelect() const { return mbMouseMoveSelect; }
339
340 Size CalcSize(sal_Int32 nMaxLines) const;
341 tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
342
346
348 void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maSelectHdl = rLink; }
349 void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maCancelHdl = rLink; }
353 void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maFocusHdl = rLink ; }
354
356 bool IsSelectionChanged() const { return mbSelectionChanged; }
357 sal_uInt16 GetSelectModifier() const { return mnSelectModifier; }
358
359 void EnableSort( bool b ) { mbSort = b; }
360
361 void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; }
362 bool IsReadOnly() const { return mbReadOnly; }
363
365
366 bool GetEdgeBlending() const { return mbEdgeBlending; }
367 void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
368
370 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
371
372private:
373 // ISearchableStringList
374 virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
375 virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
376 virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
377};
378
379class ImplListBox final : public Control
380{
381private:
386
387 bool mbVScroll : 1; // VScroll on or off
388 bool mbHScroll : 1; // HScroll on or off
389 bool mbAutoHScroll : 1; // AutoHScroll on or off
391
392 Link<ImplListBox*,void> maScrollHdl; // because it is needed by ImplListBoxWindow itself
393
394 virtual void GetFocus() override;
395 virtual void StateChanged( StateChangedType nType ) override;
396
397 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
398
399 void ImplResizeControls();
400 void ImplCheckScrollBars();
401 void ImplInitScrollBars();
402
403 DECL_LINK( ScrollBarHdl, ScrollBar*, void );
404 DECL_LINK( LBWindowScrolled, ImplListBoxWindow*, void );
405 DECL_LINK( MRUChanged, LinkParamNone*, void );
406
407public:
408 ImplListBox( vcl::Window* pParent, WinBits nWinStyle );
409 virtual ~ImplListBox() override;
410 virtual void dispose() override;
411
412 const ImplEntryList& GetEntryList() const { return maLBWindow->GetEntryList(); }
414
415 virtual void Resize() override;
416 virtual const Wallpaper& GetDisplayBackground() const override;
417
418 sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
419 sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
420 void RemoveEntry( sal_Int32 nPos );
421 void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow->GetEntryList().SetEntryData( nPos, pNewData ); }
422 void Clear();
423
424 void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
425
426 void SelectEntry( sal_Int32 nPos, bool bSelect );
427 void SetNoSelection();
429 sal_Int32 GetCurrentPos() const { return maLBWindow->GetCurrentPos(); }
430
431 bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow->ProcessKeyInput( rKEvt ); }
432 bool HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& rControl);
433
438 void SetSeparatorPos( sal_Int32 n ) { maLBWindow->SetSeparatorPos( n ); }
443 sal_Int32 GetSeparatorPos() const { return maLBWindow->GetSeparatorPos(); }
444
448 void AddSeparator( sal_Int32 n ) { maLBWindow->AddSeparator( n ); }
449
450 void SetTopEntry( sal_Int32 nTop ) { maLBWindow->SetTopEntry( nTop ); }
451 sal_Int32 GetTopEntry() const { return maLBWindow->GetTopEntry(); }
452 void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow->ShowProminentEntry( nPos ); }
453 using Window::IsVisible;
454 bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow->IsVisible( nEntry ); }
455
457 void SetLeftIndent( sal_uInt16 n ) { maLBWindow->SetLeftIndent( n ); }
458
459 void SetTravelSelect( bool bTravelSelect ) { maLBWindow->SetTravelSelect( bTravelSelect ); }
460 bool IsTravelSelect() const { return maLBWindow->IsTravelSelect(); }
461 bool IsTrackingSelect() const { return maLBWindow->IsTrackingSelect(); }
462
463 void EnableMultiSelection( bool bMulti ) { maLBWindow->EnableMultiSelection( bMulti ); }
465
467
468 void SetReadOnly( bool b ) { maLBWindow->SetReadOnly( b ); }
469 bool IsReadOnly() const { return maLBWindow->IsReadOnly(); }
470
471 Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow->CalcSize( nMaxLines ); }
475
476 void SetScrollHdl( const Link<ImplListBox*,void>& rLink ) { maScrollHdl = rLink; }
481 void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maLBWindow->SetFocusHdl( rLink ); }
486 sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); }
487 void SetHighlightColor(const Color& rColor);
488 void SetHighlightTextColor(const Color& rColor);
489
490 void SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep );
491 OUString GetMRUEntries( sal_Unicode cSep ) const;
493 sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList().GetMaxMRUCount(); }
494 sal_uInt16 GetDisplayLineCount() const
495 { return maLBWindow->GetDisplayLineCount(); }
496
497 bool GetEdgeBlending() const { return mbEdgeBlending; }
498 void SetEdgeBlending(bool bNew);
499};
500
502{
503private:
506 sal_uInt16 mnDDLineCount;
509
510 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
511
512public:
514 virtual ~ImplListBoxFloatingWindow() override;
515 virtual void dispose() override;
516 void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; }
517
518 void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; }
519 const Size& GetPrefSize() const { return maPrefSz; }
520
521 void SetAutoWidth( bool b ) { mbAutoWidth = b; }
522
523 Size CalcFloatSize() const;
524 void StartFloat( bool bStartTracking );
525
526 virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
527 tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All ) override;
528
529 void SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; }
530 sal_uInt16 GetDropDownLineCount() const { return mnDDLineCount; }
531
533
534 virtual void Resize() override;
535};
536
537class ImplWin final : public Control
538{
539private:
540
541 sal_Int32 mnItemPos;
542 OUString maString;
544
546
548
550
551 void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false);
552 virtual void FillLayoutData() const override;
553
554public:
555 ImplWin( vcl::Window* pParent, WinBits nWinStyle );
556
557 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
558 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
559 virtual void Resize() override;
560 virtual void GetFocus() override;
561 virtual void LoseFocus() override;
562
563 sal_Int32 GetItemPos() const { return mnItemPos; }
564 void SetItemPos( sal_Int32 n ) { mnItemPos = n; }
565
566 void SetString( const OUString& rStr ) { maString = rStr; }
567
568 void SetImage( const Image& rImg ) { maImage = rImg; }
569
570 void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; }
571
572 void DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout);
573
574 bool GetEdgeBlending() const { return mbEdgeBlending; }
575 void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
576
577 virtual void ShowFocus(const tools::Rectangle& rRect) override;
578
580 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
581
582};
583
584class ImplBtn final : public PushButton
585{
586private:
588
589public:
590 ImplBtn( vcl::Window* pParent, WinBits nWinStyle );
591
592 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
593 void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; }
594};
595
596void ImplInitDropDownButton( PushButton* pButton );
597
598#endif // INCLUDED_VCL_INC_LISTBOX_HXX
599
600/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawTextFlags
Definition: ctrl.hxx:80
void ImplInitSettings()
Definition: ctrl.cxx:423
Definition: image.hxx:40
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:587
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:593
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
ImplBtn(vcl::Window *pParent, WinBits nWinStyle)
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
sal_Int32 mnImages
Definition: listbox.hxx:93
void SetMaxMRUCount(sal_Int32 n)
Definition: listbox.hxx:162
bool IsEntrySelectable(sal_Int32 nPos) const
An Entry is selectable if its mnFlags does not have the ListBoxEntryFlags::DisableSelection flag set.
void SetMRUCount(sal_Int32 n)
Definition: listbox.hxx:159
bool HasEntryImage(sal_Int32 nPos) const
void SetEntryData(sal_Int32 nPos, void *pNewData)
void SetCallSelectionChangedHdl(bool bCall)
Definition: listbox.hxx:157
sal_Int32 GetSelectedEntryPos(sal_Int32 nIndex) const
bool HasImages() const
Definition: listbox.hxx:131
Image GetEntryImage(sal_Int32 nPos) const
sal_Int32 mnMRUCount
Definition: listbox.hxx:95
sal_Int32 GetSelectedEntryCount() const
OUString GetSelectedEntry(sal_Int32 nIndex) const
sal_Int32 mnLastSelected
Definition: listbox.hxx:91
VclPtr< vcl::Window > mpWindow
For getting the current locale when matching strings.
Definition: listbox.hxx:90
void SelectEntry(sal_Int32 nPos, bool bSelect)
Definition: imp_listbox.cxx:89
sal_Int32 mnSelectionAnchor
Definition: listbox.hxx:92
void RemoveEntry(sal_Int32 nPos)
sal_Int32 FindEntry(std::u16string_view rStr, bool bSearchMRUArea=false) const
OUString GetEntryText(sal_Int32 nPos) const
bool mbCallSelectionChangedHdl
Definition: listbox.hxx:99
sal_Int32 FindFirstSelectable(sal_Int32 nPos, bool bForward=true) const
const ImplEntryType * GetEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:115
ImplEntryType * GetEntry(sal_Int32 nPos) const
Definition: listbox.hxx:102
sal_Int32 mnMaxMRUCount
Definition: listbox.hxx:96
ImplEntryType * GetMutableEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:116
sal_Int32 GetLastSelected() const
Definition: listbox.hxx:151
sal_Int32 GetMaxMRUCount() const
Definition: listbox.hxx:163
void * GetEntryData(sal_Int32 nPos) const
ImplEntryList(vcl::Window *pWindow)
Definition: imp_listbox.cxx:60
sal_Int32 GetEntryCount() const
Definition: listbox.hxx:130
sal_Int32 GetMRUCount() const
Definition: listbox.hxx:160
void SetLastSelected(sal_Int32 nPos)
Definition: listbox.hxx:150
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:156
sal_Int32 GetSelectionAnchor() const
Definition: listbox.hxx:154
tools::Long GetEntryHeight(sal_Int32 nPos) const
std::vector< std::unique_ptr< ImplEntryType > > maEntries
Definition: listbox.hxx:100
sal_Int32 FindMatchingEntry(const OUString &rStr, sal_Int32 nStart, bool bLazy) const
tools::Long GetAddedHeight(sal_Int32 nEndIndex, sal_Int32 nBeginIndex) const
helper: add up heights up to index nEndIndex.
Link< sal_Int32, void > maSelectionChangedHdl
Definition: listbox.hxx:98
bool IsEntryPosSelected(sal_Int32 nIndex) const
void SetSelectionAnchor(sal_Int32 nPos)
Definition: listbox.hxx:153
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry, bool bSort)
virtual void Resize() override
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.hxx:530
void SetDropDownLineCount(sal_uInt16 n)
Definition: listbox.hxx:529
void SetAutoWidth(bool b)
Definition: listbox.hxx:521
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
VclPtr< ImplListBox > mpImplLB
Definition: listbox.hxx:504
ImplListBoxFloatingWindow(vcl::Window *pParent)
sal_Int32 GetPopupModeStartSaveSelection() const
Definition: listbox.hxx:532
void SetImplListBox(ImplListBox *pLB)
Definition: listbox.hxx:516
const Size & GetPrefSize() const
Definition: listbox.hxx:519
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
virtual bool PreNotify(NotifyEvent &rNEvt) override
void SetPrefSize(const Size &rSz)
Definition: listbox.hxx:518
sal_Int32 mnPopupModeStartSaveSelection
Definition: listbox.hxx:507
virtual ~ImplListBoxFloatingWindow() override
void StartFloat(bool bStartTracking)
std::set< sal_Int32 > maSeparators
Separator positions.
Definition: listbox.hxx:198
sal_Int32 mnUserDrawEntry
Definition: listbox.hxx:200
virtual void Tracking(const TrackingEvent &rTEvt) override
void ImplPaint(vcl::RenderContext &rRenderContext, sal_Int32 nPos)
sal_Int32 mnTop
output from line on
Definition: listbox.hxx:202
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry)
virtual void Resize() override
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:333
tools::Long mnMaxImgTxtWidth
Maximum width of a text item.
Definition: listbox.hxx:188
sal_uInt16 GetSelectModifier() const
Definition: listbox.hxx:357
sal_Int32 mnTrackingSaveSelection
Selection before Tracking();.
Definition: listbox.hxx:196
void AllowGrabFocus(bool b)
Definition: listbox.hxx:300
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:335
virtual vcl::StringEntryIdentifier NextEntry(vcl::StringEntryIdentifier _currentEntry, OUString &_out_entryText) const override
returns the next entry in the list.
sal_Int32 mnCurrentPos
Position (Focus)
Definition: listbox.hxx:195
vcl::QuickSelectionEngine maQuickSelectionEngine
Definition: listbox.hxx:236
virtual void LoseFocus() override
bool mbTrack
Tracking.
Definition: listbox.hxx:210
tools::Long mnMaxWidth
Maximum width of an entry.
Definition: listbox.hxx:192
void SetLeftIndent(tools::Long n)
virtual ~ImplListBoxWindow() override
bool ProcessKeyInput(const KeyEvent &rKEvt)
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
sal_Int32 GetLastVisibleEntry() const
virtual void KeyInput(const KeyEvent &rKEvt) override
tools::Long GetEntryHeightWithMargin() const
bool mbUserDrawEnabled
UserDraw possible.
Definition: listbox.hxx:218
bool isSeparator(const sal_Int32 &n) const
Checks if the given number n is an element of the separator positions set.
sal_Int32 GetEntryPosForPoint(const Point &rPoint) const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:289
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:353
bool IsVisible(sal_Int32 nEntry) const
tools::Long mnLeft
output from column on
Definition: listbox.hxx:203
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.hxx:317
ImplListBoxWindow(vcl::Window *pParent, WinBits nWinStyle)
bool mbRight
right align Text output
Definition: listbox.hxx:222
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
tools::Long GetLeftIndent() const
Definition: listbox.hxx:296
void ImplDoPaint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
bool SelectEntries(sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift=false, bool bCtrl=false, bool bSelectPosChange=false)
bool mbSort
ListBox sorted.
Definition: listbox.hxx:209
tools::Long GetMaxEntryWidth() const
Definition: listbox.hxx:345
bool mbGrabFocus
Grab focus at MBDown.
Definition: listbox.hxx:217
bool IsMouseMoveSelect() const
Definition: listbox.hxx:338
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:350
tools::Rectangle maFocusRect
Definition: listbox.hxx:181
void SetReadOnly(bool bReadOnly)
Definition: listbox.hxx:361
Size CalcSize(sal_Int32 nMaxLines) const
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator.
Link< ImplListBoxWindow *, void > maDoubleClickHdl
Definition: listbox.hxx:230
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:267
Link< LinkParamNone *, void > maListItemSelectHdl
Definition: listbox.hxx:234
void ShowProminentEntry(sal_Int32 nEntryPos)
ShowProminentEntry will set the entry corresponding to nEntryPos either at top or in the middle depen...
void SetTravelSelect(bool bTravelSelect)
Definition: listbox.hxx:323
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
bool mbCenter
center Text output
Definition: listbox.hxx:221
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:367
Link< UserDrawEvent *, void > maUserDrawHdl
Definition: listbox.hxx:231
bool IsTrackingSelect() const
Definition: listbox.hxx:325
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
virtual vcl::StringEntryIdentifier CurrentEntry(OUString &_out_entryText) const override
returns the current entry in the list of searchable strings.
ImplEntryList maEntryList
EntryList.
Definition: listbox.hxx:180
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:348
void DrawEntry(vcl::RenderContext &rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText)
bool mbMouseMoveSelect
Select at MouseMove.
Definition: listbox.hxx:216
void RemoveEntry(sal_Int32 nPos)
void EnableUserDraw(bool bUserDraw)
Definition: listbox.hxx:329
Link< LinkParamNone *, void > maSelectHdl
Definition: listbox.hxx:228
void ResetCurrentPos()
Definition: listbox.hxx:274
virtual void FillLayoutData() const override
tools::Long mnMaxTxtHeight
Maximum height of a text item.
Definition: listbox.hxx:185
bool mbInUserDraw
In UserDraw.
Definition: listbox.hxx:219
bool mbSelectionChanged
Do not call Select() too often ...
Definition: listbox.hxx:215
bool mbMulti
MultiListBox.
Definition: listbox.hxx:211
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Link< LinkParamNone *, void > maCancelHdl
Definition: listbox.hxx:229
virtual void MouseMove(const MouseEvent &rMEvt) override
void SetScrollHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:347
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
tools::Long mnMaxTxtWidth
Maximum width of a text item.
Definition: listbox.hxx:186
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:349
virtual void StateChanged(StateChangedType nType) override
void ScrollHorz(tools::Long nDiff)
Link< LinkParamNone *, void > maMRUChangedHdl
Definition: listbox.hxx:232
sal_uInt16 mnSelectModifier
Modifiers.
Definition: listbox.hxx:206
Link< ImplListBoxWindow *, void > maScrollHdl
Definition: listbox.hxx:227
tools::Long GetEntryHeight() const
Definition: listbox.hxx:343
tools::Long mnMaxImgHeight
Maximum height of an image item.
Definition: listbox.hxx:191
void SetUserItemSize(const Size &rSz)
void ImplUpdateEntryMetrics(ImplEntryType &rEntry)
void EnableMouseMoveSelect(bool bMouseMoveSelect)
Definition: listbox.hxx:337
tools::Long mnMaxImgWidth
Maximum width of an image item.
Definition: listbox.hxx:190
void SetTopEntry(sal_Int32 nTop)
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:275
tools::Long mnTextHeight
text height
Definition: listbox.hxx:204
void EnableMultiSelection(bool bMulti)
Definition: listbox.hxx:332
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:351
bool IsTravelSelect() const
Definition: listbox.hxx:324
void SetMRUChangedHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:352
bool IsGrabFocusAllowed() const
Definition: listbox.hxx:301
tools::Long mnMaxHeight
Maximum height of an entry.
Definition: listbox.hxx:193
sal_uInt16 GetDisplayLineCount() const
DrawTextFlags ImplGetTextStyle() const
void SetListItemSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:355
bool GetEdgeBlending() const
Definition: listbox.hxx:366
bool IsUserDrawEnabled() const
Definition: listbox.hxx:330
ImplEntryList & GetEntryList()
Definition: listbox.hxx:268
bool IsReadOnly() const
Definition: listbox.hxx:362
bool mbTrackingSelect
Selected at a MouseMove.
Definition: listbox.hxx:214
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Link< sal_Int32, void > maFocusHdl
Definition: listbox.hxx:233
bool mbTravelSelect
TravelSelect.
Definition: listbox.hxx:213
void SelectEntry(sal_Int32 nPos, bool bSelect)
void EnableSort(bool b)
Definition: listbox.hxx:359
virtual void GetFocus() override
bool mbSimpleMode
SimpleMode for MultiListBox.
Definition: listbox.hxx:212
bool mbReadOnly
ReadOnly.
Definition: listbox.hxx:220
bool IsSelectionChanged() const
Definition: listbox.hxx:356
bool mbIsDropdown
Listbox is actually a dropdown (either combobox, or popup window treated as dropdown)
Definition: listbox.hxx:225
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:480
sal_uInt16 GetDisplayLineCount() const
Definition: listbox.hxx:494
VclPtr< ScrollBar > mpHScrollBar
Definition: listbox.hxx:383
ImplListBoxWindow * GetMainWindow()
Definition: listbox.hxx:413
virtual void StateChanged(StateChangedType nType) override
bool IsReadOnly() const
Definition: listbox.hxx:469
void ImplResizeControls()
bool mbVScroll
Definition: listbox.hxx:387
tools::Long GetMaxEntryWidth() const
Definition: listbox.hxx:474
Size CalcSize(sal_Int32 nMaxLines) const
Definition: listbox.hxx:471
bool mbHScroll
Definition: listbox.hxx:388
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:464
void ImplInitScrollBars()
VclPtr< ScrollBar > mpVScrollBar
Definition: listbox.hxx:384
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator.
Definition: listbox.hxx:438
bool IsVisible(sal_Int32 nEntry) const
Definition: listbox.hxx:454
void SelectEntry(sal_Int32 nPos, bool bSelect)
void RemoveEntry(sal_Int32 nPos)
void SetTravelSelect(bool bTravelSelect)
Definition: listbox.hxx:459
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:479
OUString GetMRUEntries(sal_Unicode cSep) const
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:477
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
bool IsTrackingSelect() const
Definition: listbox.hxx:461
void ResetCurrentPos()
Definition: listbox.hxx:428
void SetHighlightColor(const Color &rColor)
void SetHighlightTextColor(const Color &rColor)
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
bool mbEdgeBlending
Definition: listbox.hxx:390
VclPtr< ImplListBoxWindow > maLBWindow
Definition: listbox.hxx:382
virtual const Wallpaper & GetDisplayBackground() const override
bool mbAutoHScroll
Definition: listbox.hxx:389
bool ProcessKeyInput(const KeyEvent &rKEvt)
Definition: listbox.hxx:431
sal_uInt16 GetSelectModifier() const
Definition: listbox.hxx:486
VclPtr< ScrollBarBox > mpScrollBarBox
Definition: listbox.hxx:385
void SetListItemSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:482
void SetReadOnly(bool b)
Definition: listbox.hxx:468
void SetMRUEntries(std::u16string_view rEntries, sal_Unicode cSep)
virtual ~ImplListBox() override
virtual void Resize() override
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:451
virtual bool EventNotify(NotifyEvent &rNEvt) override
DECL_LINK(MRUChanged, LinkParamNone *, void)
void SetTopEntry(sal_Int32 nTop)
Definition: listbox.hxx:450
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:412
bool IsTravelSelect() const
Definition: listbox.hxx:460
bool HandleWheelAsCursorTravel(const CommandEvent &rCEvt, Control &rControl)
void SetNoSelection()
void ShowProminentEntry(sal_Int32 nPos)
Definition: listbox.hxx:452
void SetLeftIndent(sal_uInt16 n)
Definition: listbox.hxx:457
DECL_LINK(LBWindowScrolled, ImplListBoxWindow *, void)
bool GetEdgeBlending() const
Definition: listbox.hxx:497
void SetScrollHdl(const Link< ImplListBox *, void > &rLink)
Definition: listbox.hxx:476
void SetMaxMRUCount(sal_Int32 n)
Definition: listbox.hxx:492
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:478
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.hxx:448
tools::Long GetEntryHeightWithMargin() const
Definition: listbox.hxx:473
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:481
sal_Int32 InsertEntry(sal_Int32 nPos, const OUString &rStr)
DECL_LINK(ScrollBarHdl, ScrollBar *, void)
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:466
bool IsSelectionChanged() const
Definition: listbox.hxx:485
void ImplCheckScrollBars()
void EnableMultiSelection(bool bMulti)
Definition: listbox.hxx:463
sal_Int32 GetMaxMRUCount() const
Definition: listbox.hxx:493
void SetEdgeBlending(bool bNew)
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.hxx:443
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:483
ImplListBox(vcl::Window *pParent, WinBits nWinStyle)
void SetEntryData(sal_Int32 nPos, void *pNewData)
Definition: listbox.hxx:421
void SetCallSelectionChangedHdl(bool bCall)
Definition: listbox.hxx:484
tools::Long GetLeftIndent() const
Definition: listbox.hxx:456
virtual void GetFocus() override
tools::Long GetEntryHeight() const
Definition: listbox.hxx:472
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:429
Link< ImplListBox *, void > maScrollHdl
Definition: listbox.hxx:392
tools::Rectangle maFocusRect
Definition: listbox.hxx:545
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:547
void SetImage(const Image &rImg)
Definition: listbox.hxx:568
sal_Int32 GetItemPos() const
Definition: listbox.hxx:563
void SetString(const OUString &rStr)
Definition: listbox.hxx:566
OUString maString
Definition: listbox.hxx:542
virtual void ShowFocus(const tools::Rectangle &rRect) override
virtual void GetFocus() override
virtual void LoseFocus() override
sal_Int32 mnItemPos
because of UserDraw I have to know which item I draw
Definition: listbox.hxx:541
void ImplDraw(vcl::RenderContext &rRenderContext, bool bLayout=false)
ImplWin(vcl::Window *pParent, WinBits nWinStyle)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void FillLayoutData() const override
bool mbEdgeBlending
Definition: listbox.hxx:549
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:575
bool GetEdgeBlending() const
Definition: listbox.hxx:574
void DrawEntry(vcl::RenderContext &rRenderContext, bool bLayout)
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:570
Image maImage
Definition: listbox.hxx:543
void SetItemPos(sal_Int32 n)
Definition: listbox.hxx:564
virtual void Resize() override
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsVisible() const
Definition: window2.cxx:1128
bool bReadOnly
sal_Int64 n
sal_uInt16 nPos
LB_EVENT_TYPE
Definition: listbox.hxx:45
@ LET_KEYSPACE
Definition: listbox.hxx:49
@ LET_TRACKING
Definition: listbox.hxx:47
@ LET_MBDOWN
Definition: listbox.hxx:46
@ LET_KEYMOVE
Definition: listbox.hxx:48
void ImplInitDropDownButton(PushButton *pButton)
Definition: imp_listbox.cxx:51
#define LISTBOX_ENTRY_NOTFOUND
Definition: lstbox.hxx:37
ListBoxEntryFlags
Definition: lstbox.hxx:48
aStr
NONE
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
long Long
const void * StringEntryIdentifier
ListBoxEntryFlags mnFlags
Definition: listbox.hxx:59
bool mbIsSelected
Definition: listbox.hxx:58
Image maImage
Definition: listbox.hxx:56
SalLayoutGlyphs * GetTextGlyphs(const OutputDevice *pOutputDevice)
Computes maStr's text layout (glyphs), cached in maStrGlyphs.
tools::Long getHeightWithMargin() const
tools::Long mnHeight
Definition: listbox.hxx:60
ImplEntryType(OUString aStr)
Definition: listbox.hxx:74
void * mpUserData
Definition: listbox.hxx:57
OUString maStr
Definition: listbox.hxx:54
ImplEntryType(OUString aStr, Image aImage)
Definition: listbox.hxx:64
SalLayoutGlyphs maStrGlyphs
Definition: listbox.hxx:55
sal_uInt16 sal_Unicode
PosSizeFlags
Definition: window.hxx:127
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109