14 #ifndef TREELISTCTRL_H
15 #define TREELISTCTRL_H
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"
33 class wxTreeListHeaderWindow;
34 class wxTreeListMainWindow;
36 #define wxTR_COLUMN_LINES 0x1000 // put border around items
37 #define wxTR_VIRTUAL 0x4000 // The application provides items text on demand.
52 int flag = wxALIGN_LEFT,
56 const wxString &tooltip = wxEmptyString) {
98 {
m_edit = edit;
return *
this; }
151 const wxPoint& pos = wxDefaultPosition,
152 const wxSize& size = wxDefaultSize,
153 long style = wxTR_DEFAULT_STYLE,
154 const wxValidator &validator = wxDefaultValidator,
158 Create(parent,
id, pos, size, style, validator, name);
163 bool Create(wxWindow *parent, wxWindowID
id = -1,
164 const wxPoint& pos = wxDefaultPosition,
165 const wxSize& size = wxDefaultSize,
166 long style = wxTR_DEFAULT_STYLE,
167 const wxValidator &validator = wxDefaultValidator,
170 void Refresh(
bool erase=TRUE,
const wxRect* rect=NULL);
214 void SetItemToolTip(
const wxTreeItemId& item,
const wxString &tip);
221 int flag = wxALIGN_LEFT,
225 const wxString& tooltip = wxEmptyString) {
232 const wxString& text,
234 int flag = wxALIGN_LEFT,
238 const wxString& tooltip = wxEmptyString) {
282 wxString
GetItemText (
const wxTreeItemId& item,
int column)
const;
284 int GetItemImage (
const wxTreeItemId& item, wxTreeItemIcon which = wxTreeItemIcon_Normal)
const;
285 int GetItemImage (
const wxTreeItemId& item,
int column)
const;
287 wxTreeItemData *
GetItemData (
const wxTreeItemId& item)
const;
288 wxTreeItemData *
GetItemData (
const wxTreeItemId& item,
int column)
const;
291 bool GetItemBold (
const wxTreeItemId& item,
int column)
const;
299 wxFont
GetItemFont (
const wxTreeItemId& item)
const;
300 wxFont
GetItemFont (
const wxTreeItemId& item,
int column)
const;
305 void SetItemText (
const wxTreeItemId& item,
const wxString& text);
306 void SetItemText (
const wxTreeItemId& item,
int column,
const wxString& text);
309 void SetItemImage (
const wxTreeItemId& item,
int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
310 void SetItemImage (
const wxTreeItemId& item,
int column,
int image);
313 void SetItemData (
const wxTreeItemId& item,
int column, wxTreeItemData *
data);
315 void SetItemBold (
const wxTreeItemId& item,
bool bold =
true);
316 void SetItemBold (
const wxTreeItemId& item,
int column,
bool bold =
true);
319 void SetItemTextColour (
const wxTreeItemId& item,
int column,
const wxColour& colour);
325 void SetItemFont (
const wxTreeItemId& item,
const wxFont& font);
326 void SetItemFont (
const wxTreeItemId& item,
int column,
const wxFont& font);
338 bool IsVisible (
const wxTreeItemId& item,
bool fullRow =
false,
bool within =
true)
const;
342 bool IsExpanded (
const wxTreeItemId& item)
const;
344 bool IsSelected (
const wxTreeItemId& item)
const;
352 virtual bool SetFont (
const wxFont &font );
363 size_t GetChildrenCount (
const wxTreeItemId& item,
bool recursively =
true);
390 wxTreeItemId
GetFirstChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
391 wxTreeItemId
GetNextChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
392 wxTreeItemId
GetPrevChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
393 wxTreeItemId
GetLastChild(
const wxTreeItemId& item, wxTreeItemIdValue& cookie)
const;
400 wxTreeItemId
GetNext(
const wxTreeItemId& item)
const;
401 wxTreeItemId
GetPrev(
const wxTreeItemId& item)
const;
410 wxTreeItemId
GetFirstVisible(
bool fullRow =
false,
bool within =
true)
const;
411 wxTreeItemId
GetNextVisible (
const wxTreeItemId& item,
bool fullRow =
false,
bool within =
true)
const;
412 wxTreeItemId
GetPrevVisible (
const wxTreeItemId& item,
bool fullRow =
false,
bool within =
true)
const;
413 wxTreeItemId
GetLastVisible (
bool fullRow =
false,
bool within =
true)
const;
419 wxTreeItemId
AddRoot (
const wxString& text,
420 int image = -1,
int selectedImage = -1,
421 wxTreeItemData *
data = NULL);
424 wxTreeItemId
PrependItem (
const wxTreeItemId& parent,
425 const wxString& text,
426 int image = -1,
int selectedImage = -1,
427 wxTreeItemData *
data = NULL);
430 wxTreeItemId
InsertItem (
const wxTreeItemId& parent,
431 const wxTreeItemId& idPrevious,
432 const wxString& text,
433 int image = -1,
int selectedImage = -1,
434 wxTreeItemData *
data = NULL);
437 wxTreeItemId
InsertItem (
const wxTreeItemId& parent,
439 const wxString& text,
440 int image = -1,
int selectedImage = -1,
441 wxTreeItemData *
data = NULL);
444 wxTreeItemId
AppendItem (
const wxTreeItemId& parent,
445 const wxString& text,
446 int image = -1,
int selectedImage = -1,
447 wxTreeItemData *
data = NULL);
450 void Delete (
const wxTreeItemId& item);
457 void SetItemParent(
const wxTreeItemId& parent,
const wxTreeItemId& item);
460 void Expand (
const wxTreeItemId& item);
462 void ExpandAll (
const wxTreeItemId& item);
464 void Collapse (
const wxTreeItemId& item);
468 void Toggle (
const wxTreeItemId& item);
471 void SetCurrentItem(
const wxTreeItemId& item = (wxTreeItemId*)NULL);
478 const wxTreeItemId& last = (wxTreeItemId*)NULL,
479 bool unselect_others =
true);
486 void ScrollTo (
const wxTreeItemId& item);
491 {
int flags;
int column;
return HitTest (point, flags, column); }
493 {
int column;
return HitTest (point, flags, column); }
494 wxTreeItemId
HitTest (
const wxPoint& point,
int&
flags,
int& column);
498 bool textOnly =
false)
const;
506 void EditLabel (
const wxTreeItemId& item,
int column);
507 void EndEdit(
bool isCancelled);
510 virtual wxString
OnGetItemText( wxTreeItemData* item,
long column )
const;
518 virtual int OnCompareItems (
const wxTreeItemId& item1,
const wxTreeItemId&
item2,
int column);
521 void SortChildren(
const wxTreeItemId& item,
int column = -1,
bool reverseOrder =
false);
524 wxTreeItemId
FindItem (
const wxTreeItemId& item,
const wxString& str,
int mode = 0) {
return FindItem(item, -1, str, mode); };
525 wxTreeItemId
FindItem (
const wxTreeItemId& item,
int column,
const wxString& str,
int mode = 0);
532 void SetDragItem (
const wxTreeItemId& item = (wxTreeItemId*)NULL);
552 void OnSize(wxSizeEvent& event);
557 DECLARE_EVENT_TABLE()
568 class wxTreeListCtrlXmlHandler :
public wxXmlResourceHandler {
569 DECLARE_DYNAMIC_CLASS(wxTreeListCtrlXmlHandler)
571 wxTreeListCtrlXmlHandler();
572 virtual wxObject *DoCreateResource();
573 virtual bool CanHandle(wxXmlNode *node);
wxFont GetItemFont(const wxTreeItemId &item) const
void Refresh(bool erase=TRUE, const wxRect *rect=NULL)
void CalculateAndSetHeaderHeight()
void SetItemFont(const wxTreeItemId &item, const wxFont &font)
void AssignButtonsImageList(wxImageList *imageList)
wxTreeListColumnInfo GetColumn(int column)
unsigned int GetLineSpacing() const
wxString GetTooltip() const
void CollapseAndReset(const wxTreeItemId &item)
wxTreeItemId GetNextVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
void OnSize(wxSizeEvent &event)
void EnsureVisible(const wxTreeItemId &item)
virtual long GetWindowStyleFlag() const
wxTreeItemId GetPrev(const wxTreeItemId &item) const
size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true)
const int wxTREE_HITTEST_ONITEMCOLUMN
wxTreeListColumnInfo & SetEditable(bool edit)
wxTreeItemId HitTest(const wxPoint &point, int &flags)
void SetItemBackgroundColour(const wxTreeItemId &item, const wxColour &colour)
wxTreeListColumnInfo & SetTooltip(const wxString &text)
const int wxTL_MODE_FIND_EXACT
void ScrollTo(const wxTreeItemId &item)
wxTreeListColumnInfo(const wxTreeListColumnInfo &other)
void AssignStateImageList(wxImageList *imageList)
void SetColumnWidth(int column, int width)
const int wxTL_MODE_NAV_EXPANDED
wxTreeListColumnInfo & SetSelectedImage(int image)
wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str, int mode=0)
wxTreeItemId GetRootItem() const
void Toggle(const wxTreeItemId &item)
void SetItemData(const wxTreeItemId &item, wxTreeItemData *data)
void SetColumnImage(int column, int image)
virtual bool SetBackgroundColour(const wxColour &colour)
void SortChildren(const wxTreeItemId &item, int column=-1, bool reverseOrder=false)
void SetLineSpacing(unsigned int spacing)
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)
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)
virtual ~wxTreeListCtrl()
wxTreeItemData * GetItemData(const wxTreeItemId &item) const
void EndEdit(bool isCancelled)
wxTreeItemId AddRoot(const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
void SetColumnAlignment(int column, int flag)
void DeleteChildren(const wxTreeItemId &item)
wxTreeItemId GetPrevExpanded(const wxTreeItemId &item) const
const int wxTL_MODE_FIND_NOCASE
int GetMainColumn() const
void AssignImageList(wxImageList *imageList)
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
wxTreeItemId GetNextSibling(const wxTreeItemId &item) const
wxTreeItemId GetFirstChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
bool IsColumnShown(int column) const
int GetColumnAlignment(int column) const
wxTreeItemId HitTest(const wxPoint &point)
const int wxTL_MODE_NAV_LEVEL
wxTreeItemId GetFirstExpandedItem() const
void SetItemHasChildren(const wxTreeItemId &item, bool has=true)
wxTreeListColumnInfo(const wxString &text=wxEmptyString, int width=DEFAULT_COL_WIDTH, int flag=wxALIGN_LEFT, int image=-1, bool shown=true, bool edit=false, const wxString &tooltip=wxEmptyString)
void SetMainColumn(int column)
wxTreeItemId GetLastVisible(bool fullRow=false, bool within=true) const
bool IsColumnEditable(int column) const
wxTreeItemId GetNext(const wxTreeItemId &item) const
void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
wxTreeListColumnInfo & SetWidth(int width)
bool IsSelected(const wxTreeItemId &item) const
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)
wxTreeListColumnInfo & SetText(const wxString &text)
wxImageList * GetImageList() const
wxTreeItemId PrependItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selectedImage=-1, wxTreeItemData *data=NULL)
int GetSelectedImage() const
int GetHeaderHeight() const
bool HasChildren(const wxTreeItemId &item) const
virtual void SetWindowStyleFlag(long styles)
void SetItemBold(const wxTreeItemId &item, bool bold=true)
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)
wxColour GetItemTextColour(const wxTreeItemId &item) const
wxTreeItemId GetNextChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
void Expand(const wxTreeItemId &item)
wxTreeItemId GetFirstVisible(bool fullRow=false, bool within=true) const
void SetItemToolTip(const wxTreeItemId &item, const wxString &tip)
const int wxTL_MODE_NAV_FULLTREE
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 GetItemBackgroundColour(const wxTreeItemId &item) 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)
const int wxTL_MODE_FIND_PARTIAL
void SetColumnText(int column, const wxString &text)
void SetCurrentItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
void RemoveColumn(int column)
virtual wxString OnGetItemText(wxTreeItemData *item, long column) const
void SetItemTextColour(const wxTreeItemId &item, const wxColour &colour)
wxTreeListColumnInfo & SetImage(int image)
int GetColumnImage(int column) const
virtual bool SetForegroundColour(const wxColour &colour)
options wxIntPtr wxIntPtr sortData std::vector< PanoInfo > * data
virtual wxSize DoGetBestSize() const
wxTreeItemId GetFirstVisibleItem(bool fullRow=false) const
void SetDragItem(const wxTreeItemId &item=(wxTreeItemId *) NULL)
void SetToolTip(const wxString &tip)
int GetItemImage(const wxTreeItemId &item, wxTreeItemIcon which=wxTreeItemIcon_Normal) const
wxTreeListColumnInfo & SetShown(bool shown)
wxTreeListMainWindow * m_main_win
wxTreeItemId GetSelection() const
wxString GetColumnText(int column) const
wxTreeListColumnInfo & SetAlignment(int flag)
size_t GetSelections(wxArrayTreeItemIds &) const
bool IsBold(const wxTreeItemId &item, int column) const
virtual bool SetFont(const wxFont &font)
bool IsBold(const wxTreeItemId &item) const
void SetImageList(wxImageList *imageList)
void ExpandAll(const wxTreeItemId &item)
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)
const int wxTL_MODE_NAV_VISIBLE
bool GetBoundingRect(const wxTreeItemId &item, wxRect &rect, bool textOnly=false) const
wxTreeItemId GetPrevVisible(const wxTreeItemId &item, bool fullRow=false, bool within=true) const
void SetButtonsImageList(wxImageList *imageList)
wxTreeListMainWindow * GetMainWindow() const
wxTreeItemId GetNextExpanded(const wxTreeItemId &item) const
virtual int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2)
wxString GetItemText(const wxTreeItemId &item) const
wxImageList * GetStateImageList() const
wxImageList * GetButtonsImageList() const
unsigned int GetIndent() const
wxTreeListHeaderWindow * GetHeaderWindow() const
bool IsExpanded(const wxTreeItemId &item) const
wxTreeItemId GetPrevChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
void SetItemText(const wxTreeItemId &item, const wxString &text)
void EditLabel(const wxTreeItemId &item)
void SetStateImageList(wxImageList *imageList)
wxTreeListHeaderWindow * m_header_win
void Delete(const wxTreeItemId &item)
int GetColumnWidth(int column) const