21#if defined(__GNUG__) && !defined(__APPLE__)
22#pragma implementation "treelistctrl.h"
34#include <wx/treebase.h>
36#include <wx/textctrl.h>
37#include <wx/imaglist.h>
38#include <wx/settings.h>
39#include <wx/dcclient.h>
40#include <wx/dcscreen.h>
41#include <wx/scrolwin.h>
42#include <wx/dcmemory.h>
43#if wxCHECK_VERSION(2, 7, 0)
44#include <wx/renderer.h>
46#include <wx/apptrait.h>
47#include <wx/dcbuffer.h>
48#include <wx/tooltip.h>
49#include <wx/hashmap.h>
50#include <wx/dynarray.h>
51#include <wx/arrimpl.cpp>
54#include "wx/mac/private.h"
63#if wxCHECK_VERSION(2,9,0)
75#if !wxCHECK_VERSION(2, 5, 0)
140#if wxCHECK_VERSION_FULL(2, 7, 0, 1)
144 void RefreshColLabel(
int col);
153 const wxPoint& pos = wxDefaultPosition,
154 const wxSize& size = wxDefaultSize,
156 const wxString&
name =
_T(
"wxtreelistctrlcolumntitles") );
160 void DoDrawRect( wxDC* dc,
int x,
int y,
int w,
int h );
162 void AdjustDC(wxDC& dc);
164 void OnPaint( wxPaintEvent& event );
166 void OnMouse( wxMouseEvent& event );
167 void OnSetFocus( wxFocusEvent& event );
172 return m_total_col_width;
178 return (
int)m_columns.GetCount();
185 void RemoveColumn (
int column);
190 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
192 return m_columns[column];
196 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
198 return m_columns[column];
204 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
205 wxEmptyString,
_T(
"Invalid column"));
206 return m_columns[column].GetText();
210 wxCHECK_RET ((column >= 0) && (column < GetColumnCount()),
211 _T(
"Invalid column"));
212 m_columns[column].SetText (text);
217 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
218 wxALIGN_LEFT,
_T(
"Invalid column"));
219 return m_columns[column].GetAlignment();
223 wxCHECK_RET ((column >= 0) && (column < GetColumnCount()),
224 _T(
"Invalid column"));
225 m_columns[column].SetAlignment (flag);
230 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
231 -1,
_T(
"Invalid column"));
232 return m_columns[column].GetWidth();
234 void SetColumnWidth (
int column,
int width);
238 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
239 false,
_T(
"Invalid column"));
240 return m_columns[column].IsEditable();
245 wxCHECK_MSG ((column >= 0) && (column < GetColumnCount()),
246 true,
_T(
"Invalid column"));
247 return m_columns[column].IsShown();
257 void SendListEvent(wxEventType type, wxPoint pos);
260 DECLARE_EVENT_TABLE()
285 const wxPoint& pos = wxDefaultPosition,
286 const wxSize& size = wxDefaultSize,
287 long style = wxTR_DEFAULT_STYLE,
288 const wxValidator& validator = wxDefaultValidator,
289 const wxString&
name =
_T(
"wxtreelistmainwindow"))
292 Create (parent,
id, pos, size, style, validator,
name);
298 const wxPoint& pos = wxDefaultPosition,
299 const wxSize& size = wxDefaultSize,
300 long style = wxTR_DEFAULT_STYLE,
301 const wxValidator& validator = wxDefaultValidator,
302 const wxString&
name =
_T(
"wxtreelistctrl"));
314 size_t GetCount()
const;
323 void SetIndent(
unsigned int indent);
328 return m_linespacing;
330 void SetLineSpacing(
unsigned int spacing);
346 return m_imageListNormal;
350 return m_imageListState;
354 return m_imageListButtons;
357 void SetImageList(wxImageList* imageList);
358 void SetStateImageList(wxImageList* imageList);
359 void SetButtonsImageList(wxImageList* imageList);
360 void AssignImageList(wxImageList* imageList);
361 void AssignStateImageList(wxImageList* imageList);
362 void AssignButtonsImageList(wxImageList* imageList);
364 void SetToolTip(
const wxString& tip);
365 void SetToolTip(wxToolTip* tip);
366 void SetItemToolTip(
const wxTreeItemId& item,
const wxString& tip);
375 wxString GetItemText (
const wxTreeItemId& item,
int column)
const;
376 wxString GetItemText (wxTreeItemData* item,
int column)
const;
379 int GetItemImage (
const wxTreeItemId& item, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const
381 return GetItemImage (item, GetMainColumn(), which);
383 int GetItemImage (
const wxTreeItemId& item,
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const;
386 wxTreeItemData* GetItemData(
const wxTreeItemId& item)
const;
387 wxTreeItemData* GetItemData(
const wxTreeItemId& item,
int column)
const;
389 bool GetItemBold(
const wxTreeItemId& item)
const;
390 bool GetItemBold(
const wxTreeItemId& item,
int column)
const;
392 wxColour GetItemTextColour(
const wxTreeItemId& item)
const;
393 wxColour GetItemTextColour(
const wxTreeItemId& item,
int column)
const;
395 wxColour GetItemBackgroundColour(
const wxTreeItemId& item)
const;
396 wxColour GetItemBackgroundColour(
const wxTreeItemId& item,
int column)
const;
398 wxFont GetItemFont(
const wxTreeItemId& item)
const;
399 wxFont GetItemFont(
const wxTreeItemId& item,
int column)
const;
410 void SetItemHasChildren(
const wxTreeItemId& item,
bool has =
true);
413 void SetItemText (
const wxTreeItemId& item,
int column,
const wxString& text);
416 void SetItemImage (
const wxTreeItemId& item,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal)
418 SetItemImage (item, GetMainColumn(), image, which);
420 void SetItemImage (
const wxTreeItemId& item,
int column,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
423 void SetItemData(
const wxTreeItemId& item, wxTreeItemData* data);
424 void SetItemData(
const wxTreeItemId& item,
int column, wxTreeItemData* data);
427 void SetItemBold(
const wxTreeItemId& item,
bool bold =
true);
428 void SetItemBold(
const wxTreeItemId& item,
int column,
bool bold =
true);
431 void SetItemTextColour(
const wxTreeItemId& item,
const wxColour& colour);
432 void SetItemTextColour(
const wxTreeItemId& item,
int column,
const wxColour& colour);
435 void SetItemBackgroundColour(
const wxTreeItemId& item,
const wxColour& colour);
436 void SetItemBackgroundColour(
const wxTreeItemId& item,
int column,
const wxColour& colour);
439 void SetItemFont(
const wxTreeItemId& item,
const wxFont& font);
440 void SetItemFont(
const wxTreeItemId& item,
int column,
const wxFont& font);
448 bool IsVisible(
const wxTreeItemId& item,
bool fullRow,
bool within =
true)
const;
450 bool HasChildren(
const wxTreeItemId& item)
const;
452 bool IsExpanded(
const wxTreeItemId& item)
const;
454 bool IsSelected(
const wxTreeItemId& item)
const;
456 bool IsBold(
const wxTreeItemId& item)
const;
457 bool IsBold(
const wxTreeItemId& item,
int column)
const;
462 virtual bool SetFont(
const wxFont& font );
466 void SetWindowStyle(
const long styles);
473 size_t GetChildrenCount(
const wxTreeItemId& item,
bool recursively =
true);
493 size_t GetSelections(wxArrayTreeItemIds&)
const;
496 wxTreeItemId GetItemParent(
const wxTreeItemId& item)
const;
506#if !wxCHECK_VERSION(2, 5, 0)
507 wxTreeItemId GetFirstChild(
const wxTreeItemId& item,
long& cookie)
const;
508 wxTreeItemId GetNextChild(
const wxTreeItemId& item,
long& cookie)
const;
509 wxTreeItemId GetPrevChild(
const wxTreeItemId& item,
long& cookie)
const;
510 wxTreeItemId GetLastChild(
const wxTreeItemId& item,
long& cookie)
const;
512 wxTreeItemId GetFirstChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
513 wxTreeItemId GetNextChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
514 wxTreeItemId GetPrevChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
515 wxTreeItemId GetLastChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
519 wxTreeItemId GetNextSibling(
const wxTreeItemId& item)
const;
520 wxTreeItemId GetPrevSibling(
const wxTreeItemId& item)
const;
523 wxTreeItemId GetNext(
const wxTreeItemId& item,
bool fulltree =
true)
const;
524 wxTreeItemId GetPrev(
const wxTreeItemId& item,
bool fulltree =
true)
const;
527 wxTreeItemId GetFirstExpandedItem()
const;
528 wxTreeItemId GetNextExpanded(
const wxTreeItemId& item)
const;
529 wxTreeItemId GetPrevExpanded(
const wxTreeItemId& item)
const;
532 wxTreeItemId GetFirstVisible(
bool fullRow,
bool within)
const;
533 wxTreeItemId GetNextVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
534 wxTreeItemId GetPrevVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
535 wxTreeItemId GetLastVisible (
bool fullRow,
bool within)
const;
541 wxTreeItemId AddRoot (
const wxString& text,
542 int image = -1,
int selectedImage = -1,
543 wxTreeItemData* data = NULL);
546 wxTreeItemId PrependItem(
const wxTreeItemId& parent,
547 const wxString& text,
548 int image = -1,
int selectedImage = -1,
549 wxTreeItemData* data = NULL);
552 wxTreeItemId InsertItem(
const wxTreeItemId& parent,
553 const wxTreeItemId& idPrevious,
554 const wxString& text,
555 int image = -1,
int selectedImage = -1,
556 wxTreeItemData* data = NULL);
559 wxTreeItemId InsertItem(
const wxTreeItemId& parent,
561 const wxString& text,
562 int image = -1,
int selectedImage = -1,
563 wxTreeItemData* data = NULL);
566 wxTreeItemId AppendItem(
const wxTreeItemId& parent,
567 const wxString& text,
568 int image = -1,
int selectedImage = -1,
569 wxTreeItemData* data = NULL);
572 void Delete(
const wxTreeItemId& item);
575 void DeleteChildren(
const wxTreeItemId& item);
580 void SetItemParent(
const wxTreeItemId& parent,
const wxTreeItemId& item);
583 void Expand(
const wxTreeItemId& item);
585 void ExpandAll(
const wxTreeItemId& item);
587 void Collapse(
const wxTreeItemId& item);
589 void CollapseAndReset(
const wxTreeItemId& item);
591 void Toggle(
const wxTreeItemId& item);
594 void SetCurrentItem(
const wxTreeItemId& item);
600 bool SelectItem(
const wxTreeItemId& item,
const wxTreeItemId& prev = (wxTreeItemId*)NULL,
601 bool unselect_others =
true);
605 void EnsureVisible(
const wxTreeItemId& item);
607 void ScrollTo(
const wxTreeItemId& item);
608 void AdjustMyScrollbars();
616 return HitTest (point, flags, column);
618 wxTreeItemId
HitTest (
const wxPoint& point,
int& flags)
621 return HitTest (point, flags, column);
623 wxTreeItemId HitTest (
const wxPoint& point,
int& flags,
int& column);
627 bool GetBoundingRect(
const wxTreeItemId& item,
629 bool textOnly =
false)
const;
634 void EditLabel (
const wxTreeItemId& item,
int column);
635 void EndEdit(
bool isCancelled);
642 virtual int OnCompareItems(
const wxTreeItemId& item1,
643 const wxTreeItemId& item2);
647 void SortChildren(
const wxTreeItemId& item,
int column,
bool reverseOrder);
650 wxTreeItemId FindItem (
const wxTreeItemId& item,
int column,
const wxString& str,
int mode = 0);
655 virtual bool SetBackgroundColour(
const wxColour& colour);
656 virtual bool SetForegroundColour(
const wxColour& colour);
659 void SetDragItem (
const wxTreeItemId& item = (wxTreeItemId*)NULL);
662 void OnPaint( wxPaintEvent& event );
664 void OnSetFocus( wxFocusEvent& event );
666 void OnChar( wxKeyEvent& event );
667 void OnMouse( wxMouseEvent& event );
668 void OnIdle( wxIdleEvent& event );
669 void OnScroll(wxScrollWinEvent& event);
680 if ((column >= 0) && (column < GetColumnCount())) m_main_column = column;
685 return m_main_column;
689 return m_curColumn >= 0 ? m_curColumn : m_main_column;
692 int GetBestColumnWidth (
int column, wxTreeItemId parent = wxTreeItemId());
762 wxTreeItemId DoInsertItem(
const wxTreeItemId& parent,
764 const wxString& text,
765 int image,
int selectedImage,
766 wxTreeItemData* data);
771 return (m_imageListButtons) || HasFlag (wxTR_TWIST_BUTTONS | wxTR_HAS_BUTTONS);
774 void CalculateLineHeight();
776 void PaintLevel(
wxTreeListItem* item, wxDC& dc,
int level,
int& y,
780 void CalculateLevel(
wxTreeListItem* item, wxDC& dc,
int level,
int& y,
782 void CalculatePositions();
788 void RefreshSelected();
792 void OnRenameTimer();
793 void OnRenameAccept(
bool isCancelled);
799 bool SendEvent(wxEventType event_type,
wxTreeListItem* item = NULL, wxTreeEvent* event = NULL);
802 DECLARE_EVENT_TABLE()
833 const wxString& value = wxEmptyString,
834 const wxPoint& pos = wxDefaultPosition,
835 const wxSize& size = wxDefaultSize,
837 const wxValidator& validator = wxDefaultValidator,
838 const wxString&
name = wxTextCtrlNameStr );
841 virtual bool Destroy();
842 void EndEdit(
bool isCancelled);
848 void OnChar( wxKeyEvent& event );
849 void OnKeyUp( wxKeyEvent& event );
850 void OnKillFocus( wxFocusEvent& event );
860 DECLARE_EVENT_TABLE()
884 if (m_ownsAttr)
delete m_attr;
913 const wxArrayString& text,
916 wxTreeItemData* data );
931 if ( IsVirtual() )
return m_owner->
GetItemText( m_props_row.m_data, column );
932 if (column < (
signed)m_text.GetCount())
return m_text[column];
933 return wxEmptyString;
936 int GetImage ( wxTreeItemIcon which = wxTreeItemIcon_Normal)
const
938 return m_images[which];
940 int GetImage (
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const
943 if (column == m_owner->
GetMainColumn())
return m_images[which];
946 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
947 if (entry == m_props_cell.end())
return NO_IMAGE;
948 return entry->second->m_image;
954 return m_props_row.m_data;
958 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
959 if (entry == m_props_cell.end())
return NULL;
960 return entry->second->m_data;
970 int GetCurrentImage()
const;
980 void SetText (
int column,
const wxString& text)
982 if (column < (
int)m_text.GetCount())
984 m_text[column] = text;
986 else if (column < m_owner->GetColumnCount())
989 for (
int i = (
int)m_text.GetCount(); i < howmany; ++i) m_text.Add (wxEmptyString);
990 m_text[column] = text;
995 m_images[which] = image;
997 void SetImage (
int column,
int image, wxTreeItemIcon which)
1000 if (column == m_owner->
GetMainColumn()) m_images[which] = image;
1004 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1005 if (entry == m_props_cell.end())
1008 m_props_cell[column]->m_image = image;
1012 entry->second->m_image = image;
1020 m_props_row.m_data = data;
1024 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1025 if (entry == m_props_cell.end())
1028 m_props_cell[column]->m_data = data;
1032 entry->second->m_data = data;
1038 m_props_row.m_isBold = bold;
1042 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1043 if (entry == m_props_cell.end())
1046 m_props_cell[column]->m_isBold = bold;
1047 m_props_cell[column]->m_isBoldSet = 1;
1051 entry->second->m_isBold = bold;
1052 entry->second->m_isBoldSet = 1;
1064 if (tip.length() > 0)
1066 m_toolTip =
new wxString(tip);
1075 return !m_children.IsEmpty();
1079 return m_hasHilight != 0;
1083 return !m_isCollapsed;
1087 return m_hasPlus || HasChildren();
1091 return m_props_row.m_isBold;
1095 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1096 if (entry == m_props_cell.end() || ! entry->second->m_isBoldSet)
return IsBold();
1097 return (entry->second->m_isBold != 0);
1101 return m_owner->IsVirtual();
1161 size_t GetChildrenCount(
bool recursively =
true)
const;
1170 int& flags,
int& column,
int level);
1176 void DeleteChildren();
1180 m_children.Insert(child, index);
1185 m_isCollapsed =
false;
1189 m_isCollapsed =
true;
1205 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1206 if (entry == m_props_cell.end())
return GetAttributes();
1207 return entry->second->m_attr;
1211 return m_props_row.m_attr;
1217 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1218 if (entry == m_props_cell.end())
1221 m_props_cell[column]->m_attr =
new wxTreeItemAttr;
1222 m_props_cell[column]->m_ownsAttr = 1;
1223 return *(m_props_cell[column]->m_attr);
1227 return *(entry->second->m_attr);
1232 if ( !m_props_row.m_attr )
1234 m_props_row.m_attr =
new wxTreeItemAttr;
1235 m_props_row.m_ownsAttr = 1;
1237 return *m_props_row.m_attr;
1269 short m_images[wxTreeItemIcon_Max];
1301 m_owner->OnRenameTimer();
1315 const wxWindowID
id,
1319 const wxString& value,
1323 const wxValidator& validator,
1324 const wxString&
name)
1325 : wxTextCtrl (parent,
id, value, pos, size, style | wxSIMPLE_BORDER, validator,
name)
1330 (*m_accept) =
false;
1331 (*m_res) = wxEmptyString;
1332 m_startValue = value;
1343 if (m_finished)
return;
1348 (*m_accept) = ! isCancelled;
1349 (*m_res) = isCancelled ? m_startValue : GetValue();
1350 m_owner->OnRenameAccept(*m_res == m_startValue);
1351 m_owner->m_editControl = NULL;
1352 m_owner->m_editItem = NULL;
1363#if wxCHECK_VERSION(2,9,0)
1364 wxTheApp->ScheduleForDestruction(
this);
1366 wxTheApp->GetTraits()->ScheduleForDestroy(
this);
1378 if (event.GetKeyCode() == WXK_RETURN)
1383 if (event.GetKeyCode() == WXK_ESCAPE)
1400 wxSize parentSize = m_owner->GetSize();
1401 wxPoint myPos = GetPosition();
1402 wxSize mySize = GetSize();
1404 GetTextExtent(GetValue() +
_T(
"M"), &sx, &sy);
1405 if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x;
1406 if (mySize.x > sx) sx = mySize.x;
1439 m_currentCursor = (wxCursor*) NULL;
1440 m_isDragging =
false;
1442 m_total_col_width = 0;
1443#if wxCHECK_VERSION_FULL(2, 7, 0, 1)
1448 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
1456 m_resizeCursor = (wxCursor*) NULL;
1465 const wxString&
name )
1466 : wxWindow( win, id, pos, size, style,
name )
1473#if !wxCHECK_VERSION(2, 5, 0)
1474 SetBackgroundColour (wxSystemSettings::GetSystemColour (wxSYS_COLOUR_BTNFACE));
1476 SetBackgroundColour (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNFACE));
1487#if !wxCHECK_VERSION(2, 5, 0)
1488 wxPen pen (wxSystemSettings::GetSystemColour (wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID);
1490 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID);
1493 const int m_corner = 1;
1495 dc->SetBrush( *wxTRANSPARENT_BRUSH );
1496#if defined( __WXMAC__ )
1499 dc->SetPen( *wxBLACK_PEN );
1501 dc->DrawLine( x + w - m_corner + 1, y, x + w, y + h );
1502 dc->DrawRectangle( x, y + h, w + 1, 1 );
1504#if defined( __WXMAC__ )
1505 pen = wxPen( wxColour( 0x88, 0x88, 0x88 ), 1, wxSOLID );
1508 dc->DrawLine( x + w - m_corner, y, x + w - 1, y + h );
1509 dc->DrawRectangle( x + 1, y + h - 1, w - 2, 1 );
1511 dc->SetPen( *wxWHITE_PEN );
1512 dc->DrawRectangle( x, y, w - m_corner + 1, 1 );
1513 dc->DrawRectangle( x, y, 1, h );
1514 dc->DrawLine( x, y + h - 1, x + 1, y + h - 1 );
1515 dc->DrawLine( x + w - 1, y, x + w - 1, y + 1 );
1523 m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
1525 m_owner->GetViewStart( &x, NULL );
1528 dc.SetDeviceOrigin( -x * xpix, 0 );
1533 wxAutoBufferedPaintDC dc(
this );
1540 GetClientSize( &w, &h );
1541 m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
1542 dc.SetBackgroundMode(wxTRANSPARENT);
1544#if wxCHECK_VERSION_FULL(2, 7, 0, 1)
1546 for (
int i = 0; i < numColumns && x < w; i++ )
1550 wxHeaderButtonParams params;
1552 params.m_labelColour = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
1553 params.m_labelFont = GetFont();
1558 wxRect rect(x, 0, wCol, h);
1561 if ( i == m_hotTrackCol)
1562 flags |= wxCONTROL_CURRENT;
1564 params.m_labelText = column.
GetText();
1569 if ((image != -1) && imageList)
1570 params.m_labelBitmap = imageList->GetBitmap(image);
1572 wxRendererNative::Get().DrawHeaderButton(
this, dc, rect, flags, wxHDR_SORT_ICON_NONE, ¶ms);
1577 wxRect rect(x, 0, w - x, h);
1578 wxRendererNative::Get().DrawHeaderButton(
this, dc, rect);
1583 dc.SetFont( GetFont() );
1588#if !wxCHECK_VERSION(2, 5, 0)
1589 dc.SetTextForeground (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOWTEXT ));
1591 dc.SetTextForeground (wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ));
1595 for (
int i = 0; i < numColumns && x < w; i++ )
1606#if !wxCHECK_VERSION(2, 7, 0)
1607 dc.SetPen( *wxWHITE_PEN );
1611 wxRendererNative::GetDefault().DrawHeaderButton (
this, dc, rect);
1616 int ix = -2, iy = 0;
1618 if ((image != -1) && imageList)
1620 imageList->GetSize (image, ix, iy);
1626 int image_offset = cw - ix - 1;
1635 dc.GetTextExtent (column.
GetText(), &text_width, NULL);
1639 case wxALIGN_CENTER:
1640 dc.GetTextExtent(column.
GetText(), &text_width, NULL);
1641 text_x += (cw - text_width) / 2 + ix + 2;
1642 image_offset = (cw - text_width - ix - 2) / 2 -
MARGIN;
1647 if ((image != -1) && imageList)
1649 imageList->Draw (image, dc, x + image_offset,
1651 wxIMAGELIST_DRAW_TRANSPARENT);
1665#if !wxCHECK_VERSION(2, 7, 0)
1669 wxRendererNative::GetDefault().DrawHeaderButton (
this, dc, rect);
1680 ClientToScreen (&x1, &y1);
1687 m_owner->GetClientSize( NULL, &y2 );
1688 m_owner->ClientToScreen( &x2, &y2 );
1691 dc.SetLogicalFunction (wxINVERT);
1692 dc.SetPen (wxPen (*wxBLACK, 2, wxSOLID));
1693 dc.SetBrush (*wxTRANSPARENT_BRUSH);
1696 dc.DrawLine (x1, y1, x2, y2);
1697 dc.SetLogicalFunction (wxCOPY);
1698 dc.SetPen (wxNullPen);
1699 dc.SetBrush (wxNullBrush);
1702#if wxCHECK_VERSION_FULL(2, 7, 0, 1)
1703 int wxTreeListHeaderWindow::XToCol(
int x)
1707 for (
int col = 0; col < numColumns; col++ )
1712 if ( x < (colLeft + column.
GetWidth()) )
1720 void wxTreeListHeaderWindow::RefreshColLabel(
int col)
1735 while (++idx <= col);
1737 m_owner->CalcScrolledPosition(x, 0, &x, NULL);
1738 RefreshRect(wxRect(x, 0, width, GetSize().GetHeight()));
1747 m_owner->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL);
1749#if wxCHECK_VERSION_FULL(2, 7, 0, 1)
1750 if ( event.Moving() )
1752 int col = XToCol(x);
1753 if ( col != m_hotTrackCol )
1757 RefreshColLabel(col);
1760 if ( m_hotTrackCol >= 0 )
1761 RefreshColLabel(m_hotTrackCol);
1763 m_hotTrackCol = col;
1767 if ( event.Leaving() && m_hotTrackCol >= 0 )
1770 RefreshColLabel(m_hotTrackCol);
1778 SendListEvent (wxEVT_COMMAND_LIST_COL_DRAGGING, event.GetPosition());
1783 GetClientSize( &w, NULL );
1784 m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
1790 if (event.ButtonUp())
1793 if (HasCapture()) ReleaseMouse();
1797 SendListEvent (wxEVT_COMMAND_LIST_COL_END_DRAG, event.GetPosition());
1812 bool hit_border =
false;
1819 for (
int column = 0; column < countCol; column++)
1825 if (
abs (x - xpos) < 3)
1841 if (event.LeftDown() || event.RightUp())
1845 if (hit_border && event.LeftDown())
1851 SendListEvent (wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, event.GetPosition());
1855 wxEventType evt =
event.LeftDown() ? wxEVT_COMMAND_LIST_COL_CLICK :
1856 wxEVT_COMMAND_LIST_COL_RIGHT_CLICK;
1860 else if (event.LeftDClick() && hit_border)
1866 else if (event.Moving())
1892 wxWindow* parent = GetParent();
1893 wxListEvent le (type, parent->GetId());
1894 le.SetEventObject (parent);
1895 le.m_pointDrag = pos;
1901 le.m_pointDrag.y -= GetSize().y;
1903 parent->GetEventHandler()->ProcessEvent (le);
1916 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()),
_T(
"Invalid column"));
1926 wxCHECK_RET ((before >= 0) && (before <
GetColumnCount()),
_T(
"Invalid column"));
1935 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()),
_T(
"Invalid column"));
1944 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()),
_T(
"Invalid column"));
1962 const wxArrayString& text,
1963 int image,
int selImage,
1964 wxTreeItemData* data)
1968 m_images[wxTreeItemIcon_Normal] = image;
1969 m_images[wxTreeItemIcon_Selected] = selImage;
1995 wxTreeListItemCellAttrHash::iterator entry =
m_props_cell.begin();
1998 if (entry->second)
delete entry->second;
2002 wxASSERT_MSG(
m_children.IsEmpty(),
_T(
"please call DeleteChildren() before destructor"));
2013 if (!recursively)
return count;
2015 size_t total = count;
2016 for (
size_t n = 0; n < count; ++n)
2026 if (y < bottomY) y = bottomY;
2028 if ( x < width ) x = width;
2033 for (
size_t n = 0; n < count; ++n )
2042 int& flags,
int& column,
int level)
2050 if (!theCtrl->HasFlag(wxTR_HIDE_ROOT) || (level > 0))
2062 if (point.x >= x && point.x < x + w)
2072 if ((point.y >=
m_y) && (point.y <=
m_y + h))
2076 int y_mid =
m_y + h / 2;
2077 if (point.y < y_mid)
2079 flags |= wxTREE_HITTEST_ONITEMUPPERPART;
2083 flags |= wxTREE_HITTEST_ONITEMLOWERPART;
2091 if ((point.x >= bntX) && (point.x <= (bntX + theCtrl->
m_btnWidth)) &&
2092 (point.y >= bntY) && (point.y <= (bntY + theCtrl->
m_btnHeight)))
2094 flags |= wxTREE_HITTEST_ONITEMBUTTON;
2104 if ((point.x >= imgX) && (point.x <= (imgX + theCtrl->
m_imgWidth)) &&
2105 (point.y >= imgY) && (point.y <= (imgY + theCtrl->
m_imgHeight)))
2107 flags |= wxTREE_HITTEST_ONITEMICON;
2115 flags |= wxTREE_HITTEST_ONITEMLABEL;
2122 flags |= wxTREE_HITTEST_ONITEMINDENT;
2131 flags |= wxTREE_HITTEST_ONITEMRIGHT;
2154 for (
size_t n = 0; n < count; n++)
2156 child =
m_children[n]->HitTest (point, theCtrl, flags, column, level + 1);
2157 if (child)
return child;
2171 image =
GetImage (wxTreeItemIcon_SelectedExpanded);
2175 image =
GetImage (wxTreeItemIcon_Expanded);
2182 image =
GetImage (wxTreeItemIcon_Selected);
2186 image =
GetImage (wxTreeItemIcon_Normal);
2238#if !wxCHECK_VERSION(2, 5, 0)
2239 m_hilightBrush =
new wxBrush (wxSystemSettings::GetSystemColour (wxSYS_COLOUR_HIGHLIGHT), wxSOLID);
2240 m_hilightUnfocusedBrush =
new wxBrush (wxSystemSettings::GetSystemColour (wxSYS_COLOUR_BTNSHADOW), wxSOLID);
2242 m_hilightBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHT), wxSOLID);
2243 m_hilightUnfocusedBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW), wxSOLID);
2246 m_imageListNormal = (wxImageList*) NULL;
2247 m_imageListButtons = (wxImageList*) NULL;
2248 m_imageListState = (wxImageList*) NULL;
2249 m_ownsImageListNormal = m_ownsImageListButtons =
2250 m_ownsImageListState =
false;
2252 m_imgWidth = 0, m_imgWidth2 = 0;
2253 m_imgHeight = 0, m_imgHeight2 = 0;
2254 m_btnWidth = 0, m_btnWidth2 = 0;
2255 m_btnHeight = 0, m_btnHeight2 = 0;
2257 m_isDragStarted = m_isDragging =
false;
2262 m_editControl = NULL;
2264 m_lastOnSame =
false;
2265 m_left_down_selection =
false;
2267 m_findTimer =
new wxTimer (
this, -1);
2269#if defined( __WXMAC__ ) && defined(__WXMAC_CARBON__)
2270 m_normalFont.MacCreateThemeFont (kThemeViewsFont);
2272 m_normalFont = wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT);
2274 m_boldFont = wxFont( m_normalFont.GetPointSize(),
2275 m_normalFont.GetFamily(),
2276 m_normalFont.GetStyle(),
2278 m_normalFont.GetUnderlined(),
2279 m_normalFont.GetFaceName(),
2280 m_normalFont.GetEncoding());
2284 m_isItemToolTip =
false;
2292 const wxValidator& validator,
2293 const wxString&
name)
2297 if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;
2298 if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;
2299 style &= ~wxTR_LINES_AT_ROOT;
2300 style |= wxTR_NO_LINES;
2303 wxGetOsVersion( &major, &minor );
2304 if (major < 10) style |= wxTR_ROW_LINES;
2307 wxScrolledWindow::Create (parent,
id, pos, size, style | wxHSCROLL | wxVSCROLL,
name);
2310 SetValidator(validator);
2313#if !wxCHECK_VERSION(2, 5, 0)
2319 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
2326 bdc.SelectObject(bmp);
2327 bdc.SetPen(*wxGREY_PEN);
2328 bdc.DrawRectangle(-1, -1, 10, 10);
2329 for (i = 0; i < 8; i++)
2331 for (j = 0; j < 8; j++)
2335 bdc.DrawPoint(i, j);
2399 wxCHECK_MSG (item.IsOk(), 0u,
_T(
"invalid tree item"));
2400 return ((
wxTreeListItem*)item.m_pItem)->GetChildrenCount (recursively);
2406 if ((styles ^ m_windowStyle) & wxTR_MULTIPLE)
2413 m_windowStyle = styles;
2426 m_toolTip = (tip == NULL) ? wxString() : tip->GetTip();
2432 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2445 wxCHECK_MSG (item.IsOk(), -1,
_T(
"invalid tree item"));
2446 return ((
wxTreeListItem*) item.m_pItem)->GetImage (column, which);
2451 wxCHECK_MSG (item.IsOk(), NULL,
_T(
"invalid tree item"));
2456 wxCHECK_MSG (item.IsOk(), NULL,
_T(
"invalid tree item"));
2462 wxCHECK_MSG(item.IsOk(),
false,
_T(
"invalid tree item"));
2467 wxCHECK_MSG(item.IsOk(),
false,
_T(
"invalid tree item"));
2473 wxCHECK_MSG (item.IsOk(), wxNullColour,
_T(
"invalid tree item"));
2476 if (attr && attr->HasTextColour())
2478 return attr->GetTextColour();
2482 return GetForegroundColour();
2487 wxCHECK_MSG (item.IsOk(), wxNullColour,
_T(
"invalid tree item"));
2490 if (attr && attr->HasTextColour())
2492 return attr->GetTextColour();
2502 wxCHECK_MSG (item.IsOk(), wxNullColour,
_T(
"invalid tree item"));
2505 if (attr && attr->HasBackgroundColour())
2507 return attr->GetBackgroundColour();
2511 return GetBackgroundColour();
2516 wxCHECK_MSG (item.IsOk(), wxNullColour,
_T(
"invalid tree item"));
2519 if (attr && attr->HasBackgroundColour())
2521 return attr->GetBackgroundColour();
2531 wxCHECK_MSG (item.IsOk(), wxNullFont,
_T(
"invalid tree item"));
2534 if (attr && attr->HasFont())
2536 return attr->GetFont();
2538 else if (pItem->
IsBold())
2549 wxCHECK_MSG (item.IsOk(), wxNullFont,
_T(
"invalid tree item"));
2553 if (attr_cell && attr_cell->HasFont())
2555 return attr_cell->GetFont();
2557 else if (attr_row && attr_row->HasFont())
2559 return attr_row->GetFont();
2561 else if (pItem->
IsBold(column))
2573 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2581 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2583 pItem->
SetImage (column, image, which);
2584 wxClientDC dc (
this);
2591 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2596 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2602 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2612 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2615 pItem->
SetBold (column, bold);
2622 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2624 pItem->
Attr().SetTextColour (colour);
2629 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2631 pItem->
Attr(column).SetTextColour (colour);
2637 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2639 pItem->
Attr().SetBackgroundColour (colour);
2644 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2646 pItem->
Attr(column).SetBackgroundColour (colour);
2652 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2654 pItem->
Attr().SetFont (font);
2659 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
2661 pItem->
Attr(column).SetFont (font);
2668 wxScrolledWindow::SetFont (font);
2687 wxCHECK_MSG (item.IsOk(),
false,
_T(
"invalid tree item"));
2694 if (parent ==
m_rootItem && HasFlag(wxTR_HIDE_ROOT))
break;
2702 wxSize clientSize = GetClientSize();
2705 ((!fullRow && rect.GetWidth() == 0) || rect.GetHeight() == 0) ||
2706 (rect.GetTop() < 0 || rect.GetBottom() >= clientSize.y) ||
2707 (!fullRow && (rect.GetLeft() < 0 || rect.GetRight() >= clientSize.x)))
return false;
2715 wxCHECK_MSG (item.IsOk(),
false,
_T(
"invalid tree item"));
2727 wxCHECK_MSG (item.IsOk(),
false,
_T(
"invalid tree item"));
2733 wxCHECK_MSG (item.IsOk(),
false,
_T(
"invalid tree item"));
2739 wxCHECK_MSG (item.IsOk(),
false,
_T(
"invalid tree item"));
2749 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2753#if !wxCHECK_VERSION(2, 5, 0)
2759 wxTreeItemIdValue& cookie)
const
2762 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2763 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2765 return (!children.IsEmpty()) ? wxTreeItemId(children.Item(0)) : wxTreeItemId();
2768#if !wxCHECK_VERSION(2, 5, 0)
2774 wxTreeItemIdValue& cookie)
const
2777 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2778 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2780 long* pIndex = ((
long*)&cookie);
2781 return ((*pIndex) + 1 < (long)children.Count()) ? wxTreeItemId(children.Item(++(*pIndex))) : wxTreeItemId();
2784#if !wxCHECK_VERSION(2, 5, 0)
2790 wxTreeItemIdValue& cookie)
const
2793 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2794 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2796 long* pIndex = (
long*)&cookie;
2797 return ((*pIndex) - 1 >= 0) ? wxTreeItemId(children.Item(--(*pIndex))) : wxTreeItemId();
2800#if !wxCHECK_VERSION(2, 5, 0)
2806 wxTreeItemIdValue& cookie)
const
2809 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2810 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2812 long* pIndex = ((
long*)&cookie);
2813 (*pIndex) = (long)children.Count();
2814 return (!children.IsEmpty()) ? wxTreeItemId(children.Last()) : wxTreeItemId();
2819 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2824 if (!parent)
return wxTreeItemId();
2827 wxArrayTreeListItems& siblings = parent->GetChildren();
2828 size_t index = siblings.Index (i);
2829 wxASSERT (index != (
size_t)wxNOT_FOUND);
2830 return (index < siblings.Count() - 1) ? wxTreeItemId(siblings[index + 1]) : wxTreeItemId();
2835 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2840 if (!parent)
return wxTreeItemId();
2843 wxArrayTreeListItems& siblings = parent->GetChildren();
2844 size_t index = siblings.Index(i);
2845 wxASSERT (index != (
size_t)wxNOT_FOUND);
2846 return (index >= 1) ? wxTreeItemId(siblings[index - 1]) : wxTreeItemId();
2852 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2857 wxArrayTreeListItems& children = ((
wxTreeListItem*)item.m_pItem)->GetChildren();
2858 if (children.GetCount() > 0)
return children.Item (0);
2863 wxTreeItemId parent = item;
2869 while (!next.IsOk() && parent.IsOk());
2876 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2883 while (fulltree || ((
wxTreeListItem*)prev.m_pItem)->IsExpanded())
2885 wxArrayTreeListItems& children = ((
wxTreeListItem*)prev.m_pItem)->GetChildren();
2886 if (children.GetCount() == 0)
break;
2887 prev = children.Item (children.GetCount() - 1);
2900 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2906 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2924 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2925 wxTreeItemId
id =
GetNext (item,
false);
2928 if (
IsVisible (
id, fullRow, within))
return id;
2931 return wxTreeItemId();
2936 wxCHECK_MSG (
GetRootItem().IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2938 wxTreeItemId res = id;
2939 while ((
id =
GetNext (
id,
false)).IsOk())
2941 if (
IsVisible (
id, fullRow, within)) res = id;
2948 wxCHECK_MSG (item.IsOk(), wxTreeItemId(),
_T(
"invalid tree item"));
2949 wxTreeItemId
id =
GetPrev (item,
true);
2952 if (
IsVisible (
id, fullRow, within))
return id;
2955 return wxTreeItemId();
2966 const wxString& text,
2967 int image,
int selImage,
2968 wxTreeItemData* data)
2971 wxCHECK_MSG (parent, wxTreeItemId(),
_T(
"item must have a parent, at least root!") );
2976 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2981#if !wxCHECK_VERSION(2, 5, 0)
2982 data->SetId ((
long)item);
2987 parent->
Insert (item, previous);
2993 int image,
int selImage,
2994 wxTreeItemData* data)
2996 wxCHECK_MSG(!
m_rootItem, wxTreeItemId(),
_T(
"tree can have only one root"));
2997 wxCHECK_MSG(
GetColumnCount(), wxTreeItemId(),
_T(
"Add column(s) before adding the root item"));
3002 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
3007#if !wxCHECK_VERSION(2, 5, 0)
3013 if (HasFlag(wxTR_HIDE_ROOT))
3018#if !wxCHECK_VERSION(2, 5, 0)
3021 wxTreeItemIdValue cookie = 0;
3029 const wxString& text,
3030 int image,
int selImage,
3031 wxTreeItemData* data)
3033 return DoInsertItem (parent, 0u, text, image, selImage, data);
3037 const wxTreeItemId& idPrevious,
3038 const wxString& text,
3039 int image,
int selImage,
3040 wxTreeItemData* data)
3043 wxCHECK_MSG (parent, wxTreeItemId(),
_T(
"item must have a parent, at least root!") );
3046 wxASSERT_MSG( index != wxNOT_FOUND,
3047 _T(
"previous item in wxTreeListMainWindow::InsertItem() is not a sibling") );
3049 return DoInsertItem (parentId, ++index, text, image, selImage, data);
3054 const wxString& text,
3055 int image,
int selImage,
3056 wxTreeItemData* data)
3059 wxCHECK_MSG (parent, wxTreeItemId(),
_T(
"item must have a parent, at least root!") );
3061 return DoInsertItem (parentId, before, text, image, selImage, data);
3065 const wxString& text,
3066 int image,
int selImage,
3067 wxTreeItemData* data)
3070 wxCHECK_MSG (parent, wxTreeItemId(),
_T(
"item must have a parent, at least root!") );
3080 if (! itemId.IsOk())
return;
3083 wxCHECK_RET (item !=
m_rootItem,
_T(
"invalid item, root may not be deleted this way!"));
3092 parent->GetChildren().Remove (item);
3114 if (! itemId.IsOk())
return;
3119 wxArrayTreeListItems& children = item->
GetChildren();
3120 for (
size_t n = children.GetCount(); n > 0; n--)
3125 children.RemoveAt(n - 1);
3132 wxCHECK_RET (item,
_T(
"invalid item for delete!"));
3148 if (HasCapture()) ReleaseMouse();
3160 size_t index = siblings.Index (item);
3161 wxASSERT (index != (
size_t)wxNOT_FOUND);
3176 wxArrayTreeListItems& children = item->
GetChildren();
3177 for (
size_t n = children.GetCount(); n > 0; n--)
3182 children.RemoveAt(n - 1);
3186 SendEvent(wxEVT_COMMAND_TREE_DELETE_ITEM, item);
3197 wxCHECK_RET (item,
_T(
"invalid item in wxTreeListMainWindow::SetItemParent") );
3198 wxCHECK_RET (parent_new,
_T(
"invalid parent in wxTreeListMainWindow::SetItemParent") );
3199 wxCHECK_RET (item !=
m_rootItem,
_T(
"invalid root as item in wxTreeListMainWindow::SetItemParent!") );
3205 parent_new->Insert(item, parent_new->
GetChildren().Count());
3208 if (parent_new->GetChildren().Count() == 1) parent_new->Expand();
3226 if (old_item != NULL && old_item != item)
3238 wxCHECK_RET (item,
_T(
"invalid item in wxTreeListMainWindow::Expand") );
3243 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 0);
3245 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
3251 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_EXPANDED);
3257 wxCHECK_RET (itemId.IsOk(),
_T(
"invalid tree item"));
3261#if !wxCHECK_VERSION(2, 5, 0)
3264 wxTreeItemIdValue cookie;
3267 while (child.IsOk())
3277 wxCHECK_RET (item,
_T(
"invalid item in wxTreeListMainWindow::Collapse") );
3282 wxTreeEvent event (wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 0 );
3284 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
3290 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
3296 wxCHECK_RET (item.IsOk(),
_T(
"invalid tree item"));
3304 wxCHECK_RET (itemId.IsOk(),
_T(
"invalid tree item"));
3328 wxCHECK_RET (item,
_T(
"invalid tree item"));
3339 wxArrayTreeListItems& children = item->
GetChildren();
3340 size_t count = children.Count();
3341 for (
size_t n = 0; n < count; ++n)
3369 wxArrayTreeListItems& children = parent->
GetChildren();
3370 int index = children.Index(crt_item);
3371 wxASSERT (index != wxNOT_FOUND);
3376 size_t count = children.Count();
3377 for (
size_t n = (index + 1); n < count; ++n)
3392 if (crt_item == last_item)
return true;
3396 wxArrayTreeListItems& children = crt_item->
GetChildren();
3397 size_t count = children.Count();
3398 for (
size_t n = 0; n < count; ++n)
3408 const wxTreeItemId& lastId,
3409 bool unselect_others)
3415 wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
3417#if !wxCHECK_VERSION(2, 5, 0)
3422 if (
SendEvent(0, item, &event) && !
event.IsAllowed())
return false;
3425 bool bUnselectedAll =
false;
3426 if (unselect_others)
3428 if (HasFlag(wxTR_MULTIPLE))
3431 bUnselectedAll =
true;
3440 if (lastId.IsOk() && itemId.IsOk() && (itemId != lastId))
3467 else if (itemId.IsOk())
3473 if (unselect_others)
3486 event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
3495 wxCHECK_RET (HasFlag(wxTR_MULTIPLE),
_T(
"invalid tree style"));
3496 wxCHECK_RET (root.IsOk(),
_T(
"no tree"));
3499 wxTreeEvent event (wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
3500#if !wxCHECK_VERSION(2, 5, 0)
3508#if !wxCHECK_VERSION(2, 5, 0)
3511 wxTreeItemIdValue cookie = 0;
3521 event.SetEventType (wxEVT_COMMAND_TREE_SEL_CHANGED);
3526 wxArrayTreeItemIds& array)
const
3528 if (item->
IsSelected()) array.Add (wxTreeItemId(item));
3532 wxArrayTreeListItems& children = item->
GetChildren();
3533 size_t count = children.GetCount();
3534 for (
size_t n = 0; n < count; ++n)
FillArray (children[n], array);
3543 return array.Count();
3548 if (!item.IsOk())
return;
3565 if (!item.IsOk())
return;
3573 int item_y = gitem->
GetY();
3576 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3579 GetViewStart (&start_x, &start_y);
3584 GetClientSize (&client_w, &client_h);
3591 int x_pos = GetScrollPos( wxHORIZONTAL );
3593 if (item_y < start_y + 3)
3596 SetScrollbars (xUnit, yUnit, xUnit ? x / xUnit : 0, yUnit ? y / yUnit : 0, x_pos, yUnit ? item_y / yUnit : 0);
3598 else if (item_y +
GetLineHeight(gitem) > start_y + client_h)
3601 item_y += yUnit + 2;
3602 SetScrollbars (xUnit, yUnit, xUnit ? x / xUnit : 0, yUnit ? y / yUnit : 0, x_pos, yUnit ? (item_y +
GetLineHeight(gitem) - client_h) / yUnit : 0 );
3627 wxCHECK_RET (itemId.IsOk(),
_T(
"invalid tree item"));
3632 _T(
"wxTreeListMainWindow::SortChildren is not reentrant") );
3634 wxArrayTreeListItems& children = item->
GetChildren();
3635 if ( children.Count() > 1 )
3650 wxTreeItemId next = item;
3671#if !wxCHECK_VERSION(2, 5, 0)
3674 wxTreeItemIdValue cookie = 0;
3679 if (next.IsOk() && HasFlag(wxTR_HIDE_ROOT))
3684 if (!next.IsOk())
return (wxTreeItemId*)NULL;
3688 int col = 0, col_start, col_end;
3691 col_start = col_end = col;
3698 while (next.IsOk() && (next != item))
3701 for (col = col_start; col <= col_end; col++)
3705 itemText =
GetItemText (next, col).Mid (0, str.Length());
3713 if (itemText.CmpNoCase (str) == 0)
return next;
3717 if (itemText.Cmp (str) == 0)
return next;
3737 if (!next.IsOk() && item.IsOk())
3740 if (HasFlag(wxTR_HIDE_ROOT))
3746 return (wxTreeItemId*)NULL;
3759 wxClientDC dc (
this);
3769 for (
int i = 0; i < n ; i++)
3771 int width = 0, height = 0;
3783 for (
int i = 0; i < n ; i++)
3785 int width = 0, height = 0;
3853 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3854 if (xUnit == 0) xUnit = GetCharWidth();
3859 int x_pos = GetScrollPos (wxHORIZONTAL);
3860 int y_pos = GetScrollPos (wxVERTICAL);
3862 if (x < GetClientSize().GetWidth()) x_pos = 0;
3863 SetScrollbars (xUnit, yUnit, x / xUnit, y / yUnit, x_pos, y_pos);
3867 SetScrollbars (0, 0, 0, 0);
3873 if (GetWindowStyleFlag() & wxTR_HAS_VARIABLE_ROW_HEIGHT)
3889#if !wxCHECK_VERSION(2, 5, 0)
3890 wxColour colTextHilight = wxSystemSettings::GetSystemColour (wxSYS_COLOUR_HIGHLIGHTTEXT);
3892 wxColour colTextHilight = wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHTTEXT);
3896 int off_h = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
3898 wxDCClipper clipper (dc, 0, item->
GetY(), total_w, total_h);
3908 dc.SetBrush (wxBrush ( colBg, wxSOLID));
3909 dc.SetPen (*wxTRANSPARENT_PEN);
3910 if (HasFlag (wxTR_FULL_ROW_HIGHLIGHT))
3918 dc.SetPen (*wxBLACK_PEN);
3925 dc.SetPen (*wxTRANSPARENT_PEN);
3928 dc.SetTextForeground (colTextHilight);
3935 dc.SetPen (
m_hasFocus ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3938 dc.DrawRectangle (0, item->
GetY() + off_h, total_w, total_h - off_h);
3942 int text_extraH = (total_h > text_h) ? (total_h - text_h) / 2 : 0;
3949 if (col_w <= 0)
continue;
3950 wxDCClipper clipper (dc, x_colstart, item->
GetY(), col_w, total_h);
3982 int w = 0, text_w = 0;
3983 wxString text = item->
GetText(i);
3984 dc.GetTextExtent (text, &text_w, NULL);
3991 w = col_w - (image_w + text_w + off_w +
MARGIN);
3992 x += (w > 0) ? w : 0;
3994 case wxALIGN_CENTER:
3995 w = (col_w - (image_w + text_w + off_w +
MARGIN)) / 2;
3996 x += (w > 0) ? w : 0;
3999 int text_x = x + image_w;
4004 if ( ! HasFlag (wxTR_FULL_ROW_HIGHLIGHT))
4007 bool drawCursor =
false;
4015 dc.SetPen (*wxTRANSPARENT_PEN);
4016 dc.SetBrush (wxBrush ( colBg, wxSOLID));
4017 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
4019 dc.SetPen (drawCursor ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
4021 dc.SetTextForeground (colTextHilight);
4022 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
4028 dc.SetPen (drawCursor && i !=
GetMainColumn() ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
4029 dc.SetBrush (wxBrush ( colBg, wxSOLID));
4030 dc.SetTextForeground (colText);
4031 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
4035 dc.SetPen (*wxBLACK_PEN);
4036 dc.SetBackgroundMode (wxTRANSPARENT);
4037 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
4045#if !wxCHECK_VERSION(2, 5, 0)
4046 wxPen pen (wxSystemSettings::GetSystemColour (wxSYS_COLOUR_3DLIGHT ), 1, wxSOLID);
4048 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_3DLIGHT ), 1, wxSOLID);
4050 dc.SetPen ((GetBackgroundColour() == *wxWHITE) ? pen : *wxWHITE_PEN);
4051 dc.DrawLine (x_colstart + col_w - 1, item->
GetY(), x_colstart + col_w - 1, item->
GetY() + total_h);
4054 dc.SetBackgroundMode (wxTRANSPARENT);
4059 int y = item->
GetY() + img_extraH;
4064 int text_y = item->
GetY() + text_extraH;
4065 dc.DrawText (text, (wxCoord)text_x, (wxCoord)text_y);
4067 x_colstart += col_w;
4076 int level,
int& y,
int x_maincol)
4080 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0))
4082 wxArrayTreeListItems& children = item->
GetChildren();
4083 for (
size_t n = 0; n < children.Count(); n++)
4085 PaintLevel (children[n], dc, 1, y, x_maincol);
4092 int x = x_maincol +
MARGIN;
4093 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
4102 if (HasFlag(wxTR_HIDE_ROOT))
4117 int y_mid = y_top + (h / 2);
4120 int exposed_x = dc.LogicalToDeviceX(0);
4121 int exposed_y = dc.LogicalToDeviceY(y_top);
4123 if (IsExposed(exposed_x, exposed_y, 10000, h))
4126 if (HasFlag(wxTR_ROW_LINES))
4132#if !wxCHECK_VERSION(2, 5, 0)
4133 wxPen pen (wxSystemSettings::GetSystemColour (wxSYS_COLOUR_3DLIGHT ), 1, wxSOLID);
4135 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_3DLIGHT ), 1, wxSOLID);
4137 dc.SetPen ((GetBackgroundColour() == *wxWHITE) ? pen : *wxWHITE_PEN);
4138 dc.DrawLine (0, y_top, total_width, y_top);
4139 dc.DrawLine (0, y_top + h, total_width, y_top + h);
4146 dc.SetBrush(*wxWHITE_BRUSH);
4152 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
4154 if (!HasFlag(wxTR_NO_LINES))
4160 if (x2 < (x_maincol +
MARGIN)) x2 = x_maincol +
MARGIN;
4167 dc.DrawLine (x3, y_mid, x3 +
LINEATROOT, y_mid);
4171 dc.DrawLine (x2, y_mid, x3 +
LINEATROOT, y_mid);
4176 dc.DrawLine (x2, y_mid, x -
m_indent / 2, y_mid);
4187 int image = wxTreeItemIcon_Normal;
4188 if (item->
IsExpanded()) image = wxTreeItemIcon_Expanded;
4189 if (item->
IsSelected()) image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
4194 dc.DestroyClippingRegion();
4197 else if (HasFlag (wxTR_TWIST_BUTTONS))
4201 dc.SetPen(*wxBLACK_PEN);
4209 button[1].y = button[0].y;
4217 button[1].x = button[0].x;
4220 button[2].y = y_mid;
4222 dc.DrawPolygon(3, button);
4229#if !wxCHECK_VERSION(2, 7, 0)
4230 dc.SetPen(*wxGREY_PEN);
4231 dc.SetBrush(*wxWHITE_BRUSH);
4233 dc.SetPen(*wxBLACK_PEN);
4241 int flag = item->
IsExpanded() ? wxCONTROL_EXPANDED : 0;
4242 wxRendererNative::GetDefault().DrawTreeItemButton (
this, dc, rect, flag);
4252 dc.SetBrush(*wxWHITE_BRUSH);
4254 dc.SetTextForeground(*wxBLACK);
4258 wxArrayTreeListItems& children = item->
GetChildren();
4272 oldY = y_mid + h / 2;
4275 for (
size_t n = 0; n < children.Count(); ++n)
4279 PaintLevel (children[n], dc, level + 1, y, x_maincol);
4282 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
4283 if (!HasFlag (wxTR_NO_LINES))
4286 dc.DrawLine (x, oldY, x, y2);
4302 wxAutoBufferedPaintDC dc (
this);
4303 wxBrush brush(GetBackgroundColour(), wxSOLID);
4304 dc.SetBackground(brush);
4376 wxTreeEvent nevent (wxEVT_COMMAND_TREE_KEY_DOWN, 0 );
4378 nevent.SetKeyEvent (event);
4379 if (
SendEvent(0, NULL, &nevent))
return;
4382 bool curItemSet =
false;
4387 if (HasFlag(wxTR_HIDE_ROOT))
4389#if !wxCHECK_VERSION(2, 5, 0)
4392 wxTreeItemIdValue cookie = 0;
4401 if (HasFlag(wxTR_MULTIPLE) && event.ShiftDown())
4410 if (curItemSet)
return;
4413 wxTreeItemId newItem = (wxTreeItemId*)NULL;
4414 switch (event.GetKeyCode())
4473 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT))
4492 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1, 1));
4500 if (abs_p.y < 0) abs_p.y = 0;
4513#if !wxCHECK_VERSION(2, 5, 0)
4516 wxTreeItemIdValue cookie = 0;
4526 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT))
4528 newItem = (wxTreeItemId*)NULL;
4544 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT))
4563#if !wxCHECK_VERSION(2, 5, 0)
4566 wxTreeItemIdValue cookie = 0;
4579#if !wxCHECK_VERSION(2, 5, 0)
4582 wxTreeItemIdValue cookie = 0;
4594 while (!newItem && parent);
4604 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1, GetClientSize().GetHeight() -
m_curItem->
GetHeight()));
4629 if (event.GetKeyCode() >= (
int)
' ' && event.GetKeyCode() < WXK_START)
4632 m_findStr.Append ((
char)event.GetKeyCode());
4638 if (newItem || (
m_findStr.Length() <= 1))
break;
4649 if (!event.ControlDown())
4651 bool unselect_others = !((
event.ShiftDown() ||
event.ControlDown()) &&
4652 HasFlag(wxTR_MULTIPLE));
4670 if (point.x < 0) flags |= wxTREE_HITTEST_TOLEFT;
4671 if (point.x > w) flags |= wxTREE_HITTEST_TORIGHT;
4672 if (point.y < 0) flags |= wxTREE_HITTEST_ABOVE;
4673 if (point.y > h) flags |= wxTREE_HITTEST_BELOW;
4674 if (flags)
return wxTreeItemId();
4678 flags = wxTREE_HITTEST_NOWHERE;
4680 return wxTreeItemId();
4684 this, flags, column, 0);
4687 flags = wxTREE_HITTEST_NOWHERE;
4689 return wxTreeItemId();
4696 bool WXUNUSED(textOnly))
const
4698 wxCHECK_MSG (itemId.IsOk(),
false,
_T(
"invalid item in wxTreeListMainWindow::GetBoundingRect") );
4703 GetScrollPixelsPerUnit (&xUnit, &yUnit);
4705 GetViewStart(& startX, & startY);
4707 rect.x = item->
GetX() - startX * xUnit;
4708 rect.y = item->
GetY() - startY * yUnit;
4721 if (!item.IsOk())
return;
4733 wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 0 );
4736 if (!te.IsAllowed())
return;
4757 for (
int i = 0; i < column; ++i)
4774 case wxALIGN_CENTER:
4776 style = wxTE_CENTER;
4794 wxClientDC dc (
this);
4796 x = dc.LogicalToDeviceX (x);
4797 y = dc.LogicalToDeviceY (y);
4803 wxPoint (x, y), wxSize (w, h), style);
4814 wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, 0 );
4816 le.SetEditCanceled(isCancelled);
4819 if (! isCancelled && le.IsAllowed())
4835 bool mayDrag =
true;
4836 bool maySelect =
true;
4837 bool mayClick =
true;
4838 bool mayDoubleClick =
true;
4842 if (
m_owner->GetEventHandler()->ProcessEvent(event))
return;
4853 wxPoint p = wxPoint (event.GetX(), event.GetY());
4857 bool bCrosshair = (item && item->
HasPlus() && (flags & wxTREE_HITTEST_ONITEMBUTTON));
4861 maySelect = mayDoubleClick =
false;
4864 if (event.Dragging())
4866 maySelect = mayDoubleClick = mayClick =
false;
4872 if (event.LeftDown()) maySelect =
false;
4874 mayDoubleClick =
false;
4877 if (mayDoubleClick) mayDoubleClick = mayClick;
4879 if (maySelect) maySelect = mayClick;
4885 if (HasFlag(wxTR_MULTIPLE))
4890 if (event.ControlDown() ||
event.ShiftDown())
4892 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4899 else if ((item != NULL && item->
IsSelected()))
4901 maySelect = maySelect &&
event.LeftUp();
4908 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4915 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4923 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown())
SetFocus();
4933 wxScrolledWindow::SetToolTip(
m_toolTip);
4945 wxScrolledWindow::SetToolTip(*tip);
4953 wxScrolledWindow::SetToolTip(wxString());
4960 wxScrolledWindow::SetToolTip(
m_toolTip);
4974 if (bCrosshair && event.LeftDown())
4989 if (event.LeftDown() && HasFlag(wxTR_MULTIPLE) && event.ShiftDown())
5000 bool unselect_others = ! (HasFlag(wxTR_MULTIPLE) && (
5002 ||
event.ControlDown()
5015 if (event.MiddleDown())
5018 wxTreeEvent nevent(0, 0);
5022 SendEvent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, item, &nevent);
5024 if (event.RightDown())
5027 wxTreeEvent nevent(0, 0);
5031 SendEvent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, item, &nevent);
5033 if (event.RightUp())
5036 wxTreeEvent nevent(0, 0);
5039 SendEvent(wxEVT_COMMAND_TREE_ITEM_MENU, item, &nevent);
5059 if (mayDoubleClick && event.LeftDClick())
5069 if (
SelectItem(item, (wxTreeItemId*)NULL,
true))
5073 if (!
SendEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, item))
5095 if (event.LeftDown() || event.MiddleDown() || event.RightDown())
5102 if (HasCapture()) ReleaseMouse();
5107 else if (event.Dragging())
5121 if (HasCapture()) ReleaseMouse();
5126 wxTreeEvent nevent(0, 0);
5129 SendEvent(wxEVT_COMMAND_TREE_END_DRAG, item, &nevent);
5134 else if (event.Dragging())
5140 const int tolerance = 3;
5143 if (dx <= tolerance && dy <= tolerance)
5163 wxTreeEvent nevent(0, 0);
5168 ? wxEVT_COMMAND_TREE_BEGIN_DRAG
5169 : wxEVT_COMMAND_TREE_BEGIN_RDRAG,
5175 if (bSkip)
event.Skip();
5197 if (
m_owner->GetEventHandler()->ProcessEvent(event))
return;
5199#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
5200 wxScrolledWindow::OnScroll(event);
5202 HandleOnScroll( event );
5205 if (event.GetOrientation() == wxHORIZONTAL)
5232 max_h += max_h / 10;
5242 int level,
int& y,
int x_colstart)
5246 int x = x_colstart +
MARGIN;
5247 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
5256 if (HasFlag(wxTR_HIDE_ROOT))
5266 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0))
goto Recurse;
5279 wxArrayTreeListItems& children = item->
GetChildren();
5280 long n, count = (long)children.Count();
5282 for (n = 0; n < count; ++n)
5292 wxClientDC dc(
this);
5315 wxClientDC dc(
this);
5320 GetVirtualSize( &cw, &ch );
5323 rect.x = dc.LogicalToDeviceX( 0 );
5325 rect.y = dc.LogicalToDeviceY( item->
GetY() - 2 );
5328 Refresh (
true, &rect );
5336 wxClientDC dc(
this);
5341 GetVirtualSize( &cw, &ch );
5344 rect.x = dc.LogicalToDeviceX( 0 );
5345 rect.y = dc.LogicalToDeviceY( item->
GetY() );
5349 Refresh (
true, &rect);
5367 const wxArrayTreeListItems& children = item->
GetChildren();
5368 long count = (long)children.GetCount();
5369 for (
long n = 0; n < count; n++ )
5381 if (!wxWindow::SetBackgroundColour(colour))
return false;
5389 if (!wxWindow::SetForegroundColour(colour))
return false;
5397 wxCHECK_RET (itemId.IsOk(),
_T(
"invalid tree item"));
5399 wxClientDC dc (
this);
5408 wxCHECK_MSG (itemId.IsOk(),
_T(
""),
_T(
"invalid tree item") );
5411 else return ((
wxTreeListItem*) itemId.m_pItem)->GetText (column);
5416 wxASSERT_MSG(
IsVirtual(),
_T(
"can be used only with virtual control") );
5422 wxWindow::SetFocus();
5428 if (!item)
return 0;
5433 GetTextExtent (item->
GetText (column), &w, &h, NULL, NULL, font.Ok() ? &font : NULL);
5437 int width = w + 2 *
MARGIN;
5441 if (HasFlag(wxTR_LINES_AT_ROOT)) width +=
LINEATROOT;
5449 while (parent && (!HasFlag(wxTR_HIDE_ROOT) || (parent != root)))
5454 if (level) width += level *
GetIndent();
5463 GetClientSize (&maxWidth, &h);
5470 if (!HasFlag(wxTR_HIDE_ROOT))
5473 if (width < w) width = w;
5474 if (width > maxWidth)
return maxWidth;
5477 wxTreeItemIdValue cookie = 0;
5482 if (width < w) width = w;
5483 if (width > maxWidth)
return maxWidth;
5489 if (width < w) width = w;
5490 if (width > maxWidth)
return maxWidth;
5503 wxTreeEvent nevent (event_type, 0);
5510 else if (event_type)
5512 event->SetEventType(event_type);
5515 event->SetEventObject (
m_owner);
5516 event->SetId(
m_owner->GetId());
5519#if !wxCHECK_VERSION(2, 5, 0)
5520 event->SetItem ((
long)item);
5522 event->SetItem (item);
5526 return m_owner->GetEventHandler()->ProcessEvent (*event);
5543 long style, const wxValidator& validator,
5544 const wxString&
name)
5546 long main_style = style & ~(wxSIMPLE_BORDER | wxSUNKEN_BORDER | wxDOUBLE_BORDER |
5547 wxRAISED_BORDER | wxSTATIC_BORDER);
5548 main_style |= wxWANTS_CHARS ;
5549 long ctrl_style = style & ~(wxVSCROLL | wxHSCROLL);
5551 if (!wxControl::Create(parent,
id, pos, size, ctrl_style, validator,
name))
5556 main_style, validator);
5558 wxPoint(0, 0), wxDefaultSize,
5560 CalculateAndSetHeaderHeight();
5571#if wxCHECK_VERSION_FULL(2, 7, 0, 1)
5573 h = (int)(wxRendererNative::Get().GetHeaderButtonHeight(m_header_win) * 0.8) + 2;
5575 h = wxRendererNative::Get().GetHeaderButtonHeight(m_header_win);
5579 m_header_win->GetTextExtent(
_T(
"Hg"), &w, &h, &d);
5584 if (h != m_headerHeight)
5595 GetClientSize(&w, &h);
5598 m_header_win->SetSize (0, 0, w, m_headerHeight);
5599 m_header_win->Refresh();
5603 m_main_win->SetSize (0, m_headerHeight, w, h - m_headerHeight);
5614 return m_main_win->GetCount();
5619 return m_main_win->GetIndent();
5624 m_main_win->SetIndent(indent);
5629 return m_main_win->GetLineSpacing();
5634 m_main_win->SetLineSpacing(spacing);
5639 return m_main_win->GetImageList();
5644 return m_main_win->GetStateImageList();
5649 return m_main_win->GetButtonsImageList();
5654 m_main_win->SetImageList(imageList);
5659 m_main_win->SetStateImageList(imageList);
5664 m_main_win->SetButtonsImageList(imageList);
5669 m_main_win->AssignImageList(imageList);
5674 m_main_win->AssignStateImageList(imageList);
5679 m_main_win->AssignButtonsImageList(imageList);
5686 return m_main_win->GetItemText (item, column);
5691 return m_main_win->GetItemImage(item, which);
5695 return m_main_win->GetItemImage(item, column);
5700 return m_main_win->GetItemData(item);
5704 return m_main_win->GetItemData(item, column);
5709 return m_main_win->GetItemBold(item);
5713 return m_main_win->GetItemBold(item, column);
5718 return m_main_win->GetItemTextColour(item);
5722 return m_main_win->GetItemTextColour(item, column);
5727 return m_main_win->GetItemBackgroundColour(item);
5731 return m_main_win->GetItemBackgroundColour(item, column);
5736 return m_main_win->GetItemFont(item);
5740 return m_main_win->GetItemFont(item, column);
5747 m_main_win->SetItemHasChildren(item, has);
5752 m_main_win->SetItemText (item, column, text);
5757 m_main_win->SetItemImage(item, image, which);
5761 m_main_win->SetItemImage(item, column, image);
5766 m_main_win->SetItemData(item, data);
5770 m_main_win->SetItemData(item, column, data);
5775 m_main_win->SetItemBold(item, bold);
5779 m_main_win->SetItemBold(item, column, bold);
5784 m_main_win->SetItemTextColour(item, colour);
5788 m_main_win->SetItemTextColour(item, column, colour);
5793 m_main_win->SetItemBackgroundColour(item, colour);
5797 m_main_win->SetItemBackgroundColour(item, column, colour);
5802 m_main_win->SetItemFont(item, font);
5806 m_main_win->SetItemFont(item, column, font);
5815 m_header_win->SetFont(font);
5816 CalculateAndSetHeaderHeight();
5817 m_header_win->Refresh();
5821 return m_main_win->SetFont(font);
5832 m_main_win->SetWindowStyle(style);
5833 m_windowStyle = style;
5838 long style = m_windowStyle;
5840 style |= m_main_win->GetWindowStyle();
5846 return m_main_win->IsVisible(item, fullRow, within);
5851 return m_main_win->HasChildren(item);
5856 return m_main_win->IsExpanded(item);
5861 return m_main_win->IsSelected(item);
5866 return m_main_win->GetChildrenCount(item, rec);
5871 return m_main_win->GetRootItem();
5876 return m_main_win->GetSelection();
5881 return m_main_win->GetSelections(arr);
5886 return m_main_win->GetItemParent(item);
5889#if !wxCHECK_VERSION(2, 5, 0)
5894 wxTreeItemIdValue& cookie)
const
5897 return m_main_win->GetFirstChild(item, cookie);
5900#if !wxCHECK_VERSION(2, 5, 0)
5905 wxTreeItemIdValue& cookie)
const
5908 return m_main_win->GetNextChild(item, cookie);
5911#if !wxCHECK_VERSION(2, 5, 0)
5916 wxTreeItemIdValue& cookie)
const
5919 return m_main_win->GetPrevChild(item, cookie);
5922#if !wxCHECK_VERSION(2, 5, 0)
5927 wxTreeItemIdValue& cookie)
const
5930 return m_main_win->GetLastChild(item, cookie);
5936 return m_main_win->GetNextSibling(item);
5941 return m_main_win->GetPrevSibling(item);
5946 return m_main_win->GetNext(item,
true);
5951 return m_main_win->GetPrev(item,
true);
5956 return m_main_win->GetFirstExpandedItem();
5961 return m_main_win->GetNextExpanded(item);
5966 return m_main_win->GetPrevExpanded(item);
5975 return m_main_win->GetFirstVisible(fullRow, within);
5980 return m_main_win->GetLastVisible(fullRow, within);
5985 return m_main_win->GetNextVisible(item, fullRow, within);
5990 return m_main_win->GetPrevVisible(item, fullRow, within);
5994 int selectedImage, wxTreeItemData* data)
5996 return m_main_win->AddRoot (text, image, selectedImage, data);
6000 const wxString& text,
int image,
6002 wxTreeItemData* data)
6004 return m_main_win->PrependItem(parent, text, image, selectedImage, data);
6008 const wxTreeItemId& previous,
6009 const wxString& text,
int image,
6011 wxTreeItemData* data)
6013 return m_main_win->InsertItem(parent, previous, text, image,
6014 selectedImage, data);
6019 const wxString& text,
int image,
6021 wxTreeItemData* data)
6023 return m_main_win->InsertItem(parent, index, text, image,
6024 selectedImage, data);
6028 const wxString& text,
int image,
6030 wxTreeItemData* data)
6032 return m_main_win->AppendItem(parent, text, image, selectedImage, data);
6037 m_main_win->Delete(item);
6042 m_main_win->DeleteChildren(item);
6047 m_main_win->DeleteRoot();
6052 m_main_win->Expand(item);
6057 m_main_win->ExpandAll(item);
6062 m_main_win->Collapse(item);
6067 m_main_win->CollapseAndReset(item);
6072 m_main_win->Toggle(item);
6077 m_main_win->Unselect();
6082 m_main_win->UnselectAll();
6086 bool unselect_others)
6088 return m_main_win->SelectItem (item,
last, unselect_others);
6093 m_main_win->SelectAll();
6098 m_main_win->EnsureVisible(item);
6103 m_main_win->ScrollTo(item);
6109 return m_main_win->HitTest (p, flags, column);
6113 bool textOnly)
const
6115 return m_main_win->GetBoundingRect(item, rect, textOnly);
6120 m_main_win->EditLabel (item, column);
6124 m_main_win->EndEdit(isCancelled);
6142 m_main_win->SortChildren(item, column, reverseOrder);
6147 return m_main_win->FindItem (item, column, str, mode);
6152 m_main_win->SetDragItem (item);
6157 if (!m_main_win)
return false;
6158 return m_main_win->SetBackgroundColour(colour);
6163 if (!m_main_win)
return false;
6164 return m_main_win->SetForegroundColour(colour);
6169 return m_main_win->GetColumnCount();
6174 m_header_win->SetColumnWidth (column, width);
6175 m_header_win->Refresh();
6180 return m_header_win->GetColumnWidth(column);
6185 m_main_win->SetMainColumn(column);
6190 return m_main_win->GetMainColumn();
6195 m_header_win->SetColumnText (column, text);
6196 m_header_win->Refresh();
6201 return m_header_win->GetColumnText(column);
6206 m_header_win->AddColumn (colInfo);
6212 m_header_win->InsertColumn (before, colInfo);
6213 m_header_win->Refresh();
6218 m_header_win->RemoveColumn (column);
6219 m_header_win->Refresh();
6224 m_header_win->SetColumn (column, colInfo);
6225 m_header_win->Refresh();
6230 return m_header_win->GetColumn(column);
6235 return m_header_win->GetColumn(column);
6240 m_header_win->SetColumn (column, GetColumn(column).SetImage(image));
6241 m_header_win->Refresh();
6246 return m_header_win->GetColumn(column).GetImage();
6251 m_header_win->SetColumn (column, GetColumn(column).SetEditable(shown));
6256 wxASSERT_MSG (column !=
GetMainColumn(),
_T(
"The main column may not be hidden") );
6257 m_header_win->SetColumn (column, GetColumn(column).SetShown(
GetMainColumn() == column ?
true : shown));
6258 m_header_win->Refresh();
6263 return m_header_win->GetColumn(column).IsEditable();
6268 return m_header_win->GetColumn(column).IsShown();
6273 m_header_win->SetColumn(column, GetColumn(column).SetAlignment(flag));
6274 m_header_win->Refresh();
6279 return m_header_win->GetColumn(column).GetAlignment();
6284 m_main_win->Refresh (erase, rect);
6285 m_header_win->Refresh (erase, rect);
6290 m_main_win->SetFocus();
6295 wxSize bestSizeHeader = m_header_win->GetBestSize();
6296 wxSize bestSizeMain = m_main_win->GetBestSize();
6297 return wxSize (bestSizeHeader.x > bestSizeMain.x ? bestSizeHeader.x : bestSizeMain.x, bestSizeHeader.y + bestSizeMain.y);
6302 return wxEmptyString;
6307 m_header_win->SetToolTip(tip);
6308 m_main_win->SetToolTip(tip);
6312 m_header_win->SetToolTip(tip);
6313 m_main_win->SetToolTip(tip);
6318 m_main_win->SetItemToolTip(item, tip);
6323 m_main_win->SetCurrentItem(itemId);
6328 m_main_win->SetItemParent(parent, item);
6339 wxTreeListCtrlXmlHandler::wxTreeListCtrlXmlHandler() : wxXmlResourceHandler()
6342#define wxTR_NO_BUTTONS 0x0000
6343#define wxTR_HAS_BUTTONS 0x0001
6344#define wxTR_NO_LINES 0x0004
6345#define wxTR_LINES_AT_ROOT 0x0008
6346#define wxTR_TWIST_BUTTONS 0x0010
6348#define wxTR_SINGLE 0x0000
6349#define wxTR_MULTIPLE 0x0020
6350#define wxTR_EXTENDED 0x0040
6351#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080
6353#define wxTR_EDIT_LABELS 0x0200
6354#define wxTR_ROW_LINES 0x0400
6355#define wxTR_HIDE_ROOT 0x0800
6357#define wxTR_FULL_ROW_HIGHLIGHT 0x2000
6360#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
6362#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
6366 XRC_ADD_STYLE(wxTR_NO_BUTTONS);
6367 XRC_ADD_STYLE(wxTR_HAS_BUTTONS);
6368 XRC_ADD_STYLE(wxTR_NO_LINES);
6369 XRC_ADD_STYLE(wxTR_LINES_AT_ROOT);
6370 XRC_ADD_STYLE(wxTR_TWIST_BUTTONS);
6372 XRC_ADD_STYLE(wxTR_SINGLE);
6373 XRC_ADD_STYLE(wxTR_MULTIPLE);
6374#if WXWIN_COMPATIBILITY_2_8
6376 XRC_ADD_STYLE(wxTR_EXTENDED);
6378 XRC_ADD_STYLE(wxTR_HAS_VARIABLE_ROW_HEIGHT);
6380 XRC_ADD_STYLE(wxTR_EDIT_LABELS);
6381 XRC_ADD_STYLE(wxTR_ROW_LINES);
6382 XRC_ADD_STYLE(wxTR_HIDE_ROOT);
6384 XRC_ADD_STYLE(wxTR_FULL_ROW_HIGHLIGHT);
6386 XRC_ADD_STYLE(wxTR_DEFAULT_STYLE);
6396 wxObject* wxTreeListCtrlXmlHandler::DoCreateResource()
6399 tlc->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(), wxDefaultValidator, GetName());
6404 bool wxTreeListCtrlXmlHandler::CanHandle(wxXmlNode* node)
6406 return IsOfClass(node, wxT(
"TreeListCtrl"));
6411#if wxCHECK_VERSION(2,9,0)
void OnKeyUp(wxKeyEvent &event)
void OnKillFocus(wxFocusEvent &event)
wxTreeListMainWindow * m_owner
void EndEdit(bool isCancelled)
void SetOwner(wxTreeListMainWindow *owner)
void OnChar(wxKeyEvent &event)
wxImageList * GetButtonsImageList() const
wxTreeItemId GetFirstChild(const wxTreeItemId &item, long &cookie) const
void AssignButtonsImageList(wxImageList *imageList)
bool HasChildren(const wxTreeItemId &item) const
void EditLabel(const wxTreeItemId &item)
void ExpandAll(const wxTreeItemId &item)
void InsertColumn(int before, const wxString &text, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false)
void Collapse(const wxTreeItemId &item)
virtual bool SetForegroundColour(const wxColour &colour)
unsigned int GetIndent() const
virtual int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2)
int GetColumnCount() const
void SetItemTextColour(const wxTreeItemId &item, const wxColour &colour)
void SetColumnAlignment(int column, int flag)
void Refresh(bool erase=TRUE, const wxRect *rect=NULL)
wxTreeItemId GetFirstVisible(bool fullRow=false, bool within=true) const
virtual wxSize DoGetBestSize() const
void SetImageList(wxImageList *imageList)
bool IsSelected(const wxTreeItemId &item) const
void SetMainColumn(int column)
wxTreeItemId AddRoot(const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void Delete(const wxTreeItemId &item)
void SetColumnWidth(int column, int width)
void DeleteChildren(const wxTreeItemId &item)
wxTreeItemId GetNextExpanded(const wxTreeItemId &item) const
void ScrollTo(const wxTreeItemId &item)
void SetItemData(const wxTreeItemId &item, wxTreeItemData *data)
wxTreeItemId HitTest(const wxPoint &point)
virtual bool SetBackgroundColour(const wxColour &colour)
wxTreeItemId GetNextSibling(const wxTreeItemId &item) const
void SetColumnEditable(int column, bool edit=true)
void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
void AssignStateImageList(wxImageList *imageList)
wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str, int mode=0)
void SetItemFont(const wxTreeItemId &item, const wxFont &font)
void RemoveColumn(int column)
void SetColumn(int column, const wxTreeListColumnInfo &colInfo)
wxTreeItemId GetFirstExpandedItem() const
void EndEdit(bool isCancelled)
bool IsExpanded(const wxTreeItemId &item) const
wxString GetItemText(const wxTreeItemId &item) const
void SetItemHasChildren(const wxTreeItemId &item, bool has=true)
wxTreeItemId GetNext(const wxTreeItemId &item) const
void SetColumnShown(int column, bool shown=true)
void SetButtonsImageList(wxImageList *imageList)
wxTreeItemId GetPrevChild(const wxTreeItemId &item, long &cookie) const
void SetColumnText(int column, const wxString &text)
wxTreeItemId GetNextChild(const wxTreeItemId &item, long &cookie) const
long GetWindowStyle() const
bool GetBoundingRect(const wxTreeItemId &item, wxRect &rect, bool textOnly=false) const
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void OnSize(wxSizeEvent &event)
wxTreeListHeaderWindow * GetHeaderWindow() const
bool SelectItem(const wxTreeItemId &item, const wxTreeItemId &last=(wxTreeItemId *) NULL, bool unselect_others=true)
wxColour GetItemTextColour(const wxTreeItemId &item) const
bool IsColumnShown(int column) const
wxTreeItemId GetPrevVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
wxTreeItemId GetPrevExpanded(const wxTreeItemId &item) const
wxTreeItemId GetLastVisible(bool fullRow=false, bool within=true) const
void AddColumn(const wxString &text, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false)
bool GetItemBold(const wxTreeItemId &item) const
int GetColumnImage(int column) const
void SetItemToolTip(const wxTreeItemId &item, const wxString &tip)
wxTreeItemId PrependItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
wxFont GetItemFont(const wxTreeItemId &item) const
wxTreeListColumnInfo GetColumn(int column)
size_t GetSelections(wxArrayTreeItemIds &) const
void SetColumnImage(int column, int image)
wxTreeItemId GetPrevSibling(const wxTreeItemId &item) const
wxString GetColumnText(int column) const
wxTreeItemId InsertItem(const wxTreeItemId &parent, const wxTreeItemId &idPrevious, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
wxTreeItemId GetSelection() const
wxTreeItemId GetFirstVisibleItem(bool fullRow=false) const
int GetColumnAlignment(int column) const
void CalculateAndSetHeaderHeight()
void SetItemBackgroundColour(const wxTreeItemId &item, const wxColour &colour)
wxColour GetItemBackgroundColour(const wxTreeItemId &item) const
void SetToolTip(const wxString &tip)
wxTreeItemData * GetItemData(const wxTreeItemId &item) const
size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true)
void SortChildren(const wxTreeItemId &item, int column=-1, bool reverseOrder=false)
wxImageList * GetImageList() const
wxTreeItemId GetRootItem() const
void SetStateImageList(wxImageList *imageList)
void Toggle(const wxTreeItemId &item)
bool IsVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
int GetColumnWidth(int column) const
void SetDragItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
wxTreeItemId GetLastChild(const wxTreeItemId &item, long &cookie) const
void EnsureVisible(const wxTreeItemId &item)
virtual bool SetFont(const wxFont &font)
int GetMainColumn() const
void SetWindowStyle(const long styles)
void CollapseAndReset(const wxTreeItemId &item)
void SetItemBold(const wxTreeItemId &item, bool bold=true)
bool IsColumnEditable(int column) const
void SetLineSpacing(unsigned int spacing)
unsigned int GetLineSpacing() const
virtual wxString OnGetItemText(wxTreeItemData *item, long column) const
wxTreeItemId GetNextVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
wxImageList * GetStateImageList() const
void AssignImageList(wxImageList *imageList)
wxTreeItemId GetItemParent(const wxTreeItemId &item) const
void SetCurrentItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
void SetItemText(const wxTreeItemId &item, const wxString &text)
void SetIndent(unsigned int indent)
void SetItemParent(const wxTreeItemId &parent, const wxTreeItemId &item)
void Expand(const wxTreeItemId &item)
int GetItemImage(const wxTreeItemId &item, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
wxTreeItemId GetPrev(const wxTreeItemId &item) const
~wxTreeListItemCellAttr()
void SetData(int column, wxTreeItemData *data)
wxTreeListItem * m_parent
void SetTextX(int text_x)
wxTreeItemData * GetData(int column) const
short m_images[wxTreeItemIcon_Max]
size_t GetChildrenCount(bool recursively=true) const
void SetItemParent(wxTreeListItem *parent)
wxTreeItemData * GetData() const
wxTreeListMainWindow * m_owner
wxTreeItemAttr * GetAttributes() const
wxArrayTreeListItems & GetChildren()
void GetSize(int &x, int &y, const wxTreeListMainWindow *)
bool IsBold(int column) const
void SetBold(int column, bool bold)
wxTreeItemAttr & Attr(int column)
const wxString * GetToolTip() const
const wxString GetText(int column) const
void SetHilight(bool set=true)
void SetImage(int column, int image, wxTreeItemIcon which)
wxTreeListItemCellAttrHash m_props_cell
void SetText(int column, const wxString &text)
void SetImage(int image, wxTreeItemIcon which)
void SetData(wxTreeItemData *data)
wxTreeListItemCellAttr m_props_row
wxTreeListItem * GetItemParent() const
wxTreeItemAttr * GetAttributes(int column) const
wxTreeListItem * HitTest(const wxPoint &point, const wxTreeListMainWindow *, int &flags, int &column, int level)
wxArrayTreeListItems m_children
void SetToolTip(const wxString &tip)
void SetHeight(int height)
int GetCurrentImage() const
void SetHasPlus(bool has=true)
int GetImage(wxTreeItemIcon which=wxTreeItemIcon_Normal) const
void Insert(wxTreeListItem *child, size_t index)
int GetImage(int column, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
void SetItemBold(const wxTreeItemId &item, bool bold=true)
void AssignButtonsImageList(wxImageList *imageList)
wxFont GetItemFont(const wxTreeItemId &item) const
size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true)
wxTreeListMainWindow(wxTreeListCtrl *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTR_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=_T("wxtreelistmainwindow"))
bool m_ownsImageListNormal
wxTreeItemId InsertItem(const wxTreeItemId &parent, const wxTreeItemId &idPrevious, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void CalculatePositions()
void SetCurrentItem(const wxTreeItemId &item)
wxTreeItemId GetLastChild(const wxTreeItemId &item, long &cookie) const
void SetWindowStyle(const long styles)
void AdjustMyScrollbars()
void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
wxImageList * m_imageListButtons
size_t GetSelections(wxArrayTreeItemIds &) const
wxTreeItemId GetPrevVisible(const wxTreeItemId &item, bool fullRow, bool within) const
void CalculateSize(wxTreeListItem *item, wxDC &dc)
wxTreeItemId DoInsertItem(const wxTreeItemId &parent, size_t previous, const wxString &text, int image, int selectedImage, wxTreeItemData *data)
int GetItemWidth(int column, wxTreeListItem *item)
wxTreeItemId GetNextVisible(const wxTreeItemId &item, bool fullRow, bool within) const
bool IsExpanded(const wxTreeItemId &item) const
wxTreeItemId GetNext(const wxTreeItemId &item, bool fulltree=true) const
wxImageList * m_imageListNormal
int GetColumnCount() const
friend class wxTreeListItem
void SetItemData(const wxTreeItemId &item, wxTreeItemData *data)
void Delete(const wxTreeItemId &item)
wxColour GetItemTextColour(const wxTreeItemId &item) const
wxTreeItemId GetPrevExpanded(const wxTreeItemId &item) const
void SetItemTextColour(const wxTreeItemId &item, const wxColour &colour)
bool HasButtons(void) const
wxTreeItemId GetNextSibling(const wxTreeItemId &item) const
virtual bool SetForegroundColour(const wxColour &colour)
void RefreshSubtree(wxTreeListItem *item)
void EditLabel(const wxTreeItemId &item, int column)
unsigned int GetLineSpacing() const
void FillArray(wxTreeListItem *, wxArrayTreeItemIds &) const
wxTreeItemId GetNextExpanded(const wxTreeItemId &item) const
bool m_left_down_selection
wxTreeListItem * m_editItem
void ExpandAll(const wxTreeItemId &item)
wxTreeItemId FindItem(const wxTreeItemId &item, int column, const wxString &str, int mode=0)
wxTreeItemId GetFirstChild(const wxTreeItemId &item, long &cookie) const
wxTreeListItem * m_toolTipItem
void RefreshLine(wxTreeListItem *item)
void SetItemHasChildren(const wxTreeItemId &item, bool has=true)
wxTreeItemId GetNextChild(const wxTreeItemId &item, long &cookie) const
int GetCurrentColumn() const
void AssignStateImageList(wxImageList *imageList)
wxColour GetItemBackgroundColour(const wxTreeItemId &item) const
void OnScroll(wxScrollWinEvent &event)
void CalculateLevel(wxTreeListItem *item, wxDC &dc, int level, int &y, int x_maincol)
void CollapseAndReset(const wxTreeItemId &item)
bool HasChildren(const wxTreeItemId &item) const
void Toggle(const wxTreeItemId &item)
wxImageList * GetImageList() const
int GetItemImage(const wxTreeItemId &item, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
void Collapse(const wxTreeItemId &item)
wxTreeItemId GetFirstExpandedItem() const
void SetItemToolTip(const wxTreeItemId &item, const wxString &tip)
void SetMainColumn(int column)
void PaintItem(wxTreeListItem *item, wxDC &dc)
bool TagNextChildren(wxTreeListItem *crt_item, wxTreeListItem *last_item)
void EndEdit(bool isCancelled)
wxImageList * m_imageListState
void OnMouse(wxMouseEvent &event)
void OnKillFocus(wxFocusEvent &event)
bool IsSelected(const wxTreeItemId &item) const
wxImageList * GetStateImageList() const
void SetToolTip(const wxString &tip)
void OnRenameAccept(bool isCancelled)
virtual ~wxTreeListMainWindow()
bool IsBold(const wxTreeItemId &item) const
wxString GetItemText(const wxTreeItemId &item, int column) const
bool m_ownsImageListState
void SetItemBackgroundColour(const wxTreeItemId &item, const wxColour &colour)
void SetButtonsImageList(wxImageList *imageList)
bool GetBoundingRect(const wxTreeItemId &item, wxRect &rect, bool textOnly=false) const
wxImageList * GetButtonsImageList() const
wxTreeListItem * m_dragItem
unsigned short m_linespacing
void SetImageList(wxImageList *imageList)
void OnChar(wxKeyEvent &event)
void OnIdle(wxIdleEvent &event)
void EnsureVisible(const wxTreeItemId &item)
wxTreeListItem * m_selectItem
wxTreeItemId AddRoot(const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void SetItemParent(const wxTreeItemId &parent, const wxTreeItemId &item)
void DoDeleteItem(wxTreeListItem *item)
bool IsVisible(const wxTreeItemId &item, bool fullRow, bool within=true) const
void Expand(const wxTreeItemId &item)
void ScrollTo(const wxTreeItemId &item)
unsigned int GetIndent() const
void SetItemFont(const wxTreeItemId &item, const wxFont &font)
void SetIndent(unsigned int indent)
wxTreeItemId GetLastVisible(bool fullRow, bool within) const
wxTreeItemId GetPrev(const wxTreeItemId &item, bool fulltree=true) const
void SetStateImageList(wxImageList *imageList)
bool SendEvent(wxEventType event_type, wxTreeListItem *item=NULL, wxTreeEvent *event=NULL)
wxTreeItemId GetFirstVisible(bool fullRow, bool within) const
bool TagAllChildrenUntilLast(wxTreeListItem *crt_item, wxTreeListItem *last_item)
wxBrush * m_hilightUnfocusedBrush
wxTreeItemId GetPrevSibling(const wxTreeItemId &item) const
wxTreeItemId GetPrevChild(const wxTreeItemId &item, long &cookie) const
int GetLineHeight(wxTreeListItem *item) const
virtual bool SetBackgroundColour(const wxColour &colour)
virtual bool SetFont(const wxFont &font)
virtual int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2)
bool SelectItem(const wxTreeItemId &item, const wxTreeItemId &prev=(wxTreeItemId *) NULL, bool unselect_others=true)
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
bool Create(wxTreeListCtrl *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTR_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=_T("wxtreelistctrl"))
wxTreeItemId HitTest(const wxPoint &point)
void PaintLevel(wxTreeListItem *item, wxDC &dc, int level, int &y, int x_maincol)
void UnselectAllChildren(wxTreeListItem *item)
void DeleteChildren(const wxTreeItemId &item)
void OnSetFocus(wxFocusEvent &event)
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
bool m_ownsImageListButtons
void SetDragItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
void SortChildren(const wxTreeItemId &item, int column, bool reverseOrder)
void CalculateLineHeight()
wxTreeListItem * m_curItem
void OnPaint(wxPaintEvent &event)
friend class wxEditTextCtrl
wxTreeItemId GetItemParent(const wxTreeItemId &item) const
void AssignImageList(wxImageList *imageList)
int GetMainColumn() const
wxTreeListItem * m_rootItem
void SetLineSpacing(unsigned int spacing)
bool GetItemBold(const wxTreeItemId &item) const
wxTreeListItem * m_shiftItem
wxTreeItemId GetSelection() const
wxTreeItemId PrependItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void OnCaptureLost(wxMouseCaptureLostEvent &WXUNUSED(event))
int GetBestColumnWidth(int column, wxTreeItemId parent=wxTreeItemId())
wxTreeItemId HitTest(const wxPoint &point, int &flags)
void SetItemText(const wxTreeItemId &item, int column, const wxString &text)
wxTreeItemId GetRootItem() const
wxEditTextCtrl * m_editControl
void RefreshSelectedUnder(wxTreeListItem *item)
wxTreeItemData * GetItemData(const wxTreeItemId &item) const
wxTreeListRenameTimer(wxTreeListMainWindow *owner)
wxTreeListMainWindow * m_owner
if(nReturnType==EIGENVALUES)
CONSTDATA date::last_spec last
CONSTCD11 std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
static int LINKAGEMODE tree_ctrl_compare_func(wxTreeListItem **item1, wxTreeListItem **item2)
static wxTreeListColumnInfo wxInvalidTreeListColumnInfo
static const int HEADER_OFFSET_Y
static const int BTNHEIGHT
static const int NO_IMAGE
static const int HEADER_OFFSET_X
static const int LINEHEIGHT
EVT_ERASE_BACKGROUND(wxTreeListHeaderWindow::OnEraseBackground) void wxTreeListHeaderWindow
static const int MININDENT
static const int EXTRA_WIDTH
static const int FIND_TIMER_TICKS
static const int LINEATROOT
static const int DRAG_TIMER_TICKS
static wxTreeListMainWindow * s_treeBeingSorted
static const int RENAME_TIMER_TICKS
WX_DECLARE_OBJARRAY(wxTreeListColumnInfo, wxArrayTreeListColumnInfo)
static const int BTNWIDTH
WX_DEFINE_ARRAY(wxTreeListItem *, wxArrayTreeListItems)
WX_DEFINE_OBJARRAY(wxArrayTreeListColumnInfo)
WX_DECLARE_HASH_MAP(int, wxTreeListItemCellAttr *, wxIntegerHash, wxIntegerEqual, wxTreeListItemCellAttrHash)
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
const wxChar * wxTreeListCtrlNameStr
static const int EXTRA_HEIGHT
class WXDLLEXPORT wxTreeListItem
const int wxTL_MODE_NAV_VISIBLE
const int wxTL_MODE_NAV_LEVEL
class WXDLLEXPORT wxTreeListHeaderWindow
const int wxTL_MODE_FIND_NOCASE
const int wxTREE_HITTEST_ONITEMCOLUMN
#define wxTR_COLUMN_LINES
const int wxTL_MODE_NAV_EXPANDED
const int wxTL_MODE_FIND_PARTIAL