corrected bug with alignment of static labels with GTK 2 (replaces patch 760066; closes bug 759375)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -149,6 +149,7 @@ wxGTK:
|
|||||||
be appended to filenames with no extension
|
be appended to filenames with no extension
|
||||||
- added wxTextCtrl::SetSelection implementation for GTK+ 2
|
- added wxTextCtrl::SetSelection implementation for GTK+ 2
|
||||||
- fixed wxTextCtrl::IsEditable() for GTK+ 2
|
- fixed wxTextCtrl::IsEditable() for GTK+ 2
|
||||||
|
- fixed wxStaticText alignment for GTK+ 2 (Kevin Hock)
|
||||||
- don't consume 100% CPU when showing a poup menu
|
- don't consume 100% CPU when showing a poup menu
|
||||||
|
|
||||||
wxMac:
|
wxMac:
|
||||||
|
@@ -22,6 +22,11 @@
|
|||||||
#include "gdk/gdk.h"
|
#include "gdk/gdk.h"
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
void wxgtk_window_size_request_callback(GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition,
|
||||||
|
wxWindow *win);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxStaticText
|
// wxStaticText
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -87,6 +92,23 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
// the bug below only happens with GTK 2
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
if ( justify != GTK_JUSTIFY_LEFT )
|
||||||
|
{
|
||||||
|
// if we let GTK call wxgtk_window_size_request_callback the label
|
||||||
|
// always shrinks to its minimal size for some reason and so no
|
||||||
|
// alignment except the default left doesn't work (in fact it does,
|
||||||
|
// but you don't see it)
|
||||||
|
gtk_signal_disconnect_by_func
|
||||||
|
(
|
||||||
|
GTK_OBJECT(m_widget),
|
||||||
|
GTK_SIGNAL_FUNC(wxgtk_window_size_request_callback),
|
||||||
|
(gpointer) this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif // __WXGTK20__
|
||||||
|
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
wxControl::SetFont( parent->GetFont() );
|
wxControl::SetFont( parent->GetFont() );
|
||||||
|
@@ -477,12 +477,18 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
|
|||||||
// "size_request" of m_widget
|
// "size_request" of m_widget
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void gtk_window_size_request_callback( GtkWidget *widget, GtkRequisition *requisition, wxWindow *win )
|
// make it extern because wxStatitText needs to disconnect this one
|
||||||
|
extern "C"
|
||||||
|
void wxgtk_window_size_request_callback(GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition,
|
||||||
|
wxWindow *win)
|
||||||
{
|
{
|
||||||
int w,h;
|
int w, h;
|
||||||
win->GetSize( &w, &h );
|
win->GetSize( &w, &h );
|
||||||
if (w < 2) w = 2;
|
if (w < 2)
|
||||||
if (h < 2) h = 2;
|
w = 2;
|
||||||
|
if (h < 2)
|
||||||
|
h = 2;
|
||||||
|
|
||||||
requisition->height = h;
|
requisition->height = h;
|
||||||
requisition->width = w;
|
requisition->width = w;
|
||||||
@@ -2797,7 +2803,7 @@ void wxWindowGTK::PostCreation()
|
|||||||
GTK_SIGNAL_FUNC(gtk_wxwindow_size_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_wxwindow_size_callback), (gpointer)this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GTK_IS_COMBO(m_widget))
|
if ( !GTK_IS_COMBO(m_widget))
|
||||||
{
|
{
|
||||||
// This is needed if we want to add our windows into native
|
// This is needed if we want to add our windows into native
|
||||||
// GTK control, such as the toolbar. With this callback, the
|
// GTK control, such as the toolbar. With this callback, the
|
||||||
@@ -2805,7 +2811,8 @@ void wxWindowGTK::PostCreation()
|
|||||||
// programmer). Sadly, it misbehaves for wxComboBox. FIXME
|
// programmer). Sadly, it misbehaves for wxComboBox. FIXME
|
||||||
// when moving to GTK 2.0.
|
// when moving to GTK 2.0.
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_request",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_request",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_size_request_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(wxgtk_window_size_request_callback),
|
||||||
|
(gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hasVMT = TRUE;
|
m_hasVMT = TRUE;
|
||||||
|
@@ -22,6 +22,11 @@
|
|||||||
#include "gdk/gdk.h"
|
#include "gdk/gdk.h"
|
||||||
#include "gtk/gtk.h"
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
void wxgtk_window_size_request_callback(GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition,
|
||||||
|
wxWindow *win);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxStaticText
|
// wxStaticText
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -87,6 +92,23 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
// the bug below only happens with GTK 2
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
if ( justify != GTK_JUSTIFY_LEFT )
|
||||||
|
{
|
||||||
|
// if we let GTK call wxgtk_window_size_request_callback the label
|
||||||
|
// always shrinks to its minimal size for some reason and so no
|
||||||
|
// alignment except the default left doesn't work (in fact it does,
|
||||||
|
// but you don't see it)
|
||||||
|
gtk_signal_disconnect_by_func
|
||||||
|
(
|
||||||
|
GTK_OBJECT(m_widget),
|
||||||
|
GTK_SIGNAL_FUNC(wxgtk_window_size_request_callback),
|
||||||
|
(gpointer) this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif // __WXGTK20__
|
||||||
|
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
wxControl::SetFont( parent->GetFont() );
|
wxControl::SetFont( parent->GetFont() );
|
||||||
|
@@ -477,12 +477,18 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
|
|||||||
// "size_request" of m_widget
|
// "size_request" of m_widget
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void gtk_window_size_request_callback( GtkWidget *widget, GtkRequisition *requisition, wxWindow *win )
|
// make it extern because wxStatitText needs to disconnect this one
|
||||||
|
extern "C"
|
||||||
|
void wxgtk_window_size_request_callback(GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition,
|
||||||
|
wxWindow *win)
|
||||||
{
|
{
|
||||||
int w,h;
|
int w, h;
|
||||||
win->GetSize( &w, &h );
|
win->GetSize( &w, &h );
|
||||||
if (w < 2) w = 2;
|
if (w < 2)
|
||||||
if (h < 2) h = 2;
|
w = 2;
|
||||||
|
if (h < 2)
|
||||||
|
h = 2;
|
||||||
|
|
||||||
requisition->height = h;
|
requisition->height = h;
|
||||||
requisition->width = w;
|
requisition->width = w;
|
||||||
@@ -2797,7 +2803,7 @@ void wxWindowGTK::PostCreation()
|
|||||||
GTK_SIGNAL_FUNC(gtk_wxwindow_size_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_wxwindow_size_callback), (gpointer)this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GTK_IS_COMBO(m_widget))
|
if ( !GTK_IS_COMBO(m_widget))
|
||||||
{
|
{
|
||||||
// This is needed if we want to add our windows into native
|
// This is needed if we want to add our windows into native
|
||||||
// GTK control, such as the toolbar. With this callback, the
|
// GTK control, such as the toolbar. With this callback, the
|
||||||
@@ -2805,7 +2811,8 @@ void wxWindowGTK::PostCreation()
|
|||||||
// programmer). Sadly, it misbehaves for wxComboBox. FIXME
|
// programmer). Sadly, it misbehaves for wxComboBox. FIXME
|
||||||
// when moving to GTK 2.0.
|
// when moving to GTK 2.0.
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_request",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_request",
|
||||||
GTK_SIGNAL_FUNC(gtk_window_size_request_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(wxgtk_window_size_request_callback),
|
||||||
|
(gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hasVMT = TRUE;
|
m_hasVMT = TRUE;
|
||||||
|
Reference in New Issue
Block a user