? .DS_Store ? patchListBox.diff ? patchListBox2.diff ? patchListBoxFULL.diff ? unxmacxi.pro ? aqua/.DS_Store ? aqua/source/.DS_Store ? aqua/source/gdi/.DS_Store Index: aqua/inc/salnativewidgets.h =================================================================== RCS file: /cvs/gsl/vcl/aqua/inc/Attic/salnativewidgets.h,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 salnativewidgets.h --- aqua/inc/salnativewidgets.h 17 Feb 2007 09:44:40 -0000 1.1.2.4 +++ aqua/inc/salnativewidgets.h 2 Jul 2007 14:02:00 -0000 @@ -40,6 +40,16 @@ #define BUTTON_WIDTH 16 #define BUTTON_HEIGHT 17 +//standard height of the AHIG +#define TAB_HEIGHT_NORMAL 20 +#define TAB_HEIGHT_SMALL 17 +#define TAB_HEIGHT_MINI 15 + +#define TAB_TEXT_OFFSET 12 + +#define LISTBOX_HEIGHT_NORMAL 20 +#define LISTBOX_TEXT_OFFSET 9 + // for some controls, like spinbuttons + spinboxes, or listboxes // we need it to adjust text position beside radio and check buttons Index: aqua/source/app/salinst.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/app/salinst.cxx,v retrieving revision 1.33.110.27 diff -u -r1.33.110.27 salinst.cxx --- aqua/source/app/salinst.cxx 28 Jun 2007 16:00:52 -0000 1.33.110.27 +++ aqua/source/app/salinst.cxx 2 Jul 2007 14:02:01 -0000 @@ -313,7 +313,9 @@ // init instance (only one instance in this version !!!) pSalData->mpFirstInstance = pInst; - ImplGetSVData()->maNWFData.mbNoFocusRects = true; + ImplGetSVData()->maNWFData.mbNoFocusRects = true; + ImplGetSVData()->maNWFData.mbListBoxMenu = true; + ImplGetSVData()->maNWFData.mbNoVScrollBarInListBox = true; return pInst; } Index: aqua/source/gdi/salnativewidgets.cxx =================================================================== RCS file: /cvs/gsl/vcl/aqua/source/gdi/Attic/salnativewidgets.cxx,v retrieving revision 1.1.2.51 diff -u -r1.1.2.51 salnativewidgets.cxx --- aqua/source/gdi/salnativewidgets.cxx 28 Jun 2007 12:35:13 -0000 1.1.2.51 +++ aqua/source/gdi/salnativewidgets.cxx 2 Jul 2007 14:02:01 -0000 @@ -302,7 +302,8 @@ case CTRL_LISTBOX: // ** TO DO ** if( nPart == PART_ENTIRE_CONTROL || nPart == PART_WINDOW || - nPart == HAS_BACKGROUND_TEXTURE + nPart == HAS_BACKGROUND_TEXTURE || + nPart == PART_WINDOW_BACKGROUND_DROPDOWNWINDOW ) return true; break; @@ -570,8 +571,11 @@ ButtonValue aListButtonValue = aValue.getTristateVal(); aListInfo.value = ImplGetButtonValue( aListButtonValue ); - aListInfo.adornment = kThemeAdornmentDefault; - + aListInfo.adornment = kThemeAdornmentDefault;//or kThemeAdornmentNone + + if( (nState & CTRL_STATE_FOCUSED) != 0 ) + aListInfo.adornment |= kThemeAdornmentFocus; + HIThemeDrawButton(&rc, &aListInfo, mrContext, kHIThemeOrientationNormal,&rc); bOK = true; } @@ -854,7 +858,13 @@ { AquaLog( "%s (%s, %s)\n", __func__, ImplDbgGetStringControlType(nType), ImplDbgGetStringControlPart(nPart)); BOOL toReturn = FALSE; + + short x = rControlRegion.GetBoundRect().Left(); + short y = rControlRegion.GetBoundRect().Top(); + short w, h; + sal_uInt8 nBorderCleanup = 0; + switch (nType) { case CTRL_COMBOBOX: @@ -872,12 +882,6 @@ case CTRL_RADIOBUTTON: case CTRL_CHECKBOX: - short x = rControlRegion.GetBoundRect().Left(); - short y = rControlRegion.GetBoundRect().Top(); - short w, h; - - sal_uInt8 nBorderCleanup = 0; - if ( nType == CTRL_PUSHBUTTON ) { w = rControlRegion.GetBoundRect().GetWidth(); @@ -899,6 +903,20 @@ toReturn = TRUE; break; + + case CTRL_LISTBOX: + if(nPart == PART_BUTTON_DOWN) { + h = LISTBOX_HEIGHT_NORMAL; + w = rControlRegion.GetBoundRect().GetWidth();// + 2*LISTBOX_TEXT_OFFSET; + + rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); + rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); + + //toReturn = TRUE; + } + + break; + } AquaLog( "AquaSalGraphics::getNativeControlRegion will return: %d\n", toReturn); Index: inc/ilstbox.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/ilstbox.hxx,v retrieving revision 1.28 diff -u -r1.28 ilstbox.hxx --- inc/ilstbox.hxx 19 Jun 2006 19:05:08 -0000 1.28 +++ inc/ilstbox.hxx 2 Jul 2007 14:02:01 -0000 @@ -57,7 +57,9 @@ #ifndef _SV_TIMER_HXX #include #endif - +#ifndef _SV_MENU_HXX +#include +#endif class ScrollBar; class ScrollBarBox; @@ -399,6 +401,9 @@ mbHScroll : 1, // HScroll an oder aus mbAutoHScroll : 1; // AutoHScroll an oder aus Link maScrollHdl; // Weil der vom ImplListBoxWindow selbst benoetigt wird. + BOOL mbScrollMenu; //has the listbox scroll symbols instead of scrollbars, like some menus + USHORT mnScrollerHeight; //height of the scroll symbol + BOOL mbNoVScrollBar; protected: virtual void GetFocus(); @@ -410,6 +415,9 @@ void ImplResizeControls(); void ImplCheckScrollBars(); void ImplInitScrollBars(); + + virtual void Paint( const Rectangle& Rect); + void ImplDrawScroller( BOOL bUp ); DECL_LINK( ScrollBarHdl, ScrollBar* ); DECL_LINK( LBWindowScrolled, void* ); @@ -496,6 +504,9 @@ USHORT GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); } USHORT GetDisplayLineCount() const { return maLBWindow.GetDisplayLineCount(); } + + USHORT GetScrollerHeight() const { return mnScrollerHeight; } + BOOL IsScrollMenu() const { return mbScrollMenu; } // pb: #106948# explicit mirroring for calc inline void EnableMirroring() { maLBWindow.EnableMirroring(); } @@ -545,6 +556,57 @@ virtual void Resize(); }; +// ----------------------------- +// - ImplListBoxFloatingMenu - +// ----------------------------- + +class ImplListBoxFloatingMenu : public MenuFloatingWindow +{ +private: + ImplListBox* mpImplLB; + Size maPrefSz; + USHORT mnDDLineCount; + USHORT mnPopupModeStartSaveSelection; + BOOL mbAutoWidth; + BOOL bScrollMenu; + BOOL bScrollUp; + BOOL bScrollDown; + +protected: + long PreNotify( NotifyEvent& rNEvt ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + +public: + ImplListBoxFloatingMenu( Window* pParent ); + + void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; } + + void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; } + const Size& GetPrefSize() const { return maPrefSz; } + + void SetAutoWidth( BOOL b ) { mbAutoWidth = b; } + BOOL IsAutoWidth() const { return mbAutoWidth; } + + Size CalcFloatSize(); + Point CalcCenteredPos(Point aPos, Size aFloatSz); + void StartFloat( BOOL bStartTracking ); + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, USHORT nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) + { FloatingWindow::SetPosSizePixel( rNewPos, rNewSize ); } + + void SetDropDownLineCount( USHORT n ) { mnDDLineCount = n; } + USHORT GetDropDownLineCount() const { return mnDDLineCount; } + + USHORT GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; } + + virtual void Resize(); + + virtual void Paint( const Rectangle& ); +}; + + // ----------- // - ImplWin - // ----------- Index: inc/vcl/lstbox.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/vcl/lstbox.hxx,v retrieving revision 1.2 diff -u -r1.2 lstbox.hxx --- inc/vcl/lstbox.hxx 11 Apr 2007 17:59:45 -0000 1.2 +++ inc/vcl/lstbox.hxx 2 Jul 2007 14:02:02 -0000 @@ -50,6 +50,7 @@ class Image; class ImplListBox; class ImplListBoxFloatingWindow; +class ImplListBoxFloatingMenu; class ImplBtn; class ImplWin; @@ -62,6 +63,7 @@ private: ImplListBox* mpImplLB; ImplListBoxFloatingWindow* mpFloatWin; + ImplListBoxFloatingMenu* mpFloatMenu; ImplWin* mpImplWin; ImplBtn* mpBtn; USHORT mnDDHeight; @@ -89,7 +91,7 @@ SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); //#endif - BOOL IsDropDownBox() const { return mpFloatWin ? TRUE : FALSE; } + BOOL IsDropDownBox() const { return (mpFloatWin || mpFloatMenu) ? TRUE : FALSE; } protected: ListBox( WindowType nType ); Index: inc/vcl/menu.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/vcl/menu.hxx,v retrieving revision 1.2 diff -u -r1.2 menu.hxx --- inc/vcl/menu.hxx 11 Apr 2007 18:00:17 -0000 1.2 +++ inc/vcl/menu.hxx 2 Jul 2007 14:02:02 -0000 @@ -68,6 +68,14 @@ #include #endif +#ifndef _SV_TIMER_HXX +#include +#endif + +#ifndef _SV_FLOATWIN_HXX +#include +#endif + struct MenuItemData; class Point; class Size; @@ -536,5 +544,98 @@ return *this; } + + +// ---------------------- +// - MenuFloatingWindow - +// ---------------------- + +class MenuFloatingWindow : public FloatingWindow +{ + friend void Menu::ImplFillLayoutData() const; + friend Menu::~Menu(); + +private: + Menu* pMenu; + PopupMenu* pActivePopup; + Timer aHighlightChangedTimer; + Timer aSubmenuCloseTimer; + Timer aScrollTimer; + ULONG nSaveFocusId; +// long nStartY; + USHORT nHighlightedItem; // gehighlightetes/selektiertes Item + USHORT nMBDownPos; + USHORT nScrollerHeight; + USHORT nFirstEntry; + USHORT nBorder; + USHORT nPosInParent; + BOOL bInExecute; + + BOOL bScrollMenu; + BOOL bScrollUp; + BOOL bScrollDown; + BOOL bIgnoreFirstMove; + BOOL bKeyInput; + + DECL_LINK( PopupEnd, FloatingWindow* ); + DECL_LINK( HighlightChanged, Timer* ); + DECL_LINK( SubmenuClose, Timer* ); + DECL_LINK( AutoScroll, Timer* ); + + void StateChanged( StateChangedType nType ); + void DataChanged( const DataChangedEvent& rDCEvt ); +protected: + Region ImplCalcClipRegion( BOOL bIncludeLogo = TRUE ) const; + void ImplInitClipRegion(); + void ImplDrawScroller( BOOL bUp ); + using Window::ImplScroll; + void ImplScroll( const Point& rMousePos ); + void ImplScroll( BOOL bUp ); + void ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd = FALSE ); + void ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDown ); + long ImplGetStartY() const; + Rectangle ImplGetItemRect( USHORT nPos ); + +public: + MenuFloatingWindow( Menu* pMenu, Window* pParent, WinBits nStyle ); + ~MenuFloatingWindow(); + + void doShutdown(); + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvent ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void Resize(); + + void SetFocusId( ULONG nId ) { nSaveFocusId = nId; } + ULONG GetFocusId() const { return nSaveFocusId; } + + void EnableScrollMenu( BOOL b ); + BOOL IsScrollMenu() const { return bScrollMenu; } + USHORT GetScrollerHeight() const { return nScrollerHeight; } + + void Execute(); + void StopExecute( ULONG nFocusId = 0 ); + void EndExecute(); + void EndExecute( USHORT nSelectId ); + + PopupMenu* GetActivePopup() const { return pActivePopup; } + void KillActivePopup( PopupMenu* pThisOnly = NULL ); + + void HighlightItem( USHORT nPos, BOOL bHighlight ); + void ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ); + USHORT GetHighlightedItem() const { return nHighlightedItem; } + + void SetPosInParent( USHORT nPos ) { nPosInParent = nPos; } + USHORT GetPosInParent() const { return nPosInParent; } + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); +}; + + #endif // _SV_MENU_HXX Index: inc/vcl/salnativewidgets.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/vcl/salnativewidgets.hxx,v retrieving revision 1.2.44.1 diff -u -r1.2.44.1 salnativewidgets.hxx --- inc/vcl/salnativewidgets.hxx 22 Jun 2007 07:07:50 -0000 1.2.44.1 +++ inc/vcl/salnativewidgets.hxx 2 Jul 2007 14:02:02 -0000 @@ -199,6 +199,7 @@ #define PART_BACKGROUND_WINDOW 6000 #define PART_BACKGROUND_DIALOG 6001 +#define PART_WINDOW_BACKGROUND_DROPDOWNWINDOW 6002 /* Control State: * Index: inc/vcl/svdata.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/vcl/svdata.hxx,v retrieving revision 1.3.4.1 diff -u -r1.3.4.1 svdata.hxx --- inc/vcl/svdata.hxx 20 Jun 2007 19:00:27 -0000 1.3.4.1 +++ inc/vcl/svdata.hxx 2 Jul 2007 14:02:02 -0000 @@ -314,6 +314,8 @@ // in menubar if not transparent bool mbOpenMenuOnF10; // on gnome the first menu opens on F10 bool mbNoFocusRects; // on Aqua focus rects are not used + bool mbListBoxMenu; // on Aqua, dropdown listboxes have a menu instead of a floating window + bool mbNoVScrollBarInListBox; // on Aqua, dropdown listbox windows haven't Vertical scrollbar }; Index: source/control/ilstbox.cxx =================================================================== RCS file: /cvs/gsl/vcl/source/control/ilstbox.cxx,v retrieving revision 1.58 diff -u -r1.58 ilstbox.cxx --- source/control/ilstbox.cxx 15 Jan 2007 14:38:40 -0000 1.58 +++ source/control/ilstbox.cxx 2 Jul 2007 14:02:03 -0000 @@ -81,7 +81,15 @@ #include #endif +#ifndef _SV_WINDOW_H +#include +#endif + +#ifndef _SV_DECOVIEW_HXX +#include +#endif +using ::rtl::OUString; using namespace ::com::sun::star; @@ -565,6 +573,10 @@ ImplInitSettings( TRUE, TRUE, TRUE ); ImplCalcMetrics(); + + SetPaintTransparent(TRUE); + + EnableChildTransparentMode(); } // ----------------------------------------------------------------------- @@ -580,6 +592,19 @@ void ImplListBoxWindow::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { ImplInitFieldSettings( this, bFont, bForeground, bBackground ); + + // user override + if ( IsControlBackground() ) + SetBackground( GetControlBackground() ); + // NWF background + else if( IsNativeControlSupported( CTRL_LISTBOX, PART_WINDOW_BACKGROUND_DROPDOWNWINDOW ) ) + { + ImplGetWindowImpl()->mnNativeBackground = PART_WINDOW_BACKGROUND_DROPDOWNWINDOW; + EnableChildTransparentMode( TRUE ); + } + // fallback to settings color + else + SetBackground( GetSettings().GetStyleSettings().GetDialogColor() ); } // ----------------------------------------------------------------------- @@ -641,6 +666,8 @@ Invalidate(); } +// ----------------------------------------------------------------------- + void ImplListBoxWindow::SetUserItemSize( const Size& rSz ) { delete mpLayoutData, mpLayoutData = NULL; @@ -2047,10 +2074,18 @@ mbVScroll = FALSE; mbHScroll = FALSE; mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ) ? TRUE : FALSE; + + mbNoVScrollBar = ImplGetSVData()->maNWFData.mbNoVScrollBarInListBox; + mbScrollMenu = FALSE; + mnScrollerHeight= (mbNoVScrollBar) ? GetSettings().GetStyleSettings().GetScrollBarSize() /2 : 0 ; maLBWindow.SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) ); maLBWindow.SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) ); maLBWindow.Show(); + + SetPaintTransparent(TRUE); + + EnableChildTransparentMode(); } // ----------------------------------------------------------------------- @@ -2215,8 +2250,12 @@ { if( !mbVScroll ) bArrange = TRUE; - mbVScroll = TRUE; - + + if( !mbNoVScrollBar ) + mbVScroll = TRUE; + else + mbScrollMenu = TRUE; + // Ueberpruefung des rausgescrollten Bereichs SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft... } @@ -2225,6 +2264,8 @@ if( mbVScroll ) bArrange = TRUE; mbVScroll = FALSE; + mbScrollMenu = FALSE; + SetTopEntry( 0 ); } @@ -2248,8 +2289,12 @@ if( nEntries > nMaxVisEntries ) { bArrange = TRUE; - mbVScroll = TRUE; - + + if( !mbNoVScrollBar ) + mbVScroll = TRUE; + else + mbScrollMenu = TRUE; + // Ueberpruefung des rausgescrollten Bereichs SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft... } @@ -2320,6 +2365,12 @@ // Scrollbar on left or right side? BOOL bMirroring = maLBWindow.IsMirroring(); Point aWinPos( bMirroring && mbVScroll ? nSBWidth : 0, 0 ); + + if ( mbScrollMenu ) { + aInnerSz.Height() -= 2 * mnScrollerHeight; + aWinPos.Y() += mnScrollerHeight; + } + maLBWindow.SetPosSizePixel( aWinPos, aInnerSz ); // ScrollBarBox @@ -2514,6 +2565,40 @@ return aEntries; } +void ImplListBox::Paint( const Rectangle& Rect) +{ + Control::Paint( Rect ); + + ImplDrawScroller( TRUE ); + ImplDrawScroller( FALSE ); +} + +void ImplListBox::ImplDrawScroller( BOOL bUp ) +{ + SetClipRegion(); + + Size aOutSz = GetOutputSizePixel(); + long nY = bUp ? 0 : ( aOutSz.Height() - mnScrollerHeight ); + long nX = 0;//TODO: add offset for checkmark + Rectangle aRect( Point( nX, nY ), Size( aOutSz.Width()-nX, mnScrollerHeight ) ); + + DecorationView aDecoView( this ); + SymbolType eSymbol = bUp ? SYMBOL_SPIN_UP : SYMBOL_SPIN_DOWN; + + USHORT nStyle = 0; + USHORT nTopEntry = GetMainWindow()->GetTopEntry(); + USHORT nLastEntry = nTopEntry + GetMainWindow()->GetDisplayLineCount(); + //first entry is 0 not 1 + BOOL bScrollUp = nTopEntry!=0; + BOOL bScrollDown = ( nLastEntry + 1 ) < (GetMainWindow()->GetEntryList()->GetEntryCount()); + if ( ( bUp && !bScrollUp ) || ( !bUp && !bScrollDown ) ) + nStyle |= SYMBOL_DRAW_DISABLE; + + aDecoView.DrawSymbol( aRect, eSymbol, GetSettings().GetStyleSettings().GetButtonTextColor(), nStyle ); + + ImplInitClipRegion(); +} + // ======================================================================= ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) : @@ -2528,6 +2613,10 @@ mbInUserDraw = FALSE; mbUserDrawEnabled = FALSE; mnItemPos = LISTBOX_ENTRY_NOTFOUND; + + SetPaintTransparent(TRUE); + + EnableChildTransparentMode(); } // ----------------------------------------------------------------------- @@ -2997,6 +3086,252 @@ if( !IsInPopupMode() ) { Size aFloatSz = CalcFloatSize(); + SetSizePixel( aFloatSz ); + mpImplLB->SetSizePixel( GetOutputSizePixel() ); + + USHORT nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 ); + mnPopupModeStartSaveSelection = nPos; + + Size aSz = GetParent()->GetSizePixel(); + Point aPos = GetParent()->GetPosPixel(); + aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos ); + Rectangle aRect( aPos, aSz ); + + // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI + // where the document is unmirrored + // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror + if( GetParent()->GetParent()->ImplHasMirroredGraphics() && !GetParent()->GetParent()->IsRTLEnabled() ) + GetParent()->GetParent()->ImplReMirror( aRect ); + + StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); + + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + mpImplLB->SetTopEntry( nPos ); + + if( bStartTracking ) + mpImplLB->GetMainWindow()->EnableMouseMoveSelect( TRUE ); + + if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() ) + mpImplLB->GetMainWindow()->GrabFocus(); + + mpImplLB->GetMainWindow()->ImplClearLayoutData(); + } +} + +// ======================================================================= + +ImplListBoxFloatingMenu::ImplListBoxFloatingMenu( Window* pParent ) : + MenuFloatingWindow( NULL, pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ) // no drop shadow for list boxes +{ + mpImplLB = NULL; + mnDDLineCount = 0; + mbAutoWidth = FALSE; + + mnPopupModeStartSaveSelection = LISTBOX_ENTRY_NOTFOUND; + + EnableSaveBackground(); + + EnableChildTransparentMode(); +} + +// ----------------------------------------------------------------------- + +uno::Reference< ::com::sun::star::accessibility::XAccessible > ImplListBoxFloatingMenu::CreateAccessible() +{ + // Hide Accessible for this Window, because it's a top window we don't want to see as a top window. + // Must be handled in the ListBox/ComboBox Accessibility Implementation + return NULL; +} + +// ----------------------------------------------------------------------- + +long ImplListBoxFloatingMenu::PreNotify( NotifyEvent& rNEvt ) +{ + if( rNEvt.GetType() == EVENT_LOSEFOCUS ) + { + if( !GetParent()->HasChildPathFocus( TRUE ) ) + EndPopupMode(); + } + + return FloatingWindow::PreNotify( rNEvt ); +} + +// ----------------------------------------------------------------------- + +void ImplListBoxFloatingMenu::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +{ + FloatingWindow::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); + + // Fix #60890# ( MBA ): um auch im aufgeklappten Zustand der Listbox die Gr"o\se einfach zu einen + // Aufruf von Resize() "andern zu k"onnen, wird die Position hier ggf. angepa\t + if ( IsReallyVisible() && ( nFlags & WINDOW_POSSIZE_HEIGHT ) ) + { + Point aPos = GetParent()->GetPosPixel(); + aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos ); + + if ( nFlags & WINDOW_POSSIZE_X ) + aPos.X() = nX; + + if ( nFlags & WINDOW_POSSIZE_Y ) + aPos.Y() = nY; + + USHORT nIndex; + SetPosPixel( ImplCalcPos( this, Rectangle( aPos, GetParent()->GetSizePixel() ), FLOATWIN_POPUPMODE_DOWN, nIndex ) ); + } + +// if( !IsReallyVisible() ) + { + // Die ImplListBox erhaelt kein Resize, weil nicht sichtbar. + // Die Fenster muessen aber ein Resize() erhalten, damit die + // Anzahl der sichtbaren Eintraege fuer PgUp/PgDown stimmt. + // Die Anzahl kann auch nicht von List/Combobox berechnet werden, + // weil hierfuer auch die ggf. vorhandene vertikale Scrollbar + // beruecksichtigt werden muss. + mpImplLB->SetSizePixel( GetOutputSizePixel() ); + ((Window*)mpImplLB)->Resize(); + ((Window*)mpImplLB->GetMainWindow())->Resize(); + } +} + +// ----------------------------------------------------------------------- + +void ImplListBoxFloatingMenu::Resize() +{ + mpImplLB->GetMainWindow()->ImplClearLayoutData(); + FloatingWindow::Resize(); +} + +// ----------------------------------------------------------------------- + +Size ImplListBoxFloatingMenu::CalcFloatSize() +{ + Size aFloatSz( maPrefSz ); + + sal_Int32 nLeft, nTop, nRight, nBottom; + GetBorder( nLeft, nTop, nRight, nBottom ); + + USHORT nScrollHeight=(mpImplLB->IsScrollMenu()) ? mpImplLB->GetScrollerHeight(): 0; + + USHORT nLines = mpImplLB->GetEntryList()->GetEntryCount(); + if ( mnDDLineCount && ( nLines > mnDDLineCount ) ) + nLines = mnDDLineCount; + + Size aSz = mpImplLB->CalcSize( nLines ); + long nMaxHeight = aSz.Height() + nTop + nBottom + 2*nScrollHeight; + + if ( mnDDLineCount ) + aFloatSz.Height() = nMaxHeight; + + long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); + if( mbAutoWidth ) + { + // AutoSize erstmal nur fuer die Breite... + + aFloatSz.Width() = aSz.Width() + nLeft + nRight; + aFloatSz.Width() += nRight; // etwas mehr Platz sieht besser aus... + + if ( ( aFloatSz.Height() < nMaxHeight ) || ( mnDDLineCount && ( mnDDLineCount < mpImplLB->GetEntryList()->GetEntryCount() ) ) ) + { + // dann wird noch der vertikale Scrollbar benoetigt + //long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); + //aFloatSz.Width() += nSBWidth; + + aFloatSz.Height() += 2*nScrollHeight; + + //the selected item is centered instead of being at the top when there are scrollbars + USHORT nCurPos = mpImplLB->GetMainWindow()->GetCurrentPos(); + USHORT nTopEntry = mpImplLB->GetMainWindow()->GetTopEntry(); + USHORT nVisibleLines = mpImplLB->GetMainWindow()->GetDisplayLineCount(); + if (( nCurPos == nTopEntry ) && ( nCurPos - nVisibleLines/2 > 0 )) + mpImplLB->GetMainWindow()->SetTopEntry( nCurPos - nVisibleLines/2 ); + } + } + + if ( aFloatSz.Height() > nMaxHeight ) + aFloatSz.Height() = nMaxHeight; + + // Minimale Hoehe, falls Hoehe nicht auf Float-Hoehe eingestellt wurde. + // Der Parent vom FloatWin muss die DropDown-Combo/Listbox sein. + Size aParentSz = GetParent()->GetSizePixel(); + if( !mnDDLineCount && ( aFloatSz.Height() < aParentSz.Height() ) ) + aFloatSz.Height() = aParentSz.Height(); + + // Nicht schmaler als der Parent werden... + long nButtonWidth;//=GetParent()->GetSizePixel().Width(); + ImplControlValue aControlValue; + Window *pBorder = GetWindow( WINDOW_BORDER ); + Point aPoint; + Region aContent, aBound; + Region aArea( Rectangle(aPoint, pBorder->GetOutputSizePixel()) ); + + if ( GetNativeControlRegion( CTRL_LISTBOX, PART_BUTTON_DOWN, + aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) + { + nButtonWidth=aContent.GetBoundRect().GetWidth(); + } + else { + // as the button width is initialized with the standard scrollbar width + nButtonWidth = nSBWidth; //GetSettings().GetStyleSettings().GetScrollBarSize(); + } + + if( aFloatSz.Width() < aParentSz.Width() - nButtonWidth ) + aFloatSz.Width() = aParentSz.Width() - nButtonWidth -4; + + // Hoehe auf Entries alignen... + long nInnerHeight = aFloatSz.Height() - nTop - nBottom - 2*nScrollHeight; + long nEntryHeight = mpImplLB->GetEntryHeight(); + if ( nInnerHeight % nEntryHeight ) + { + nInnerHeight /= nEntryHeight; + nInnerHeight++; + nInnerHeight *= nEntryHeight; + aFloatSz.Height() = nInnerHeight + nTop + nBottom + 2*nScrollHeight; + } + + return aFloatSz; +} + +// ----------------------------------------------------------------------- + +Point ImplListBoxFloatingMenu::CalcCenteredPos(Point aPos, Size aFloatSz) +{ + //first pos is 0 + USHORT nCurPos = mpImplLB->GetMainWindow()->GetCurrentPos(); + USHORT nTopEntry = mpImplLB->GetMainWindow()->GetTopEntry(); + USHORT nLines = mpImplLB->GetMainWindow()->GetDisplayLineCount(); + USHORT nScrollHeight=(mpImplLB->IsScrollMenu()) ? mpImplLB->GetScrollerHeight(): 0; + + //height of the button + long nButtonHeight; + ImplControlValue aControlValue; + Window *pBorder = GetWindow( WINDOW_BORDER ); + Point aPoint; + Region aContent, aBound; + Region aArea( Rectangle(aPoint, pBorder->GetOutputSizePixel()) ); + + if ( GetNativeControlRegion( CTRL_LISTBOX, PART_BUTTON_DOWN, + aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) + { + nButtonHeight=aContent.GetBoundRect().GetWidth(); + } + else { + // as the button width is initialized with the standard scrollbar width, considering height equal to width + nButtonHeight = GetSettings().GetStyleSettings().GetScrollBarSize(); + } + + if(nCurPos != LISTBOX_ENTRY_NOTFOUND && nLines > 0 ) + aPos.Y() -= (aFloatSz.Height() - 2 * nScrollHeight) * (nCurPos - nTopEntry) / nLines + nScrollHeight + nButtonHeight; + + return aPos; +} + +// ----------------------------------------------------------------------- + +void ImplListBoxFloatingMenu::StartFloat( BOOL bStartTracking ) +{ + if( !IsInPopupMode() ) + { + Size aFloatSz = CalcFloatSize(); SetSizePixel( aFloatSz ); mpImplLB->SetSizePixel( GetOutputSizePixel() ); @@ -3006,7 +3341,9 @@ Size aSz = GetParent()->GetSizePixel(); Point aPos = GetParent()->GetPosPixel(); - aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos ); + aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos ); + aPos = CalcCenteredPos(aPos, aFloatSz); + Rectangle aRect( aPos, aSz ); // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI @@ -3015,7 +3352,7 @@ if( GetParent()->GetParent()->ImplHasMirroredGraphics() && !GetParent()->GetParent()->IsRTLEnabled() ) GetParent()->GetParent()->ImplReMirror( aRect ); - StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); + StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE);//FLOATWIN_POPUPMODE_DOWN ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) mpImplLB->SetTopEntry( nPos ); @@ -3029,3 +3366,21 @@ mpImplLB->GetMainWindow()->ImplClearLayoutData(); } } + +// ----------------------------------------------------------------------- + +void ImplListBoxFloatingMenu::Paint( const Rectangle& ) +{ + if( IsNativeControlSupported( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL ) ) + { + SetClipRegion(); + //mpImplLB->Hide(); + DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, + Region( Rectangle( Point(0, 0), CalcFloatSize() ) ), + CTRL_STATE_ENABLED, + ImplControlValue(), + OUString() ); + ImplInitClipRegion(); + } +} + Index: source/control/lstbox.cxx =================================================================== RCS file: /cvs/gsl/vcl/source/control/lstbox.cxx,v retrieving revision 1.37 diff -u -r1.37 lstbox.cxx --- source/control/lstbox.cxx 17 Sep 2006 11:54:15 -0000 1.37 +++ source/control/lstbox.cxx 2 Jul 2007 14:02:04 -0000 @@ -122,8 +122,9 @@ mpImplLB = NULL; delete mpFloatWin; + delete mpFloatMenu; delete mpImplWin; - delete mpBtn; + //delete mpBtn; } // ----------------------------------------------------------------------- @@ -131,6 +132,7 @@ void ListBox::ImplInitListBoxData() { mpFloatWin = NULL; + mpFloatMenu = NULL; mpImplWin = NULL; mpBtn = NULL; @@ -156,9 +158,16 @@ GetBorder( nLeft, nTop, nRight, nBottom ); mnDDHeight = (USHORT)(GetTextHeight() + nTop + nBottom + 4); - mpFloatWin = new ImplListBoxFloatingWindow( this ); - mpFloatWin->SetAutoWidth( TRUE ); - mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) ); + if( ! ImplGetSVData()->maNWFData.mbListBoxMenu ) { + mpFloatWin = new ImplListBoxFloatingWindow( this ); + mpFloatWin->SetAutoWidth( TRUE ); + mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) ); + } + else { + mpFloatMenu = new ImplListBoxFloatingMenu( this ); + mpFloatMenu->SetAutoWidth( TRUE ); + mpFloatMenu->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) ); + } mpImplWin = new ImplWin( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER ); mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) ); @@ -175,6 +184,8 @@ Window* pLBParent = this; if ( mpFloatWin ) pLBParent = mpFloatWin; + else if ( mpFloatMenu ) + pLBParent = mpFloatMenu; mpImplLB = new ImplListBox( pLBParent, nStyle&(~WB_BORDER) ); mpImplLB->SetSelectHdl( LINK( this, ListBox, ImplSelectHdl ) ); mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) ); @@ -189,6 +200,11 @@ mpFloatWin->SetImplListBox( mpImplLB ); mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) ); } + else if ( mpFloatMenu ) + { + mpFloatMenu->SetImplListBox( mpImplLB ); + mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) ); + } else mpImplLB->GetMainWindow()->AllowGrabFocus( TRUE ); @@ -237,7 +253,10 @@ { if( !mpImplLB->IsTravelSelect() ) { - mpFloatWin->EndPopupMode(); + if(mpFloatWin) + mpFloatWin->EndPopupMode(); + else if (mpFloatMenu) + mpFloatMenu->EndPopupMode(); mpImplWin->GrabFocus(); } @@ -269,8 +288,12 @@ IMPL_LINK( ListBox, ImplCancelHdl, void*, EMPTYARG ) { - if( IsInDropDown() ) - mpFloatWin->EndPopupMode(); + if( IsInDropDown() ) { + if(mpFloatWin) + mpFloatWin->EndPopupMode(); + else if(mpFloatMenu) + mpFloatMenu->EndPopupMode(); + } return 1; } @@ -313,19 +336,36 @@ IMPL_LINK( ListBox, ImplClickBtnHdl, void*, EMPTYARG ) { - if( !mpFloatWin->IsInPopupMode() ) - { - mpImplWin->GrabFocus(); - mpBtn->SetPressed( TRUE ); - mpFloatWin->StartFloat( TRUE ); - ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); - - ImplClearLayoutData(); - if( mpImplLB ) - mpImplLB->GetMainWindow()->ImplClearLayoutData(); - if( mpImplWin ) - mpImplWin->ImplClearLayoutData(); - } + if( mpFloatWin ) { + if( !mpFloatWin->IsInPopupMode() ) + { + mpImplWin->GrabFocus(); + //mpBtn->SetPressed( TRUE ); + mpFloatWin->StartFloat( TRUE ); + ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); + + ImplClearLayoutData(); + if( mpImplLB ) + mpImplLB->GetMainWindow()->ImplClearLayoutData(); + if( mpImplWin ) + mpImplWin->ImplClearLayoutData(); + } + } + else if ( mpFloatMenu ) { + if( !mpFloatMenu->IsInPopupMode() ) + { + mpImplWin->GrabFocus(); + //mpBtn->SetPressed( TRUE ); + mpFloatMenu->StartFloat( TRUE ); + ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); + + ImplClearLayoutData(); + if( mpImplLB ) + mpImplLB->GetMainWindow()->ImplClearLayoutData(); + if( mpImplWin ) + mpImplWin->ImplClearLayoutData(); + } + } return 0; } @@ -334,23 +374,46 @@ IMPL_LINK( ListBox, ImplPopupModeEndHdl, void*, EMPTYARG ) { - if( mpFloatWin->IsPopupModeCanceled() ) - { - if ( ( mpFloatWin->GetPopupModeStartSaveSelection() != LISTBOX_ENTRY_NOTFOUND ) - && !IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) ) + if( mpFloatWin ) { + if( mpFloatWin->IsPopupModeCanceled() ) { - mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), TRUE ); - BOOL bTravelSelect = mpImplLB->IsTravelSelect(); - mpImplLB->SetTravelSelect( TRUE ); - - ImplDelData aCheckDelete; - ImplAddDel( &aCheckDelete ); - Select(); - if ( aCheckDelete.IsDelete() ) - return 0; - ImplRemoveDel( &aCheckDelete ); + if ( ( mpFloatWin->GetPopupModeStartSaveSelection() != LISTBOX_ENTRY_NOTFOUND ) + && !IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) ) + { + mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), TRUE ); + BOOL bTravelSelect = mpImplLB->IsTravelSelect(); + mpImplLB->SetTravelSelect( TRUE ); + + ImplDelData aCheckDelete; + ImplAddDel( &aCheckDelete ); + Select(); + if ( aCheckDelete.IsDelete() ) + return 0; + ImplRemoveDel( &aCheckDelete ); - mpImplLB->SetTravelSelect( bTravelSelect ); + mpImplLB->SetTravelSelect( bTravelSelect ); + } + } + } + else if ( mpFloatMenu ) { + if( mpFloatMenu->IsPopupModeCanceled() ) + { + if ( ( mpFloatMenu->GetPopupModeStartSaveSelection() != LISTBOX_ENTRY_NOTFOUND ) + && !IsEntryPosSelected( mpFloatMenu->GetPopupModeStartSaveSelection() ) ) + { + mpImplLB->SelectEntry( mpFloatMenu->GetPopupModeStartSaveSelection(), TRUE ); + BOOL bTravelSelect = mpImplLB->IsTravelSelect(); + mpImplLB->SetTravelSelect( TRUE ); + + ImplDelData aCheckDelete; + ImplAddDel( &aCheckDelete ); + Select(); + if ( aCheckDelete.IsDelete() ) + return 0; + ImplRemoveDel( &aCheckDelete ); + + mpImplLB->SetTravelSelect( bTravelSelect ); + } } } @@ -360,7 +423,7 @@ if( mpImplWin ) mpImplWin->ImplClearLayoutData(); - mpBtn->SetPressed( FALSE ); + //mpBtn->SetPressed( FALSE ); ImplCallEventListeners( VCLEVENT_DROPDOWN_CLOSE ); return 0; } @@ -371,14 +434,27 @@ { if( IsDropDownBox() ) { - if( mpFloatWin->IsInPopupMode() ) - mpFloatWin->EndPopupMode(); - else - { - mpImplWin->GrabFocus(); - mpBtn->SetPressed( TRUE ); - mpFloatWin->StartFloat( TRUE ); - ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); + if( mpFloatWin ) { + if( mpFloatWin->IsInPopupMode() ) + mpFloatWin->EndPopupMode(); + else + { + mpImplWin->GrabFocus(); + mpBtn->SetPressed( TRUE ); + mpFloatWin->StartFloat( TRUE ); + ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); + } + } + else if( mpFloatMenu ) { + if( mpFloatMenu->IsInPopupMode() ) + mpFloatMenu->EndPopupMode(); + else + { + mpImplWin->GrabFocus(); + mpBtn->SetPressed( TRUE ); + mpFloatMenu->StartFloat( TRUE ); + ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); + } } } } @@ -593,6 +669,13 @@ else if ( !bAuto ) mpFloatWin->SetDropDownLineCount( 0 ); } + else if ( mpFloatMenu ) + { + if ( bAuto && !mpFloatMenu->GetDropDownLineCount() ) + mpFloatMenu->SetDropDownLineCount( 5 ); + else if ( !bAuto ) + mpFloatMenu->SetDropDownLineCount( 0 ); + } } // ----------------------------------------------------------------------- @@ -601,13 +684,18 @@ { if ( mpFloatWin ) mpFloatWin->SetAutoWidth( b ); + else if ( mpFloatMenu ) + mpFloatMenu->SetAutoWidth( b ); } // ----------------------------------------------------------------------- BOOL ListBox::IsDDAutoWidthEnabled() const { - return mpFloatWin ? mpFloatWin->IsAutoWidth() : FALSE; + if(mpFloatWin) + return mpFloatWin->IsAutoWidth(); + else + return mpFloatMenu ? mpFloatMenu->IsAutoWidth() : FALSE; } // ----------------------------------------------------------------------- @@ -616,6 +704,8 @@ { if ( mpFloatWin ) mpFloatWin->SetDropDownLineCount( nLines ); + else if ( mpFloatMenu ) + mpFloatMenu->SetDropDownLineCount( nLines ); } // ----------------------------------------------------------------------- @@ -625,6 +715,8 @@ USHORT nLines = 0; if ( mpFloatWin ) nLines = mpFloatWin->GetDropDownLineCount(); + else if ( mpFloatMenu ) + nLines = mpFloatMenu->GetDropDownLineCount(); return nLines; } @@ -634,12 +726,14 @@ { if( IsDropDownBox() && ( nFlags & WINDOW_POSSIZE_SIZE ) ) { - Size aPrefSz = mpFloatWin->GetPrefSize(); + Size aPrefSz; + aPrefSz = (mpFloatWin) ? mpFloatWin->GetPrefSize() : mpFloatMenu->GetPrefSize(); if ( ( nFlags & WINDOW_POSSIZE_HEIGHT ) && ( nHeight >= 2*mnDDHeight ) ) aPrefSz.Height() = nHeight-mnDDHeight; if ( nFlags & WINDOW_POSSIZE_WIDTH ) aPrefSz.Width() = nWidth; - mpFloatWin->SetPrefSize( aPrefSz ); + if( mpFloatWin ) mpFloatWin->SetPrefSize( aPrefSz ); + else if( mpFloatMenu ) mpFloatMenu->SetPrefSize( aPrefSz ); if ( IsAutoSizeEnabled() && ! (nFlags & WINDOW_POSSIZE_DROPDOWN) ) nHeight = mnDDHeight; @@ -709,6 +803,8 @@ // weil KEY_PGUP/DOWN ausgewertet wird... if ( mpFloatWin ) mpFloatWin->SetSizePixel( mpFloatWin->CalcFloatSize() ); + else if ( mpFloatMenu ) + mpFloatMenu->SetSizePixel( mpFloatMenu->CalcFloatSize() ); Control::Resize(); } @@ -730,6 +826,16 @@ pMainWin->SetLayoutDataParent( this ); } } + else if ( mpFloatMenu ) { + // dropdown mode + AppendLayoutData( *mpImplWin ); + mpImplWin->SetLayoutDataParent( this ); + if( mpFloatMenu->IsReallyVisible() ) + { + AppendLayoutData( *pMainWin ); + pMainWin->SetLayoutDataParent( this ); + } + } else { AppendLayoutData( *pMainWin ); @@ -895,6 +1001,9 @@ long ListBox::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0; + //FloatingWindow * pFloatWindow; + //pFloatWindow = ( mpFloatWin ) ? mpFloatWin : mpFloatMenu; + if ( mpImplLB ) { if( ( rNEvt.GetType() == EVENT_KEYINPUT ) && ( rNEvt.GetWindow() == mpImplWin ) ) @@ -912,6 +1021,14 @@ ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); nDone = 1; } + else if( mpFloatMenu && !mpFloatMenu->IsInPopupMode() && + aKeyEvt.GetKeyCode().IsMod2() ) + { + mpBtn->SetPressed( TRUE ); + mpFloatMenu->StartFloat( FALSE ); + ImplCallEventListeners( VCLEVENT_DROPDOWN_OPEN ); + nDone = 1; + } else { nDone = mpImplLB->ProcessKeyInput( aKeyEvt ); @@ -926,6 +1043,12 @@ mpFloatWin->EndPopupMode(); nDone = 1; } + else if( mpFloatMenu && mpFloatMenu->IsInPopupMode() && + aKeyEvt.GetKeyCode().IsMod2() ) + { + mpFloatMenu->EndPopupMode(); + nDone = 1; + } else { nDone = mpImplLB->ProcessKeyInput( aKeyEvt ); @@ -946,14 +1069,18 @@ { if( mpFloatWin ) mpImplLB->GetMainWindow()->CalcMaxVisibleEntries( mpFloatWin->CalcFloatSize() ); + else if( mpFloatMenu ) + mpImplLB->GetMainWindow()->CalcMaxVisibleEntries( mpFloatMenu->CalcFloatSize() ); nDone = mpImplLB->ProcessKeyInput( aKeyEvt ); } } } else if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) { - if ( IsInDropDown() && !HasChildPathFocus( TRUE ) ) - mpFloatWin->EndPopupMode(); + if ( IsInDropDown() && !HasChildPathFocus( TRUE ) ) { + if( mpFloatWin ) mpFloatWin->EndPopupMode(); + else if ( mpFloatMenu ) mpFloatMenu->EndPopupMode(); + } } else if ( (rNEvt.GetType() == EVENT_COMMAND) && (rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) && @@ -1206,7 +1333,7 @@ BOOL ListBox::IsInDropDown() const { - return mpFloatWin && mpFloatWin->IsInPopupMode(); + return ( mpFloatWin && mpFloatWin->IsInPopupMode() ) || ( mpFloatMenu && mpFloatMenu->IsInPopupMode() ); } // ----------------------------------------------------------------------- @@ -1243,7 +1370,7 @@ mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode ); // ohne Focus ist das Traveln in einer MultiSelection nicht zu sehen: - if ( mpFloatWin ) + if ( mpFloatWin || mpFloatMenu ) mpImplLB->GetMainWindow()->AllowGrabFocus( bMulti ); } @@ -1504,7 +1631,9 @@ Rectangle ListBox::GetDropDownPosSizePixel() const { - return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative( const_cast(this) ) : Rectangle(); + if( mpFloatWin ) return mpFloatWin->GetWindowExtentsRelative( const_cast(this) ); + else if (mpFloatMenu) return mpFloatMenu->GetWindowExtentsRelative( const_cast(this) ); + else return Rectangle(); } // ----------------------------------------------------------------------- Index: source/window/menu.cxx =================================================================== RCS file: /cvs/gsl/vcl/source/window/menu.cxx,v retrieving revision 1.148.4.3 diff -u -r1.148.4.3 menu.cxx --- source/window/menu.cxx 25 Jun 2007 11:08:09 -0000 1.148.4.3 +++ source/window/menu.cxx 2 Jul 2007 14:02:06 -0000 @@ -499,97 +499,6 @@ } - -// ---------------------- -// - MenuFloatingWindow - -// ---------------------- - -class MenuFloatingWindow : public FloatingWindow -{ - friend void Menu::ImplFillLayoutData() const; - friend Menu::~Menu(); - -private: - Menu* pMenu; - PopupMenu* pActivePopup; - Timer aHighlightChangedTimer; - Timer aSubmenuCloseTimer; - Timer aScrollTimer; - ULONG nSaveFocusId; -// long nStartY; - USHORT nHighlightedItem; // gehighlightetes/selektiertes Item - USHORT nMBDownPos; - USHORT nScrollerHeight; - USHORT nFirstEntry; - USHORT nBorder; - USHORT nPosInParent; - BOOL bInExecute; - - BOOL bScrollMenu; - BOOL bScrollUp; - BOOL bScrollDown; - BOOL bIgnoreFirstMove; - BOOL bKeyInput; - - DECL_LINK( PopupEnd, FloatingWindow* ); - DECL_LINK( HighlightChanged, Timer* ); - DECL_LINK( SubmenuClose, Timer* ); - DECL_LINK( AutoScroll, Timer* ); - - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); -protected: - Region ImplCalcClipRegion( BOOL bIncludeLogo = TRUE ) const; - void ImplInitClipRegion(); - void ImplDrawScroller( BOOL bUp ); - using Window::ImplScroll; - void ImplScroll( const Point& rMousePos ); - void ImplScroll( BOOL bUp ); - void ImplCursorUpDown( BOOL bUp, BOOL bHomeEnd = FALSE ); - void ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDown ); - long ImplGetStartY() const; - Rectangle ImplGetItemRect( USHORT nPos ); - -public: - MenuFloatingWindow( Menu* pMenu, Window* pParent, WinBits nStyle ); - ~MenuFloatingWindow(); - - void doShutdown(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void Resize(); - - void SetFocusId( ULONG nId ) { nSaveFocusId = nId; } - ULONG GetFocusId() const { return nSaveFocusId; } - - void EnableScrollMenu( BOOL b ); - BOOL IsScrollMenu() const { return bScrollMenu; } - USHORT GetScrollerHeight() const { return nScrollerHeight; } - - void Execute(); - void StopExecute( ULONG nFocusId = 0 ); - void EndExecute(); - void EndExecute( USHORT nSelectId ); - - PopupMenu* GetActivePopup() const { return pActivePopup; } - void KillActivePopup( PopupMenu* pThisOnly = NULL ); - - void HighlightItem( USHORT nPos, BOOL bHighlight ); - void ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer ); - USHORT GetHighlightedItem() const { return nHighlightedItem; } - - void SetPosInParent( USHORT nPos ) { nPosInParent = nPos; } - USHORT GetPosInParent() const { return nPosInParent; } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); -}; - // To get the transparent mouse-over look, the closer is actually a toolbox // overload DataChange to handle style changes correctly class DecoToolBox : public ToolBox