From 863e0817feef71dbc6d0469d23651ff42e7cc730 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 4 Mar 2005 19:14:24 +0000 Subject: [PATCH] Trying to get default button placement and size right. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 45 ++++++++++++++++++++++++++++++++++++--------- src/gtk1/window.cpp | 45 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 72 insertions(+), 18 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index dbc991b9b2..969e4b655f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3102,22 +3102,49 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; - int border = 0; + int left_border = 0; + int right_border = 0; + int top_border = 0; int bottom_border = 0; -#ifndef __WXGTK20__ + /* the default button has a border around it */ if (GTK_WIDGET_CAN_DEFAULT(m_widget)) { - /* the default button has a border around it */ - border = 6; +#ifdef __WXGTK20__ +#if 0 + GtkBorder *default_border; + gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); + if (default_border) + { + left_border += default_border->left; + right_border += default_border->right; + top_border += default_border->top; + bottom_border += default_border->bottom; + g_free( default_border ); + + } +#endif + GtkBorder *default_outside_border; + { + gtk_widget_style_get( m_widget, "default_outside_border", &default_outside_border, NULL ); + left_border += default_outside_border->left; + right_border += default_outside_border->right; + top_border += default_outside_border->top; + bottom_border += default_outside_border->bottom; + g_free( default_outside_border ); + } +#else + left_border = 6; + right_border = 6; + top_border = 6; bottom_border = 5; - } #endif + } - DoMoveWindow( m_x-border, - m_y-border, - m_width+2*border, - m_height+border+bottom_border ); + DoMoveWindow( m_x-top_border, + m_y-left_border, + m_width+left_border+right_border, + m_height+top_border+bottom_border ); } if (m_hasScrolling) diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index dbc991b9b2..969e4b655f 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -3102,22 +3102,49 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; - int border = 0; + int left_border = 0; + int right_border = 0; + int top_border = 0; int bottom_border = 0; -#ifndef __WXGTK20__ + /* the default button has a border around it */ if (GTK_WIDGET_CAN_DEFAULT(m_widget)) { - /* the default button has a border around it */ - border = 6; +#ifdef __WXGTK20__ +#if 0 + GtkBorder *default_border; + gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); + if (default_border) + { + left_border += default_border->left; + right_border += default_border->right; + top_border += default_border->top; + bottom_border += default_border->bottom; + g_free( default_border ); + + } +#endif + GtkBorder *default_outside_border; + { + gtk_widget_style_get( m_widget, "default_outside_border", &default_outside_border, NULL ); + left_border += default_outside_border->left; + right_border += default_outside_border->right; + top_border += default_outside_border->top; + bottom_border += default_outside_border->bottom; + g_free( default_outside_border ); + } +#else + left_border = 6; + right_border = 6; + top_border = 6; bottom_border = 5; - } #endif + } - DoMoveWindow( m_x-border, - m_y-border, - m_width+2*border, - m_height+border+bottom_border ); + DoMoveWindow( m_x-top_border, + m_y-left_border, + m_width+left_border+right_border, + m_height+top_border+bottom_border ); } if (m_hasScrolling) -- 2.45.2