summaryrefslogtreecommitdiff
path: root/vcl/source/control/combobox.cxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2004-05-18 09:53:59 +0000
committerKurt Zenker <kz@openoffice.org>2004-05-18 09:53:59 +0000
commitca273690b684252d0dbbb1b2a704415ecc35f9f7 (patch)
treefc450518561f136bc8f4b13a2a0483ff616f4148 /vcl/source/control/combobox.cxx
parentea4e7c1639da9523bfe4f20704060e092fb9ec0a (diff)
INTEGRATION: CWS vcl21 (1.28.84); FILE MERGED
2004/04/01 13:26:01 pl 1.28.84.1: #114210# add: GetIndexForPoint for ComboBox
Diffstat (limited to 'vcl/source/control/combobox.cxx')
-rw-r--r--vcl/source/control/combobox.cxx48
1 files changed, 46 insertions, 2 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 753cee97a286..f79562242e69 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: combobox.cxx,v $
*
- * $Revision: 1.29 $
+ * $Revision: 1.30 $
*
- * last change: $Author: hr $ $Date: 2004-05-10 15:46:12 $
+ * last change: $Author: kz $ $Date: 2004-05-18 10:53:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -334,6 +334,11 @@ IMPL_LINK( ComboBox, ImplClickBtnHdl, void*, EMPTYARG )
SetSelection( Selection( 0, SELECTION_MAX ) );
mpFloatWin->StartFloat( TRUE );
ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN );
+
+ ImplClearLayoutData();
+ if( mpImplLB )
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
+
return 0;
}
@@ -353,6 +358,10 @@ IMPL_LINK( ComboBox, ImplPopupModeEndHdl, void*, p )
}
}
+ ImplClearLayoutData();
+ if( mpImplLB )
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
+
mpBtn->SetPressed( FALSE );
ImplCallEventListeners( VCLEVENT_DROPDOWN_CLOSE );
return 0;
@@ -1495,3 +1504,38 @@ void ComboBox::SetBorderStyle( USHORT nBorderStyle )
mpImplLB->SetBorderStyle( nBorderStyle );
}
}
+// -----------------------------------------------------------------------------
+
+long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const
+{
+ if( ! mpLayoutData )
+ FillLayoutData();
+
+ // check whether rPoint fits at all
+ long nIndex = Control::GetIndexForPoint( rPoint );
+ if( nIndex != -1 )
+ {
+ // point must be either in main list window
+ // or in impl window (dropdown case)
+ ImplListBoxWindow* pMain = mpImplLB->GetMainWindow();
+
+ // convert coordinates to ImplListBoxWindow pixel coordinate space
+ Point aConvPoint = LogicToPixel( rPoint );
+ aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
+ aConvPoint = pMain->AbsoluteScreenToOutputPixel( aConvPoint );
+ aConvPoint = pMain->PixelToLogic( aConvPoint );
+
+ // try to find entry
+ USHORT nEntry = pMain->GetEntryPosForPoint( aConvPoint );
+ if( nEntry == LISTBOX_ENTRY_NOTFOUND )
+ nIndex = -1;
+ else
+ rPos = nEntry;
+ }
+
+ // get line relative index
+ if( nIndex != -1 )
+ nIndex = ToRelativeLineIndex( nIndex );
+
+ return nIndex;
+}