summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-15 20:50:30 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-16 21:57:16 +0900
commit458a827e96523ac52d021f1fd3653b5a734940c0 (patch)
treebac00c1dd627a6c07393c94300943e0bfd5d9028
parenta6c85d74ea03b35f03217daad9869f4458aa0c0f (diff)
further refactor Menu to use RenderContext
Change-Id: Ied420c8b3349ff1a2e2951c14359cbe1a23e5141
-rw-r--r--vcl/source/window/menu.cxx2
-rw-r--r--vcl/source/window/menubarwindow.cxx90
-rw-r--r--vcl/source/window/menubarwindow.hxx4
-rw-r--r--vcl/source/window/menufloatingwindow.cxx149
-rw-r--r--vcl/source/window/menufloatingwindow.hxx129
5 files changed, 183 insertions, 191 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index d43c3cf04fb8..1fc1a38f0fa7 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1820,7 +1820,7 @@ void Menu::ImplPaint(vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuIt
{
// for symbols: nFontHeight x nFontHeight
long nFontHeight = pWin->GetTextHeight();
- long nExtra = nFontHeight/4;
+ long nExtra = nFontHeight / 4;
long nCheckHeight = 0, nRadioHeight = 0;
ImplGetNativeCheckAndRadioSize( pWin, nCheckHeight, nRadioHeight );
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 970154798881..756c6afad06e 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -408,7 +408,7 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt )
if ( rMEvt.IsLeaveWindow() )
{
if ( nRolloveredItem != ITEMPOS_INVALID && nRolloveredItem != nHighlightedItem )
- HighlightItem( nRolloveredItem, false );
+ Invalidate(); //HighlightItem( nRolloveredItem, false );
nRolloveredItem = ITEMPOS_INVALID;
return;
@@ -420,10 +420,10 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt )
if ( nRolloveredItem != nEntry )
{
if ( nRolloveredItem != ITEMPOS_INVALID )
- HighlightItem( nRolloveredItem, false );
+ Invalidate(); //HighlightItem( nRolloveredItem, false );
nRolloveredItem = nEntry;
- HighlightItem( nRolloveredItem, true );
+ Invalidate(); //HighlightItem( nRolloveredItem, true );
}
return;
}
@@ -507,7 +507,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b
if ( nHighlightedItem != ITEMPOS_INVALID )
{
if ( nHighlightedItem != nRolloveredItem )
- HighlightItem( nHighlightedItem, false );
+ Invalidate(); //HighlightItem( nHighlightedItem, false );
pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
}
@@ -515,9 +515,9 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b
nHighlightedItem = (sal_uInt16)n;
DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
if ( nHighlightedItem != ITEMPOS_INVALID )
- HighlightItem( nHighlightedItem, true );
+ Invalidate(); //HighlightItem( nHighlightedItem, true );
else if ( nRolloveredItem != ITEMPOS_INVALID )
- HighlightItem( nRolloveredItem, true );
+ Invalidate(); //HighlightItem( nRolloveredItem, true );
pMenu->ImplCallHighlight(nHighlightedItem);
if( mbAutoPopup )
@@ -581,97 +581,91 @@ static void ImplAddNWFSeparator( vcl::RenderContext& rRenderContext, const Menub
}
}
-void MenuBarWindow::HighlightItem(sal_uInt16 nPos, bool bHighlight)
+void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight)
{
- if( ! pMenu )
+ if (!pMenu)
return;
long nX = 0;
size_t nCount = pMenu->pItemList->size();
- for ( size_t n = 0; n < nCount; n++ )
+ for (size_t n = 0; n < nCount; n++)
{
MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
- if ( n == nPos )
+ if (n == nPos)
{
- if ( pData->eType != MenuItemType::SEPARATOR )
+ if (pData->eType != MenuItemType::SEPARATOR)
{
// #107747# give menuitems the height of the menubar
- Rectangle aRect = Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), GetOutputSizePixel().Height()-2 ) );
- Push( PushFlags::CLIPREGION );
- IntersectClipRegion( aRect );
+ Rectangle aRect = Rectangle(Point(nX, 1), Size(pData->aSz.Width(), GetOutputSizePixel().Height() - 2));
+ rRenderContext.Push(PushFlags::CLIPREGION);
+ rRenderContext.IntersectClipRegion(aRect);
bool bRollover = bHighlight && nPos != nHighlightedItem;
- if ( bHighlight )
+ if (bHighlight)
{
- if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) &&
- IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENUBAR, PART_MENU_ITEM) &&
+ rRenderContext.IsNativeControlSupported(CTRL_MENUBAR, PART_ENTIRE_CONTROL))
{
// draw background (transparency)
MenubarValue aControlValue;
aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this );
- if ( !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
- Erase();
+ if (!Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
+ rRenderContext.Erase();
else
{
- Point tmp(0,0);
- Rectangle aBgRegion( tmp, GetOutputSizePixel() );
- DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL,
- aBgRegion,
- ControlState::ENABLED,
- aControlValue,
- OUString() );
+ Rectangle aBgRegion(Point(), rRenderContext.GetOutputSizePixel());
+ rRenderContext.DrawNativeControl(CTRL_MENUBAR, PART_ENTIRE_CONTROL, aBgRegion,
+ ControlState::ENABLED, aControlValue, OUString());
}
- ImplAddNWFSeparator(*this, aControlValue); // FIXME
+ ImplAddNWFSeparator(rRenderContext, aControlValue);
// draw selected item
ControlState nState = ControlState::ENABLED;
- if ( bRollover )
+ if (bRollover)
nState |= ControlState::ROLLOVER;
else
nState |= ControlState::SELECTED;
- DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM,
- aRect,
- nState,
- aControlValue,
- OUString() );
+ rRenderContext.DrawNativeControl(CTRL_MENUBAR, PART_MENU_ITEM,
+ aRect, nState, aControlValue, OUString() );
}
else
{
- if ( bRollover )
- SetFillColor( GetSettings().GetStyleSettings().GetMenuBarRolloverColor() );
+ if (bRollover)
+ rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuBarRolloverColor());
else
- SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
- SetLineColor();
- DrawRect( aRect );
+ rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
+ rRenderContext.SetLineColor();
+ rRenderContext.DrawRect(aRect);
}
}
else
{
- if( IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENUBAR, PART_ENTIRE_CONTROL))
{
MenubarValue aMenubarValue;
aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this );
- if ( !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
- Erase( aRect );
+ if (!Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty())
+ rRenderContext.Erase(aRect);
else
{
// use full window size to get proper gradient
// but clip accordingly
Point aPt;
- Rectangle aCtrlRect( aPt, GetOutputSizePixel() );
+ Rectangle aCtrlRect(aPt, rRenderContext.GetOutputSizePixel());
- DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRect, ControlState::ENABLED, aMenubarValue, OUString() );
+ rRenderContext.DrawNativeControl(CTRL_MENUBAR, PART_ENTIRE_CONTROL,
+ aCtrlRect, ControlState::ENABLED, aMenubarValue, OUString());
}
- ImplAddNWFSeparator(*this, aMenubarValue); // FIXME
+ ImplAddNWFSeparator(rRenderContext, aMenubarValue);
}
else
- Erase( aRect );
+ rRenderContext.Erase(aRect);
}
- Pop();
- pMenu->ImplPaint( this, 0, 0, pData, bHighlight, false, bRollover );
+ rRenderContext.Pop();
+ pMenu->ImplPaint(this, 0, 0, pData, bHighlight, false, bRollover);
}
return;
}
@@ -908,7 +902,7 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
pMenu->ImplPaint(this, 0);
if (nHighlightedItem != ITEMPOS_INVALID)
- HighlightItem(nHighlightedItem, true );
+ HighlightItem(rRenderContext, nHighlightedItem, true);
// in high contrast mode draw a separating line on the lower edge
if (!rRenderContext.IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) &&
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index 2c664befe122..ee1036ebd77f 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -87,7 +87,7 @@ private:
std::map< sal_uInt16, AddButtonEntry > m_aAddButtons;
- void HighlightItem( sal_uInt16 nPos, bool bHighlight );
+ void HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight);
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true) SAL_OVERRIDE;
sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
@@ -131,7 +131,7 @@ public:
virtual void KillActivePopup() SAL_OVERRIDE;
virtual void PopupClosed(Menu* pMenu) SAL_OVERRIDE;
virtual sal_uInt16 GetHighlightedItem() const SAL_OVERRIDE { return nHighlightedItem; }
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
virtual void SetAutoPopup(bool bAuto) SAL_OVERRIDE { mbAutoPopup = bAuto; }
virtual void LayoutChanged() SAL_OVERRIDE;
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 32acf47fb628..a3773b673320 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -80,8 +80,8 @@ void MenuFloatingWindow::doShutdown()
if( i < nCount )
{
MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
- if( pPWin )
- pPWin->HighlightItem( i, false );
+ if (pPWin)
+ pPWin->Invalidate(); //pPWin->HighlightItem( i, false );
}
}
@@ -116,7 +116,7 @@ void MenuFloatingWindow::dispose()
void MenuFloatingWindow::Resize()
{
- InitMenuClipRegion();
+ InitMenuClipRegion(*this); // FIXME
}
long MenuFloatingWindow::ImplGetStartY() const
@@ -149,15 +149,15 @@ vcl::Region MenuFloatingWindow::ImplCalcClipRegion( bool bIncludeLogo ) const
return aRegion;
}
-void MenuFloatingWindow::InitMenuClipRegion()
+void MenuFloatingWindow::InitMenuClipRegion(vcl::RenderContext& rRenderContext)
{
- if ( IsScrollMenu() )
+ if (IsScrollMenu())
{
- SetClipRegion( ImplCalcClipRegion() );
+ rRenderContext.SetClipRegion(ImplCalcClipRegion());
}
else
{
- SetClipRegion();
+ rRenderContext.SetClipRegion();
}
}
@@ -361,7 +361,7 @@ void MenuFloatingWindow::EnableScrollMenu( bool b )
bScrollMenu = b;
nScrollerHeight = b ? (sal_uInt16) GetSettings().GetStyleSettings().GetScrollBarSize() /2 : 0;
bScrollDown = true;
- InitMenuClipRegion();
+ InitMenuClipRegion(*this);
}
void MenuFloatingWindow::Execute()
@@ -556,10 +556,10 @@ void MenuFloatingWindow::ImplScroll( bool bUp )
KillActivePopup();
Update();
- if( ! pMenu )
+ if (!pMenu)
return;
- HighlightItem( nHighlightedItem, false );
+ Invalidate();
pMenu->ImplKillLayoutData();
@@ -573,13 +573,13 @@ void MenuFloatingWindow::ImplScroll( bool bUp )
if ( !bScrollDown )
{
bScrollDown = true;
- ImplDrawScroller( false );
+ Invalidate();
}
if ( pMenu->ImplGetPrevVisible( nFirstEntry ) == ITEMPOS_INVALID )
{
bScrollUp = false;
- ImplDrawScroller( true );
+ Invalidate();
}
Scroll( 0, nScrollEntryHeight, ImplCalcClipRegion( false ).GetBoundRect(), SCROLL_CLIP );
@@ -594,7 +594,7 @@ void MenuFloatingWindow::ImplScroll( bool bUp )
if ( !bScrollUp )
{
bScrollUp = true;
- ImplDrawScroller( true );
+ Invalidate();
}
long nHeight = GetOutputSizePixel().Height();
@@ -603,13 +603,13 @@ void MenuFloatingWindow::ImplScroll( bool bUp )
if ( pMenu->ImplGetNextVisible( nLastVisible ) == ITEMPOS_INVALID )
{
bScrollDown = false;
- ImplDrawScroller( false );
+ Invalidate();
}
Scroll( 0, -nScrollEntryHeight, ImplCalcClipRegion( false ).GetBoundRect(), SCROLL_CLIP );
}
- HighlightItem( nHighlightedItem, true );
+ Invalidate();
}
void MenuFloatingWindow::ImplScroll( const Point& rMousePos )
@@ -664,7 +664,7 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
if ( nHighlightedItem != ITEMPOS_INVALID )
{
- HighlightItem( nHighlightedItem, false );
+ Invalidate(); //HighlightItem( nHighlightedItem, false );
pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
}
@@ -687,12 +687,12 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
if( pPWin && pPWin->nHighlightedItem != i )
{
- pPWin->HighlightItem( i, true );
+ pPWin->Invalidate(); //HighlightItem( i, true );
pPWin->nHighlightedItem = i;
}
}
}
- HighlightItem( nHighlightedItem, true );
+ Invalidate(); //HighlightItem( nHighlightedItem, true );
pMenu->ImplCallHighlight( nHighlightedItem );
}
else
@@ -711,92 +711,89 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
}
}
-void MenuFloatingWindow::HighlightItem( sal_uInt16 nPos, bool bHighlight )
+void MenuFloatingWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight)
{
- if( ! pMenu )
+ if (!pMenu)
return;
- Size aSz = GetOutputSizePixel();
- long nStartY = ImplGetStartY();
- long nY = nScrollerHeight + nStartY + ImplGetSVData()->maNWFData.mnMenuFormatBorderY;
- long nX = 0;
+ Size aSz = rRenderContext.GetOutputSizePixel();
+ long nStartY = ImplGetStartY();
+ long nY = nScrollerHeight + nStartY + ImplGetSVData()->maNWFData.mnMenuFormatBorderY;
+ long nX = 0;
- if ( pMenu->pLogo )
+ if (pMenu->pLogo)
nX = pMenu->pLogo->aBitmap.GetSizePixel().Width();
int nOuterSpaceX = ImplGetSVData()->maNWFData.mnMenuFormatBorderX;
size_t nCount = pMenu->pItemList->size();
- for ( size_t n = 0; n < nCount; n++ )
+ for (size_t n = 0; n < nCount; n++)
{
MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
- if ( n == nPos )
+ if (n == nPos)
{
- DBG_ASSERT( pMenu->ImplIsVisible( n ), "Highlight: Item not visible!" );
- if ( pData->eType != MenuItemType::SEPARATOR )
+ DBG_ASSERT(pMenu->ImplIsVisible(n), "Highlight: Item not visible!");
+ if (pData->eType != MenuItemType::SEPARATOR)
{
bool bRestoreLineColor = false;
Color oldLineColor;
bool bDrawItemRect = true;
- Rectangle aItemRect( Point( nX+nOuterSpaceX, nY ), Size( aSz.Width()-2*nOuterSpaceX, pData->aSz.Height() ) );
- if ( pData->nBits & MenuItemBits::POPUPSELECT )
+ Rectangle aItemRect(Point(nX + nOuterSpaceX, nY), Size(aSz.Width() - 2 * nOuterSpaceX, pData->aSz.Height()));
+ if (pData->nBits & MenuItemBits::POPUPSELECT)
{
long nFontHeight = GetTextHeight();
- aItemRect.Right() -= nFontHeight + nFontHeight/4;
+ aItemRect.Right() -= nFontHeight + nFontHeight / 4;
}
- if( IsNativeControlSupported( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL ) )
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
- Size aPxSize( GetOutputSizePixel() );
- Push( PushFlags::CLIPREGION );
- IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pData->aSz.Height() ) ) );
- Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) );
- MenupopupValue aVal( pMenu->nTextPos-GUTTERBORDER, aItemRect );
- DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL,
- aCtrlRect,
- ControlState::ENABLED,
- aVal,
- OUString() );
- if( bHighlight &&
- IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) )
+ Size aPxSize(rRenderContext.GetOutputSizePixel());
+ rRenderContext.Push(PushFlags::CLIPREGION);
+ rRenderContext.IntersectClipRegion(Rectangle(Point(nX, nY), Size(aSz.Width(), pData->aSz.Height())));
+ Rectangle aCtrlRect(Point(nX, 0), Size(aPxSize.Width()-nX, aPxSize.Height()));
+ MenupopupValue aVal(pMenu->nTextPos-GUTTERBORDER, aItemRect);
+ rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL,
+ aCtrlRect, ControlState::ENABLED, aVal, OUString());
+ if (bHighlight &&
+ rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_ITEM))
{
bDrawItemRect = false;
- if( !DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM,
- aItemRect,
- ControlState::SELECTED | ( pData->bEnabled? ControlState::ENABLED: ControlState::NONE ),
- aVal,
- OUString() ) )
+ if (!rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_MENU_ITEM, aItemRect,
+ ControlState::SELECTED | (pData->bEnabled
+ ? ControlState::ENABLED
+ : ControlState::NONE),
+ aVal, OUString()))
{
bDrawItemRect = bHighlight;
}
}
else
bDrawItemRect = bHighlight;
- Pop();
+ rRenderContext.Pop();
}
- if( bDrawItemRect )
+ if (bDrawItemRect)
{
- if ( bHighlight )
+ if (bHighlight)
{
- if( pData->bEnabled )
- SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ if (pData->bEnabled)
+ rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
else
{
- SetFillColor();
- oldLineColor = GetLineColor();
- SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ rRenderContext.SetFillColor();
+ oldLineColor = rRenderContext.GetLineColor();
+ rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
bRestoreLineColor = true;
}
}
else
- SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+ rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuColor());
- DrawRect( aItemRect );
+ rRenderContext.DrawRect(aItemRect);
}
- pMenu->ImplPaint( this, nScrollerHeight, nStartY, pData, bHighlight );
- if( bRestoreLineColor )
- SetLineColor( oldLineColor );
+ pMenu->ImplPaint(this, nScrollerHeight, nStartY, pData, bHighlight);
+ if (bRestoreLineColor)
+ rRenderContext.SetLineColor(oldLineColor);
}
return;
}
@@ -1098,41 +1095,41 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang
rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL,
Rectangle(Point(nX, 0), aPxSize),
ControlState::ENABLED, aVal, OUString());
- InitMenuClipRegion();
+ InitMenuClipRegion(rRenderContext);
}
if (IsScrollMenu())
{
- ImplDrawScroller( true );
- ImplDrawScroller( false );
+ ImplDrawScroller(rRenderContext, true);
+ ImplDrawScroller(rRenderContext, false);
}
rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuColor());
pMenu->ImplPaint(this, nScrollerHeight, ImplGetStartY());
if (nHighlightedItem != ITEMPOS_INVALID)
- HighlightItem(nHighlightedItem, true);
+ HighlightItem(rRenderContext, nHighlightedItem, true);
}
-void MenuFloatingWindow::ImplDrawScroller( bool bUp )
+void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp)
{
if( ! pMenu )
return;
- SetClipRegion();
+ rRenderContext.SetClipRegion();
- Size aOutSz = GetOutputSizePixel();
- long nY = bUp ? 0 : ( aOutSz.Height() - nScrollerHeight );
+ Size aOutSz = rRenderContext.GetOutputSizePixel();
+ long nY = bUp ? 0 : (aOutSz.Height() - nScrollerHeight);
long nX = pMenu->pLogo ? pMenu->pLogo->aBitmap.GetSizePixel().Width() : 0;
- Rectangle aRect( Point( nX, nY ), Size( aOutSz.Width()-nX, nScrollerHeight ) );
+ Rectangle aRect(Point(nX, nY), Size(aOutSz.Width() - nX, nScrollerHeight));
- DecorationView aDecoView( this );
+ DecorationView aDecoView(&rRenderContext);
SymbolType eSymbol = bUp ? SymbolType::SPIN_UP : SymbolType::SPIN_DOWN;
DrawSymbolFlags nStyle = DrawSymbolFlags::NONE;
- if ( ( bUp && !bScrollUp ) || ( !bUp && !bScrollDown ) )
+ if ((bUp && !bScrollUp) || (!bUp && !bScrollDown))
nStyle |= DrawSymbolFlags::Disable;
- aDecoView.DrawSymbol( aRect, eSymbol, GetSettings().GetStyleSettings().GetButtonTextColor(), nStyle );
+ aDecoView.DrawSymbol(aRect, eSymbol, rRenderContext.GetSettings().GetStyleSettings().GetButtonTextColor(), nStyle);
- InitMenuClipRegion();
+ InitMenuClipRegion(rRenderContext);
}
void MenuFloatingWindow::RequestHelp( const HelpEvent& rHEvt )
diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx
index 030fde0ba427..721ba72012e6 100644
--- a/vcl/source/window/menufloatingwindow.hxx
+++ b/vcl/source/window/menufloatingwindow.hxx
@@ -36,86 +36,87 @@ class MenuFloatingWindow : public FloatingWindow, public MenuWindow
friend Menu::~Menu();
private:
- Menu* pMenu;
- PopupMenu* pActivePopup;
- Timer aHighlightChangedTimer;
- Timer aSubmenuCloseTimer;
- Timer aScrollTimer;
- sal_uLong nSaveFocusId;
- sal_uInt16 nHighlightedItem; // highlighted/selected Item
- sal_uInt16 nMBDownPos;
- sal_uInt16 nScrollerHeight;
- sal_uInt16 nFirstEntry;
- sal_uInt16 nBorder;
- sal_uInt16 nPosInParent;
- bool bInExecute;
-
- bool bScrollMenu;
- bool bScrollUp;
- bool bScrollDown;
- bool bIgnoreFirstMove;
- bool bKeyInput;
-
- DECL_LINK(PopupEnd, void *);
- DECL_LINK_TYPED( HighlightChanged, Timer*, void );
- DECL_LINK_TYPED(SubmenuClose, Timer *, void);
- DECL_LINK_TYPED(AutoScroll, Timer *, void);
- DECL_LINK( ShowHideListener, VclWindowEvent* );
-
- virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
-
- void InitMenuClipRegion();
+ Menu* pMenu;
+ PopupMenu* pActivePopup;
+ Timer aHighlightChangedTimer;
+ Timer aSubmenuCloseTimer;
+ Timer aScrollTimer;
+ sal_uLong nSaveFocusId;
+ sal_uInt16 nHighlightedItem; // highlighted/selected Item
+ sal_uInt16 nMBDownPos;
+ sal_uInt16 nScrollerHeight;
+ sal_uInt16 nFirstEntry;
+ sal_uInt16 nBorder;
+ sal_uInt16 nPosInParent;
+
+ bool bInExecute : 1;
+
+ bool bScrollMenu : 1;
+ bool bScrollUp : 1;
+ bool bScrollDown : 1;
+ bool bIgnoreFirstMove : 1;
+ bool bKeyInput : 1;
+
+ DECL_LINK(PopupEnd, void *);
+ DECL_LINK_TYPED( HighlightChanged, Timer*, void );
+ DECL_LINK_TYPED(SubmenuClose, Timer *, void);
+ DECL_LINK_TYPED(AutoScroll, Timer *, void);
+ DECL_LINK( ShowHideListener, VclWindowEvent* );
+
+ virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
+
+ void InitMenuClipRegion(vcl::RenderContext& rRenderContext);
protected:
- vcl::Region ImplCalcClipRegion( bool bIncludeLogo = true ) const;
- void ImplDrawScroller( bool bUp );
+ vcl::Region ImplCalcClipRegion( bool bIncludeLogo = true ) const;
+ void ImplDrawScroller(vcl::RenderContext& rRenderContext, 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( sal_uInt16 nPos );
+ 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( sal_uInt16 nPos );
public:
MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle );
virtual ~MenuFloatingWindow();
- virtual void dispose() SAL_OVERRIDE;
- void doShutdown();
+ virtual void dispose() SAL_OVERRIDE;
+ void doShutdown();
- virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
- virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
- virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) SAL_OVERRIDE;
- virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
- virtual void Resize() SAL_OVERRIDE;
+ virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual void KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
+ virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
+ virtual void Resize() SAL_OVERRIDE;
- void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; }
- sal_uLong GetFocusId() const { return nSaveFocusId; }
+ void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; }
+ sal_uLong GetFocusId() const { return nSaveFocusId; }
- void EnableScrollMenu( bool b );
- bool IsScrollMenu() const { return bScrollMenu; }
- sal_uInt16 GetScrollerHeight() const { return nScrollerHeight; }
+ void EnableScrollMenu( bool b );
+ bool IsScrollMenu() const { return bScrollMenu; }
+ sal_uInt16 GetScrollerHeight() const { return nScrollerHeight; }
- void Execute();
- void StopExecute( sal_uLong nFocusId = 0 );
- void EndExecute();
- void EndExecute( sal_uInt16 nSelectId );
+ void Execute();
+ void StopExecute( sal_uLong nFocusId = 0 );
+ void EndExecute();
+ void EndExecute( sal_uInt16 nSelectId );
- PopupMenu* GetActivePopup() const { return pActivePopup; }
- void KillActivePopup( PopupMenu* pThisOnly = NULL );
+ PopupMenu* GetActivePopup() const { return pActivePopup; }
+ void KillActivePopup( PopupMenu* pThisOnly = NULL );
- void HighlightItem( sal_uInt16 nPos, bool bHighlight );
- void ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTimer );
- sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; }
+ void HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHighlight);
+ void ChangeHighlightItem(sal_uInt16 n, bool bStartPopupTimer);
+ sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; }
- void SetPosInParent( sal_uInt16 nPos ) { nPosInParent = nPos; }
+ void SetPosInParent( sal_uInt16 nPos ) { nPosInParent = nPos; }
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
};
#endif // INCLUDED_VCL_SOURCE_WINDOW_MENUFLOATINGWINDOW_HXX