wxScrolledWindow inherits from wxPanel to
make tab travseral work. Work around for GTK scrolledwidget bug. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,10 +17,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
|
#include "wx/panel.h"
|
||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxScrolledWindow: public wxWindow
|
class WXDLLEXPORT wxScrolledWindow: public wxPanel
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(wxScrolledWindow)
|
DECLARE_ABSTRACT_CLASS(wxScrolledWindow)
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
|
#include "wx/listctrl.h"
|
||||||
|
|
||||||
// derived classes
|
// derived classes
|
||||||
|
|
||||||
@@ -98,7 +99,23 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
(void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices );
|
(void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices );
|
||||||
|
|
||||||
SetBackgroundColour( *wxWHITE );
|
wxListCtrl *m_listCtrl = new wxListCtrl(
|
||||||
|
this, -1, wxPoint(200, 10), wxSize(180, 120),
|
||||||
|
wxLC_REPORT | wxSUNKEN_BORDER);
|
||||||
|
|
||||||
|
m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90);
|
||||||
|
m_listCtrl->InsertColumn(1, "Last", wxLIST_FORMAT_LEFT, 90);
|
||||||
|
|
||||||
|
for ( int i=0; i < 30; i++)
|
||||||
|
{
|
||||||
|
char buf[20];
|
||||||
|
sprintf(buf, "Item %d", i);
|
||||||
|
m_listCtrl->InsertItem(i, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
(void) new wxListBox( this, -1, wxPoint(200,180), wxSize(180,120), 5, choices, wxLB_ALWAYS_SB );
|
||||||
|
|
||||||
|
SetBackgroundColour( "WHEAT" );
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas()
|
MyCanvas::~MyCanvas()
|
||||||
|
@@ -25,15 +25,16 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/generic/scrolwin.h"
|
#include "wx/generic/scrolwin.h"
|
||||||
|
#include "wx/panel.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow)
|
BEGIN_EVENT_TABLE(wxScrolledWindow, wxPanel)
|
||||||
EVT_SCROLLWIN(wxScrolledWindow::OnScroll)
|
EVT_SCROLLWIN(wxScrolledWindow::OnScroll)
|
||||||
EVT_SIZE(wxScrolledWindow::OnSize)
|
EVT_SIZE(wxScrolledWindow::OnSize)
|
||||||
EVT_PAINT(wxScrolledWindow::OnPaint)
|
EVT_PAINT(wxScrolledWindow::OnPaint)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@@ -80,7 +81,7 @@ bool wxScrolledWindow::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_scaleX = 1.0;
|
m_scaleX = 1.0;
|
||||||
m_scaleY = 1.0;
|
m_scaleY = 1.0;
|
||||||
|
|
||||||
return wxWindow::Create(parent, id, pos, size, style, name);
|
return wxPanel::Create(parent, id, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -79,7 +79,6 @@ gtk_myfixed_get_type ()
|
|||||||
(GtkArgGetFunc) NULL,
|
(GtkArgGetFunc) NULL,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
myfixed_type = gtk_type_unique (gtk_container_get_type (), &myfixed_info);
|
myfixed_type = gtk_type_unique (gtk_container_get_type (), &myfixed_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +172,8 @@ gtk_myfixed_new ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
void gtk_myfixed_scroll_set_adjustments (GtkMyFixed *myfixed,
|
void
|
||||||
|
gtk_myfixed_scroll_set_adjustments (GtkMyFixed *myfixed,
|
||||||
GtkAdjustment *hadj,
|
GtkAdjustment *hadj,
|
||||||
GtkAdjustment *vadj)
|
GtkAdjustment *vadj)
|
||||||
{
|
{
|
||||||
@@ -331,8 +331,16 @@ gtk_myfixed_set_size (GtkMyFixed *myfixed,
|
|||||||
{
|
{
|
||||||
child_allocation.x = child->x;
|
child_allocation.x = child->x;
|
||||||
child_allocation.y = child->y;
|
child_allocation.y = child->y;
|
||||||
child_allocation.width = child->width;
|
child_allocation.width = MAX( child->width, 1 );
|
||||||
child_allocation.height = child->height;
|
child_allocation.height = MAX( child->height, 1 );
|
||||||
|
|
||||||
|
/* work around for GTK bug when moving widgets outside
|
||||||
|
the X window -> do NOT move them entirely outside */
|
||||||
|
if (child_allocation.y + child_allocation.height < 0)
|
||||||
|
child_allocation.y = -child_allocation.height;
|
||||||
|
if (child_allocation.x + child_allocation.width < 0)
|
||||||
|
child_allocation.x = -child_allocation.width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (widget, &child_allocation);
|
gtk_widget_size_allocate (widget, &child_allocation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -340,7 +348,6 @@ gtk_myfixed_set_size (GtkMyFixed *myfixed,
|
|||||||
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
|
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,8 +372,7 @@ gtk_myfixed_map (GtkWidget *widget)
|
|||||||
child = children->data;
|
child = children->data;
|
||||||
children = children->next;
|
children = children->next;
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (child->widget) &&
|
if (GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget))
|
||||||
!GTK_WIDGET_MAPPED (child->widget))
|
|
||||||
gtk_widget_map (child->widget);
|
gtk_widget_map (child->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,10 +447,9 @@ gtk_myfixed_realize (GtkWidget *widget)
|
|||||||
GDK_ENTER_NOTIFY_MASK |
|
GDK_ENTER_NOTIFY_MASK |
|
||||||
GDK_LEAVE_NOTIFY_MASK |
|
GDK_LEAVE_NOTIFY_MASK |
|
||||||
GDK_FOCUS_CHANGE_MASK;
|
GDK_FOCUS_CHANGE_MASK;
|
||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||||
|
|
||||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
|
widget->window = gdk_window_new( gtk_widget_get_parent_window (widget), &attributes,
|
||||||
attributes_mask);
|
attributes_mask);
|
||||||
gdk_window_set_user_data (widget->window, widget);
|
gdk_window_set_user_data (widget->window, widget);
|
||||||
|
|
||||||
@@ -533,18 +538,24 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
|
|||||||
test GTK_WIDGET_REALIZED() has to be here */
|
test GTK_WIDGET_REALIZED() has to be here */
|
||||||
if (GTK_WIDGET_VISIBLE (child->widget))
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
||||||
{
|
{
|
||||||
/*
|
/* if (GTK_IS_NOTEBOOK(child->widget) && !GTK_WIDGET_REALIZED(child->widget))
|
||||||
if (GTK_IS_NOTEBOOK(child->widget) && !GTK_WIDGET_REALIZED(child->widget))
|
|
||||||
{
|
{
|
||||||
gtk_widget_queue_resize( child->widget );
|
gtk_widget_queue_resize( child->widget );
|
||||||
}
|
}
|
||||||
else
|
else */
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
child_allocation.x = child->x;
|
child_allocation.x = child->x;
|
||||||
child_allocation.y = child->y;
|
child_allocation.y = child->y;
|
||||||
child_allocation.width = child->width;
|
child_allocation.width = MAX( child->width, 1 );
|
||||||
child_allocation.height = child->height;
|
child_allocation.height = MAX( child->height, 1 );
|
||||||
|
|
||||||
|
/* work around for GTK bug when moving widgets outside
|
||||||
|
the X window -> do NOT move them entirely outside */
|
||||||
|
if (child_allocation.y + child_allocation.height < 0)
|
||||||
|
child_allocation.y = -child_allocation.height;
|
||||||
|
if (child_allocation.x + child_allocation.width < 0)
|
||||||
|
child_allocation.x = -child_allocation.width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -635,7 +635,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// win is a control: tab can be propagated up
|
/* win is a control: tab can be propagated up */
|
||||||
if ( (!ret) &&
|
if ( (!ret) &&
|
||||||
((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
|
((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
|
||||||
(win->HasFlag(wxTE_PROCESS_TAB) == 0))
|
(win->HasFlag(wxTE_PROCESS_TAB) == 0))
|
||||||
|
@@ -79,7 +79,6 @@ gtk_myfixed_get_type ()
|
|||||||
(GtkArgGetFunc) NULL,
|
(GtkArgGetFunc) NULL,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
myfixed_type = gtk_type_unique (gtk_container_get_type (), &myfixed_info);
|
myfixed_type = gtk_type_unique (gtk_container_get_type (), &myfixed_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +172,8 @@ gtk_myfixed_new ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
void gtk_myfixed_scroll_set_adjustments (GtkMyFixed *myfixed,
|
void
|
||||||
|
gtk_myfixed_scroll_set_adjustments (GtkMyFixed *myfixed,
|
||||||
GtkAdjustment *hadj,
|
GtkAdjustment *hadj,
|
||||||
GtkAdjustment *vadj)
|
GtkAdjustment *vadj)
|
||||||
{
|
{
|
||||||
@@ -331,8 +331,16 @@ gtk_myfixed_set_size (GtkMyFixed *myfixed,
|
|||||||
{
|
{
|
||||||
child_allocation.x = child->x;
|
child_allocation.x = child->x;
|
||||||
child_allocation.y = child->y;
|
child_allocation.y = child->y;
|
||||||
child_allocation.width = child->width;
|
child_allocation.width = MAX( child->width, 1 );
|
||||||
child_allocation.height = child->height;
|
child_allocation.height = MAX( child->height, 1 );
|
||||||
|
|
||||||
|
/* work around for GTK bug when moving widgets outside
|
||||||
|
the X window -> do NOT move them entirely outside */
|
||||||
|
if (child_allocation.y + child_allocation.height < 0)
|
||||||
|
child_allocation.y = -child_allocation.height;
|
||||||
|
if (child_allocation.x + child_allocation.width < 0)
|
||||||
|
child_allocation.x = -child_allocation.width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (widget, &child_allocation);
|
gtk_widget_size_allocate (widget, &child_allocation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -340,7 +348,6 @@ gtk_myfixed_set_size (GtkMyFixed *myfixed,
|
|||||||
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
|
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,8 +372,7 @@ gtk_myfixed_map (GtkWidget *widget)
|
|||||||
child = children->data;
|
child = children->data;
|
||||||
children = children->next;
|
children = children->next;
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (child->widget) &&
|
if (GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget))
|
||||||
!GTK_WIDGET_MAPPED (child->widget))
|
|
||||||
gtk_widget_map (child->widget);
|
gtk_widget_map (child->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,10 +447,9 @@ gtk_myfixed_realize (GtkWidget *widget)
|
|||||||
GDK_ENTER_NOTIFY_MASK |
|
GDK_ENTER_NOTIFY_MASK |
|
||||||
GDK_LEAVE_NOTIFY_MASK |
|
GDK_LEAVE_NOTIFY_MASK |
|
||||||
GDK_FOCUS_CHANGE_MASK;
|
GDK_FOCUS_CHANGE_MASK;
|
||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||||
|
|
||||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
|
widget->window = gdk_window_new( gtk_widget_get_parent_window (widget), &attributes,
|
||||||
attributes_mask);
|
attributes_mask);
|
||||||
gdk_window_set_user_data (widget->window, widget);
|
gdk_window_set_user_data (widget->window, widget);
|
||||||
|
|
||||||
@@ -533,18 +538,24 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
|
|||||||
test GTK_WIDGET_REALIZED() has to be here */
|
test GTK_WIDGET_REALIZED() has to be here */
|
||||||
if (GTK_WIDGET_VISIBLE (child->widget))
|
if (GTK_WIDGET_VISIBLE (child->widget))
|
||||||
{
|
{
|
||||||
/*
|
/* if (GTK_IS_NOTEBOOK(child->widget) && !GTK_WIDGET_REALIZED(child->widget))
|
||||||
if (GTK_IS_NOTEBOOK(child->widget) && !GTK_WIDGET_REALIZED(child->widget))
|
|
||||||
{
|
{
|
||||||
gtk_widget_queue_resize( child->widget );
|
gtk_widget_queue_resize( child->widget );
|
||||||
}
|
}
|
||||||
else
|
else */
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
child_allocation.x = child->x;
|
child_allocation.x = child->x;
|
||||||
child_allocation.y = child->y;
|
child_allocation.y = child->y;
|
||||||
child_allocation.width = child->width;
|
child_allocation.width = MAX( child->width, 1 );
|
||||||
child_allocation.height = child->height;
|
child_allocation.height = MAX( child->height, 1 );
|
||||||
|
|
||||||
|
/* work around for GTK bug when moving widgets outside
|
||||||
|
the X window -> do NOT move them entirely outside */
|
||||||
|
if (child_allocation.y + child_allocation.height < 0)
|
||||||
|
child_allocation.y = -child_allocation.height;
|
||||||
|
if (child_allocation.x + child_allocation.width < 0)
|
||||||
|
child_allocation.x = -child_allocation.width;
|
||||||
|
|
||||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -635,7 +635,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// win is a control: tab can be propagated up
|
/* win is a control: tab can be propagated up */
|
||||||
if ( (!ret) &&
|
if ( (!ret) &&
|
||||||
((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
|
((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
|
||||||
(win->HasFlag(wxTE_PROCESS_TAB) == 0))
|
(win->HasFlag(wxTE_PROCESS_TAB) == 0))
|
||||||
|
Reference in New Issue
Block a user