Kaydet (Commit) 7092c767 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

ApplySettings for Menu

Change-Id: Iaf004e3deed19dfc9f808b53f0bbe45e0949c034
üst 12443d11
...@@ -120,10 +120,10 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce ) ...@@ -120,10 +120,10 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
Window( pParent, 0 ), Window( pParent, 0 ),
aCloseBtn(VclPtr<DecoToolBox>::Create(this)), aCloseBtn(VclPtr<DecoToolBox>::Create(this)),
aFloatBtn(VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )), aFloatBtn(VclPtr<PushButton>::Create(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE)),
aHideBtn(VclPtr<PushButton>::Create(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )) aHideBtn(VclPtr<PushButton>::Create(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE))
{ {
SetType( WINDOW_MENUBARWINDOW ); SetType(WINDOW_MENUBARWINDOW);
pMenu = NULL; pMenu = NULL;
pActivePopup = NULL; pActivePopup = NULL;
nSaveFocusId = 0; nSaveFocusId = 0;
...@@ -136,9 +136,9 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : ...@@ -136,9 +136,9 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
ResMgr* pResMgr = ImplGetResMgr(); ResMgr* pResMgr = ImplGetResMgr();
if( pResMgr ) if(pResMgr)
{ {
BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) ); BitmapEx aBitmap(ResId(SV_RESID_BITMAP_CLOSEDOC, *pResMgr));
aCloseBtn->maImage = Image(aBitmap); aCloseBtn->maImage = Image(aBitmap);
aCloseBtn->SetOutStyle(TOOLBOX_STYLE_FLAT); aCloseBtn->SetOutStyle(TOOLBOX_STYLE_FLAT);
...@@ -162,7 +162,7 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : ...@@ -162,7 +162,7 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
ImplInitStyleSettings(); ImplInitStyleSettings();
AddEventListener( LINK( this, MenuBarWindow, ShowHideListener ) ); AddEventListener(LINK(this, MenuBarWindow, ShowHideListener));
} }
MenuBarWindow::~MenuBarWindow() MenuBarWindow::~MenuBarWindow()
...@@ -187,8 +187,8 @@ void MenuBarWindow::SetMenu( MenuBar* pMen ) ...@@ -187,8 +187,8 @@ void MenuBarWindow::SetMenu( MenuBar* pMen )
pMenu = pMen; pMenu = pMen;
KillActivePopup(); KillActivePopup();
nHighlightedItem = ITEMPOS_INVALID; nHighlightedItem = ITEMPOS_INVALID;
ImplInitMenuWindow( this, true, true ); ImplInitMenuWindow(this, true, true);
if ( pMen ) if (pMen)
{ {
aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton()); aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton());
aCloseBtn->Show(pMen->HasCloseButton() || !m_aAddButtons.empty()); aCloseBtn->Show(pMen->HasCloseButton() || !m_aAddButtons.empty());
...@@ -988,55 +988,93 @@ void MenuBarWindow::StateChanged( StateChangedType nType ) ...@@ -988,55 +988,93 @@ void MenuBarWindow::StateChanged( StateChangedType nType )
{ {
Window::StateChanged( nType ); Window::StateChanged( nType );
if ( ( nType == StateChangedType::ControlForeground ) || if (nType == StateChangedType::ControlForeground ||
( nType == StateChangedType::ControlBackground ) ) nType == StateChangedType::ControlBackground)
{ {
ImplInitMenuWindow( this, false, true ); ImplInitMenuWindow(this, false, true);
Invalidate(); Invalidate();
} }
else if( pMenu ) else if(pMenu)
{
pMenu->ImplKillLayoutData(); pMenu->ImplKillLayoutData();
}
} }
void MenuBarWindow::LayoutChanged() void MenuBarWindow::LayoutChanged()
{ {
if( pMenu ) if (!pMenu)
return;
ImplInitMenuWindow(this, true, true);
// if the font was changed.
long nHeight = pMenu->ImplCalcSize(this).Height();
// depending on the native implementation or the displayable flag
// the menubar windows is suppressed (ie, height=0)
if (!static_cast<MenuBar*>(pMenu)->IsDisplayable() ||
(pMenu->ImplGetSalMenu() && pMenu->ImplGetSalMenu()->VisibleMenuBar()))
{ {
ImplInitMenuWindow( this, true, true ); nHeight = 0;
// if the font was changed.
long nHeight = pMenu->ImplCalcSize( this ).Height();
// depending on the native implementation or the displayable flag
// the menubar windows is suppressed (ie, height=0)
if( !static_cast<MenuBar*>(pMenu)->IsDisplayable() ||
( pMenu->ImplGetSalMenu() && pMenu->ImplGetSalMenu()->VisibleMenuBar() ) )
nHeight = 0;
setPosSizePixel( 0, 0, 0, nHeight, WINDOW_POSSIZE_HEIGHT );
GetParent()->Resize();
Invalidate();
Resize();
if( pMenu )
pMenu->ImplKillLayoutData();
} }
setPosSizePixel(0, 0, 0, nHeight, WINDOW_POSSIZE_HEIGHT);
GetParent()->Resize();
Invalidate();
Resize();
pMenu->ImplKillLayoutData();
}
void MenuBarWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
const BitmapEx& rPersonaBitmap = Application::GetSettings().GetStyleSettings().GetPersonaHeader();
if (!rPersonaBitmap.IsEmpty())
{
Wallpaper aWallpaper(rPersonaBitmap);
aWallpaper.SetStyle(WALLPAPER_TOPRIGHT);
aWallpaper.SetColor(Application::GetSettings().GetStyleSettings().GetWorkspaceColor());
rRenderContext.SetBackground(aWallpaper);
SetPaintTransparent(false);
SetParentClipMode(0);
}
else if (rRenderContext.IsNativeControlSupported(CTRL_MENUBAR, PART_ENTIRE_CONTROL))
{
rRenderContext.SetBackground(); // background will be drawn by NWF
}
else
{
Wallpaper aWallpaper;
aWallpaper.SetStyle(WALLPAPER_APPLICATIONGRADIENT);
rRenderContext.SetBackground(aWallpaper);
SetPaintTransparent(false);
SetParentClipMode(0);
}
rRenderContext.SetTextColor(rStyleSettings.GetMenuBarTextColor());
rRenderContext.SetTextFillColor();
rRenderContext.SetLineColor();
} }
void MenuBarWindow::ImplInitStyleSettings() void MenuBarWindow::ImplInitStyleSettings()
{ {
if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) && if (IsNativeControlSupported(CTRL_MENUBAR, PART_MENU_ITEM) &&
IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) IsNativeControlSupported(CTRL_MENUBAR, PART_ENTIRE_CONTROL))
{ {
AllSettings aSettings( GetSettings() ); AllSettings aSettings(GetSettings());
ImplGetFrame()->UpdateSettings( aSettings ); // to update persona ImplGetFrame()->UpdateSettings(aSettings); // to update persona
StyleSettings aStyle( aSettings.GetStyleSettings() ); StyleSettings aStyle(aSettings.GetStyleSettings());
Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor; Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
if( aHighlightTextColor != Color( COL_TRANSPARENT ) ) if (aHighlightTextColor != Color(COL_TRANSPARENT))
{ {
aStyle.SetMenuHighlightTextColor( aHighlightTextColor ); aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
} }
aSettings.SetStyleSettings( aStyle ); aSettings.SetStyleSettings(aStyle);
OutputDevice::SetSettings( aSettings ); OutputDevice::SetSettings(aSettings);
} }
} }
......
...@@ -97,11 +97,13 @@ private: ...@@ -97,11 +97,13 @@ private:
void ImplInitStyleSettings(); void ImplInitStyleSettings();
DECL_LINK_TYPED(CloseHdl, ToolBox *, void); virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
DECL_LINK(FloatHdl, void *);
DECL_LINK(HideHdl, void *); DECL_LINK_TYPED(CloseHdl, ToolBox *, void);
DECL_LINK( ToolboxEventHdl, VclWindowEvent* ); DECL_LINK(FloatHdl, void *);
DECL_LINK( ShowHideListener, VclWindowEvent* ); DECL_LINK(HideHdl, void *);
DECL_LINK( ToolboxEventHdl, VclWindowEvent* );
DECL_LINK( ShowHideListener, VclWindowEvent* );
void StateChanged( StateChangedType nType ) SAL_OVERRIDE; void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
......
...@@ -119,6 +119,24 @@ void MenuFloatingWindow::Resize() ...@@ -119,6 +119,24 @@ void MenuFloatingWindow::Resize()
InitMenuClipRegion(*this); // FIXME InitMenuClipRegion(*this); // FIXME
} }
void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
rRenderContext.SetBackground(); // background will be drawn by NWF
}
else
rRenderContext.SetBackground(Wallpaper(rStyleSettings.GetMenuColor()));
rRenderContext.SetTextColor(rStyleSettings.GetMenuTextColor());
rRenderContext.SetTextFillColor();
rRenderContext.SetLineColor();
}
long MenuFloatingWindow::ImplGetStartY() const long MenuFloatingWindow::ImplGetStartY() const
{ {
long nY = 0; long nY = 0;
...@@ -1110,7 +1128,7 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang ...@@ -1110,7 +1128,7 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang
void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp) void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp)
{ {
if( ! pMenu ) if (!pMenu)
return; return;
rRenderContext.SetClipRegion(); rRenderContext.SetClipRegion();
......
...@@ -80,21 +80,23 @@ protected: ...@@ -80,21 +80,23 @@ protected:
Rectangle ImplGetItemRect( sal_uInt16 nPos ); Rectangle ImplGetItemRect( sal_uInt16 nPos );
public: public:
MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle ); MenuFloatingWindow(Menu* pMenu, vcl::Window* pParent, WinBits nStyle);
virtual ~MenuFloatingWindow(); virtual ~MenuFloatingWindow();
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
void doShutdown(); void doShutdown();
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE; virtual void KeyInput(const KeyEvent& rKEvent) SAL_OVERRIDE;
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; } void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; }
sal_uLong GetFocusId() const { return nSaveFocusId; } sal_uLong GetFocusId() const { return nSaveFocusId; }
......
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