Implement and test wxDataViewCtrl::GetColumnPosition() for GTK+
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -288,6 +288,7 @@ public:
|
|||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
GtkWidget* GetGtkHandle() { return m_column; }
|
GtkWidget* GetGtkHandle() { return m_column; }
|
||||||
|
GtkWidget* GetConstGtkHandle() const { return m_column; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// holds the GTK handle
|
// holds the GTK handle
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# =========================================================================
|
# =========================================================================
|
||||||
# This makefile was generated by
|
# This makefile was generated by
|
||||||
# Bakefile 0.2.1 (http://bakefile.sourceforge.net)
|
# Bakefile 0.2.2 (http://bakefile.sourceforge.net)
|
||||||
# Do not modify, all changes will be overwritten!
|
# Do not modify, all changes will be overwritten!
|
||||||
# =========================================================================
|
# =========================================================================
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@ TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
|
|||||||
EXTRALIBS = @EXTRALIBS@
|
EXTRALIBS = @EXTRALIBS@
|
||||||
EXTRALIBS_GUI = @EXTRALIBS_GUI@
|
EXTRALIBS_GUI = @EXTRALIBS_GUI@
|
||||||
EXTRALIBS_SDL = @EXTRALIBS_SDL@
|
EXTRALIBS_SDL = @EXTRALIBS_SDL@
|
||||||
|
CXXWARNINGS = @CXXWARNINGS@
|
||||||
HOST_SUFFIX = @HOST_SUFFIX@
|
HOST_SUFFIX = @HOST_SUFFIX@
|
||||||
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
|
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
|
||||||
SAMPLES_RPATH_POSTLINK = @SAMPLES_RPATH_POSTLINK@
|
SAMPLES_RPATH_POSTLINK = @SAMPLES_RPATH_POSTLINK@
|
||||||
@@ -45,7 +46,8 @@ WX_VERSION = $(WX_RELEASE).0
|
|||||||
LIBDIRNAME = $(wx_top_builddir)/lib
|
LIBDIRNAME = $(wx_top_builddir)/lib
|
||||||
DATAVIEW_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
DATAVIEW_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||||
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
|
||||||
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples $(CPPFLAGS) $(CXXFLAGS)
|
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples $(CXXWARNINGS) \
|
||||||
|
$(CPPFLAGS) $(CXXFLAGS)
|
||||||
DATAVIEW_OBJECTS = \
|
DATAVIEW_OBJECTS = \
|
||||||
$(__dataview_os2_lib_res) \
|
$(__dataview_os2_lib_res) \
|
||||||
dataview_dataview.o \
|
dataview_dataview.o \
|
||||||
@@ -189,7 +191,7 @@ dataview_dataview.o: $(srcdir)/dataview.cpp
|
|||||||
$(CXXC) -c -o $@ $(DATAVIEW_CXXFLAGS) $(srcdir)/dataview.cpp
|
$(CXXC) -c -o $@ $(DATAVIEW_CXXFLAGS) $(srcdir)/dataview.cpp
|
||||||
|
|
||||||
dataview_sample_rc.o: $(srcdir)/../sample.rc
|
dataview_sample_rc.o: $(srcdir)/../sample.rc
|
||||||
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) $(__EXCEPTIONS_DEFINE_p_2) $(__RTTI_DEFINE_p_2) $(__THREAD_DEFINE_p_2) --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_1) --include-dir $(top_srcdir)/include
|
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) $(__EXCEPTIONS_DEFINE_p_2) $(__RTTI_DEFINE_p_2) $(__THREAD_DEFINE_p_2) --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_1) --include-dir $(top_srcdir)/include
|
||||||
|
|
||||||
|
|
||||||
# Include dependency info, if present:
|
# Include dependency info, if present:
|
||||||
|
@@ -497,7 +497,7 @@ public:
|
|||||||
void OnExpanded( wxDataViewEvent &event );
|
void OnExpanded( wxDataViewEvent &event );
|
||||||
void OnCollapsing( wxDataViewEvent &event );
|
void OnCollapsing( wxDataViewEvent &event );
|
||||||
void OnCollapsed( wxDataViewEvent &event );
|
void OnCollapsed( wxDataViewEvent &event );
|
||||||
void OnSelected( wxDataViewEvent &event );
|
void OnSelectionChanged( wxDataViewEvent &event );
|
||||||
|
|
||||||
void OnEditingStarted( wxDataViewEvent &event );
|
void OnEditingStarted( wxDataViewEvent &event );
|
||||||
void OnEditingDone( wxDataViewEvent &event );
|
void OnEditingDone( wxDataViewEvent &event );
|
||||||
@@ -590,12 +590,11 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_DATAVIEW_ITEM_EXPANDED(ID_MUSIC_CTRL, MyFrame::OnExpanded)
|
EVT_DATAVIEW_ITEM_EXPANDED(ID_MUSIC_CTRL, MyFrame::OnExpanded)
|
||||||
EVT_DATAVIEW_ITEM_COLLAPSING(ID_MUSIC_CTRL, MyFrame::OnCollapsing)
|
EVT_DATAVIEW_ITEM_COLLAPSING(ID_MUSIC_CTRL, MyFrame::OnCollapsing)
|
||||||
EVT_DATAVIEW_ITEM_COLLAPSED(ID_MUSIC_CTRL, MyFrame::OnCollapsed)
|
EVT_DATAVIEW_ITEM_COLLAPSED(ID_MUSIC_CTRL, MyFrame::OnCollapsed)
|
||||||
EVT_DATAVIEW_ITEM_SELECTED(ID_MUSIC_CTRL, MyFrame::OnSelected)
|
EVT_DATAVIEW_SELECTION_CHANGED(ID_MUSIC_CTRL, MyFrame::OnSelectionChanged)
|
||||||
|
|
||||||
EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL, MyFrame::OnEditingStarted)
|
EVT_DATAVIEW_ITEM_EDITING_STARTED(ID_MUSIC_CTRL, MyFrame::OnEditingStarted)
|
||||||
EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL, MyFrame::OnEditingDone)
|
EVT_DATAVIEW_ITEM_EDITING_DONE(ID_MUSIC_CTRL, MyFrame::OnEditingDone)
|
||||||
|
|
||||||
|
|
||||||
EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderClick)
|
EVT_DATAVIEW_COLUMN_HEADER_CLICK(ID_MUSIC_CTRL, MyFrame::OnHeaderClick)
|
||||||
EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(ID_MUSIC_CTRL, MyFrame::OnHeaderRightClick)
|
EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(ID_MUSIC_CTRL, MyFrame::OnHeaderRightClick)
|
||||||
EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL, MyFrame::OnSorted)
|
EVT_DATAVIEW_COLUMN_SORTED(ID_MUSIC_CTRL, MyFrame::OnSorted)
|
||||||
@@ -755,15 +754,15 @@ void MyFrame::OnActivated( wxDataViewEvent &event )
|
|||||||
if(!m_log)
|
if(!m_log)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item Id: %d; Column: %d", event.GetItem().GetID(), event.GetColumn());
|
wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item Id: %d", event.GetItem().GetID() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnSelected( wxDataViewEvent &event )
|
void MyFrame::OnSelectionChanged( wxDataViewEvent &event )
|
||||||
{
|
{
|
||||||
if(!m_log)
|
if(!m_log)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxLogMessage("wxEVT_COMMAND_DATAVIEW_ITEM_SELECTED, Item Id: %d", event.GetItem().GetID() );
|
wxLogMessage("wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, First selected Item: %d", event.GetItem().GetID() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnExpanding( wxDataViewEvent &event )
|
void MyFrame::OnExpanding( wxDataViewEvent &event )
|
||||||
@@ -819,8 +818,10 @@ void MyFrame::OnHeaderClick( wxDataViewEvent &event )
|
|||||||
{
|
{
|
||||||
if(!m_log)
|
if(!m_log)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int pos = m_musicCtrl->GetColumnPosition( event.GetDataViewColumn() );
|
||||||
|
|
||||||
wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column: %d", event.GetColumn());
|
wxLogMessage("wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, Column position: %d", pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )
|
void MyFrame::OnHeaderRightClick( wxDataViewEvent &event )
|
||||||
|
@@ -3114,7 +3114,15 @@ bool wxDataViewCtrl::ClearColumns()
|
|||||||
|
|
||||||
int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const
|
int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const
|
||||||
{
|
{
|
||||||
return -1;
|
GtkTreeViewColumn *gtk_column = GTK_TREE_VIEW_COLUMN(column->GetConstGtkHandle());
|
||||||
|
|
||||||
|
GList *list = gtk_tree_view_get_columns( GTK_TREE_VIEW(m_treeview) );
|
||||||
|
|
||||||
|
gint pos = g_list_index( list, (gconstpointer) gtk_column );
|
||||||
|
|
||||||
|
g_list_free( list );
|
||||||
|
|
||||||
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const
|
wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const
|
||||||
|
Reference in New Issue
Block a user