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>
106 #if !wxCHECK_VERSION(3,3,0)
150 const wxPoint &pos = wxDefaultPosition,
151 const wxSize &size = wxDefaultSize,
153 const wxString &name = _T(
"wxtreelistctrlcolumntitles") );
157 void DoDrawRect( wxDC *dc,
int x,
int y,
int w,
int h );
161 void OnPaint( wxPaintEvent &event );
163 void OnMouse( wxMouseEvent &event );
193 wxEmptyString, _T(
"Invalid column"));
198 _T(
"Invalid column"));
204 wxALIGN_LEFT, _T(
"Invalid column"));
209 _T(
"Invalid column"));
215 -1, _T(
"Invalid column"));
222 false, _T(
"Invalid column"));
228 true, _T(
"Invalid column"));
263 const wxPoint& pos = wxDefaultPosition,
264 const wxSize& size = wxDefaultSize,
265 long style = wxTR_DEFAULT_STYLE,
266 const wxValidator &validator = wxDefaultValidator,
267 const wxString& name = _T(
"wxtreelistmainwindow"))
270 Create (parent,
id, pos, size, style, validator, name);
276 const wxPoint& pos = wxDefaultPosition,
277 const wxSize& size = wxDefaultSize,
278 long style = wxTR_DEFAULT_STYLE,
279 const wxValidator &validator = wxDefaultValidator,
280 const wxString& name = _T(
"wxtreelistctrl"));
326 void SetItemToolTip(
const wxTreeItemId& item,
const wxString &tip);
335 wxString
GetItemText (
const wxTreeItemId& item,
int column)
const;
336 wxString
GetItemText (wxTreeItemData* item,
int column)
const;
340 int GetItemImage (
const wxTreeItemId& item,
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const;
343 wxTreeItemData *
GetItemData(
const wxTreeItemId& item)
const;
344 wxTreeItemData *
GetItemData(
const wxTreeItemId& item,
int column)
const;
347 bool GetItemBold(
const wxTreeItemId& item,
int column)
const;
355 wxFont
GetItemFont(
const wxTreeItemId& item)
const;
356 wxFont
GetItemFont(
const wxTreeItemId& item,
int column)
const;
370 void SetItemText (
const wxTreeItemId& item,
int column,
const wxString& text);
374 void SetItemImage (
const wxTreeItemId& item,
int column,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
378 void SetItemData(
const wxTreeItemId& item,
int column, wxTreeItemData *
data);
381 void SetItemBold(
const wxTreeItemId& item,
bool bold =
true);
382 void SetItemBold(
const wxTreeItemId& item,
int column,
bool bold =
true);
386 void SetItemTextColour(
const wxTreeItemId& item,
int column,
const wxColour& colour);
393 void SetItemFont(
const wxTreeItemId& item,
const wxFont& font);
394 void SetItemFont(
const wxTreeItemId& item,
int column,
const wxFont& font);
402 bool IsVisible(
const wxTreeItemId& item,
bool fullRow,
bool within =
true)
const;
406 bool IsExpanded(
const wxTreeItemId& item)
const;
408 bool IsSelected(
const wxTreeItemId& item)
const;
410 bool IsBold(
const wxTreeItemId& item)
const;
411 bool IsBold(
const wxTreeItemId& item,
int column)
const;
416 virtual bool SetFont(
const wxFont &font );
454 wxTreeItemId
GetFirstChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
455 wxTreeItemId
GetNextChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
456 wxTreeItemId
GetPrevChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
457 wxTreeItemId
GetLastChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
464 wxTreeItemId
GetNext(
const wxTreeItemId& item,
bool fulltree =
true)
const;
465 wxTreeItemId
GetPrev(
const wxTreeItemId& item,
bool fulltree =
true)
const;
474 wxTreeItemId
GetNextVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
475 wxTreeItemId
GetPrevVisible (
const wxTreeItemId& item,
bool fullRow,
bool within)
const;
482 wxTreeItemId
AddRoot (
const wxString& text,
483 int image = -1,
int selectedImage = -1,
484 wxTreeItemData *
data = NULL);
487 wxTreeItemId
PrependItem(
const wxTreeItemId& parent,
488 const wxString& text,
489 int image = -1,
int selectedImage = -1,
490 wxTreeItemData *
data = NULL);
493 wxTreeItemId
InsertItem(
const wxTreeItemId& parent,
494 const wxTreeItemId& idPrevious,
495 const wxString& text,
496 int image = -1,
int selectedImage = -1,
497 wxTreeItemData *
data = NULL);
500 wxTreeItemId
InsertItem(
const wxTreeItemId& parent,
502 const wxString& text,
503 int image = -1,
int selectedImage = -1,
504 wxTreeItemData *
data = NULL);
507 wxTreeItemId
AppendItem(
const wxTreeItemId& parent,
508 const wxString& text,
509 int image = -1,
int selectedImage = -1,
510 wxTreeItemData *
data = NULL);
513 void Delete(
const wxTreeItemId& item);
521 void SetItemParent(
const wxTreeItemId& parent,
const wxTreeItemId& item);
524 void Expand(
const wxTreeItemId& item);
526 void ExpandAll(
const wxTreeItemId& item);
528 void Collapse(
const wxTreeItemId& item);
532 void Toggle(
const wxTreeItemId& item);
541 bool SelectItem(
const wxTreeItemId& item,
const wxTreeItemId& prev = (wxTreeItemId*)NULL,
542 bool unselect_others =
true);
548 void ScrollTo(
const wxTreeItemId& item);
554 {
int flags;
int column;
return HitTest (point, flags, column); }
556 {
int column;
return HitTest (point, flags, column); }
557 wxTreeItemId
HitTest (
const wxPoint& point,
int&
flags,
int& column);
563 bool textOnly =
false)
const;
568 void EditLabel (
const wxTreeItemId& item,
int column);
569 void EndEdit(
bool isCancelled);
577 const wxTreeItemId&
item2);
581 void SortChildren(
const wxTreeItemId& item,
int column,
bool reverseOrder);
584 bool MatchItemText (
const wxString &itemText,
const wxString &pattern,
int mode);
585 wxTreeItemId
FindItem (
const wxTreeItemId& item,
int column,
const wxString& str,
int mode = 0);
594 void SetDragItem (
const wxTreeItemId& item = (wxTreeItemId*)NULL);
597 void OnPaint( wxPaintEvent &event );
601 void OnChar( wxKeyEvent &event );
602 void OnMouse( wxMouseEvent &event );
603 void OnIdle( wxIdleEvent &event );
604 void OnScroll(wxScrollWinEvent& event);
689 const wxString& text,
690 int image,
int selectedImage,
691 wxTreeItemData *
data);
757 const wxString &value = wxEmptyString,
758 const wxPoint &pos = wxDefaultPosition,
759 const wxSize &size = wxDefaultSize,
761 const wxValidator& validator = wxDefaultValidator,
762 const wxString &name = wxTextCtrlNameStr );
766 void EndEdit(
bool isCancelled);
769 void OnChar( wxKeyEvent &event );
770 void OnKeyUp( wxKeyEvent &event );
827 const wxArrayString& text,
830 wxTreeItemData *
data );
843 if (column < (
signed)
m_text.GetCount())
return m_text[column];
844 return wxEmptyString;
847 int GetImage ( wxTreeItemIcon which = wxTreeItemIcon_Normal)
const {
return m_images[which]; };
848 int GetImage (
int column, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const
854 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
856 return entry->second->m_image;
862 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
864 return entry->second->m_data;
878 void SetText (
int column,
const wxString& text)
880 if (column < (
int)
m_text.GetCount()) {
882 }
else if (column < m_owner->GetColumnCount()) {
884 for (
int i = (
int)
m_text.GetCount(); i < howmany; ++i)
886 m_text.Add(wxEmptyString);
893 void SetImage (
int column,
int image, wxTreeItemIcon which)
899 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
904 entry->second->m_image = image;
913 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
918 entry->second->m_data =
data;
925 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
931 entry->second->m_isBold = bold;
932 entry->second->m_isBoldSet = 1;
939 if (tip.length() > 0) {
m_toolTip =
new wxString(tip); }
952 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
954 return (entry->second->m_isBold != 0);
974 if (column >=0 && column < (
signed)
m_text_x.GetCount())
995 int &
flags,
int& column,
int level);
1019 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
1021 return entry->second->m_attr;
1027 wxTreeListItemCellAttrHash::const_iterator entry =
m_props_cell.find( column );
1034 return *(entry->second->m_attr);
1116 const wxWindowID
id,
1120 const wxString &value,
1124 const wxValidator& validator,
1125 const wxString &name)
1126 : wxTextCtrl (parent, id, value, pos, size, style | wxSIMPLE_BORDER | wxTE_PROCESS_ENTER, validator, name)
1131 (*m_accept) =
false;
1132 (*m_res) = wxEmptyString;
1149 (*m_accept) = ! isCancelled;
1163 wxTheApp->ScheduleForDestruction(
this);
1174 if (event.GetKeyCode() == WXK_RETURN)
1179 if (event.GetKeyCode() == WXK_ESCAPE)
1196 wxSize parentSize =
m_owner->GetSize();
1197 wxPoint myPos = GetPosition();
1198 wxSize mySize = GetSize();
1200 GetTextExtent(GetValue() + _T(
"M"), &sx, &sy);
1201 if (myPos.x + sx > parentSize.x) sx = parentSize.x - myPos.x;
1202 if (mySize.x > sx) sx = mySize.x;
1234 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
1266 const wxString &name )
1267 : wxWindow( win, id, pos, size, style, name )
1274 SetBackgroundColour (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNFACE));
1284 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW ), 1, wxPENSTYLE_SOLID);
1285 const int m_corner = 1;
1287 dc->SetBrush( *wxTRANSPARENT_BRUSH );
1288 #if defined( __WXMAC__ )
1291 dc->SetPen( *wxBLACK_PEN );
1293 dc->DrawLine( x+w-m_corner+1, y, x+w, y+h );
1294 dc->DrawRectangle( x, y+h, w+1, 1 );
1296 #if defined( __WXMAC__ )
1297 pen = wxPen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
1300 dc->DrawLine( x+w-m_corner, y, x+w-1, y+h );
1301 dc->DrawRectangle( x+1, y+h-1, w-2, 1 );
1303 dc->SetPen( *wxWHITE_PEN );
1304 dc->DrawRectangle( x, y, w-m_corner+1, 1 );
1305 dc->DrawRectangle( x, y, 1, h );
1306 dc->DrawLine( x, y+h-1, x+1, y+h-1 );
1307 dc->DrawLine( x+w-1, y, x+w-1, y+1 );
1315 m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
1317 m_owner->GetViewStart( &x, NULL );
1320 dc.SetDeviceOrigin( -x * xpix, 0 );
1325 wxAutoBufferedPaintDC dc(
this );
1332 GetClientSize( &w, &h );
1333 m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
1334 dc.SetBackgroundMode(wxTRANSPARENT);
1337 for (
int i = 0; i < numColumns && x < w; i++ )
1341 wxHeaderButtonParams params;
1344 params.m_labelColour = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
1345 params.m_labelFont = GetFont();
1350 wxRect rect(x, 0, wCol, h);
1354 flags |= wxCONTROL_CURRENT;
1356 params.m_labelText = column.
GetText();
1361 if ((image != -1) && imageList)
1362 params.m_labelBitmap = imageList->GetBitmap(image);
1364 wxRendererNative::Get().DrawHeaderButton(
this, dc, rect, flags, wxHDR_SORT_ICON_NONE, ¶ms);
1368 wxRect rect(x, 0, w-x, h);
1369 wxRendererNative::Get().DrawHeaderButton(
this, dc, rect);
1378 ClientToScreen (&x1, &y1);
1385 m_owner->GetClientSize( NULL, &y2 );
1386 m_owner->ClientToScreen( &x2, &y2 );
1389 dc.SetLogicalFunction (wxINVERT);
1390 dc.SetPen (wxPen (*wxBLACK, 2, wxPENSTYLE_SOLID));
1391 dc.SetBrush (*wxTRANSPARENT_BRUSH);
1394 dc.DrawLine (x1, y1, x2, y2);
1395 dc.SetLogicalFunction (wxCOPY);
1396 dc.SetPen (wxNullPen);
1397 dc.SetBrush (wxNullBrush);
1404 for (
int col = 0; col < numColumns; col++ )
1409 if ( x < (colLeft + column.
GetWidth()) )
1430 }
while (++idx <= col);
1432 m_owner->CalcScrolledPosition(x, 0, &x, NULL);
1433 RefreshRect(wxRect(x, 0, width, GetSize().GetHeight()));
1440 m_owner->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL);
1442 const int col =
XToCol(x);
1445 SetToolTip(
m_columns[col].GetTooltip());
1449 SetToolTip(wxEmptyString);
1451 if ( event.Moving() )
1476 SendListEvent (wxEVT_COMMAND_LIST_COL_DRAGGING, event.GetPosition());
1481 GetClientSize( &w, NULL );
1482 m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
1488 if (event.ButtonUp()) {
1490 if (HasCapture()) ReleaseMouse();
1494 SendListEvent (wxEVT_COMMAND_LIST_COL_END_DRAG, event.GetPosition());
1505 bool hit_border =
false;
1512 for (
int column = 0; column < countCol; column++) {
1517 if (abs (x-xpos) < 3) {
1531 if (event.LeftDown() ||
event.RightUp()) {
1534 if (hit_border && event.LeftDown()) {
1539 SendListEvent (wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, event.GetPosition());
1541 wxEventType evt =
event.LeftDown()? wxEVT_COMMAND_LIST_COL_CLICK:
1542 wxEVT_COMMAND_LIST_COL_RIGHT_CLICK;
1545 }
else if (event.LeftDClick() && hit_border) {
1549 }
else if (event.Moving()) {
1569 wxWindow *parent = GetParent();
1570 wxListEvent le (type, parent->GetId());
1571 le.SetEventObject (parent);
1572 le.m_pointDrag = pos;
1578 le.m_pointDrag.y -= GetSize().y;
1580 parent->GetEventHandler()->ProcessEvent (le);
1591 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1600 wxCHECK_RET ((before >= 0) && (before <
GetColumnCount()), _T(
"Invalid column"));
1608 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1616 wxCHECK_RET ((column >= 0) && (column <
GetColumnCount()), _T(
"Invalid column"));
1633 const wxArrayString& text,
1634 int image,
int selImage,
1635 wxTreeItemData *
data)
1638 m_images[wxTreeItemIcon_Normal] = image;
1639 m_images[wxTreeItemIcon_Selected] = selImage;
1664 wxTreeListItemCellAttrHash::iterator entry =
m_props_cell.begin();
1666 if (entry->second)
delete entry->second;
1670 wxASSERT_MSG(
m_children.IsEmpty(), _T(
"please call DeleteChildren() before destructor"));
1679 if (!recursively)
return count;
1681 size_t total = count;
1682 for (
size_t n = 0; n < count; ++n) {
1690 if (y < bottomY) y = bottomY;
1692 if ( x < width ) x = width;
1696 for (
size_t n = 0; n < count; ++n ) {
1704 int &
flags,
int& column,
int level) {
1711 if (!theCtrl->HasFlag(wxTR_HIDE_ROOT) || (level > 0)) {
1721 if (point.x >= x && point.x < x+w) {
1730 if ((point.y >=
m_y) && (point.y <=
m_y + h)) {
1733 int y_mid =
m_y + h/2;
1734 if (point.y < y_mid) {
1735 flags |= wxTREE_HITTEST_ONITEMUPPERPART;
1737 flags |= wxTREE_HITTEST_ONITEMLOWERPART;
1744 if ((point.x >= bntX) && (point.x <= (bntX + theCtrl->
m_btnWidth)) &&
1745 (point.y >= bntY) && (point.y <= (bntY + theCtrl->
m_btnHeight))) {
1746 flags |= wxTREE_HITTEST_ONITEMBUTTON;
1755 if ((point.x >= imgX) && (point.x <= (imgX + theCtrl->
m_imgWidth)) &&
1756 (point.y >= imgY) && (point.y <= (imgY + theCtrl->
m_imgHeight))) {
1757 flags |= wxTREE_HITTEST_ONITEMICON;
1764 flags |= wxTREE_HITTEST_ONITEMLABEL;
1769 if (point.x <
m_x) {
1770 flags |= wxTREE_HITTEST_ONITEMINDENT;
1778 flags |= wxTREE_HITTEST_ONITEMRIGHT;
1800 for (
size_t n = 0; n < count; n++) {
1801 child =
m_children[n]->HitTest (point, theCtrl, flags, column, level+1);
1802 if (child)
return child;
1813 image =
GetImage (wxTreeItemIcon_SelectedExpanded);
1815 image =
GetImage (wxTreeItemIcon_Expanded);
1819 image =
GetImage (wxTreeItemIcon_Selected);
1821 image =
GetImage (wxTreeItemIcon_Normal);
1859 m_hilightBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHT), wxBRUSHSTYLE_SOLID);
1860 m_hilightUnfocusedBrush =
new wxBrush (wxSystemSettings::GetColour (wxSYS_COLOUR_BTNSHADOW), wxBRUSHSTYLE_SOLID);
1862 m_imageListNormal = (wxImageList *) NULL;
1863 m_imageListButtons = (wxImageList *) NULL;
1864 m_imageListState = (wxImageList *) NULL;
1865 m_ownsImageListNormal = m_ownsImageListButtons =
1866 m_ownsImageListState =
false;
1868 m_imgWidth = 0, m_imgWidth2 = 0;
1869 m_imgHeight = 0, m_imgHeight2 = 0;
1870 m_btnWidth = 0, m_btnWidth2 = 0;
1871 m_btnHeight = 0, m_btnHeight2 = 0;
1873 m_isDragStarted = m_isDragging =
false;
1878 m_editControl = NULL;
1880 m_lastOnSame =
false;
1881 m_left_down_selection =
false;
1883 m_findTimer =
new wxTimer (
this, -1);
1885 #if defined( __WXMAC__ ) && defined(__WXMAC_CARBON__)
1886 m_normalFont.MacCreateThemeFont (kThemeViewsFont);
1888 m_normalFont = wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT);
1890 m_boldFont = wxFont( m_normalFont.GetPointSize(),
1891 m_normalFont.GetFamily(),
1892 m_normalFont.GetStyle(),
1894 m_normalFont.GetUnderlined(),
1895 m_normalFont.GetFaceName(),
1896 m_normalFont.GetEncoding());
1899 m_isItemToolTip =
false;
1907 const wxValidator &validator,
1908 const wxString& name) {
1910 wxScrolledWindow::Create (parent,
id, pos, size, style|wxHSCROLL|wxVSCROLL, name);
1912 #if wxUSE_VALIDATORS
1913 SetValidator(validator);
1918 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
1920 m_dottedPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 0, wxPENSTYLE_DOT);
1995 wxCHECK_MSG (item.IsOk(), 0u, _T(
"invalid tree item"));
2001 if ((styles ^ m_windowStyle) & wxTR_MULTIPLE) {
UnselectAll(); }
2005 m_windowStyle = styles;
2016 m_toolTip = (tip == NULL) ? wxString() : tip->GetTip();
2021 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2033 wxCHECK_MSG (item.IsOk(), -1, _T(
"invalid tree item"));
2034 return ((
wxTreeListItem*) item.m_pItem)->GetImage (column, which);
2038 wxCHECK_MSG (item.IsOk(), NULL, _T(
"invalid tree item"));
2042 wxCHECK_MSG (item.IsOk(), NULL, _T(
"invalid tree item"));
2047 wxCHECK_MSG(item.IsOk(),
false, _T(
"invalid tree item"));
2051 wxCHECK_MSG(item.IsOk(),
false, _T(
"invalid tree item"));
2056 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2059 if (attr && attr->HasTextColour()) {
2060 return attr->GetTextColour();
2062 return GetForegroundColour();
2066 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2069 if (attr && attr->HasTextColour()) {
2070 return attr->GetTextColour();
2077 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2080 if (attr && attr->HasBackgroundColour()) {
2081 return attr->GetBackgroundColour();
2083 return GetBackgroundColour();
2087 wxCHECK_MSG (item.IsOk(), wxNullColour, _T(
"invalid tree item"));
2090 if (attr && attr->HasBackgroundColour()) {
2091 return attr->GetBackgroundColour();
2098 wxCHECK_MSG (item.IsOk(), wxNullFont, _T(
"invalid tree item"));
2101 if (attr && attr->HasFont()) {
2102 return attr->GetFont();
2103 }
else if (pItem->IsBold()) {
2110 wxCHECK_MSG (item.IsOk(), wxNullFont, _T(
"invalid tree item"));
2113 wxItemAttr *attr_row = pItem->GetAttributes();
2114 if (attr_cell && attr_cell->HasFont()) {
2115 return attr_cell->GetFont();
2116 }
else if (attr_row && attr_row->HasFont()) {
2117 return attr_row->GetFont();
2118 }
else if (pItem->IsBold(column)) {
2126 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2133 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2135 if(pItem->GetImage(column, which) != image)
2137 pItem->
SetImage (column, image, which);
2148 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2152 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2157 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2159 if (pItem->IsBold() != bold) {
2165 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2168 pItem->
SetBold (column, bold);
2174 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2176 pItem->
Attr().SetTextColour (colour);
2180 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2182 pItem->
Attr(column).SetTextColour (colour);
2187 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2189 pItem->
Attr().SetBackgroundColour (colour);
2193 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2195 pItem->
Attr(column).SetBackgroundColour (colour);
2200 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2202 pItem->
Attr().SetFont (font);
2206 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2208 pItem->
Attr(column).SetFont (font);
2214 wxScrolledWindow::SetFont (font);
2232 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2238 if (parent ==
m_rootItem && HasFlag(wxTR_HIDE_ROOT))
break;
2245 wxSize clientSize = GetClientSize();
2248 ((!fullRow && rect.GetWidth() == 0) || rect.GetHeight() == 0) ||
2249 (rect.GetTop() < 0 || rect.GetBottom() >= clientSize.y) ||
2250 (!fullRow && (rect.GetLeft() < 0 || rect.GetRight() >= clientSize.x)))
return false;
2257 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"));
2278 wxCHECK_MSG (item.IsOk(),
false, _T(
"invalid tree item"));
2287 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2292 wxTreeItemIdValue& cookie)
const {
2293 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2294 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2296 return (!children.IsEmpty())? wxTreeItemId(children.Item(0)): 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 return ((*pIndex)+1 < (long)children.Count())? wxTreeItemId(children.Item(++(*pIndex))): wxTreeItemId();
2309 wxTreeItemIdValue& cookie)
const {
2310 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2311 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2313 long *pIndex = (
long*)&cookie;
2314 return ((*pIndex)-1 >= 0)? wxTreeItemId(children.Item(--(*pIndex))): wxTreeItemId();
2318 wxTreeItemIdValue& cookie)
const {
2319 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2320 wxArrayTreeListItems& children = ((
wxTreeListItem*) item.m_pItem)->GetChildren();
2322 long *pIndex = ((
long*)&cookie);
2323 (*pIndex) = (long)children.Count();
2324 return (!children.IsEmpty())? wxTreeItemId(children.Last()): wxTreeItemId();
2328 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2333 if (!parent)
return wxTreeItemId();
2336 wxArrayTreeListItems& siblings = parent->GetChildren();
2337 size_t index = siblings.Index (i);
2338 wxASSERT (index != (
size_t)wxNOT_FOUND);
2339 return (index < siblings.Count()-1)? wxTreeItemId(siblings[index+1]): wxTreeItemId();
2343 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2348 if (!parent)
return wxTreeItemId();
2351 wxArrayTreeListItems& siblings = parent->GetChildren();
2352 size_t index = siblings.Index(i);
2353 wxASSERT (index != (
size_t)wxNOT_FOUND);
2354 return (index >= 1)? wxTreeItemId(siblings[index-1]): wxTreeItemId();
2359 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2363 wxArrayTreeListItems& children = ((
wxTreeListItem*)item.m_pItem)->GetChildren();
2364 if (children.GetCount() > 0)
return children.Item (0);
2369 wxTreeItemId parent = item;
2373 }
while (!next.IsOk() && parent.IsOk());
2379 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2386 while (fulltree || ((
wxTreeListItem*)prev.m_pItem)->IsExpanded()) {
2387 wxArrayTreeListItems& children = ((
wxTreeListItem*)prev.m_pItem)->GetChildren();
2388 if (children.GetCount() == 0)
break;
2389 prev = children.Item (children.GetCount() - 1);
2400 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2405 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2418 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2419 wxTreeItemId
id =
GetNext (item,
false);
2421 if (
IsVisible (
id, fullRow, within))
return id;
2424 return wxTreeItemId();
2428 wxCHECK_MSG (
GetRootItem().IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2430 wxTreeItemId res = id;
2431 while ((
id =
GetNext (
id,
false)).IsOk()) {
2432 if (
IsVisible (
id, fullRow, within)) res = id;
2438 wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(
"invalid tree item"));
2439 wxTreeItemId
id =
GetPrev (item,
true);
2441 if (
IsVisible (
id, fullRow, within))
return id;
2444 return wxTreeItemId();
2455 const wxString& text,
2456 int image,
int selImage,
2457 wxTreeItemData *
data) {
2459 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2464 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2470 parent->
Insert (item, previous);
2476 int image,
int selImage,
2477 wxTreeItemData *
data) {
2478 wxCHECK_MSG(!
m_rootItem, wxTreeItemId(), _T(
"tree can have only one root"));
2479 wxCHECK_MSG(
GetColumnCount(), wxTreeItemId(), _T(
"Add column(s) before adding the root item"));
2484 for (
int i = 0; i < (int)
GetColumnCount(); ++i) arr.Add (wxEmptyString);
2490 if (HasFlag(wxTR_HIDE_ROOT)) {
2494 wxTreeItemIdValue cookie = 0;
2501 const wxString& text,
2502 int image,
int selImage,
2503 wxTreeItemData *
data) {
2504 return DoInsertItem (parent, 0u, text, image, selImage, data);
2508 const wxTreeItemId& idPrevious,
2509 const wxString& text,
2510 int image,
int selImage,
2511 wxTreeItemData *
data) {
2513 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2516 wxASSERT_MSG( index != wxNOT_FOUND,
2517 _T(
"previous item in wxTreeListMainWindow::InsertItem() is not a sibling") );
2519 return DoInsertItem (parentId, ++index, text, image, selImage, data);
2524 const wxString& text,
2525 int image,
int selImage,
2526 wxTreeItemData *
data) {
2528 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2530 return DoInsertItem (parentId, before, text, image, selImage, data);
2534 const wxString& text,
2535 int image,
int selImage,
2536 wxTreeItemData *
data) {
2538 wxCHECK_MSG (parent, wxTreeItemId(), _T(
"item must have a parent, at least root!") );
2547 if (! itemId.IsOk())
return;
2550 wxCHECK_RET (item !=
m_rootItem, _T(
"invalid item, root may not be deleted this way!"));
2558 parent->GetChildren().Remove (item);
2577 if (! itemId.IsOk())
return;
2582 wxArrayTreeListItems& children = item->
GetChildren();
2583 for (
size_t n = children.GetCount(); n>0; n--) {
2587 children.RemoveAt(n-1);
2593 wxCHECK_RET (item, _T(
"invalid item for delete!"));
2605 if (HasCapture()) ReleaseMouse();
2615 size_t index = siblings.Index (item);
2616 wxASSERT (index != (
size_t)wxNOT_FOUND);
2630 wxArrayTreeListItems& children = item->
GetChildren();
2631 for (
size_t n = children.GetCount(); n>0; n--) {
2635 children.RemoveAt(n-1);
2644 SendEvent(wxEVT_COMMAND_TREE_DELETE_ITEM, item);
2654 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::SetItemParent") );
2655 wxCHECK_RET (parent_new, _T(
"invalid parent in wxTreeListMainWindow::SetItemParent") );
2656 wxCHECK_RET (item !=
m_rootItem, _T(
"invalid root as item in wxTreeListMainWindow::SetItemParent!") );
2662 parent_new->Insert(item, parent_new->
GetChildren().Count());
2665 if (parent_new->GetChildren().Count() == 1) parent_new->Expand();
2680 if (old_item != NULL && old_item != item) {
2690 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::Expand") );
2695 wxTreeEvent event(wxEVT_COMMAND_TREE_ITEM_EXPANDING, 0);
2697 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
2703 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_EXPANDED);
2708 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2712 wxTreeItemIdValue cookie;
2714 while (child.IsOk()) {
2722 wxCHECK_RET (item, _T(
"invalid item in wxTreeListMainWindow::Collapse") );
2727 wxTreeEvent event (wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 0 );
2729 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return;
2735 event.SetEventType (wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
2740 wxCHECK_RET (item.IsOk(), _T(
"invalid tree item"));
2747 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
2765 wxCHECK_RET (item, _T(
"invalid tree item"));
2774 wxArrayTreeListItems& children = item->
GetChildren();
2775 size_t count = children.Count();
2776 for (
size_t n = 0; n < count; ++n) {
2800 wxArrayTreeListItems& children = parent->
GetChildren();
2801 int index = children.Index(crt_item);
2802 wxASSERT (index != wxNOT_FOUND);
2806 size_t count = children.Count();
2807 for (
size_t n = (index+1); n < count; ++n) {
2820 if (crt_item==last_item)
return true;
2823 wxArrayTreeListItems& children = crt_item->
GetChildren();
2824 size_t count = children.Count();
2825 for (
size_t n = 0; n < count; ++n) {
2834 const wxTreeItemId& lastId,
2835 bool unselect_others) {
2840 wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
2843 if (
SendEvent(0, item, &event) && !event.IsAllowed())
return false;
2846 bool bUnselectedAll =
false;
2847 if (unselect_others) {
2848 if (HasFlag(wxTR_MULTIPLE)) {
2856 if (lastId.IsOk() && itemId.IsOk() && (itemId != lastId)) {
2876 }
else if (itemId.IsOk()) {
2881 if (unselect_others) {
2891 event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
2899 wxCHECK_RET (HasFlag(wxTR_MULTIPLE), _T(
"invalid tree style"));
2900 wxCHECK_RET (root.IsOk(), _T(
"no tree"));
2903 wxTreeEvent event (wxEVT_COMMAND_TREE_SEL_CHANGING, 0);
2908 wxTreeItemIdValue cookie = 0;
2916 event.SetEventType (wxEVT_COMMAND_TREE_SEL_CHANGED);
2921 wxArrayTreeItemIds &array)
const {
2922 if (item->
IsSelected()) array.Add (wxTreeItemId(item));
2925 wxArrayTreeListItems& children = item->
GetChildren();
2926 size_t count = children.GetCount();
2927 for (
size_t n = 0; n < count; ++n)
FillArray (children[n], array);
2935 return array.Count();
2939 if (!item.IsOk())
return;
2954 if (!item.IsOk())
return;
2962 int item_y = gitem->
GetY();
2965 GetScrollPixelsPerUnit (&xUnit, &yUnit);
2968 GetViewStart (&start_x, &start_y);
2973 GetClientSize (&client_w, &client_h);
2980 int x_pos = GetScrollPos( wxHORIZONTAL );
2982 if (item_y < start_y+3) {
2984 SetScrollbars (xUnit, yUnit, xUnit ? x/xUnit : 0, yUnit ? y/yUnit : 0, x_pos, yUnit ? item_y/yUnit : 0);
2987 item_y += yUnit + 2;
2988 SetScrollbars (xUnit, yUnit, xUnit ? x/xUnit : 0, yUnit ? y/yUnit : 0, x_pos, yUnit ? (item_y+
GetLineHeight(gitem)-client_h)/yUnit : 0 );
2997 wxCHECK_MSG (
s_treeBeingSorted, 0, _T(
"bug in wxTreeListMainWindow::SortChildren()") );
3013 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
3018 _T(
"wxTreeListMainWindow::SortChildren is not reentrant") );
3020 wxArrayTreeListItems& children = item->
GetChildren();
3021 if ( children.Count() > 1 ) {
3032 wxString searchText;
3035 searchText = itemText.Mid (0, pattern.Length());
3037 searchText = itemText;
3040 if (searchText.CmpNoCase (pattern) == 0)
return true;
3042 if (searchText.Cmp (pattern) == 0)
return true;
3050 wxTreeItemIdValue cookie = 0;
3051 wxTreeItemId next = item;
3055 int col, col_start, col_end;
3056 if (column >= 0) { col_start = col_end = column; }
3075 if (next.IsOk() && HasFlag(wxTR_HIDE_ROOT)) {
3080 if (! next.IsOk() || next == item)
return (wxTreeItemId*)NULL;
3082 for (col=col_start; col<=col_end; col++) {
3087 return (wxTreeItemId*)NULL;
3107 for (
int i = 0; i < n ; i++) {
3108 int width = 0, height = 0;
3119 for (
int i = 0; i < n ; i++) {
3120 int width = 0, height = 0;
3177 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3178 if (xUnit == 0) xUnit = GetCharWidth();
3183 int x_pos = GetScrollPos (wxHORIZONTAL);
3184 int y_pos = GetScrollPos (wxVERTICAL);
3186 if (x < GetClientSize().GetWidth()) x_pos = 0;
3187 SetScrollbars (xUnit, yUnit, x/xUnit, y/yUnit, x_pos, y_pos);
3189 SetScrollbars (0, 0, 0, 0);
3194 if (GetWindowStyleFlag() & wxTR_HAS_VARIABLE_ROW_HEIGHT) {
3206 wxColour colTextHilight = wxSystemSettings::GetColour (wxSYS_COLOUR_HIGHLIGHTTEXT);
3209 int off_h = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
3211 wxDCClipper clipper (dc, 0, item->
GetY(), total_w, total_h);
3221 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3222 dc.SetPen (*wxTRANSPARENT_PEN);
3223 if (HasFlag (wxTR_FULL_ROW_HIGHLIGHT)) {
3227 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3228 dc.SetPen (*wxBLACK_PEN);
3229 #endif // !__WXMAC__
3232 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3233 dc.SetPen (*wxTRANSPARENT_PEN);
3234 #endif // !__WXMAC__
3236 dc.SetTextForeground (colTextHilight);
3240 dc.SetPen (
m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
3243 dc.DrawRectangle (0, item->
GetY() + off_h, total_w, total_h - off_h);
3247 int text_extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0;
3253 if (col_w <= 0)
continue;
3254 wxDCClipper clipper (dc, x_colstart, item->
GetY(), col_w, total_h);
3280 int w = 0, text_w = 0;
3281 wxString text = item->
GetText(i);
3282 dc.GetTextExtent (text, &text_w, NULL);
3288 w = col_w - (image_w + text_w + off_w +
MARGIN);
3291 case wxALIGN_CENTER:
3292 w = (col_w - (image_w + text_w + off_w +
MARGIN))/2;
3296 int text_x = x + image_w;
3301 if ( ! HasFlag (wxTR_FULL_ROW_HIGHLIGHT)) {
3303 bool drawCursor =
false;
3304 #ifndef __WXMAC__ // don't draw rect outline if we already have the background color
3306 #endif // !__WXMAC__
3310 dc.SetPen (*wxTRANSPARENT_PEN);
3311 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3312 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
3314 dc.SetPen (drawCursor ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3316 dc.SetTextForeground (colTextHilight);
3317 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
3321 dc.SetPen (drawCursor && i !=
GetMainColumn() ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
3322 dc.SetBrush (wxBrush ( colBg, wxBRUSHSTYLE_SOLID));
3323 dc.SetTextForeground (colText);
3324 dc.DrawRectangle (x_colstart, item->
GetY() + off_h, col_w, total_h - off_h);
3327 dc.SetPen (*wxBLACK_PEN);
3328 dc.SetBackgroundMode (wxTRANSPARENT);
3329 dc.DrawRectangle (text_x, item->
GetY() + off_h, text_w, total_h - off_h);
3336 wxPen pen (wxSystemSettings::GetColour (wxSYS_COLOUR_3DLIGHT ), 1, wxPENSTYLE_SOLID);
3337 dc.SetPen ((GetBackgroundColour() == *wxWHITE)? pen: *wxWHITE_PEN);
3338 dc.DrawLine (x_colstart+col_w-1, item->
GetY(), x_colstart+col_w-1, item->
GetY()+total_h);
3341 dc.SetBackgroundMode (wxTRANSPARENT);
3345 int y = item->
GetY() + img_extraH;
3350 int text_y = item->
GetY() + text_extraH;
3351 dc.DrawText (text, (wxCoord)text_x, (wxCoord)text_y);
3353 x_colstart += col_w;
3362 int level,
int &y,
int x_maincol) {
3365 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0)) {
3366 wxArrayTreeListItems& children = item->
GetChildren();
3367 for (
size_t n = 0; n < children.Count(); n++) {
3368 PaintLevel (children[n], dc, 1, y, x_maincol);
3375 int x = x_maincol +
MARGIN;
3376 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
3382 if (HasFlag(wxTR_HIDE_ROOT)) {
3394 int y_mid = y_top + (h/2);
3397 int exposed_x = dc.LogicalToDeviceX(0);
3398 int exposed_y = dc.LogicalToDeviceY(y_top);
3400 if (IsExposed(exposed_x, exposed_y, 10000, h)) {
3402 if (HasFlag(wxTR_ROW_LINES)) {
3405 dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxPENSTYLE_SOLID));
3406 dc.DrawLine (0, y_top, total_width, y_top);
3407 dc.DrawLine (0, y_top+h, total_width, y_top+h);
3414 dc.SetBrush(*wxWHITE_BRUSH);
3420 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
3422 if (!HasFlag(wxTR_NO_LINES)) {
3427 if (x2 < (x_maincol + MARGIN)) x2 = x_maincol +
MARGIN;
3432 dc.DrawLine (x3, y_mid, x3 +
LINEATROOT, y_mid);
3434 dc.DrawLine (x2, y_mid, x3 +
LINEATROOT, y_mid);
3437 dc.DrawLine (x2, y_mid, x - m_indent/2, y_mid);
3446 int image = wxTreeItemIcon_Normal;
3447 if (item->
IsExpanded()) image = wxTreeItemIcon_Expanded;
3448 if (item->
IsSelected()) image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
3453 dc.DestroyClippingRegion();
3455 }
else if (HasFlag (wxTR_TWIST_BUTTONS)) {
3458 dc.SetPen(*wxBLACK_PEN);
3465 button[1].y = button[0].y;
3471 button[1].x = button[0].x;
3474 button[2].y = y_mid;
3476 dc.DrawPolygon(3, button);
3482 int flag = item->
IsExpanded()? wxCONTROL_EXPANDED: 0;
3483 wxRendererNative::Get().DrawTreeItemButton (
this, dc, rect, flag);
3491 dc.SetBrush(*wxWHITE_BRUSH);
3493 dc.SetTextForeground(*wxBLACK);
3497 wxArrayTreeListItems& children = item->
GetChildren();
3511 for (
size_t n = 0; n < children.Count(); ++n) {
3514 PaintLevel (children[n], dc, level+1, y, x_maincol);
3517 wxDCClipper clipper(dc, x_maincol, y_top, clip_width, 10000);
3518 if (!HasFlag (wxTR_NO_LINES)) {
3520 dc.DrawLine (x, oldY, x, y2);
3535 wxAutoBufferedPaintDC dc (
this);
3536 wxBrush brush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID);
3537 dc.SetBackground(brush);
3599 wxTreeEvent nevent (wxEVT_COMMAND_TREE_KEY_DOWN, 0 );
3601 nevent.SetKeyEvent (event);
3603 nevent.SetExtraLong(event.GetModifiers());
3604 if (
SendEvent(0, NULL, &nevent))
return;
3607 bool curItemSet =
false;
3611 if (HasFlag(wxTR_HIDE_ROOT)) {
3612 wxTreeItemIdValue cookie = 0;
3620 if (HasFlag(wxTR_MULTIPLE) && event.ShiftDown()) {
3626 if (curItemSet)
return;
3629 wxTreeItemId newItem = (wxTreeItemId*)NULL;
3630 switch (event.GetKeyCode()) {
3640 case WXK_SUBTRACT: {
3646 case WXK_MULTIPLY: {
3673 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3687 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1,1));
3694 if (abs_p.y < 0) abs_p.y = 0;
3704 wxTreeItemIdValue cookie = 0;
3710 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3711 newItem = (wxTreeItemId*)NULL;
3722 if ((newItem ==
GetRootItem()) && HasFlag(wxTR_HIDE_ROOT)) {
3734 wxTreeItemIdValue cookie = 0;
3743 wxTreeItemIdValue cookie = 0;
3751 }
while (!newItem && parent);
3756 case WXK_PAGEDOWN: {
3759 wxPoint abs_p = CalcUnscrolledPosition (wxPoint(1,GetClientSize().GetHeight() -
m_curItem->
GetHeight()));
3780 wxChar key =
event.GetUnicodeKey();
3781 if (key == WXK_NONE) key = (wxChar)event.GetKeyCode();
3788 wxTreeItemId prev = (wxTreeItemId*)NULL;
3805 prev = (wxTreeItemId*)NULL;
3817 if (!event.ControlDown()) {
3818 bool unselect_others = !((
event.ShiftDown() ||
event.ControlDown()) &&
3819 HasFlag(wxTR_MULTIPLE));
3836 if (point.x<0) flags |= wxTREE_HITTEST_TOLEFT;
3837 if (point.x>w) flags |= wxTREE_HITTEST_TORIGHT;
3838 if (point.y<0) flags |= wxTREE_HITTEST_ABOVE;
3839 if (point.y>h) flags |= wxTREE_HITTEST_BELOW;
3840 if (flags)
return wxTreeItemId();
3843 flags = wxTREE_HITTEST_NOWHERE;
3845 return wxTreeItemId();
3849 this, flags, column, 0);
3851 flags = wxTREE_HITTEST_NOWHERE;
3853 return wxTreeItemId();
3860 bool WXUNUSED(textOnly))
const {
3861 wxCHECK_MSG (itemId.IsOk(),
false, _T(
"invalid item in wxTreeListMainWindow::GetBoundingRect") );
3866 GetScrollPixelsPerUnit (&xUnit, &yUnit);
3868 GetViewStart(& startX, & startY);
3870 rect.x = item->GetX() - startX * xUnit;
3871 rect.y = item->GetY() - startY * yUnit;
3872 rect.width = item->GetWidth();
3883 if (!item.IsOk())
return;
3892 wxTreeEvent te( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 0 );
3912 for (
int i = 0; i < column; ++i) {
3920 case wxALIGN_LEFT: {style = wxTE_LEFT; x -= 1;
break;}
3921 case wxALIGN_CENTER: {style = wxTE_CENTER; x -= 1;
break;}
3922 case wxALIGN_RIGHT: {style = wxTE_RIGHT; x += 0;
break;}
3931 x = dc.LogicalToDeviceX (x);
3932 y = dc.LogicalToDeviceY (y);
3938 wxPoint (x, y), wxSize (w, h), style);
3950 wxTreeEvent le( wxEVT_COMMAND_TREE_END_LABEL_EDIT, 0 );
3952 le.SetEditCanceled(isCancelled);
3965 bool mayDrag =
true;
3966 bool maySelect =
true;
3967 bool mayClick =
true;
3968 bool mayDoubleClick =
true;
3972 if (
m_owner->GetEventHandler()->ProcessEvent(event))
return;
3983 wxPoint p = wxPoint (event.GetX(),
event.GetY());
3987 bool bCrosshair = (item && item->
HasPlus() && (flags & wxTREE_HITTEST_ONITEMBUTTON));
3990 maySelect = mayDoubleClick =
false;
3993 if (event.Dragging()) {
3994 maySelect = mayDoubleClick = mayClick =
false;
3999 if (event.LeftDown()) maySelect =
false;
4001 mayDoubleClick =
false;
4004 if (mayDoubleClick) mayDoubleClick = mayClick;
4006 if (maySelect) maySelect = mayClick;
4011 if (HasFlag(wxTR_MULTIPLE)) {
4015 if (event.ControlDown() ||
event.ShiftDown()) {
4016 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4022 }
else if ((item != NULL && item->
IsSelected())) {
4023 maySelect = maySelect &&
event.LeftUp();
4028 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4033 maySelect = maySelect && (
event.LeftDown() ||
event.RightDown());
4041 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown())
SetFocus();
4049 wxScrolledWindow::SetToolTip(
m_toolTip);
4058 wxScrolledWindow::SetToolTip(*tip);
4064 wxScrolledWindow::SetToolTip(wxString());
4069 wxScrolledWindow::SetToolTip(
m_toolTip);
4082 if (bCrosshair && event.LeftDown()) {
4095 if (event.LeftDown() && HasFlag(wxTR_MULTIPLE) &&
event.ShiftDown()) {
4103 bool unselect_others = ! (HasFlag(wxTR_MULTIPLE) && (
4105 ||
event.ControlDown()
4117 if (event.MiddleDown()) {
4119 wxTreeEvent nevent(0, 0);
4123 SendEvent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, item, &nevent);
4125 if (event.RightDown()) {
4127 wxTreeEvent nevent(0, 0);
4131 SendEvent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, item, &nevent);
4133 if (event.RightUp()) {
4135 wxTreeEvent nevent(0, 0);
4138 SendEvent(wxEVT_COMMAND_TREE_ITEM_MENU, item, &nevent);
4156 if (mayDoubleClick && event.LeftDClick()) {
4165 if (
SelectItem(item, (wxTreeItemId*)NULL,
true)) {
4168 if (!
SendEvent(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, item)) {
4187 if (event.LeftDown() ||
event.MiddleDown() ||
event.RightDown()) {
4193 if (HasCapture()) ReleaseMouse();
4197 }
else if (event.Dragging()) {
4208 if (HasCapture()) ReleaseMouse();
4213 wxTreeEvent nevent(0, 0);
4216 SendEvent(wxEVT_COMMAND_TREE_END_DRAG, item, &nevent);
4220 }
else if (event.Dragging()) {
4224 const int tolerance = 3;
4227 if (dx <= tolerance && dy <= tolerance)
4245 wxTreeEvent nevent(0, 0);
4250 ? wxEVT_COMMAND_TREE_BEGIN_DRAG
4251 : wxEVT_COMMAND_TREE_BEGIN_RDRAG,
4257 if (bSkip)
event.Skip();
4277 if (
m_owner->GetEventHandler()->ProcessEvent(event))
return;
4280 HandleOnScroll( event );
4282 if(event.GetOrientation() == wxHORIZONTAL) {
4304 max_h += max_h / 10;
4314 int level,
int &y,
int x_colstart) {
4317 int x = x_colstart +
MARGIN;
4318 if (HasFlag(wxTR_LINES_AT_ROOT)) x +=
LINEATROOT;
4324 if (HasFlag(wxTR_HIDE_ROOT)) {
4331 if (HasFlag(wxTR_HIDE_ROOT) && (level == 0))
goto Recurse;
4344 wxArrayTreeListItems& children = item->
GetChildren();
4345 long n, count = (long)children.Count();
4347 for (n = 0; n < count; ++n) {
4381 GetVirtualSize( &cw, &ch );
4384 rect.x = dc.LogicalToDeviceX( 0 );
4386 rect.y = dc.LogicalToDeviceY( item->
GetY() - 2 );
4389 Refresh (
true, &rect );
4401 GetVirtualSize( &cw, &ch );
4404 rect.x = dc.LogicalToDeviceX( 0 );
4405 rect.y = dc.LogicalToDeviceY( item->
GetY() );
4409 Refresh (
true, &rect);
4425 const wxArrayTreeListItems& children = item->
GetChildren();
4426 long count = (long)children.GetCount();
4427 for (
long n = 0; n < count; n++ ) {
4437 if (!wxWindow::SetBackgroundColour(colour))
return false;
4444 if (!wxWindow::SetForegroundColour(colour))
return false;
4451 wxCHECK_RET (itemId.IsOk(), _T(
"invalid tree item"));
4453 if (this->IsFrozen())
4470 wxCHECK_MSG (itemId.IsOk(), _T(
""), _T(
"invalid tree item") );
4473 else return ((
wxTreeListItem*) itemId.m_pItem)->GetText (column);
4477 wxASSERT_MSG(
IsVirtual(), _T(
"can be used only with virtual control") );
4482 wxWindow::SetFocus();
4487 if (!item)
return 0;
4492 GetTextExtent (item->
GetText (column), &w, &
h, NULL, NULL, font.Ok()? &font: NULL);
4496 int width = w + 2*
MARGIN;
4499 if (HasFlag(wxTR_LINES_AT_ROOT)) width +=
LINEATROOT;
4507 while (parent && (!HasFlag(wxTR_HIDE_ROOT) || (parent != root))) {
4511 if (level) width += level *
GetIndent();
4519 GetClientSize (&maxWidth, &h);
4526 if (!HasFlag(wxTR_HIDE_ROOT)) {
4528 if (width < w) width = w;
4529 if (width > maxWidth)
return maxWidth;
4532 wxTreeItemIdValue cookie = 0;
4534 while (item.IsOk()) {
4536 if (width < w) width = w;
4537 if (width > maxWidth)
return maxWidth;
4542 if (width < w) width = w;
4543 if (width > maxWidth)
return maxWidth;
4555 wxTreeEvent nevent (event_type, 0);
4557 if (event == NULL) {
4560 }
else if (event_type) {
4561 event->SetEventType(event_type);
4564 event->SetEventObject (
m_owner);
4565 event->SetId(
m_owner->GetId());
4567 event->SetItem (item);
4570 return m_owner->GetEventHandler()->ProcessEvent (*event);
4593 long style,
const wxValidator &validator,
4594 const wxString& name)
4596 long main_style = style & ~(wxBORDER_SIMPLE | wxBORDER_SUNKEN | wxBORDER_DOUBLE |
4597 wxBORDER_RAISED | wxBORDER_STATIC);
4598 main_style |= wxWANTS_CHARS ;
4599 long ctrl_style = style & ~(wxVSCROLL|wxHSCROLL);
4601 if (!wxControl::Create(parent,
id, pos, size, ctrl_style, validator, name)) {
4605 main_style, validator);
4607 wxPoint(0, 0), wxDefaultSize,
4621 h = (int)(wxRendererNative::Get().GetHeaderButtonHeight(
m_header_win) * 0.8) + 2;
4623 h = wxRendererNative::Get().GetHeaderButtonHeight(
m_header_win);
4637 GetClientSize(&w, &h);
4786 long main_style = style & ~(wxBORDER_SIMPLE | wxBORDER_SUNKEN | wxBORDER_DOUBLE | wxBORDER_RAISED | wxBORDER_STATIC);
4787 main_style |= wxWANTS_CHARS;
4790 m_windowStyle = style & ~(wxVSCROLL | wxHSCROLL);
4796 long style = m_windowStyle;
4830 wxTreeItemIdValue& cookie)
const
4834 wxTreeItemIdValue& cookie)
const
4838 wxTreeItemIdValue& cookie)
const
4842 wxTreeItemIdValue& cookie)
const
4882 int selectedImage, wxTreeItemData*
data)
4886 const wxString& text,
int image,
4888 wxTreeItemData*
data)
4892 const wxTreeItemId& previous,
4893 const wxString& text,
int image,
4895 wxTreeItemData*
data)
4898 selectedImage, data);
4903 const wxString& text,
int image,
4905 wxTreeItemData*
data)
4908 selectedImage, data);
4912 const wxString& text,
int image,
4914 wxTreeItemData*
data)
4948 bool unselect_others)
4967 bool textOnly)
const
5084 wxASSERT_MSG (column !=
GetMainColumn(), _T(
"The main column may not be hidden") );
5122 wxSize bestSizeMain =
m_main_win->GetBestSize();
5123 return wxSize (bestSizeHeader.x > bestSizeMain.x ? bestSizeHeader.x : bestSizeMain.x, bestSizeHeader.y + bestSizeMain.y);
5128 return wxEmptyString;
5160 wxTreeListCtrlXmlHandler::wxTreeListCtrlXmlHandler() : wxXmlResourceHandler() {
5162 #define wxTR_NO_BUTTONS 0x0000 // for convenience
5163 #define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
5164 #define wxTR_NO_LINES 0x0004 // don't draw lines at all
5165 #define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
5166 #define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl
5168 #define wxTR_SINGLE 0x0000 // for convenience
5169 #define wxTR_MULTIPLE 0x0020 // can select multiple items
5170 #define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
5171 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
5173 #define wxTR_EDIT_LABELS 0x0200 // can edit item labels
5174 #define wxTR_ROW_LINES 0x0400 // put border around items
5175 #define wxTR_HIDE_ROOT 0x0800 // don't display root node
5177 #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
5180 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES)
5182 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
5186 XRC_ADD_STYLE(wxTR_NO_BUTTONS);
5187 XRC_ADD_STYLE(wxTR_HAS_BUTTONS);
5188 XRC_ADD_STYLE(wxTR_NO_LINES);
5189 XRC_ADD_STYLE(wxTR_LINES_AT_ROOT);
5190 XRC_ADD_STYLE(wxTR_TWIST_BUTTONS);
5192 XRC_ADD_STYLE(wxTR_SINGLE);
5193 XRC_ADD_STYLE(wxTR_MULTIPLE);
5194 #if WXWIN_COMPATIBILITY_2_8
5196 XRC_ADD_STYLE(wxTR_EXTENDED);
5197 #endif // WXWIN_COMPATIBILITY_2_8
5198 XRC_ADD_STYLE(wxTR_HAS_VARIABLE_ROW_HEIGHT);
5200 XRC_ADD_STYLE(wxTR_EDIT_LABELS);
5201 XRC_ADD_STYLE(wxTR_ROW_LINES);
5202 XRC_ADD_STYLE(wxTR_HIDE_ROOT);
5204 XRC_ADD_STYLE(wxTR_FULL_ROW_HIGHLIGHT);
5206 XRC_ADD_STYLE(wxTR_DEFAULT_STYLE);
5216 wxObject *wxTreeListCtrlXmlHandler::DoCreateResource() {
5217 XRC_MAKE_INSTANCE(tlc, wxTreeListCtrl);
5218 tlc->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(), wxDefaultValidator, GetName());
5223 bool wxTreeListCtrlXmlHandler::CanHandle(wxXmlNode * node) {
5224 return IsOfClass(node,
"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)
void CalculateSize(wxTreeListItem *item, wxReadOnlyDC &dc)
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)
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
void CalculateLevel(wxTreeListItem *item, wxReadOnlyDC &dc, int level, int &y, int x_maincol)
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 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)