LibreOffice Module vcl (master)  1
listbox.cxx
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 
21 #include <vcl/commandevent.hxx>
22 #include <vcl/event.hxx>
23 #include <vcl/lstbox.hxx>
24 #include <vcl/settings.hxx>
25 #include <vcl/uitest/uiobject.hxx>
26 #include <sal/log.hxx>
27 
28 #include <svdata.hxx>
29 #include <controldata.hxx>
30 #include <listbox.hxx>
31 #include <dndeventdispatcher.hxx>
32 #include <comphelper/lok.hxx>
33 
34 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
35 #include <boost/property_tree/ptree.hpp>
36 
38 {
40 }
41 
43  : Control(nType)
44  , mpImplLB(nullptr)
45 {
47 }
48 
50 {
52  ImplInit( pParent, nStyle );
53 }
54 
56 {
57  disposeOnce();
58 }
59 
61 {
63 
68 
70 }
71 
73 {
74  mpFloatWin = nullptr;
75  mpImplWin = nullptr;
76  mpBtn = nullptr;
77  mnDDHeight = 0;
79  mnLineCount = 0;
80  m_nMaxWidthChars = -1;
81  mbDDAutoSize = true;
82 }
83 
84 void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
85 {
86  nStyle = ImplInitStyle( nStyle );
87  if ( !(nStyle & WB_NOBORDER) && ( nStyle & WB_DROPDOWN ) )
88  nStyle |= WB_BORDER;
89 
90  Control::ImplInit( pParent, nStyle, nullptr );
91 
92  css::uno::Reference< css::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this);
93 
94  if( nStyle & WB_DROPDOWN )
95  {
96  sal_Int32 nLeft, nTop, nRight, nBottom;
97  GetBorder( nLeft, nTop, nRight, nBottom );
98  mnDDHeight = static_cast<sal_uInt16>(GetTextHeight() + nTop + nBottom + 4);
99 
100  if( IsNativeWidgetEnabled() &&
102  {
103  ImplControlValue aControlValue;
104  tools::Rectangle aCtrlRegion( Point( 0, 0 ), Size( 20, mnDDHeight ) );
105  tools::Rectangle aBoundingRgn( aCtrlRegion );
106  tools::Rectangle aContentRgn( aCtrlRegion );
108  ControlState::ENABLED, aControlValue,
109  aBoundingRgn, aContentRgn ) )
110  {
111  sal_Int32 nHeight = aBoundingRgn.GetHeight();
112  if( nHeight > mnDDHeight )
113  mnDDHeight = static_cast<sal_uInt16>(nHeight);
114  }
115  }
116 
120  mpFloatWin->SetAutoWidth( true );
121  mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) );
122  mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);
123 
124  mpImplWin = VclPtr<ImplWin>::Create( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
125  mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
126  mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
127  mpImplWin->Show();
128  mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
129  mpImplWin->SetEdgeBlending(false);
130 
133  mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
134  mpBtn->Show();
135  mpBtn->GetDropTarget()->addDropTargetListener(xDrop);
136  }
137 
138  vcl::Window* pLBParent = this;
139  if ( mpFloatWin )
140  pLBParent = mpFloatWin;
141  mpImplLB = VclPtr<ImplListBox>::Create( pLBParent, nStyle&(~WB_BORDER) );
142  mpImplLB->SetSelectHdl( LINK( this, ListBox, ImplSelectHdl ) );
143  mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) );
144  mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) );
145  mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) );
146  mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
147  mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) );
148  mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) );
149  mpImplLB->SetPosPixel( Point() );
150  mpImplLB->SetEdgeBlending(false);
151  mpImplLB->Show();
152 
153  mpImplLB->GetDropTarget()->addDropTargetListener(xDrop);
154 
155  if ( mpFloatWin )
156  {
158  mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) );
159  }
160  else
162 
163  SetCompoundControl( true );
164 }
165 
167 {
168  if ( !(nStyle & WB_NOTABSTOP) )
169  nStyle |= WB_TABSTOP;
170  if ( !(nStyle & WB_NOGROUP) )
171  nStyle |= WB_GROUP;
172  return nStyle;
173 }
174 
175 IMPL_LINK_NOARG(ListBox, ImplSelectHdl, LinkParamNone*, void)
176 {
177  bool bPopup = IsInDropDown();
178  if( IsDropDownBox() )
179  {
180  if( !mpImplLB->IsTravelSelect() )
181  {
182  mpFloatWin->EndPopupMode();
183  mpImplWin->GrabFocus();
184  }
185 
186  mpImplWin->SetItemPos( GetSelectedEntryPos() );
187  mpImplWin->SetString( GetSelectedEntry() );
188  if( mpImplLB->GetEntryList()->HasImages() )
189  {
190  Image aImage = mpImplLB->GetEntryList()->GetEntryImage( GetSelectedEntryPos() );
191  mpImplWin->SetImage( aImage );
192  }
193  mpImplWin->Invalidate();
194  }
195 
196  if ( ( !IsTravelSelect() || mpImplLB->IsSelectionChanged() ) || ( bPopup && !IsMultiSelectionEnabled() ) )
197  Select();
198 }
199 
200 IMPL_LINK( ListBox, ImplFocusHdl, sal_Int32, nPos, void )
201 {
202  CallEventListeners( VclEventId::ListboxFocus, reinterpret_cast<void*>(nPos) );
203 }
204 
205 IMPL_LINK_NOARG( ListBox, ImplListItemSelectHdl, LinkParamNone*, void )
206 {
207  CallEventListeners( VclEventId::DropdownSelect );
208 }
209 
210 IMPL_LINK_NOARG(ListBox, ImplScrollHdl, ImplListBox*, void)
211 {
212  CallEventListeners( VclEventId::ListboxScrolled );
213 }
214 
215 IMPL_LINK_NOARG(ListBox, ImplCancelHdl, LinkParamNone*, void)
216 {
217  if( IsInDropDown() )
218  mpFloatWin->EndPopupMode();
219 }
220 
221 IMPL_LINK( ListBox, ImplSelectionChangedHdl, sal_Int32, nChanged, void )
222 {
223  if ( !mpImplLB->IsTrackingSelect() )
224  {
225  const ImplEntryList* pEntryList = mpImplLB->GetEntryList();
226  if ( pEntryList->IsEntryPosSelected( nChanged ) )
227  {
228  // FIXME? This should've been turned into an ImplPaintEntry some time ago...
229  if ( nChanged < pEntryList->GetMRUCount() )
230  nChanged = pEntryList->FindEntry( pEntryList->GetEntryText( nChanged ) );
231  mpImplWin->SetItemPos( nChanged );
232  mpImplWin->SetString( mpImplLB->GetEntryList()->GetEntryText( nChanged ) );
233  if( mpImplLB->GetEntryList()->HasImages() )
234  {
235  Image aImage = mpImplLB->GetEntryList()->GetEntryImage( nChanged );
236  mpImplWin->SetImage( aImage );
237  }
238  }
239  else
240  {
241  mpImplWin->SetItemPos( LISTBOX_ENTRY_NOTFOUND );
242  mpImplWin->SetString( OUString() );
243  Image aImage;
244  mpImplWin->SetImage( aImage );
245  }
246  mpImplWin->Invalidate();
247  }
248 }
249 
250 IMPL_LINK_NOARG(ListBox, ImplDoubleClickHdl, ImplListBoxWindow*, void)
251 {
252  DoubleClick();
253 }
254 
255 IMPL_LINK_NOARG(ListBox, ImplClickBtnHdl, void*, void)
256 {
257  if( !mpFloatWin->IsInPopupMode() )
258  {
259  CallEventListeners( VclEventId::DropdownPreOpen );
260  mpImplWin->GrabFocus();
261  mpBtn->SetPressed( true );
262  mpFloatWin->StartFloat( true );
263  CallEventListeners( VclEventId::DropdownOpen );
264 
265  ImplClearLayoutData();
266  if( mpImplLB )
267  mpImplLB->GetMainWindow()->ImplClearLayoutData();
268  if( mpImplWin )
269  mpImplWin->ImplClearLayoutData();
270  }
271 }
272 
273 IMPL_LINK_NOARG(ListBox, ImplPopupModeEndHdl, FloatingWindow*, void)
274 {
275  if( mpFloatWin->IsPopupModeCanceled() )
276  {
277  if ( ( mpFloatWin->GetPopupModeStartSaveSelection() != LISTBOX_ENTRY_NOTFOUND )
278  && !IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) )
279  {
280  mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), true );
281  bool bTravelSelect = mpImplLB->IsTravelSelect();
282  mpImplLB->SetTravelSelect( true );
283 
284  VclPtr<vcl::Window> xWindow = this;
285  Select();
286  if ( xWindow->IsDisposed() )
287  return;
288 
289  mpImplLB->SetTravelSelect( bTravelSelect );
290  }
291  }
292 
293  ImplClearLayoutData();
294  if( mpImplLB )
295  mpImplLB->GetMainWindow()->ImplClearLayoutData();
296  if( mpImplWin )
297  mpImplWin->ImplClearLayoutData();
298 
299  mpBtn->SetPressed( false );
300  CallEventListeners( VclEventId::DropdownClose );
301 }
302 
304 {
305  if( IsDropDownBox() )
306  {
307  if( mpFloatWin->IsInPopupMode() )
309  else
310  {
312  mpImplWin->GrabFocus();
313  mpBtn->SetPressed( true );
314  mpFloatWin->StartFloat( true );
316  }
317  }
318 }
319 
321 {
322  rRenderContext.SetBackground();
323 }
324 
325 void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags )
326 {
328 
329  Point aPos = pDev->LogicToPixel( rPos );
330  Size aSize = pDev->LogicToPixel( rSize );
331  vcl::Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
332  OutDevType eOutDevType = pDev->GetOutDevType();
333 
334  pDev->Push();
335  pDev->SetMapMode();
336  pDev->SetFont( aFont );
337  pDev->SetTextFillColor();
338 
339  // Border/Background
340  pDev->SetLineColor();
341  pDev->SetFillColor();
342  bool bBorder = (GetStyle() & WB_BORDER);
343  bool bBackground = IsControlBackground();
344  if ( bBorder || bBackground )
345  {
346  tools::Rectangle aRect( aPos, aSize );
347  if ( bBorder )
348  {
349  ImplDrawFrame( pDev, aRect );
350  }
351  if ( bBackground )
352  {
354  pDev->DrawRect( aRect );
355  }
356  }
357 
358  // Content
359  if ( ( nFlags & DrawFlags::Mono ) || ( eOutDevType == OUTDEV_PRINTER ) )
360  {
361  pDev->SetTextColor( COL_BLACK );
362  }
363  else
364  {
365  if ( !IsEnabled() )
366  {
367  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
368  pDev->SetTextColor( rStyleSettings.GetDisableColor() );
369  }
370  else
371  {
372  pDev->SetTextColor( GetTextColor() );
373  }
374  }
375 
376  const long nOnePixel = GetDrawPixel( pDev, 1 );
377  const long nOffX = 3*nOnePixel;
379  tools::Rectangle aTextRect( aPos, aSize );
380 
381  if ( GetStyle() & WB_CENTER )
382  nTextStyle |= DrawTextFlags::Center;
383  else if ( GetStyle() & WB_RIGHT )
384  nTextStyle |= DrawTextFlags::Right;
385  else
386  nTextStyle |= DrawTextFlags::Left;
387 
388  aTextRect.AdjustLeft(nOffX );
389  aTextRect.AdjustRight( -nOffX );
390 
391  if ( IsDropDownBox() )
392  {
393  OUString aText = GetSelectedEntry();
394  long nTextHeight = pDev->GetTextHeight();
395  long nTextWidth = pDev->GetTextWidth( aText );
396  long nOffY = (aSize.Height()-nTextHeight) / 2;
397 
398  // Clipping?
399  if ( (nOffY < 0) ||
400  ((nOffY+nTextHeight) > aSize.Height()) ||
401  ((nOffX+nTextWidth) > aSize.Width()) )
402  {
403  tools::Rectangle aClip( aPos, aSize );
404  if ( nTextHeight > aSize.Height() )
405  aClip.AdjustBottom(nTextHeight-aSize.Height()+1 ); // So that HP Printers don't optimize this away
406  pDev->IntersectClipRegion( aClip );
407  }
408 
409  pDev->DrawText( aTextRect, aText, nTextStyle );
410  }
411  else
412  {
413  long nTextHeight = pDev->GetTextHeight();
414  sal_uInt16 nLines = ( nTextHeight > 0 ) ? static_cast<sal_uInt16>(aSize.Height() / nTextHeight) : 1;
415  tools::Rectangle aClip( aPos, aSize );
416 
417  pDev->IntersectClipRegion( aClip );
418 
419  if ( !nLines )
420  nLines = 1;
421 
422  for ( sal_uInt16 n = 0; n < nLines; n++ )
423  {
424  sal_Int32 nEntry = n+mpImplLB->GetTopEntry();
425  bool bSelected = mpImplLB->GetEntryList()->IsEntryPosSelected( nEntry );
426  if ( bSelected )
427  {
428  pDev->SetFillColor( COL_BLACK );
429  pDev->DrawRect( tools::Rectangle( Point( aPos.X(), aPos.Y() + n*nTextHeight ),
430  Point( aPos.X() + aSize.Width(), aPos.Y() + (n+1)*nTextHeight + 2*nOnePixel ) ) );
431  pDev->SetFillColor();
432  pDev->SetTextColor( COL_WHITE );
433  }
434 
435  aTextRect.SetTop( aPos.Y() + n*nTextHeight );
436  aTextRect.SetBottom( aTextRect.Top() + nTextHeight );
437 
438  pDev->DrawText( aTextRect, mpImplLB->GetEntryList()->GetEntryText( nEntry ), nTextStyle );
439 
440  if ( bSelected )
441  pDev->SetTextColor( COL_BLACK );
442  }
443  }
444 
445  pDev->Pop();
446 }
447 
449 {
450  if ( mpImplLB )
451  {
452  if( IsDropDownBox() )
453  mpImplWin->GrabFocus();
454  else
455  mpImplLB->GrabFocus();
456  }
457 
459 }
460 
462 {
463  if( IsDropDownBox() )
464  {
465  if (mpImplWin)
466  mpImplWin->HideFocus();
467  }
468  else
469  {
470  if (mpImplLB)
471  mpImplLB->HideFocus();
472  }
473 
475 }
476 
478 {
479  Control::DataChanged( rDCEvt );
480 
481  if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
483  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
484  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
485  {
486  SetBackground(); // Due to a hack in Window::UpdateSettings the background must be reset
487  // otherwise it will overpaint NWF drawn listboxes
488  Resize();
489  mpImplLB->Resize(); // Is not called by ListBox::Resize() if the ImplLB does not change
490 
491  if ( mpImplWin )
492  {
493  mpImplWin->SetSettings( GetSettings() ); // If not yet set...
495 
498  }
499 
500  if ( IsDropDownBox() )
501  Invalidate();
502  }
503 }
504 
505 void ListBox::EnableAutoSize( bool bAuto )
506 {
507  mbDDAutoSize = bAuto;
508  if ( mpFloatWin )
509  {
510  if ( bAuto && !mpFloatWin->GetDropDownLineCount() )
511  {
512  // use GetListBoxMaximumLineCount here; before, was on fixed number of five
514  }
515  else if ( !bAuto )
516  {
518  }
519  }
520 }
521 
522 void ListBox::SetDropDownLineCount( sal_uInt16 nLines )
523 {
524  mnLineCount = nLines;
525  if ( mpFloatWin )
527 }
528 
530 {
531  // Adapt to maximum allowed number.
532  // Limit for LOK as we can't render outside of the dialog canvas.
535  else
536  SetDropDownLineCount(GetSettings().GetStyleSettings().GetListBoxMaximumLineCount());
537 }
538 
540 {
541  if ( mpFloatWin )
543  return mnLineCount;
544 }
545 
546 void ListBox::setPosSizePixel( long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags )
547 {
548  if( IsDropDownBox() && ( nFlags & PosSizeFlags::Size ) )
549  {
550  Size aPrefSz = mpFloatWin->GetPrefSize();
551  if ( ( nFlags & PosSizeFlags::Height ) && ( nHeight >= 2*mnDDHeight ) )
552  aPrefSz.setHeight( nHeight-mnDDHeight );
553  if ( nFlags & PosSizeFlags::Width )
554  aPrefSz.setWidth( nWidth );
555  mpFloatWin->SetPrefSize( aPrefSz );
556 
557  if (IsAutoSizeEnabled())
558  nHeight = mnDDHeight;
559  }
560 
561  Control::setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
562 }
563 
565 {
566  Size aOutSz = GetOutputSizePixel();
567  if( IsDropDownBox() )
568  {
569  // Initialize the dropdown button size with the standard scrollbar width
570  long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
571  long nBottom = aOutSz.Height();
572 
573  // Note: in case of no border, pBorder will actually be this
575  ImplControlValue aControlValue;
576  Point aPoint;
577  tools::Rectangle aContent, aBound;
578 
579  // Use the full extent of the control
580  tools::Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() );
581 
583  aArea, ControlState::NONE, aControlValue, aBound, aContent) )
584  {
585  // Convert back from border space to local coordinates
586  aPoint = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aPoint ) );
587  aContent.Move( -aPoint.X(), -aPoint.Y() );
588 
589  // Use the themes drop down size for the button
590  aOutSz.setWidth( aContent.Left() );
591  mpBtn->setPosSizePixel( aContent.Left(), 0, aContent.GetWidth(), nBottom );
592 
593  // Adjust the size of the edit field
595  aArea, ControlState::NONE, aControlValue, aBound, aContent) )
596  {
597  // Convert back from border space to local coordinates
598  aContent.Move( -aPoint.X(), -aPoint.Y() );
599 
600  // Use the themes drop down size
602  {
603  // No border but focus ring behavior -> we have a problem; the
604  // native rect relies on the border to draw the focus
605  // let's do the best we can and center vertically, so it doesn't look
606  // completely wrong.
607  Size aSz( GetOutputSizePixel() );
608  long nDiff = aContent.Top() - (aSz.Height() - aContent.GetHeight())/2;
609  aContent.AdjustTop( -nDiff );
610  aContent.AdjustBottom( -nDiff );
611  }
612  mpImplWin->SetPosSizePixel( aContent.TopLeft(), aContent.GetSize() );
613  }
614  else
615  mpImplWin->SetSizePixel( aOutSz );
616  }
617  else
618  {
619  nSBWidth = CalcZoom( nSBWidth );
620  mpImplWin->setPosSizePixel( 0, 0, aOutSz.Width() - nSBWidth, aOutSz.Height() );
621  mpBtn->setPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() );
622  }
623  }
624  else
625  {
626  mpImplLB->SetSizePixel( aOutSz );
627  }
628 
629  // Retain FloatingWindow size even when it's invisible, as we still process KEY_PGUP/DOWN ...
630  if ( mpFloatWin )
632 
633  Control::Resize();
634 }
635 
637 {
638  mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData );
639  const ImplListBoxWindow* rMainWin = mpImplLB->GetMainWindow();
640  if( mpFloatWin )
641  {
642  // Dropdown mode
645  if( mpFloatWin->IsReallyVisible() )
646  {
647  AppendLayoutData( *rMainWin );
648  rMainWin->SetLayoutDataParent( this );
649  }
650  }
651  else
652  {
653  AppendLayoutData( *rMainWin );
654  rMainWin->SetLayoutDataParent( this );
655  }
656 }
657 
658 long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const
659 {
660  if( !HasLayoutData() )
661  FillLayoutData();
662 
663  // Check whether rPoint fits at all
664  long nIndex = Control::GetIndexForPoint( rPoint );
665  if( nIndex != -1 )
666  {
667  // Point must be either in main list window
668  // or in impl window (dropdown case)
670 
671  // Convert coordinates to ImplListBoxWindow pixel coordinate space
672  Point aConvPoint = LogicToPixel( rPoint );
673  aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
674  aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint );
675  aConvPoint = rMain->PixelToLogic( aConvPoint );
676 
677  // Try to find entry
678  sal_Int32 nEntry = rMain->GetEntryPosForPoint( aConvPoint );
679  if( nEntry == LISTBOX_ENTRY_NOTFOUND )
680  {
681  // Not found, maybe dropdown case
683  {
684  // Convert to impl window pixel coordinates
685  aConvPoint = LogicToPixel( rPoint );
686  aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
687  aConvPoint = mpImplWin->AbsoluteScreenToOutputPixel( aConvPoint );
688 
689  // Check whether converted point is inside impl window
690  Size aImplWinSize = mpImplWin->GetOutputSizePixel();
691  if( aConvPoint.X() >= 0 && aConvPoint.Y() >= 0 && aConvPoint.X() < aImplWinSize.Width() && aConvPoint.Y() < aImplWinSize.Height() )
692  {
693  // Inside the impl window, the position is the current item pos
694  rPos = mpImplWin->GetItemPos();
695  }
696  else
697  nIndex = -1;
698  }
699  else
700  nIndex = -1;
701  }
702  else
703  rPos = nEntry;
704 
705  SAL_WARN_IF( nIndex == -1, "vcl", "found index for point, but relative index failed" );
706  }
707 
708  // Get line relative index
709  if( nIndex != -1 )
710  nIndex = ToRelativeLineIndex( nIndex );
711 
712  return nIndex;
713 }
714 
716 {
717  if( nType == StateChangedType::ReadOnly )
718  {
719  if( mpImplWin )
720  mpImplWin->Enable( !IsReadOnly() );
721  if( mpBtn )
722  mpBtn->Enable( !IsReadOnly() );
723  }
724  else if( nType == StateChangedType::Enable )
725  {
726  mpImplLB->Enable( IsEnabled() );
727  if( mpImplWin )
728  {
729  mpImplWin->Enable( IsEnabled() );
732  {
734  }
735  else
737  }
738  if( mpBtn )
739  mpBtn->Enable( IsEnabled() );
740  }
741  else if( nType == StateChangedType::UpdateMode )
742  {
744  }
745  else if ( nType == StateChangedType::Zoom )
746  {
747  mpImplLB->SetZoom( GetZoom() );
748  if ( mpImplWin )
749  {
750  mpImplWin->SetZoom( GetZoom() );
753  }
754  Resize();
755  }
756  else if ( nType == StateChangedType::ControlFont )
757  {
759  if ( mpImplWin )
760  {
764  }
765  Resize();
766  }
767  else if ( nType == StateChangedType::ControlForeground )
768  {
770  if ( mpImplWin )
771  {
776  }
777  }
778  else if ( nType == StateChangedType::ControlBackground )
779  {
781  if ( mpImplWin )
782  {
784  {
785  // Transparent background
788  }
789  else
790  {
793  }
796  }
797  }
798  else if ( nType == StateChangedType::Style )
799  {
801  mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) != 0 );
802  bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
803  mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
804  }
805  else if( nType == StateChangedType::Mirroring )
806  {
807  if( mpBtn )
808  {
811  }
813  if( mpImplWin )
815  Resize();
816  }
817 
818  Control::StateChanged( nType );
819 }
820 
822 {
823  bool bDone = false;
824  if ( mpImplLB )
825  {
826  if( ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) && ( rNEvt.GetWindow() == mpImplWin ) )
827  {
828  KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
829  switch( aKeyEvt.GetKeyCode().GetCode() )
830  {
831  case KEY_DOWN:
832  {
833  if( mpFloatWin && !mpFloatWin->IsInPopupMode() &&
834  aKeyEvt.GetKeyCode().IsMod2() )
835  {
837  mpBtn->SetPressed( true );
838  mpFloatWin->StartFloat( false );
840  bDone = true;
841  }
842  else
843  {
844  bDone = mpImplLB->ProcessKeyInput( aKeyEvt );
845  }
846  }
847  break;
848  case KEY_UP:
849  {
850  if( mpFloatWin && mpFloatWin->IsInPopupMode() &&
851  aKeyEvt.GetKeyCode().IsMod2() )
852  {
854  bDone = true;
855  }
856  else
857  {
858  bDone = mpImplLB->ProcessKeyInput( aKeyEvt );
859  }
860  }
861  break;
862  case KEY_RETURN:
863  {
864  if( IsInDropDown() )
865  {
866  mpImplLB->ProcessKeyInput( aKeyEvt );
867  bDone = true;
868  }
869  }
870  break;
871 
872  default:
873  {
874  bDone = mpImplLB->ProcessKeyInput( aKeyEvt );
875  }
876  }
877  }
878  else if ( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
879  {
880  if ( IsInDropDown() && !HasChildPathFocus( true ) )
882  }
883  else if ( (rNEvt.GetType() == MouseNotifyEvent::COMMAND) &&
885  (rNEvt.GetWindow() == mpImplWin) )
886  {
887  MouseWheelBehaviour nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() );
888  if ( ( nWheelBehavior == MouseWheelBehaviour::ALWAYS )
889  || ( ( nWheelBehavior == MouseWheelBehaviour::FocusOnly )
890  && HasChildPathFocus()
891  )
892  )
893  {
895  }
896  else
897  {
898  bDone = false; // Don't consume this event, let the default handling take it (i.e. scroll the context)
899  }
900  }
901  }
902 
903  return bDone || Control::PreNotify( rNEvt );
904 }
905 
907 {
909 }
910 
912 {
914 }
915 
917 {
918  if (!mpImplLB)
919  return;
920  mpImplLB->Clear();
921  if( IsDropDownBox() )
922  {
924  mpImplWin->SetString( OUString() );
925  Image aImage;
926  mpImplWin->SetImage( aImage );
928  }
929  CallEventListeners( VclEventId::ListboxItemRemoved, reinterpret_cast<void*>(-1) );
930 }
931 
933 {
935  if( IsDropDownBox() )
936  {
938  mpImplWin->SetString( OUString() );
939  Image aImage;
940  mpImplWin->SetImage( aImage );
942  }
943 }
944 
945 sal_Int32 ListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos )
946 {
947  sal_Int32 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr );
948  nRealPos = sal::static_int_cast<sal_Int32>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount());
949  CallEventListeners( VclEventId::ListboxItemAdded, reinterpret_cast<void*>(nRealPos) );
950  return nRealPos;
951 }
952 
953 sal_Int32 ListBox::InsertEntry( const OUString& rStr, const Image& rImage, sal_Int32 nPos )
954 {
955  sal_Int32 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage );
956  nRealPos = sal::static_int_cast<sal_Int32>(nRealPos - mpImplLB->GetEntryList()->GetMRUCount());
957  CallEventListeners( VclEventId::ListboxItemAdded, reinterpret_cast<void*>(nRealPos) );
958  return nRealPos;
959 }
960 
961 void ListBox::RemoveEntry( const OUString& rStr )
962 {
963  RemoveEntry( GetEntryPos( rStr ) );
964 }
965 
966 void ListBox::RemoveEntry( sal_Int32 nPos )
967 {
969  CallEventListeners( VclEventId::ListboxItemRemoved, reinterpret_cast<void*>(nPos) );
970 }
971 
972 Image ListBox::GetEntryImage( sal_Int32 nPos ) const
973 {
974  if ( mpImplLB && mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
975  return mpImplLB->GetEntryList()->GetEntryImage( nPos );
976  return Image();
977 }
978 
979 sal_Int32 ListBox::GetEntryPos( const OUString& rStr ) const
980 {
981  if (!mpImplLB)
982  return LISTBOX_ENTRY_NOTFOUND;
983  sal_Int32 nPos = mpImplLB->GetEntryList()->FindEntry( rStr );
984  if ( nPos != LISTBOX_ENTRY_NOTFOUND )
985  nPos = nPos - mpImplLB->GetEntryList()->GetMRUCount();
986  return nPos;
987 }
988 
989 sal_Int32 ListBox::GetEntryPos( const void* pData ) const
990 {
991  if (!mpImplLB)
992  return LISTBOX_ENTRY_NOTFOUND;
993  sal_Int32 nPos = mpImplLB->GetEntryList()->FindEntry( pData );
994  if ( nPos != LISTBOX_ENTRY_NOTFOUND )
995  nPos = nPos - mpImplLB->GetEntryList()->GetMRUCount();
996  return nPos;
997 }
998 
999 OUString ListBox::GetEntry( sal_Int32 nPos ) const
1000 {
1001  if (!mpImplLB)
1002  return OUString();
1004 }
1005 
1006 sal_Int32 ListBox::GetEntryCount() const
1007 {
1008  if (!mpImplLB)
1009  return 0;
1011 }
1012 
1013 OUString ListBox::GetSelectedEntry(sal_Int32 nIndex) const
1014 {
1015  return GetEntry( GetSelectedEntryPos( nIndex ) );
1016 }
1017 
1019 {
1020  if (!mpImplLB)
1021  return 0;
1023 }
1024 
1025 sal_Int32 ListBox::GetSelectedEntryPos( sal_Int32 nIndex ) const
1026 {
1027  if (!mpImplLB || !mpImplLB->GetEntryList())
1028  return LISTBOX_ENTRY_NOTFOUND;
1029 
1030  sal_Int32 nPos = mpImplLB->GetEntryList()->GetSelectedEntryPos( nIndex );
1031  if ( nPos != LISTBOX_ENTRY_NOTFOUND )
1032  {
1033  if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() )
1035  nPos = nPos - mpImplLB->GetEntryList()->GetMRUCount();
1036  }
1037  return nPos;
1038 }
1039 
1040 bool ListBox::IsEntrySelected(const OUString& rStr) const
1041 {
1042  return IsEntryPosSelected( GetEntryPos( rStr ) );
1043 }
1044 
1045 bool ListBox::IsEntryPosSelected( sal_Int32 nPos ) const
1046 {
1048 }
1049 
1050 void ListBox::SelectEntry( const OUString& rStr, bool bSelect )
1051 {
1052  SelectEntryPos( GetEntryPos( rStr ), bSelect );
1053 }
1054 
1055 void ListBox::SelectEntryPos( sal_Int32 nPos, bool bSelect )
1056 {
1057  if (!mpImplLB)
1058  return;
1059 
1060  if ( 0 <= nPos && nPos < mpImplLB->GetEntryList()->GetEntryCount() )
1061  {
1062  sal_Int32 nCurrentPos = mpImplLB->GetCurrentPos();
1063  mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), bSelect );
1064  //Only when bSelect == true, send both Selection & Focus events
1065  if (nCurrentPos != nPos && bSelect)
1066  {
1067  CallEventListeners( VclEventId::ListboxSelect, reinterpret_cast<void*>(nPos));
1068  if (HasFocus())
1069  CallEventListeners( VclEventId::ListboxFocus, reinterpret_cast<void*>(nPos));
1070  }
1071  }
1072 }
1073 
1074 void ListBox::SetEntryData( sal_Int32 nPos, void* pNewData )
1075 {
1076  mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount(), pNewData );
1077 }
1078 
1079 void* ListBox::GetEntryData( sal_Int32 nPos ) const
1080 {
1082 }
1083 
1084 void ListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
1085 {
1086  mpImplLB->SetEntryFlags( nPos + mpImplLB->GetEntryList()->GetMRUCount(), nFlags );
1087 }
1088 
1090 {
1092 }
1093 
1094 void ListBox::SetTopEntry( sal_Int32 nPos )
1095 {
1097 }
1098 
1099 sal_Int32 ListBox::GetTopEntry() const
1100 {
1102  if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() )
1103  nPos = 0;
1104  return nPos;
1105 }
1106 
1108 {
1109  return mpImplLB->IsTravelSelect();
1110 }
1111 
1113 {
1114  // when the dropdown is dismissed, first mbInPopupMode is set to false, and on the next event iteration then
1115  // mbPopupMode is set to false
1117 }
1118 
1120 {
1122  tools::Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( static_cast<vcl::Window*>(const_cast<ListBox *>(this)) );
1123  aRect.Move( aOffset.TopLeft().X(), aOffset.TopLeft().Y() );
1124  return aRect;
1125 }
1126 
1128 {
1129  EnableMultiSelection( bMulti, false );
1130 }
1131 
1132 void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
1133 {
1134  mpImplLB->EnableMultiSelection( bMulti, bStackSelection );
1135 
1136  // WB_SIMPLEMODE:
1137  // The MultiListBox behaves just like a normal ListBox
1138  // MultiSelection is possible via corresponding additional keys
1139  bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
1140  mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
1141 
1142  // In a MultiSelection, we can't see us travelling without focus
1143  if ( mpFloatWin )
1144  mpImplLB->GetMainWindow()->AllowGrabFocus( bMulti );
1145 }
1146 
1148 {
1150 }
1151 
1153 {
1154  Size aSz;
1155 
1156  if (!mpImplLB)
1157  return aSz;
1158 
1159  aSz = CalcSubEditSize();
1160 
1161  bool bAddScrollWidth = false;
1162 
1163  if (IsDropDownBox())
1164  {
1165  aSz.AdjustHeight(4 ); // add a space between entry and border
1166  aSz.AdjustWidth(4 ); // add a little breathing space
1167  bAddScrollWidth = true;
1168  }
1169  else
1170  bAddScrollWidth = (GetStyle() & WB_VSCROLL) == WB_VSCROLL;
1171 
1172  if (bAddScrollWidth)
1173  {
1174  // Try native borders; scrollbar size may not be a good indicator
1175  // See how large the edit area inside is to estimate what is needed for the dropdown
1176  ImplControlValue aControlValue;
1177  tools::Rectangle aContent, aBound;
1178  Size aTestSize( 100, 20 );
1179  tools::Rectangle aArea( Point(), aTestSize );
1181  aControlValue, aBound, aContent) )
1182  {
1183  // use the themes drop down size
1184  aSz.AdjustWidth(aTestSize.Width() - aContent.GetWidth() );
1185  }
1186  else
1187  aSz.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize() );
1188  }
1189 
1190  aSz = CalcWindowSize( aSz );
1191 
1192  if (IsDropDownBox()) // Check minimum height of dropdown box
1193  {
1194  ImplControlValue aControlValue;
1195  tools::Rectangle aRect( Point( 0, 0 ), aSz );
1196  tools::Rectangle aContent, aBound;
1198  aControlValue, aBound, aContent) )
1199  {
1200  if( aBound.GetHeight() > aSz.Height() )
1201  aSz.setHeight( aBound.GetHeight() );
1202  }
1203  }
1204 
1205  return aSz;
1206 }
1207 
1209 {
1210  Size aSz;
1211 
1212  if (!mpImplLB)
1213  return aSz;
1214 
1215  if ( !IsDropDownBox() )
1217  else
1218  {
1219  aSz.setHeight( mpImplLB->GetEntryHeight() );
1220  // Size to maximum entry width
1222 
1223  if (m_nMaxWidthChars != -1)
1224  {
1225  long nMaxWidth = m_nMaxWidthChars * approximate_char_width();
1226  aSz.setWidth( std::min(aSz.Width(), nMaxWidth) );
1227  }
1228 
1229  // Do not create ultrathin ListBoxes, it doesn't look good
1231  aSz.setWidth( GetSettings().GetStyleSettings().GetScrollBarSize() );
1232  }
1233 
1234  return aSz;
1235 }
1236 
1238 {
1239  return CalcMinimumSize();
1240 }
1241 
1242 Size ListBox::CalcAdjustedSize( const Size& rPrefSize ) const
1243 {
1244  Size aSz = rPrefSize;
1245  sal_Int32 nLeft, nTop, nRight, nBottom;
1246  static_cast<vcl::Window*>(const_cast<ListBox *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1247  aSz.AdjustHeight( -(nTop+nBottom) );
1248  if ( !IsDropDownBox() )
1249  {
1250  long nEntryHeight = CalcBlockSize( 1, 1 ).Height();
1251  long nLines = aSz.Height() / nEntryHeight;
1252  if ( nLines < 1 )
1253  nLines = 1;
1254  aSz.setHeight( nLines * nEntryHeight );
1255  }
1256  else
1257  {
1258  aSz.setHeight( mnDDHeight );
1259  }
1260  aSz.AdjustHeight(nTop+nBottom );
1261 
1262  aSz = CalcWindowSize( aSz );
1263  return aSz;
1264 }
1265 
1266 Size ListBox::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
1267 {
1268  // ScrollBars are shown if needed
1269  Size aMinSz = CalcMinimumSize();
1270  // aMinSz = ImplCalcOutSz( aMinSz );
1271 
1272  Size aSz;
1273 
1274  // Height
1275  if ( nLines )
1276  {
1277  if ( !IsDropDownBox() )
1278  aSz.setHeight( mpImplLB->CalcSize( nLines ).Height() );
1279  else
1280  aSz.setHeight( mnDDHeight );
1281  }
1282  else
1283  aSz.setHeight( aMinSz.Height() );
1284 
1285  // Width
1286  if ( nColumns )
1287  aSz.setWidth( nColumns * GetTextWidth( OUString('X') ) );
1288  else
1289  aSz.setWidth( aMinSz.Width() );
1290 
1291  if ( IsDropDownBox() )
1292  aSz.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize() );
1293 
1294  if ( !IsDropDownBox() )
1295  {
1296  if ( aSz.Width() < aMinSz.Width() )
1297  aSz.AdjustHeight(GetSettings().GetStyleSettings().GetScrollBarSize() );
1298  if ( aSz.Height() < aMinSz.Height() )
1299  aSz.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize() );
1300  }
1301 
1302  aSz = CalcWindowSize( aSz );
1303  return aSz;
1304 }
1305 
1306 void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
1307 {
1308  float nCharWidth = approximate_char_width();
1309  if ( !IsDropDownBox() )
1310  {
1312  rnCols = static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth);
1313  rnLines = static_cast<sal_uInt16>(aOutSz.Height()/mpImplLB->GetEntryHeightWithMargin());
1314  }
1315  else
1316  {
1317  Size aOutSz = mpImplWin->GetOutputSizePixel();
1318  rnCols = static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth);
1319  rnLines = 1;
1320  }
1321 }
1322 
1323 IMPL_LINK( ListBox, ImplUserDrawHdl, UserDrawEvent*, pEvent, void )
1324 {
1325  UserDraw( *pEvent );
1326 }
1327 
1329 {
1330 }
1331 
1333 {
1334  if (rEvt.GetWindow() == mpImplLB->GetMainWindow())
1335  mpImplLB->GetMainWindow()->DrawEntry(*rEvt.GetRenderContext(), rEvt.GetItemId(), true/*bDrawImage*/, true/*bDrawText*/, false/*bDrawTextAtImagePos*/ );
1336  else if (rEvt.GetWindow() == mpImplWin)
1337  mpImplWin->DrawEntry(*rEvt.GetRenderContext(), false/*layout*/);
1338 }
1339 
1340 void ListBox::EnableUserDraw( bool bUserDraw )
1341 {
1342  mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
1343  if ( mpImplWin )
1344  mpImplWin->EnableUserDraw( bUserDraw );
1345 }
1346 
1347 void ListBox::SetReadOnly( bool bReadOnly )
1348 {
1349  if ( mpImplLB->IsReadOnly() != bReadOnly )
1350  {
1351  mpImplLB->SetReadOnly( bReadOnly );
1353  }
1354 }
1355 
1357 {
1358  return mpImplLB->IsReadOnly();
1359 }
1360 
1361 void ListBox::SetSeparatorPos( sal_Int32 n )
1362 {
1363  mpImplLB->SetSeparatorPos( n );
1364 }
1365 
1366 sal_Int32 ListBox::GetSeparatorPos() const
1367 {
1368  return mpImplLB->GetSeparatorPos();
1369 }
1370 
1371 void ListBox::AddSeparator( sal_Int32 n )
1372 {
1373  mpImplLB->AddSeparator( n );
1374 }
1375 
1377 {
1378  return mpImplLB->GetDisplayLineCount();
1379 }
1380 
1382 {
1384 }
1385 
1387 {
1388  return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative( const_cast<ListBox*>(this) ) : tools::Rectangle();
1389 }
1390 
1392 {
1393  // !!! Recursion does not occur because the ImplListBox is initialized by default
1394  // to a non-transparent color in Window::ImplInitData
1395  return mpImplLB->GetDisplayBackground();
1396 }
1397 
1398 void ListBox::setMaxWidthChars(sal_Int32 nWidth)
1399 {
1400  if (nWidth != m_nMaxWidthChars)
1401  {
1402  m_nMaxWidthChars = nWidth;
1403  queue_resize();
1404  }
1405 }
1406 
1407 bool ListBox::set_property(const OString &rKey, const OUString &rValue)
1408 {
1409  if (rKey == "active")
1410  SelectEntryPos(rValue.toInt32());
1411  else if (rKey == "max-width-chars")
1412  setMaxWidthChars(rValue.toInt32());
1413  else if (rKey == "can-focus")
1414  {
1415  // as far as I can see in Gtk, setting a ComboBox as can.focus means
1416  // the focus gets stuck in it, so try here to behave like gtk does
1417  // with the settings that work, i.e. can.focus of false doesn't
1418  // set the hard WB_NOTABSTOP
1419  WinBits nBits = GetStyle();
1420  nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
1421  if (toBool(rValue))
1422  nBits |= WB_TABSTOP;
1423  SetStyle(nBits);
1424  }
1425  else
1426  return Control::set_property(rKey, rValue);
1427  return true;
1428 }
1429 
1431 {
1432  return ListBoxUIObject::create;
1433 }
1434 
1435 boost::property_tree::ptree ListBox::DumpAsPropertyTree()
1436 {
1437  boost::property_tree::ptree aTree(Control::DumpAsPropertyTree());
1438  boost::property_tree::ptree aEntries;
1439 
1440  for (int i = 0; i < GetEntryCount(); ++i)
1441  {
1442  boost::property_tree::ptree aEntry;
1443  aEntry.put("", GetEntry(i));
1444  aEntries.push_back(std::make_pair("", aEntry));
1445  }
1446 
1447  aTree.add_child("entries", aEntries);
1448 
1449  boost::property_tree::ptree aSelected;
1450 
1451  for (int i = 0; i < GetSelectedEntryCount(); ++i)
1452  {
1453  boost::property_tree::ptree aEntry;
1454  aEntry.put("", GetSelectedEntryPos(i));
1455  aSelected.push_back(std::make_pair("", aEntry));
1456  }
1457 
1458  aTree.put("selectedCount", GetSelectedEntryCount());
1459  aTree.add_child("selectedEntries", aSelected);
1460 
1461  return aTree;
1462 }
1463 
1466 {
1467  ImplInit( pParent, nStyle );
1468  EnableMultiSelection( true );
1469 }
1470 
1471 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 m_nMaxWidthChars
Definition: lstbox.hxx:87
Point TopLeft() const
long Width() const
const Color & GetTextColor() const
Definition: outdev.hxx:1110
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
Definition: text.cxx:780
OutDevType GetOutDevType() const
Definition: outdev.hxx:522
bool IsControlBackground() const
Definition: window2.cxx:1076
virtual void EnableRTL(bool bEnable=true) override
Definition: ctrl.cxx:65
bool IsInPopupMode() const
Definition: floatwin.hxx:147
virtual Size GetOptimalSize() const override
Definition: listbox.cxx:1237
float approximate_char_width() const
Definition: text.cxx:902
Image GetEntryImage(sal_Int32 nPos) const
Definition: listbox.cxx:972
bool IsDropDownBox() const
Definition: lstbox.hxx:113
bool ImplCallEventListenersAndHandler(VclEventId nEvent, std::function< void()> const &callHandler)
this calls both our event listeners, and a specified handler
Definition: ctrl.cxx:305
long GetWidth() const
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:482
long GetIndexForPoint(const Point &rPoint, sal_Int32 &rPos) const
Definition: listbox.cxx:658
OUString GetSelectedEntry(sal_Int32 nSelIndex=0) const
Definition: listbox.cxx:1013
void EnableMultiSelection(bool bMulti, bool bStackMode)
Definition: listbox.hxx:468
void HideFocus()
Definition: window2.cxx:91
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const
Definition: floatwin.hxx:121
void SetPopupModeEndHdl(const Link< FloatingWindow *, void > &rLink)
Definition: floatwin.hxx:152
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:581
bool HasEntryImage(sal_Int32 nPos) const
long GetHeight() const
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: listbox.cxx:320
const ImplEntryList * GetEntryList() const
Definition: listbox.hxx:415
void SetNoSelection()
long ToRelativeLineIndex(long nIndex) const
ToRelativeLineIndex changes a layout data index to a count relative to its line.
Definition: ctrl.cxx:211
sal_Int32 GetSelectedEntryPos(sal_Int32 nSelIndex=0) const
Definition: listbox.cxx:1025
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.hxx:446
long AdjustWidth(long n)
sal_uInt16 mnDDHeight
Definition: lstbox.hxx:85
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
sal_Int32 GetSelectedEntryPos(sal_Int32 nIndex) const
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:318
void EnableUserDraw(bool bUserDraw)
Definition: listbox.hxx:584
bool IsTravelSelect() const
Definition: listbox.hxx:465
VclPtr< ImplBtn > mpBtn
Definition: lstbox.hxx:84
long Height() const
SAL_DLLPRIVATE void ImplDrawFrame(OutputDevice *pDev, tools::Rectangle &rRect)
draws a frame around the give rectangle, onto the given device
Definition: ctrl.cxx:336
A widget used to choose from a list of items and which has no entry.
Definition: lstbox.hxx:78
IMPL_LINK_NOARG(ListBox, ImplSelectHdl, LinkParamNone *, void)
Definition: listbox.cxx:175
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: listbox.cxx:84
void AllowGrabFocus(bool b)
Definition: listbox.hxx:297
WinBits const WB_NOGROUP
long AdjustLeft(long nHorzMoveDelta)
ListBoxEntryFlags GetEntryFlags(sal_Int32 nPos) const
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2877
void disposeAndClear()
Definition: vclptr.hxx:200
const StyleSettings & GetStyleSettings() const
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:469
virtual void Select()
Definition: listbox.cxx:906
const Size & GetPrefSize() const
Definition: listbox.hxx:526
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
Definition: listbox.cxx:546
ImplSVNWFData maNWFData
Definition: svdata.hxx:352
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:454
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1251
WinBits const WB_RIGHT
sal_Int32 GetEntryPosForPoint(const Point &rPoint) const
void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3852
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual FactoryFunction GetUITestFactory() const override
Definition: listbox.cxx:1430
void SetTextFillColor()
Definition: text.cxx:698
sal_uInt16 GetCode() const
Definition: keycod.hxx:53
void RemoveEntry(const OUString &rStr)
Definition: listbox.cxx:961
sal_Int32 GetSelectedEntryCount() const
PosSizeFlags
Definition: window.hxx:141
DataChangedEventType GetType() const
Definition: event.hxx:348
const KeyEvent * GetKeyEvent() const
Definition: event.hxx:302
void IntersectClipRegion(const tools::Rectangle &rRect)
long GetMaxEntryWidth() const
Definition: listbox.hxx:479
void EnableQuickSelection(bool b)
Definition: listbox.cxx:37
long CalcZoom(long n) const
Definition: window2.cxx:397
void AppendLayoutData(const Control &rSubControl) const
Definition: ctrl.cxx:273
WinBits const WB_VSCROLL
void SetDropDownLineCount(sal_uInt16 nLines)
Definition: listbox.cxx:522
void Clear()
Definition: listbox.cxx:916
virtual void SetSettings(const AllSettings &rSettings) override
const Color & GetControlBackground() const
Definition: window2.cxx:1071
VclPtr< ImplListBox > mpImplLB
Definition: lstbox.hxx:81
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator. ...
Definition: listbox.cxx:1361
bool IsReadOnly() const
Definition: listbox.hxx:474
virtual void DoubleClick()
Definition: listbox.cxx:911
void SetDropDownLineCount(sal_uInt16 n)
Definition: listbox.hxx:536
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
long AdjustHeight(long n)
void EnableUserDraw(bool bUserDraw)
Definition: listbox.cxx:1340
sal_Int32 FindEntry(const OUString &rStr, bool bSearchMRUArea=false) const
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3008
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
void SetMapMode()
Definition: map.cxx:655
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:485
#define LISTBOX_ENTRY_NOTFOUND
Definition: lstbox.hxx:33
long AdjustBottom(long nVertMoveDelta)
void Move(long nHorzMoveDelta, long nVertMoveDelta)
bool HandleWheelAsCursorTravel(const CommandEvent &rCEvt)
const Fraction & GetZoom() const
Definition: window2.cxx:1199
void SelectEntry(const OUString &rStr, bool bSelect=true)
Definition: listbox.cxx:1050
void * GetEntryData(sal_Int32 nPos) const
StateChangedType
Definition: window.hxx:311
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2685
sal_Int64 WinBits
vcl::Window * GetWindow() const
Definition: event.hxx:295
void SetBackground()
void SetControlFont()
Definition: window2.cxx:409
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:432
void SetReadOnly(bool b)
Definition: listbox.hxx:473
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2395
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
Definition: listbox.cxx:1119
void EnableAutoSize(bool bAuto)
Definition: listbox.cxx:505
sal_Int32 GetEntryCount() const
Definition: listbox.cxx:1006
Size CalcAdjustedSize(const Size &rPrefSize) const
Definition: listbox.cxx:1242
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: listbox.cxx:477
const vcl::Font & GetFont() const
Definition: outdev.hxx:637
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:582
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.hxx:451
void EnableMirroring()
pb: #106948# explicit mirroring for calc
Definition: listbox.hxx:504
void SetEntryData(sal_Int32 nPos, void *pNewData)
Definition: listbox.hxx:424
AllSettingsFlags GetFlags() const
Definition: event.hxx:349
virtual boost::property_tree::ptree DumpAsPropertyTree() override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: listbox.cxx:1435
virtual const Wallpaper & GetDisplayBackground() const override
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1303
void * GetEntryData(sal_Int32 nPos) const
Definition: listbox.cxx:1079
void SetCompoundControl(bool bCompound)
Definition: window2.cxx:936
long Top() const
OUString GetEntry(sal_Int32 nPos) const
Definition: listbox.cxx:999
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:484
bool IsReadOnly() const
Definition: listbox.cxx:1356
bool mbDDAutoSize
Definition: lstbox.hxx:92
bool IsEntrySelected(const OUString &rStr) const
Definition: listbox.cxx:1040
Image GetEntryImage(sal_Int32 nPos) const
ImplListBoxWindow * GetMainWindow()
Definition: listbox.hxx:416
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
virtual void Draw(OutputDevice *pDev, const Point &rPos, const Size &rSize, DrawFlags nFlags) override
Definition: listbox.cxx:325
const Color & GetControlForeground() const
Definition: window2.cxx:1061
long GetDrawPixel(::OutputDevice const *pDev, long nPixels) const
Definition: window2.cxx:563
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:471
void SetTopEntry(sal_Int32 nTop)
Definition: listbox.hxx:453
void RemoveEntry(sal_Int32 nPos)
WinBits const WB_NOLIGHTBORDER
sal_Int32 GetMRUCount() const
Definition: listbox.hxx:156
sal_uInt16 GetDisplayLineCount() const
Definition: listbox.hxx:497
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:67
Size CalcWindowSize(const Size &rOutSz) const
Definition: window2.cxx:537
bool IsAutoSizeEnabled() const
Definition: lstbox.hxx:150
void SetScrollHdl(const Link< ImplListBox *, void > &rLink)
Definition: listbox.hxx:481
virtual boost::property_tree::ptree DumpAsPropertyTree()
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3354
void SetLineColor()
void EnableQuickSelection(bool b)
const Color & GetDisableColor() const
bool IsRTLEnabled() const
Definition: outdev.hxx:1354
void SetTop(long v)
vcl::RenderContext * GetRenderContext() const
Definition: event.hxx:223
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:51
sal_Int32 mnSaveValue
Definition: lstbox.hxx:86
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: listbox.cxx:1407
DrawFlags
Definition: window.hxx:354
virtual void Resize() override
void setMaxWidthChars(sal_Int32 nWidth)
Definition: listbox.cxx:1398
bool IsEntryPosSelected(sal_Int32 nIndex) const
OutDevType
Definition: outdev.hxx:278
Link< ListBox &, void > maDoubleClickHdl
Definition: lstbox.hxx:89
The edit field part of a control, e.g.
bool IsNativeWidgetEnabled() const
Definition: window.cxx:3703
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.cxx:1371
void SetControlBackground()
Definition: window2.cxx:497
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
Definition: listbox.cxx:1055
WinBits const WB_SIMPLEMODE
void SetReadOnly(bool bReadOnly=true)
Definition: listbox.cxx:1347
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.hxx:537
void SetImage(const Image &rImg)
Definition: listbox.hxx:579
void SetControlForeground()
Definition: window2.cxx:457
int i
tools::Rectangle GetDropDownPosSizePixel() const
Definition: listbox.cxx:1386
bool IsTravelSelect() const
Definition: listbox.cxx:1107
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1156
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:658
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2971
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.cxx:539
virtual ~ListBox() override
Definition: listbox.cxx:55
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:297
bool IsUpdateMode() const
Definition: window2.cxx:1162
void SetFillColor()
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
CommandEventId GetCommand() const
void SetNoSelection()
Definition: listbox.cxx:932
sal_Int32 GetSelectedEntryCount() const
Definition: listbox.cxx:1018
void SetZoom(const Fraction &rZoom)
Definition: window2.cxx:365
void SetTextColor(const Color &rColor)
Definition: text.cxx:663
void SetItemPos(sal_Int32 n)
Definition: listbox.hxx:575
WinBits const WB_RECTSTYLE
sal_Int32 InsertEntry(const OUString &rStr, sal_Int32 nPos=LISTBOX_APPEND)
Definition: listbox.cxx:945
void EnableMirroring()
Definition: listbox.cxx:1381
bool IsEntryPosSelected(sal_Int32 nPos) const
Definition: listbox.cxx:1045
MouseNotifyEvent GetType() const
Definition: event.hxx:294
MultiListBox(vcl::Window *pParent, WinBits nStyle)
Definition: listbox.cxx:1464
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
Definition: listbox.cxx:1306
sal_uInt16 GetDisplayLineCount() const
Definition: listbox.cxx:1376
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: ctrl.cxx:59
WinBits const WB_DROPDOWN
virtual void Resize() override
Definition: listbox.cxx:564
static bool toBool(const OString &rValue)
Definition: builder.cxx:70
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
DrawTextFlags
Definition: outdev.hxx:144
void DrawEntry(const UserDrawEvent &rEvt)
Definition: listbox.cxx:1332
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1420
WinBits const WB_SORT
void RequestDoubleBuffering(bool bRequest)
Enable/disable double-buffering of the frame window and all its children.
Definition: window.cxx:3819
virtual void LoseFocus()
Definition: window.cxx:1818
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2824
void GrabFocus()
Definition: window.cxx:2980
Size CalcSubEditSize() const
Definition: listbox.cxx:1208
void ToggleDropDown()
Definition: listbox.cxx:303
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:889
virtual const Wallpaper & GetDisplayBackground() const override
Definition: listbox.cxx:1391
SAL_DLLPRIVATE void ImplInitListBoxData()
Definition: listbox.cxx:72
WinBits const WB_LEFT
long X() const
void SetStyle(WinBits nStyle)
Definition: window.cxx:1925
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2867
Size GetSize() const
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
this methods stores a combination of flags from the ListBoxEntryFlags::* defines at the given entry...
Definition: listbox.cxx:1084
void DrawEntry(vcl::RenderContext &rRenderContext, bool bLayout)
Size CalcSize(sal_Int32 nMaxLines) const
Definition: listbox.hxx:476
WinBits const WB_NOBORDER
void EnableSort(bool b)
Definition: listbox.hxx:356
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1257
sal_uInt16 GetItemId() const
Definition: event.hxx:225
ListBoxEntryFlags GetEntryFlags(sal_Int32 nPos) const
this methods gets the current combination of flags from the ListBoxEntryFlags::* defines from the giv...
Definition: listbox.cxx:1089
Size CalcMinimumSize() const
Definition: listbox.cxx:1152
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: listbox.cxx:821
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1185
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:940
long GetIndexForPoint(const Point &rPoint) const
Definition: ctrl.cxx:134
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:931
#define KEY_RETURN
Definition: keycodes.hxx:119
virtual void GetFocus() override
Definition: listbox.cxx:448
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2386
sal_Int32 GetEntryPos(const OUString &rStr) const
Definition: listbox.cxx:979
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:53
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: listbox.cxx:60
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
Definition: listbox.cxx:1266
void DrawEntry(vcl::RenderContext &rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos=false)
void SetPressed(bool bPressed)
Definition: button.cxx:1562
static SAL_DLLPRIVATE WinBits ImplInitStyle(WinBits nStyle)
Definition: listbox.cxx:166
virtual void Resize() override
Definition: ctrl.cxx:74
#define KEY_DOWN
Definition: keycodes.hxx:110
sal_uInt16 mnLineCount
Definition: lstbox.hxx:90
void SetPrefSize(const Size &rSz)
Definition: listbox.hxx:525
bool ProcessKeyInput(const KeyEvent &rKEvt)
Definition: listbox.hxx:434
long AdjustRight(long nHorzMoveDelta)
WindowType
VclPtr< ImplListBoxFloatingWindow > mpFloatWin
Definition: lstbox.hxx:82
Definition: ctrl.hxx:33
long GetEntryHeight() const
Definition: listbox.hxx:477
ListBoxEntryFlags
Definition: lstbox.hxx:43
virtual void GetFocus()
Definition: window.cxx:1804
bool mbNoFocusRects
Definition: svdata.hxx:276
#define SAL_WARN_IF(condition, area, stream)
WinBits const WB_BORDER
void SetFont(const vcl::Font &rNewFont)
std::unique_ptr< vcl::ImplControlData > mpControlData
Definition: ctrl.hxx:36
sal_Int32 GetTopEntry() const
Definition: listbox.cxx:1099
void SetAutoWidth(bool b)
Definition: listbox.hxx:528
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator. ...
Definition: listbox.hxx:441
virtual void FillLayoutData() const override
Definition: listbox.cxx:636
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:590
vcl::Font GetDrawPixelFont(::OutputDevice const *pDev) const
Definition: window2.cxx:553
Definition: image.hxx:40
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:488
void SetBottom(long v)
long GetEntryHeightWithMargin() const
Definition: listbox.hxx:478
void EnableMultiSelection(bool bMulti, bool bStackSelection)
Definition: listbox.cxx:1132
long AdjustTop(long nVertMoveDelta)
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.cxx:1366
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:483
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
long Left() const
long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: text.cxx:878
bool IsDisposed() const
Definition: window.cxx:136
WinBits const WB_TABSTOP
VclPtr< ImplWin > mpImplWin
Definition: lstbox.hxx:83
bool IsMultiSelectionEnabled() const
Definition: listbox.cxx:1147
Event to pass information for UserDraw() handling eg. in comboboxes.
Definition: event.hxx:205
WinBits const WB_CENTER
sal_Int32 InsertEntry(sal_Int32 nPos, const OUString &rStr)
ScXMLEditAttributeMap::Entry const aEntries[]
bool IsEnabled() const
Definition: window2.cxx:1111
MouseWheelBehaviour
Definition: settings.hxx:83
void AdaptDropDownLineCountToMaximum()
Definition: listbox.cxx:529
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:486
virtual void LoseFocus() override
Definition: listbox.cxx:461
WinBits GetStyle() const
Definition: window2.cxx:942
void SelectEntry(sal_Int32 nPos, bool bSelect)
virtual void UserDraw(const UserDrawEvent &rUDEvt)
Definition: listbox.cxx:1328
OUString GetEntryText(sal_Int32 nPos) const
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2818
void StartFloat(bool bStartTracking)
WinBits const WB_GROUP
void ImplInitDropDownButton(PushButton *pButton)
Definition: imp_listbox.cxx:50
void SetTopEntry(sal_Int32 nPos)
Definition: listbox.cxx:1094
void SetString(const OUString &rStr)
Definition: listbox.hxx:577
void SetEntryData(sal_Int32 nPos, void *pNewData)
Definition: listbox.cxx:1074
long GetScrollBarSize() const
void EnableUserDraw(bool bUserDraw)
Definition: listbox.hxx:326
bool IsReallyVisible() const
Definition: window2.cxx:1096
vcl::Font GetControlFont() const
Definition: window2.cxx:438
sal_Int32 GetItemPos() const
Definition: listbox.hxx:574
void SetImplListBox(ImplListBox *pLB)
Definition: listbox.hxx:523
Link< ListBox &, void > maSelectHdl
Definition: lstbox.hxx:88
bool HasFocus() const
Definition: window.cxx:2985
bool IsInDropDown() const
Definition: listbox.cxx:1112
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:60
sal_Int32 nPos
void SetEdgeBlending(bool bNew)
void setWidth(long nWidth)
void EndPopupMode(FloatWinPopupEndFlags nFlags=FloatWinPopupEndFlags::NONE)
Definition: floatwin.cxx:886
vcl::Window * GetWindow() const
Definition: event.hxx:222
WinBits const WB_NOTABSTOP
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1246
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
tools::Rectangle GetWindowExtentsRelative(vcl::Window *pRelativeWindow) const
Definition: window.cxx:2904
sal_Int32 GetEntryCount() const
Definition: listbox.hxx:125
virtual void StateChanged(StateChangedType nType) override
Definition: listbox.cxx:715
bool HasLayoutData() const
determines whether we currently have layout data
Definition: ctrl.cxx:90
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:608
long Y() const
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
ListBox(WindowType nType)
Definition: listbox.cxx:42
void SetLayoutDataParent(const Control *pParent) const
Definition: ctrl.cxx:324
#define KEY_UP
Definition: keycodes.hxx:111
void SetListItemSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:487
bool IsMod2() const
Definition: keycod.hxx:62
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2150
IMPL_LINK(ListBox, ImplFocusHdl, sal_Int32, nPos, void)
Definition: listbox.cxx:200
void setHeight(long nHeight)