diff options
author | Stephan Schäfer <ssa@openoffice.org> | 2002-10-01 15:23:25 +0000 |
---|---|---|
committer | Stephan Schäfer <ssa@openoffice.org> | 2002-10-01 15:23:25 +0000 |
commit | b850c6e1e00ebbd30258b6c4811967e8f26c9e53 (patch) | |
tree | 5d2adaab69bdf7668bf0a9ffc06fee1260d04c0d /vcl | |
parent | 423b288363951a99abbe9477661911ec1cbcf5dc (diff) |
#103891# document closer
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/src/images.src | 16 | ||||
-rw-r--r-- | vcl/source/src/makefile.mk | 9 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 115 |
3 files changed, 128 insertions, 12 deletions
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src index 163cb4dc6e00..48f1984408ab 100644 --- a/vcl/source/src/images.src +++ b/vcl/source/src/images.src @@ -2,9 +2,9 @@ * * $RCSfile: images.src,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $ + * last change: $Author: ssa $ $Date: 2002-10-01 16:23:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -145,6 +145,18 @@ Bitmap SV_RESID_BITMAP_PIN // ----------------------------------------------------------------------- +Bitmap SV_RESID_BITMAP_CLOSEDOC +{ + File = "closedoc.bmp"; +}; + +Bitmap SV_RESID_BITMAP_CLOSEDOCHC +{ + File = "closedochc.bmp"; +}; + +// ----------------------------------------------------------------------- + Bitmap SV_RESID_BITMAP_SPLITHPIN { File = "splhpin.bmp"; diff --git a/vcl/source/src/makefile.mk b/vcl/source/src/makefile.mk index 8520005b59d8..69b10a90ef5b 100644 --- a/vcl/source/src/makefile.mk +++ b/vcl/source/src/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $ +# last change: $Author: ssa $ $Date: 2002-10-01 16:23:25 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -99,7 +99,10 @@ RESLIB1BMPS= check.bmp \ splhpin.bmp \ splvpin.bmp \ splharw.bmp \ - splvarw.bmp + splvarw.bmp \ + closedoc.bmp \ + closedochc.bmp + # --- Targets ------------------------------------------------------ diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 0cb2f188ed72..f1931f0b214f 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2,9 +2,9 @@ * * $RCSfile: menu.cxx,v $ * - * $Revision: 1.71 $ + * $Revision: 1.72 $ * - * last change: $Author: ssa $ $Date: 2002-09-10 11:19:16 $ + * last change: $Author: ssa $ $Date: 2002-10-01 16:21:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,6 +139,10 @@ #ifndef _VCL_CONTROLLAYOUT_HXX #include <controllayout.hxx> #endif +#ifndef _SV_TOOLBOX_HXX +#include <toolbox.hxx> +#endif +#include <tools/stream.hxx> #pragma hdrstop @@ -189,6 +193,9 @@ DBG_NAME( Menu ); #define EXTRASPACEY 2 #define EXTRAITEMHEIGHT 4 +// document closer +#define IID_DOCUMENTCLOSE 1 + inline BOOL ImplIsMouseFollow() { return ( Application::GetSettings().GetMouseSettings().GetFollow() & MOUSE_FOLLOW_MENU ) ? TRUE : FALSE; @@ -461,6 +468,85 @@ public: void revokeAccessibleParent(); }; +// To get the transparent mouse-over look, the closer is actually a toolbox +// overload DataChange to handle style changes correctly +class DecoToolBox : public ToolBox +{ + long lastSize; +public: + DecoToolBox( Window* pParent, WinBits nStyle = 0 ); + DecoToolBox( Window* pParent, const ResId& rResId ); + + void DataChanged( const DataChangedEvent& rDCEvt ); + void Resize(); + + void SetImages(); + + Image maImage; + Image maImageHC; +}; + +DecoToolBox::DecoToolBox( Window* pParent, WinBits nStyle ) : + ToolBox( pParent, nStyle ) +{ + lastSize = -1; +} +DecoToolBox::DecoToolBox( Window* pParent, const ResId& rResId ) : + ToolBox( pParent, rResId ) +{ + lastSize = -1; +} +void DecoToolBox::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + + if ( rDCEvt.GetFlags() & SETTINGS_STYLE ) + { + SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetMenuBarColor() ) ); + SetImages(); + } +} + +void DecoToolBox::SetImages() +{ + if( lastSize != -1 ) + { + BitmapEx aBmp( maImage.GetBitmap(), Color( COL_LIGHTMAGENTA ) ); + aBmp.SetSizePixel( Size( lastSize, lastSize ) ); + // TODO: erase transparent !!! + aBmp.Erase( GetSettings().GetStyleSettings().GetMenuBarColor() ); + + Rectangle aSrcRect( Point(0,0), maImage.GetSizePixel() ); + Rectangle aDestRect( Point((lastSize - maImage.GetSizePixel().Width())/2, (lastSize - maImage.GetSizePixel().Height())/2 ), + maImage.GetSizePixel() ); + + BitmapEx aBmpSrc( + GetSettings().GetStyleSettings().GetMenuBarColor().IsDark() ? + maImageHC.GetBitmap() : maImage.GetBitmap(), + Color( COL_LIGHTMAGENTA ) ); + aBmp.CopyPixel( aDestRect, aSrcRect, &aBmpSrc ); + Image aImg( aBmp ); + + SetItemImage( IID_DOCUMENTCLOSE, aImg ); + } +} + +void DecoToolBox::Resize() +{ + Size aOutSz = GetOutputSizePixel(); + long n = aOutSz.Height(); + if( n > 9 ) + { + n -= 8; + if( n != lastSize ) + { + lastSize = n; + SetImages(); + } + } + + ToolBox::Resize(); +} // Eine Basicklasse fuer beide (wegen pActivePopup, Timer, ...) waere nett, // aber dann musste eine 'Container'-Klasse gemacht werden, da von @@ -481,7 +567,7 @@ private: BOOL bIgnoreFirstMove; BOOL bStayActive; - PushButton aCloser; + DecoToolBox aCloser; PushButton aFloatBtn; PushButton aHideBtn; @@ -3828,7 +3914,7 @@ void MenuFloatingWindow::revokeAccessibleParent() MenuBarWindow::MenuBarWindow( Window* pParent ) : Window( pParent, 0 ), - aCloser( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ), + aCloser( this ), aFloatBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ), aHideBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ) { @@ -3843,12 +3929,25 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) : bStayActive = FALSE; ResMgr* pResMgr = ImplGetResMgr(); + + Bitmap aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, pResMgr ) ); + Bitmap aBitmapHC( ResId( SV_RESID_BITMAP_CLOSEDOCHC, pResMgr ) ); + + aCloser.maImage = Image( aBitmap, Color( COL_LIGHTMAGENTA ) ); + aCloser.maImageHC = Image( aBitmapHC, Color( COL_LIGHTMAGENTA ) ); + + aCloser.SetOutStyle( TOOLBOX_STYLE_FLAT ); + aCloser.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetMenuBarColor() ) ); + + aCloser.InsertItem( IID_DOCUMENTCLOSE, + GetSettings().GetStyleSettings().GetMenuBarColor().IsDark() ? aCloser.maImageHC : aCloser.maImage, 0 ); aCloser.SetClickHdl( LINK( this, MenuBarWindow, CloserHdl ) ); - aCloser.SetSymbol( SYMBOL_CLOSE ); - aCloser.SetQuickHelpText( XubString( ResId( SV_HELPTEXT_CLOSE, pResMgr ) ) ); + aCloser.SetQuickHelpText( IID_DOCUMENTCLOSE, XubString( ResId( SV_HELPTEXT_CLOSEDOCUMENT, pResMgr ) ) ); + aFloatBtn.SetClickHdl( LINK( this, MenuBarWindow, FloatHdl ) ); aFloatBtn.SetSymbol( SYMBOL_FLOAT ); aFloatBtn.SetQuickHelpText( XubString( ResId( SV_HELPTEXT_RESTORE, pResMgr ) ) ); + aHideBtn.SetClickHdl( LINK( this, MenuBarWindow, HideHdl ) ); aHideBtn.SetSymbol( SYMBOL_HIDE ); aHideBtn.SetQuickHelpText( XubString( ResId( SV_HELPTEXT_MINIMIZE, pResMgr ) ) ); @@ -3874,7 +3973,7 @@ void MenuBarWindow::SetMenu( MenuBar* pMen ) ImplInitMenuWindow( this, TRUE, TRUE ); if ( pMen ) { - aCloser.Show( pMen->HasCloser() ); + aCloser.Show( TRUE /*pMen->HasCloser()*/ ); aFloatBtn.Show( pMen->HasFloatButton() ); aHideBtn.Show( pMen->HasHideButton() ); } @@ -4399,10 +4498,12 @@ void MenuBarWindow::Resize() aHideBtn.SetSymbol( SYMBOL_OS2HIDE ); else aHideBtn.SetSymbol( SYMBOL_HIDE ); + /* if ( nStyle & STYLE_OPTION_OS2STYLE ) aCloser.SetSymbol( SYMBOL_OS2CLOSE ); else aCloser.SetSymbol( SYMBOL_CLOSE ); + */ } USHORT MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const |