diff options
author | Rüdiger Timm <rt@openoffice.org> | 2005-03-30 08:12:41 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2005-03-30 08:12:41 +0000 |
commit | 4ba72354b2169b7fa4410978661d2199574a88ea (patch) | |
tree | 4b7208c0504f488c935fc468e8dee39e8d51ce11 /vcl | |
parent | a8a676d822bb2f41babb6f74f67a00e30e8e7f5b (diff) |
INTEGRATION: CWS vcl38 (1.10.56); FILE MERGED
2005/03/16 12:13:40 pl 1.10.56.2: #45142# NWF for tooltips
2005/03/11 12:38:47 pl 1.10.56.1: #b6238085# support for Edits without border on systems that set NWFs HAS_BACKGROUND_TEXTURE
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 80 |
1 files changed, 74 insertions, 6 deletions
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 6dc89dccea1b..427f7b788f76 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salnativewidgets-gtk.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: rt $ $Date: 2005-03-29 12:59:52 $ + * last change: $Author: rt $ $Date: 2005-03-30 09:12:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -122,6 +122,7 @@ static GtkWidget * gMenubarWidget = NULL; static GtkWidget * gMenuItemMenubarWidget = NULL; static GtkWidget * gMenuWidget = NULL; static GtkWidget * gMenuItemMenuWidget = NULL; +static GtkWidget * gTooltipPopup = NULL; osl::Mutex * pWidgetMutex; @@ -156,6 +157,7 @@ static void NWEnsureGTKScrolledWindow ( void ); static void NWEnsureGTKToolbar ( void ); static void NWEnsureGTKMenubar ( void ); static void NWEnsureGTKMenu ( void ); +static void NWEnsureGTKTooltip ( void ); static void NWConvertVCLStateToGTKState( ControlState nVCLState, GtkStateType* nGTKState, GtkShadowType* nGTKShadow ); static void NWAddWidgetToCacheWindow( GtkWidget* widget ); @@ -414,6 +416,8 @@ void GtkData::deInitNWF( void ) gtk_widget_destroy( gCacheWindow ); if( gMenuWidget ) gtk_widget_destroy( gMenuWidget ); + if( gTooltipPopup ) + gtk_widget_destroy( gTooltipPopup ); delete pWidgetMutex; delete gNWPixmapCacheList; @@ -482,6 +486,7 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP || (nPart==PART_ALL_BUTTONS) ) ) || ((nType==CTRL_COMBOBOX) && ( (nPart==PART_ENTIRE_CONTROL) + || (nPart==PART_BUTTON_DOWN) || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || (((nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER)) && @@ -502,6 +507,8 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP ) || ((nType == CTRL_MENUBAR) && ( (nPart==PART_ENTIRE_CONTROL) ) ) || + ((nType == CTRL_TOOLTIP) && + ( (nPart==PART_ENTIRE_CONTROL) ) ) || ((nType == CTRL_MENU_POPUP) && ( (nPart==PART_ENTIRE_CONTROL) ) || (nPart==PART_MENU_ITEM) @@ -732,7 +739,10 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, { returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, aCaption ); } - else if ( (nType == CTRL_COMBOBOX) && (nPart==PART_ENTIRE_CONTROL) ) + else if ( (nType == CTRL_COMBOBOX) && + ( (nPart==PART_ENTIRE_CONTROL) + ||(nPart==PART_BUTTON_DOWN) + ) ) { returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, aCaption ); } @@ -763,6 +773,10 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, { returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, aCaption ); } + else if( (nType == CTRL_TOOLTIP) && (nPart == PART_ENTIRE_CONTROL) ) + { + returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, aCaption ); + } if( pixmap ) { returnVal = NWRenderPixmapToScreen( pixmap, aPixmapRect ); @@ -1966,6 +1980,8 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, NWSetWidgetState( gArrowWidget, nState, stateType ); buttonRect = NWGetComboBoxButtonRect( nType, nPart, pixmapRect, nState, aValue, rControlHandle, aCaption ); + if( nPart == PART_BUTTON_DOWN ) + buttonRect.Left() += 1; Rectangle aEditBoxRect( pixmapRect ); aEditBoxRect.SetSize( Size( pixmapRect.GetWidth() - buttonRect.GetWidth(), aEditBoxRect.GetHeight() ) ); @@ -1983,8 +1999,9 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, clipRect.width = it->GetWidth(); clipRect.height = it->GetHeight(); - NWPaintOneEditBox( gdkDrawable, &clipRect, nType, nPart, aEditBoxRect, - nState, aValue, rControlHandle, aCaption ); + if( nPart == PART_ENTIRE_CONTROL ) + NWPaintOneEditBox( gdkDrawable, &clipRect, nType, nPart, aEditBoxRect, + nState, aValue, rControlHandle, aCaption ); // Buttons must paint opaque since some themes have alpha-channel enabled buttons gtk_paint_flat_box( gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, @@ -2575,6 +2592,44 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu( return( TRUE ); } +BOOL GtkSalGraphics::NWPaintGTKTooltip( + GdkDrawable* gdkDrawable, + ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + SalControlHandle& rControlHandle, OUString aCaption ) +{ + NWEnsureGTKTooltip(); + + gint x, y, w, h; + GdkRectangle clipRect; + + x = rControlRectangle.Left(); + y = rControlRectangle.Top(); + w = rControlRectangle.GetWidth(); + h = rControlRectangle.GetHeight(); + + 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_flat_box( gTooltipPopup->style, + gdkDrawable, + GTK_STATE_NORMAL, + GTK_SHADOW_OUT, + &clipRect, + gTooltipPopup, + "tooltip", + x, y, w, h ); + } + + return( TRUE ); +} + //---- static Rectangle NWGetListBoxButtonRect( ControlType nType, @@ -2789,6 +2844,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetInfoTextColor( aTextColor ); aStyleSet.SetWindowTextColor( aTextColor ); aStyleSet.SetFieldTextColor( aTextColor ); + aStyleSet.SetHelpTextColor( aTextColor ); // background colors Color aBackColor = getColor( pStyle->bg[GTK_STATE_NORMAL] ); @@ -2799,7 +2855,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetWorkspaceColor( aBackColor ); aStyleSet.SetFieldColor( aBackFieldColor ); aStyleSet.SetWindowColor( aBackFieldColor ); - // ancient wisdom tells us a mystic algorithm how to set checked color + aStyleSet.SetHelpColor( aBackColor ); + // ancient wisdom tells us a mystic algorithm how to set checked color if( aBackColor == COL_LIGHTGRAY ) aStyleSet.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); else @@ -3303,3 +3360,14 @@ static void NWEnsureGTKMenu(void) gWidgetDefaultFlags[ (long)gMenuItemMenuWidget ] = GTK_WIDGET_FLAGS( gMenuItemMenuWidget ); } } + +static void NWEnsureGTKTooltip(void) +{ + if( !gTooltipPopup ) + { + gTooltipPopup = gtk_window_new (GTK_WINDOW_POPUP); + gtk_widget_set_name (gTooltipPopup, "gtk-tooltips"); + gtk_widget_realize( gTooltipPopup ); + gtk_widget_ensure_style( gTooltipPopup ); + } +} |