summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-12-21 04:42:34 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2016-12-21 11:42:32 +0200
commitc95293de347597bb32d3c4aa5429b21385cae97a (patch)
tree9b68cfd4b31b6f638b1e55fb427818ca869759bf
parent90395eb694c0a9dd9033863d1def9678d4328943 (diff)
Fix the table border toolbar popup
Using ImplPopupFloatWin for it isn't a good idea: It doesn't need its dragging code, nor its painting code (which draws the ugly black border), and the resizing code conflicts with the title-based border which results in a wrong size (and we might have even bigger problems, if we start to use .ui based layouts for the ToolbarPopup class). We can of course put checks all over the place, but why do it, if we can simply use plain FloatingWindow? Change-Id: Ibc9a5c220309d15a60f6425835e1cc7a1b19c530
-rw-r--r--vcl/source/window/dockmgr.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index fa6e3b83cbad..ac587a6ec2ec 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -435,8 +435,7 @@ private:
void ImplSetBorder();
public:
- ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin,
- bool bHasGrip, bool bUsePopupWin );
+ ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip );
virtual ~ImplPopupFloatWin() override;
virtual void dispose() override;
@@ -456,16 +455,15 @@ public:
bool hasGrip() const { return mbHasGrip; }
};
-ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin,
- bool bHasGrip, bool bUsePopupWin ) :
- FloatingWindow( pParent, bUsePopupWin ? WB_STDPOPUP : WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW)
+ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) :
+ FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW )
{
mpWindowImpl->mbToolbarFloatingWindow = true; // indicate window type, required for accessibility
// which should not see this window as a toplevel window
mpDockingWin = pDockingWin;
mbMoving = false;
mbTrackingEnabled = false;
- mbHasGrip = !bUsePopupWin && bHasGrip;
+ mbHasGrip = bHasGrip;
ImplSetBorder();
}
@@ -973,8 +971,11 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
bool bIsToolBox = GetWindow()->GetType() == WINDOW_TOOLBOX;
// the new parent for popup mode
- VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, bAllowTearOff,
- bAllowTearOff && !bIsToolBox );
+ VclPtr<FloatingWindow> pWin;
+ if ( bAllowTearOff && !bIsToolBox )
+ pWin = VclPtr<FloatingWindow>::Create( mpParent, WB_STDPOPUP );
+ else
+ pWin = VclPtr<ImplPopupFloatWin>::Create( mpParent, this, bAllowTearOff );
pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
pWin->SetText( GetWindow()->GetText() );
@@ -987,7 +988,8 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
GetWindow()->mpWindowImpl->mnBottomBorder = 0;
// position toolbox below the drag grip
- GetWindow()->SetPosPixel( pWin->GetToolboxPosition() );
+ if ( bIsToolBox )
+ GetWindow()->SetPosPixel( static_cast<ImplPopupFloatWin*>( pWin.get() )->GetToolboxPosition() );
// reparent borderwindow and window
if ( mpOldBorderWin )