12#ifndef __WXTREEMULTICTRL_H__
13#define __WXTREEMULTICTRL_H__
71#pragma interface "wxTreeMultiCtrl.cpp"
78#include <wx/dynarray.h>
81#include "TreeMultiItemRoot.h"
84#define wxTMC_DEFAULT_STYLE wxSIMPLE_BORDER
93#define wxTMC_BG_ADJUST_CNT 0x000000001
96#define wxTMC_BG_ADJUST_BTN 0x000000002
99#define wxTMC_BG_ADJUST_ALL (wxTMC_BG_ADJUST_CNT | wxTMC_BG_ADJUST_BTN)
102#define wxTMC_SPAN_WIDTH 0x000000004
106#define wxTreeMultiCtrlNameStr wxT("wxTreeMultiCtrl")
108#define WXTMC_GUTTER_DEFAULT 6
109#define WXTMC_YSPACING_DEFAULT 10
110#define WXTMC_PIXELS_PER_UNIT 10
207 return (this->GetItem() == item.GetItem());
212 return (this->GetItem() != item.GetItem());
281 wxCHECK(_item,
false);
292 wxCHECK(_item,
false);
293 return _item->IsExcluded();
300 wxCHECK(this->GetItem(),
false);
308 wxCHECK(_item,
false);
317 wxCHECK(_item, wxEmptyString);
365 int _frontSpacing, _frontSpacingOrg;
379 _frontSpacing(frontSpacing),
380 _frontSpacingOrg(frontSpacing),
381 _topSpacing(topSpacing),
382 _checkState(checkState)
387 _frontSpacing(frontSpacing),
388 _frontSpacingOrg(frontSpacing),
389 _topSpacing(topSpacing)
405 if (num > 0) _frontSpacing += (_frontSpacingOrg * num);
406 return _frontSpacing;
416 _frontSpacing -= (_frontSpacingOrg * num);
417 if (_frontSpacing < 0) _frontSpacing = 0;
418 return _frontSpacing;
423 _frontSpacing = frontSpacing;
424 _frontSpacingOrg = frontSpacing;
430 return _frontSpacing;
437 _topSpacing = topSpacing;
438 if (_topSpacing < 0) _topSpacing = 0;
442 int GetTopSpacing()
const {
478 _flags &= ~(flag_mask);
486 void SetDefaultCheckState(
bool checkState =
true) {
487 _checkState = checkState;
492 bool GetDefaultCheckState()
const {
500#define wxTreeMultiWindowInfoDefault wxTreeMultiWindowInfo(wxTMC_BG_ADJUST_CNT, 8, 0)
502#define wxTreeMultiWindowInfoDefault wxTreeMultiWindowInfo(wxTMC_BG_ADJUST_ALL, 8, 0)
552 wxBitmap *_expandBmp, *_collBmp;
555 int _iconDeltaY, _checkDeltaY;
580 wxBitmap *_checkBmp, *_uncheckBmp, *_tristateBmp;
586 int _checkHeight, _checkWidth;
590 wxBrush* m_HilightBrush;
597 wxArrayTreeMultiItem m_SelectedItems;
620 void RecalculateNodePositions();
630 void SetWindowBackgroundColour(wxWindow* wnd,
const wxColour& col,
int flags);
637 void UpdateAllWindowVisibility();
644 void RecalculateVirtualSize();
647 using wxScrolledWindow::AdjustScrollbars;
649 virtual void AdjustScrollbars(
int x,
int y);
652 void RecalculateVirtualSizeFromNode(
const TreeMultiItemNode* node,
int& x,
int& y);
669 void AdjustIconsDeltaY();
697 wxString
const& Name);
718 void OnPaint(wxPaintEvent& event);
720 void OnMouseClick(wxMouseEvent& event);
722 void OnRightMouseClick(wxMouseEvent& Event);
724 void OnKey(wxKeyEvent& event);
726 void OnSize(wxSizeEvent& event);
729 void RecalculateSpanSizes();
736 : _create_called(false) {
744 wxTreeMultiCtrl(wxWindow* parent, wxWindowID
id = -1,
const wxPoint& pos = wxDefaultPosition,
745 const wxSize& size = wxDefaultSize,
long style = wxTMC_DEFAULT_STYLE,
746 const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTreeMultiCtrlNameStr)
747 : _style(style | wxTAB_TRAVERSAL),
748 _create_called(false) {
749 Create(parent,
id, pos, size, style, validator, name);
760 bool Create(wxWindow* parent, wxWindowID
id = -1,
const wxPoint& pos = wxDefaultPosition,
761 const wxSize& size = wxDefaultSize,
long style = wxTMC_DEFAULT_STYLE,
762 const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTreeMultiCtrlNameStr);
783 const wxString& name = wxEmptyString,
792 wxString
const& Name = wxEmptyString,
800 const wxString& name = wxEmptyString,
807 const wxString& name = wxEmptyString);
816 wxString
const& name);
823 wxString
const& name = wxEmptyString);
832 this->m_SelectedItems.Clear();
885 return this->m_SelectedItems.GetCount();
971 bool skipFirst =
false);
985 return n->GetNodeCount();
1041 void SetTextValue(
int wndId,
const wxString& value = wxEmptyString);
1077 int GetCheckboxState(
const wxTreeMultiItem& item,
bool WXUNUSED(recursive)) {
1078 wxCHECK(item.
IsOk(), -1);
1082 if (b->GetCheckbox())
return b->GetCheckboxState();
1091 wxCHECK2(item.
IsOk(),
return);
1093 if (b->GetCheckbox()) b->SetCheckboxState(state);
1094 RedrawFromNode(item.GetItem()->GetParent());
1110 if (spacingY >= 0) {
1111 _spacingY = spacingY;
1127 void SetCheckboxView(
bool value) {
1128 _checkboxView = value;
1135 bool GetCheckboxView()
const {
1136 return _checkboxView;
1207 return _captionFont;
1221 void OnDraw(wxDC& dc);
1224 DECLARE_EVENT_TABLE()
Definition TreeMultiItemBase.h:30
virtual TreeMultiItemRoot * IsTreeMultiItemRoot() const
Definition TreeMultiItemBase.h:88
bool IsVisible()
Definition TreeMultiItemBase.cpp:51
bool IsSelected(void) const
Definition TreeMultiItemBase.h:169
virtual TreeMultiItemNode * IsTreeMultiItemNode() const
Definition TreeMultiItemBase.h:102
virtual TreeMultiItemWindow * IsTreeMultiItemWindow() const
Definition TreeMultiItemBase.h:95
wxString GetName() const
Definition TreeMultiItemBase.h:76
Definition TreeMultiItemNode.h:41
bool IsExpanded() const
Definition TreeMultiItemNode.h:109
Definition TreeMultiItemRoot.h:29
Definition TreeMultiItemWindow.h:27
This is the visual control, which will contain all the logic for the tree mechanism.
Definition wxTreeMultiCtrl.h:541
void DeleteAllItems(void)
Definition wxTreeMultiCtrl.h:830
wxTreeMultiItem GetNextChild(const wxTreeMultiItem &item, int &cookie) const
Definition wxTreeMultiCtrl.cpp:1627
void Fold(const wxTreeMultiItem &item, bool expand=true)
Definition wxTreeMultiCtrl.h:867
void SelectItem(wxTreeMultiItem const &Item, bool UnselectOthers=true, bool ExpandSelection=false)
Definition wxTreeMultiCtrl.cpp:436
wxTreeMultiItem GetNext(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.cpp:1694
void SetCaption(wxTreeMultiItem const &item, const wxString &caption)
Definition wxTreeMultiCtrl.cpp:146
wxTreeMultiItem FindItem(const wxString &name, bool ignoreCase=false)
Definition wxTreeMultiCtrl.h:974
bool Delete(wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.cpp:304
void Exclude(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.cpp:560
wxTreeMultiItem GetFocus()
Definition wxTreeMultiCtrl.cpp:928
void Expand(const wxTreeMultiItem &item, bool recursive)
Definition wxTreeMultiCtrl.cpp:362
wxWindow * GetWindow(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.h:1045
wxTreeMultiCtrl(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTMC_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxTreeMultiCtrlNameStr)
Definition wxTreeMultiCtrl.h:744
int GetChildrenCount(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.h:982
bool GetBooleanValue(int wndId)
Definition wxTreeMultiCtrl.cpp:1417
size_t GetSelectedItemIndex(wxTreeMultiItem const &Item) const
Definition wxTreeMultiCtrl.cpp:424
void Include(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.cpp:572
bool Create(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTMC_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxTreeMultiCtrlNameStr)
Definition wxTreeMultiCtrl.cpp:52
size_t GetSelectedItemCount(void) const
Definition wxTreeMultiCtrl.h:884
const wxFont & GetCaptionFont() const
Definition wxTreeMultiCtrl.h:1206
wxTreeMultiItem HitTest(wxPoint const &pt, int &flags)
Definition wxTreeMultiCtrl.cpp:853
wxTreeMultiCtrl()
Definition wxTreeMultiCtrl.h:735
wxTreeMultiItem FindItem(const wxTreeMultiItem &item, const wxString &name, bool ignoreCase=false, bool skipFirst=false)
Definition wxTreeMultiCtrl.cpp:1327
wxTreeMultiItem GetNextSibling(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.cpp:1653
wxTreeMultiItem GetFirstRoot(void) const
Definition wxTreeMultiCtrl.h:1150
virtual ~wxTreeMultiCtrl()
Definition wxTreeMultiCtrl.cpp:173
wxTreeMultiItem GetLastRoot(void) const
Definition wxTreeMultiCtrl.h:1155
wxTreeMultiItem AddRoot(const wxString &caption, const wxString &name=wxEmptyString)
Definition wxTreeMultiCtrl.cpp:185
wxTreeMultiItem GetParent(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.cpp:1602
wxTreeMultiItem GetSelectedItem(size_t Index) const
Definition wxTreeMultiCtrl.cpp:417
wxString GetTextValue(int wndId)
Definition wxTreeMultiCtrl.cpp:1488
void SetSelectionValue(int wndId, int sel)
Definition wxTreeMultiCtrl.cpp:1567
wxTreeMultiItem GetLastSelectedItem(void) const
Definition wxTreeMultiCtrl.cpp:410
void SetCaptionFont(const wxFont &font)
Definition wxTreeMultiCtrl.cpp:137
void DeleteChildren(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.cpp:334
int GetSelectionValue(int wndId)
Definition wxTreeMultiCtrl.cpp:1518
wxTreeMultiItem PrependNode(wxTreeMultiItem const &ParentItem, wxString const &caption=wxEmptyString, wxString const &name=wxEmptyString)
Definition wxTreeMultiCtrl.cpp:286
void SetSpacingY(int spacingY)
Definition wxTreeMultiCtrl.h:1109
wxTreeMultiItem GetFirstSelectedItem(void) const
Definition wxTreeMultiCtrl.cpp:403
void Unselect(wxTreeMultiItem const &Item)
Definition wxTreeMultiCtrl.cpp:521
void SetTextValue(int wndId, const wxString &value=wxEmptyString)
Definition wxTreeMultiCtrl.cpp:1467
void Collapse(const wxTreeMultiItem &item, bool recursive)
Definition wxTreeMultiCtrl.cpp:371
wxTreeMultiItem GetLastChild(const wxTreeMultiItem &item) const
Definition wxTreeMultiCtrl.cpp:1643
wxTreeMultiItem PrependWindow(wxTreeMultiItem const &ParentItem, wxWindow *window=nullptr, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfoDefault, int flags=0)
Definition wxTreeMultiCtrl.cpp:230
wxTreeMultiItem GetPrevSibling(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.cpp:1674
wxTreeMultiItem GetFirstChild(const wxTreeMultiItem &item, int &cookie) const
Definition wxTreeMultiCtrl.cpp:1612
void CollapseNodes(bool recursive=false)
Definition wxTreeMultiCtrl.cpp:386
wxTreeMultiItem GetPrevious(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.cpp:1716
void ExpandNodes(bool recursive=false)
Definition wxTreeMultiCtrl.cpp:380
wxTreeMultiItem GetExcludedParent(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.cpp:584
wxTreeMultiItem AppendNode(wxTreeMultiItem const &ParentItem, const wxString &caption=wxEmptyString, const wxString &name=wxEmptyString)
Definition wxTreeMultiCtrl.cpp:249
void UnselectAll(void)
Definition wxTreeMultiCtrl.cpp:509
int GetSpacingY() const
Definition wxTreeMultiCtrl.h:1118
wxTreeMultiItem AppendWindow(const wxTreeMultiItem &ParentItem, wxWindow *window=nullptr, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfoDefault, int flags=0)
Definition wxTreeMultiCtrl.cpp:192
void CollapseAndReset(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.cpp:392
void GetSelectionValues(int wndId, wxArrayInt &sels)
Definition wxTreeMultiCtrl.cpp:1544
void SetBooleanValue(int wndId, bool value=true)
Definition wxTreeMultiCtrl.cpp:1439
An intermediate class which is used to return as 'item' value for the wxTreeMultiCtrl....
Definition wxTreeMultiCtrl.h:173
bool IsVisible()
Definition wxTreeMultiCtrl.h:307
bool IsRootItem() const
Definition wxTreeMultiCtrl.h:270
bool IsNodeItem() const
Definition wxTreeMultiCtrl.h:260
bool IsExpanded() const
Definition wxTreeMultiCtrl.h:280
bool IsSelected(void) const
Definition wxTreeMultiCtrl.h:299
bool IsOk() const
Definition wxTreeMultiCtrl.h:241
bool operator!=(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.h:211
wxTreeMultiItem GetParent() const
Definition wxTreeMultiCtrl.h:217
wxTreeMultiItem()
Definition wxTreeMultiCtrl.h:180
bool operator==(wxTreeMultiItem const &item) const
Definition wxTreeMultiCtrl.h:206
wxString GetName() const
Definition wxTreeMultiCtrl.h:316
bool IsWindowItem() const
Definition wxTreeMultiCtrl.h:249
bool IsExcluded()
Definition wxTreeMultiCtrl.h:291
void operator=(const wxTreeMultiItem &item)
Definition wxTreeMultiCtrl.h:201
This class contains information for every Window node to be added.
Definition wxTreeMultiCtrl.h:357
void SetTopSpacing(int topSpacing)
Definition wxTreeMultiCtrl.h:436
int Outdent(int num=1)
Definition wxTreeMultiCtrl.h:415
int SetFlags(int flags)
Definition wxTreeMultiCtrl.h:449
int RemoveFlag(int flag_mask)
Definition wxTreeMultiCtrl.h:476
int AddFlag(int flag_mask)
Definition wxTreeMultiCtrl.h:466
void SetFrontSpacing(int frontSpacing)
Definition wxTreeMultiCtrl.h:422
int GetFlags() const
Definition wxTreeMultiCtrl.h:458
int GetFrontSpacing() const
Definition wxTreeMultiCtrl.h:429
int Indent(int num=1)
Definition wxTreeMultiCtrl.h:404
@ wxTMC_HITTEST_CAPTION
wxCoord was found on a caption of a Node or Root item
Definition wxTreeMultiCtrl.h:122
@ wxTMC_HITTEST_WINDOW
wxCoord was found inside a window, or behind it, on a Window node
Definition wxTreeMultiCtrl.h:120
@ wxTMC_HITTEST_CHECKBOX
wxCoord was found on a checkbox (only when item really has a checkbox)
Definition wxTreeMultiCtrl.h:124
@ wxTMC_HITTEST_GUTTER
wxCoord was found in the gutter of the node (in front of the [+])
Definition wxTreeMultiCtrl.h:118