17#if defined(__GNUG__) && !defined(__APPLE__)
18 #pragma interface "treelistctrl.h"
21#include <wx/treectrl.h>
22#include <wx/control.h>
24#include <wx/listctrl.h>
26 #include "wx/xrc/xmlres.h"
30#if wxCHECK_VERSION(2,9,0)
38#define wxTR_COLUMN_LINES 0x1000
39#define wxTR_VIRTUAL 0x4000
43#if !wxCHECK_VERSION(2, 5, 0)
44typedef long wxTreeItemIdValue;
63 int flag = wxALIGN_LEFT,
71 m_selected_image = -1;
89 wxString
GetText()
const {
return m_text; }
92 int GetWidth()
const {
return m_shown ? m_width : 0; }
106 { m_edit = edit;
return *
this; }
151 : m_header_win(0), m_main_win(0), m_headerHeight(0)
155 const wxPoint& pos = wxDefaultPosition,
156 const wxSize& size = wxDefaultSize,
157 long style = wxTR_DEFAULT_STYLE,
158 const wxValidator &validator = wxDefaultValidator,
160 : m_header_win(0), m_main_win(0), m_headerHeight(0)
162 Create(parent,
id, pos, size, style, validator,
name);
167 bool Create(wxWindow *parent, wxWindowID
id = -1,
168 const wxPoint& pos = wxDefaultPosition,
169 const wxSize& size = wxDefaultSize,
170 long style = wxTR_DEFAULT_STYLE,
171 const wxValidator &validator = wxDefaultValidator,
174 void Refresh(
bool erase=
TRUE,
const wxRect* rect=NULL);
181 size_t GetCount()
const;
186 unsigned int GetIndent()
const;
187 void SetIndent(
unsigned int indent);
190 unsigned int GetLineSpacing()
const;
191 void SetLineSpacing(
unsigned int spacing);
205 wxImageList *GetImageList()
const;
206 wxImageList *GetStateImageList()
const;
207 wxImageList *GetButtonsImageList()
const;
209 void SetImageList(wxImageList *imageList);
210 void SetStateImageList(wxImageList *imageList);
211 void SetButtonsImageList(wxImageList *imageList);
212 void AssignImageList(wxImageList *imageList);
213 void AssignStateImageList(wxImageList *imageList);
214 void AssignButtonsImageList(wxImageList *imageList);
218 void SetItemToolTip(
const wxTreeItemId& item,
const wxString &tip);
225 int flag = wxALIGN_LEFT,
235 const wxString& text,
237 int flag = wxALIGN_LEFT,
241 InsertColumn (before,
247 void RemoveColumn (
int column);
250 int GetColumnCount()
const;
253 void SetMainColumn (
int column);
254 int GetMainColumn()
const;
260 void SetColumnText (
int column,
const wxString& text);
261 wxString GetColumnText (
int column)
const;
263 void SetColumnWidth (
int column,
int width);
264 int GetColumnWidth (
int column)
const;
266 void SetColumnAlignment (
int column,
int flag);
267 int GetColumnAlignment (
int column)
const;
269 void SetColumnImage (
int column,
int image);
270 int GetColumnImage (
int column)
const;
272 void SetColumnShown (
int column,
bool shown =
true);
273 bool IsColumnShown (
int column)
const;
275 void SetColumnEditable (
int column,
bool edit =
true);
276 bool IsColumnEditable (
int column)
const;
284 wxString GetItemText (
const wxTreeItemId& item,
int column)
const;
286 int GetItemImage (
const wxTreeItemId& item, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const;
287 int GetItemImage (
const wxTreeItemId& item,
int column)
const;
289 wxTreeItemData *GetItemData (
const wxTreeItemId& item)
const;
290 wxTreeItemData *GetItemData (
const wxTreeItemId& item,
int column)
const;
292 bool GetItemBold (
const wxTreeItemId& item)
const;
293 bool GetItemBold (
const wxTreeItemId& item,
int column)
const;
295 wxColour GetItemTextColour (
const wxTreeItemId& item)
const;
296 wxColour GetItemTextColour (
const wxTreeItemId& item,
int column)
const;
298 wxColour GetItemBackgroundColour (
const wxTreeItemId& item)
const;
299 wxColour GetItemBackgroundColour (
const wxTreeItemId& item,
int column)
const;
301 wxFont GetItemFont (
const wxTreeItemId& item)
const;
302 wxFont GetItemFont (
const wxTreeItemId& item,
int column)
const;
307 void SetItemText (
const wxTreeItemId& item,
const wxString& text);
308 void SetItemText (
const wxTreeItemId& item,
int column,
const wxString& text);
311 void SetItemImage (
const wxTreeItemId& item,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
312 void SetItemImage (
const wxTreeItemId& item,
int column,
int image);
314 void SetItemData (
const wxTreeItemId& item, wxTreeItemData *data);
315 void SetItemData (
const wxTreeItemId& item,
int column, wxTreeItemData *data);
317 void SetItemBold (
const wxTreeItemId& item,
bool bold =
true);
318 void SetItemBold (
const wxTreeItemId& item,
int column,
bool bold =
true);
320 void SetItemTextColour (
const wxTreeItemId& item,
const wxColour& colour);
321 void SetItemTextColour (
const wxTreeItemId& item,
int column,
const wxColour& colour);
323 void SetItemBackgroundColour (
const wxTreeItemId& item,
const wxColour& colour);
324 void SetItemBackgroundColour (
const wxTreeItemId& item,
int column,
const wxColour& colour);
327 void SetItemFont (
const wxTreeItemId& item,
const wxFont& font);
328 void SetItemFont (
const wxTreeItemId& item,
int column,
const wxFont& font);
334 void SetItemHasChildren(
const wxTreeItemId& item,
bool has =
true);
340 bool IsVisible (
const wxTreeItemId& item,
bool fullRow =
false,
bool within =
true)
const;
344 bool IsExpanded (
const wxTreeItemId& item)
const;
346 bool IsSelected (
const wxTreeItemId& item)
const;
348 bool IsBold (
const wxTreeItemId& item)
const {
return IsBold(item, GetMainColumn()); };
349 bool IsBold (
const wxTreeItemId& item,
int column)
const {
return GetItemBold(item, column); };
354 virtual bool SetFont (
const wxFont &font );
357 void SetWindowStyle (
const long styles);
358 long GetWindowStyle()
const;
366 size_t GetChildrenCount (
const wxTreeItemId& item,
bool recursively =
true);
374 wxTreeItemId GetRootItem()
const;
377 wxTreeItemId GetSelection()
const;
380 size_t GetSelections (wxArrayTreeItemIds&)
const;
393#if !wxCHECK_VERSION(2, 5, 0)
394 wxTreeItemId GetFirstChild(
const wxTreeItemId& item,
long& cookie)
const;
395 wxTreeItemId GetNextChild(
const wxTreeItemId& item,
long& cookie)
const;
396 wxTreeItemId GetPrevChild(
const wxTreeItemId& item,
long& cookie)
const;
397 wxTreeItemId GetLastChild(
const wxTreeItemId& item,
long& cookie)
const;
399 wxTreeItemId GetFirstChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
400 wxTreeItemId GetNextChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
401 wxTreeItemId GetPrevChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
402 wxTreeItemId GetLastChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
406 wxTreeItemId GetNextSibling(
const wxTreeItemId& item)
const;
407 wxTreeItemId GetPrevSibling(
const wxTreeItemId& item)
const;
410 wxTreeItemId GetNext(
const wxTreeItemId& item)
const;
411 wxTreeItemId GetPrev(
const wxTreeItemId& item)
const;
414 wxTreeItemId GetFirstExpandedItem()
const;
415 wxTreeItemId GetNextExpanded(
const wxTreeItemId& item)
const;
416 wxTreeItemId GetPrevExpanded(
const wxTreeItemId& item)
const;
419 wxTreeItemId GetFirstVisibleItem(
bool fullRow =
false)
const;
420 wxTreeItemId GetFirstVisible(
bool fullRow =
false,
bool within =
true)
const;
421 wxTreeItemId GetNextVisible (
const wxTreeItemId& item,
bool fullRow =
false,
bool within =
true)
const;
422 wxTreeItemId GetPrevVisible (
const wxTreeItemId& item,
bool fullRow =
false,
bool within =
true)
const;
423 wxTreeItemId GetLastVisible (
bool fullRow =
false,
bool within =
true)
const;
429 wxTreeItemId AddRoot (
const wxString& text,
430 int image = -1,
int selectedImage = -1,
431 wxTreeItemData *data = NULL);
434 wxTreeItemId PrependItem (
const wxTreeItemId& parent,
435 const wxString& text,
436 int image = -1,
int selectedImage = -1,
437 wxTreeItemData *data = NULL);
440 wxTreeItemId InsertItem (
const wxTreeItemId& parent,
441 const wxTreeItemId& idPrevious,
442 const wxString& text,
443 int image = -1,
int selectedImage = -1,
444 wxTreeItemData *data = NULL);
447 wxTreeItemId InsertItem (
const wxTreeItemId& parent,
449 const wxString& text,
450 int image = -1,
int selectedImage = -1,
451 wxTreeItemData *data = NULL);
454 wxTreeItemId AppendItem (
const wxTreeItemId& parent,
455 const wxString& text,
456 int image = -1,
int selectedImage = -1,
457 wxTreeItemData *data = NULL);
460 void Delete (
const wxTreeItemId& item);
467 void SetItemParent(
const wxTreeItemId& parent,
const wxTreeItemId& item);
470 void Expand (
const wxTreeItemId& item);
472 void ExpandAll (
const wxTreeItemId& item);
474 void Collapse (
const wxTreeItemId& item);
476 void CollapseAndReset(
const wxTreeItemId& item);
478 void Toggle (
const wxTreeItemId& item);
481 void SetCurrentItem(
const wxTreeItemId& item = (wxTreeItemId*)NULL);
487 bool SelectItem (
const wxTreeItemId& item,
488 const wxTreeItemId&
last = (wxTreeItemId*)NULL,
489 bool unselect_others =
true);
494 void EnsureVisible (
const wxTreeItemId& item);
496 void ScrollTo (
const wxTreeItemId& item);
501 {
int flags;
int column;
return HitTest (point, flags, column); }
502 wxTreeItemId
HitTest (
const wxPoint& point,
int& flags)
503 {
int column;
return HitTest (point, flags, column); }
504 wxTreeItemId
HitTest (
const wxPoint& point,
int& flags,
int& column);
507 bool GetBoundingRect (
const wxTreeItemId& item, wxRect& rect,
508 bool textOnly =
false)
const;
514 { EditLabel (item, GetMainColumn()); }
516 void EditLabel (
const wxTreeItemId& item,
int column);
517 void EndEdit(
bool isCancelled);
520 virtual wxString OnGetItemText( wxTreeItemData* item,
long column )
const;
527 virtual int OnCompareItems (
const wxTreeItemId& item1,
const wxTreeItemId& item2);
528 virtual int OnCompareItems (
const wxTreeItemId& item1,
const wxTreeItemId& item2,
int column);
531 void SortChildren(
const wxTreeItemId& item,
int column = -1,
bool reverseOrder =
false);
534 wxTreeItemId
FindItem (
const wxTreeItemId& item,
const wxString& str,
int mode = 0) {
return FindItem(item, -1, str, mode); };
535 wxTreeItemId FindItem (
const wxTreeItemId& item,
int column,
const wxString& str,
int mode = 0);
538 virtual bool SetBackgroundColour (
const wxColour& colour);
539 virtual bool SetForegroundColour (
const wxColour& colour);
542 void SetDragItem (
const wxTreeItemId& item = (wxTreeItemId*)NULL);
545 virtual wxSize DoGetBestSize()
const;
550 {
return m_header_win; }
555 {
return m_main_win; }
560 void CalculateAndSetHeaderHeight();
561 void DoHeaderLayout();
562 void OnSize(wxSizeEvent& event);
567 DECLARE_EVENT_TABLE()
578class WXDLLIMPEXP_XRC wxTreeListCtrlXmlHandler :
public wxXmlResourceHandler {
579 DECLARE_DYNAMIC_CLASS(wxTreeListCtrlXmlHandler)
581 wxTreeListCtrlXmlHandler();
582 virtual wxObject *DoCreateResource();
583 virtual bool CanHandle(wxXmlNode *node);
588#if wxCHECK_VERSION(2,9,0)
wxTreeListColumnInfo & SetAlignment(int flag)
wxTreeListColumnInfo & SetWidth(int width)
int GetSelectedImage() const
wxTreeListColumnInfo(const wxTreeListColumnInfo &other)
wxTreeListColumnInfo & SetSelectedImage(int image)
wxTreeListColumnInfo & SetEditable(bool edit)
wxTreeListColumnInfo & SetImage(int image)
wxTreeListColumnInfo(const wxString &text=wxEmptyString, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false)
wxTreeListColumnInfo & SetText(const wxString &text)
wxTreeListColumnInfo & SetShown(bool shown)
void EditLabel(const wxTreeItemId &item)
void InsertColumn(int before, const wxString &text, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false)
wxTreeListMainWindow * GetMainWindow() const
wxTreeItemId HitTest(const wxPoint &point)
wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str, int mode=0)
int GetHeaderHeight() const
wxString GetItemText(const wxTreeItemId &item) const
wxTreeListHeaderWindow * GetHeaderWindow() const
wxTreeItemId HitTest(const wxPoint &point, int &flags)
void AddColumn(const wxString &text, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false)
bool IsBold(const wxTreeItemId &item, int column) const
virtual ~wxTreeListCtrl()
long GetWindowStyleFlag() const
wxTreeListMainWindow * m_main_win
wxTreeListCtrl(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 IsBold(const wxTreeItemId &item) const
void SetItemText(const wxTreeItemId &item, const wxString &text)
wxTreeListHeaderWindow * m_header_win
size_t GetChildrenCount(bool recursively=true) const
void SetItemParent(wxTreeListItem *parent)
wxTreeListItem * GetItemParent() const
wxTreeListItem * HitTest(const wxPoint &point, const wxTreeListMainWindow *, int &flags, int &column, int level)
void SetToolTip(const wxString &tip)
CONSTDATA date::last_spec last
const int wxTL_MODE_NAV_VISIBLE
const int wxTL_MODE_NAV_LEVEL
const int wxTL_MODE_FIND_EXACT
const int wxTL_MODE_FIND_NOCASE
const int wxTREE_HITTEST_ONITEMCOLUMN
const int wxTL_MODE_NAV_EXPANDED
const int wxTL_MODE_NAV_FULLTREE
WXDLLEXPORT const wxChar * wxTreeListCtrlNameStr
const int wxTL_MODE_FIND_PARTIAL