Merge branch 'gtk-dvc-custom-edit'
Fix regression with custom wxDataViewCtrl editors in wxGTK. See https://github.com/wxWidgets/wxWidgets/pull/660
This commit is contained in:
@@ -180,6 +180,7 @@ wxGTK:
|
|||||||
- Fix wxTextCtrl::GetStyle() with GTK+ 3.
|
- Fix wxTextCtrl::GetStyle() with GTK+ 3.
|
||||||
- Fix wxButton::SetBitmapPosition() with GTK+ 3 (Jake Nelson).
|
- Fix wxButton::SetBitmapPosition() with GTK+ 3 (Jake Nelson).
|
||||||
- Support background colour in wxDataViewCtrl attributes.
|
- Support background colour in wxDataViewCtrl attributes.
|
||||||
|
- Fix regression with showing custom wxDataViewCtrl editors.
|
||||||
- Improve wxSpinCtrl best size calculation.
|
- Improve wxSpinCtrl best size calculation.
|
||||||
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
|
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
|
||||||
- Improve wxRadioBox appearance in high DPI (Arrigo Marchiori, Maarten Bent).
|
- Improve wxRadioBox appearance in high DPI (Arrigo Marchiori, Maarten Bent).
|
||||||
|
@@ -1151,12 +1151,34 @@ extern "C" {
|
|||||||
|
|
||||||
#define GTK_TYPE_WX_CELL_EDITOR_BIN (gtk_wx_cell_editor_bin_get_type ())
|
#define GTK_TYPE_WX_CELL_EDITOR_BIN (gtk_wx_cell_editor_bin_get_type ())
|
||||||
#define GTK_WX_CELL_EDITOR_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WX_CELL_EDITOR_BIN, GtkWxCellEditorBin))
|
#define GTK_WX_CELL_EDITOR_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WX_CELL_EDITOR_BIN, GtkWxCellEditorBin))
|
||||||
#define GTK_IS_WX_CELL_EDITOR_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WX_CELL_EDITOR_BIN))
|
|
||||||
#define GTK_IS_WX_CELL_EDITOR_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WX_CELL_EDITOR_BIN))
|
// In GTK+ < 3.8 GtkBin can't be used as widget base type without defining our
|
||||||
|
// own size_allocate and related (either size_request for GTK+ 2 or
|
||||||
|
// get_preferred_height for GTK+ 3) vfuncs, so we use GtkHBox instead. But in
|
||||||
|
// GTK+ 4, GtkHBox is removed, so we do use GtkBin with it.
|
||||||
|
#ifdef __WXGTK4__
|
||||||
|
typedef GtkBin GtkWxCellEditorBinBase;
|
||||||
|
typedef GtkBinClass GtkWxCellEditorBinBaseClass;
|
||||||
|
|
||||||
|
// Notice that this can't be just a (const) variable as GTK+ type constants
|
||||||
|
// are actually macros expanding into function calls, which shouldn't be
|
||||||
|
// performed before the library is initialized, so we need to use either an
|
||||||
|
// inline function or a define, which is simpler.
|
||||||
|
#define GtkWxCellEditorBinBaseType GTK_TYPE_BIN
|
||||||
|
#else // GTK+ < 4
|
||||||
|
// GtkHBox is deprecated since 3.2, so avoid warnings about using it.
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
|
|
||||||
|
typedef GtkHBox GtkWxCellEditorBinBase;
|
||||||
|
typedef GtkHBoxClass GtkWxCellEditorBinBaseClass;
|
||||||
|
#define GtkWxCellEditorBinBaseType GTK_TYPE_HBOX
|
||||||
|
|
||||||
|
wxGCC_WARNING_RESTORE(deprecated-declarations)
|
||||||
|
#endif // GTK+ version
|
||||||
|
|
||||||
struct GtkWxCellEditorBin
|
struct GtkWxCellEditorBin
|
||||||
{
|
{
|
||||||
GtkBin parent;
|
GtkWxCellEditorBinBase parent;
|
||||||
|
|
||||||
// The actual user-created editor.
|
// The actual user-created editor.
|
||||||
wxWindow* editor;
|
wxWindow* editor;
|
||||||
@@ -1184,7 +1206,7 @@ gtk_wx_cell_editor_bin_get_type()
|
|||||||
{
|
{
|
||||||
const GTypeInfo cell_editor_bin_info =
|
const GTypeInfo cell_editor_bin_info =
|
||||||
{
|
{
|
||||||
sizeof (GtkBinClass),
|
sizeof (GtkWxCellEditorBinBaseClass),
|
||||||
NULL, /* base_init */
|
NULL, /* base_init */
|
||||||
NULL, /* base_finalize */
|
NULL, /* base_finalize */
|
||||||
gtk_wx_cell_editor_bin_class_init,
|
gtk_wx_cell_editor_bin_class_init,
|
||||||
@@ -1196,7 +1218,8 @@ gtk_wx_cell_editor_bin_get_type()
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
cell_editor_bin_type = g_type_register_static( GTK_TYPE_BIN,
|
cell_editor_bin_type = g_type_register_static(
|
||||||
|
GtkWxCellEditorBinBaseType,
|
||||||
"GtkWxCellEditorBin", &cell_editor_bin_info, (GTypeFlags)0 );
|
"GtkWxCellEditorBin", &cell_editor_bin_info, (GTypeFlags)0 );
|
||||||
|
|
||||||
|
|
||||||
@@ -1422,7 +1445,7 @@ gtk_wx_cell_renderer_new (void)
|
|||||||
static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
|
static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
|
||||||
GtkCellRenderer *renderer,
|
GtkCellRenderer *renderer,
|
||||||
GdkEvent *WXUNUSED(event),
|
GdkEvent *WXUNUSED(event),
|
||||||
GtkWidget *widget,
|
GtkWidget *WXUNUSED(widget),
|
||||||
const gchar *path,
|
const gchar *path,
|
||||||
wxConstGdkRect *WXUNUSED(background_area),
|
wxConstGdkRect *WXUNUSED(background_area),
|
||||||
wxConstGdkRect *cell_area,
|
wxConstGdkRect *cell_area,
|
||||||
@@ -1439,25 +1462,10 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing(
|
|||||||
if (cell->GetEditorCtrl())
|
if (cell->GetEditorCtrl())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GdkRectangle rect;
|
|
||||||
gtk_wx_cell_renderer_get_size (renderer, widget, cell_area,
|
|
||||||
&rect.x,
|
|
||||||
&rect.y,
|
|
||||||
&rect.width,
|
|
||||||
&rect.height);
|
|
||||||
|
|
||||||
rect.x += cell_area->x;
|
|
||||||
rect.y += cell_area->y;
|
|
||||||
// rect.width -= renderer->xpad * 2;
|
|
||||||
// rect.height -= renderer->ypad * 2;
|
|
||||||
|
|
||||||
// wxRect renderrect(wxRectFromGDKRect(&rect));
|
|
||||||
wxRect renderrect(wxRectFromGDKRect(cell_area));
|
|
||||||
|
|
||||||
wxDataViewItem
|
wxDataViewItem
|
||||||
item(cell->GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(path)));
|
item(cell->GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(path)));
|
||||||
|
|
||||||
if (!cell->StartEditing(item, renderrect))
|
if (!cell->StartEditing(item, wxRectFromGDKRect(cell_area)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wxrenderer->editor_bin = gtk_wx_cell_editor_bin_new(cell->GetEditorCtrl());
|
wxrenderer->editor_bin = gtk_wx_cell_editor_bin_new(cell->GetEditorCtrl());
|
||||||
|
Reference in New Issue
Block a user