#include <wx/scrolwin.h>
#include "wx/gizmos/treelistctrl.h"
-//#include "treelistctrl.h"
-
#ifdef __WXGTK__
#include <gtk/gtk.h>
// select this item
void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE,
bool extended_select=FALSE);
+ void SelectAll(bool extended_select=FALSE);
// make sure this item is visible (expanding the parent item and/or
// scrolling to this item if necessary)
void EnsureVisible(const wxTreeItemId& item);
int numColumns = GetColumnCount();
for ( int i = 0; i < numColumns && x < w; i++ )
{
+ if (!GetColumnShown (i)) continue;
+
wxTreeListColumnInfo& column = GetColumn(i);
int wCol = column.GetWidth();
return res;
}
- wxTreeListHeaderWindow* header_win = theCtrl->m_owner->GetHeaderWindow();
+ wxTreeListHeaderWindow* header_win = theCtrl->m_owner->GetHeaderWindow();
if (point.x >= header_win->GetWidth())
column = -1;
else if(flags & wxTREE_HITTEST_ONITEMINDENT) {
int x = 0;
for(size_t i = 0; i < theCtrl->GetMainColumn(); ++i) {
- if (!header_win->GetColumnShown(i)) continue;
+ if (!header_win->GetColumnShown(i)) continue;
int w = header_win->GetColumnWidth(i);
if(point.x >= x && point.x < x+w) {
flags ^= wxTREE_HITTEST_ONITEMINDENT;
int x = 0;
size_t i;
for(i = 0; i < theCtrl->GetMainColumn()+1; ++i) {
- if (!header_win->GetColumnShown(i)) continue;
+ if (!header_win->GetColumnShown(i)) continue;
x += header_win->GetColumnWidth(i);
}
for(i = theCtrl->GetMainColumn()+1; i < theCtrl->GetColumnCount(); ++i) {
- if (!header_win->GetColumnShown(i)) continue;
+ if (!header_win->GetColumnShown(i)) continue;
int w = header_win->GetColumnWidth(i);
if(point.x >= x && point.x < x+w) {
flags ^= wxTREE_HITTEST_ONITEMRIGHT;
GetEventHandler()->ProcessEvent( event );
}
+void wxTreeListMainWindow::SelectAll(bool extended_select)
+{
+ wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style") );
+
+ wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() );
+ event.SetItem( GetRootItem() );
+ event.SetOldItem( (long) m_current );
+ event.SetEventObject( /*this*/m_owner );
+ // TODO : Here we don't send any selection mode yet !
+
+ if(m_owner->GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed())
+ return;
+
+ // shift press
+ if (!extended_select)
+ {
+
+ }
+ else
+ {
+
+ }
+ long cookie = 0;
+ wxTreeItemId root = GetRootItem();
+ wxTreeListItem *first = (wxTreeListItem *)GetFirstChild (root, cookie).m_pItem;
+ wxTreeListItem *last = (wxTreeListItem *)GetLastChild (GetRootItem()).m_pItem;
+ if (TagAllChildrenUntilLast (first, last, true)) return;
+ TagNextChildren (first, last, true);
+
+ event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
+ GetEventHandler()->ProcessEvent( event );
+}
+
void wxTreeListMainWindow::FillArray(wxTreeListItem *item,
wxArrayTreeItemIds &array) const
{
bool extended_select)
{ m_main_win->SelectItem(item, unselect_others, extended_select); }
+void wxTreeListCtrl::SelectAll(bool extended_select)
+{ m_main_win->SelectAll(extended_select); }
+
void wxTreeListCtrl::EnsureVisible(const wxTreeItemId& item)
{ m_main_win->EnsureVisible(item); }
void wxTreeListCtrl::ShowColumn(size_t column, bool shown)
{
- m_header_win->SetColumn(column, GetColumn(column).SetShown(shown));
+ wxASSERT_MSG( column != GetMainColumn(),
+ wxT("The main column may not be hidden") );
+ m_header_win->SetColumn(column, GetColumn(column).SetShown(GetMainColumn()? true: shown));
}
bool wxTreeListCtrl::IsColumnShown(size_t column) const
void wxTreeListCtrl::SetFocus()
{ m_main_win->SetFocus(); }
+