diff options
-rw-r--r-- | svtools/source/control/headbar.cxx | 81 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkgdi.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/vcl/salnativewidgets.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 36 |
4 files changed, 87 insertions, 36 deletions
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 3f004e3a5ac8..7ff53f8703c6 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -604,45 +604,58 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev, bDraw = sal_False; if ( bDraw ) - { - long nArrowY; - if ( aTxtSize.Height() ) - nArrowY = nTxtPosY+(aTxtSize.Height()/2); - else if ( aImageSize.Width() && aImageSize.Height() ) - nArrowY = nImagePosY+(aImageSize.Height()/2); - else - { - if ( nBits & HIB_TOP ) - nArrowY = aRect.Top()+1; - else if ( nBits & HIB_BOTTOM ) - nArrowY = aRect.Bottom()-HEAD_ARROWSIZE2-1; - else - nArrowY = aRect.Top()+((aRect.GetHeight()-HEAD_ARROWSIZE2)/2); - } - nArrowY -= HEAD_ARROWSIZE1-1; - if ( nBits & HIB_DOWNARROW ) + if( pWin && pWin->IsNativeControlSupported(CTRL_LISTHEADER, PART_ARROW) ) { - pDev->SetLineColor( rStyleSettings.GetLightColor() ); - pDev->DrawLine( Point( nArrowX, nArrowY ), - Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) ); - pDev->DrawLine( Point( nArrowX, nArrowY ), - Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ) ); - pDev->SetLineColor( rStyleSettings.GetShadowColor() ); - pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ), - Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) ); + aCtrlRegion=Rectangle(Point(nArrowX,aRect.Top()),Size(nArrowWidth,aRect.GetHeight())); + // control value passes 1 if arrow points down, 0 otherwise + aControlValue.setNumericVal((nBits&HIB_DOWNARROW)?1:0); + nState|=CTRL_STATE_ENABLED; + if(bHigh) + nState|=CTRL_STATE_PRESSED; + pWin->DrawNativeControl( CTRL_LISTHEADER, PART_ARROW, + aCtrlRegion, nState, aControlValue, + rtl::OUString() ); } else { - pDev->SetLineColor( rStyleSettings.GetLightColor() ); - pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ), - Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) ); - pDev->SetLineColor( rStyleSettings.GetShadowColor() ); - pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ), - Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ) ); - pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ), - Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) ); + long nArrowY; + if ( aTxtSize.Height() ) + nArrowY = nTxtPosY+(aTxtSize.Height()/2); + else if ( aImageSize.Width() && aImageSize.Height() ) + nArrowY = nImagePosY+(aImageSize.Height()/2); + else + { + if ( nBits & HIB_TOP ) + nArrowY = aRect.Top()+1; + else if ( nBits & HIB_BOTTOM ) + nArrowY = aRect.Bottom()-HEAD_ARROWSIZE2-1; + else + nArrowY = aRect.Top()+((aRect.GetHeight()-HEAD_ARROWSIZE2)/2); + } + nArrowY -= HEAD_ARROWSIZE1-1; + if ( nBits & HIB_DOWNARROW ) + { + pDev->SetLineColor( rStyleSettings.GetLightColor() ); + pDev->DrawLine( Point( nArrowX, nArrowY ), + Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) ); + pDev->DrawLine( Point( nArrowX, nArrowY ), + Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ) ); + pDev->SetLineColor( rStyleSettings.GetShadowColor() ); + pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ), + Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) ); + } + else + { + pDev->SetLineColor( rStyleSettings.GetLightColor() ); + pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ), + Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) ); + pDev->SetLineColor( rStyleSettings.GetShadowColor() ); + pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ), + Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ) ); + pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ), + Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) ); + } } - } } // Gegebenenfalls auch UserDraw aufrufen diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index ab03d1864bd3..9dc93b136b7a 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -165,6 +165,11 @@ protected: GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect ); sal_Bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ); + sal_Bool NWPaintGTKArrow( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + const OUString& rCaption ); sal_Bool NWPaintGTKListHeader( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index 02857a11b3ff..40d4fbde371a 100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -172,6 +172,7 @@ typedef sal_uInt32 ControlPart; #define PART_TRACK_VERT_AREA 205 #define PART_THUMB_HORZ 210 // Also used as toolbar grip #define PART_THUMB_VERT 211 // Also used as toolbar grip +#define PART_ARROW 220 #define PART_MENU_ITEM 250 #define PART_MENU_ITEM_CHECK_MARK 251 #define PART_MENU_ITEM_RADIO_MARK 252 diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 31067512a0c7..c9b1c30ff9ea 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -641,7 +641,7 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar break; case CTRL_LISTHEADER: - if(nPart == PART_BUTTON) + if(nPart == PART_BUTTON || nPart == PART_ARROW) return true; break; } @@ -940,7 +940,10 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, } else if(nType==CTRL_LISTHEADER) { - returnVal = NWPaintGTKListHeader( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); + if(nPart == PART_BUTTON) + returnVal = NWPaintGTKListHeader( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); + else if(nPart == PART_ARROW) + returnVal = NWPaintGTKArrow( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } if( pixmap ) @@ -1203,6 +1206,35 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, /************************************************************************ * Individual control drawing functions ************************************************************************/ +sal_Bool GtkSalGraphics::NWPaintGTKArrow( + GdkDrawable* gdkDrawable, + ControlType, ControlPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + const OUString& ) +{ + GtkArrowType arrowType(aValue.getNumericVal()&1?GTK_ARROW_DOWN:GTK_ARROW_UP); + GtkStateType stateType(nState&CTRL_STATE_PRESSED?GTK_STATE_ACTIVE:GTK_STATE_NORMAL); + + GdkRectangle clipRect; + for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it ) + { + clipRect.x = it->Left(); + clipRect.y = it->Top(); + clipRect.width = it->GetWidth(); + clipRect.height = it->GetHeight(); + + gtk_paint_arrow(m_pWindow->style,gdkDrawable,stateType,GTK_SHADOW_NONE,&clipRect, + m_pWindow,"arrow",arrowType,true, + rControlRectangle.Left(), + rControlRectangle.Top(), + rControlRectangle.GetWidth(), + rControlRectangle.GetHeight()); + } + return true; +} + sal_Bool GtkSalGraphics::NWPaintGTKListHeader( GdkDrawable* gdkDrawable, ControlType, ControlPart, |