diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-18 11:18:49 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-18 11:22:50 +0900 |
commit | 6656e915c8e0348dcaeedb40a68ba308e174960b (patch) | |
tree | 26d1b1d9d75ebee8b14d1082928b7abf4894b821 | |
parent | 6fa87f3fde8316fe1e4c35d1dd5132dbd7d7d903 (diff) |
ApplySettings for dialog
Change-Id: I30f26799e0dfa059ad754eead5ba382f44bf1310
-rw-r--r-- | include/vcl/dialog.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/helpwin.hxx | 14 | ||||
-rw-r--r-- | vcl/source/app/help.cxx | 39 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 28 |
4 files changed, 67 insertions, 16 deletions
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 4678645a60cf..c7f0a747b163 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -53,6 +53,8 @@ private: SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); + virtual void ApplySettings(vcl::RenderContext& rRenderContext); + SAL_DLLPRIVATE Dialog (const Dialog &) SAL_DELETED_FUNCTION; SAL_DLLPRIVATE Dialog & operator= (const Dialog &) SAL_DELETED_FUNCTION; diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx index b553c6eb0540..5889a4f74311 100644 --- a/vcl/inc/helpwin.hxx +++ b/vcl/inc/helpwin.hxx @@ -44,11 +44,15 @@ private: QuickHelpFlags mnStyle; protected: - DECL_LINK_TYPED( TimerHdl, Timer*, void ); - virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) SAL_OVERRIDE; - virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; - virtual OUString GetText() const SAL_OVERRIDE; - void ImplShow(); + DECL_LINK_TYPED( TimerHdl, Timer*, void ); + + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE; + virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + + virtual OUString GetText() const SAL_OVERRIDE; + void ImplShow(); + public: HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle ); diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index f9d02fc01e43..6bdb60e57d39 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -253,17 +253,18 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); SetPointFont(*this, rStyleSettings.GetHelpFont()); - SetTextColor( rStyleSettings.GetHelpTextColor() ); - SetTextAlign( ALIGN_TOP ); - if ( IsNativeControlSupported( CTRL_TOOLTIP, PART_ENTIRE_CONTROL ) ) + SetTextColor(rStyleSettings.GetHelpTextColor()); + SetTextAlign(ALIGN_TOP); + if (IsNativeControlSupported(CTRL_TOOLTIP, PART_ENTIRE_CONTROL)) { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); SetBackground(); } else - SetBackground( Wallpaper( rStyleSettings.GetHelpColor() ) ); + SetBackground(Wallpaper(rStyleSettings.GetHelpColor())); + if( rStyleSettings.GetHelpColor().IsDark() ) SetLineColor( COL_WHITE ); else @@ -289,6 +290,30 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal maHideTimer.SetTimeout( rHelpSettings.GetTipTimeout() ); } +void HelpTextWindow::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + SetPointFont(rRenderContext, rStyleSettings.GetHelpFont()); + rRenderContext.SetTextColor(rStyleSettings.GetHelpTextColor()); + rRenderContext.SetTextAlign(ALIGN_TOP); + + if (rRenderContext.IsNativeControlSupported(CTRL_TOOLTIP, PART_ENTIRE_CONTROL)) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + rRenderContext.SetBackground(Wallpaper(rStyleSettings.GetHelpColor())); + + if (rStyleSettings.GetHelpColor().IsDark()) + rRenderContext.SetLineColor(COL_WHITE); + else + rRenderContext.SetLineColor(COL_BLACK); + rRenderContext.SetFillColor(); +} + HelpTextWindow::~HelpTextWindow() { disposeOnce(); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 4aa3e15f08cc..93273a79a890 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -432,20 +432,40 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) ImplInitSettings(); } +void Dialog::ApplySettings(vcl::RenderContext& rRenderContext) +{ + if (IsControlBackground()) + { + // user override + SetBackground(GetControlBackground()); + } + else if (rRenderContext.IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG)) + { + // NWF background + mpWindowImpl->mnNativeBackground = PART_BACKGROUND_DIALOG; + EnableChildTransparentMode(true); + } + else + { + // fallback to settings color + rRenderContext.SetBackground(GetSettings().GetStyleSettings().GetDialogColor()); + } +} + void Dialog::ImplInitSettings() { // user override - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); + if (IsControlBackground()) + SetBackground(GetControlBackground()); // NWF background - else if( IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG ) ) + else if( IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG)) { mpWindowImpl->mnNativeBackground = PART_BACKGROUND_DIALOG; EnableChildTransparentMode( true ); } // fallback to settings color else - SetBackground( GetSettings().GetStyleSettings().GetDialogColor() ); + SetBackground(GetSettings().GetStyleSettings().GetDialogColor()); } Dialog::Dialog( WindowType nType ) |