implement wxListBox::EnsureVisible() in wxGTK; add a test for it to the widgets sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -139,6 +139,7 @@ wxGTK:
|
|||||||
|
|
||||||
- Return false from wxEventLoop::Dispatch() if gtk_main_quit() was called and
|
- Return false from wxEventLoop::Dispatch() if gtk_main_quit() was called and
|
||||||
so the loop should exit (Rodolfo Schulz de Lima).
|
so the loop should exit (Rodolfo Schulz de Lima).
|
||||||
|
- Implement wxListBox::EnsureVisible() (Andreas Kling)
|
||||||
- Fixed wxCURSOR_HAND to map to GDK_HAND2 and not GDK_HAND1, for consistency
|
- Fixed wxCURSOR_HAND to map to GDK_HAND2 and not GDK_HAND1, for consistency
|
||||||
with other applications.
|
with other applications.
|
||||||
|
|
||||||
|
@@ -74,6 +74,8 @@ public:
|
|||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual int GetSelections(wxArrayInt& aSelections) const;
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
||||||
|
|
||||||
|
virtual void EnsureVisible(int n);
|
||||||
|
|
||||||
static wxVisualAttributes
|
static wxVisualAttributes
|
||||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
|
|
||||||
@@ -119,6 +121,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void Init(); //common construction
|
void Init(); //common construction
|
||||||
|
|
||||||
|
// common part of DoSetFirstItem() and EnsureVisible()
|
||||||
|
void DoScrollToCell(int n, float alignY, float alignX);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -906,7 +906,7 @@ void wxListBox::GtkSetSelection(int n, const bool select, const bool blockEvent)
|
|||||||
m_blockEvent = false;
|
m_blockEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::DoSetFirstItem( int n )
|
void wxListBox::DoScrollToCell(int n, float alignY, float alignX)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_treeview, wxT("invalid listbox") );
|
wxCHECK_RET( m_treeview, wxT("invalid listbox") );
|
||||||
wxCHECK_RET( IsValid(n), wxT("invalid index"));
|
wxCHECK_RET( IsValid(n), wxT("invalid index"));
|
||||||
@@ -928,11 +928,21 @@ void wxListBox::DoSetFirstItem( int n )
|
|||||||
|
|
||||||
// Scroll to the desired cell (0.0 == topleft alignment)
|
// Scroll to the desired cell (0.0 == topleft alignment)
|
||||||
gtk_tree_view_scroll_to_cell(m_treeview, path, NULL,
|
gtk_tree_view_scroll_to_cell(m_treeview, path, NULL,
|
||||||
TRUE, 0.0f, 0.0f);
|
TRUE, alignY, alignX);
|
||||||
|
|
||||||
gtk_tree_path_free(path);
|
gtk_tree_path_free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxListBox::DoSetFirstItem(int n)
|
||||||
|
{
|
||||||
|
DoScrollToCell(n, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListBox::EnsureVisible(int n)
|
||||||
|
{
|
||||||
|
DoScrollToCell(n, 0.5, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// hittest
|
// hittest
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user