implemented tab order in wxGTK2
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -105,6 +105,11 @@ public:
|
|||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
virtual void AddChild( wxWindowBase *child );
|
||||||
|
virtual void RemoveChild( wxWindowBase *child );
|
||||||
|
#endif
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
// --------------
|
// --------------
|
||||||
@@ -229,6 +234,10 @@ public:
|
|||||||
bool m_hasFocus:1; // true if == FindFocus()
|
bool m_hasFocus:1; // true if == FindFocus()
|
||||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||||
|
// chain needs update
|
||||||
|
#endif
|
||||||
|
|
||||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||||
// different methods of inserting a child window into a wxFrame,
|
// different methods of inserting a child window into a wxFrame,
|
||||||
@@ -258,6 +267,13 @@ protected:
|
|||||||
// common part of all ctors (not virtual because called from ctor)
|
// common part of all ctors (not virtual because called from ctor)
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||||
|
|
||||||
|
// Copies m_children tab order to GTK focus chain:
|
||||||
|
void RealizeTabOrder();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||||
|
@@ -105,6 +105,11 @@ public:
|
|||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
virtual void AddChild( wxWindowBase *child );
|
||||||
|
virtual void RemoveChild( wxWindowBase *child );
|
||||||
|
#endif
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
// --------------
|
// --------------
|
||||||
@@ -229,6 +234,10 @@ public:
|
|||||||
bool m_hasFocus:1; // true if == FindFocus()
|
bool m_hasFocus:1; // true if == FindFocus()
|
||||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||||
|
// chain needs update
|
||||||
|
#endif
|
||||||
|
|
||||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||||
// different methods of inserting a child window into a wxFrame,
|
// different methods of inserting a child window into a wxFrame,
|
||||||
@@ -258,6 +267,13 @@ protected:
|
|||||||
// common part of all ctors (not virtual because called from ctor)
|
// common part of all ctors (not virtual because called from ctor)
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||||
|
|
||||||
|
// Copies m_children tab order to GTK focus chain:
|
||||||
|
void RealizeTabOrder();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||||
|
@@ -2655,6 +2655,7 @@ void wxWindowGTK::Init()
|
|||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
m_imData = NULL;
|
m_imData = NULL;
|
||||||
m_x11Context = NULL;
|
m_x11Context = NULL;
|
||||||
|
m_dirtyTabOrder = false;
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_XIM
|
#ifdef HAVE_XIM
|
||||||
m_ic = (GdkIC*) NULL;
|
m_ic = (GdkIC*) NULL;
|
||||||
@@ -3116,6 +3117,11 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
|
|||||||
|
|
||||||
void wxWindowGTK::OnInternalIdle()
|
void wxWindowGTK::OnInternalIdle()
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
if ( m_dirtyTabOrder )
|
||||||
|
RealizeTabOrder();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Update invalidated regions.
|
// Update invalidated regions.
|
||||||
GtkUpdate();
|
GtkUpdate();
|
||||||
|
|
||||||
@@ -3705,6 +3711,62 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child)
|
|||||||
(*m_insertCallback)(this, child);
|
(*m_insertCallback)(this, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
|
||||||
|
void wxWindowGTK::AddChild(wxWindowBase *child)
|
||||||
|
{
|
||||||
|
wxWindowBase::AddChild(child);
|
||||||
|
m_dirtyTabOrder = true;
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::RemoveChild(wxWindowBase *child)
|
||||||
|
{
|
||||||
|
wxWindowBase::RemoveChild(child);
|
||||||
|
m_dirtyTabOrder = true;
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
|
||||||
|
{
|
||||||
|
wxWindowBase::DoMoveInTabOrder(win, move);
|
||||||
|
m_dirtyTabOrder = true;
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::RealizeTabOrder()
|
||||||
|
{
|
||||||
|
if (m_wxwindow)
|
||||||
|
{
|
||||||
|
if (m_children.size() > 0)
|
||||||
|
{
|
||||||
|
GList *chain = NULL;
|
||||||
|
|
||||||
|
for (wxWindowList::const_iterator i = m_children.begin();
|
||||||
|
i != m_children.end(); ++i)
|
||||||
|
{
|
||||||
|
chain = g_list_prepend(chain, (*i)->m_widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
chain = g_list_reverse(chain);
|
||||||
|
|
||||||
|
gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain);
|
||||||
|
g_list_free(chain);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dirtyTabOrder = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __WXGTK20__
|
||||||
|
|
||||||
void wxWindowGTK::Raise()
|
void wxWindowGTK::Raise()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
||||||
|
@@ -2655,6 +2655,7 @@ void wxWindowGTK::Init()
|
|||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
m_imData = NULL;
|
m_imData = NULL;
|
||||||
m_x11Context = NULL;
|
m_x11Context = NULL;
|
||||||
|
m_dirtyTabOrder = false;
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_XIM
|
#ifdef HAVE_XIM
|
||||||
m_ic = (GdkIC*) NULL;
|
m_ic = (GdkIC*) NULL;
|
||||||
@@ -3116,6 +3117,11 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
|
|||||||
|
|
||||||
void wxWindowGTK::OnInternalIdle()
|
void wxWindowGTK::OnInternalIdle()
|
||||||
{
|
{
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
if ( m_dirtyTabOrder )
|
||||||
|
RealizeTabOrder();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Update invalidated regions.
|
// Update invalidated regions.
|
||||||
GtkUpdate();
|
GtkUpdate();
|
||||||
|
|
||||||
@@ -3705,6 +3711,62 @@ void wxWindowGTK::DoAddChild(wxWindowGTK *child)
|
|||||||
(*m_insertCallback)(this, child);
|
(*m_insertCallback)(this, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
|
||||||
|
void wxWindowGTK::AddChild(wxWindowBase *child)
|
||||||
|
{
|
||||||
|
wxWindowBase::AddChild(child);
|
||||||
|
m_dirtyTabOrder = true;
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::RemoveChild(wxWindowBase *child)
|
||||||
|
{
|
||||||
|
wxWindowBase::RemoveChild(child);
|
||||||
|
m_dirtyTabOrder = true;
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
|
||||||
|
{
|
||||||
|
wxWindowBase::DoMoveInTabOrder(win, move);
|
||||||
|
m_dirtyTabOrder = true;
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::RealizeTabOrder()
|
||||||
|
{
|
||||||
|
if (m_wxwindow)
|
||||||
|
{
|
||||||
|
if (m_children.size() > 0)
|
||||||
|
{
|
||||||
|
GList *chain = NULL;
|
||||||
|
|
||||||
|
for (wxWindowList::const_iterator i = m_children.begin();
|
||||||
|
i != m_children.end(); ++i)
|
||||||
|
{
|
||||||
|
chain = g_list_prepend(chain, (*i)->m_widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
chain = g_list_reverse(chain);
|
||||||
|
|
||||||
|
gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain);
|
||||||
|
g_list_free(chain);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dirtyTabOrder = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __WXGTK20__
|
||||||
|
|
||||||
void wxWindowGTK::Raise()
|
void wxWindowGTK::Raise()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
||||||
|
Reference in New Issue
Block a user