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"));
258 const wxPoint& pos = wxDefaultPosition,
259 const wxSize& size = wxDefaultSize,
260 long style = wxTR_DEFAULT_STYLE,
261 const wxValidator &validator = wxDefaultValidator,
262 const wxString& name = _T(
"wxtreelistmainwindow"))
265 Create (parent,
id, pos, size, style, validator, name);
271 const wxPoint& pos = wxDefaultPosition,
272 const wxSize& size = wxDefaultSize,
273 long style = wxTR_DEFAULT_STYLE,
274 const wxValidator &validator = wxDefaultValidator,
275 const wxString& name = _T(
"wxtreelistctrl"));
321 void SetItemToolTip(
const wxTreeItemId& item,
const wxString &tip);
330 wxString
GetItemText (
const wxTreeItemId& item,
int column)
const;
331 wxString
GetItemText (wxTreeItemData* item,
int column)
const;
335 int GetItemImage (
const wxTreeItemId& item,
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const;
338 wxTreeItemData *
GetItemData(
const wxTreeItemId& item)
const;
339 wxTreeItemData *
GetItemData(
const wxTreeItemId& item,
int column)
const;
342 bool GetItemBold(
const wxTreeItemId& item,
int column)
const;
350 wxFont
GetItemFont(
const wxTreeItemId& item)
const;
351 wxFont
GetItemFont(
const wxTreeItemId& item,
int column)
const;
365 void SetItemText (
const wxTreeItemId& item,
int column,
const wxString& text);
369 void SetItemImage (
const wxTreeItemId& item,
int column,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
373 void SetItemData(
const wxTreeItemId& item,
int column, wxTreeItemData *
data);
376 void SetItemBold(
const wxTreeItemId& item,
bool bold =
true);
377 void SetItemBold(
const wxTreeItemId& item,
int column,
bool bold =
true);
381 void SetItemTextColour(
const wxTreeItemId& item,
int column,
const wxColour& colour);
388 void SetItemFont(
const wxTreeItemId& item,
const wxFont& font);
389 void SetItemFont(
const wxTreeItemId& item,
int column,
const wxFont& font);
397 bool IsVisible(
const wxTreeItemId& item,
bool fullRow,
bool within =
true)
const;
401 bool IsExpanded(
const wxTreeItemId& item)
const;
403 bool IsSelected(
const wxTreeItemId& item)
const;
405 bool IsBold(
const wxTreeItemId& item)
const;
406 bool IsBold(
const wxTreeItemId& item,
int column)
const;
411 virtual bool SetFont(
const wxFont &font );
449 wxTreeItemId
GetFirstChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
450 wxTreeItemId
GetNextChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
451 wxTreeItemId
GetPrevChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
452 wxTreeItemId
GetLastChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
459 wxTreeItemId
GetNext(
const wxTreeItemId& item,
bool fulltree =
true)
const;
460 wxTreeItemId
GetPrev(
const wxTreeItemId& item,
bool fulltree =
true)
const;
469 wxTreeItemId
GetNextVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
470 wxTreeItemId
GetPrevVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
477 wxTreeItemId
AddRoot (
const wxString& text,
478 int image = -1,
int selectedImage = -1,
479 wxTreeItemData *
data = NULL);
482 wxTreeItemId
PrependItem(
const wxTreeItemId& parent,
483 const wxString& text,
484 int image = -1,
int selectedImage = -1,
485 wxTreeItemData *
data = NULL);
488 wxTreeItemId
InsertItem(
const wxTreeItemId& parent,
489 const wxTreeItemId& idPrevious,
490 const wxString& text,
491 int image = -1,
int selectedImage = -1,
492 wxTreeItemData *
data = NULL);
495 wxTreeItemId
InsertItem(
const wxTreeItemId& parent,
497 const wxString& text,
498 int image = -1,
int selectedImage = -1,
499 wxTreeItemData *
data = NULL);
502 wxTreeItemId
AppendItem(
const wxTreeItemId& parent,
503 const wxString& text,
504 int image = -1,
int selectedImage = -1,
505 wxTreeItemData *
data = NULL);
508 void Delete(
const wxTreeItemId& item);
516 void SetItemParent(
const wxTreeItemId& parent,
const wxTreeItemId& item);
519 void Expand(
const wxTreeItemId& item);
521 void ExpandAll(
const wxTreeItemId& item);
523 void Collapse(
const wxTreeItemId& item);
527 void Toggle(
const wxTreeItemId& item);
536 bool SelectItem(
const wxTreeItemId& item,
const wxTreeItemId& prev = (wxTreeItemId*)NULL,
537 bool unselect_others =
true);
543 void ScrollTo(
const wxTreeItemId& item);
549 {
int flags;
int column;
return HitTest (point, flags, column); }
551 {
int column;
return HitTest (point, flags, column); }
552 wxTreeItemId
HitTest (
const wxPoint& point,
int&
flags,
int& column);
558 bool textOnly =
false)
const;
563 void EditLabel (
const wxTreeItemId& item,
int column);
564 void EndEdit(
bool isCancelled);
572 const wxTreeItemId&
item2);
576 void SortChildren(
const wxTreeItemId& item,
int column,
bool reverseOrder);
579 bool MatchItemText (
const wxString &itemText,
const wxString &pattern,
int mode);
580 wxTreeItemId
FindItem (
const wxTreeItemId& item,
int column,
const wxString& str,
int mode = 0);
589 void SetDragItem (
const wxTreeItemId& item = (wxTreeItemId*)NULL);
592 void OnPaint( wxPaintEvent &event );
596 void OnChar( wxKeyEvent &event );
597 void OnMouse( wxMouseEvent &event );
598 void OnIdle( wxIdleEvent &event );
599 void OnScroll(wxScrollWinEvent& event);
684 const wxString& text,
685 int image,
int selectedImage,
686 wxTreeItemData *
data);
752 const wxString &value = wxEmptyString,
753 const wxPoint &pos = wxDefaultPosition,
754 const wxSize &size = wxDefaultSize,
756 const wxValidator& validator = wxDefaultValidator,
757 const wxString &name = wxTextCtrlNameStr );
761 void EndEdit(
bool isCancelled);
764 void OnChar( wxKeyEvent &event );
765 void OnKeyUp( wxKeyEvent &event );
822 const wxArrayString& text,
825 wxTreeItemData *
data );
838 if (column < (
signed)
m_text.GetCount())
return m_text[column];
839 return wxEmptyString;
842 int GetImage ( wxTreeItemIcon which = wxTreeItemIcon_Normal)
const {
return m_images[which]; };
843 int GetImage (
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const
849 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
851 return entry->second->m_image;
857 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
859 return entry->second->m_data;
873 void SetText (
int column,
const wxString& text)
875 if (column < (
int)
m_text.GetCount()) {
877 }
else if (column < m_owner->GetColumnCount()) {
879 for (
int i = (
int)
m_text.GetCount(); i < howmany; ++i)
881 m_text.Add(wxEmptyString);
888 void SetImage (
int column,
int image, wxTreeItemIcon which)
894 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
899 entry->second->m_image = image;
908 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
913 entry->second->m_data =
data;
920 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
926 entry->second->m_isBold = bold;
927 entry->second->m_isBoldSet = 1;
934 if (tip.length() > 0) {
m_toolTip =
new wxString(tip); }
947 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
949 return (entry->second->m_isBold != 0);
969 if (column >=0 && column < (
signed)
m_text_x.GetCount())
990 int &
flags,
int& column,
int level);
1014 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
1016 return entry->second->m_attr;
1022 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
1029 return *(entry->second->m_attr);
1111 const wxWindowID
id,
1115 const wxString &value,
1119 const wxValidator& validator,
1120 const wxString &name)
1121 : wxTextCtrl (parent, id, value, pos, size, style | wxSIMPLE_BORDER | wxTE_PROCESS_ENTER, validator, name)
1126 (*m_accept) =
false;
1127 (*m_res) = wxEmptyString;
1144 (*m_accept) = ! isCancelled;
1158 wxTheApp->ScheduleForDestruction(
this);
1169 if (event.GetKeyCode() == WXK_RETURN)
1174 if (event.GetKeyCode() == WXK_ESCAPE)
1191 wxSize parentSize =
m_owner->GetSize();
1192 wxPoint myPos = GetPosition();
1193 wxSize mySize = GetSize();
1195 GetTextExtent(GetValue() + _T(
"M"), &sx, &sy);
1196 if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x;
1197 if (mySize.x > sx) sx = mySize.x;
1229 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()) {
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()) {
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);
1586 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1595 wxCHECK_RET ((before >= 0) && (before <
GetColumnCount()), _T(
"Invalid column"));
1603 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1611 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
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);
1854 m_hilightBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHT), wxBRUSHSTYLE_SOLID);
1855 m_hilightUnfocusedBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW), wxBRUSHSTYLE_SOLID);
1857 m_imageListNormal = (wxImageList *) NULL;
1858 m_imageListButtons = (wxImageList *) NULL;
1859 m_imageListState = (wxImageList *) NULL;
1860 m_ownsImageListNormal = m_ownsImageListButtons =
1861 m_ownsImageListState =
false;
1863 m_imgWidth = 0, m_imgWidth2 = 0;
1864 m_imgHeight = 0, m_imgHeight2 = 0;
1865 m_btnWidth = 0, m_btnWidth2 = 0;
1866 m_btnHeight = 0, m_btnHeight2 = 0;
1868 m_isDragStarted = m_isDragging =
false;
1873 m_editControl = NULL;
1875 m_lastOnSame =
false;
1876 m_left_down_selection =
false;
1878 m_findTimer =
new wxTimer (
this, -1);
1880 #if defined( __WXMAC__ ) && defined(__WXMAC_CARBON__)
1881 m_normalFont.MacCreateThemeFont (kThemeViewsFont);
1883 m_normalFont = wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT);
1885 m_boldFont = wxFont( m_normalFont.GetPointSize(),
1886 m_normalFont.GetFamily(),
1887 m_normalFont.GetStyle(),
1889 m_normalFont.GetUnderlined(),
1890 m_normalFont.GetFaceName(),
1891 m_normalFont.GetEncoding());
1894 m_isItemToolTip =
false;
1902 const wxValidator &validator,
1903 const wxString& name) {
1905 wxScrolledWindow::Create (parent,
id, pos, size, style|wxHSCROLL|wxVSCROLL, name);
1907 #if wxUSE_VALIDATORS
1908 SetValidator(validator);
1913 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
1915 m_dottedPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 0, wxPENSTYLE_DOT);
1990 wxCHECK_MSG (item.IsOk(), 0u, _T(
"invalid tree item"));
1996 if ((styles ^ m_windowStyle) & wxTR_MULTIPLE) {
UnselectAll(); }
2000 m_windowStyle = styles;
2011 m_toolTip = (tip == NULL) ? wxString() : tip->GetTip();
2016 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2028 wxCHECK_MSG (item.IsOk(), -1, _T(
"invalid tree item"));
2029 return ((
wxTreeListItem*) item.m_pItem)->GetImage (column, which);
2033 wxCHECK_MSG (item.IsOk(), NULL, _T(
"invalid tree item"));
2037 wxCHECK_MSG (item.IsOk(), NULL, _T(
"invalid tree item"));
2042 wxCHECK_MSG(item.IsOk(),
false, _T(
"invalid tree item"));
2046 wxCHECK_MSG(item.IsOk(),
false, _T(
"invalid tree item"));
2051 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2054 if (attr && attr->HasTextColour()) {
2055 return attr->GetTextColour();
2057 return GetForegroundColour();
2061 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2064 if (attr && attr->HasTextColour()) {
2065 return attr->GetTextColour();
2072 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2075 if (attr && attr->HasBackgroundColour()) {
2076 return attr->GetBackgroundColour();
2078 return GetBackgroundColour();
2082 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2085 if (attr && attr->HasBackgroundColour()) {
2086 return attr->GetBackgroundColour();
2093 wxCHECK_MSG (item.IsOk(), wxNullFont, _T(
"invalid tree item"));
2096 if (attr && attr->HasFont()) {
2097 return attr->GetFont();
2098 }
else if (pItem->IsBold()) {
2105 wxCHECK_MSG (item.IsOk(), wxNullFont, _T(
"invalid tree item"));
2108 wxItemAttr *attr_row = pItem->GetAttributes();
2109 if (attr_cell && attr_cell->HasFont()) {
2110 return attr_cell->GetFont();
2111 }
else if (attr_row && attr_row->HasFont()) {
2112 return attr_row->GetFont();
2113 }
else if (pItem->IsBold(column)) {
2121 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2128 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2130 if(pItem->GetImage(column, which) != image)
2132 pItem->
SetImage (column, image, which);
2135 wxClientDC dc (
this);
2143 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2147 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2152 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2154 if (pItem->IsBold() != bold) {
2160 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2163 pItem->
SetBold (column, bold);
2169 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2171 pItem->
Attr().SetTextColour (colour);
2175 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2177 pItem->
Attr(column).SetTextColour (colour);
2182 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2184 pItem->
Attr().SetBackgroundColour (colour);
2188 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2190 pItem->
Attr(column).SetBackgroundColour (colour);
2195 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2197 pItem->
Attr().SetFont (font);
2201 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2203 pItem->
Attr(column).SetFont (font);
2209 wxScrolledWindow::SetFont (font);
2227 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2233 if (parent ==
m_rootItem && HasFlag(wxTR_HIDE_ROOT))
break;
2240 wxSize clientSize = GetClientSize();
2243 ((!fullRow && rect.GetWidth() == 0) || rect.GetHeight() == 0) ||
2244 (rect.GetTop() < 0 || rect.GetBottom() >= clientSize.y) ||
2245 (!fullRow && (rect.GetLeft() < 0 || rect.GetRight() >= clientSize.x)))
return false;
2252 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2263 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2268 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2273 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2282 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2287 wxTreeItemIdValue& cookie)
const {
2288 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2289 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2291 return (!children.IsEmpty())? wxTreeItemId(children.Item(0)): wxTreeItemId();
2295 wxTreeItemIdValue& cookie)
const {
2296 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2297 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2299 long *pIndex = ((
long*)&cookie);
2300 return ((*pIndex)+1 < (long)children.Count())? wxTreeItemId(children.Item(++(*pIndex))): wxTreeItemId();
2304 wxTreeItemIdValue& cookie)
const {
2305 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2306 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2308 long *pIndex = (
long*)&cookie;
2309 return ((*pIndex)-1 >= 0)? wxTreeItemId(children.Item(--(*pIndex))): wxTreeItemId();
2313 wxTreeItemIdValue& cookie)
const {
2314 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2315 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2317 long *pIndex = ((
long*)&cookie);
2318 (*pIndex) = (long)children.Count();
2319 return (!children.IsEmpty())? wxTreeItemId(children.Last()): wxTreeItemId();
2323 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2328 if (!parent)
return wxTreeItemId();
2331 wxArrayTreeListItems& siblings = parent->GetChildren();
2332 size_t index = siblings.Index (i);
2333 wxASSERT (index != (
size_t)wxNOT_FOUND);
2334 return (index < siblings.Count()-1)? wxTreeItemId(siblings[index+1]): wxTreeItemId();
2338 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2343 if (!parent)
return wxTreeItemId();
2346 wxArrayTreeListItems& siblings = parent->GetChildren();
2347 size_t index = siblings.Index(i);
2348 wxASSERT (index != (
size_t)wxNOT_FOUND);
2349 return (index >= 1)? wxTreeItemId(siblings[index-1]): wxTreeItemId();
2354 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2358 wxArrayTreeListItems& children = ((
wxTreeListItem*)item.m_pItem)->GetChildren();
2359 if (children.GetCount() > 0)
return children.Item (0);
2364 wxTreeItemId parent = item;
2368 }
while (!next.IsOk() && parent.IsOk());
2374 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2381 while (fulltree || ((
wxTreeListItem*)prev.m_pItem)->IsExpanded()) {
2382 wxArrayTreeListItems& children = ((
wxTreeListItem*)prev.m_pItem)->GetChildren();
2383 if (children.GetCount() == 0)
break;
2384 prev = children.Item (children.GetCount() - 1);
2395 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2400 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2413 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2414 wxTreeItemId
id =
GetNext (item,
false);
2416 if (
IsVisible (
id, fullRow, within))
return id;
2419 return wxTreeItemId();
2423 wxCHECK_MSG (
GetRootItem().IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2425 wxTreeItemId res = id;
2426 while ((
id =
GetNext (
id,
false)).IsOk()) {
2427 if (
IsVisible (
id, fullRow, within)) res = id;
2433 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2434 wxTreeItemId
id =
GetPrev (item,
true);
2436 if (
IsVisible (
id, fullRow, within))
return id;
2439 return wxTreeItemId();
2450 const wxString& text,
2451 int image,
int selImage,
2452 wxTreeItemData *
data) {
2454 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2459 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2465 parent->
Insert (item, previous);
2471 int image,
int selImage,
2472 wxTreeItemData *
data) {
2473 wxCHECK_MSG(!
m_rootItem, wxTreeItemId(), _T(
"tree can have only one root"));
2474 wxCHECK_MSG(
GetColumnCount(), wxTreeItemId(), _T(
"Add column(s) before adding the root item"));
2479 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2485 if (HasFlag(wxTR_HIDE_ROOT)) {
2489 wxTreeItemIdValue cookie = 0;
2496 const wxString& text,
2497 int image,
int selImage,
2498 wxTreeItemData *
data) {
2499 return DoInsertItem (parent, 0u, text, image, selImage, data);
2503 const wxTreeItemId& idPrevious,
2504 const wxString& text,
2505 int image,
int selImage,
2506 wxTreeItemData *
data) {
2508 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2511 wxASSERT_MSG( index != wxNOT_FOUND,
2512 _T(
"previous item in wxTreeListMainWindow::InsertItem() is not a sibling") );
2514 return DoInsertItem (parentId, ++index, text, image, selImage, data);
2519 const wxString& text,
2520 int image,
int selImage,
2521 wxTreeItemData *
data) {
2523 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2525 return DoInsertItem (parentId, before, text, image, selImage, data);
2529 const wxString& text,
2530 int image,
int selImage,
2531 wxTreeItemData *
data) {
2533 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2542 if (! itemId.IsOk())
return;
2545 wxCHECK_RET (item !=
m_rootItem, _T(
"invalid item, root may not be deleted this way!"));
2553 parent->GetChildren().Remove (item);
2572 if (! itemId.IsOk())
return;
2577 wxArrayTreeListItems& children = item->
GetChildren();
2578 for (
size_t n = children.GetCount(); n>0; n--) {
2582 children.RemoveAt(n-1);
2588 wxCHECK_RET (item, _T(
"invalid item for delete!"));
2600 if (HasCapture()) ReleaseMouse();
2610 size_t index = siblings.Index (item);
2611 wxASSERT (index != (
size_t)wxNOT_FOUND);
2625 wxArrayTreeListItems& children = item->
GetChildren();
2626 for (
size_t n = children.GetCount(); n>0; n--) {
2630 children.RemoveAt(n-1);
2639 SendEvent(wxEVT_COMMAND_TREE_DELETE_ITEM, item);
2649 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::SetItemParent") );
2650 wxCHECK_RET (parent_new, _T(
"invalid parent in wxTreeListMainWindow::SetItemParent") );
2651 wxCHECK_RET (item !=
m_rootItem, _T(
"invalid root as item in wxTreeListMainWindow::SetItemParent!") );
2657 parent_new->Insert(item, parent_new->
GetChildren().Count());
2660 if (parent_new->GetChildren().Count() == 1) parent_new->Expand();
2675 if (old_item != NULL && old_item != item) {
2685 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::Expand") );
2690 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 0);
2692 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
2698 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_EXPANDED);
2703 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2707 wxTreeItemIdValue cookie;
2709 while (child.IsOk()) {
2717 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::Collapse") );
2722 wxTreeEvent event (wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 0 );
2724 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
2730 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
2735 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2742 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2760 wxCHECK_RET (item, _T(
"invalid tree item"));
2769 wxArrayTreeListItems& children = item->
GetChildren();
2770 size_t count = children.Count();
2771 for (
size_t n = 0; n < count; ++n) {
2795 wxArrayTreeListItems& children = parent->
GetChildren();
2796 int index = children.Index(crt_item);
2797 wxASSERT (index != wxNOT_FOUND);
2801 size_t count = children.Count();
2802 for (
size_t n = (index+1); n < count; ++n) {
2815 if (crt_item==last_item)
return true;
2818 wxArrayTreeListItems& children = crt_item->
GetChildren();
2819 size_t count = children.Count();
2820 for (
size_t n = 0; n < count; ++n) {
2829 const wxTreeItemId& lastId,
2830 bool unselect_others) {
2835 wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
2838 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return false;
2841 bool bUnselectedAll =
false;
2842 if (unselect_others) {
2843 if (HasFlag(wxTR_MULTIPLE)) {
2851 if (lastId.IsOk() && itemId.IsOk() && (itemId != lastId)) {
2871 }
else if (itemId.IsOk()) {
2876 if (unselect_others) {
2886 event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
2894 wxCHECK_RET (HasFlag(wxTR_MULTIPLE), _T(
"invalid tree style"));
2895 wxCHECK_RET (root.IsOk(), _T(
"no tree"));
2898 wxTreeEvent event (wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
2903 wxTreeItemIdValue cookie = 0;
2911 event.SetEventType (wxEVT_COMMAND_TREE_SEL_CHANGED);
2916 wxArrayTreeItemIds &array)
const {
2917 if (item->
IsSelected()) array.Add (wxTreeItemId(item));
2920 wxArrayTreeListItems& children = item->
GetChildren();
2921 size_t count = children.GetCount();
2922 for (
size_t n = 0; n < count; ++n)
FillArray (children[n], array);
2930 return array.Count();
2934 if (!item.IsOk())
return;
2949 if (!item.IsOk())
return;
2957 int item_y = gitem->
GetY();
2960 GetScrollPixelsPerUnit (&xUnit, &yUnit);
2963 GetViewStart (&start_x, &start_y);
2968 GetClientSize (&client_w, &client_h);
2975 int x_pos = GetScrollPos( wxHORIZONTAL );
2977 if (item_y < start_y+3) {
2979 SetScrollbars (xUnit, yUnit, xUnit ? x/xUnit : 0, yUnit ? y/yUnit : 0, x_pos, yUnit ? item_y/yUnit : 0);
2982 item_y += yUnit + 2;
2983 SetScrollbars (xUnit, yUnit, xUnit ? x/xUnit : 0, yUnit ? y/yUnit : 0, x_pos, yUnit ? (item_y+
GetLineHeight(gitem)-client_h)/yUnit : 0 );
2992 wxCHECK_MSG (
s_treeBeingSorted, 0, _T(
"bug in wxTreeListMainWindow::SortChildren()") );
3008 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
3013 _T(
"wxTreeListMainWindow::SortChildren is not reentrant") );
3015 wxArrayTreeListItems& children = item->
GetChildren();
3016 if ( children.Count() > 1 ) {
3027 wxString searchText;
3030 searchText = itemText.Mid (0, pattern.Length());
3032 searchText = itemText;
3035 if (searchText.CmpNoCase (pattern) == 0)
return true;
3037 if (searchText.Cmp (pattern) == 0)
return true;
3045 wxTreeItemIdValue cookie = 0;
3046 wxTreeItemId next = item;
3050 int col, col_start, col_end;
3051 if (column >= 0) { col_start = col_end = column; }
3070 if (next.IsOk() && HasFlag(wxTR_HIDE_ROOT)) {
3075 if (! next.IsOk() || next == item)
return (wxTreeItemId*)NULL;
3077 for (col=col_start; col<=col_end; col++) {
3082 return (wxTreeItemId*)NULL;
3093 wxClientDC dc (
this);
3102 for (
int i = 0; i < n ; i++) {
3103 int width = 0, height = 0;
3114 for (
int i = 0; i < n ; i++) {
3115 int width = 0, height = 0;
3172 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3173 if (xUnit == 0) xUnit = GetCharWidth();
3178 int x_pos = GetScrollPos (wxHORIZONTAL);
3179 int y_pos = GetScrollPos (wxVERTICAL);
3181 if (x < GetClientSize().GetWidth()) x_pos = 0;
3182 SetScrollbars (xUnit, yUnit, x/xUnit, y/yUnit, x_pos, y_pos);
3184 SetScrollbars (0, 0, 0, 0);
3189 if (GetWindowStyleFlag() & wxTR_HAS_VARIABLE_ROW_HEIGHT) {
3201 wxColour colTextHilight = wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHTTEXT);
3204 int off_h = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
3206 wxDCClipper clipper (dc, 0, item->
GetY(), total_w, total_h);
3216 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3217 dc.SetPen (*wxTRANSPARENT_PEN);
3218 if (HasFlag (wxTR_FULL_ROW_HIGHLIGHT)) {
3222 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3223 dc.SetPen (*wxBLACK_PEN);
3224 #endif // !__WXMAC__
3227 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3228 dc.SetPen (*wxTRANSPARENT_PEN);
3229 #endif // !__WXMAC__
3231 dc.SetTextForeground (colTextHilight);
3235 dc.SetPen (
m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
3238 dc.DrawRectangle (0, item->
GetY() + off_h, total_w, total_h - off_h);
3242 int text_extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0;
3248 if (col_w <= 0)
continue;
3249 wxDCClipper clipper (dc, x_colstart, item->
GetY(), col_w, total_h);
3275 int w = 0, text_w = 0;
3276 wxString text = item->
GetText(i);
3277 dc.GetTextExtent (text, &text_w, NULL);
3283 w = col_w - (image_w + text_w + off_w +
MARGIN);
3286 case wxALIGN_CENTER:
3287 w = (col_w - (image_w + text_w + off_w +
MARGIN))/2;
3291 int text_x = x + image_w;
3296 if ( ! HasFlag (wxTR_FULL_ROW_HIGHLIGHT)) {
3298 bool drawCursor =
false;
3299 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3301 #endif // !__WXMAC__
3305 dc.SetPen (*wxTRANSPARENT_PEN);
3306 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3307 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
3309 dc.SetPen (drawCursor ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3311 dc.SetTextForeground (colTextHilight);
3312 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
3316 dc.SetPen (drawCursor && i !=
GetMainColumn() ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3317 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3318 dc.SetTextForeground (colText);
3319 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
3322 dc.SetPen (*wxBLACK_PEN);
3323 dc.SetBackgroundMode (wxTRANSPARENT);
3324 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
3331 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_3DLIGHT ), 1, wxPENSTYLE_SOLID);
3332 dc.SetPen ((GetBackgroundColour() == *wxWHITE)? pen: *wxWHITE_PEN);
3333 dc.DrawLine (x_colstart+col_w-1, item->
GetY(), x_colstart+col_w-1, item->
GetY()+total_h);
3336 dc.SetBackgroundMode (wxTRANSPARENT);
3340 int y = item->
GetY() + img_extraH;
3345 int text_y = item->
GetY() + text_extraH;
3346 dc.DrawText (text, (wxCoord)text_x, (wxCoord)text_y);
3348 x_colstart += col_w;
3357 int level,
int &y,
int x_maincol) {
3360 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0)) {
3361 wxArrayTreeListItems& children = item->
GetChildren();
3362 for (
size_t n = 0; n < children.Count(); n++) {
3363 PaintLevel (children[n], dc, 1, y, x_maincol);
3370 int x = x_maincol +
MARGIN;
3371 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
3377 if (HasFlag(wxTR_HIDE_ROOT)) {
3389 int y_mid = y_top + (h/2);
3392 int exposed_x = dc.LogicalToDeviceX(0);
3393 int exposed_y = dc.LogicalToDeviceY(y_top);
3395 if (IsExposed(exposed_x, exposed_y, 10000, h)) {
3397 if (HasFlag(wxTR_ROW_LINES)) {
3400 dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxPENSTYLE_SOLID));
3401 dc.DrawLine (0, y_top, total_width, y_top);
3402 dc.DrawLine (0, y_top+h, total_width, y_top+h);
3409 dc.SetBrush(*wxWHITE_BRUSH);
3415 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
3417 if (!HasFlag(wxTR_NO_LINES)) {
3422 if (x2 < (x_maincol + MARGIN)) x2 = x_maincol +
MARGIN;
3427 dc.DrawLine (x3, y_mid, x3 +
LINEATROOT, y_mid);
3429 dc.DrawLine (x2, y_mid, x3 +
LINEATROOT, y_mid);
3432 dc.DrawLine (x2, y_mid, x - m_indent/2, y_mid);
3441 int image = wxTreeItemIcon_Normal;
3442 if (item->
IsExpanded()) image = wxTreeItemIcon_Expanded;
3443 if (item->
IsSelected()) image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
3448 dc.DestroyClippingRegion();
3450 }
else if (HasFlag (wxTR_TWIST_BUTTONS)) {
3453 dc.SetPen(*wxBLACK_PEN);
3460 button[1].y = button[0].y;
3466 button[1].x = button[0].x;
3469 button[2].y = y_mid;
3471 dc.DrawPolygon(3, button);
3477 int flag = item->
IsExpanded()? wxCONTROL_EXPANDED: 0;
3478 wxRendererNative::Get().DrawTreeItemButton (
this, dc, rect, flag);
3486 dc.SetBrush(*wxWHITE_BRUSH);
3488 dc.SetTextForeground(*wxBLACK);
3492 wxArrayTreeListItems& children = item->
GetChildren();
3506 for (
size_t n = 0; n < children.Count(); ++n) {
3509 PaintLevel (children[n], dc, level+1, y, x_maincol);
3512 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
3513 if (!HasFlag (wxTR_NO_LINES)) {
3515 dc.DrawLine (x, oldY, x, y2);
3530 wxAutoBufferedPaintDC dc (
this);
3531 wxBrush brush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID);
3532 dc.SetBackground(brush);
3594 wxTreeEvent nevent (wxEVT_COMMAND_TREE_KEY_DOWN, 0 );
3596 nevent.SetKeyEvent (event);
3598 nevent.SetExtraLong(event.GetModifiers());
3599 if (
SendEvent(0, NULL, &nevent))
return;
3602 bool curItemSet =
false;
3606 if (HasFlag(wxTR_HIDE_ROOT)) {
3607 wxTreeItemIdValue cookie = 0;
3615 if (HasFlag(wxTR_MULTIPLE) && event.ShiftDown()) {
3621 if (curItemSet)
return;
3624 wxTreeItemId newItem = (wxTreeItemId*)NULL;
3625 switch (event.GetKeyCode()) {
3635 case WXK_SUBTRACT: {
3641 case WXK_MULTIPLY: {
3668 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3682 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1,1));
3689 if (abs_p.y < 0) abs_p.y = 0;
3699 wxTreeItemIdValue cookie = 0;
3705 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3706 newItem = (wxTreeItemId*)NULL;
3717 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3729 wxTreeItemIdValue cookie = 0;
3738 wxTreeItemIdValue cookie = 0;
3746 }
while (!newItem && parent);
3751 case WXK_PAGEDOWN: {
3754 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1,GetClientSize().GetHeight() -
m_curItem->
GetHeight()));
3775 wxChar key =
event.GetUnicodeKey();
3776 if (key == WXK_NONE) key = (wxChar)event.GetKeyCode();
3783 wxTreeItemId prev = (wxTreeItemId*)NULL;
3800 prev = (wxTreeItemId*)NULL;
3812 if (!event.ControlDown()) {
3813 bool unselect_others = !((
event.ShiftDown() ||
event.ControlDown()) &&
3814 HasFlag(wxTR_MULTIPLE));
3831 if (point.x<0) flags |= wxTREE_HITTEST_TOLEFT;
3832 if (point.x>w) flags |= wxTREE_HITTEST_TORIGHT;
3833 if (point.y<0) flags |= wxTREE_HITTEST_ABOVE;
3834 if (point.y>h) flags |= wxTREE_HITTEST_BELOW;
3835 if (flags)
return wxTreeItemId();
3838 flags = wxTREE_HITTEST_NOWHERE;
3840 return wxTreeItemId();
3844 this, flags, column, 0);
3846 flags = wxTREE_HITTEST_NOWHERE;
3848 return wxTreeItemId();
3855 bool WXUNUSED(textOnly))
const {
3856 wxCHECK_MSG (itemId.IsOk(),
false, _T(
"invalid item in wxTreeListMainWindow::GetBoundingRect") );
3861 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3863 GetViewStart(& startX, & startY);
3865 rect.x = item->GetX() - startX * xUnit;
3866 rect.y = item->GetY() - startY * yUnit;
3867 rect.width = item->GetWidth();
3878 if (!item.IsOk())
return;
3887 wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 0 );
3907 for (
int i = 0; i < column; ++i) {
3915 case wxALIGN_LEFT: {style = wxTE_LEFT; x -= 1;
break;}
3916 case wxALIGN_CENTER: {style = wxTE_CENTER; x -= 1;
break;}
3917 case wxALIGN_RIGHT: {style = wxTE_RIGHT; x += 0;
break;}
3924 wxClientDC dc (
this);
3926 x = dc.LogicalToDeviceX (x);
3927 y = dc.LogicalToDeviceY (y);
3933 wxPoint (x, y), wxSize (w, h), style);
3945 wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, 0 );
3947 le.SetEditCanceled(isCancelled);
3960 bool mayDrag =
true;
3961 bool maySelect =
true;
3962 bool mayClick =
true;
3963 bool mayDoubleClick =
true;
3967 if (
m_owner->GetEventHandler()->ProcessEvent(event))
return;
3978 wxPoint p = wxPoint (event.GetX(),
event.GetY());
3982 bool bCrosshair = (item && item->
HasPlus() && (flags & wxTREE_HITTEST_ONITEMBUTTON));
3985 maySelect = mayDoubleClick =
false;
3988 if (event.Dragging()) {
3989 maySelect = mayDoubleClick = mayClick =
false;
3994 if (event.LeftDown()) maySelect =
false;
3996 mayDoubleClick =
false;
3999 if (mayDoubleClick) mayDoubleClick = mayClick;
4001 if (maySelect) maySelect = mayClick;
4006 if (HasFlag(wxTR_MULTIPLE)) {
4010 if (event.ControlDown() ||
event.ShiftDown()) {
4011 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4017 }
else if ((item != NULL && item->
IsSelected())) {
4018 maySelect = maySelect &&
event.LeftUp();
4023 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4028 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4036 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown())
SetFocus();
4044 wxScrolledWindow::SetToolTip(
m_toolTip);
4053 wxScrolledWindow::SetToolTip(*tip);
4059 wxScrolledWindow::SetToolTip(wxString());
4064 wxScrolledWindow::SetToolTip(
m_toolTip);
4077 if (bCrosshair && event.LeftDown()) {
4090 if (event.LeftDown() && HasFlag(wxTR_MULTIPLE) &&
event.ShiftDown()) {
4098 bool unselect_others = ! (HasFlag(wxTR_MULTIPLE) && (
4100 ||
event.ControlDown()
4112 if (event.MiddleDown()) {
4114 wxTreeEvent nevent(0, 0);
4118 SendEvent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, item, &nevent);
4120 if (event.RightDown()) {
4122 wxTreeEvent nevent(0, 0);
4126 SendEvent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, item, &nevent);
4128 if (event.RightUp()) {
4130 wxTreeEvent nevent(0, 0);
4133 SendEvent(wxEVT_COMMAND_TREE_ITEM_MENU, item, &nevent);
4151 if (mayDoubleClick && event.LeftDClick()) {
4160 if (
SelectItem(item, (wxTreeItemId*)NULL,
true)) {
4163 if (!
SendEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, item)) {
4182 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown()) {
4188 if (HasCapture()) ReleaseMouse();
4192 }
else if (event.Dragging()) {
4203 if (HasCapture()) ReleaseMouse();
4208 wxTreeEvent nevent(0, 0);
4211 SendEvent(wxEVT_COMMAND_TREE_END_DRAG, item, &nevent);
4215 }
else if (event.Dragging()) {
4219 const int tolerance = 3;
4222 if (dx <= tolerance && dy <= tolerance)
4240 wxTreeEvent nevent(0, 0);
4245 ? wxEVT_COMMAND_TREE_BEGIN_DRAG
4246 : wxEVT_COMMAND_TREE_BEGIN_RDRAG,
4252 if (bSkip)
event.Skip();
4272 if (
m_owner->GetEventHandler()->ProcessEvent(event))
return;
4275 HandleOnScroll( event );
4277 if(event.GetOrientation() == wxHORIZONTAL) {
4299 max_h += max_h / 10;
4309 int level,
int &y,
int x_colstart) {
4312 int x = x_colstart +
MARGIN;
4313 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
4319 if (HasFlag(wxTR_HIDE_ROOT)) {
4326 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0))
goto Recurse;
4339 wxArrayTreeListItems& children = item->
GetChildren();
4340 long n, count = (long)children.Count();
4342 for (n = 0; n < count; ++n) {
4350 wxClientDC dc(
this);
4371 wxClientDC dc(
this);
4376 GetVirtualSize( &cw, &ch );
4379 rect.x = dc.LogicalToDeviceX( 0 );
4381 rect.y = dc.LogicalToDeviceY( item->
GetY() - 2 );
4384 Refresh (
true, &rect );
4391 wxClientDC dc(
this);
4396 GetVirtualSize( &cw, &ch );
4399 rect.x = dc.LogicalToDeviceX( 0 );
4400 rect.y = dc.LogicalToDeviceY( item->
GetY() );
4404 Refresh (
true, &rect);
4420 const wxArrayTreeListItems& children = item->
GetChildren();
4421 long count = (long)children.GetCount();
4422 for (
long n = 0; n < count; n++ ) {
4432 if (!wxWindow::SetBackgroundColour(colour))
return false;
4439 if (!wxWindow::SetForegroundColour(colour))
return false;
4446 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
4448 if (this->IsFrozen())
4456 wxClientDC dc(
this);
4465 wxCHECK_MSG (itemId.IsOk(), _T(
""), _T(
"invalid tree item") );
4468 else return ((
wxTreeListItem*) itemId.m_pItem)->GetText (column);
4472 wxASSERT_MSG(
IsVirtual(), _T(
"can be used only with virtual control") );
4477 wxWindow::SetFocus();
4482 if (!item)
return 0;
4487 GetTextExtent (item->
GetText (column), &w, &
h, NULL, NULL, font.Ok()? &font: NULL);
4491 int width = w + 2*
MARGIN;
4494 if (HasFlag(wxTR_LINES_AT_ROOT)) width +=
LINEATROOT;
4502 while (parent && (!HasFlag(wxTR_HIDE_ROOT) || (parent != root))) {
4506 if (level) width += level *
GetIndent();
4514 GetClientSize (&maxWidth, &h);
4521 if (!HasFlag(wxTR_HIDE_ROOT)) {
4523 if (width < w) width = w;
4524 if (width > maxWidth)
return maxWidth;
4527 wxTreeItemIdValue cookie = 0;
4529 while (item.IsOk()) {
4531 if (width < w) width = w;
4532 if (width > maxWidth)
return maxWidth;
4537 if (width < w) width = w;
4538 if (width > maxWidth)
return maxWidth;
4550 wxTreeEvent nevent (event_type, 0);
4552 if (event == NULL) {
4555 }
else if (event_type) {
4556 event->SetEventType(event_type);
4559 event->SetEventObject (
m_owner);
4560 event->SetId(
m_owner->GetId());
4562 event->SetItem (item);
4565 return m_owner->GetEventHandler()->ProcessEvent (*event);
4588 long style,
const wxValidator &validator,
4589 const wxString& name)
4591 long main_style = style & ~(wxBORDER_SIMPLE | wxBORDER_SUNKEN | wxBORDER_DOUBLE |
4592 wxBORDER_RAISED | wxBORDER_STATIC);
4593 main_style |= wxWANTS_CHARS ;
4594 long ctrl_style = style & ~(wxVSCROLL|wxHSCROLL);
4596 if (!wxControl::Create(parent,
id, pos, size, ctrl_style, validator, name)) {
4600 main_style, validator);
4602 wxPoint(0, 0), wxDefaultSize,
4616 h = (int)(wxRendererNative::Get().GetHeaderButtonHeight(
m_header_win) * 0.8) + 2;
4618 h = wxRendererNative::Get().GetHeaderButtonHeight(
m_header_win);
4632 GetClientSize(&w, &h);
4781 long main_style = style & ~(wxBORDER_SIMPLE | wxBORDER_SUNKEN | wxBORDER_DOUBLE | wxBORDER_RAISED | wxBORDER_STATIC);
4782 main_style |= wxWANTS_CHARS;
4785 m_windowStyle = style & ~(wxVSCROLL | wxHSCROLL);
4791 long style = m_windowStyle;
4825 wxTreeItemIdValue& cookie)
const
4829 wxTreeItemIdValue& cookie)
const
4833 wxTreeItemIdValue& cookie)
const
4837 wxTreeItemIdValue& cookie)
const
4877 int selectedImage, wxTreeItemData*
data)
4881 const wxString& text,
int image,
4883 wxTreeItemData*
data)
4887 const wxTreeItemId& previous,
4888 const wxString& text,
int image,
4890 wxTreeItemData*
data)
4893 selectedImage, data);
4898 const wxString& text,
int image,
4900 wxTreeItemData*
data)
4903 selectedImage, data);
4907 const wxString& text,
int image,
4909 wxTreeItemData*
data)
4943 bool unselect_others)
4962 bool textOnly)
const
5079 wxASSERT_MSG (column !=
GetMainColumn(), _T(
"The main column may not be hidden") );
5117 wxSize bestSizeMain =
m_main_win->GetBestSize();
5118 return wxSize (bestSizeHeader.x > bestSizeMain.x ? bestSizeHeader.x : bestSizeMain.x, bestSizeHeader.y + bestSizeMain.y);
5123 return wxEmptyString;
5155 wxTreeListCtrlXmlHandler::wxTreeListCtrlXmlHandler() : wxXmlResourceHandler() {
5157 #define wxTR_NO_BUTTONS 0x0000 // for convenience
5158 #define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
5159 #define wxTR_NO_LINES 0x0004 // don't draw lines at all
5160 #define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
5161 #define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl
5163 #define wxTR_SINGLE 0x0000 // for convenience
5164 #define wxTR_MULTIPLE 0x0020 // can select multiple items
5165 #define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
5166 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
5168 #define wxTR_EDIT_LABELS 0x0200 // can edit item labels
5169 #define wxTR_ROW_LINES 0x0400 // put border around items
5170 #define wxTR_HIDE_ROOT 0x0800 // don't display root node
5172 #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
5175 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
5177 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
5181 XRC_ADD_STYLE(wxTR_NO_BUTTONS);
5182 XRC_ADD_STYLE(wxTR_HAS_BUTTONS);
5183 XRC_ADD_STYLE(wxTR_NO_LINES);
5184 XRC_ADD_STYLE(wxTR_LINES_AT_ROOT);
5185 XRC_ADD_STYLE(wxTR_TWIST_BUTTONS);
5187 XRC_ADD_STYLE(wxTR_SINGLE);
5188 XRC_ADD_STYLE(wxTR_MULTIPLE);
5189 #if WXWIN_COMPATIBILITY_2_8
5191 XRC_ADD_STYLE(wxTR_EXTENDED);
5192 #endif // WXWIN_COMPATIBILITY_2_8
5193 XRC_ADD_STYLE(wxTR_HAS_VARIABLE_ROW_HEIGHT);
5195 XRC_ADD_STYLE(wxTR_EDIT_LABELS);
5196 XRC_ADD_STYLE(wxTR_ROW_LINES);
5197 XRC_ADD_STYLE(wxTR_HIDE_ROOT);
5199 XRC_ADD_STYLE(wxTR_FULL_ROW_HIGHLIGHT);
5201 XRC_ADD_STYLE(wxTR_DEFAULT_STYLE);
5211 wxObject *wxTreeListCtrlXmlHandler::DoCreateResource() {
5212 XRC_MAKE_INSTANCE(tlc, wxTreeListCtrl);
5213 tlc->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(), wxDefaultValidator, GetName());
5218 bool wxTreeListCtrlXmlHandler::CanHandle(wxXmlNode * node) {
5219 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
bool m_ownsImageListButtons
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)
friend class wxTreeListHeaderWindow
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)
friend class wxTreeListMainWindow
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
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 Create(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTR_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=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
bool m_ownsImageListNormal
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)
wxEditTextCtrl(wxWindow *parent, const wxWindowID id, bool *accept, wxString *res, wxTreeListMainWindow *owner, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxTextCtrlNameStr)