Kaydet (Commit) 2b16c138 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Jan Holesovsky

use ApplySettings instead of ImplInitSettings is called

Change-Id: I30cbfe1906d5d59db93a354ca1d1862c4b5e631a
Signed-off-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 3501d1b0
......@@ -43,6 +43,7 @@ public:
WindowAlign GetAlign() const;
bool IsHorizontal() const;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
......
......@@ -44,7 +44,6 @@ private:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
public:
......@@ -64,6 +63,8 @@ public:
virtual ~FixedText();
virtual void dispose() SAL_OVERRIDE;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
......@@ -89,6 +90,7 @@ public:
explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle = 0 );
virtual void LoseFocus() SAL_OVERRIDE;
virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
};
......@@ -102,7 +104,6 @@ private:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false);
protected:
......@@ -116,6 +117,8 @@ public:
explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ );
explicit FixedLine( vcl::Window* pParent, const ResId& );
virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
......@@ -135,13 +138,14 @@ private:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings();
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
const Point& rPos, const Size& rSize );
public:
explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 );
virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
......@@ -168,7 +172,6 @@ private:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings();
protected:
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
......@@ -179,6 +182,8 @@ public:
explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 );
explicit FixedImage( vcl::Window* pParent, const ResId& );
virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
......
......@@ -85,6 +85,7 @@ public:
virtual ~ListBox();
virtual void dispose() SAL_OVERRIDE;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
......
......@@ -425,28 +425,9 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext)
rRenderContext.SetTextFillColor();
}
void Control::ImplInitSettings( const bool _bFont, const bool _bForeground )
void Control::ImplInitSettings(const bool, const bool)
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
if (_bFont)
{
Font aFont(GetCanonicalFont(rStyleSettings));
if (IsControlFont())
aFont.Merge(GetControlFont());
SetZoomedPointFont(*this, aFont);
}
if (_bForeground || _bFont)
{
Color aColor;
if (IsControlForeground())
aColor = GetControlForeground();
else
aColor = GetCanonicalTextColor(rStyleSettings);
SetTextColor(aColor);
SetTextFillColor();
}
ApplySettings(*this);
}
void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr,
......
This diff is collapsed.
......@@ -105,7 +105,6 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
nStyle |= WB_BORDER;
Control::ImplInit( pParent, nStyle, NULL );
SetBackground();
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this);
......@@ -369,6 +368,11 @@ void ListBox::ToggleDropDown()
}
}
void ListBox::ApplySettings(vcl::RenderContext& rRenderContext)
{
rRenderContext.SetBackground();
}
void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{
mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true );
......
......@@ -44,50 +44,12 @@ DockingAreaWindow::ImplData::~ImplData()
{
}
static void ImplInitBackground( DockingAreaWindow* pThis )
{
const StyleSettings rSetting = Application::GetSettings().GetStyleSettings();
const BitmapEx& rPersonaBitmap = pThis->GetAlign() == WINDOWALIGN_TOP ? rSetting.GetPersonaHeader() :rSetting.GetPersonaFooter();
if ( !rPersonaBitmap.IsEmpty() &&( pThis->GetAlign() == WINDOWALIGN_TOP|| pThis->GetAlign()==WINDOWALIGN_BOTTOM ) )
{
Wallpaper aWallpaper( rPersonaBitmap );
if(pThis->GetAlign()==WINDOWALIGN_TOP )
aWallpaper.SetStyle( WALLPAPER_TOPRIGHT );
else
aWallpaper.SetStyle( WALLPAPER_BOTTOMRIGHT );
aWallpaper.SetColor( rSetting.GetWorkspaceColor() );
// we need to shift the bitmap vertically so that it spans over the
// menubar conveniently
long nMenubarHeight = 0;
SystemWindow *pSysWin = pThis->GetSystemWindow();
if ( pSysWin && pSysWin->GetMenuBar() )
{
vcl::Window *pMenubarWin = pSysWin->GetMenuBar()->GetWindow();
if ( pMenubarWin )
nMenubarHeight = pMenubarWin->GetOutputHeightPixel();
}
aWallpaper.SetRect( Rectangle( Point( 0, -nMenubarHeight ), Size( pThis->GetOutputWidthPixel(), pThis->GetOutputHeightPixel() + nMenubarHeight ) ) );
pThis->SetBackground( aWallpaper );
}
else if( !pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) )
{
Wallpaper aWallpaper;
aWallpaper.SetStyle( WALLPAPER_APPLICATIONGRADIENT );
pThis->SetBackground( aWallpaper );
}
else
pThis->SetBackground( Wallpaper( pThis->GetSettings().GetStyleSettings().GetFaceColor() ) );
}
DockingAreaWindow::DockingAreaWindow( vcl::Window* pParent ) :
Window( WINDOW_DOCKINGAREA )
{
ImplInit( pParent, WB_CLIPCHILDREN|WB_3DLOOK, NULL );
mpImplData = new ImplData;
ImplInitBackground( this );
}
DockingAreaWindow::~DockingAreaWindow()
......@@ -107,7 +69,6 @@ void DockingAreaWindow::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
ImplInitBackground( this );
Invalidate();
}
}
......@@ -149,7 +110,6 @@ void DockingAreaWindow::SetAlign( WindowAlign eNewAlign )
if( eNewAlign != mpImplData->meAlign )
{
mpImplData->meAlign = eNewAlign;
ImplInitBackground( this );
Invalidate();
}
}
......@@ -159,13 +119,56 @@ WindowAlign DockingAreaWindow::GetAlign() const
return mpImplData->meAlign;
}
void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings();
const BitmapEx& rPersonaBitmap = (GetAlign() == WINDOWALIGN_TOP) ? rSetting.GetPersonaHeader() : rSetting.GetPersonaFooter();
if (!rPersonaBitmap.IsEmpty() && (GetAlign() == WINDOWALIGN_TOP || GetAlign()==WINDOWALIGN_BOTTOM))
{
Wallpaper aWallpaper(rPersonaBitmap);
if (GetAlign() == WINDOWALIGN_TOP)
aWallpaper.SetStyle(WALLPAPER_TOPRIGHT);
else
aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT);
aWallpaper.SetColor(rSetting.GetWorkspaceColor());
// we need to shift the bitmap vertically so that it spans over the
// menubar conveniently
long nMenubarHeight = 0;
SystemWindow* pSysWin = GetSystemWindow();
if (pSysWin && pSysWin->GetMenuBar())
{
vcl::Window* pMenubarWin = pSysWin->GetMenuBar()->GetWindow();
if (pMenubarWin)
nMenubarHeight = pMenubarWin->GetOutputHeightPixel();
}
aWallpaper.SetRect(Rectangle(Point(0, -nMenubarHeight),
Size(rRenderContext.GetOutputWidthPixel(),
rRenderContext.GetOutputHeightPixel() + nMenubarHeight)));
rRenderContext.SetBackground(aWallpaper);
}
else if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL))
{
Wallpaper aWallpaper;
aWallpaper.SetStyle(WALLPAPER_APPLICATIONGRADIENT);
rRenderContext.SetBackground(aWallpaper);
}
else
rRenderContext.SetBackground(Wallpaper(rSetting.GetFaceColor()));
}
void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings();
EnableNativeWidget(true); // only required because the toolkit currently switches this flag off
if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL))
{
ToolbarValue aControlValue;
const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings();
if (GetAlign() == WINDOWALIGN_TOP && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG)
{
......@@ -256,7 +259,6 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl
void DockingAreaWindow::Resize()
{
ImplInitBackground( this );
ImplInvalidateMenubar( this );
if (IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL))
Invalidate();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment