21 #if defined(__GNUG__) && !defined(__APPLE__)
22 #pragma implementation "treelistctrl.h"
26 #include "wx/wxprec.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 #include <wx/renderer.h>
44 #include <wx/apptrait.h>
45 #include <wx/dcbuffer.h>
46 #include <wx/tooltip.h>
47 #include <wx/hashmap.h>
48 #include <wx/dynarray.h>
49 #include <wx/arrimpl.cpp>
50 #include <wx/itemattr.h>
52 #if defined(__WXMAC__) && defined(__WXOSX__)
53 #include "wx/osx/private.h"
54 #elif defined(__WXMAC__)
55 #include "wx/mac/private.h"
61 #include <wx/msgdlg.h>
145 const wxPoint &pos = wxDefaultPosition,
146 const wxSize &size = wxDefaultSize,
148 const wxString &name = _T(
"wxtreelistctrlcolumntitles") );
152 void DoDrawRect( wxDC *dc,
int x,
int y,
int w,
int h );
156 void OnPaint( wxPaintEvent &event );
158 void OnMouse( wxMouseEvent &event );
188 wxEmptyString, _T(
"Invalid column"));
193 _T(
"Invalid column"));
199 wxALIGN_LEFT, _T(
"Invalid column"));
204 _T(
"Invalid column"));
210 -1, _T(
"Invalid column"));
217 false, _T(
"Invalid column"));
223 true, _T(
"Invalid column"));
237 DECLARE_EVENT_TABLE()
251 friend class wxEditTextCtrl;
259 const wxPoint& pos = wxDefaultPosition,
260 const wxSize& size = wxDefaultSize,
261 long style = wxTR_DEFAULT_STYLE,
262 const wxValidator &validator = wxDefaultValidator,
263 const wxString& name = _T(
"wxtreelistmainwindow"))
266 Create (parent,
id, pos, size, style, validator, name);
272 const wxPoint& pos = wxDefaultPosition,
273 const wxSize& size = wxDefaultSize,
274 long style = wxTR_DEFAULT_STYLE,
275 const wxValidator &validator = wxDefaultValidator,
276 const wxString& name = _T(
"wxtreelistctrl"));
285 size_t GetCount()
const;
291 void SetIndent(
unsigned int indent);
295 void SetLineSpacing(
unsigned int spacing);
313 void SetImageList(wxImageList *imageList);
314 void SetStateImageList(wxImageList *imageList);
315 void SetButtonsImageList(wxImageList *imageList);
316 void AssignImageList(wxImageList *imageList);
317 void AssignStateImageList(wxImageList *imageList);
318 void AssignButtonsImageList(wxImageList *imageList);
320 void SetToolTip(
const wxString& tip);
321 void SetToolTip(wxToolTip *tip);
322 void SetItemToolTip(
const wxTreeItemId& item,
const wxString &tip);
331 wxString GetItemText (
const wxTreeItemId& item,
int column)
const;
332 wxString GetItemText (wxTreeItemData* item,
int column)
const;
335 int GetItemImage (
const wxTreeItemId& item, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const {
return GetItemImage (item, GetMainColumn(), which); }
336 int GetItemImage (
const wxTreeItemId& item,
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const;
339 wxTreeItemData *GetItemData(
const wxTreeItemId& item)
const;
340 wxTreeItemData *GetItemData(
const wxTreeItemId& item,
int column)
const;
342 bool GetItemBold(
const wxTreeItemId& item)
const;
343 bool GetItemBold(
const wxTreeItemId& item,
int column)
const;
345 wxColour GetItemTextColour(
const wxTreeItemId& item)
const;
346 wxColour GetItemTextColour(
const wxTreeItemId& item,
int column)
const;
348 wxColour GetItemBackgroundColour(
const wxTreeItemId& item)
const;
349 wxColour GetItemBackgroundColour(
const wxTreeItemId& item,
int column)
const;
351 wxFont GetItemFont(
const wxTreeItemId& item)
const;
352 wxFont GetItemFont(
const wxTreeItemId& item,
int column)
const;
363 void SetItemHasChildren(
const wxTreeItemId& item,
bool has =
true);
366 void SetItemText (
const wxTreeItemId& item,
int column,
const wxString& text);
369 void SetItemImage (
const wxTreeItemId& item,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal) {
SetItemImage (item, GetMainColumn(), image, which); }
370 void SetItemImage (
const wxTreeItemId& item,
int column,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
373 void SetItemData(
const wxTreeItemId& item, wxTreeItemData *
data);
374 void SetItemData(
const wxTreeItemId& item,
int column, wxTreeItemData *
data);
377 void SetItemBold(
const wxTreeItemId& item,
bool bold =
true);
378 void SetItemBold(
const wxTreeItemId& item,
int column,
bool bold =
true);
381 void SetItemTextColour(
const wxTreeItemId& item,
const wxColour& colour);
382 void SetItemTextColour(
const wxTreeItemId& item,
int column,
const wxColour& colour);
385 void SetItemBackgroundColour(
const wxTreeItemId& item,
const wxColour& colour);
386 void SetItemBackgroundColour(
const wxTreeItemId& item,
int column,
const wxColour& colour);
389 void SetItemFont(
const wxTreeItemId& item,
const wxFont& font);
390 void SetItemFont(
const wxTreeItemId& item,
int column,
const wxFont& font);
398 bool IsVisible(
const wxTreeItemId& item,
bool fullRow,
bool within =
true)
const;
400 bool HasChildren(
const wxTreeItemId& item)
const;
402 bool IsExpanded(
const wxTreeItemId& item)
const;
404 bool IsSelected(
const wxTreeItemId& item)
const;
406 bool IsBold(
const wxTreeItemId& item)
const;
407 bool IsBold(
const wxTreeItemId& item,
int column)
const;
412 virtual bool SetFont(
const wxFont &font );
416 void SetWindowStyle(
const long styles);
423 size_t GetChildrenCount(
const wxTreeItemId& item,
bool recursively =
true);
437 size_t GetSelections(wxArrayTreeItemIds&)
const;
440 wxTreeItemId GetItemParent(
const wxTreeItemId& item)
const;
450 wxTreeItemId GetFirstChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
451 wxTreeItemId GetNextChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
452 wxTreeItemId GetPrevChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
453 wxTreeItemId GetLastChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
456 wxTreeItemId GetNextSibling(
const wxTreeItemId& item)
const;
457 wxTreeItemId GetPrevSibling(
const wxTreeItemId& item)
const;
460 wxTreeItemId GetNext(
const wxTreeItemId& item,
bool fulltree =
true)
const;
461 wxTreeItemId GetPrev(
const wxTreeItemId& item,
bool fulltree =
true)
const;
464 wxTreeItemId GetFirstExpandedItem()
const;
465 wxTreeItemId GetNextExpanded(
const wxTreeItemId& item)
const;
466 wxTreeItemId GetPrevExpanded(
const wxTreeItemId& item)
const;
469 wxTreeItemId GetFirstVisible(
bool fullRow,
bool within)
const;
470 wxTreeItemId GetNextVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
471 wxTreeItemId GetPrevVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
472 wxTreeItemId GetLastVisible (
bool fullRow,
bool within)
const;
478 wxTreeItemId AddRoot (
const wxString& text,
479 int image = -1,
int selectedImage = -1,
480 wxTreeItemData *
data = NULL);
483 wxTreeItemId PrependItem(
const wxTreeItemId& parent,
484 const wxString& text,
485 int image = -1,
int selectedImage = -1,
486 wxTreeItemData *
data = NULL);
489 wxTreeItemId InsertItem(
const wxTreeItemId& parent,
490 const wxTreeItemId& idPrevious,
491 const wxString& text,
492 int image = -1,
int selectedImage = -1,
493 wxTreeItemData *
data = NULL);
496 wxTreeItemId InsertItem(
const wxTreeItemId& parent,
498 const wxString& text,
499 int image = -1,
int selectedImage = -1,
500 wxTreeItemData *
data = NULL);
503 wxTreeItemId AppendItem(
const wxTreeItemId& parent,
504 const wxString& text,
505 int image = -1,
int selectedImage = -1,
506 wxTreeItemData *
data = NULL);
509 void Delete(
const wxTreeItemId& item);
512 void DeleteChildren(
const wxTreeItemId& item);
517 void SetItemParent(
const wxTreeItemId& parent,
const wxTreeItemId& item);
520 void Expand(
const wxTreeItemId& item);
522 void ExpandAll(
const wxTreeItemId& item);
524 void Collapse(
const wxTreeItemId& item);
526 void CollapseAndReset(
const wxTreeItemId& item);
528 void Toggle(
const wxTreeItemId& item);
531 void SetCurrentItem(
const wxTreeItemId& item);
537 bool SelectItem(
const wxTreeItemId& item,
const wxTreeItemId& prev = (wxTreeItemId*)NULL,
538 bool unselect_others =
true);
542 void EnsureVisible(
const wxTreeItemId& item);
544 void ScrollTo(
const wxTreeItemId& item);
545 void AdjustMyScrollbars();
550 {
int flags;
int column;
return HitTest (point, flags, column); }
552 {
int column;
return HitTest (point, flags, column); }
553 wxTreeItemId HitTest (
const wxPoint& point,
int&
flags,
int& column);
557 bool GetBoundingRect(
const wxTreeItemId& item,
559 bool textOnly =
false)
const;
564 void EditLabel (
const wxTreeItemId& item,
int column);
565 void EndEdit(
bool isCancelled);
572 virtual int OnCompareItems(
const wxTreeItemId& item1,
573 const wxTreeItemId&
item2);
577 void SortChildren(
const wxTreeItemId& item,
int column,
bool reverseOrder);
580 bool MatchItemText (
const wxString &itemText,
const wxString &pattern,
int mode);
581 wxTreeItemId FindItem (
const wxTreeItemId& item,
int column,
const wxString& str,
int mode = 0);
586 virtual bool SetBackgroundColour(
const wxColour& colour);
587 virtual bool SetForegroundColour(
const wxColour& colour);
590 void SetDragItem (
const wxTreeItemId& item = (wxTreeItemId*)NULL);
593 void OnPaint( wxPaintEvent &event );
596 void OnKillFocus( wxFocusEvent &event );
597 void OnChar( wxKeyEvent &event );
598 void OnMouse( wxMouseEvent &event );
599 void OnIdle( wxIdleEvent &event );
600 void OnScroll(wxScrollWinEvent& event);
608 {
if ((column >= 0) && (column <
GetColumnCount())) m_main_column = column; }
613 int GetBestColumnWidth (
int column, wxTreeItemId parent = wxTreeItemId());
642 wxBrush *m_hilightBrush,
648 bool m_ownsImageListNormal,
650 m_ownsImageListButtons;
654 wxImageList *m_imageListNormal,
683 wxTreeItemId DoInsertItem(
const wxTreeItemId& parent,
685 const wxString& text,
686 int image,
int selectedImage,
687 wxTreeItemData *
data);
691 {
return (m_imageListButtons) || HasFlag (wxTR_TWIST_BUTTONS|wxTR_HAS_BUTTONS); }
693 void CalculateLineHeight();
695 void PaintLevel(
wxTreeListItem *item, wxDC& dc,
int level,
int &y,
699 void CalculateLevel(
wxTreeListItem *item, wxDC &dc,
int level,
int &y,
701 void CalculatePositions();
707 void RefreshSelected();
711 void OnRenameTimer();
712 void OnRenameAccept(
bool isCancelled);
718 bool SendEvent(wxEventType event_type,
wxTreeListItem *item = NULL, wxTreeEvent *event = NULL);
720 void OnDpiChanged(wxDPIChangedEvent& e);
723 DECLARE_EVENT_TABLE()
746 class wxEditTextCtrl:
public wxTextCtrl
749 wxEditTextCtrl (wxWindow *parent,
754 const wxString &value = wxEmptyString,
755 const wxPoint &pos = wxDefaultPosition,
756 const wxSize &size = wxDefaultSize,
758 const wxValidator& validator = wxDefaultValidator,
759 const wxString &name = wxTextCtrlNameStr );
762 virtual bool Destroy();
763 void EndEdit(
bool isCancelled);
766 void OnChar( wxKeyEvent &event );
767 void OnKeyUp( wxKeyEvent &event );
768 void OnKillFocus( wxFocusEvent &event );
778 DECLARE_EVENT_TABLE()
800 if (m_ownsAttr)
delete m_attr;
826 const wxArrayString& text,
829 wxTreeItemData *
data );
841 if ( IsVirtual() )
return m_owner->
GetItemText( m_props_row.m_data, column );
842 if (column < (
signed)m_text.GetCount())
return m_text[column];
843 return wxEmptyString;
846 int GetImage ( wxTreeItemIcon which = wxTreeItemIcon_Normal)
const {
return m_images[which]; };
847 int GetImage (
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const
850 if(column == m_owner->
GetMainColumn())
return m_images[which];
853 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
854 if (entry == m_props_cell.end())
return NO_IMAGE;
855 return entry->second->m_image;
859 wxTreeItemData *
GetData()
const {
return m_props_row.m_data; };
861 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
862 if (entry == m_props_cell.end())
return NULL;
863 return entry->second->m_data;
870 int GetCurrentImage()
const;
877 void SetText (
int column,
const wxString& text)
879 if (column < (
int)m_text.GetCount()) {
880 m_text[column] = text;
883 for (
int i = (
int)m_text.GetCount(); i < howmany; ++i)
885 m_text.Add(wxEmptyString);
888 m_text[column] = text;
891 void SetImage (
int image, wxTreeItemIcon which) { m_images[which] = image; };
892 void SetImage (
int column,
int image, wxTreeItemIcon which)
895 if (column == m_owner->
GetMainColumn()) m_images[which] = image;
898 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
899 if (entry == m_props_cell.end()) {
901 m_props_cell[column]->m_image = image;
903 entry->second->m_image = image;
912 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
913 if (entry == m_props_cell.end()) {
915 m_props_cell[column]->m_data =
data;
917 entry->second->m_data =
data;
921 void SetBold(
bool bold) { m_props_row.m_isBold = bold; }
924 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
925 if (entry == m_props_cell.end()) {
927 m_props_cell[column]->m_isBold = bold;
928 m_props_cell[column]->m_isBoldSet = 1;
930 entry->second->m_isBold = bold;
931 entry->second->m_isBoldSet = 1;
937 if (m_toolTip) {
delete m_toolTip; m_toolTip = NULL; }
938 if (tip.length() > 0) { m_toolTip =
new wxString(tip); }
947 bool HasPlus()
const {
return m_hasPlus || HasChildren(); }
948 bool IsBold()
const {
return m_props_row.m_isBold != 0; }
951 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
952 if (entry == m_props_cell.end() || ! entry->second->m_isBoldSet)
return IsBold();
953 return (entry->second->m_isBold != 0);
959 int GetX()
const {
return m_x; }
960 int GetY()
const {
return m_y; }
973 if (column >=0 && column < (
signed)m_text_x.GetCount())
975 return m_text_x[column];
979 void SetTextX (
int column,
int text_x) {
if (column >=0 && column < (
signed)m_text_x.GetCount()) m_text_x[column] = text_x; }
985 size_t GetChildrenCount(
bool recursively =
true)
const;
994 int &
flags,
int& column,
int level);
1000 void DeleteChildren();
1003 { m_children.Insert(child, index); }
1018 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1019 if (entry == m_props_cell.end())
return GetAttributes();
1020 return entry->second->m_attr;
1026 wxTreeListItemCellAttrHash::const_iterator entry = m_props_cell.find( column );
1027 if (entry == m_props_cell.end()) {
1029 m_props_cell[column]->m_attr =
new wxItemAttr;
1030 m_props_cell[column]->m_ownsAttr = 1;
1031 return *(m_props_cell[column]->m_attr);
1033 return *(entry->second->m_attr);
1038 if ( !m_props_row.m_attr )
1040 m_props_row.m_attr =
new wxItemAttr;
1041 m_props_row.m_ownsAttr = 1;
1043 return *m_props_row.m_attr;
1074 short m_images[wxTreeItemIcon_Max];
1079 int m_isCollapsed :1;
1080 int m_hasHilight :1;
1107 m_owner->OnRenameTimer();
1114 BEGIN_EVENT_TABLE (wxEditTextCtrl,wxTextCtrl)
1115 EVT_CHAR (wxEditTextCtrl::OnChar)
1116 EVT_KEY_UP (wxEditTextCtrl::OnKeyUp)
1117 EVT_KILL_FOCUS (wxEditTextCtrl::OnKillFocus)
1120 wxEditTextCtrl::wxEditTextCtrl (wxWindow *parent,
1121 const wxWindowID
id,
1125 const wxString &value,
1129 const wxValidator& validator,
1130 const wxString &name)
1131 : wxTextCtrl (parent,
id, value, pos, size, style | wxSIMPLE_BORDER | wxTE_PROCESS_ENTER, validator, name)
1136 (*m_accept) =
false;
1137 (*m_res) = wxEmptyString;
1138 m_startValue = value;
1147 if (m_finished)
return;
1151 (*m_accept) = ! isCancelled;
1152 (*m_res) = isCancelled ? m_startValue : GetValue();
1153 m_owner->OnRenameAccept(*m_res == m_startValue);
1154 m_owner->m_editControl = NULL;
1155 m_owner->m_editItem = NULL;
1165 wxTheApp->ScheduleForDestruction(
this);
1176 if (event.GetKeyCode() == WXK_RETURN)
1181 if (event.GetKeyCode() == WXK_ESCAPE)
1198 wxSize parentSize = m_owner->GetSize();
1199 wxPoint myPos = GetPosition();
1200 wxSize mySize = GetSize();
1202 GetTextExtent(GetValue() + _T(
"M"), &sx, &sy);
1203 if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x;
1204 if (mySize.x > sx) sx = mySize.x;
1238 m_isDragging =
false;
1244 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
1261 const wxString &name )
1262 : wxWindow( win, id, pos, size, style, name )
1269 SetBackgroundColour (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNFACE));
1279 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW ), 1, wxPENSTYLE_SOLID);
1280 const int m_corner = 1;
1282 dc->SetBrush( *wxTRANSPARENT_BRUSH );
1283 #if defined( __WXMAC__ )
1286 dc->SetPen( *wxBLACK_PEN );
1288 dc->DrawLine( x+w-m_corner+1, y, x+w, y+h );
1289 dc->DrawRectangle( x, y+h, w+1, 1 );
1291 #if defined( __WXMAC__ )
1292 pen = wxPen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
1295 dc->DrawLine( x+w-m_corner, y, x+w-1, y+h );
1296 dc->DrawRectangle( x+1, y+h-1, w-2, 1 );
1298 dc->SetPen( *wxWHITE_PEN );
1299 dc->DrawRectangle( x, y, w-m_corner+1, 1 );
1300 dc->DrawRectangle( x, y, 1, h );
1301 dc->DrawLine( x, y+h-1, x+1, y+h-1 );
1302 dc->DrawLine( x+w-1, y, x+w-1, y+1 );
1310 m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
1312 m_owner->GetViewStart( &x, NULL );
1315 dc.SetDeviceOrigin( -x * xpix, 0 );
1320 wxAutoBufferedPaintDC dc(
this );
1327 GetClientSize( &w, &h );
1328 m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
1329 dc.SetBackgroundMode(wxTRANSPARENT);
1332 for (
int i = 0; i < numColumns && x < w; i++ )
1336 wxHeaderButtonParams params;
1339 params.m_labelColour = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
1340 params.m_labelFont = GetFont();
1345 wxRect rect(x, 0, wCol, h);
1349 flags |= wxCONTROL_CURRENT;
1351 params.m_labelText = column.
GetText();
1356 if ((image != -1) && imageList)
1357 params.m_labelBitmap = imageList->GetBitmap(image);
1359 wxRendererNative::Get().DrawHeaderButton(
this, dc, rect, flags, wxHDR_SORT_ICON_NONE, ¶ms);
1363 wxRect rect(x, 0, w-x, h);
1364 wxRendererNative::Get().DrawHeaderButton(
this, dc, rect);
1373 ClientToScreen (&x1, &y1);
1380 m_owner->GetClientSize( NULL, &y2 );
1381 m_owner->ClientToScreen( &x2, &y2 );
1384 dc.SetLogicalFunction (wxINVERT);
1385 dc.SetPen (wxPen (*wxBLACK, 2, wxPENSTYLE_SOLID));
1386 dc.SetBrush (*wxTRANSPARENT_BRUSH);
1389 dc.DrawLine (x1, y1, x2, y2);
1390 dc.SetLogicalFunction (wxCOPY);
1391 dc.SetPen (wxNullPen);
1392 dc.SetBrush (wxNullBrush);
1399 for (
int col = 0; col < numColumns; col++ )
1404 if ( x < (colLeft + column.
GetWidth()) )
1425 }
while (++idx <= col);
1427 m_owner->CalcScrolledPosition(x, 0, &x, NULL);
1428 RefreshRect(wxRect(x, 0, width, GetSize().GetHeight()));
1435 m_owner->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL);
1437 const int col =
XToCol(x);
1440 SetToolTip(
m_columns[col].GetTooltip());
1444 SetToolTip(wxEmptyString);
1446 if ( event.Moving() )
1471 SendListEvent (wxEVT_COMMAND_LIST_COL_DRAGGING, event.GetPosition());
1476 GetClientSize( &w, NULL );
1477 m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
1483 if (event.ButtonUp()) {
1484 m_isDragging =
false;
1485 if (HasCapture()) ReleaseMouse();
1489 SendListEvent (wxEVT_COMMAND_LIST_COL_END_DRAG, event.GetPosition());
1500 bool hit_border =
false;
1507 for (
int column = 0; column < countCol; column++) {
1512 if (abs (x-xpos) < 3) {
1526 if (event.LeftDown() ||
event.RightUp()) {
1529 if (hit_border && event.LeftDown()) {
1530 m_isDragging =
true;
1534 SendListEvent (wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, event.GetPosition());
1536 wxEventType evt =
event.LeftDown()? wxEVT_COMMAND_LIST_COL_CLICK:
1537 wxEVT_COMMAND_LIST_COL_RIGHT_CLICK;
1540 }
else if (event.LeftDClick() && hit_border) {
1544 }
else if (event.Moving()) {
1564 wxWindow *parent = GetParent();
1565 wxListEvent le (type, parent->GetId());
1566 le.SetEventObject (parent);
1567 le.m_pointDrag = pos;
1573 le.m_pointDrag.y -= GetSize().y;
1575 parent->GetEventHandler()->ProcessEvent (le);
1581 m_owner->AdjustMyScrollbars();
1582 m_owner->m_dirty =
true;
1586 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1590 m_owner->AdjustMyScrollbars();
1591 m_owner->m_dirty =
true;
1595 wxCHECK_RET ((before >= 0) && (before <
GetColumnCount()), _T(
"Invalid column"));
1598 m_owner->AdjustMyScrollbars();
1599 m_owner->m_dirty =
true;
1603 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1606 m_owner->AdjustMyScrollbars();
1607 m_owner->m_dirty =
true;
1611 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1617 m_owner->AdjustMyScrollbars();
1619 m_owner->m_dirty =
true;
1628 const wxArrayString& text,
1629 int image,
int selImage,
1630 wxTreeItemData *
data)
1633 m_images[wxTreeItemIcon_Normal] = image;
1634 m_images[wxTreeItemIcon_Selected] = selImage;
1659 wxTreeListItemCellAttrHash::iterator entry =
m_props_cell.begin();
1661 if (entry->second)
delete entry->second;
1665 wxASSERT_MSG(
m_children.IsEmpty(), _T(
"please call DeleteChildren() before destructor"));
1674 if (!recursively)
return count;
1676 size_t total = count;
1677 for (
size_t n = 0; n < count; ++n) {
1685 if (y < bottomY) y = bottomY;
1687 if ( x < width ) x = width;
1691 for (
size_t n = 0; n < count; ++n ) {
1699 int &
flags,
int& column,
int level) {
1706 if (!theCtrl->HasFlag(wxTR_HIDE_ROOT) || (level > 0)) {
1716 if (point.x >= x && point.x < x+w) {
1725 if ((point.y >=
m_y) && (point.y <=
m_y + h)) {
1728 int y_mid =
m_y + h/2;
1729 if (point.y < y_mid) {
1730 flags |= wxTREE_HITTEST_ONITEMUPPERPART;
1732 flags |= wxTREE_HITTEST_ONITEMLOWERPART;
1739 if ((point.x >= bntX) && (point.x <= (bntX + theCtrl->
m_btnWidth)) &&
1740 (point.y >= bntY) && (point.y <= (bntY + theCtrl->
m_btnHeight))) {
1741 flags |= wxTREE_HITTEST_ONITEMBUTTON;
1750 if ((point.x >= imgX) && (point.x <= (imgX + theCtrl->
m_imgWidth)) &&
1751 (point.y >= imgY) && (point.y <= (imgY + theCtrl->
m_imgHeight))) {
1752 flags |= wxTREE_HITTEST_ONITEMICON;
1759 flags |= wxTREE_HITTEST_ONITEMLABEL;
1764 if (point.x <
m_x) {
1765 flags |= wxTREE_HITTEST_ONITEMINDENT;
1773 flags |= wxTREE_HITTEST_ONITEMRIGHT;
1795 for (
size_t n = 0; n < count; n++) {
1796 child =
m_children[n]->HitTest (point, theCtrl, flags, column, level+1);
1797 if (child)
return child;
1808 image =
GetImage (wxTreeItemIcon_SelectedExpanded);
1810 image =
GetImage (wxTreeItemIcon_Expanded);
1814 image =
GetImage (wxTreeItemIcon_Selected);
1816 image =
GetImage (wxTreeItemIcon_Normal);
1833 EVT_PAINT (wxTreeListMainWindow::OnPaint)
1835 EVT_MOUSE_EVENTS (wxTreeListMainWindow::OnMouse)
1836 EVT_CHAR (wxTreeListMainWindow::OnChar)
1837 EVT_SET_FOCUS (wxTreeListMainWindow::OnSetFocus)
1838 EVT_KILL_FOCUS (wxTreeListMainWindow::OnKillFocus)
1839 EVT_IDLE (wxTreeListMainWindow::OnIdle)
1840 EVT_SCROLLWIN (wxTreeListMainWindow::OnScroll)
1841 EVT_MOUSE_CAPTURE_LOST(wxTreeListMainWindow::OnCaptureLost)
1842 EVT_DPI_CHANGED(wxTreeListMainWindow::OnDpiChanged)
1851 void wxTreeListMainWindow::Init() {
1868 m_hilightBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHT), wxBRUSHSTYLE_SOLID);
1869 m_hilightUnfocusedBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW), wxBRUSHSTYLE_SOLID);
1871 m_imageListNormal = (wxImageList *) NULL;
1872 m_imageListButtons = (wxImageList *) NULL;
1873 m_imageListState = (wxImageList *) NULL;
1874 m_ownsImageListNormal = m_ownsImageListButtons =
1875 m_ownsImageListState =
false;
1877 m_imgWidth = 0, m_imgWidth2 = 0;
1878 m_imgHeight = 0, m_imgHeight2 = 0;
1879 m_btnWidth = 0, m_btnWidth2 = 0;
1880 m_btnHeight = 0, m_btnHeight2 = 0;
1882 m_isDragStarted = m_isDragging =
false;
1887 m_editControl = NULL;
1889 m_lastOnSame =
false;
1890 m_left_down_selection =
false;
1892 m_findTimer =
new wxTimer (
this, -1);
1894 #if defined( __WXMAC__ ) && defined(__WXMAC_CARBON__)
1895 m_normalFont.MacCreateThemeFont (kThemeViewsFont);
1897 m_normalFont = wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT);
1899 m_boldFont = wxFont( m_normalFont.GetPointSize(),
1900 m_normalFont.GetFamily(),
1901 m_normalFont.GetStyle(),
1903 m_normalFont.GetUnderlined(),
1904 m_normalFont.GetFaceName(),
1905 m_normalFont.GetEncoding());
1908 m_isItemToolTip =
false;
1916 const wxValidator &validator,
1917 const wxString& name) {
1919 wxScrolledWindow::Create (parent,
id, pos, size, style|wxHSCROLL|wxVSCROLL, name);
1921 #if wxUSE_VALIDATORS
1922 SetValidator(validator);
1927 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
1929 m_dottedPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 0, wxPENSTYLE_DOT);
1947 if (m_editControl) {
1965 m_indent = wxMax ((
unsigned)
MININDENT, indent);
1970 m_linespacing = spacing;
1977 wxCHECK_MSG (item.IsOk(), 0u, _T(
"invalid tree item"));
1983 if ((styles ^ m_windowStyle) & wxTR_MULTIPLE) {
UnselectAll(); }
1987 m_windowStyle = styles;
1992 m_isItemToolTip =
false;
1997 m_isItemToolTip =
false;
1998 m_toolTip = (tip == NULL) ? wxString() : tip->GetTip();
2003 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2004 m_isItemToolTip =
true;
2015 wxCHECK_MSG (item.IsOk(), -1, _T(
"invalid tree item"));
2016 return ((
wxTreeListItem*) item.m_pItem)->GetImage (column, which);
2020 wxCHECK_MSG (item.IsOk(), NULL, _T(
"invalid tree item"));
2024 wxCHECK_MSG (item.IsOk(), NULL, _T(
"invalid tree item"));
2029 wxCHECK_MSG(item.IsOk(),
false, _T(
"invalid tree item"));
2033 wxCHECK_MSG(item.IsOk(),
false, _T(
"invalid tree item"));
2038 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2041 if (attr && attr->HasTextColour()) {
2042 return attr->GetTextColour();
2044 return GetForegroundColour();
2048 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2051 if (attr && attr->HasTextColour()) {
2052 return attr->GetTextColour();
2059 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2062 if (attr && attr->HasBackgroundColour()) {
2063 return attr->GetBackgroundColour();
2065 return GetBackgroundColour();
2069 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2072 if (attr && attr->HasBackgroundColour()) {
2073 return attr->GetBackgroundColour();
2080 wxCHECK_MSG (item.IsOk(), wxNullFont, _T(
"invalid tree item"));
2083 if (attr && attr->HasFont()) {
2084 return attr->GetFont();
2085 }
else if (pItem->IsBold()) {
2092 wxCHECK_MSG (item.IsOk(), wxNullFont, _T(
"invalid tree item"));
2095 wxItemAttr *attr_row = pItem->GetAttributes();
2096 if (attr_cell && attr_cell->HasFont()) {
2097 return attr_cell->GetFont();
2098 }
else if (attr_row && attr_row->HasFont()) {
2099 return attr_row->GetFont();
2100 }
else if (pItem->IsBold(column)) {
2108 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2115 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2117 if(pItem->GetImage(column, which) != image)
2119 pItem->
SetImage (column, image, which);
2122 wxClientDC dc (
this);
2130 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2134 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2139 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2141 if (pItem->IsBold() != bold) {
2147 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2150 pItem->
SetBold (column, bold);
2156 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2158 pItem->
Attr().SetTextColour (colour);
2162 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2164 pItem->
Attr(column).SetTextColour (colour);
2169 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2171 pItem->
Attr().SetBackgroundColour (colour);
2175 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2177 pItem->
Attr(column).SetBackgroundColour (colour);
2182 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2184 pItem->
Attr().SetFont (font);
2188 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2190 pItem->
Attr(column).SetFont (font);
2196 wxScrolledWindow::SetFont (font);
2197 m_normalFont = font;
2198 m_boldFont = wxFont (m_normalFont.GetPointSize(),
2199 m_normalFont.GetFamily(),
2200 m_normalFont.GetStyle(),
2202 m_normalFont.GetUnderlined(),
2203 m_normalFont.GetFaceName());
2214 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2220 if (parent == m_rootItem && HasFlag(wxTR_HIDE_ROOT))
break;
2227 wxSize clientSize = GetClientSize();
2230 ((!fullRow && rect.GetWidth() == 0) || rect.GetHeight() == 0) ||
2231 (rect.GetTop() < 0 || rect.GetBottom() >= clientSize.y) ||
2232 (!fullRow && (rect.GetLeft() < 0 || rect.GetRight() >= clientSize.x)))
return false;
2239 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2250 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2255 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2260 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2269 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2274 wxTreeItemIdValue& cookie)
const {
2275 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2276 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2278 return (!children.IsEmpty())? wxTreeItemId(children.Item(0)): wxTreeItemId();
2282 wxTreeItemIdValue& cookie)
const {
2283 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2284 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2286 long *pIndex = ((
long*)&cookie);
2287 return ((*pIndex)+1 < (long)children.Count())? wxTreeItemId(children.Item(++(*pIndex))): wxTreeItemId();
2291 wxTreeItemIdValue& cookie)
const {
2292 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2293 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2295 long *pIndex = (
long*)&cookie;
2296 return ((*pIndex)-1 >= 0)? wxTreeItemId(children.Item(--(*pIndex))): wxTreeItemId();
2300 wxTreeItemIdValue& cookie)
const {
2301 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2302 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2304 long *pIndex = ((
long*)&cookie);
2305 (*pIndex) = (long)children.Count();
2306 return (!children.IsEmpty())? wxTreeItemId(children.Last()): wxTreeItemId();
2310 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2315 if (!parent)
return wxTreeItemId();
2318 wxArrayTreeListItems& siblings = parent->GetChildren();
2319 size_t index = siblings.Index (i);
2320 wxASSERT (index != (
size_t)wxNOT_FOUND);
2321 return (index < siblings.Count()-1)? wxTreeItemId(siblings[index+1]): wxTreeItemId();
2325 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2330 if (!parent)
return wxTreeItemId();
2333 wxArrayTreeListItems& siblings = parent->GetChildren();
2334 size_t index = siblings.Index(i);
2335 wxASSERT (index != (
size_t)wxNOT_FOUND);
2336 return (index >= 1)? wxTreeItemId(siblings[index-1]): wxTreeItemId();
2341 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2345 wxArrayTreeListItems& children = ((
wxTreeListItem*)item.m_pItem)->GetChildren();
2346 if (children.GetCount() > 0)
return children.Item (0);
2351 wxTreeItemId parent = item;
2355 }
while (!next.IsOk() && parent.IsOk());
2361 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2368 while (fulltree || ((
wxTreeListItem*)prev.m_pItem)->IsExpanded()) {
2369 wxArrayTreeListItems& children = ((
wxTreeListItem*)prev.m_pItem)->GetChildren();
2370 if (children.GetCount() == 0)
break;
2371 prev = children.Item (children.GetCount() - 1);
2382 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2387 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2400 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2401 wxTreeItemId
id =
GetNext (item,
false);
2403 if (
IsVisible (
id, fullRow, within))
return id;
2406 return wxTreeItemId();
2410 wxCHECK_MSG (
GetRootItem().IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2412 wxTreeItemId res = id;
2413 while ((
id =
GetNext (
id,
false)).IsOk()) {
2414 if (
IsVisible (
id, fullRow, within)) res = id;
2420 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2421 wxTreeItemId
id =
GetPrev (item,
true);
2423 if (
IsVisible (
id, fullRow, within))
return id;
2426 return wxTreeItemId();
2437 const wxString& text,
2438 int image,
int selImage,
2439 wxTreeItemData *
data) {
2441 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2446 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2452 parent->
Insert (item, previous);
2458 int image,
int selImage,
2459 wxTreeItemData *
data) {
2460 wxCHECK_MSG(!m_rootItem, wxTreeItemId(), _T(
"tree can have only one root"));
2461 wxCHECK_MSG(
GetColumnCount(), wxTreeItemId(), _T(
"Add column(s) before adding the root item"));
2466 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2470 data->SetId(m_rootItem);
2472 if (HasFlag(wxTR_HIDE_ROOT)) {
2476 wxTreeItemIdValue cookie = 0;
2483 const wxString& text,
2484 int image,
int selImage,
2485 wxTreeItemData *
data) {
2486 return DoInsertItem (parent, 0u, text, image, selImage, data);
2490 const wxTreeItemId& idPrevious,
2491 const wxString& text,
2492 int image,
int selImage,
2493 wxTreeItemData *
data) {
2495 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2498 wxASSERT_MSG( index != wxNOT_FOUND,
2499 _T(
"previous item in wxTreeListMainWindow::InsertItem() is not a sibling") );
2501 return DoInsertItem (parentId, ++index, text, image, selImage, data);
2506 const wxString& text,
2507 int image,
int selImage,
2508 wxTreeItemData *
data) {
2510 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2512 return DoInsertItem (parentId, before, text, image, selImage, data);
2516 const wxString& text,
2517 int image,
int selImage,
2518 wxTreeItemData *
data) {
2520 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2529 if (! itemId.IsOk())
return;
2532 wxCHECK_RET (item != m_rootItem, _T(
"invalid item, root may not be deleted this way!"));
2540 parent->GetChildren().Remove (item);
2546 if (! m_rootItem)
return;
2553 SendEvent(wxEVT_COMMAND_TREE_DELETE_ITEM, m_rootItem);
2559 if (! itemId.IsOk())
return;
2564 wxArrayTreeListItems& children = item->
GetChildren();
2565 for (
size_t n = children.GetCount(); n>0; n--) {
2569 children.RemoveAt(n-1);
2575 wxCHECK_RET (item, _T(
"invalid item for delete!"));
2581 if (m_editControl) { m_editControl->
EndEdit(
true); }
2584 if (item == m_dragItem) {
2586 m_isDragStarted = m_isDragging =
false;
2587 if (HasCapture()) ReleaseMouse();
2593 if (item == m_curItem) {
2596 wxArrayTreeListItems& siblings = m_curItem->
GetChildren();
2597 size_t index = siblings.Index (item);
2598 wxASSERT (index != (
size_t)wxNOT_FOUND);
2605 if (item == m_selectItem) {
2607 SelectItem(m_selectItem, (wxTreeItemId*)NULL,
true);
2612 wxArrayTreeListItems& children = item->
GetChildren();
2613 for (
size_t n = children.GetCount(); n>0; n--) {
2617 children.RemoveAt(n-1);
2626 SendEvent(wxEVT_COMMAND_TREE_DELETE_ITEM, item);
2636 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::SetItemParent") );
2637 wxCHECK_RET (parent_new, _T(
"invalid parent in wxTreeListMainWindow::SetItemParent") );
2638 wxCHECK_RET (item != m_rootItem, _T(
"invalid root as item in wxTreeListMainWindow::SetItemParent!") );
2644 parent_new->Insert(item, parent_new->
GetChildren().Count());
2647 if (parent_new->GetChildren().Count() == 1) parent_new->Expand();
2662 if (old_item != NULL && old_item != item) {
2672 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::Expand") );
2677 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 0);
2678 event.SetInt(m_curColumn);
2679 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
2685 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_EXPANDED);
2690 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2694 wxTreeItemIdValue cookie;
2696 while (child.IsOk()) {
2704 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::Collapse") );
2709 wxTreeEvent event (wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 0 );
2710 event.SetInt(m_curColumn);
2711 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
2717 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
2722 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2729 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2747 wxCHECK_RET (item, _T(
"invalid tree item"));
2753 if (item != m_curItem) m_lastOnSame =
false;
2756 wxArrayTreeListItems& children = item->
GetChildren();
2757 size_t count = children.Count();
2758 for (
size_t n = 0; n < count; ++n) {
2782 wxArrayTreeListItems& children = parent->
GetChildren();
2783 int index = children.Index(crt_item);
2784 wxASSERT (index != wxNOT_FOUND);
2788 size_t count = children.Count();
2789 for (
size_t n = (index+1); n < count; ++n) {
2802 if (crt_item==last_item)
return true;
2805 wxArrayTreeListItems& children = crt_item->
GetChildren();
2806 size_t count = children.Count();
2807 for (
size_t n = 0; n < count; ++n) {
2816 const wxTreeItemId& lastId,
2817 bool unselect_others) {
2822 wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
2823 event.SetInt(m_curColumn);
2824 event.SetOldItem (m_curItem);
2825 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return false;
2828 bool bUnselectedAll =
false;
2829 if (unselect_others) {
2830 if (HasFlag(wxTR_MULTIPLE)) {
2838 if (lastId.IsOk() && itemId.IsOk() && (itemId != lastId)) {
2858 }
else if (itemId.IsOk()) {
2863 if (unselect_others) {
2873 event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
2881 wxCHECK_RET (HasFlag(wxTR_MULTIPLE), _T(
"invalid tree style"));
2882 wxCHECK_RET (root.IsOk(), _T(
"no tree"));
2885 wxTreeEvent event (wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
2886 event.SetOldItem (m_curItem);
2888 if (
SendEvent(0, m_rootItem, &event) && !event.IsAllowed())
return;
2890 wxTreeItemIdValue cookie = 0;
2898 event.SetEventType (wxEVT_COMMAND_TREE_SEL_CHANGED);
2903 wxArrayTreeItemIds &array)
const {
2904 if (item->
IsSelected()) array.Add (wxTreeItemId(item));
2907 wxArrayTreeListItems& children = item->
GetChildren();
2908 size_t count = children.GetCount();
2909 for (
size_t n = 0; n < count; ++n)
FillArray (children[n], array);
2917 return array.Count();
2921 if (!item.IsOk())
return;
2936 if (!item.IsOk())
return;
2944 int item_y = gitem->
GetY();
2947 GetScrollPixelsPerUnit (&xUnit, &yUnit);
2950 GetViewStart (&start_x, &start_y);
2955 GetClientSize (&client_w, &client_h);
2959 m_rootItem->
GetSize (x, y,
this);
2962 int x_pos = GetScrollPos( wxHORIZONTAL );
2964 if (item_y < start_y+3) {
2966 SetScrollbars (xUnit, yUnit, xUnit ? x/xUnit : 0, yUnit ? y/yUnit : 0, x_pos, yUnit ? item_y/yUnit : 0);
2969 item_y += yUnit + 2;
2970 SetScrollbars (xUnit, yUnit, xUnit ? x/xUnit : 0, yUnit ? y/yUnit : 0, x_pos, yUnit ? (item_y+
GetLineHeight(gitem)-client_h)/yUnit : 0 );
2979 wxCHECK_MSG (s_treeBeingSorted, 0, _T(
"bug in wxTreeListMainWindow::SortChildren()") );
2985 return (m_sortColumn == -1
2987 : (m_ReverseSortOrder
2995 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2999 wxCHECK_RET (!s_treeBeingSorted,
3000 _T(
"wxTreeListMainWindow::SortChildren is not reentrant") );
3002 wxArrayTreeListItems& children = item->
GetChildren();
3003 if ( children.Count() > 1 ) {
3005 s_treeBeingSorted =
this;
3006 m_sortColumn = column;
3007 m_ReverseSortOrder = reverseOrder;
3009 s_treeBeingSorted = NULL;
3014 wxString searchText;
3017 searchText = itemText.Mid (0, pattern.Length());
3019 searchText = itemText;
3022 if (searchText.CmpNoCase (pattern) == 0)
return true;
3024 if (searchText.Cmp (pattern) == 0)
return true;
3032 wxTreeItemIdValue cookie = 0;
3033 wxTreeItemId next = item;
3037 int col, col_start, col_end;
3038 if (column >= 0) { col_start = col_end = column; }
3057 if (next.IsOk() && HasFlag(wxTR_HIDE_ROOT)) {
3062 if (! next.IsOk() || next == item)
return (wxTreeItemId*)NULL;
3064 for (col=col_start; col<=col_end; col++) {
3069 return (wxTreeItemId*)NULL;
3080 wxClientDC dc (
this);
3081 dc.SetFont (m_normalFont);
3084 if (m_imageListNormal) {
3088 int n = m_imageListNormal->GetImageCount();
3089 for (
int i = 0; i < n ; i++) {
3090 int width = 0, height = 0;
3091 m_imageListNormal->GetSize(i, width, height);
3092 if (height > m_lineHeight) m_lineHeight = height +
m_linespacing;
3096 if (m_imageListButtons) {
3100 int n = m_imageListButtons->GetImageCount();
3101 for (
int i = 0; i < n ; i++) {
3102 int width = 0, height = 0;
3103 m_imageListButtons->GetSize(i, width, height);
3104 if (height > m_lineHeight) m_lineHeight = height +
m_linespacing;
3108 if (m_lineHeight < 30) {
3111 m_lineHeight += m_lineHeight / 10;
3117 m_imageListNormal = imageList;
3118 m_ownsImageListNormal =
false;
3125 m_imageListState = imageList;
3126 m_ownsImageListState =
false;
3131 m_imageListButtons = imageList;
3132 m_ownsImageListButtons =
false;
3139 m_ownsImageListNormal =
true;
3144 m_ownsImageListState =
true;
3149 m_ownsImageListButtons =
true;
3159 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3160 if (xUnit == 0) xUnit = GetCharWidth();
3163 m_rootItem->
GetSize (x, y,
this);
3165 int x_pos = GetScrollPos (wxHORIZONTAL);
3166 int y_pos = GetScrollPos (wxVERTICAL);
3168 if (x < GetClientSize().GetWidth()) x_pos = 0;
3169 SetScrollbars (xUnit, yUnit, x/xUnit, y/yUnit, x_pos, y_pos);
3171 SetScrollbars (0, 0, 0, 0);
3176 if (GetWindowStyleFlag() & wxTR_HAS_VARIABLE_ROW_HEIGHT) {
3188 wxColour colTextHilight = wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHTTEXT);
3191 int off_h = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
3193 wxDCClipper clipper (dc, 0, item->
GetY(), total_w, total_h);
3203 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3204 dc.SetPen (*wxTRANSPARENT_PEN);
3205 if (HasFlag (wxTR_FULL_ROW_HIGHLIGHT)) {
3207 if (! m_isDragging && m_hasFocus) {
3208 dc.SetBrush (*m_hilightBrush);
3209 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3210 dc.SetPen (*wxBLACK_PEN);
3211 #endif // !__WXMAC__
3213 dc.SetBrush (*m_hilightUnfocusedBrush);
3214 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3215 dc.SetPen (*wxTRANSPARENT_PEN);
3216 #endif // !__WXMAC__
3218 dc.SetTextForeground (colTextHilight);
3221 if (item == m_curItem) {
3222 dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
3225 dc.DrawRectangle (0, item->
GetY() + off_h, total_w, total_h - off_h);
3229 int text_extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0;
3230 int img_extraH = (total_h >
m_imgHeight)? (total_h-m_imgHeight)/2: 0;
3235 if (col_w <= 0)
continue;
3236 wxDCClipper clipper (dc, x_colstart, item->
GetY(), col_w, total_h);
3262 int w = 0, text_w = 0;
3263 wxString text = item->
GetText(i);
3264 dc.GetTextExtent (text, &text_w, NULL);
3270 w = col_w - (image_w + text_w + off_w +
MARGIN);
3273 case wxALIGN_CENTER:
3274 w = (col_w - (image_w + text_w + off_w +
MARGIN))/2;
3278 int text_x = x + image_w;
3283 if ( ! HasFlag (wxTR_FULL_ROW_HIGHLIGHT)) {
3285 bool drawCursor =
false;
3286 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3287 drawCursor = (item == m_curItem && i == m_curColumn && !m_isDragging &&
m_hasFocus);
3288 #endif // !__WXMAC__
3292 dc.SetPen (*wxTRANSPARENT_PEN);
3293 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3294 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
3296 dc.SetPen (drawCursor ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3297 dc.SetBrush(!m_isDragging && m_hasFocus ? *m_hilightBrush : *m_hilightUnfocusedBrush);
3298 dc.SetTextForeground (colTextHilight);
3299 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
3303 dc.SetPen (drawCursor && i !=
GetMainColumn() ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3304 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3305 dc.SetTextForeground (colText);
3306 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
3309 dc.SetPen (*wxBLACK_PEN);
3310 dc.SetBackgroundMode (wxTRANSPARENT);
3311 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
3318 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_3DLIGHT ), 1, wxPENSTYLE_SOLID);
3319 dc.SetPen ((GetBackgroundColour() == *wxWHITE)? pen: *wxWHITE_PEN);
3320 dc.DrawLine (x_colstart+col_w-1, item->
GetY(), x_colstart+col_w-1, item->
GetY()+total_h);
3323 dc.SetBackgroundMode (wxTRANSPARENT);
3326 if (image !=
NO_IMAGE && m_imageListNormal && image < m_imageListNormal->GetImageCount()) {
3327 int y = item->
GetY() + img_extraH;
3328 m_imageListNormal->Draw (image, dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
3332 int text_y = item->
GetY() + text_extraH;
3333 dc.DrawText (text, (wxCoord)text_x, (wxCoord)text_y);
3335 x_colstart += col_w;
3339 dc.SetFont( m_normalFont );
3344 int level,
int &y,
int x_maincol) {
3347 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0)) {
3348 wxArrayTreeListItems& children = item->
GetChildren();
3349 for (
size_t n = 0; n < children.Count(); n++) {
3350 PaintLevel (children[n], dc, 1, y, x_maincol);
3357 int x = x_maincol +
MARGIN;
3358 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
3362 x += (m_indent-m_indent/2);
3364 if (HasFlag(wxTR_HIDE_ROOT)) {
3365 x += m_indent * (level-1);
3367 x += m_indent * level;
3376 int y_mid = y_top + (h/2);
3379 int exposed_x = dc.LogicalToDeviceX(0);
3380 int exposed_y = dc.LogicalToDeviceY(y_top);
3382 if (IsExposed(exposed_x, exposed_y, 10000, h)) {
3384 if (HasFlag(wxTR_ROW_LINES)) {
3387 dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxPENSTYLE_SOLID));
3388 dc.DrawLine (0, y_top, total_width, y_top);
3389 dc.DrawLine (0, y_top+h, total_width, y_top+h);
3396 dc.SetBrush(*wxWHITE_BRUSH);
3397 dc.SetPen(m_dottedPen);
3401 GetColumn(m_main_column).
GetWidth();
3402 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
3404 if (!HasFlag(wxTR_NO_LINES)) {
3407 dc.SetPen(m_dottedPen);
3409 if (x2 < (x_maincol + MARGIN)) x2 = x_maincol +
MARGIN;
3413 dc.DrawLine (x2, y_mid, x - m_btnWidth2, y_mid);
3414 dc.DrawLine (x3, y_mid, x3 +
LINEATROOT, y_mid);
3416 dc.DrawLine (x2, y_mid, x3 +
LINEATROOT, y_mid);
3419 dc.DrawLine (x2, y_mid, x - m_indent/2, y_mid);
3425 if (m_imageListButtons) {
3428 int image = wxTreeItemIcon_Normal;
3429 if (item->
IsExpanded()) image = wxTreeItemIcon_Expanded;
3430 if (item->
IsSelected()) image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
3431 int xx = x - m_btnWidth2 +
MARGIN;
3433 dc.SetClippingRegion(xx, yy, m_btnWidth, m_btnHeight);
3434 m_imageListButtons->Draw (image, dc, xx, yy, wxIMAGELIST_DRAW_TRANSPARENT);
3435 dc.DestroyClippingRegion();
3437 }
else if (HasFlag (wxTR_TWIST_BUTTONS)) {
3440 dc.SetPen(*wxBLACK_PEN);
3441 dc.SetBrush(*m_hilightBrush);
3444 button[0].x = x - (m_btnWidth2+1);
3445 button[0].y = y_mid - (m_btnHeight/3);
3446 button[1].x = x + (m_btnWidth2+1);
3447 button[1].y = button[0].y;
3449 button[2].y = button[0].y + (m_btnHeight2+1);
3451 button[0].x = x - (m_btnWidth/3);
3452 button[0].y = y_mid - (m_btnHeight2+1);
3453 button[1].x = button[0].x;
3454 button[1].y = y_mid + (m_btnHeight2+1);
3455 button[2].x = button[0].x + (m_btnWidth2+1);
3456 button[2].y = y_mid;
3458 dc.DrawPolygon(3, button);
3463 wxRect rect (x-m_btnWidth2, y_mid-m_btnHeight2, m_btnWidth, m_btnHeight);
3464 int flag = item->
IsExpanded()? wxCONTROL_EXPANDED: 0;
3465 wxRendererNative::Get().DrawTreeItemButton (
this, dc, rect, flag);
3473 dc.SetBrush(*wxWHITE_BRUSH);
3474 dc.SetPen(m_dottedPen);
3475 dc.SetTextForeground(*wxBLACK);
3479 wxArrayTreeListItems& children = item->
GetChildren();
3483 GetColumn(m_main_column).
GetWidth();
3487 if (m_imgWidth > 0) {
3493 for (
size_t n = 0; n < children.Count(); ++n) {
3496 PaintLevel (children[n], dc, level+1, y, x_maincol);
3499 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
3500 if (!HasFlag (wxTR_NO_LINES)) {
3502 dc.DrawLine (x, oldY, x, y2);
3517 wxAutoBufferedPaintDC dc (
this);
3518 wxBrush brush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID);
3519 dc.SetBackground(brush);
3526 if (m_imageListButtons) {
3527 m_imageListButtons->GetSize (0, m_btnWidth, m_btnHeight);
3532 m_btnWidth2 = m_btnWidth/2;
3533 m_btnHeight2 = m_btnHeight/2;
3536 if (m_imageListNormal) {
3537 m_imageListNormal->GetSize (0, m_imgWidth, m_imgHeight);
3539 m_imgWidth2 = m_imgWidth/2;
3540 m_imgHeight2 = m_imgHeight/2;
3543 if (m_imageListButtons) {
3550 dc.SetFont( m_normalFont );
3551 dc.SetPen( m_dottedPen );
3561 PaintLevel (m_rootItem, dc, 0, y, x_maincol);
3581 wxTreeEvent nevent (wxEVT_COMMAND_TREE_KEY_DOWN, 0 );
3582 nevent.SetInt(m_curColumn);
3583 nevent.SetKeyEvent (event);
3585 nevent.SetExtraLong(event.GetModifiers());
3586 if (
SendEvent(0, NULL, &nevent))
return;
3589 bool curItemSet =
false;
3593 if (HasFlag(wxTR_HIDE_ROOT)) {
3594 wxTreeItemIdValue cookie = 0;
3597 SelectItem(m_curItem, (wxTreeItemId*)NULL,
true);
3602 if (HasFlag(wxTR_MULTIPLE) && event.ShiftDown()) {
3603 if (!m_shiftItem) m_shiftItem =
m_curItem;
3608 if (curItemSet)
return;
3611 wxTreeItemId newItem = (wxTreeItemId*)NULL;
3612 switch (event.GetKeyCode()) {
3622 case WXK_SUBTRACT: {
3628 case WXK_MULTIPLY: {
3631 }
else if (m_curItem->
HasPlus()) {
3643 if (!
SendEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, m_curItem)) {
3655 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3669 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1,1));
3671 newItem = m_rootItem->
HitTest(abs_p,
this, flags, col, 0);
3674 if (newItem == m_curItem) {
3675 abs_p.y -= GetClientSize().GetHeight() - m_curItem->
GetHeight();
3676 if (abs_p.y < 0) abs_p.y = 0;
3677 newItem = m_rootItem->
HitTest(abs_p,
this, flags, col, 0);
3686 wxTreeItemIdValue cookie = 0;
3692 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3693 newItem = (wxTreeItemId*)NULL;
3704 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3716 wxTreeItemIdValue cookie = 0;
3725 wxTreeItemIdValue cookie = 0;
3733 }
while (!newItem && parent);
3738 case WXK_PAGEDOWN: {
3741 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1,GetClientSize().GetHeight() - m_curItem->
GetHeight()));
3743 newItem = m_rootItem->
HitTest(abs_p,
this, flags, col, 0);
3746 if (newItem == m_curItem) {
3747 abs_p.y += GetClientSize().GetHeight() - m_curItem->
GetHeight();
3749 newItem = m_rootItem->
HitTest(abs_p,
this, flags, col, 0);
3762 wxChar key =
event.GetUnicodeKey();
3763 if (key == WXK_NONE) key = (wxChar)event.GetKeyCode();
3767 if (!m_findTimer->IsRunning()) m_findStr.Clear();
3768 m_findStr.Append (key);
3770 wxTreeItemId prev = (wxTreeItemId*)NULL;
3773 prev = (wxTreeItemId*)m_curItem;
3781 newItem =
FindItem (prev, -1, m_findStr, mode);
3787 prev = (wxTreeItemId*)NULL;
3788 newItem =
FindItem (prev, -1, m_findStr, mode);
3791 if (! newItem) m_findStr.RemoveLast();
3799 if (!event.ControlDown()) {
3800 bool unselect_others = !((
event.ShiftDown() ||
event.ControlDown()) &&
3801 HasFlag(wxTR_MULTIPLE));
3802 SelectItem (newItem, m_shiftItem, unselect_others);
3818 if (point.x<0) flags |= wxTREE_HITTEST_TOLEFT;
3819 if (point.x>w) flags |= wxTREE_HITTEST_TORIGHT;
3820 if (point.y<0) flags |= wxTREE_HITTEST_ABOVE;
3821 if (point.y>h) flags |= wxTREE_HITTEST_BELOW;
3822 if (flags)
return wxTreeItemId();
3825 flags = wxTREE_HITTEST_NOWHERE;
3827 return wxTreeItemId();
3831 this, flags, column, 0);
3833 flags = wxTREE_HITTEST_NOWHERE;
3835 return wxTreeItemId();
3842 bool WXUNUSED(textOnly))
const {
3843 wxCHECK_MSG (itemId.IsOk(),
false, _T(
"invalid item in wxTreeListMainWindow::GetBoundingRect") );
3848 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3850 GetViewStart(& startX, & startY);
3852 rect.x = item->GetX() - startX * xUnit;
3853 rect.y = item->GetY() - startY * yUnit;
3854 rect.width = item->GetWidth();
3865 if (!item.IsOk())
return;
3869 if (m_editControl) { m_editControl->
EndEdit(
true); }
3874 wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 0 );
3876 SendEvent(0, m_editItem, &te);
if (!te.IsAllowed())
return;
3887 int y = m_editItem->
GetY() + 1;
3891 x += m_editItem->
GetTextX(column) - 2;
3894 for (
int i = 0; i < column; ++i) {
3902 case wxALIGN_LEFT: {style = wxTE_LEFT; x -= 1;
break;}
3903 case wxALIGN_CENTER: {style = wxTE_CENTER; x -= 1;
break;}
3904 case wxALIGN_RIGHT: {style = wxTE_RIGHT; x += 0;
break;}
3911 wxClientDC dc (
this);
3913 x = dc.LogicalToDeviceX (x);
3914 y = dc.LogicalToDeviceY (y);
3918 m_editControl =
new wxEditTextCtrl (
this, -1, &m_editAccept, &m_editRes,
3919 this, m_editItem->
GetText (column),
3920 wxPoint (x, y), wxSize (w, h), style);
3921 m_editControl->SelectAll();
3922 m_editControl->SetFocus();
3932 wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, 0 );
3933 le.SetLabel( m_editRes );
3934 le.SetEditCanceled(isCancelled);
3935 le.SetInt(m_editCol);
3936 SendEvent(0, m_editItem, &le);
if (! isCancelled && le.IsAllowed())
3938 SetItemText (m_editItem, le.GetInt(), le.GetLabel());
3943 if (m_editControl) { m_editControl->
EndEdit(
true); }
3947 bool mayDrag =
true;
3948 bool maySelect =
true;
3949 bool mayClick =
true;
3950 bool mayDoubleClick =
true;
3954 if (m_owner->GetEventHandler()->ProcessEvent(event))
return;
3955 if (!m_rootItem)
return;
3965 wxPoint p = wxPoint (event.GetX(),
event.GetY());
3968 this, flags, m_curColumn, 0);
3969 bool bCrosshair = (item && item->
HasPlus() && (flags & wxTREE_HITTEST_ONITEMBUTTON));
3972 maySelect = mayDoubleClick =
false;
3975 if (event.Dragging()) {
3976 maySelect = mayDoubleClick = mayClick =
false;
3981 if (event.LeftDown()) maySelect =
false;
3983 mayDoubleClick =
false;
3986 if (mayDoubleClick) mayDoubleClick = mayClick;
3988 if (maySelect) maySelect = mayClick;
3993 if (HasFlag(wxTR_MULTIPLE)) {
3997 if (event.ControlDown() ||
event.ShiftDown()) {
3998 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
3999 m_lastOnSame =
false;
4004 }
else if ((item != NULL && item->
IsSelected())) {
4005 maySelect = maySelect &&
event.LeftUp();
4010 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4015 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4023 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown())
SetFocus();
4026 if (item != m_toolTipItem) {
4030 m_toolTipItem = NULL;
4031 wxScrolledWindow::SetToolTip(m_toolTip);
4039 m_toolTipItem = item;
4040 wxScrolledWindow::SetToolTip(*tip);
4044 }
else if (m_isItemToolTip) {
4045 m_toolTipItem = item;
4046 wxScrolledWindow::SetToolTip(wxString());
4049 }
else if (m_toolTipItem != NULL) {
4050 m_toolTipItem = NULL;
4051 wxScrolledWindow::SetToolTip(m_toolTip);
4061 if (event.LeftDown()) m_lastOnSame = (item == m_curItem);
4064 if (bCrosshair && event.LeftDown()) {
4077 if (event.LeftDown() && HasFlag(wxTR_MULTIPLE) &&
event.ShiftDown()) {
4078 if (!m_shiftItem) m_shiftItem =
m_curItem;
4085 bool unselect_others = ! (HasFlag(wxTR_MULTIPLE) && (
4087 ||
event.ControlDown()
4091 if (
SelectItem(item, m_shiftItem, unselect_others)) {
4099 if (event.MiddleDown()) {
4101 wxTreeEvent nevent(0, 0);
4103 nevent.SetInt(m_curColumn);
4105 SendEvent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, item, &nevent);
4107 if (event.RightDown()) {
4109 wxTreeEvent nevent(0, 0);
4111 nevent.SetInt(m_curColumn);
4113 SendEvent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, item, &nevent);
4115 if (event.RightUp()) {
4117 wxTreeEvent nevent(0, 0);
4119 nevent.SetInt(m_curColumn);
4120 SendEvent(wxEVT_COMMAND_TREE_ITEM_MENU, item, &nevent);
4124 if (m_lastOnSame && event.LeftUp()) {
4125 if ((item == m_curItem) && (m_curColumn != -1) &&
4132 m_lastOnSame =
false;
4138 if (mayDoubleClick && event.LeftDClick()) {
4143 m_editTimer->Stop();
4144 m_lastOnSame =
false;
4147 if (
SelectItem(item, (wxTreeItemId*)NULL,
true)) {
4150 if (!
SendEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, item)) {
4169 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown()) {
4174 m_isDragStarted = m_isDragging =
false;
4175 if (HasCapture()) ReleaseMouse();
4179 }
else if (event.Dragging()) {
4189 m_isDragStarted = m_isDragging =
false;
4190 if (HasCapture()) ReleaseMouse();
4195 wxTreeEvent nevent(0, 0);
4197 nevent.SetInt(m_curColumn);
4198 SendEvent(wxEVT_COMMAND_TREE_END_DRAG, item, &nevent);
4202 }
else if (event.Dragging()) {
4205 if (m_isDragStarted) {
4206 const int tolerance = 3;
4207 int dx = abs(p.x - m_dragStartPos.x);
4208 int dy = abs(p.y - m_dragStartPos.y);
4209 if (dx <= tolerance && dy <= tolerance)
4216 m_isDragStarted =
true;
4223 m_isDragging =
true;
4227 wxTreeEvent nevent(0, 0);
4229 nevent.SetInt(m_dragCol);
4232 ? wxEVT_COMMAND_TREE_BEGIN_DRAG
4233 : wxEVT_COMMAND_TREE_BEGIN_RDRAG,
4239 if (bSkip)
event.Skip();
4247 if (!m_dirty)
return;
4259 if (m_owner->GetEventHandler()->ProcessEvent(event))
return;
4262 HandleOnScroll( event );
4264 if(event.GetOrientation() == wxHORIZONTAL) {
4275 dc.GetTextExtent (!item->
GetText(m_main_column).empty()
4276 ? item->
GetText (m_main_column)
4280 dc.SetFont (m_normalFont);
4282 int max_h = (m_imgHeight > text_h) ? m_imgHeight : text_h;
4286 max_h += max_h / 10;
4290 if (max_h > m_lineHeight) m_lineHeight = max_h;
4291 item->
SetWidth(m_imgWidth + text_w+2);
4296 int level,
int &y,
int x_colstart) {
4299 int x = x_colstart +
MARGIN;
4300 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
4304 x += (m_indent-m_indent/2);
4306 if (HasFlag(wxTR_HIDE_ROOT)) {
4307 x += m_indent * (level-1);
4309 x += m_indent * level;
4313 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0))
goto Recurse;
4326 wxArrayTreeListItems& children = item->
GetChildren();
4327 long n, count = (long)children.Count();
4329 for (n = 0; n < count; ++n) {
4335 if ( !m_rootItem )
return;
4337 wxClientDC dc(
this);
4340 dc.SetFont( m_normalFont );
4342 dc.SetPen( m_dottedPen );
4356 if (m_dirty)
return;
4358 wxClientDC dc(
this);
4363 GetVirtualSize( &cw, &ch );
4366 rect.x = dc.LogicalToDeviceX( 0 );
4368 rect.y = dc.LogicalToDeviceY( item->
GetY() - 2 );
4371 Refresh (
true, &rect );
4376 if (m_dirty)
return;
4378 wxClientDC dc(
this);
4383 GetVirtualSize( &cw, &ch );
4386 rect.x = dc.LogicalToDeviceX( 0 );
4387 rect.y = dc.LogicalToDeviceY( item->
GetY() );
4391 Refresh (
true, &rect);
4407 const wxArrayTreeListItems& children = item->
GetChildren();
4408 long count = (long)children.GetCount();
4409 for (
long n = 0; n < count; n++ ) {
4419 if (!wxWindow::SetBackgroundColour(colour))
return false;
4426 if (!wxWindow::SetForegroundColour(colour))
return false;
4433 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
4435 if (this->IsFrozen())
4443 wxClientDC dc(
this);
4452 wxCHECK_MSG (itemId.IsOk(), _T(
""), _T(
"invalid tree item") );
4455 else return ((
wxTreeListItem*) itemId.m_pItem)->GetText (column);
4459 wxASSERT_MSG(
IsVirtual(), _T(
"can be used only with virtual control") );
4464 wxWindow::SetFocus();
4469 if (!item)
return 0;
4474 GetTextExtent (item->
GetText (column), &w, &
h, NULL, NULL, font.Ok()? &font: NULL);
4478 int width = w + 2*
MARGIN;
4481 if (HasFlag(wxTR_LINES_AT_ROOT)) width +=
LINEATROOT;
4489 while (parent && (!HasFlag(wxTR_HIDE_ROOT) || (parent != root))) {
4493 if (level) width += level *
GetIndent();
4501 GetClientSize (&maxWidth, &h);
4508 if (!HasFlag(wxTR_HIDE_ROOT)) {
4510 if (width < w) width = w;
4511 if (width > maxWidth)
return maxWidth;
4514 wxTreeItemIdValue cookie = 0;
4516 while (item.IsOk()) {
4518 if (width < w) width = w;
4519 if (width > maxWidth)
return maxWidth;
4524 if (width < w) width = w;
4525 if (width > maxWidth)
return maxWidth;
4537 wxTreeEvent nevent (event_type, 0);
4539 if (event == NULL) {
4541 event->SetInt (m_curColumn);
4542 }
else if (event_type) {
4543 event->SetEventType(event_type);
4546 event->SetEventObject (m_owner);
4547 event->SetId(m_owner->GetId());
4549 event->SetItem (item);
4552 return m_owner->GetEventHandler()->ProcessEvent (*event);
4559 if (m_imageListNormal)
4579 long style, const wxValidator &validator,
4580 const wxString& name)
4582 long main_style = style & ~(wxBORDER_SIMPLE | wxBORDER_SUNKEN | wxBORDER_DOUBLE |
4583 wxBORDER_RAISED | wxBORDER_STATIC);
4584 main_style |= wxWANTS_CHARS ;
4585 long ctrl_style = style & ~(wxVSCROLL|wxHSCROLL);
4587 if (!wxControl::Create(parent,
id, pos, size, ctrl_style, validator, name)) {
4591 main_style, validator);
4593 wxPoint(0, 0), wxDefaultSize,
4595 CalculateAndSetHeaderHeight();
4606 h = (int)(wxRendererNative::Get().GetHeaderButtonHeight(
m_header_win) * 0.8) + 2;
4608 h = wxRendererNative::Get().GetHeaderButtonHeight(
m_header_win);
4622 GetClientSize(&w, &h);
4771 long main_style = style & ~(wxBORDER_SIMPLE | wxBORDER_SUNKEN | wxBORDER_DOUBLE | wxBORDER_RAISED | wxBORDER_STATIC);
4772 main_style |= wxWANTS_CHARS;
4775 m_windowStyle = style & ~(wxVSCROLL | wxHSCROLL);
4781 long style = m_windowStyle;
4815 wxTreeItemIdValue& cookie)
const
4819 wxTreeItemIdValue& cookie)
const
4823 wxTreeItemIdValue& cookie)
const
4827 wxTreeItemIdValue& cookie)
const
4867 int selectedImage, wxTreeItemData*
data)
4871 const wxString& text,
int image,
4873 wxTreeItemData*
data)
4877 const wxTreeItemId& previous,
4878 const wxString& text,
int image,
4880 wxTreeItemData*
data)
4883 selectedImage, data);
4888 const wxString& text,
int image,
4890 wxTreeItemData*
data)
4893 selectedImage, data);
4897 const wxString& text,
int image,
4899 wxTreeItemData*
data)
4933 bool unselect_others)
4952 bool textOnly)
const
5069 wxASSERT_MSG (column !=
GetMainColumn(), _T(
"The main column may not be hidden") );
5107 wxSize bestSizeMain =
m_main_win->GetBestSize();
5108 return wxSize (bestSizeHeader.x > bestSizeMain.x ? bestSizeHeader.x : bestSizeMain.x, bestSizeHeader.y + bestSizeMain.y);
5113 return wxEmptyString;
5145 wxTreeListCtrlXmlHandler::wxTreeListCtrlXmlHandler() : wxXmlResourceHandler() {
5147 #define wxTR_NO_BUTTONS 0x0000 // for convenience
5148 #define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
5149 #define wxTR_NO_LINES 0x0004 // don't draw lines at all
5150 #define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
5151 #define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl
5153 #define wxTR_SINGLE 0x0000 // for convenience
5154 #define wxTR_MULTIPLE 0x0020 // can select multiple items
5155 #define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
5156 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
5158 #define wxTR_EDIT_LABELS 0x0200 // can edit item labels
5159 #define wxTR_ROW_LINES 0x0400 // put border around items
5160 #define wxTR_HIDE_ROOT 0x0800 // don't display root node
5162 #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
5165 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
5167 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
5171 XRC_ADD_STYLE(wxTR_NO_BUTTONS);
5172 XRC_ADD_STYLE(wxTR_HAS_BUTTONS);
5173 XRC_ADD_STYLE(wxTR_NO_LINES);
5174 XRC_ADD_STYLE(wxTR_LINES_AT_ROOT);
5175 XRC_ADD_STYLE(wxTR_TWIST_BUTTONS);
5177 XRC_ADD_STYLE(wxTR_SINGLE);
5178 XRC_ADD_STYLE(wxTR_MULTIPLE);
5179 #if WXWIN_COMPATIBILITY_2_8
5181 XRC_ADD_STYLE(wxTR_EXTENDED);
5182 #endif // WXWIN_COMPATIBILITY_2_8
5183 XRC_ADD_STYLE(wxTR_HAS_VARIABLE_ROW_HEIGHT);
5185 XRC_ADD_STYLE(wxTR_EDIT_LABELS);
5186 XRC_ADD_STYLE(wxTR_ROW_LINES);
5187 XRC_ADD_STYLE(wxTR_HIDE_ROOT);
5189 XRC_ADD_STYLE(wxTR_FULL_ROW_HIGHLIGHT);
5191 XRC_ADD_STYLE(wxTR_DEFAULT_STYLE);
5201 wxObject *wxTreeListCtrlXmlHandler::DoCreateResource() {
5202 XRC_MAKE_INSTANCE(tlc, wxTreeListCtrl);
5203 tlc->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(), wxDefaultValidator, GetName());
5208 bool wxTreeListCtrlXmlHandler::CanHandle(wxXmlNode * node) {
5209 return IsOfClass(node, wxT(
"TreeListCtrl"));
wxTreeListItem * m_dragItem
int GetImage(wxTreeItemIcon which=wxTreeItemIcon_Normal) const
bool TagNextChildren(wxTreeListItem *crt_item, wxTreeListItem *last_item)
wxFont GetItemFont(const wxTreeItemId &item) const
void PaintLevel(wxTreeListItem *item, wxDC &dc, int level, int &y, int x_maincol)
wxTreeListMainWindow * m_owner
void Refresh(bool erase=TRUE, const wxRect *rect=NULL)
void SetItemData(const wxTreeItemId &item, wxTreeItemData *data)
void CalculateAndSetHeaderHeight()
wxItemAttr * GetAttributes(int column) const
void SetItemFont(const wxTreeItemId &item, const wxFont &font)
wxItemAttr & Attr(int column)
wxTreeItemId InsertItem(const wxTreeItemId &parent, const wxTreeItemId &idPrevious, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void OnChar(wxKeyEvent &event)
static const int NO_IMAGE
void AssignButtonsImageList(wxImageList *imageList)
wxTreeListColumnInfo GetColumn(int column)
unsigned int GetLineSpacing() const
size_t GetChildrenCount(bool recursively=true) const
wxTreeListItem * GetItemParent() const
void SetBold(int column, bool bold)
void SetItemText(const wxTreeItemId &item, int column, const wxString &text)
WX_DEFINE_ARRAY_PTR(wxTreeListItem *, wxArrayTreeListItems)
void CollapseAndReset(const wxTreeItemId &item)
wxTreeItemId GetNextVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
void OnSize(wxSizeEvent &event)
bool GetBoundingRect(const wxTreeItemId &item, wxRect &rect, bool textOnly=false) const
void SetImage(int column, int image, wxTreeItemIcon which)
void EnsureVisible(const wxTreeItemId &item)
virtual long GetWindowStyleFlag() const
void Delete(const wxTreeItemId &item)
wxTreeItemId GetPrev(const wxTreeItemId &item) const
void RefreshSelectedUnder(wxTreeListItem *item)
size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true)
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
wxTreeItemData * GetData() const
const int wxTREE_HITTEST_ONITEMCOLUMN
wxTreeListMainWindow * m_owner
void SetItemBackgroundColour(const wxTreeItemId &item, const wxColour &colour)
wxTreeListRenameTimer(wxTreeListMainWindow *owner)
virtual bool SetForegroundColour(const wxColour &colour)
void EndEdit(bool isCancelled)
void ScrollTo(const wxTreeItemId &item)
bool SelectItem(const wxTreeItemId &item, const wxTreeItemId &prev=(wxTreeItemId *) NULL, bool unselect_others=true)
static const int RENAME_TIMER_TICKS
void AssignStateImageList(wxImageList *imageList)
void EnsureVisible(const wxTreeItemId &item)
void OnKeyUp(wxKeyEvent &event)
void SetColumnWidth(int column, int width)
const int wxTL_MODE_NAV_EXPANDED
WX_DEFINE_OBJARRAY(wxArrayTreeListColumnInfo)
size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true)
void SortChildren(const wxTreeItemId &item, int column, bool reverseOrder)
wxItemAttr * GetAttributes() const
wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str, int mode=0)
friend class wxTreeListItem
wxTreeItemId GetRootItem() const
void Toggle(const wxTreeItemId &item)
void AdjustMyScrollbars()
void SetItemTextColour(const wxTreeItemId &item, const wxColour &colour)
wxColour GetItemBackgroundColour(const wxTreeItemId &item) const
void SetItemData(const wxTreeItemId &item, wxTreeItemData *data)
wxTreeItemId GetNextVisible(const wxTreeItemId &item, bool fullRow, bool within) const
static const int LINEHEIGHT
void SetColumnImage(int column, int image)
static const int DRAG_TIMER_TICKS
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"))
virtual bool SetBackgroundColour(const wxColour &colour)
static wxTreeListColumnInfo wxInvalidTreeListColumnInfo
static const int HEADER_OFFSET_Y
void SortChildren(const wxTreeItemId &item, int column=-1, bool reverseOrder=false)
wxArrayTreeListItems & GetChildren()
void SetItemFont(const wxTreeItemId &item, const wxFont &font)
wxTreeItemId GetNextSibling(const wxTreeItemId &item) const
void SetLineSpacing(unsigned int spacing)
wxTreeItemId GetNextExpanded(const wxTreeItemId &item) const
void SetHeight(int height)
wxTreeItemId GetPrevSibling(const wxTreeItemId &item) const
void Collapse(const wxTreeItemId &item)
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void SetItemBackgroundColour(const wxTreeItemId &item, const wxColour &colour)
bool SelectItem(const wxTreeItemId &item, const wxTreeItemId &last=(wxTreeItemId *) NULL, bool unselect_others=true)
void SetItemParent(const wxTreeItemId &parent, const wxTreeItemId &item)
void SetColumnShown(int column, bool shown=true)
void CalculateSize(wxTreeListItem *item, wxDC &dc)
wxTreeItemData * GetItemData(const wxTreeItemId &item) const
void EndEdit(bool isCancelled)
~wxTreeListItemCellAttr()
void OnRenameAccept(bool isCancelled)
wxTreeItemId AddRoot(const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void SetColumnAlignment(int column, int flag)
void OnChar(wxKeyEvent &event)
wxTreeItemId GetItemParent(const wxTreeItemId &item) const
void DeleteChildren(const wxTreeItemId &item)
static const int HEADER_OFFSET_X
wxTreeItemId GetPrevExpanded(const wxTreeItemId &item) const
void SetToolTip(const wxString &tip)
const int wxTL_MODE_FIND_NOCASE
int GetMainColumn() const
void RefreshSubtree(wxTreeListItem *item)
void AssignImageList(wxImageList *imageList)
void EndEdit(bool isCancelled)
static const int EXTRA_WIDTH
void SetColumnEditable(int column, bool edit=true)
wxTreeItemId GetLastChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
wxTreeItemId GetItemParent(const wxTreeItemId &item) const
bool IsVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
unsigned short m_linespacing
wxTreeListItem * m_rootItem
wxTreeItemId GetNextSibling(const wxTreeItemId &item) const
wxTreeItemId GetFirstChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
bool IsColumnShown(int column) const
wxTreeItemId GetPrevSibling(const wxTreeItemId &item) const
void SetImageList(wxImageList *imageList)
void SetMainColumn(int column)
int GetColumnAlignment(int column) const
static const int BTNHEIGHT
bool GetItemBold(const wxTreeItemId &item) const
wxTreeItemId HitTest(const wxPoint &point)
const int wxTL_MODE_NAV_LEVEL
int GetCurrentColumn() const
wxTreeItemId GetFirstExpandedItem() const
void SetLineSpacing(unsigned int spacing)
void Collapse(const wxTreeItemId &item)
bool IsBold(const wxTreeItemId &item) const
size_t GetSelections(wxArrayTreeItemIds &) const
void SetItemHasChildren(const wxTreeItemId &item, bool has=true)
wxTreeItemId PrependItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void GetSize(int &x, int &y, const wxTreeListMainWindow *)
bool m_left_down_selection
void SetItemBold(const wxTreeItemId &item, bool bold=true)
void AssignStateImageList(wxImageList *imageList)
void CalculateLineHeight()
wxImageList * GetButtonsImageList() const
wxTreeItemId GetLastVisible(bool fullRow, bool within) const
wxTreeItemId GetRootItem() const
virtual int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2)
wxTreeListItemCellAttr m_props_row
void SetMainColumn(int column)
wxString GetItemText(const wxTreeItemId &item, int column) const
wxTreeItemId GetLastVisible(bool fullRow=false, bool within=true) const
void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
bool IsColumnEditable(int column) const
wxTreeItemId GetNext(const wxTreeItemId &item) const
void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
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 IsVisible(const wxTreeItemId &item, bool fullRow, bool within=true) const
wxTreeItemId AddRoot(const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
wxTreeItemId FindItem(const wxTreeItemId &item, int column, const wxString &str, int mode=0)
void OnDpiChanged(wxDPIChangedEvent &e)
virtual ~wxTreeListMainWindow()
void FillArray(wxTreeListItem *, wxArrayTreeItemIds &) const
void SetItemParent(wxTreeListItem *parent)
wxTreeListItem * m_selectItem
short m_images[wxTreeItemIcon_Max]
wxTreeItemId GetLastChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
bool HasButtons(void) const
wxTreeListItem * m_shiftItem
void SetItemToolTip(const wxTreeItemId &item, const wxString &tip)
void Insert(wxTreeListItem *child, size_t index)
bool IsSelected(const wxTreeItemId &item) const
void PaintItem(wxTreeListItem *item, wxDC &dc)
void SetText(int column, const wxString &text)
void Expand(const wxTreeItemId &item)
void SetIndent(unsigned int indent)
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, const wxString &tooltip=wxEmptyString)
void SetData(int column, wxTreeItemData *data)
void SetStateImageList(wxImageList *imageList)
bool SendEvent(wxEventType event_type, wxTreeListItem *item=NULL, wxTreeEvent *event=NULL)
void AssignButtonsImageList(wxImageList *imageList)
void SetImage(int image, wxTreeItemIcon which)
wxImageList * GetImageList() const
unsigned int GetLineSpacing() const
void EditLabel(const wxTreeItemId &item, int column)
wxTreeListItem * HitTest(const wxPoint &point, const wxTreeListMainWindow *, int &flags, int &column, int level)
wxTreeItemId PrependItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
wxTreeItemId GetFirstChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
void SetCurrentItem(const wxTreeItemId &item)
WX_DECLARE_OBJARRAY(wxTreeListColumnInfo, wxArrayTreeListColumnInfo)
wxTreeItemId GetPrev(const wxTreeItemId &item, bool fulltree=true) const
bool HasChildren(const wxTreeItemId &item) const
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
static int LINKAGEMODE tree_ctrl_compare_func(wxTreeListItem **item1, wxTreeListItem **item2)
bool m_ownsImageListState
EVT_ERASE_BACKGROUND(wxTreeListHeaderWindow::OnEraseBackground) void wxTreeListHeaderWindow
virtual void SetWindowStyleFlag(long styles)
void SetItemBold(const wxTreeItemId &item, bool bold=true)
int GetImage(int column, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
void AddColumn(const wxString &text, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false, const wxString &tooltip=wxEmptyString)
int GetBestColumnWidth(int column, wxTreeItemId parent=wxTreeItemId())
wxTreeItemId HitTest(const wxPoint &point)
wxColour GetItemTextColour(const wxTreeItemId &item) const
void ExpandAll(const wxTreeItemId &item)
wxTreeItemId GetNextChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
void RefreshLine(wxTreeListItem *item)
void Expand(const wxTreeItemId &item)
static const int LINEATROOT
int GetItemWidth(int column, wxTreeListItem *item)
wxTreeItemId GetFirstVisible(bool fullRow=false, bool within=true) const
void AssignImageList(wxImageList *imageList)
void SetItemToolTip(const wxTreeItemId &item, const wxString &tip)
void OnKillFocus(wxFocusEvent &event)
int GetColumnCount() const
const wxChar * wxTreeListCtrlNameStr
bool GetItemBold(const wxTreeItemId &item) const
wxColour GetItemTextColour(const wxTreeItemId &item) const
static wxTreeListMainWindow * s_treeBeingSorted
wxColour GetItemBackgroundColour(const wxTreeItemId &item) const
int GetCurrentImage() const
void SetColumn(int column, const wxTreeListColumnInfo &colInfo)
wxTreeItemId InsertItem(const wxTreeItemId &parent, const wxTreeItemId &idPrevious, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
int GetTextX(int column) const
void OnIdle(wxIdleEvent &event)
wxTreeItemId GetFirstExpandedItem() const
const int wxTL_MODE_FIND_PARTIAL
void SetColumnText(int column, const wxString &text)
void SetCurrentItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
void RemoveColumn(int column)
void SetItemParent(const wxTreeItemId &parent, const wxTreeItemId &item)
virtual wxString OnGetItemText(wxTreeItemData *item, long column) const
wxTreeListItem * m_parent
void SetItemTextColour(const wxTreeItemId &item, const wxColour &colour)
const wxString GetText(int column) const
int GetItemImage(const wxTreeItemId &item, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
int GetColumnImage(int column) const
unsigned int GetIndent() const
wxTreeItemId HitTest(const wxPoint &point, int &flags)
bool IsSelected(const wxTreeItemId &item) const
void UnselectAllChildren(wxTreeListItem *item)
wxImageList * m_imageListButtons
virtual bool SetForegroundColour(const wxColour &colour)
void SetTextX(int column, int text_x)
wxArrayTreeListItems m_children
friend class wxEditTextCtrl
wxTreeItemId GetFirstVisible(bool fullRow, bool within) const
void SetOwner(wxTreeListMainWindow *owner)
bool IsExpanded(const wxTreeItemId &item) const
wxTreeItemId GetPrevChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
bool TagAllChildrenUntilLast(wxTreeListItem *crt_item, wxTreeListItem *last_item)
void SetHasPlus(bool has=true)
static const int EXTRA_HEIGHT
options wxIntPtr wxIntPtr sortData std::vector< PanoInfo > * data
wxTreeItemId GetNext(const wxTreeItemId &item, bool fulltree=true) const
#define wxTR_COLUMN_LINES
static const int MININDENT
int GetLineHeight(wxTreeListItem *item) const
virtual wxSize DoGetBestSize() const
static const int BTNWIDTH
wxTreeItemId GetFirstVisibleItem(bool fullRow=false) const
void SetDragItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
wxTreeItemId DoInsertItem(const wxTreeItemId &parent, size_t previous, const wxString &text, int image, int selectedImage, wxTreeItemData *data)
void SetToolTip(const wxString &tip)
void SetWindowStyle(const long styles)
int GetItemImage(const wxTreeItemId &item, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
int GetColumnCount() const
wxImageList * GetStateImageList() const
wxTreeListMainWindow * m_main_win
wxTreeItemId GetSelection() const
wxString GetColumnText(int column) const
wxTreeItemId GetPrevExpanded(const wxTreeItemId &item) const
void OnScroll(wxScrollWinEvent &event)
void CollapseAndReset(const wxTreeItemId &item)
void OnKillFocus(wxFocusEvent &event)
wxTreeListItemCellAttrHash m_props_cell
wxImageList * m_imageListNormal
void SetHilight(bool set=true)
void ScrollTo(const wxTreeItemId &item)
size_t GetSelections(wxArrayTreeItemIds &) const
virtual bool SetFont(const wxFont &font)
wxFont GetItemFont(const wxTreeItemId &item) const
static void info(const char *fmt,...)
void SetImageList(wxImageList *imageList)
void ExpandAll(const wxTreeItemId &item)
wxImageList * m_imageListState
void SetItemHasChildren(const wxTreeItemId &item, bool has=true)
bool MatchItemText(const wxString &itemText, const wxString &pattern, int mode)
wxBrush * m_hilightUnfocusedBrush
void OnPaint(wxPaintEvent &event)
void SetDragItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
const int wxTL_MODE_NAV_VISIBLE
wxTreeItemId GetSelection() const
bool GetBoundingRect(const wxTreeItemId &item, wxRect &rect, bool textOnly=false) const
wxTreeItemId GetPrevVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
void Toggle(const wxTreeItemId &item)
void SetButtonsImageList(wxImageList *imageList)
wxTreeListMainWindow * GetMainWindow() const
wxTreeItemId GetNextChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
wxTreeItemId GetNextExpanded(const wxTreeItemId &item) const
void SetData(wxTreeItemData *data)
wxTreeItemData * GetData(int column) const
void OnCaptureLost(wxMouseCaptureLostEvent &WXUNUSED(event))
wxTreeItemId GetPrevVisible(const wxTreeItemId &item, bool fullRow, bool within) const
void OnMouse(wxMouseEvent &event)
virtual int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2)
bool HasChildren(const wxTreeItemId &item) const
wxString GetItemText(const wxTreeItemId &item) const
wxImageList * GetStateImageList() const
void CalculateLevel(wxTreeListItem *item, wxDC &dc, int level, int &y, int x_maincol)
void SetIndent(unsigned int indent)
void CalculatePositions()
wxImageList * GetButtonsImageList() const
wxTreeListMainWindow * m_owner
wxTreeListItem * m_editItem
void DoDeleteItem(wxTreeListItem *item)
virtual bool SetBackgroundColour(const wxColour &colour)
wxEditTextCtrl * m_editControl
wxTreeListItem * m_curItem
unsigned int GetIndent() const
void SetButtonsImageList(wxImageList *imageList)
void DeleteChildren(const wxTreeItemId &item)
WX_DECLARE_HASH_MAP(int, wxTreeListItemCellAttr *, wxIntegerHash, wxIntegerEqual, wxTreeListItemCellAttrHash)
virtual bool SetFont(const wxFont &font)
wxTreeListHeaderWindow * GetHeaderWindow() const
bool IsExpanded(const wxTreeItemId &item) const
wxTreeItemId GetPrevChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
wxTreeItemData * GetItemData(const wxTreeItemId &item) const
void SetItemText(const wxTreeItemId &item, const wxString &text)
void EditLabel(const wxTreeItemId &item)
wxImageList * GetImageList() const
void SetStateImageList(wxImageList *imageList)
wxTreeListHeaderWindow * m_header_win
void Delete(const wxTreeItemId &item)
const wxString * GetToolTip() const
bool IsBold(int column) const
int GetColumnWidth(int column) const
wxTreeListItem * m_toolTipItem
static const int FIND_TIMER_TICKS
void OnEraseBackground(wxEraseEvent &WXUNUSED(event))
int GetMainColumn() const
void SetToolTip(const wxString &tip)
void OnSetFocus(wxFocusEvent &event)