summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-10-08 21:59:02 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-10-09 00:31:30 +0300
commit9ffd74a37670f7c102595a460fb2c425eb58da62 (patch)
tree21d688819ef573860184db93c346e19f795df3cb /vcl
parenta1297fc2df243d765ffb14f18bbdde158459b9f4 (diff)
Revert "Add title-based tearoff to DockingManager"
Careful reading of the code reveals that WB_POPUP is what adds the tearoff title, not WB_OWNERDRAWDECORATION, so we can use that instead of introducing yet another title implementation into ImplPopupFloatWin. This reverts commit 6128a8311d37514c49c2fe3ba80f850a51de37d6. Change-Id: I681686c9a0bd79d80f43ce213caeef77dcbab6b8
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/dockmgr.cxx81
1 files changed, 24 insertions, 57 deletions
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 9caf5cc7082b..984e5af8332e 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -454,13 +454,6 @@ Rectangle DockingManager::GetPosSizePixel( const vcl::Window *pWindow )
#define POPUP_DRAGHEIGHT (POPUP_DRAGGRIP+POPUP_DRAGBORDER+POPUP_DRAGBORDER)
#define POPUP_DRAGWIDTH 20
-enum class TearOffStyle
-{
- Grip,
- Title,
- None
-};
-
class ImplPopupFloatWin : public FloatingWindow
{
private:
@@ -470,11 +463,12 @@ private:
bool mbTrackingEnabled;
Point maDelta;
Point maTearOffPosition;
- TearOffStyle meTearOffStyle;
+ bool mbGripAtBottom;
+ bool mbHasGrip;
void ImplSetBorder();
public:
- ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, TearOffStyle eStyle );
+ ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip );
virtual ~ImplPopupFloatWin() override;
virtual void dispose() override;
@@ -490,11 +484,12 @@ public:
Point GetToolboxPosition() const;
Point GetTearOffPosition() const;
void DrawGrip(vcl::RenderContext& rRenderContext);
- void DrawTitle(vcl::RenderContext& rRenderContext);
void DrawBorder(vcl::RenderContext& rRenderContext);
+
+ bool hasGrip() const { return mbHasGrip; }
};
-ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, TearOffStyle eStyle ) :
+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
@@ -503,7 +498,8 @@ ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWra
mbHighlight = false;
mbMoving = false;
mbTrackingEnabled = false;
- meTearOffStyle = eStyle;
+ mbGripAtBottom = true;
+ mbHasGrip = bHasGrip;
ImplSetBorder();
}
@@ -537,10 +533,8 @@ void ImplPopupFloatWin::ImplSetBorder()
// by setting those members the method SetOutputSizePixel() can
// be used to set the proper window size
mpWindowImpl->mnTopBorder = 1;
- if( meTearOffStyle == TearOffStyle::Grip )
+ if( hasGrip() )
mpWindowImpl->mnTopBorder += POPUP_DRAGHEIGHT+2;
- else if( meTearOffStyle == TearOffStyle::Title )
- mpWindowImpl->mnTopBorder += GetSettings().GetStyleSettings().GetTitleHeight()+2;
mpWindowImpl->mnBottomBorder = 1;
mpWindowImpl->mnLeftBorder = 1;
mpWindowImpl->mnRightBorder = 1;
@@ -554,23 +548,24 @@ void ImplPopupFloatWin::Resize()
Rectangle ImplPopupFloatWin::GetDragRect() const
{
- if( meTearOffStyle == TearOffStyle::Grip )
- {
- return Rectangle( 1, GetOutputSizePixel().Height() - 3 - POPUP_DRAGHEIGHT,
- GetOutputSizePixel().Width() - 1, GetOutputSizePixel().Height() - 1 );
- }
- else if( meTearOffStyle == TearOffStyle::Title )
+ Rectangle aRect;
+ if( hasGrip() )
{
- return Rectangle( 1, 1, GetOutputSizePixel().Width() - 1, GetSettings().GetStyleSettings().GetTitleHeight() + 2 );
+ aRect = Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT );
+ if( mbGripAtBottom )
+ {
+ int height = GetOutputSizePixel().Height();
+ aRect.Top() = height - 3 - POPUP_DRAGHEIGHT;
+ aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT;
+ }
}
-
- return Rectangle();
+ return aRect;
}
Point ImplPopupFloatWin::GetToolboxPosition() const
{
// return inner position where a toolbox could be placed
- Point aPt( 1, 1 + ( meTearOffStyle != TearOffStyle::Title ? 0 : GetDragRect().getHeight()) ); // grip + border
+ Point aPt( 1, 1 + ((mbGripAtBottom || !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border
return aPt;
}
@@ -696,33 +691,13 @@ void ImplPopupFloatWin::DrawGrip(vcl::RenderContext& rRenderContext)
rRenderContext.SetFillColor();
}
-void ImplPopupFloatWin::DrawTitle(vcl::RenderContext &rRenderContext)
-{
- Rectangle aRect(GetDragRect());
- aRect.Left() += 2;
- aRect.Right() -= 2;
-
- DrawTextFlags nTextStyle = DrawTextFlags::Left | DrawTextFlags::VCenter | DrawTextFlags::EndEllipsis | DrawTextFlags::Clip;
- rRenderContext.SetTextColor(GetSettings().GetStyleSettings().GetButtonTextColor());
- SetPointFont(rRenderContext, GetSettings().GetStyleSettings().GetTitleFont());
- rRenderContext.DrawText(aRect, GetText(), nTextStyle);
-}
-
void ImplPopupFloatWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
Rectangle aRect(Point(), GetOutputSizePixel());
-
- if (meTearOffStyle == TearOffStyle::Grip)
- {
- rRenderContext.DrawWallpaper(aRect, Wallpaper(rRenderContext.GetSettings().GetStyleSettings().GetFaceGradientColor()));
- DrawGrip(rRenderContext);
- }
- else if ( meTearOffStyle == TearOffStyle::Title )
- {
- rRenderContext.DrawWallpaper(aRect, Wallpaper(rRenderContext.GetSettings().GetStyleSettings().GetFaceColor()));
- DrawTitle(rRenderContext);
- }
+ rRenderContext.DrawWallpaper(aRect, Wallpaper(rRenderContext.GetSettings().GetStyleSettings().GetFaceGradientColor()));
DrawBorder(rRenderContext);
+ if (hasGrip())
+ DrawGrip(rRenderContext);
}
void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt )
@@ -1110,15 +1085,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
mpOldBorderWin = nullptr; // no border window found
// the new parent for popup mode
- TearOffStyle eStyle = TearOffStyle::None;
- if ( nFlags & FloatWinPopupFlags::AllowTearOff )
- {
- if ( dynamic_cast< ToolBox* >( GetWindow() ) )
- eStyle = TearOffStyle::Grip;
- else
- eStyle = TearOffStyle::Title;
- }
- VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, eStyle );
+ VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, bool(nFlags & FloatWinPopupFlags::AllowTearOff) );
pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
pWin->SetText( GetWindow()->GetText() );