Merge branch 'WX_3_0_BRANCH' into wxPy-3.0-branch
This commit is contained in:
@@ -251,6 +251,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|||||||
}
|
}
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
GdkRGBA c;
|
GdkRGBA c;
|
||||||
|
gtk_style_context_set_state(sc, stateFlag);
|
||||||
gtk_style_context_get_color(sc, stateFlag, &c);
|
gtk_style_context_get_color(sc, stateFlag, &c);
|
||||||
attr.colFg = wxColour(c);
|
attr.colFg = wxColour(c);
|
||||||
gtk_style_context_get_background_color(sc, stateFlag, &c);
|
gtk_style_context_get_background_color(sc, stateFlag, &c);
|
||||||
@@ -319,7 +320,11 @@ wxSize wxControl::GTKGetPreferredSize(GtkWidget* widget) const
|
|||||||
{
|
{
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
|
int w, h;
|
||||||
|
gtk_widget_get_size_request(widget, &w, &h);
|
||||||
|
gtk_widget_set_size_request(widget, -1, -1);
|
||||||
gtk_widget_get_preferred_size(widget, NULL, &req);
|
gtk_widget_get_preferred_size(widget, NULL, &req);
|
||||||
|
gtk_widget_set_size_request(widget, w, h);
|
||||||
#else
|
#else
|
||||||
GTK_WIDGET_GET_CLASS(widget)->size_request(widget, &req);
|
GTK_WIDGET_GET_CLASS(widget)->size_request(widget, &req);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -155,33 +155,39 @@ static GtkWidget* ToolTipWidget()
|
|||||||
static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||||
{
|
{
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get_background_color(sc, state, &gdkRGBA);
|
gtk_style_context_get_background_color(sc, state, &gdkRGBA);
|
||||||
if (gdkRGBA.alpha <= 0)
|
if (gdkRGBA.alpha <= 0)
|
||||||
{
|
{
|
||||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||||
sc = gtk_widget_get_style_context(widget);
|
sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get_background_color(sc, state, &gdkRGBA);
|
gtk_style_context_get_background_color(sc, state, &gdkRGBA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void fg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
static void fg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||||
{
|
{
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get_color(sc, state, &gdkRGBA);
|
gtk_style_context_get_color(sc, state, &gdkRGBA);
|
||||||
if (gdkRGBA.alpha <= 0)
|
if (gdkRGBA.alpha <= 0)
|
||||||
{
|
{
|
||||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||||
sc = gtk_widget_get_style_context(widget);
|
sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get_color(sc, state, &gdkRGBA);
|
gtk_style_context_get_color(sc, state, &gdkRGBA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void border(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
static void border(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||||
{
|
{
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get_border_color(sc, state, &gdkRGBA);
|
gtk_style_context_get_border_color(sc, state, &gdkRGBA);
|
||||||
if (gdkRGBA.alpha <= 0)
|
if (gdkRGBA.alpha <= 0)
|
||||||
{
|
{
|
||||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||||
sc = gtk_widget_get_style_context(widget);
|
sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_set_state(sc, state);
|
||||||
gtk_style_context_get_border_color(sc, state, &gdkRGBA);
|
gtk_style_context_get_border_color(sc, state, &gdkRGBA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,6 +459,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(ButtonWidget());
|
GtkStyleContext* sc = gtk_widget_get_style_context(ButtonWidget());
|
||||||
|
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||||
gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL,
|
gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL,
|
||||||
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||||
#else
|
#else
|
||||||
|
@@ -196,7 +196,7 @@ wxSize wxSpinButton::DoGetBestSize() const
|
|||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);
|
GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);
|
||||||
GtkBorder pad = { 0, 0, 0, 0 };
|
GtkBorder pad = { 0, 0, 0, 0 };
|
||||||
gtk_style_context_get_padding(sc, GtkStateFlags(0), &pad);
|
gtk_style_context_get_padding(sc, gtk_style_context_get_state(sc), &pad);
|
||||||
best.x -= pad.left + pad.right;
|
best.x -= pad.left + pad.right;
|
||||||
#else
|
#else
|
||||||
gtk_widget_ensure_style(m_widget);
|
gtk_widget_ensure_style(m_widget);
|
||||||
|
@@ -1828,6 +1828,7 @@ void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)
|
|||||||
gtk_style_context_save(context);
|
gtk_style_context_save(context);
|
||||||
gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW);
|
gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW);
|
||||||
}
|
}
|
||||||
|
gtk_style_context_set_state(context, selectedFocused);
|
||||||
gtk_style_context_get_color(context, selectedFocused, &fg_orig);
|
gtk_style_context_get_color(context, selectedFocused, &fg_orig);
|
||||||
gtk_style_context_get_background_color(context, selectedFocused, &bg_orig);
|
gtk_style_context_get_background_color(context, selectedFocused, &bg_orig);
|
||||||
if (IsMultiLine())
|
if (IsMultiLine())
|
||||||
|
@@ -1194,6 +1194,14 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static gboolean reset_size_request(void* data)
|
||||||
|
{
|
||||||
|
gtk_widget_set_size_request(GTK_WIDGET(data), -1, -1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
|
void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
base_type::DoSetClientSize(width, height);
|
base_type::DoSetClientSize(width, height);
|
||||||
@@ -1202,6 +1210,25 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
|
|||||||
// Has to be done after calling base because it calls SetSize,
|
// Has to be done after calling base because it calls SetSize,
|
||||||
// which sets this true
|
// which sets this true
|
||||||
m_deferShowAllowed = false;
|
m_deferShowAllowed = false;
|
||||||
|
|
||||||
|
if (m_wxwindow)
|
||||||
|
{
|
||||||
|
// If window is not resizable or not yet shown, set size request on
|
||||||
|
// client widget, to make it more likely window will get correct size
|
||||||
|
// even if our decorations size cache is incorrect (as it will be before
|
||||||
|
// showing first TLW).
|
||||||
|
if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
|
||||||
|
{
|
||||||
|
gtk_widget_set_size_request(m_widget, -1, -1);
|
||||||
|
gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight);
|
||||||
|
}
|
||||||
|
else if (!IsShown())
|
||||||
|
{
|
||||||
|
gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight);
|
||||||
|
// Cancel size request at next idle to allow resizing
|
||||||
|
g_idle_add_full(G_PRIORITY_LOW, reset_size_request, m_wxwindow, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
|
void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
|
||||||
|
@@ -192,8 +192,24 @@ static void pizza_remove(GtkContainer* container, GtkWidget* widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
|
// Get preferred size of children, to avoid GTK+ warnings complaining
|
||||||
|
// that they were size-allocated without asking their preferred size
|
||||||
|
static void children_get_preferred_size(const GList* p)
|
||||||
|
{
|
||||||
|
for (; p; p = p->next)
|
||||||
|
{
|
||||||
|
const wxPizzaChild* child = static_cast<wxPizzaChild*>(p->data);
|
||||||
|
if (gtk_widget_get_visible(child->widget))
|
||||||
|
{
|
||||||
|
GtkRequisition req;
|
||||||
|
gtk_widget_get_preferred_size(child->widget, &req, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natural)
|
static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natural)
|
||||||
{
|
{
|
||||||
|
children_get_preferred_size(WX_PIZZA(widget)->m_children);
|
||||||
*minimum = 0;
|
*minimum = 0;
|
||||||
gtk_widget_get_size_request(widget, natural, NULL);
|
gtk_widget_get_size_request(widget, natural, NULL);
|
||||||
if (*natural < 0)
|
if (*natural < 0)
|
||||||
@@ -202,6 +218,7 @@ static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natu
|
|||||||
|
|
||||||
static void pizza_get_preferred_height(GtkWidget* widget, int* minimum, int* natural)
|
static void pizza_get_preferred_height(GtkWidget* widget, int* minimum, int* natural)
|
||||||
{
|
{
|
||||||
|
children_get_preferred_size(WX_PIZZA(widget)->m_children);
|
||||||
*minimum = 0;
|
*minimum = 0;
|
||||||
gtk_widget_get_size_request(widget, NULL, natural);
|
gtk_widget_get_size_request(widget, NULL, natural);
|
||||||
if (*natural < 0)
|
if (*natural < 0)
|
||||||
@@ -452,6 +469,7 @@ void wxPizza::get_border(GtkBorder& border)
|
|||||||
else
|
else
|
||||||
sc = gtk_widget_get_style_context(wxGTKPrivate::GetEntryWidget());
|
sc = gtk_widget_get_style_context(wxGTKPrivate::GetEntryWidget());
|
||||||
|
|
||||||
|
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||||
gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border);
|
gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border);
|
||||||
#else // !__WXGTK3__
|
#else // !__WXGTK3__
|
||||||
GtkStyle* style;
|
GtkStyle* style;
|
||||||
|
@@ -304,6 +304,7 @@ draw_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win)
|
|||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GtkStyleContext* sc = gtk_widget_get_style_context(win->m_wxwindow);
|
GtkStyleContext* sc = gtk_widget_get_style_context(win->m_wxwindow);
|
||||||
GdkRGBA c;
|
GdkRGBA c;
|
||||||
|
gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL);
|
||||||
gtk_style_context_get_border_color(sc, GTK_STATE_FLAG_NORMAL, &c);
|
gtk_style_context_get_border_color(sc, GTK_STATE_FLAG_NORMAL, &c);
|
||||||
gdk_cairo_set_source_rgba(cr, &c);
|
gdk_cairo_set_source_rgba(cr, &c);
|
||||||
cairo_set_line_width(cr, 1);
|
cairo_set_line_width(cr, 1);
|
||||||
@@ -4443,6 +4444,7 @@ void wxWindowGTK::GTKApplyStyle(GtkWidget* widget, GtkRcStyle* WXUNUSED_IN_GTK3(
|
|||||||
cairo_pattern_t* pattern = NULL;
|
cairo_pattern_t* pattern = NULL;
|
||||||
if (m_backgroundColour.IsOk())
|
if (m_backgroundColour.IsOk())
|
||||||
{
|
{
|
||||||
|
gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL);
|
||||||
gtk_style_context_get(context,
|
gtk_style_context_get(context,
|
||||||
GTK_STATE_FLAG_NORMAL, "background-image", &pattern, NULL);
|
GTK_STATE_FLAG_NORMAL, "background-image", &pattern, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -477,13 +477,13 @@ void wxPGProperty::Init()
|
|||||||
|
|
||||||
void wxPGProperty::Init( const wxString& label, const wxString& name )
|
void wxPGProperty::Init( const wxString& label, const wxString& name )
|
||||||
{
|
{
|
||||||
// We really need to check if &label and &name are NULL pointers
|
// wxPG_LABEL reference can be NULL if we are called before property
|
||||||
// (this can if we are called before property grid has been initalized)
|
// grid has been initialized
|
||||||
|
|
||||||
if ( (&label) != NULL && label != wxPG_LABEL )
|
if ( sm_wxPG_LABEL && label != wxPG_LABEL )
|
||||||
m_label = label;
|
m_label = label;
|
||||||
|
|
||||||
if ( (&name) != NULL && name != wxPG_LABEL )
|
if ( sm_wxPG_LABEL && name != wxPG_LABEL )
|
||||||
DoSetName( name );
|
DoSetName( name );
|
||||||
else
|
else
|
||||||
DoSetName( m_label );
|
DoSetName( m_label );
|
||||||
|
Reference in New Issue
Block a user