diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2009-11-24 13:08:55 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2009-11-24 13:08:55 +0100 |
commit | eb17ba2dd929c358712fb253bb1f52af6c50a37d (patch) | |
tree | 00e0d8da0342131299f51bcdc5848bd40a90caca /vcl | |
parent | 4728fe82faf9e0266922868215fa9a75a32dd3df (diff) | |
parent | 593aebed34f922feeb9c4f1f0f864e67f8b78527 (diff) |
CWS-TOOLING: integrate CWS ooo32gsl02_DEV300
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/bitmapex.hxx | 13 | ||||
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 73 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/inc/plugins/gtk/gtkframe.hxx | 7 |
4 files changed, 102 insertions, 7 deletions
diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index 3da80ce8c2f1..e5ddf50f1efa 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -381,6 +381,19 @@ public: const BmpFilterParam* pFilterParam = NULL, const Link* pProgress = NULL ); + /** Get transparency at given position + + @param nX + integer X-Position in Bitmap + + @param nY + integer Y-Position in Bitmap + + @return transparency value in the range of [0 .. 255] where + 0 is not transparent, 255 is fully transparent + */ + sal_uInt8 GetTransparency(sal_Int32 nX, sal_Int32 nY) const; + public: friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index cfcac8851089..4e2ed20a7966 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -47,6 +47,7 @@ #include <tools/rc.h> #endif #include <vcl/svapp.hxx> +#include <vcl/bmpacc.hxx> // ------------ // - BitmapEx - @@ -761,6 +762,78 @@ void BitmapEx::Draw( OutputDevice* pOutDev, // ------------------------------------------------------------------ +sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const +{ + sal_uInt8 nTransparency(0xff); + + if(!aBitmap.IsEmpty()) + { + if(nX >= 0 && nX < aBitmapSize.Width() && nY >= 0 && nY < aBitmapSize.Height()) + { + switch(eTransparent) + { + case TRANSPARENT_NONE: + { + // not transparent, ergo all covered + nTransparency = 0x00; + break; + } + case TRANSPARENT_COLOR: + { + Bitmap aTestBitmap(aBitmap); + BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess(); + + if(pRead) + { + const Color aColor = pRead->GetColor(nY, nX); + + // if color is not equal to TransparentColor, we are not transparent + if(aColor != aTransparentColor) + { + nTransparency = 0x00; + } + + aTestBitmap.ReleaseAccess(pRead); + } + break; + } + case TRANSPARENT_BITMAP: + { + if(!aMask.IsEmpty()) + { + Bitmap aTestBitmap(aMask); + BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess(); + + if(pRead) + { + const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX)); + + if(bAlpha) + { + nTransparency = aBitmapColor.GetIndex(); + } + else + { + if(0x00 != aBitmapColor.GetIndex()) + { + nTransparency = 0x00; + } + } + + aTestBitmap.ReleaseAccess(pRead); + } + } + break; + } + } + } + } + + return nTransparency; +} + +// ------------------------------------------------------------------ + SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ) { rBitmapEx.aBitmap.Write( rOStm ); diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index eff7319d6efc..99a331be2318 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -772,7 +772,10 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) m_aForeignTopLevelWindow = None; m_nStyle = nStyle; - GtkWindowType eWinType = ((nStyle & SAL_FRAME_STYLE_FLOAT) && ! (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + GtkWindowType eWinType = ( (nStyle & SAL_FRAME_STYLE_FLOAT) && + ! (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION| + SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) + ) ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL; if( nStyle & SAL_FRAME_STYLE_SYSTEMCHILD ) @@ -801,7 +804,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) bool bDecoHandling = ! isChild() && ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || - (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ); + (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) ); /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME at some point that may be fixed in metacity and we will have to revisit this @@ -832,6 +835,11 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); bNoDecor = true; } + else if( (nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) + { + eType = GDK_WINDOW_TYPE_HINT_UTILITY; + } + if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; @@ -869,7 +877,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) || bMetaCityToolWindowHack ) + if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -2075,7 +2083,7 @@ void GtkSalFrame::ToTop( USHORT nFlags ) * to our window - which it of course won't since our input hint * is set to false. */ - if( (m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) + if( (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) ) XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime ); } else diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index a8fc6f65d4ee..c2a147517ac8 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -242,9 +242,10 @@ class GtkSalFrame : public SalFrame bool isFloatGrabWindow() const { return - (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab - !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not - !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION); // toolbars are also not + (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab + !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not + !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) && // toolbars are also not + !(m_nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE); // focusable floats are not } bool isChild( bool bPlug = true, bool bSysChild = true ) |