# Symbols must be exported (Windows)
ADD_DEF(BBTK_EXPORT_SYMBOLS)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty)
+
#-----------------------------------------------------------------------------
# Sources files
-FILE(GLOB SOURCES "." "*.cxx" "*.cpp")
+FILE(GLOB SOURCES "." "*.cxx" "*.cpp" "ThirdParty/wx/treemultictrl/*.cpp")
FILE(GLOB SOURCES_H "." "*.h" )
#-----------------------------------------------------------------------------
# lib definition
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemBase.cpp,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemBase.cpp,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License
+//---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "TreeMultiItemBase.cpp"
+#endif
+
+/* for compilers that support precompilation
+ includes "wx/wx.h" */
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop\r
+#endif\r
+\r
+#include "wx/treemultictrl/TreeMultiItemBase.h"\r
+#include "wx/treemultictrl/TreeMultiItemNode.h"\r
+\r
+/** TreeMultiItemBase\r
+ * This class is the node of the whole tree. All the other classes in the\r
+ * tree descend from this node. It contains the type of the class without
+ * using RTTI. NOTE: this class cannot be constructed directly
+ */
+
+TreeMultiItemBase::TreeMultiItemBase(TreeMultiItemNode *parent)
+ : _excluded(false)
+
+ , _x(0)
+ , _y(0)
+ , _width(0)\r
+ , _height(0)\r
+ , _parent(parent)\r
+ , m_Selected(false)\r
+#if(CHECKBOXVIEW)\r
+ , _checkbox(false)\r
+ , _checkboxState(0)\r
+#endif
+{
+ // TODO: Enter your constructor code here
+}
+
+TreeMultiItemBase::~TreeMultiItemBase()
+{
+ // TODO: Enter your destructor code here
+}
+
+bool TreeMultiItemBase::IsVisible()
+{
+ // are we excluded? then we are not visible as well
+
+ if(IsExcluded())
+ return false;
+
+ // check every parent up until the last and if one of them is collapsed
+ // we are not visible
+
+ TreeMultiItemNode *p = GetParent();
+ while(p)
+ {
+ if(!p->IsExpanded())
+ return false;
+ else
+ p = p->GetParent();
+ }
+
+ return true;
+}
--- /dev/null
+//---------------------------------------------------------------------------
+// $RCSfile: TreeMultiItemBase.h,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemBase.h,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------
+// Author: Jorgen Bodde
+// Copyright: (c) Jorgen Bodde
+// License: wxWidgets License
+//---------------------------------------------------------------------------
+
+#ifndef __TREEMULTIITEMBASE_HPP_
+#define __TREEMULTIITEMBASE_HPP_
+
+#ifdef __GNUG__
+ #pragma interface "TreeMultiItemBase.cpp"
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+#endif
+
+// forward definitions
+class TreeMultiItemRoot;
+class TreeMultiItemWindow;
+class TreeMultiItemNode;
+
+class TreeMultiItemBase
+{
+protected:
+ TreeMultiItemBase(TreeMultiItemNode *parent);
+
+ /** Name property of this item, useful for assigning / coupling
+ external variable reference to this item. It is not mandatory */
+ wxString _name;
+
+ /** Flag to indicate that this node is visible or not. The Node can be
+ temporarily excluded by flagging it. This has also consequences for all
+ the children of this node (if any) */
+ bool _excluded;
+
+ /** Type of instanced class */
+ int _type;
+
+ /** Calculated X, Y position */
+ int _x, _y;
+
+ /** Calculated width, height */
+ int _width, _height;
+
+#if(CHECKBOXVIEW)
+ /** Checkbox flag (draw one or not) */
+ bool _checkbox;
+
+ /** Internal draw state. This is a unintelligent state, and should be
+ updated when this node has some checked and some unchecked children
+ then this should become a tri-stated item */
+ int _checkboxState;
+#endif
+
+public:
+ virtual ~TreeMultiItemBase();
+
+ // type of tree item
+
+ int GetType() const { return _type; };
+ TreeMultiItemNode *GetParent() const { return _parent; };
+
+ /** Get name of this node */
+ wxString GetName() const {
+ return _name;
+ };
+ /** Set name of the item */
+ void SetName(wxString const& NewName)
+ {
+ this->_name = NewName;
+ }
+
+ /** returns the instance pointer if the current node is
+ a TreeMultiItemRoot, and NULL when it's not.
+ */
+ virtual TreeMultiItemRoot *IsTreeMultiItemRoot() const {
+ return 0;
+ };
+
+ /** returns the instance pointer if the current node is
+ a TreeMultiItemWindow, and NULL when it's not.
+ */
+ virtual TreeMultiItemWindow *IsTreeMultiItemWindow() const {
+ return 0;
+ };
+
+ /** returns the instance pointer if the current node is
+ a TreeMultiItemNode, and NULL when it's not.
+ */
+ virtual TreeMultiItemNode *IsTreeMultiItemNode() const {
+ return 0;
+ };
+
+ /** Sets or resets the excluded flag. When excluded node is not visible */
+ void SetExcluded(bool excluded) {
+ _excluded = excluded;
+ };
+
+ /** Get / Set routine for X */
+ void SetX(int x) {
+ _x = x;
+ };
+
+ int GetX() const {
+ return _x;
+ };
+
+ /** Get / Set routine for Y */
+ void SetY(int y) {
+ _y = y;
+ };
+
+ int GetY() const {
+ return _y;
+ };
+
+ /** Get / Set routine for height */
+ void SetHeight(int height) {
+ _height = height;
+ };
+
+ int GetHeight() const {
+ return _height;
+ };
+
+ /** Get / Set routine for width */
+ void SetWidth(int width) {
+ _width = width;
+ };
+
+ int GetWidth() const {
+ return _width;
+ };
+
+ /** Returns true when this item is drawn somewhere in the
+ tree. Whenever a parent of this node is collapsed, it
+ is not visible and it is not necessary to perform i.e.
+ redraw actions.
+
+ It also returns false when this node is excluded from the
+ tree.
+
+ \sa wxTreeMultiCtrl::Exclude(), wxTreeMultiCtrl::Include())
+ */
+ bool IsVisible();
+
+ /* Returns if this node is excluded from the tree. If this item
+ is a Node, then all kids are excluded as well */
+ bool IsExcluded() const {
+ return _excluded;
+ };
+
+ //
+ // item selection status handling
+
+ /** checks if the item is selected */
+ bool IsSelected(void) const
+ {
+ return this->m_Selected;
+ }
+
+ /** mark the current item as selected */
+ void Select(void)
+ {
+ this->m_Selected = true;
+ }
+
+ /** toggle the selection status */
+ void ToggleSelection(void)
+ {
+ this->m_Selected = !(this->m_Selected);
+ }
+
+ /** unmark the item */
+ void Unselect(void)
+ {
+ this->m_Selected = false;
+ }
+
+#if(CHECKBOXVIEW)
+ /** Sets checkbox or not. This does not influence the state of the checkbox */
+ void SetCheckbox(bool value) {
+ _checkbox = value;
+ };
+
+ /** Returns current state of the checkbox view */
+ bool GetCheckbox() const {
+ return _checkbox;
+ };
+
+ /** Sets checkbox state. If 0 it's unchecked, 1 = checked and 2 = tristate */
+ virtual void SetCheckboxState(int state) {
+ wxCHECK2(state < 3 && state >= 0, return);
+ _checkboxState = state;
+ };
+
+ /** Returns current state of checkbox */
+ int GetCheckboxState() const {
+ return _checkboxState;
+ };
+#endif
+
+private:
+ TreeMultiItemNode *_parent;
+
+ // flags to indicate the status of the item:
+ bool m_Selected;
+};
+
+#endif
+
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemNode.cpp,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemNode.cpp,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License
+//---------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "TreeMultiItemNode.cpp"
+#endif
+
+/* for compilers that support precompilation
+ includes "wx/wx.h" */
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop\r
+#endif\r
+\r
+#include "wx/treemultictrl/TreeMultiItemNode.h"\r
+\r
+#include "wx/arrimpl.cpp"\r
+WX_DEFINE_OBJARRAY(TreeMultiItemBaseArray);\r
+
+/** TreeMultiItemNode
+ * This class is a container holder for multiple TreeMultiItemBase classes.
+ * Since both a TreeMultiItemNode and a TreeMultiItemWindow are a descendant
+ * from a TreeMultiItemBase class, it can hold multiple of these.
+ * In the case of a directory tree structure, it can hold multiple
+ * directories, and leafs (files).
+ */
+
+// default constructor for container composite
+TreeMultiItemNode::TreeMultiItemNode(TreeMultiItemNode *parent, const wxString &caption, const wxString &name)
+ : TreeMultiItemBase(parent)
+ , _caption(caption)
+ , _nodeExpanded(true)
+
+{
+ _name = name;
+ Clear();
+}
+
+//------------------------------------------------------------
+
+TreeMultiItemNode::~TreeMultiItemNode()
+{
+ // delete all items on this level
+ Clear();
+}
+
+//------------------------------------------------------------
+
+void TreeMultiItemNode::AddNode(TreeMultiItemBase *node)
+{
+ if(node)
+ _items.Add(node);\r
+}\r
+\r
+void TreeMultiItemNode::InsertNode(TreeMultiItemBase* NodePtr, size_t Position)\r
+{\r
+ if (NodePtr != NULL)\r
+ this->_items.Insert(NodePtr,Position);\r
+}\r
+\r
+//------------------------------------------------------------\r
+\r
+void TreeMultiItemNode::DeleteNode(TreeMultiItemBase *node)\r
+{
+ // this is wrong. The RemoveAt and Remove should delete
+ // the object
+ if(node)
+ {
+ _items.Detach(Index(node));
+ delete node;
+ }
+
+}
+
+//------------------------------------------------------------
+
+void TreeMultiItemNode::DeleteNode(int index)
+{
+ // this is wrong. The RemoveAt and Remove should delete
+ // the object
+ if(index < (int)_items.Count() && index >= 0)
+ _items.RemoveAt(index);
+}
+
+//------------------------------------------------------------
+
+int TreeMultiItemNode::GetNodeCount() const
+{
+ return _items.Count();
+}
+
+//------------------------------------------------------------
+
+TreeMultiItemBase *TreeMultiItemNode::GetNode(int index) const
+{
+ TreeMultiItemBase *value = 0;
+
+ if(index < (int)_items.Count() && index >= 0)
+ value = &_items.Item(index);
+
+ return value;
+}
+
+//------------------------------------------------------------
+
+TreeMultiItemBase *TreeMultiItemNode::RemoveNode(TreeMultiItemBase *node)
+{
+ if(node)
+ _items.Detach(_items.Index(*node));
+
+ return node;
+}
+
+//------------------------------------------------------------
+
+TreeMultiItemBase * TreeMultiItemNode::RemoveNode(int index)
+{
+ TreeMultiItemBase *value = 0;
+
+ if(index < (int)_items.Count() && index > 0)
+ {
+ value = &_items.Item(index);
+ _items.Detach(index);
+ }
+
+ return value;
+}
+
+//------------------------------------------------------------
+
+int TreeMultiItemNode::Index(TreeMultiItemBase *node, bool searchFromEnd) const
+{
+ wxCHECK(node, -1);
+
+ return _items.Index(*node, searchFromEnd);
+}
+
+//------------------------------------------------------------
+
+void TreeMultiItemNode::Clear()
+{
+ _items.Clear();
+}
+
+//------------------------------------------------------------
+
+TreeMultiItemBase * TreeMultiItemNode::GetNodeNext(int &cookie) const
+{
+ TreeMultiItemBase *value = 0;
+
+ if(cookie >= 0 && cookie < (int)_items.Count())
+ {
+ value = &_items[cookie];
+ cookie++;
+ }
+
+ return value;
+}
+\r
+//------------------------------------------------------------\r
+\r
+TreeMultiItemBase* TreeMultiItemNode::First() const\r
+{\r
+ if (this->_items.GetCount() > 0)\r
+ return &(this->_items[0]);\r
+ else\r
+ return NULL;\r
+} /* TreeMultiItemNode::First() const */\r
+\r
+TreeMultiItemBase* TreeMultiItemNode::Last() const\r
+{\r
+ if(this->_items.GetCount() > 0)\r
+ return &(this->_items.Last());\r
+ else\r
+ return NULL;\r
+} /* TreeMultiItemNode::Last() const */\r
+\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemNode.h,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemNode.h,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License
+//---------------------------------------------------------------------------
+
+#ifndef __TREEMULTIITEMNODE_HPP_
+#define __TREEMULTIITEMNODE_HPP_
+
+#ifdef __GNUG__
+ #pragma interface "TreeMultiItemNode.cpp"
+#endif
+
+#ifndef WX_PRECOMP\r
+ #include "wx/wx.h"\r
+#endif\r
+#include "wx/treebase.h"\r
+\r
+\r
+#include <wx/dynarray.h>\r
+#include "TreeMultiItemBase.h"\r
+#include "TreeMultiItemWindow.h"
+
+/** TreeMultiItemNode
+ * This class is the element class for WX_OBJ_ARRAY and it
+ * should be filled with the member variables and methods to
+ * manipulate each object inside the object array.
+ *
+ * See wxArray for all base methods manipulating the array
+ * Clear() can be used to safely delete all objects.
+ */
+
+// declare the array class here
+
+WX_DECLARE_OBJARRAY(TreeMultiItemBase, TreeMultiItemBaseArray);
+
+class TreeMultiItemNode : public TreeMultiItemBase
+{
+private:
+ TreeMultiItemBaseArray _items;
+
+ /** Caption of this node. */
+ wxString _caption;
+
+ /** Indicates if this node is expanded (true) or collapsed (false) */\r
+ bool _nodeExpanded;\r
+\r
+ /** visual attributes of the node */\r
+ wxTreeItemAttr m_Attributes;\r
+\r
+public:\r
+ TreeMultiItemNode(TreeMultiItemNode *parent, const wxString &caption = wxEmptyString, const wxString &name = wxEmptyString);\r
+ virtual ~TreeMultiItemNode();\r
+
+ // isClass method
+ virtual TreeMultiItemNode *IsTreeMultiItemNode() const {
+ return (TreeMultiItemNode *)this;
+ };
+ \r
+ // add methods\r
+ void AddNode(TreeMultiItemBase *node);\r
+ void InsertNode(TreeMultiItemBase* NodePtr, size_t Position);\r
+\r
+ // delete methods\r
+ void Clear();\r
+ void DeleteNode(TreeMultiItemBase *node);
+ void DeleteNode(int index);
+ TreeMultiItemBase *RemoveNode(TreeMultiItemBase *node);
+ TreeMultiItemBase *RemoveNode(int index);
+
+ // get methods
+ int GetNodeCount() const;
+ TreeMultiItemBase *GetNode(int index) const;\r
+ int Index(TreeMultiItemBase *node, bool searchFromEnd = false) const;\r
+ TreeMultiItemBase *GetNodeNext(int &cookie) const;\r
+ \r
+ TreeMultiItemBase* First() const;\r
+ TreeMultiItemBase* Last() const;\r
+\r
+ /** Fold function sets or clears the expanded flag. Note when excluded from drawing, this\r
+ will have no effect on redraw */\r
+ void Fold(bool expand) {
+ if(_nodeExpanded != expand)
+ _nodeExpanded = expand;
+ };
+
+ /** Return caption */
+ const wxString &GetCaption() const {
+ return _caption;
+ };
+
+ /** Returns true if the node is expanded. Subnodes can still be collapsed though */
+ bool IsExpanded() const {
+ return _nodeExpanded;
+ };
+
+
+};
+
+#endif
+
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemRoot.cpp,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemRoot.cpp,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License\r
+//---------------------------------------------------------------------------\r
+\r
+#ifdef __GNUG__\r
+ #pragma implementation "TreeMultiItemRoot.cpp"\r
+#endif\r
+\r
+/* for compilers that support precompilation\r
+ includes "wx/wx.h" */\r
+\r
+#include "wx/wxprec.h"\r
+\r
+#ifdef __BORLANDC__\r
+ #pragma hdrstop\r
+#endif\r
+\r
+#include "wx/treemultictrl/TreeMultiItemRoot.h"\r
+\r
+/** TreeMultiItemRoot\r
+ * This class is the class you use to create a tree. It contains all the\r
+ * public methods from a TreeMultiItemNode, but you can add more to it \r
+ * because it is the root. A typical addition is the load entry for a \r
+ * directory, or other type of enumeration. You could store the base path\r
+ * of a relative tree in this class.\r
+ */\r
+\r
+TreeMultiItemRoot::TreeMultiItemRoot()\r
+ : TreeMultiItemNode(0, _T(""), _T(""))\r
+{\r
+ // TODO: Enter your constructor code here\r
+}\r
+\r
+TreeMultiItemRoot::~TreeMultiItemRoot()\r
+{\r
+ // TODO: Enter your destructor code here\r
+}\r
+\r
+\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemRoot.h,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemRoot.h,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License\r
+//---------------------------------------------------------------------------\r
+\r
+#ifndef __TREEMULTIITEMROOT_HPP_\r
+#define __TREEMULTIITEMROOT_HPP_\r
+\r
+#ifdef __GNUG__\r
+ #pragma interface "TreeMultiItemRoot.cpp"\r
+#endif\r
+\r
+#ifndef WX_PRECOMP\r
+ #include "wx/wx.h"\r
+#endif\r
+\r
+#include "TreeMultiItemBase.h"\r
+#include "TreeMultiItemNode.h"\r
+\r
+/** This class is the root class. It can hold many of the TreeMultiItemWindow and\r
+ * TreeMultiItemNode classes.\r
+ */\r
+class TreeMultiItemRoot : public TreeMultiItemNode\r
+{\r
+public:\r
+ TreeMultiItemRoot();\r
+ virtual ~TreeMultiItemRoot();\r
+\r
+ // IsClass method\r
+ virtual TreeMultiItemRoot *IsTreeMultiItemRoot() const {\r
+ return (TreeMultiItemRoot *)this;\r
+ };\r
+};\r
+\r
+#endif\r
+\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemWindow.cpp,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemWindow.cpp,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License\r
+//---------------------------------------------------------------------------\r
+\r
+#ifdef __GNUG__\r
+ #pragma implementation "TreeMultiItemWindow.cpp"\r
+#endif\r
+\r
+/* for compilers that support precompilation\r
+ includes "wx/wx.h" */\r
+\r
+#include "wx/wxprec.h"\r
+\r
+#ifdef __BORLANDC__\r
+ #pragma hdrstop\r
+#endif\r
+\r
+#include "wx/treemultictrl/TreeMultiItemWindow.h"\r
+\r
+/** TreeMultiItemWindow\r
+ * This class is a possible end node for the tree. If you want multiple\r
+ * types of end-nodes you should copy this file and adjust it with a \r
+ * different class name.\r
+ */\r
+\r
+TreeMultiItemWindow::TreeMultiItemWindow(TreeMultiItemNode *parent, const wxString &name)\r
+ : TreeMultiItemBase(parent)\r
+ , _window(0)\r
+ , _topSpacing(0)\r
+ , _frontSpacing(0)\r
+ , _span(false)\r
+{\r
+ _name = name;\r
+\r
+ // TODO: Enter your constructor code here\r
+}\r
+\r
+TreeMultiItemWindow::~TreeMultiItemWindow()\r
+{\r
+ if(_window)\r
+ _window->Destroy();\r
+}\r
+\r
+void TreeMultiItemWindow::AssignWindow(wxWindow *wnd)\r
+{\r
+ // delete previous, assign new (even if zero)\r
+ if(_window)\r
+ _window->Destroy();\r
+\r
+ _window = wnd;\r
+\r
+ // recalculate the size\r
+ if(wnd)\r
+ {\r
+ wxSize size; \r
+\r
+ // resize the sized control by sizer or \r
+ // by single window. For a sizer handled window\r
+ // GetBestSize returns the optimal size\r
+\r
+ /// \todo This might need rivision for retaining the sizer size\r
+ /// maybe we need to check whether size is <> 0,0 before get best size\r
+\r
+ if(wnd->GetSizer())\r
+ size = wnd->GetBestSize();\r
+ else\r
+ size = wnd->GetSize();\r
+\r
+ _height = size.GetHeight();\r
+ _width = size.GetWidth();\r
+\r
+ }\r
+ else\r
+ {\r
+ _height = 0;\r
+ _width = 0;\r
+ }\r
+}\r
+\r
+#if(CHECKBOXVIEW)\r
+\r
+void TreeMultiItemWindow::SetCheckboxState(int state) {\r
+ TreeMultiItemBase::SetCheckboxState(state);\r
+\r
+ // enable or disable the window\r
+ if(GetCheckbox() && GetWindow() && state != 2)\r
+ GetWindow()->Enable(state == 1);\r
+};\r
+\r
+#endif // #if(CHECKBOXVIEW)\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: TreeMultiItemWindow.h,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemWindow.h,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:18 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License\r
+//---------------------------------------------------------------------------\r
+\r
+#ifndef __TREEMULTIITEMWINDOW_HPP_\r
+#define __TREEMULTIITEMWINDOW_HPP_\r
+\r
+#ifdef __GNUG__\r
+ #pragma interface "TreeMultiItemWindow.cpp"\r
+#endif\r
+\r
+#ifndef WX_PRECOMP\r
+ #include "wx/wx.h"\r
+#endif\r
+\r
+#include <wx/dynarray.h>\r
+\r
+#include "TreeMultiItemBase.h"\r
+\r
+class TreeMultiItemWindow : public TreeMultiItemBase\r
+{\r
+private:\r
+ /** The simple control, or complex sizer that represents this window\r
+ in the TreeMultiCtrl */\r
+ wxWindow *_window;\r
+\r
+ /** Top and front extra spacings, added to X, Y */\r
+ int _topSpacing, _frontSpacing;\r
+\r
+ /** Spanning flag */\r
+ bool _span;\r
+\r
+public:\r
+ TreeMultiItemWindow(TreeMultiItemNode *parent, const wxString &name = wxEmptyString);\r
+ virtual ~TreeMultiItemWindow();\r
+\r
+ // IsClass method\r
+ virtual TreeMultiItemWindow *IsTreeMultiItemWindow() const {\r
+ return (TreeMultiItemWindow *)this;\r
+ };\r
+ \r
+ /** Assigns the given window to this TreeMultiItemWindow, and also destroys the \r
+ present window. If the assigned window is 0, this item is not drawn\r
+ and removed from the tree visually */\r
+ void AssignWindow(wxWindow *wnd);\r
+\r
+ /** Get window method */\r
+ wxWindow *GetWindow() {\r
+ return _window;\r
+ };\r
+\r
+ /* Sets front spacing */\r
+ void SetFrontSpacing(int frontSpacing) {\r
+ _frontSpacing = frontSpacing;\r
+ };\r
+ /* Gets front spacing */\r
+ int GetFrontSpacing() const {\r
+ return _frontSpacing;\r
+ };\r
+ /* Sets top spacing */\r
+ void SetTopSpacing(int topSpacing) {\r
+ _topSpacing = topSpacing;\r
+ };\r
+ /* Gets top spacing */\r
+ int GetTopSpacing() const {\r
+ return _topSpacing;\r
+ };\r
+ \r
+ /* Sets horizontal span, meaning when this is set the window\r
+ attached may be resized horizontally when the window is resized */\r
+ void SetHorizontalSpan(bool span) {\r
+ _span = span;\r
+ };\r
+\r
+ /* Sets horizontal span, meaning when this is set the window\r
+ attached may be resized horizontally when the window is resized */\r
+ bool GetHorizontalSpan() const {\r
+ return _span;\r
+ };\r
+\r
+#if(CHECKBOXVIEW)\r
+ /** Inherited from base, to enable or disable window */\r
+ virtual void SetCheckboxState(int state);\r
+#endif\r
+};\r
+\r
+#endif\r
+\r
--- /dev/null
+/* XPM */\r
+static char *checked_icon[] = {\r
+"13 13 256 3",\r
+"000 c #1C5180",\r
+"001 c #21A121",\r
+"002 c #E2E2DD",\r
+"003 c #E3E3DF",\r
+"004 c #E5E5E1",\r
+"005 c #E7E7E3",\r
+"006 c #EAEAE6",\r
+"007 c #ECECE9",\r
+"008 c #EFEFEC",\r
+"009 c #F1F1EF",\r
+"010 c #F3F3F1",\r
+"011 c #F5F5F3",\r
+"012 c #F7F7F6",\r
+"013 c #F9F9F8",\r
+"014 c #FAFAF9",\r
+"015 c #FCFCFB",\r
+"016 c #FDFDFD",\r
+"017 c #FEFEFE",\r
+"018 c gray100",\r
+"019 c black",\r
+"020 c black",\r
+"021 c black",\r
+"022 c black",\r
+"023 c black",\r
+"024 c black",\r
+"025 c black",\r
+"026 c black",\r
+"027 c black",\r
+"028 c black",\r
+"029 c black",\r
+"030 c black",\r
+"031 c black",\r
+"032 c black",\r
+"033 c black",\r
+"034 c black",\r
+"035 c black",\r
+"036 c black",\r
+"037 c black",\r
+"038 c black",\r
+"039 c black",\r
+"040 c black",\r
+"041 c black",\r
+"042 c black",\r
+"043 c black",\r
+"044 c black",\r
+"045 c black",\r
+"046 c black",\r
+"047 c black",\r
+"048 c black",\r
+"049 c black",\r
+"050 c black",\r
+"051 c black",\r
+"052 c black",\r
+"053 c black",\r
+"054 c black",\r
+"055 c black",\r
+"056 c black",\r
+"057 c black",\r
+"058 c black",\r
+"059 c black",\r
+"060 c black",\r
+"061 c black",\r
+"062 c black",\r
+"063 c black",\r
+"064 c black",\r
+"065 c black",\r
+"066 c black",\r
+"067 c black",\r
+"068 c black",\r
+"069 c black",\r
+"070 c black",\r
+"071 c black",\r
+"072 c black",\r
+"073 c black",\r
+"074 c black",\r
+"075 c black",\r
+"076 c black",\r
+"077 c black",\r
+"078 c black",\r
+"079 c black",\r
+"080 c black",\r
+"081 c black",\r
+"082 c black",\r
+"083 c black",\r
+"084 c black",\r
+"085 c black",\r
+"086 c black",\r
+"087 c black",\r
+"088 c black",\r
+"089 c black",\r
+"090 c black",\r
+"091 c black",\r
+"092 c black",\r
+"093 c black",\r
+"094 c black",\r
+"095 c black",\r
+"096 c black",\r
+"097 c black",\r
+"098 c black",\r
+"099 c black",\r
+"100 c black",\r
+"101 c black",\r
+"102 c black",\r
+"103 c black",\r
+"104 c black",\r
+"105 c black",\r
+"106 c black",\r
+"107 c black",\r
+"108 c black",\r
+"109 c black",\r
+"110 c black",\r
+"111 c black",\r
+"112 c black",\r
+"113 c black",\r
+"114 c black",\r
+"115 c black",\r
+"116 c black",\r
+"117 c black",\r
+"118 c black",\r
+"119 c black",\r
+"120 c black",\r
+"121 c black",\r
+"122 c black",\r
+"123 c black",\r
+"124 c black",\r
+"125 c black",\r
+"126 c black",\r
+"127 c black",\r
+"128 c black",\r
+"129 c black",\r
+"130 c black",\r
+"131 c black",\r
+"132 c black",\r
+"133 c black",\r
+"134 c black",\r
+"135 c black",\r
+"136 c black",\r
+"137 c black",\r
+"138 c black",\r
+"139 c black",\r
+"140 c black",\r
+"141 c black",\r
+"142 c black",\r
+"143 c black",\r
+"144 c black",\r
+"145 c black",\r
+"146 c black",\r
+"147 c black",\r
+"148 c black",\r
+"149 c black",\r
+"150 c black",\r
+"151 c black",\r
+"152 c black",\r
+"153 c black",\r
+"154 c black",\r
+"155 c black",\r
+"156 c black",\r
+"157 c black",\r
+"158 c black",\r
+"159 c black",\r
+"160 c black",\r
+"161 c black",\r
+"162 c black",\r
+"163 c black",\r
+"164 c black",\r
+"165 c black",\r
+"166 c black",\r
+"167 c black",\r
+"168 c black",\r
+"169 c black",\r
+"170 c black",\r
+"171 c black",\r
+"172 c black",\r
+"173 c black",\r
+"174 c black",\r
+"175 c black",\r
+"176 c black",\r
+"177 c black",\r
+"178 c black",\r
+"179 c black",\r
+"180 c black",\r
+"181 c black",\r
+"182 c black",\r
+"183 c black",\r
+"184 c black",\r
+"185 c black",\r
+"186 c black",\r
+"187 c black",\r
+"188 c black",\r
+"189 c black",\r
+"190 c black",\r
+"191 c black",\r
+"192 c black",\r
+"193 c black",\r
+"194 c black",\r
+"195 c black",\r
+"196 c black",\r
+"197 c black",\r
+"198 c black",\r
+"199 c black",\r
+"200 c black",\r
+"201 c black",\r
+"202 c black",\r
+"203 c black",\r
+"204 c black",\r
+"205 c black",\r
+"206 c black",\r
+"207 c black",\r
+"208 c black",\r
+"209 c black",\r
+"210 c black",\r
+"211 c black",\r
+"212 c black",\r
+"213 c black",\r
+"214 c black",\r
+"215 c black",\r
+"216 c black",\r
+"217 c black",\r
+"218 c black",\r
+"219 c black",\r
+"220 c black",\r
+"221 c black",\r
+"222 c black",\r
+"223 c black",\r
+"224 c black",\r
+"225 c black",\r
+"226 c black",\r
+"227 c black",\r
+"228 c black",\r
+"229 c black",\r
+"230 c black",\r
+"231 c black",\r
+"232 c black",\r
+"233 c black",\r
+"234 c black",\r
+"235 c black",\r
+"236 c black",\r
+"237 c black",\r
+"238 c black",\r
+"239 c black",\r
+"240 c black",\r
+"241 c black",\r
+"242 c black",\r
+"243 c black",\r
+"244 c black",\r
+"245 c black",\r
+"246 c black",\r
+"247 c black",\r
+"248 c black",\r
+"249 c black",\r
+"250 c black",\r
+"251 c black",\r
+"252 c black",\r
+"253 c black",\r
+"254 c black",\r
+"255 c black",\r
+"000000000000000000000000000000000000000",\r
+"000002002002003004005006007008009010000",\r
+"000002002003004005006007008009010011000",\r
+"000002003004005006007008009001011012000",\r
+"000003004005006007008009001001012013000",\r
+"000004005001007008009001001001013014000",\r
+"000005006001001009001001001013014015000",\r
+"000006007001001001001001013014015016000",\r
+"000007008009001001001013014015016017000",\r
+"000008009010011001013014015016017018000",\r
+"000009010011012013014015016017018018000",\r
+"000010011012013014015016017018018018000",\r
+"000000000000000000000000000000000000000"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *collapse_xpm[] = {\r
+"11 11 16 2",\r
+"00 c black",\r
+"01 c #7B9CB5",\r
+"02 c #B5C6D6",\r
+"03 c #C6B5A5",\r
+"04 c #C6BDA5",\r
+"05 c #C6BDAD",\r
+"06 c #CECEBD",\r
+"07 c #D6D0C3",\r
+"08 c #DED6CE",\r
+"09 c #DEDECE",\r
+"10 c #DEDED6",\r
+"11 c #E7E7DE",\r
+"12 c #EFEFE7",\r
+"13 c #F7F7EF",\r
+"14 c gray97",\r
+"15 c gray100",\r
+"1515151515151515151515",\r
+"1502010101010101010215",\r
+"1501151515151515150115",\r
+"1501151515001515130115",\r
+"1501141414001412110115",\r
+"1501130000000000090115",\r
+"1501131212001110080115",\r
+"1501100807000706060115",\r
+"1501060503030303050115",\r
+"1502010101010101010215",\r
+"1515151515151515151515"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *expand_xpm[] = {\r
+"11 11 16 2",\r
+"00 c black",\r
+"01 c #7B9CB5",\r
+"02 c #B5C6D6",\r
+"03 c #C6B5A5",\r
+"04 c #C6BDA5",\r
+"05 c #C6BDAD",\r
+"06 c #D2CEBD",\r
+"07 c #D6D2C6",\r
+"08 c #DED6CE",\r
+"09 c #DEDECE",\r
+"10 c #DEDED6",\r
+"11 c #E7E7DE",\r
+"12 c #EFEFE7",\r
+"13 c #F7F7EF",\r
+"14 c gray97",\r
+"15 c gray100",\r
+"1515151515151515151515",\r
+"1502010101010101010215",\r
+"1501151515151515150115",\r
+"1501151515151515130115",\r
+"1501141414141412110115",\r
+"1501130000000000090115",\r
+"1501131212121110080115",\r
+"1501100807070706060115",\r
+"1501060503030303050115",\r
+"1502010101010101010215",\r
+"1515151515151515151515"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *tristate_icon[] = {\r
+"13 13 256 3",\r
+"000 c #1C5180",\r
+"001 c #6DBB6C",\r
+"002 c #6EBC6C",\r
+"003 c #6FBD6D",\r
+"004 c #70BE6F",\r
+"005 c #71BF70",\r
+"006 c #72C071",\r
+"007 c #73C172",\r
+"008 c #73C273",\r
+"009 c #74C274",\r
+"010 c #75C374",\r
+"011 c #75C475",\r
+"012 c #76C476",\r
+"013 c #76C576",\r
+"014 c #E2E2DD",\r
+"015 c #E3E3DF",\r
+"016 c #E5E5E1",\r
+"017 c #E7E7E3",\r
+"018 c #EAEAE6",\r
+"019 c #ECECE9",\r
+"020 c #EFEFEC",\r
+"021 c #F1F1EF",\r
+"022 c #F3F3F1",\r
+"023 c #F5F5F3",\r
+"024 c #F7F7F6",\r
+"025 c #F9F9F8",\r
+"026 c #FAFAF9",\r
+"027 c #FCFCFB",\r
+"028 c #FDFDFD",\r
+"029 c #FEFEFE",\r
+"030 c gray100",\r
+"031 c black",\r
+"032 c black",\r
+"033 c black",\r
+"034 c black",\r
+"035 c black",\r
+"036 c black",\r
+"037 c black",\r
+"038 c black",\r
+"039 c black",\r
+"040 c black",\r
+"041 c black",\r
+"042 c black",\r
+"043 c black",\r
+"044 c black",\r
+"045 c black",\r
+"046 c black",\r
+"047 c black",\r
+"048 c black",\r
+"049 c black",\r
+"050 c black",\r
+"051 c black",\r
+"052 c black",\r
+"053 c black",\r
+"054 c black",\r
+"055 c black",\r
+"056 c black",\r
+"057 c black",\r
+"058 c black",\r
+"059 c black",\r
+"060 c black",\r
+"061 c black",\r
+"062 c black",\r
+"063 c black",\r
+"064 c black",\r
+"065 c black",\r
+"066 c black",\r
+"067 c black",\r
+"068 c black",\r
+"069 c black",\r
+"070 c black",\r
+"071 c black",\r
+"072 c black",\r
+"073 c black",\r
+"074 c black",\r
+"075 c black",\r
+"076 c black",\r
+"077 c black",\r
+"078 c black",\r
+"079 c black",\r
+"080 c black",\r
+"081 c black",\r
+"082 c black",\r
+"083 c black",\r
+"084 c black",\r
+"085 c black",\r
+"086 c black",\r
+"087 c black",\r
+"088 c black",\r
+"089 c black",\r
+"090 c black",\r
+"091 c black",\r
+"092 c black",\r
+"093 c black",\r
+"094 c black",\r
+"095 c black",\r
+"096 c black",\r
+"097 c black",\r
+"098 c black",\r
+"099 c black",\r
+"100 c black",\r
+"101 c black",\r
+"102 c black",\r
+"103 c black",\r
+"104 c black",\r
+"105 c black",\r
+"106 c black",\r
+"107 c black",\r
+"108 c black",\r
+"109 c black",\r
+"110 c black",\r
+"111 c black",\r
+"112 c black",\r
+"113 c black",\r
+"114 c black",\r
+"115 c black",\r
+"116 c black",\r
+"117 c black",\r
+"118 c black",\r
+"119 c black",\r
+"120 c black",\r
+"121 c black",\r
+"122 c black",\r
+"123 c black",\r
+"124 c black",\r
+"125 c black",\r
+"126 c black",\r
+"127 c black",\r
+"128 c black",\r
+"129 c black",\r
+"130 c black",\r
+"131 c black",\r
+"132 c black",\r
+"133 c black",\r
+"134 c black",\r
+"135 c black",\r
+"136 c black",\r
+"137 c black",\r
+"138 c black",\r
+"139 c black",\r
+"140 c black",\r
+"141 c black",\r
+"142 c black",\r
+"143 c black",\r
+"144 c black",\r
+"145 c black",\r
+"146 c black",\r
+"147 c black",\r
+"148 c black",\r
+"149 c black",\r
+"150 c black",\r
+"151 c black",\r
+"152 c black",\r
+"153 c black",\r
+"154 c black",\r
+"155 c black",\r
+"156 c black",\r
+"157 c black",\r
+"158 c black",\r
+"159 c black",\r
+"160 c black",\r
+"161 c black",\r
+"162 c black",\r
+"163 c black",\r
+"164 c black",\r
+"165 c black",\r
+"166 c black",\r
+"167 c black",\r
+"168 c black",\r
+"169 c black",\r
+"170 c black",\r
+"171 c black",\r
+"172 c black",\r
+"173 c black",\r
+"174 c black",\r
+"175 c black",\r
+"176 c black",\r
+"177 c black",\r
+"178 c black",\r
+"179 c black",\r
+"180 c black",\r
+"181 c black",\r
+"182 c black",\r
+"183 c black",\r
+"184 c black",\r
+"185 c black",\r
+"186 c black",\r
+"187 c black",\r
+"188 c black",\r
+"189 c black",\r
+"190 c black",\r
+"191 c black",\r
+"192 c black",\r
+"193 c black",\r
+"194 c black",\r
+"195 c black",\r
+"196 c black",\r
+"197 c black",\r
+"198 c black",\r
+"199 c black",\r
+"200 c black",\r
+"201 c black",\r
+"202 c black",\r
+"203 c black",\r
+"204 c black",\r
+"205 c black",\r
+"206 c black",\r
+"207 c black",\r
+"208 c black",\r
+"209 c black",\r
+"210 c black",\r
+"211 c black",\r
+"212 c black",\r
+"213 c black",\r
+"214 c black",\r
+"215 c black",\r
+"216 c black",\r
+"217 c black",\r
+"218 c black",\r
+"219 c black",\r
+"220 c black",\r
+"221 c black",\r
+"222 c black",\r
+"223 c black",\r
+"224 c black",\r
+"225 c black",\r
+"226 c black",\r
+"227 c black",\r
+"228 c black",\r
+"229 c black",\r
+"230 c black",\r
+"231 c black",\r
+"232 c black",\r
+"233 c black",\r
+"234 c black",\r
+"235 c black",\r
+"236 c black",\r
+"237 c black",\r
+"238 c black",\r
+"239 c black",\r
+"240 c black",\r
+"241 c black",\r
+"242 c black",\r
+"243 c black",\r
+"244 c black",\r
+"245 c black",\r
+"246 c black",\r
+"247 c black",\r
+"248 c black",\r
+"249 c black",\r
+"250 c black",\r
+"251 c black",\r
+"252 c black",\r
+"253 c black",\r
+"254 c black",\r
+"255 c black",\r
+"000000000000000000000000000000000000000",\r
+"000014014014015016017018019020021022000",\r
+"000014014015016017018019020021022023000",\r
+"000014015001002003004005006007023024000",\r
+"000015016002003004005006007008024025000",\r
+"000016017003004005006007008009025026000",\r
+"000017018004005006007008009010026027000",\r
+"000018019005006007008009010011027028000",\r
+"000019020006007008009010011012028029000",\r
+"000020021007008009010011012013029030000",\r
+"000021022023024025026027028029030030000",\r
+"000022023024025026027028029030030030000",\r
+"000000000000000000000000000000000000000"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *unchecked_icon[] = {\r
+"13 13 256 3",\r
+"000 c #1C5180",\r
+"001 c #DCDCD7",\r
+"002 c #DEDED9",\r
+"003 c #E0E0DB",\r
+"004 c #E2E2DE",\r
+"005 c #E5E5E2",\r
+"006 c #E8E8E5",\r
+"007 c #ECECE9",\r
+"008 c #EFEFEC",\r
+"009 c #F1F1EF",\r
+"010 c #F3F3F1",\r
+"011 c #F5F5F4",\r
+"012 c #F7F7F6",\r
+"013 c #F9F9F8",\r
+"014 c #FBFBFA",\r
+"015 c #FDFDFC",\r
+"016 c #FEFEFE",\r
+"017 c gray100",\r
+"018 c black",\r
+"019 c black",\r
+"020 c black",\r
+"021 c black",\r
+"022 c black",\r
+"023 c black",\r
+"024 c black",\r
+"025 c black",\r
+"026 c black",\r
+"027 c black",\r
+"028 c black",\r
+"029 c black",\r
+"030 c black",\r
+"031 c black",\r
+"032 c black",\r
+"033 c black",\r
+"034 c black",\r
+"035 c black",\r
+"036 c black",\r
+"037 c black",\r
+"038 c black",\r
+"039 c black",\r
+"040 c black",\r
+"041 c black",\r
+"042 c black",\r
+"043 c black",\r
+"044 c black",\r
+"045 c black",\r
+"046 c black",\r
+"047 c black",\r
+"048 c black",\r
+"049 c black",\r
+"050 c black",\r
+"051 c black",\r
+"052 c black",\r
+"053 c black",\r
+"054 c black",\r
+"055 c black",\r
+"056 c black",\r
+"057 c black",\r
+"058 c black",\r
+"059 c black",\r
+"060 c black",\r
+"061 c black",\r
+"062 c black",\r
+"063 c black",\r
+"064 c black",\r
+"065 c black",\r
+"066 c black",\r
+"067 c black",\r
+"068 c black",\r
+"069 c black",\r
+"070 c black",\r
+"071 c black",\r
+"072 c black",\r
+"073 c black",\r
+"074 c black",\r
+"075 c black",\r
+"076 c black",\r
+"077 c black",\r
+"078 c black",\r
+"079 c black",\r
+"080 c black",\r
+"081 c black",\r
+"082 c black",\r
+"083 c black",\r
+"084 c black",\r
+"085 c black",\r
+"086 c black",\r
+"087 c black",\r
+"088 c black",\r
+"089 c black",\r
+"090 c black",\r
+"091 c black",\r
+"092 c black",\r
+"093 c black",\r
+"094 c black",\r
+"095 c black",\r
+"096 c black",\r
+"097 c black",\r
+"098 c black",\r
+"099 c black",\r
+"100 c black",\r
+"101 c black",\r
+"102 c black",\r
+"103 c black",\r
+"104 c black",\r
+"105 c black",\r
+"106 c black",\r
+"107 c black",\r
+"108 c black",\r
+"109 c black",\r
+"110 c black",\r
+"111 c black",\r
+"112 c black",\r
+"113 c black",\r
+"114 c black",\r
+"115 c black",\r
+"116 c black",\r
+"117 c black",\r
+"118 c black",\r
+"119 c black",\r
+"120 c black",\r
+"121 c black",\r
+"122 c black",\r
+"123 c black",\r
+"124 c black",\r
+"125 c black",\r
+"126 c black",\r
+"127 c black",\r
+"128 c black",\r
+"129 c black",\r
+"130 c black",\r
+"131 c black",\r
+"132 c black",\r
+"133 c black",\r
+"134 c black",\r
+"135 c black",\r
+"136 c black",\r
+"137 c black",\r
+"138 c black",\r
+"139 c black",\r
+"140 c black",\r
+"141 c black",\r
+"142 c black",\r
+"143 c black",\r
+"144 c black",\r
+"145 c black",\r
+"146 c black",\r
+"147 c black",\r
+"148 c black",\r
+"149 c black",\r
+"150 c black",\r
+"151 c black",\r
+"152 c black",\r
+"153 c black",\r
+"154 c black",\r
+"155 c black",\r
+"156 c black",\r
+"157 c black",\r
+"158 c black",\r
+"159 c black",\r
+"160 c black",\r
+"161 c black",\r
+"162 c black",\r
+"163 c black",\r
+"164 c black",\r
+"165 c black",\r
+"166 c black",\r
+"167 c black",\r
+"168 c black",\r
+"169 c black",\r
+"170 c black",\r
+"171 c black",\r
+"172 c black",\r
+"173 c black",\r
+"174 c black",\r
+"175 c black",\r
+"176 c black",\r
+"177 c black",\r
+"178 c black",\r
+"179 c black",\r
+"180 c black",\r
+"181 c black",\r
+"182 c black",\r
+"183 c black",\r
+"184 c black",\r
+"185 c black",\r
+"186 c black",\r
+"187 c black",\r
+"188 c black",\r
+"189 c black",\r
+"190 c black",\r
+"191 c black",\r
+"192 c black",\r
+"193 c black",\r
+"194 c black",\r
+"195 c black",\r
+"196 c black",\r
+"197 c black",\r
+"198 c black",\r
+"199 c black",\r
+"200 c black",\r
+"201 c black",\r
+"202 c black",\r
+"203 c black",\r
+"204 c black",\r
+"205 c black",\r
+"206 c black",\r
+"207 c black",\r
+"208 c black",\r
+"209 c black",\r
+"210 c black",\r
+"211 c black",\r
+"212 c black",\r
+"213 c black",\r
+"214 c black",\r
+"215 c black",\r
+"216 c black",\r
+"217 c black",\r
+"218 c black",\r
+"219 c black",\r
+"220 c black",\r
+"221 c black",\r
+"222 c black",\r
+"223 c black",\r
+"224 c black",\r
+"225 c black",\r
+"226 c black",\r
+"227 c black",\r
+"228 c black",\r
+"229 c black",\r
+"230 c black",\r
+"231 c black",\r
+"232 c black",\r
+"233 c black",\r
+"234 c black",\r
+"235 c black",\r
+"236 c black",\r
+"237 c black",\r
+"238 c black",\r
+"239 c black",\r
+"240 c black",\r
+"241 c black",\r
+"242 c black",\r
+"243 c black",\r
+"244 c black",\r
+"245 c black",\r
+"246 c black",\r
+"247 c black",\r
+"248 c black",\r
+"249 c black",\r
+"250 c black",\r
+"251 c black",\r
+"252 c black",\r
+"253 c black",\r
+"254 c black",\r
+"255 c black",\r
+"000000000000000000000000000000000000000",\r
+"000001001001002003004005006007008009000",\r
+"000001001002003004005006007008009010000",\r
+"000001002003004005006007008009010011000",\r
+"000002003004005006007008009010011012000",\r
+"000003004005006007008009010011012013000",\r
+"000004005006007008009010011012013014000",\r
+"000005006007008009010011012013014015000",\r
+"000006007008009010011012013014015016000",\r
+"000007008009010011012013014015016017000",\r
+"000008009010011012013014015016017017000",\r
+"000009010011012013014015016017017017000",\r
+"000000000000000000000000000000000000000"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *collapse_xpm[] = {\r
+"11 11 16 2",\r
+"00 c black",\r
+"01 c #848484",\r
+"02 c none",\r
+"03 c gray100",\r
+"04 c gray100",\r
+"05 c gray100",\r
+"06 c gray100",\r
+"07 c gray100",\r
+"08 c gray100",\r
+"09 c gray100",\r
+"10 c gray100",\r
+"11 c gray100",\r
+"12 c gray100",\r
+"13 c gray100",\r
+"14 c gray100",\r
+"15 c gray100",\r
+"0202020202020202020202",\r
+"0101010101010101010101",\r
+"0103030303030303030301",\r
+"0103030303000303030301",\r
+"0103030303000303030301",\r
+"0103030000000000030301",\r
+"0103030303000303030301",\r
+"0103030303000303030301",\r
+"0103030303030303030301",\r
+"0101010101010101010101",\r
+"0202020202020202020202"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *expand_xpm[] = {\r
+"11 11 16 2",\r
+"00 c black",\r
+"01 c #848484",\r
+"02 c none",\r
+"03 c gray100",\r
+"04 c gray100",\r
+"05 c gray100",\r
+"06 c gray100",\r
+"07 c gray100",\r
+"08 c gray100",\r
+"09 c gray100",\r
+"10 c gray100",\r
+"11 c gray100",\r
+"12 c gray100",\r
+"13 c gray100",\r
+"14 c gray100",\r
+"15 c gray100",\r
+"0202020202020202020202",\r
+"0101010101010101010101",\r
+"0103030303030303030301",\r
+"0103030303030303030301",\r
+"0103030303030303030301",\r
+"0103030000000000030301",\r
+"0103030303030303030301",\r
+"0103030303030303030301",\r
+"0103030303030303030301",\r
+"0101010101010101010101",\r
+"0202020202020202020202"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *collapse_xpm[] =\r
+{\r
+/* width height ncolors chars_per_pixel */\r
+"11 11 6 1",\r
+/* colors */\r
+"A c None",\r
+"B c #CCCCCCCCCCCC",\r
+"C c #EEEEEEEEEEEE",\r
+"D c #DDDDDDDDDDDD",\r
+"E c #BBBBBBBBBBBB",\r
+"F c #AAAAAAAAAAAA",\r
+/* pixels */\r
+"ACAAAAAAAAA",\r
+"ABEAAAAAAAA",\r
+"AFEEBAAAAAA",\r
+"AEEFEEDAAAA",\r
+"AEFEFEFBCAA",\r
+"AFEFEFEFEBA",\r
+"AEEEFEFBCAA",\r
+"AEFFEEDAAAA",\r
+"AFEEDAAAAAA",\r
+"ABBCAAAAAAA",\r
+"ACAAAAAAAAA",\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *expand_xpm[] =\r
+{\r
+/* width height ncolors chars_per_pixel */\r
+"11 11 6 1",\r
+/* colors */\r
+"A c None",\r
+"B c #CCCCCCCCCCCC",\r
+"C c #EEEEEEEEEEEE",\r
+"D c #DDDDDDDDDDDD",\r
+"E c #BBBBBBBBBBBB",\r
+"F c #AAAAAAAAAAAA",\r
+/* pixels */\r
+"AAAAAAAAAAA",\r
+"CBFEEFEEFBC",\r
+"ABEFEEFEEEA",\r
+"ACEFEFEFEAA",\r
+"AADEFEFEBAA",\r
+"AAAEEFEEAAA",\r
+"AAADFEFDAAA",\r
+"AAAABFBAAAA",\r
+"AAAACECAAAA",\r
+"AAAAABAAAAA",\r
+"AAAAAAAAAAA",\r
+};\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: tmcimages.h,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/tmcimages.h,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:19 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License\r
+//---------------------------------------------------------------------------\r
+\r
+#ifndef _TMCIMAGES_H_\r
+#define _TMCIMAGES_H_\r
+\r
+// pics for the expand / collapse buttons\r
+#ifdef __APPLE__\r
+ #include "mac_collapse.xpm"\r
+ #include "mac_expand.xpm"\r
+#else\r
+ #ifdef LINUX\r
+ #include "linux_collapse.xpm"\r
+ #include "linux_expand.xpm"\r
+ #else\r
+ #include "default_collapse.xpm"\r
+ #include "default_expand.xpm"\r
+ #endif\r
+#endif\r
+\r
+#if(CHECKBOXVIEW)\r
+ // icons for checkbox states\r
+ #ifdef WINDOWS\r
+ #include "win_unchecked_icon.xpm"\r
+ #include "win_checked_icon.xpm"\r
+ #include "win_tristate_icon.xpm"\r
+ #else\r
+ #include "default_unchecked_icon.xpm"\r
+ #include "default_checked_icon.xpm"\r
+ #include "default_tristate_icon.xpm"\r
+ #endif // WINDOWS\r
+#endif // #if(CHECKBOXVIEW)\r
+\r
+#endif // _TMCIMAGES_H_\r
--- /dev/null
+/* XPM */\r
+static char *checked_icon[] = {\r
+"13 13 256 3",\r
+"000 c #1C5180",\r
+"001 c #21A121",\r
+"002 c #E2E2DD",\r
+"003 c #E3E3DF",\r
+"004 c #E5E5E1",\r
+"005 c #E7E7E3",\r
+"006 c #EAEAE6",\r
+"007 c #ECECE9",\r
+"008 c #EFEFEC",\r
+"009 c #F1F1EF",\r
+"010 c #F3F3F1",\r
+"011 c #F5F5F3",\r
+"012 c #F7F7F6",\r
+"013 c #F9F9F8",\r
+"014 c #FAFAF9",\r
+"015 c #FCFCFB",\r
+"016 c #FDFDFD",\r
+"017 c #FEFEFE",\r
+"018 c gray100",\r
+"019 c black",\r
+"020 c black",\r
+"021 c black",\r
+"022 c black",\r
+"023 c black",\r
+"024 c black",\r
+"025 c black",\r
+"026 c black",\r
+"027 c black",\r
+"028 c black",\r
+"029 c black",\r
+"030 c black",\r
+"031 c black",\r
+"032 c black",\r
+"033 c black",\r
+"034 c black",\r
+"035 c black",\r
+"036 c black",\r
+"037 c black",\r
+"038 c black",\r
+"039 c black",\r
+"040 c black",\r
+"041 c black",\r
+"042 c black",\r
+"043 c black",\r
+"044 c black",\r
+"045 c black",\r
+"046 c black",\r
+"047 c black",\r
+"048 c black",\r
+"049 c black",\r
+"050 c black",\r
+"051 c black",\r
+"052 c black",\r
+"053 c black",\r
+"054 c black",\r
+"055 c black",\r
+"056 c black",\r
+"057 c black",\r
+"058 c black",\r
+"059 c black",\r
+"060 c black",\r
+"061 c black",\r
+"062 c black",\r
+"063 c black",\r
+"064 c black",\r
+"065 c black",\r
+"066 c black",\r
+"067 c black",\r
+"068 c black",\r
+"069 c black",\r
+"070 c black",\r
+"071 c black",\r
+"072 c black",\r
+"073 c black",\r
+"074 c black",\r
+"075 c black",\r
+"076 c black",\r
+"077 c black",\r
+"078 c black",\r
+"079 c black",\r
+"080 c black",\r
+"081 c black",\r
+"082 c black",\r
+"083 c black",\r
+"084 c black",\r
+"085 c black",\r
+"086 c black",\r
+"087 c black",\r
+"088 c black",\r
+"089 c black",\r
+"090 c black",\r
+"091 c black",\r
+"092 c black",\r
+"093 c black",\r
+"094 c black",\r
+"095 c black",\r
+"096 c black",\r
+"097 c black",\r
+"098 c black",\r
+"099 c black",\r
+"100 c black",\r
+"101 c black",\r
+"102 c black",\r
+"103 c black",\r
+"104 c black",\r
+"105 c black",\r
+"106 c black",\r
+"107 c black",\r
+"108 c black",\r
+"109 c black",\r
+"110 c black",\r
+"111 c black",\r
+"112 c black",\r
+"113 c black",\r
+"114 c black",\r
+"115 c black",\r
+"116 c black",\r
+"117 c black",\r
+"118 c black",\r
+"119 c black",\r
+"120 c black",\r
+"121 c black",\r
+"122 c black",\r
+"123 c black",\r
+"124 c black",\r
+"125 c black",\r
+"126 c black",\r
+"127 c black",\r
+"128 c black",\r
+"129 c black",\r
+"130 c black",\r
+"131 c black",\r
+"132 c black",\r
+"133 c black",\r
+"134 c black",\r
+"135 c black",\r
+"136 c black",\r
+"137 c black",\r
+"138 c black",\r
+"139 c black",\r
+"140 c black",\r
+"141 c black",\r
+"142 c black",\r
+"143 c black",\r
+"144 c black",\r
+"145 c black",\r
+"146 c black",\r
+"147 c black",\r
+"148 c black",\r
+"149 c black",\r
+"150 c black",\r
+"151 c black",\r
+"152 c black",\r
+"153 c black",\r
+"154 c black",\r
+"155 c black",\r
+"156 c black",\r
+"157 c black",\r
+"158 c black",\r
+"159 c black",\r
+"160 c black",\r
+"161 c black",\r
+"162 c black",\r
+"163 c black",\r
+"164 c black",\r
+"165 c black",\r
+"166 c black",\r
+"167 c black",\r
+"168 c black",\r
+"169 c black",\r
+"170 c black",\r
+"171 c black",\r
+"172 c black",\r
+"173 c black",\r
+"174 c black",\r
+"175 c black",\r
+"176 c black",\r
+"177 c black",\r
+"178 c black",\r
+"179 c black",\r
+"180 c black",\r
+"181 c black",\r
+"182 c black",\r
+"183 c black",\r
+"184 c black",\r
+"185 c black",\r
+"186 c black",\r
+"187 c black",\r
+"188 c black",\r
+"189 c black",\r
+"190 c black",\r
+"191 c black",\r
+"192 c black",\r
+"193 c black",\r
+"194 c black",\r
+"195 c black",\r
+"196 c black",\r
+"197 c black",\r
+"198 c black",\r
+"199 c black",\r
+"200 c black",\r
+"201 c black",\r
+"202 c black",\r
+"203 c black",\r
+"204 c black",\r
+"205 c black",\r
+"206 c black",\r
+"207 c black",\r
+"208 c black",\r
+"209 c black",\r
+"210 c black",\r
+"211 c black",\r
+"212 c black",\r
+"213 c black",\r
+"214 c black",\r
+"215 c black",\r
+"216 c black",\r
+"217 c black",\r
+"218 c black",\r
+"219 c black",\r
+"220 c black",\r
+"221 c black",\r
+"222 c black",\r
+"223 c black",\r
+"224 c black",\r
+"225 c black",\r
+"226 c black",\r
+"227 c black",\r
+"228 c black",\r
+"229 c black",\r
+"230 c black",\r
+"231 c black",\r
+"232 c black",\r
+"233 c black",\r
+"234 c black",\r
+"235 c black",\r
+"236 c black",\r
+"237 c black",\r
+"238 c black",\r
+"239 c black",\r
+"240 c black",\r
+"241 c black",\r
+"242 c black",\r
+"243 c black",\r
+"244 c black",\r
+"245 c black",\r
+"246 c black",\r
+"247 c black",\r
+"248 c black",\r
+"249 c black",\r
+"250 c black",\r
+"251 c black",\r
+"252 c black",\r
+"253 c black",\r
+"254 c black",\r
+"255 c black",\r
+"000000000000000000000000000000000000000",\r
+"000002002002003004005006007008009010000",\r
+"000002002003004005006007008009010011000",\r
+"000002003004005006007008009001011012000",\r
+"000003004005006007008009001001012013000",\r
+"000004005001007008009001001001013014000",\r
+"000005006001001009001001001013014015000",\r
+"000006007001001001001001013014015016000",\r
+"000007008009001001001013014015016017000",\r
+"000008009010011001013014015016017018000",\r
+"000009010011012013014015016017018018000",\r
+"000010011012013014015016017018018018000",\r
+"000000000000000000000000000000000000000"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *tristate_icon[] = {\r
+"13 13 256 3",\r
+"000 c #1C5180",\r
+"001 c #6DBB6C",\r
+"002 c #6EBC6C",\r
+"003 c #6FBD6D",\r
+"004 c #70BE6F",\r
+"005 c #71BF70",\r
+"006 c #72C071",\r
+"007 c #73C172",\r
+"008 c #73C273",\r
+"009 c #74C274",\r
+"010 c #75C374",\r
+"011 c #75C475",\r
+"012 c #76C476",\r
+"013 c #76C576",\r
+"014 c #E2E2DD",\r
+"015 c #E3E3DF",\r
+"016 c #E5E5E1",\r
+"017 c #E7E7E3",\r
+"018 c #EAEAE6",\r
+"019 c #ECECE9",\r
+"020 c #EFEFEC",\r
+"021 c #F1F1EF",\r
+"022 c #F3F3F1",\r
+"023 c #F5F5F3",\r
+"024 c #F7F7F6",\r
+"025 c #F9F9F8",\r
+"026 c #FAFAF9",\r
+"027 c #FCFCFB",\r
+"028 c #FDFDFD",\r
+"029 c #FEFEFE",\r
+"030 c gray100",\r
+"031 c black",\r
+"032 c black",\r
+"033 c black",\r
+"034 c black",\r
+"035 c black",\r
+"036 c black",\r
+"037 c black",\r
+"038 c black",\r
+"039 c black",\r
+"040 c black",\r
+"041 c black",\r
+"042 c black",\r
+"043 c black",\r
+"044 c black",\r
+"045 c black",\r
+"046 c black",\r
+"047 c black",\r
+"048 c black",\r
+"049 c black",\r
+"050 c black",\r
+"051 c black",\r
+"052 c black",\r
+"053 c black",\r
+"054 c black",\r
+"055 c black",\r
+"056 c black",\r
+"057 c black",\r
+"058 c black",\r
+"059 c black",\r
+"060 c black",\r
+"061 c black",\r
+"062 c black",\r
+"063 c black",\r
+"064 c black",\r
+"065 c black",\r
+"066 c black",\r
+"067 c black",\r
+"068 c black",\r
+"069 c black",\r
+"070 c black",\r
+"071 c black",\r
+"072 c black",\r
+"073 c black",\r
+"074 c black",\r
+"075 c black",\r
+"076 c black",\r
+"077 c black",\r
+"078 c black",\r
+"079 c black",\r
+"080 c black",\r
+"081 c black",\r
+"082 c black",\r
+"083 c black",\r
+"084 c black",\r
+"085 c black",\r
+"086 c black",\r
+"087 c black",\r
+"088 c black",\r
+"089 c black",\r
+"090 c black",\r
+"091 c black",\r
+"092 c black",\r
+"093 c black",\r
+"094 c black",\r
+"095 c black",\r
+"096 c black",\r
+"097 c black",\r
+"098 c black",\r
+"099 c black",\r
+"100 c black",\r
+"101 c black",\r
+"102 c black",\r
+"103 c black",\r
+"104 c black",\r
+"105 c black",\r
+"106 c black",\r
+"107 c black",\r
+"108 c black",\r
+"109 c black",\r
+"110 c black",\r
+"111 c black",\r
+"112 c black",\r
+"113 c black",\r
+"114 c black",\r
+"115 c black",\r
+"116 c black",\r
+"117 c black",\r
+"118 c black",\r
+"119 c black",\r
+"120 c black",\r
+"121 c black",\r
+"122 c black",\r
+"123 c black",\r
+"124 c black",\r
+"125 c black",\r
+"126 c black",\r
+"127 c black",\r
+"128 c black",\r
+"129 c black",\r
+"130 c black",\r
+"131 c black",\r
+"132 c black",\r
+"133 c black",\r
+"134 c black",\r
+"135 c black",\r
+"136 c black",\r
+"137 c black",\r
+"138 c black",\r
+"139 c black",\r
+"140 c black",\r
+"141 c black",\r
+"142 c black",\r
+"143 c black",\r
+"144 c black",\r
+"145 c black",\r
+"146 c black",\r
+"147 c black",\r
+"148 c black",\r
+"149 c black",\r
+"150 c black",\r
+"151 c black",\r
+"152 c black",\r
+"153 c black",\r
+"154 c black",\r
+"155 c black",\r
+"156 c black",\r
+"157 c black",\r
+"158 c black",\r
+"159 c black",\r
+"160 c black",\r
+"161 c black",\r
+"162 c black",\r
+"163 c black",\r
+"164 c black",\r
+"165 c black",\r
+"166 c black",\r
+"167 c black",\r
+"168 c black",\r
+"169 c black",\r
+"170 c black",\r
+"171 c black",\r
+"172 c black",\r
+"173 c black",\r
+"174 c black",\r
+"175 c black",\r
+"176 c black",\r
+"177 c black",\r
+"178 c black",\r
+"179 c black",\r
+"180 c black",\r
+"181 c black",\r
+"182 c black",\r
+"183 c black",\r
+"184 c black",\r
+"185 c black",\r
+"186 c black",\r
+"187 c black",\r
+"188 c black",\r
+"189 c black",\r
+"190 c black",\r
+"191 c black",\r
+"192 c black",\r
+"193 c black",\r
+"194 c black",\r
+"195 c black",\r
+"196 c black",\r
+"197 c black",\r
+"198 c black",\r
+"199 c black",\r
+"200 c black",\r
+"201 c black",\r
+"202 c black",\r
+"203 c black",\r
+"204 c black",\r
+"205 c black",\r
+"206 c black",\r
+"207 c black",\r
+"208 c black",\r
+"209 c black",\r
+"210 c black",\r
+"211 c black",\r
+"212 c black",\r
+"213 c black",\r
+"214 c black",\r
+"215 c black",\r
+"216 c black",\r
+"217 c black",\r
+"218 c black",\r
+"219 c black",\r
+"220 c black",\r
+"221 c black",\r
+"222 c black",\r
+"223 c black",\r
+"224 c black",\r
+"225 c black",\r
+"226 c black",\r
+"227 c black",\r
+"228 c black",\r
+"229 c black",\r
+"230 c black",\r
+"231 c black",\r
+"232 c black",\r
+"233 c black",\r
+"234 c black",\r
+"235 c black",\r
+"236 c black",\r
+"237 c black",\r
+"238 c black",\r
+"239 c black",\r
+"240 c black",\r
+"241 c black",\r
+"242 c black",\r
+"243 c black",\r
+"244 c black",\r
+"245 c black",\r
+"246 c black",\r
+"247 c black",\r
+"248 c black",\r
+"249 c black",\r
+"250 c black",\r
+"251 c black",\r
+"252 c black",\r
+"253 c black",\r
+"254 c black",\r
+"255 c black",\r
+"000000000000000000000000000000000000000",\r
+"000014014014015016017018019020021022000",\r
+"000014014015016017018019020021022023000",\r
+"000014015001002003004005006007023024000",\r
+"000015016002003004005006007008024025000",\r
+"000016017003004005006007008009025026000",\r
+"000017018004005006007008009010026027000",\r
+"000018019005006007008009010011027028000",\r
+"000019020006007008009010011012028029000",\r
+"000020021007008009010011012013029030000",\r
+"000021022023024025026027028029030030000",\r
+"000022023024025026027028029030030030000",\r
+"000000000000000000000000000000000000000"\r
+};\r
--- /dev/null
+/* XPM */\r
+static char *unchecked_icon[] = {\r
+"13 13 256 3",\r
+"000 c #1C5180",\r
+"001 c #DCDCD7",\r
+"002 c #DEDED9",\r
+"003 c #E0E0DB",\r
+"004 c #E2E2DE",\r
+"005 c #E5E5E2",\r
+"006 c #E8E8E5",\r
+"007 c #ECECE9",\r
+"008 c #EFEFEC",\r
+"009 c #F1F1EF",\r
+"010 c #F3F3F1",\r
+"011 c #F5F5F4",\r
+"012 c #F7F7F6",\r
+"013 c #F9F9F8",\r
+"014 c #FBFBFA",\r
+"015 c #FDFDFC",\r
+"016 c #FEFEFE",\r
+"017 c gray100",\r
+"018 c black",\r
+"019 c black",\r
+"020 c black",\r
+"021 c black",\r
+"022 c black",\r
+"023 c black",\r
+"024 c black",\r
+"025 c black",\r
+"026 c black",\r
+"027 c black",\r
+"028 c black",\r
+"029 c black",\r
+"030 c black",\r
+"031 c black",\r
+"032 c black",\r
+"033 c black",\r
+"034 c black",\r
+"035 c black",\r
+"036 c black",\r
+"037 c black",\r
+"038 c black",\r
+"039 c black",\r
+"040 c black",\r
+"041 c black",\r
+"042 c black",\r
+"043 c black",\r
+"044 c black",\r
+"045 c black",\r
+"046 c black",\r
+"047 c black",\r
+"048 c black",\r
+"049 c black",\r
+"050 c black",\r
+"051 c black",\r
+"052 c black",\r
+"053 c black",\r
+"054 c black",\r
+"055 c black",\r
+"056 c black",\r
+"057 c black",\r
+"058 c black",\r
+"059 c black",\r
+"060 c black",\r
+"061 c black",\r
+"062 c black",\r
+"063 c black",\r
+"064 c black",\r
+"065 c black",\r
+"066 c black",\r
+"067 c black",\r
+"068 c black",\r
+"069 c black",\r
+"070 c black",\r
+"071 c black",\r
+"072 c black",\r
+"073 c black",\r
+"074 c black",\r
+"075 c black",\r
+"076 c black",\r
+"077 c black",\r
+"078 c black",\r
+"079 c black",\r
+"080 c black",\r
+"081 c black",\r
+"082 c black",\r
+"083 c black",\r
+"084 c black",\r
+"085 c black",\r
+"086 c black",\r
+"087 c black",\r
+"088 c black",\r
+"089 c black",\r
+"090 c black",\r
+"091 c black",\r
+"092 c black",\r
+"093 c black",\r
+"094 c black",\r
+"095 c black",\r
+"096 c black",\r
+"097 c black",\r
+"098 c black",\r
+"099 c black",\r
+"100 c black",\r
+"101 c black",\r
+"102 c black",\r
+"103 c black",\r
+"104 c black",\r
+"105 c black",\r
+"106 c black",\r
+"107 c black",\r
+"108 c black",\r
+"109 c black",\r
+"110 c black",\r
+"111 c black",\r
+"112 c black",\r
+"113 c black",\r
+"114 c black",\r
+"115 c black",\r
+"116 c black",\r
+"117 c black",\r
+"118 c black",\r
+"119 c black",\r
+"120 c black",\r
+"121 c black",\r
+"122 c black",\r
+"123 c black",\r
+"124 c black",\r
+"125 c black",\r
+"126 c black",\r
+"127 c black",\r
+"128 c black",\r
+"129 c black",\r
+"130 c black",\r
+"131 c black",\r
+"132 c black",\r
+"133 c black",\r
+"134 c black",\r
+"135 c black",\r
+"136 c black",\r
+"137 c black",\r
+"138 c black",\r
+"139 c black",\r
+"140 c black",\r
+"141 c black",\r
+"142 c black",\r
+"143 c black",\r
+"144 c black",\r
+"145 c black",\r
+"146 c black",\r
+"147 c black",\r
+"148 c black",\r
+"149 c black",\r
+"150 c black",\r
+"151 c black",\r
+"152 c black",\r
+"153 c black",\r
+"154 c black",\r
+"155 c black",\r
+"156 c black",\r
+"157 c black",\r
+"158 c black",\r
+"159 c black",\r
+"160 c black",\r
+"161 c black",\r
+"162 c black",\r
+"163 c black",\r
+"164 c black",\r
+"165 c black",\r
+"166 c black",\r
+"167 c black",\r
+"168 c black",\r
+"169 c black",\r
+"170 c black",\r
+"171 c black",\r
+"172 c black",\r
+"173 c black",\r
+"174 c black",\r
+"175 c black",\r
+"176 c black",\r
+"177 c black",\r
+"178 c black",\r
+"179 c black",\r
+"180 c black",\r
+"181 c black",\r
+"182 c black",\r
+"183 c black",\r
+"184 c black",\r
+"185 c black",\r
+"186 c black",\r
+"187 c black",\r
+"188 c black",\r
+"189 c black",\r
+"190 c black",\r
+"191 c black",\r
+"192 c black",\r
+"193 c black",\r
+"194 c black",\r
+"195 c black",\r
+"196 c black",\r
+"197 c black",\r
+"198 c black",\r
+"199 c black",\r
+"200 c black",\r
+"201 c black",\r
+"202 c black",\r
+"203 c black",\r
+"204 c black",\r
+"205 c black",\r
+"206 c black",\r
+"207 c black",\r
+"208 c black",\r
+"209 c black",\r
+"210 c black",\r
+"211 c black",\r
+"212 c black",\r
+"213 c black",\r
+"214 c black",\r
+"215 c black",\r
+"216 c black",\r
+"217 c black",\r
+"218 c black",\r
+"219 c black",\r
+"220 c black",\r
+"221 c black",\r
+"222 c black",\r
+"223 c black",\r
+"224 c black",\r
+"225 c black",\r
+"226 c black",\r
+"227 c black",\r
+"228 c black",\r
+"229 c black",\r
+"230 c black",\r
+"231 c black",\r
+"232 c black",\r
+"233 c black",\r
+"234 c black",\r
+"235 c black",\r
+"236 c black",\r
+"237 c black",\r
+"238 c black",\r
+"239 c black",\r
+"240 c black",\r
+"241 c black",\r
+"242 c black",\r
+"243 c black",\r
+"244 c black",\r
+"245 c black",\r
+"246 c black",\r
+"247 c black",\r
+"248 c black",\r
+"249 c black",\r
+"250 c black",\r
+"251 c black",\r
+"252 c black",\r
+"253 c black",\r
+"254 c black",\r
+"255 c black",\r
+"000000000000000000000000000000000000000",\r
+"000001001001002003004005006007008009000",\r
+"000001001002003004005006007008009010000",\r
+"000001002003004005006007008009010011000",\r
+"000002003004005006007008009010011012000",\r
+"000003004005006007008009010011012013000",\r
+"000004005006007008009010011012013014000",\r
+"000005006007008009010011012013014015000",\r
+"000006007008009010011012013014015016000",\r
+"000007008009010011012013014015016017000",\r
+"000008009010011012013014015016017017000",\r
+"000009010011012013014015016017017017000",\r
+"000000000000000000000000000000000000000"\r
+};\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: wxTreeMultiCtrl.cpp,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/wxTreeMultiCtrl.cpp,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:19 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License\r
+//---------------------------------------------------------------------------\r
+\r
+#ifdef __GNUG__\r
+ #pragma implementation "wxTreeMultiCtrl.h"\r
+#endif\r
+\r
+// For compilers that support precompilation, includes "wx/wx.h".\r
+#include "wx/wxprec.h"\r
+#include "wx/treebase.h"\r
+\r
+#ifdef __BORLANDC__\r
+ #pragma hdrstop\r
+#endif\r
+\r
+#include "wx/arrimpl.cpp"\r
+\r
+#include "wx/treemultictrl/wxTreeMultiCtrl.h"\r
+#include "wx/treemultictrl/wxTreeMultiEvent.h"\r
+#include "tmcimages.h"\r
+\r
+\r
+\r
+//----------------------------------------------------------------------------\r
+// wxTreeMultiItem\r
+//----------------------------------------------------------------------------\r
+\r
+WX_DEFINE_OBJARRAY(wxArrayTreeMultiItem);\r
+\r
+//----------------------------------------------------------------------------\r
+// wxTreeMultiCtrl\r
+//----------------------------------------------------------------------------\r
+\r
+IMPLEMENT_DYNAMIC_CLASS(wxTreeMultiCtrl, wxScrolledWindow)\r
+\r
+// WDR: event table for wxTreeMultiCtrl\r
+BEGIN_EVENT_TABLE(wxTreeMultiCtrl, wxScrolledWindow)\r
+ EVT_LEFT_DOWN (wxTreeMultiCtrl::OnMouseClick)\r
+ EVT_LEFT_DCLICK(wxTreeMultiCtrl::OnMouseClick)\r
+ EVT_RIGHT_DOWN (wxTreeMultiCtrl::OnRightMouseClick)\r
+ EVT_PAINT(wxTreeMultiCtrl::OnPaint)\r
+ EVT_SIZE(wxTreeMultiCtrl::OnSize)\r
+// EVT_KEY_UP(wxTreeMultiCtrl::OnKey)\r
+END_EVENT_TABLE()\r
+\r
+bool wxTreeMultiCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,\r
+ const wxSize& size, long style, const wxValidator & WXUNUSED(validator),\r
+ const wxString& name )\r
+{\r
+ wxScrolledWindow::Create( parent, id, pos, size, style | wxTAB_TRAVERSAL, name);\r
+\r
+ _create_called = true;\r
+\r
+ // do the init\r
+ Init();\r
+\r
+ return TRUE;\r
+}\r
+\r
+void wxTreeMultiCtrl::Init()\r
+{\r
+ _root.Clear();\r
+\r
+ _expandBmp = 0;\r
+ _collBmp = 0;\r
+\r
+#if(CHECKBOXVIEW)\r
+ _checkBmp = 0;\r
+ _uncheckBmp = 0;\r
+ _tristateBmp = 0;\r
+\r
+ _checkHeight = 11;\r
+ _checkWidth = 11;\r
+\r
+ _checkboxView = false;\r
+#endif\r
+\r
+ _gutterWidth = WXTMC_GUTTER_DEFAULT;\r
+ _iconWidth = 11;\r
+ _iconHeight = 11;\r
+ _maxHeight = 1;;\r
+ _iconDeltaY = 2;\r
+ _spacingY = WXTMC_YSPACING_DEFAULT;\r
+ _captionHeight = 13;\r
+\r
+ // create two bitmap nodes for drawing\r
+\r
+ _expandBmp = new wxBitmap(expand_xpm);\r
+ _collBmp = new wxBitmap(collapse_xpm);\r
+\r
+ // calculate average font height for bitmap centering\r
+\r
+ _iconWidth = _expandBmp->GetWidth();\r
+ _iconHeight = _expandBmp->GetHeight();\r
+\r
+#if(CHECKBOXVIEW)\r
+ // create bitmaps for checkboxes\r
+ _checkBmp = new wxBitmap(checked_icon);\r
+ _uncheckBmp = new wxBitmap(unchecked_icon);\r
+ _tristateBmp = new wxBitmap(tristate_icon);\r
+\r
+ // adjust the height if the checkboxes are higher\r
+ // so that everything is alligned properly\r
+ _checkHeight = _checkBmp->GetHeight();\r
+ _checkWidth = _checkBmp->GetWidth();\r
+#endif\r
+\r
+ // remember the highest of the two bitmaps so there is\r
+ // always enough room\r
+ _maxHeight = _iconHeight;\r
+\r
+#if(CHECKBOXVIEW)\r
+ if(_maxHeight < _checkHeight)\r
+ _maxHeight = _checkHeight;\r
+#endif\r
+\r
+ // set standard highlighting brush\r
+ this->m_HilightBrush = new wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT),wxSOLID);\r
+\r
+ // set standard DC font\r
+ _captionFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);\r
+\r
+ // adjust bitmap icon y position so they are centered\r
+ AdjustIconsDeltaY();\r
+\r
+ // set virtual size to this window size\r
+ if (_create_called) {\r
+ wxSize wndsize = GetSize();\r
+ SetVirtualSize(wndsize.GetWidth(), wndsize.GetWidth());\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::SetCaptionFont(const wxFont &font)\r
+{\r
+ _captionFont = font;\r
+\r
+ // adjust the icons so that they are in the middle\r
+ AdjustIconsDeltaY();\r
+\r
+ RedrawFromNode(0);\r
+};\r
+\r
+void wxTreeMultiCtrl::AdjustIconsDeltaY()\r
+{\r
+ int x = 0, y = 0;\r
+\r
+ if(_captionFont.Ok())\r
+ GetTextExtent(wxT("jG"), &x, &y, 0, 0, &_captionFont);\r
+ _captionHeight = y;\r
+\r
+ if(_maxHeight < _captionHeight)\r
+ _maxHeight = _captionHeight;\r
+\r
+ // determine the center pos for the [+]\r
+ _iconDeltaY = abs(_maxHeight - _iconHeight) / 2 + 1;\r
+ if(_iconDeltaY < 1)\r
+ _iconDeltaY = 1;\r
+\r
+#if(CHECKBOXVIEW)\r
+ // determine the center pos for the checkbox\r
+ _checkDeltaY = abs(_maxHeight - _checkHeight) / 2 + 1;\r
+ if(_checkDeltaY < 1)\r
+ _checkDeltaY = 1;\r
+#endif\r
+}\r
+\r
+wxTreeMultiCtrl::~wxTreeMultiCtrl()\r
+{\r
+ // delete the bitmap resources\r
+ delete _expandBmp;\r
+ delete _collBmp;\r
+\r
+#if(CHECKBOXVIEW)\r
+ delete _checkBmp;\r
+ delete _uncheckBmp;\r
+ delete _tristateBmp;\r
+#endif\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::AddRoot(const wxString &caption, const wxString &name)\r
+{\r
+ wxTreeMultiItem result((TreeMultiItemBase *)&_root);\r
+ result = AppendNode(result, caption, name);\r
+\r
+ return result;\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::AppendWindow(const wxTreeMultiItem &ParentItem, wxWindow *window, const wxString &name, const wxTreeMultiWindowInfo &info, int flags)\r
+{\r
+ // add window only if the parent item is valid and...\r
+ wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));\r
+\r
+ TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes\r
+\r
+ // ... is a node\r
+ wxCHECK(parent != NULL, wxTreeMultiItem(0));\r
+\r
+ // now, append node to the tree control:\r
+ wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,wx_static_cast(size_t,parent->GetNodeCount()),window,name,info,flags));\r
+ // redraw the stucture:\r
+ this->RedrawFromNode(parent);\r
+ // return the new window\r
+ return NewWindowItem;\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::InsertWindow(wxTreeMultiItem const& ParentItem, size_t Position, wxWindow *window, wxString const& name, wxTreeMultiWindowInfo const& info, int flags)\r
+{\r
+ // add window only if the parent item is valid and...\r
+ wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));\r
+\r
+ TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes\r
+\r
+ // ... is a node\r
+ wxCHECK(parent != NULL, wxTreeMultiItem(0));\r
+\r
+ // now, append node to the tree control:\r
+ wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,Position,window,name,info,flags));\r
+ // redraw the stucture:\r
+ this->RedrawFromNode(parent);\r
+ // return the new window\r
+ return NewWindowItem;\r
+} /* wxTreeMultiCtrl::InsertWindow(wxTreeMultiItem const&, size_t, wxWindow*, wxString const&, wxTreeMultiWindowInfo const&, int) */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::PrependWindow(wxTreeMultiItem const& ParentItem, wxWindow *window, const wxString &name, wxTreeMultiWindowInfo const& info, int flags)\r
+{\r
+ // add window only if the parent item is valid and...\r
+ wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));\r
+\r
+ TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes\r
+\r
+ // ... is a node\r
+ wxCHECK(parent != NULL, wxTreeMultiItem(0));\r
+\r
+ // now, append node to the tree control:\r
+ wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,0,window,name,info,flags));\r
+ // redraw the stucture:\r
+ this->RedrawFromNode(parent);\r
+ // return the new window\r
+ return NewWindowItem;\r
+} /* wxTreeMultiCtrl::PrependWindow(wxTreeMultiItem const&, wxWindow*, const wxString &, wxTreeMultiWindowInfo const&, int) */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::AppendNode(wxTreeMultiItem const& ParentItem, const wxString &caption, const wxString &name)\r
+{\r
+ // add window only if the parent item is valid and...\r
+ wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));\r
+\r
+ TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes\r
+\r
+ // ... is a node\r
+ wxCHECK(parent != NULL, wxTreeMultiItem(0));\r
+\r
+ // now, append node to the tree control:\r
+ wxTreeMultiItem NewNodeItem(this->InsertNode(parent,wx_static_cast(size_t,parent->GetNodeCount()),caption,name));\r
+ // redraw the structure:\r
+ this->RedrawFromNode(parent);\r
+ // return the new node:\r
+ return NewNodeItem;\r
+} /* wxTreeMultiCtrl::AppendNode(wxTreeMultiItem const&, const wxString &, const wxString&) */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::InsertNode(wxTreeMultiItem const& ParentItem, size_t Position, wxString const& caption, wxString const& name)\r
+{\r
+ // add window only if the parent item is valid and...\r
+ wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));\r
+\r
+ TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes\r
+\r
+ // ... is a node\r
+ wxCHECK(parent != NULL, wxTreeMultiItem(0));\r
+\r
+ // now, append node to the tree control:\r
+ wxTreeMultiItem NewNodeItem(this->InsertNode(parent,Position,caption,name));\r
+ // redraw the structure:\r
+ this->RedrawFromNode(parent);\r
+ // return the new node:\r
+ return NewNodeItem;\r
+} /* wxTreeMultiCtrl::InsertNode(wxTreeMultiItem const&, size_t, wxString const&, wxString const&) */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::PrependNode(wxTreeMultiItem const& ParentItem, wxString const& caption, wxString const& name)\r
+{\r
+ // add window only if the parent item is valid and...\r
+ wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));\r
+\r
+ TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes\r
+\r
+ // ... is a node\r
+ wxCHECK(parent != NULL, wxTreeMultiItem(0));\r
+\r
+ // now, append node to the tree control:\r
+ wxTreeMultiItem NewNodeItem(this->InsertNode(parent,0,caption,name));\r
+ // redraw the structure:\r
+ this->RedrawFromNode(parent);\r
+ // return the new node:\r
+ return NewNodeItem;\r
+} /* wxTreeMultiCtrl::PrependNode(wxTreeMultiItem const&, wxString const&, wxString const&) */\r
+\r
+bool wxTreeMultiCtrl::Delete(wxTreeMultiItem &item)\r
+{\r
+ bool redraw = true;\r
+ wxCHECK(item.IsOk(), false);\r
+\r
+ wxTreeMultiItem nullItem(0);\r
+\r
+\r
+ // if item has been selected, remove it from the selected list:\r
+ size_t ItemIndex(this->GetSelectedItemIndex(item));\r
+\r
+ if (ItemIndex != this->GetSelectedItemCount())\r
+ this->m_SelectedItems.RemoveAt(ItemIndex);\r
+\r
+ // get parent, to delete item from\r
+ TreeMultiItemNode *p = item.GetItem()->GetParent();\r
+\r
+ // first check if it was visible, if so from the parent off\r
+ // it needs redrawing\r
+ redraw = item.GetItem()->IsVisible();\r
+ if(p)\r
+ p->DeleteNode(item.GetItem());\r
+ else\r
+ _root.DeleteNode(item.GetItem());\r
+\r
+ item = nullItem;\r
+\r
+ // do redraw when node was visible\r
+ if(redraw)\r
+ RedrawFromNode(p);\r
+\r
+ return true;\r
+}\r
+\r
+void wxTreeMultiCtrl::DeleteChildren(const wxTreeMultiItem &item)\r
+{\r
+ if(item.IsNodeItem())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();\r
+\r
+ // remove all children from the selected item list:\r
+ if (n->GetNodeCount() > 0)\r
+ {\r
+ // variable definitions and initializations:\r
+ int Cookie;\r
+ wxTreeMultiItem FirstItemIterator(this->GetFirstChild(item,Cookie)), LastItemIterator(this->GetLastChild(item));\r
+\r
+ for (;;)\r
+ {\r
+ size_t ItemIndex(this->GetSelectedItemIndex(item)); // variable definition and initialization\r
+\r
+ if (ItemIndex != this->GetSelectedItemCount())\r
+ this->m_SelectedItems.RemoveAt(ItemIndex);\r
+ if (FirstItemIterator == LastItemIterator)\r
+ break; // all children checked\r
+ else\r
+ FirstItemIterator = this->GetNext(FirstItemIterator);\r
+ } /* for */\r
+ } /* if */\r
+ // delete children:\r
+ n->Clear();\r
+ // redraw:\r
+ RedrawFromNode(n);\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::Expand(const wxTreeMultiItem &item, bool recursive)\r
+{\r
+ if(item.IsOk())\r
+ {\r
+ TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();\r
+ if(!n)\r
+ n = item.GetItem()->GetParent();\r
+ DoFold(n, true, recursive);\r
+ RedrawFromNode(item.GetItem()->IsTreeMultiItemNode());\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::Collapse(const wxTreeMultiItem &item, bool recursive)\r
+{\r
+ if(item.IsOk())\r
+ {\r
+ TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();\r
+ if(!n)\r
+ n = item.GetItem()->GetParent();\r
+ DoFold(n, false, recursive);\r
+ RedrawFromNode(item.GetItem()->IsTreeMultiItemNode());\r
+ }\r
+}\r
+\r
+\r
+void wxTreeMultiCtrl::ExpandNodes(bool recursive)\r
+{\r
+ // go through all children and call DoFold recursively\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ DoFold(_root.GetNode(i), true, recursive);\r
+ RedrawFromNode(0);\r
+}\r
+\r
+void wxTreeMultiCtrl::CollapseNodes(bool recursive)\r
+{\r
+ // go through all children and call DoFold recursively\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ DoFold(_root.GetNode(i), false, recursive);\r
+ RedrawFromNode(0);\r
+}\r
+\r
+void wxTreeMultiCtrl::CollapseAndReset(const wxTreeMultiItem &item)\r
+{\r
+ if(item.IsNodeItem())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();\r
+\r
+ // delete all kids\r
+ n->Clear();\r
+ Collapse(item, false);\r
+ }\r
+}\r
+\r
+// Selection manipulation\r
+wxTreeMultiItem wxTreeMultiCtrl::GetFirstSelectedItem(void) const\r
+{\r
+ if (this->GetSelectedItemCount() > 0)\r
+ return this->m_SelectedItems[0];\r
+ else\r
+ return wxTreeMultiItem();\r
+} /* wxTreeMultiCtrl::GetFirstSelectedItem(void) const */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetLastSelectedItem(void) const\r
+{\r
+ if (this->GetSelectedItemCount() > 0)\r
+ return this->m_SelectedItems[this->GetSelectedItemCount()-1];\r
+ else\r
+ return wxTreeMultiItem();\r
+} /* wxTreeMultiCtrl::GetLastSelectedItem(void) const */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetSelectedItem(size_t Index) const\r
+{\r
+ if (Index < this->GetSelectedItemCount())\r
+ return this->m_SelectedItems[Index];\r
+ else\r
+ return wxTreeMultiItem();\r
+} /* wxTreeMultiCtrl::GetSelectedItem(size_t Index) const */\r
+\r
+size_t wxTreeMultiCtrl::GetSelectedItemIndex(wxTreeMultiItem const& Item) const\r
+{\r
+ // attention: the function wxArray::Index() can NOT be used in a save manner as it only checks the address of an item\r
+ // element but it is not guaranteed that Item may not be a copy of the originally inserted item\r
+ const size_t NoOfSelectedItems = this->GetSelectedItemCount();\r
+\r
+ size_t Index(0);\r
+\r
+\r
+ while ((Index < NoOfSelectedItems) && (this->m_SelectedItems[Index] != Item))\r
+ ++Index;\r
+ return Index;\r
+} /* wxTreeMultiCtrl::GetSelectedItemIndex(wxTreeMultiItem const&) const */\r
+\r
+void wxTreeMultiCtrl::SelectItem(wxTreeMultiItem const& Item, bool UnselectOthers, bool ExpandSelection)\r
+{\r
+ TreeMultiItemNode* NodePtr(Item.GetItem()->IsTreeMultiItemNode());\r
+\r
+\r
+ // only nodes can be selected and they can only be selected if they are not already selected:\r
+ if ((NodePtr == NULL) || NodePtr->IsSelected())\r
+ return;\r
+\r
+ // inform that we are about to change:\r
+ wxTreeMultiEvent Event(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGING,Item); // variable definition and initialization\r
+\r
+ if (this->m_SelectedItems.GetCount() > 0) // the last item in the array is always the latest inserted item\r
+ Event.SetOldItem(this->m_SelectedItems.Last());\r
+ Event.SetEventObject(this);\r
+ if (this->GetEventHandler()->ProcessEvent(Event) && !(Event.IsAllowed()))\r
+ return; // vetoed\r
+\r
+ // make sure that the to be selected item can be seen:\r
+ this->Include(Item);\r
+\r
+ // variable definition and initialization:\r
+ wxTreeMultiItem ExcludedParent(this->GetExcludedParent(Item));\r
+\r
+ while (ExcludedParent.IsOk())\r
+ {\r
+ this->Include(ExcludedParent);\r
+ ExcludedParent = this->GetExcludedParent(Item);\r
+ } /* while */\r
+\r
+ // unselect items if necessary:\r
+ if (UnselectOthers)\r
+ this->UnselectAll();\r
+ // expand selection if necessary:\r
+ if (ExpandSelection)\r
+ {\r
+ // variable definition:\r
+ wxTreeMultiItem FirstItemIterator, LastItemIterator;\r
+ wxTreeMultiItem LastSelectedItem;\r
+\r
+ // determine the last selected item or the first item in case nothing has been selected before:\r
+ if (this->m_SelectedItems.GetCount() > 0)\r
+ LastSelectedItem = this->m_SelectedItems.Last();\r
+ else\r
+ LastSelectedItem = this->GetFirstRoot();\r
+ // determine the item from which to start and the one with which to end the selection:\r
+ if (Item.GetItem()->GetY() > LastSelectedItem.GetItem()->GetY())\r
+ {\r
+ FirstItemIterator = LastSelectedItem;\r
+ LastItemIterator = Item;\r
+ } /* if */\r
+ else\r
+ {\r
+ FirstItemIterator = Item;\r
+ LastItemIterator = LastSelectedItem;\r
+ } /* if */\r
+ // select all items that are a node and are placed between the two limiting iterators (included the limits):\r
+ for (;;)\r
+ {\r
+ if (!(FirstItemIterator.IsSelected()) && FirstItemIterator.IsNodeItem())\r
+ {\r
+ FirstItemIterator.GetItem()->Select();\r
+ this->m_SelectedItems.Add(FirstItemIterator);\r
+ this->RefreshRect(wxRect(FirstItemIterator.GetItem()->GetX(), FirstItemIterator.GetItem()->GetY(),\r
+ FirstItemIterator.GetItem()->GetWidth(),FirstItemIterator.GetItem()->GetHeight()));\r
+ } /* if */\r
+ if (FirstItemIterator == LastItemIterator)\r
+ break; // done\r
+ // continue iterating:\r
+ FirstItemIterator = this->GetNext(FirstItemIterator);\r
+ } /* for */\r
+ } /* if */\r
+ else // select passed item only\r
+ {\r
+ NodePtr->Select();\r
+ this->m_SelectedItems.Add(NodePtr);\r
+ this->RefreshRect(wxRect(NodePtr->GetX(),NodePtr->GetY(),NodePtr->GetWidth(),NodePtr->GetHeight()));\r
+ } /* if */\r
+\r
+ // inform that we have selected the item:\r
+ Event.SetEventType(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGED);\r
+ this->GetEventHandler()->ProcessEvent(Event);\r
+} /* wxTreeMultiCtrl::SelectItem(wxTreeMultiItem const&, bool, bool) */\r
+\r
+void wxTreeMultiCtrl::UnselectAll(void)\r
+{\r
+ const size_t NoOfSelectedItems = this->m_SelectedItems.GetCount();\r
+\r
+\r
+ for (size_t i=0; i<NoOfSelectedItems; ++i)\r
+ {\r
+ this->RefreshRect(wxRect(this->m_SelectedItems[i].GetItem()->GetX(), this->m_SelectedItems[i].GetItem()->GetY(),\r
+ this->m_SelectedItems[i].GetItem()->GetWidth(),this->m_SelectedItems[i].GetItem()->GetHeight()));\r
+ this->m_SelectedItems[i].GetItem()->Unselect();\r
+ } /* for */\r
+ this->m_SelectedItems.Clear();\r
+} /* wxTreeMultiCtrl::UnselectAll(void) */\r
+\r
+void wxTreeMultiCtrl::Unselect(wxTreeMultiItem const& Item)\r
+{\r
+ size_t ItemIndex(this->GetSelectedItemIndex(Item));\r
+\r
+\r
+ if (ItemIndex != this->GetSelectedItemCount())\r
+ {\r
+ Item.GetItem()->Unselect();\r
+ this->m_SelectedItems.RemoveAt(ItemIndex);\r
+ this->RefreshRect(wxRect(Item.GetItem()->GetX(),Item.GetItem()->GetY(),Item.GetItem()->GetWidth(),Item.GetItem()->GetHeight()));\r
+ } /* if */\r
+} /* wxTreeMultiCtrl::Unselect(wxTreeMultiItem const&) */\r
+\r
+void wxTreeMultiCtrl::DoFold(TreeMultiItemBase *item, bool expand, bool recursive)\r
+{\r
+\r
+ // go through all node objects on this level, and expand or\r
+ // collapse them\r
+\r
+ if(item == 0)\r
+ return;\r
+\r
+ // if this is a node, use it to go through all the subnodes (if needed)\r
+ // if not, then just exit.\r
+\r
+ TreeMultiItemNode *node = item->IsTreeMultiItemNode();\r
+ if(node)\r
+ {\r
+ node->Fold(expand);\r
+\r
+ // go recursive\r
+ if(recursive)\r
+ {\r
+ TreeMultiItemNode *p;\r
+ for(int i = 0; i < node->GetNodeCount(); i++)\r
+ {\r
+ // get node, and if a real node, then call fold\r
+ p = node->GetNode(i)->IsTreeMultiItemNode();\r
+ if(p)\r
+ p->Fold(expand);\r
+\r
+ // go recursive for every node\r
+ DoFold(p, expand, recursive);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::Exclude(const wxTreeMultiItem &item)\r
+{\r
+ wxCHECK2(item.IsOk(), return);\r
+\r
+ // exclude the item, and refresh\r
+ // if already excluded, skip\r
+\r
+ if(!item.GetItem()->IsExcluded())\r
+ {\r
+ item.GetItem()->SetExcluded(true);\r
+ RedrawFromParentNode(item.GetItem());\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::Include(const wxTreeMultiItem &item)\r
+{\r
+ wxCHECK2(item.IsOk(), return);\r
+\r
+ // include the item, and refresh. If not\r
+ // excluded, do nothing\r
+\r
+ if(item.GetItem()->IsExcluded())\r
+ {\r
+ item.GetItem()->SetExcluded(false);\r
+ RedrawFromParentNode(item.GetItem());\r
+ }\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetExcludedParent(const wxTreeMultiItem &item)\r
+{\r
+ wxCHECK(item.IsOk(), wxTreeMultiItem(0));\r
+\r
+ // go find the parent (including this one) that\r
+ // can be the excluded one\r
+\r
+ TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();\r
+ if(n && n->IsExcluded())\r
+ return wxTreeMultiItem(n);\r
+\r
+ n = item.GetItem()->GetParent();\r
+ while(n)\r
+ {\r
+ if(n->IsExcluded())\r
+ return wxTreeMultiItem(n);\r
+ else\r
+ n = n->GetParent();\r
+ }\r
+\r
+ return wxTreeMultiItem(0);\r
+}\r
+\r
+void wxTreeMultiCtrl::OnSize(wxSizeEvent &WXUNUSED(event))\r
+{\r
+ RecalculateSpanSizes();\r
+}\r
+\r
+void wxTreeMultiCtrl::OnPaint(wxPaintEvent& WXUNUSED(event) )\r
+{\r
+ wxPaintDC dc(this);\r
+\r
+ PrepareDC(dc);\r
+\r
+ // go recursive and draw the whole visible tree.\r
+ dc.SetFont(_captionFont);\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ DrawNode(_root.GetNode(i), dc);\r
+}\r
+\r
+void wxTreeMultiCtrl::DrawNode(TreeMultiItemBase *b, wxDC &dc)\r
+{\r
+ // go through this item .. if it is a node, draw\r
+ // the caption, else reposition the window.\r
+\r
+ if(!b)\r
+ return;\r
+\r
+ // forget it if this node is not visible\r
+ if(b->IsVisible())\r
+ {\r
+ int bmpOffsetX = b->GetX() - (_gutterWidth + _iconWidth);\r
+\r
+#if(CHECKBOXVIEW)\r
+ // now draw the checkbox if there is any, in the proper state\r
+ if(b->GetCheckbox())\r
+ {\r
+ DrawCheckbox(b, dc);\r
+\r
+ // adjust the bmpOffset because we also have a checkbox\r
+ bmpOffsetX -= _checkWidth;\r
+ }\r
+#endif\r
+\r
+ if(b->IsTreeMultiItemNode())\r
+ {\r
+ // draw the node icon and the caption\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)b;\r
+\r
+ // set background of caption item\r
+ if (n->IsSelected())\r
+ {\r
+ dc.SetBrush(*(this->m_HilightBrush));\r
+ dc.SetPen(wxPen(this->m_HilightBrush->GetColour(),1,wxSOLID));\r
+ } /* if */\r
+ else\r
+ {\r
+ dc.SetBrush(wxBrush(*wxWHITE,wxSOLID));\r
+ dc.SetPen(wxPen(*wxWHITE,1,wxSOLID));\r
+ } /* if */\r
+ dc.DrawRectangle(n->GetX(),n->GetY(),n->GetWidth(),n->GetHeight());\r
+ // draw caption\r
+ dc.DrawText(n->GetCaption(), n->GetX(), n->GetY());\r
+\r
+ // draw the bitmap for the state\r
+ if(n->IsExpanded())\r
+ dc.DrawBitmap(*_expandBmp, bmpOffsetX, n->GetY() + _iconDeltaY, true);\r
+ else\r
+ dc.DrawBitmap(*_collBmp, bmpOffsetX, n->GetY() + _iconDeltaY, true);\r
+\r
+ // now go through all the subnodes\r
+ for(int i = 0; i < n->GetNodeCount(); i++)\r
+ DrawNode(n->GetNode(i), dc);\r
+\r
+ }\r
+ }\r
+}\r
+\r
+#if(CHECKBOXVIEW)\r
+\r
+void wxTreeMultiCtrl::DrawCheckbox(TreeMultiItemBase *b, wxDC &dc, bool convertScrolled)\r
+{\r
+ wxCHECK2(b, return);\r
+\r
+ wxBitmap *bmp;\r
+ int bmpOffsetX = b->GetX() - (_gutterWidth + _iconWidth);\r
+\r
+ switch(b->GetCheckboxState())\r
+ {\r
+ case 0:\r
+ bmp = _uncheckBmp;\r
+ break;\r
+ case 1:\r
+ bmp = _checkBmp;\r
+ break;\r
+ default:\r
+ bmp = _tristateBmp;\r
+ break;\r
+ }\r
+\r
+ int x, xx, y, yy;\r
+\r
+ if(b->IsTreeMultiItemWindow())\r
+ {\r
+ xx = x = bmpOffsetX - ((TreeMultiItemWindow *)b)->GetFrontSpacing() + _checkWidth;\r
+ yy = y = b->GetY() + _checkDeltaY;\r
+ }\r
+ else\r
+ {\r
+ xx = x = bmpOffsetX;\r
+ yy = y = b->GetY() + _checkDeltaY;\r
+ }\r
+\r
+ if(convertScrolled)\r
+ CalcScrolledPosition(x, y, &xx, &yy);\r
+\r
+ dc.DrawBitmap(*bmp, xx, yy, true);\r
+}\r
+\r
+#endif // #if(CHECKBOXVIEW)\r
+\r
+void wxTreeMultiCtrl::OnKey(wxKeyEvent &event)\r
+{\r
+ // check if we need to traverse to upper or lower\r
+ // control in the list\r
+ if(event.GetKeyCode() == WXK_TAB)\r
+ {\r
+ wxTreeMultiItem item = GetFocus();\r
+ if(item.IsOk())\r
+ {\r
+ // traverse down direction\r
+ if(!event.ShiftDown())\r
+ item = FindNextVisibleWindowItem(item.GetItem());\r
+ //else // traverse in up direction\r
+ // item = FindPreviousVisibleWindowItem(item);\r
+\r
+ if(item.IsOk())\r
+ {\r
+ TreeMultiItemWindow *w = item.GetItem()->IsTreeMultiItemWindow();\r
+ if(w)\r
+ {\r
+ wxWindow *wnd = w->GetWindow();\r
+ wnd->SetFocus();\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ event.Skip();\r
+}\r
+\r
+void wxTreeMultiCtrl::OnMouseClick( wxMouseEvent &event )\r
+{\r
+ // react on double click and left mouse down\r
+ if(event.LeftDown() || event.LeftDClick())\r
+ {\r
+ // get translation point\r
+ wxPoint pt( event.GetPosition() );\r
+\r
+ int x = 0, y = 0;\r
+ CalcUnscrolledPosition( pt.x, pt.y, &x, &y );\r
+\r
+ // go check if we clicked a treenode\r
+ int flags;\r
+ wxPoint p(x,y);\r
+ wxTreeMultiItem id = HitTest(p, flags);\r
+\r
+#if(CHECKBOXVIEW)\r
+ if(flags == wxTMC_HITTEST_CHECKBOX)\r
+ {\r
+ // toggle the checkbox, and redraw\r
+ if(id.IsOk())\r
+ {\r
+ TreeMultiItemBase *b = id.GetItem();\r
+ b->SetCheckboxState((b->GetCheckboxState()+1) & 0x1);\r
+\r
+ TreeMultiItemWindow *w = b->IsTreeMultiItemWindow();\r
+ if(w)\r
+ {\r
+ // try to force a focus on the window. This could\r
+ // be extended by searching for the first edit control\r
+ // class but for now, just a focus is tried.\r
+ w->GetWindow()->Enable(b->GetCheckboxState() == 1);\r
+ w->GetWindow()->SetFocus();\r
+\r
+ // draw the checkbox in the state needed\r
+ wxClientDC dc(this);\r
+ DrawCheckbox(b, dc, true);\r
+\r
+ // TODO: determine if the upper parents should be\r
+ // tristated or not\r
+\r
+ ScanTristateCheckstates(b);\r
+\r
+ }\r
+ else if(b->IsTreeMultiItemNode())\r
+ {\r
+ // descend to all the children and set the state of the parent\r
+ SetRecursiveCheckState((TreeMultiItemNode *)b, b->GetCheckboxState() == 1);\r
+ RedrawFromNode((TreeMultiItemNode *)b);\r
+ }\r
+ }\r
+ }\r
+ else\r
+#endif // #if(CHECKBOXVIEW)\r
+ {\r
+ // react on left mouse button, to fold and on\r
+ // right for caption doubleclick\r
+ int area = -1;\r
+\r
+// adjust behaviour for Linux (single click = always fold)\r
+#ifndef LINUX\r
+ if(event.LeftDClick())\r
+ area = wxTMC_HITTEST_CAPTION;\r
+ else\r
+ area = wxTMC_HITTEST_GUTTER;\r
+#else\r
+ area = flags;\r
+#endif\r
+\r
+// Linux (single or double click -> always fold\r
+ if (id.IsOk())\r
+ {\r
+#ifdef LINUX\r
+ // we have a valid item, if it is a node, then fold\r
+ TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode();\r
+ if(n)\r
+ {\r
+ this->SelectItem(id);\r
+ Fold(n, !n->IsExpanded());\r
+ } /* if */\r
+#else\r
+ if (event.LeftDown())\r
+ if (flags == wxTMC_HITTEST_GUTTER)\r
+ {\r
+ TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode(); // for some reasons also windows may have set the flag\r
+\r
+ if (n != NULL)\r
+ Fold(n, !n->IsExpanded());\r
+ } /* if */\r
+ else if (flags == wxTMC_HITTEST_CAPTION)\r
+ {\r
+ TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode(); // for some reasons also windows may have set the flag\r
+\r
+ if (n != NULL)\r
+ {\r
+ this->SelectItem(id);\r
+ this->RedrawFromNode(n);\r
+ } /* if */\r
+ } /* if */\r
+#endif\r
+ } /* if */\r
+ else\r
+ this->UnselectAll();\r
+ }\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::OnRightMouseClick(wxMouseEvent& Event)\r
+{\r
+ if (Event.RightDown())\r
+ if (Event.Dragging())\r
+ this->UnselectAll();\r
+ else\r
+ {\r
+ // variable definitions:\r
+ int Flags;\r
+ wxPoint Point;\r
+\r
+ // translate mouse coordinates:\r
+ CalcUnscrolledPosition(Event.GetPosition().x,Event.GetPosition().y,&(Point.x),&(Point.y));\r
+ // check if the mouse is above the caption of an item:\r
+ wxTreeMultiItem Item(this->HitTest(Point,Flags)); // variable definition and initialization\r
+\r
+ if (Item.IsOk() && (Flags == wxTMC_HITTEST_CAPTION))\r
+ {\r
+ this->SelectItem(Item);\r
+ this->RedrawFromNode(Item.GetItem()->IsTreeMultiItemNode());\r
+ Event.Skip(); // window will convert right mouse click to a context menu event or proceed with\r
+ // a right mouse click event if the context menu event cannot be processed\r
+ } /* if */\r
+ else\r
+ this->UnselectAll();\r
+ } /* if */\r
+ else\r
+ this->UnselectAll();\r
+} /* wxTreeMultiCtrl::OnRightMouseClick(wxMouseEvent&) */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::HitTest(wxPoint const& pt, int &flags)\r
+{\r
+ // scan all nodes to see which one matches\r
+ TreeMultiItemBase *b = 0;\r
+ for(int i = 0; i < _root.GetNodeCount() && !b; i++)\r
+ b = FindNodeByPoint(_root.GetNode(i), pt, flags);\r
+\r
+ if(!b)\r
+ {\r
+ // none found, reset\r
+ flags = 0;\r
+ return wxTreeMultiItem(0);\r
+ }\r
+\r
+ // return an item\r
+ return wxTreeMultiItem(b);\r
+}\r
+\r
+TreeMultiItemBase *wxTreeMultiCtrl::FindNodeByPoint(TreeMultiItemBase *b, wxPoint const& pt, int &area)\r
+{\r
+ wxCHECK(b, 0);\r
+\r
+ // if this layer is not visible, return with nothing.\r
+ if(!b->IsVisible())\r
+ return 0;\r
+\r
+ area = 0;\r
+\r
+ // now see if our y is matching the mouse\r
+ if(pt.y >= b->GetY() && pt.y < (b->GetY() + b->GetHeight()))\r
+ {\r
+#if(CHECKBOXVIEW)\r
+ // if we are checkboxed, calculate the checkbox position\r
+ if(b->GetCheckbox())\r
+ {\r
+ int extraSpacing = 0, extraWidth = 0;\r
+\r
+ // now for a windows item, this is minus the gutter. For a normal node it is X minus checkbox\r
+ if(b->IsTreeMultiItemWindow())\r
+ {\r
+ extraWidth = _checkWidth;\r
+ extraSpacing = ((TreeMultiItemWindow *)b)->GetFrontSpacing();\r
+ }\r
+ else\r
+ extraSpacing = 4;\r
+\r
+ if(pt.x > (b->GetX() - extraSpacing - _checkWidth) && pt.x < (b->GetX() - extraSpacing + extraWidth))\r
+ {\r
+ area = wxTMC_HITTEST_CHECKBOX;\r
+ return b;\r
+ }\r
+ }\r
+#endif\r
+\r
+ // allrighty we have something, now where and what is it (look with x)\r
+ if(pt.x < b->GetX())\r
+ area = wxTMC_HITTEST_GUTTER;\r
+\r
+ /** \todo Match only the real part of the caption, window (we assume x > GetX() which is the rest)\r
+ HOWEVER the window probably doesn't propagate the click event back to the parent, so we might\r
+ leave it like this so the use can click behind a window so it will be selected.\r
+ */\r
+ else\r
+ {\r
+ // inside area, return proper flag\r
+ if(b->IsTreeMultiItemNode())\r
+ area = wxTMC_HITTEST_CAPTION;\r
+ else\r
+ area = wxTMC_HITTEST_WINDOW;\r
+ }\r
+\r
+ return b;\r
+ }\r
+ else\r
+ {\r
+ // not found, let's try our children if we have some\r
+ TreeMultiItemNode *n = b->IsTreeMultiItemNode();\r
+ if(n)\r
+ {\r
+ TreeMultiItemBase *bb = 0;\r
+ for(int i = 0; i < n->GetNodeCount() && !bb; i++)\r
+ bb = FindNodeByPoint(n->GetNode(i), pt, area);\r
+\r
+ // keep returning result to caller\r
+ return bb;\r
+ }\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetFocus()\r
+{\r
+ wxWindow *wnd = wxWindow::FindFocus();\r
+\r
+ // now find window that holds this item. if not\r
+ // visible it cannot have focus (should not have)\r
+\r
+ wxTreeMultiItem item = FindWindowNode(wnd);\r
+ if(item.IsOk() && item.GetItem()->IsVisible())\r
+ return item;\r
+\r
+ return wxTreeMultiItem(0);\r
+}\r
+\r
+#if(CHECKBOXVIEW)\r
+\r
+void wxTreeMultiCtrl::SetRecursiveCheckState(TreeMultiItemNode *n, bool check)\r
+{\r
+ int state = 0;\r
+ if(check)\r
+ state++;\r
+\r
+ // go check all kids on this level\r
+ for(int i = 0; i < n->GetNodeCount(); i++)\r
+ {\r
+ // check all the nodes, and go deeper\r
+ n->GetNode(i)->SetCheckboxState(state);\r
+ if(n->GetNode(i)->IsTreeMultiItemNode())\r
+ SetRecursiveCheckState((TreeMultiItemNode *)n->GetNode(i), check);\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::ScanTristateCheckstates(TreeMultiItemBase *b)\r
+{\r
+ // check from the parent on, all node entries and see if they are\r
+ // checked or cleared or scattered\r
+ TreeMultiItemNode *p = b->GetParent();\r
+\r
+ if(p && p->GetCheckbox())\r
+ {\r
+ bool foundcheck = false, foundclear = false;\r
+ for(size_t i = 0; i < (size_t)p->GetNodeCount(); ++i)\r
+ {\r
+ // only evaluate when checkboxed\r
+ if(p->GetNode(i)->IsTreeMultiItemWindow() && p->GetNode(i)->GetCheckbox())\r
+ {\r
+ // record instance of a cleared checkbox\r
+ if(!p->GetNode(i)->GetCheckboxState())\r
+ foundclear = true;\r
+ // record instance of checked checkbox\r
+ if(p->GetNode(i)->GetCheckboxState() == 1)\r
+ foundcheck = true;\r
+ }\r
+ }\r
+\r
+ // if we have both check and clear, go tristate\r
+ // if all clear, clear parent and if all set, then set parent\r
+ if(foundclear && !foundcheck)\r
+ p->SetCheckboxState(0);\r
+ else if(!foundclear && foundcheck)\r
+ p->SetCheckboxState(1);\r
+ else if(foundclear && foundcheck)\r
+ p->SetCheckboxState(2);\r
+\r
+ //wxClientDC dc;\r
+ //DrawCheckbox(p, dc, false);\r
+ RedrawFromNode(p);\r
+ }\r
+}\r
+\r
+#endif // #if(CHECKBOXVIEW)\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::InsertNode(TreeMultiItemNode* ParentPtr, size_t Position, wxString const& Caption, wxString const& Name)\r
+{\r
+ int extX, extY;\r
+\r
+ TreeMultiItemNode* NodePtr(new TreeMultiItemNode(ParentPtr,Caption,Name)); // generate new node pointer\r
+\r
+\r
+ // continue with initializing the new node:\r
+#if(CHECKBOXVIEW)\r
+ // if checkbox view is desired, tag this item as a checkbox\r
+ // and set the state as 'false'\r
+ NodePtr->SetCheckbox(_checkboxView);\r
+ NodePtr->SetCheckboxState(0);\r
+#endif\r
+ // calculate the height and width\r
+ this->GetTextExtent(Caption,&extX,&extY,0,0,&(this->_captionFont));\r
+ NodePtr->SetHeight(extY);\r
+ NodePtr->SetWidth(extX);\r
+ // finally, insert node:\r
+ if (Position < (size_t)ParentPtr->GetNodeCount())\r
+ ParentPtr->InsertNode(NodePtr,Position);\r
+ else\r
+ ParentPtr->AddNode(NodePtr);\r
+ // return the newly created node:\r
+ return wxTreeMultiItem(NodePtr);\r
+} /* wxTreeMultiCtrl::InsertNode(TreeMultiItemNode*, size_t, wxString const&, wxString const&) */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::InsertWindow(TreeMultiItemNode* ParentPtr, size_t Position, wxWindow* WindowPtr, wxString const& Name, wxTreeMultiWindowInfo const& Info, int Flags)\r
+{\r
+ int WindowFlags;\r
+\r
+ TreeMultiItemWindow* NewWindowPtr = new TreeMultiItemWindow(ParentPtr,Name); // generate new window pointer\r
+\r
+\r
+ // get flags from passed variable "Flags"; in case this variable does not contain any flags use the window's information flags:\r
+ if (Flags != 0)\r
+ WindowFlags = Flags;\r
+ else\r
+ WindowFlags = Info.GetFlags();\r
+\r
+ // continue with initializing the new window:\r
+#if(CHECKBOXVIEW)\r
+ // if checkbox view is desired, tag this item as a checkbox\r
+ // and set the state as 'false'\r
+ NewWindowPtr->SetCheckbox(_checkboxView);\r
+#endif\r
+ // if style wants us to change background, set it to our background\r
+ if (WindowFlags & wxTMC_BG_ADJUST_ALL)\r
+ {\r
+ // go through all children of this window, and set the\r
+ // background of it (recursively)\r
+ this->SetWindowBackgroundColour(WindowPtr,this->GetBackgroundColour(),WindowFlags);\r
+ } /* if */\r
+\r
+ // set the spacing:\r
+ NewWindowPtr->SetTopSpacing(Info.GetTopSpacing());\r
+#if(CHECKBOXVIEW)\r
+ // make sure that the checkboxes are at least indented enough\r
+ if (this->_checkboxView)\r
+ NewWindowPtr->SetFrontSpacing(Info.GetFrontSpacing() + this->_checkWidth);\r
+ else\r
+#endif\r
+ NewWindowPtr->SetFrontSpacing(Info.GetFrontSpacing());\r
+ // assign finally the window:\r
+ NewWindowPtr->AssignWindow(WindowPtr);\r
+\r
+#if(CHECKBOXVIEW)\r
+ // set the checkbox state after the window is assigned\r
+ NewWindowPtr->SetCheckboxState(Info.GetDefaultCheckState());\r
+#endif\r
+\r
+ // if the window is not visible, set hide flag\r
+ this->ShowTreeMultiWindow(NewWindowPtr,NewWindowPtr->IsVisible());\r
+\r
+ // finally, insert the newly constructed window:\r
+ if (Position < (size_t)ParentPtr->GetNodeCount())\r
+ ParentPtr->InsertNode(NewWindowPtr,Position);\r
+ else\r
+ ParentPtr->AddNode(NewWindowPtr);\r
+ // return the newly created window:\r
+ return wxTreeMultiItem(NewWindowPtr);\r
+} /* wxTreeMultiCtrl::InsertWindow(TreeMultiItemNode*, size_t, wxWindow*, wxString const&, wxTreeMultiWindowInfo const&, int) */\r
+\r
+void wxTreeMultiCtrl::RedrawFromParentNode(TreeMultiItemBase *n)\r
+{\r
+ TreeMultiItemNode *p = 0;\r
+ if(n)\r
+ p = n->GetParent();\r
+\r
+ RedrawFromNode(p);\r
+}\r
+\r
+void wxTreeMultiCtrl::RedrawFromNode(TreeMultiItemNode *n)\r
+{\r
+ static int recalcMutex = 0;\r
+ bool visible = true;\r
+\r
+ if(recalcMutex > 0)\r
+ return;\r
+\r
+ recalcMutex ++;\r
+\r
+ // when node is not visible or excluded\r
+ // then don't redraw.\r
+\r
+ if(n)\r
+ visible = n->IsVisible();\r
+\r
+ if(visible)\r
+ {\r
+ int h, h1,w, w1;\r
+ GetVirtualSize(&w, &h);\r
+\r
+ UpdateAllWindowVisibility();\r
+ RecalculateNodePositions();\r
+ RecalculateVirtualSize();\r
+\r
+ // why is this needed? Because folding or collapsing can change\r
+ // the state. When the virtual area gets smaller, we need to keep\r
+ // the largest one and the other way atound. And since we do not\r
+ // know here we are folding or collapsing, we remember the biggest\r
+ GetVirtualSize(&w1, &h1);\r
+\r
+ if(h1 > h)\r
+ h = h1;\r
+\r
+ // only refresh the part from x,y down\r
+ if(n)\r
+ {\r
+ int x, y;\r
+ CalcScrolledPosition(n->GetX(), n->GetY(), &x, &y);\r
+ if(h - y > 0)\r
+ {\r
+ wxRect rect(0, y, w, h - y);\r
+ RefreshRect(rect);\r
+ }\r
+ else\r
+ Refresh();\r
+ }\r
+ else\r
+ Refresh(); // do a full refresh\r
+ }\r
+\r
+ recalcMutex --;\r
+}\r
+\r
+void wxTreeMultiCtrl::RecalculateNodePositions()\r
+{\r
+ int currentY = _spacingY;\r
+ // go recursive on every node, and store the information in the node\r
+\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ currentY += CalculateNodeDimensions(_root.GetNode(i), currentY, 0);\r
+}\r
+\r
+int wxTreeMultiCtrl::CalculateNodeDimensions(TreeMultiItemBase *b, int currentY, int level)\r
+{\r
+ int gutter = (_gutterWidth * 2) + _iconWidth;\r
+ int y = 0, topSpacing = 0;\r
+\r
+ // return same if no proper object\r
+ wxCHECK(b, 0);\r
+\r
+#if(CHECKBOXVIEW)\r
+ if(b->GetCheckbox())\r
+ gutter += _checkWidth;\r
+#endif\r
+\r
+ // if we are not visible, skip recalculation and descending\r
+ if(b->IsVisible())\r
+ {\r
+ b->SetY(currentY);\r
+\r
+ // if level is 0, calculate with front gutter, else without\r
+ y = currentY + b->GetHeight();\r
+ if(b->IsTreeMultiItemNode())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)b;\r
+\r
+ if(level == 0)\r
+ b->SetX(gutter);\r
+ else\r
+ b->SetX(gutter + (level * (_gutterWidth + _iconWidth)));\r
+\r
+ // now do children of this node\r
+\r
+ for(int i = 0; i < n->GetNodeCount(); i++)\r
+ y += CalculateNodeDimensions(n->GetNode(i), y + _spacingY, level+1);\r
+ }\r
+ else if(b->IsTreeMultiItemWindow())\r
+ {\r
+ TreeMultiItemWindow *w = (TreeMultiItemWindow *)b;\r
+\r
+ if(level == 0)\r
+ b->SetX(gutter + w->GetFrontSpacing());\r
+ else\r
+ b->SetX(_gutterWidth + (level * (_gutterWidth + _iconWidth)) + w->GetFrontSpacing());\r
+\r
+ topSpacing = w->GetTopSpacing();\r
+\r
+ // reposition the window\r
+\r
+ wxWindow *wnd = w->GetWindow();\r
+ if(wnd)\r
+ {\r
+ int x = 0, y = 0;\r
+ CalcScrolledPosition(w->GetX(), w->GetY(), &x, &y);\r
+ wnd->SetSize(x, y, w->GetWidth(), w->GetHeight());\r
+ }\r
+ }\r
+\r
+ if(y > 0)\r
+ return (y - currentY) + _spacingY + topSpacing; // return delta\r
+ else\r
+ return 0;\r
+ }\r
+\r
+ return 0; // not visible, thus we skip calculations\r
+}\r
+\r
+void wxTreeMultiCtrl::RecalculateSpanSizes()\r
+{\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ CalculateNodeSpanning(_root.GetNode(i));\r
+}\r
+\r
+void wxTreeMultiCtrl::CalculateNodeSpanning(TreeMultiItemBase *b)\r
+{\r
+ // return same if no proper object\r
+ wxCHECK2(b, return);\r
+\r
+ if(b->IsTreeMultiItemNode())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)b;\r
+\r
+ // now do children of this node\r
+\r
+ for(int i = 0; i < n->GetNodeCount(); i++)\r
+ CalculateNodeSpanning(n->GetNode(i));\r
+ }\r
+ else if(b->IsTreeMultiItemWindow())\r
+ {\r
+ TreeMultiItemWindow *w = (TreeMultiItemWindow *)b;\r
+ wxWindow *wnd = w->GetWindow();\r
+ if(wnd)\r
+ {\r
+ // if the window is spanning, we adjust the width to the max width of the control\r
+ if(w->GetHorizontalSpan())\r
+ {\r
+ wxSize tmcsize = GetClientSize();\r
+ int maxwidth = tmcsize.GetWidth() - w->GetX() - 8; // extract 3 for border\r
+\r
+ wxSizer *sz = wnd->GetSizer();\r
+ if(sz)\r
+ {\r
+ if(maxwidth < sz->GetMinSize().GetWidth())\r
+ maxwidth = sz->GetMinSize().GetWidth();\r
+ }\r
+\r
+ // prevent a size of 0\r
+ if(maxwidth < 1)\r
+ maxwidth = 1;\r
+\r
+ // set the size\r
+ w->SetWidth(maxwidth);\r
+ wnd->SetSize(w->GetWidth(), w->GetHeight());\r
+\r
+ // layout by sizer (not sure if this is needed)\r
+ if(wnd->GetSizer())\r
+ wnd->GetSizer()->Layout();\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::RecalculateVirtualSize()\r
+{\r
+ // go through all the nodes, and store the largest x and largest y\r
+\r
+ int x = 0, y = 0;\r
+ RecalculateVirtualSizeFromNode(&_root, x, y);\r
+\r
+ // now adjust virtual size\r
+ SetVirtualSize(x, y);\r
+ AdjustScrollbars(x, y);\r
+}\r
+\r
+void wxTreeMultiCtrl::AdjustScrollbars(int x, int y)\r
+{\r
+ // adjust scrollbars\r
+ // courtesy of treectrlg.cpp\r
+\r
+ y += WXTMC_PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels\r
+ x += WXTMC_PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels\r
+ int x_pos = GetScrollPos( wxHORIZONTAL );\r
+ int y_pos = GetScrollPos( wxVERTICAL );\r
+ SetScrollbars( WXTMC_PIXELS_PER_UNIT, WXTMC_PIXELS_PER_UNIT, x/WXTMC_PIXELS_PER_UNIT,\r
+ y/WXTMC_PIXELS_PER_UNIT, x_pos, y_pos, true );\r
+}\r
+\r
+void wxTreeMultiCtrl::RecalculateVirtualSizeFromNode(const TreeMultiItemNode *node, int &x, int &y)\r
+{\r
+ if(node->IsExcluded())\r
+ return;\r
+\r
+ // if calulate this node's dimensions\r
+ if(x < (node->GetWidth() + node->GetX()))\r
+ x = node->GetWidth() + node->GetX();\r
+\r
+ y = node->GetY() + node->GetHeight();\r
+\r
+ // if this node is collapsed, no subnodes are visible, else\r
+ // go through all subnodes as well, node needs to be included as well\r
+ if(node->IsExpanded())\r
+ {\r
+ TreeMultiItemBase *b;\r
+ for(int i = 0; i < node->GetNodeCount(); i++)\r
+ {\r
+ b = node->GetNode(i);\r
+\r
+ // calculate x and y\r
+ if(x < (b->GetWidth() + b->GetX()))\r
+ x = b->GetWidth() + b->GetX();\r
+\r
+ y = b->GetY() + b->GetHeight();\r
+\r
+ if(b->IsTreeMultiItemNode())\r
+ RecalculateVirtualSizeFromNode((TreeMultiItemNode *)b, x, y);\r
+ }\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::SetWindowBackgroundColour(wxWindow *wnd, const wxColour &col, int flags)\r
+{\r
+ if(wnd)\r
+ {\r
+ // if we cannot change a button, make sure all button\r
+ // classes are not changed\r
+\r
+ wxButton *btn = wxDynamicCast(wnd, wxButton);\r
+ if(!btn || ((flags & wxTMC_BG_ADJUST_BTN) != 0))\r
+ wnd->SetBackgroundColour(col);\r
+\r
+ // get every window, and make the background equal to the given one\r
+ wxWindowListNode *node = wnd->GetChildren().GetFirst();\r
+ while (node)\r
+ {\r
+ SetWindowBackgroundColour(node->GetData(), col, flags);\r
+ node = node->GetNext();\r
+ }\r
+ }\r
+}\r
+\r
+void wxTreeMultiCtrl::ShowTreeMultiWindow(TreeMultiItemWindow *window, bool show)\r
+{\r
+ // show or hide window\r
+ if(window && window->GetWindow())\r
+ window->GetWindow()->Show(show);\r
+}\r
+\r
+void wxTreeMultiCtrl::UpdateAllWindowVisibility()\r
+{\r
+ // all roots are visible, but what lies beneath ... who knows\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ UpdateTreeMultiWindowVisibility(_root.GetNode(i), true);\r
+}\r
+\r
+void wxTreeMultiCtrl::UpdateTreeMultiWindowVisibility(TreeMultiItemBase *b, bool show)\r
+{\r
+ if(b)\r
+ {\r
+ // this is done for performance issues. IsVisible can go all\r
+ // the way up the tree to check. However if show is already\r
+ // false, there is no need to check (some higher one is collapsed)\r
+ bool showMe = show;\r
+\r
+ if(showMe)\r
+ showMe = b->IsVisible();\r
+\r
+ if(b->IsTreeMultiItemWindow())\r
+ {\r
+ // if this level must be hidden, hide\r
+ ShowTreeMultiWindow((TreeMultiItemWindow*)b, showMe);\r
+ }\r
+ else if(b->IsTreeMultiItemNode())\r
+ {\r
+ TreeMultiItemNode *node = (TreeMultiItemNode *)b;\r
+\r
+ // if hidden, descend and hide all windows\r
+ for(int i = 0; i < node->GetNodeCount(); i++)\r
+ UpdateTreeMultiWindowVisibility(node->GetNode(i), showMe);\r
+ }\r
+ }\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::FindItem(const wxTreeMultiItem &item, const wxString &name, bool ignoreCase, bool skipFirst)\r
+{\r
+ if(item.IsOk())\r
+ {\r
+ TreeMultiItemBase *b = item.GetItem();\r
+\r
+ // check this item first (or not)\r
+\r
+ if(!skipFirst)\r
+ {\r
+ if(b->GetName().IsSameAs(name, !ignoreCase))\r
+ return wxTreeMultiItem(b);\r
+ }\r
+\r
+ if(b->IsTreeMultiItemNode())\r
+ {\r
+ // now check whether we are a node, then go check children\r
+\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)b;\r
+ wxTreeMultiItem result(0);\r
+ for(int i = 0; i < n->GetNodeCount() && !result.IsOk(); i++)\r
+ result = FindItem(wxTreeMultiItem(n->GetNode(i)), name, ignoreCase, false);\r
+\r
+ return result;\r
+ }\r
+ }\r
+\r
+ return wxTreeMultiItem(0);\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::FindWindowNode(wxWindow *wnd, TreeMultiItemNode *n)\r
+{\r
+ wxCHECK(wnd, wxTreeMultiItem(0));\r
+\r
+ // take root node if not assigned one\r
+\r
+ if(!n)\r
+ n = (TreeMultiItemNode *)&_root;\r
+\r
+ // check on this level for the wxWindow pointer\r
+\r
+ TreeMultiItemWindow *w;\r
+ wxTreeMultiItem result(0);\r
+ for(int i = 0; i < n->GetNodeCount() && !result.IsOk(); i++)\r
+ {\r
+ // if window node\r
+ w = n->GetNode(i)->IsTreeMultiItemWindow();\r
+ if(w && w->GetWindow() == wnd)\r
+ return wxTreeMultiItem(n);\r
+\r
+ // if node, go deeper\r
+ if(n->GetNode(i)->IsTreeMultiItemNode())\r
+ result = FindWindowNode(wnd, (TreeMultiItemNode*)n->GetNode(i));\r
+ }\r
+\r
+ return result;\r
+}\r
+\r
+TreeMultiItemWindow *wxTreeMultiCtrl::FindNextVisibleWindowItem(TreeMultiItemBase *b, int index)\r
+{\r
+ wxCHECK(b, 0);\r
+\r
+ // check on this level, go deeper with every node we got. When a node is not\r
+ // visible anymore, skip the node.\r
+\r
+ TreeMultiItemWindow *value = 0;\r
+ if(b->IsVisible())\r
+ {\r
+ // if we are already searching on a node with an index\r
+\r
+ TreeMultiItemBase *bn = 0;\r
+ TreeMultiItemNode *n = b->IsTreeMultiItemNode();\r
+ if(n)\r
+ {\r
+ for(int i = index + 1; i < n->GetNodeCount() && !value; i++)\r
+ {\r
+ bn = n->GetNode(i);\r
+ value = bn->IsTreeMultiItemWindow();\r
+\r
+ // assume a node, root when not a a window\r
+ if(!value)\r
+ value = FindNextVisibleWindowItem(bn, -1);\r
+ }\r
+\r
+ }\r
+ else\r
+ {\r
+ if(b->IsTreeMultiItemWindow())\r
+ {\r
+ // get parent first, and locate child as ptr\r
+ TreeMultiItemNode *p = b->GetParent();\r
+ wxCHECK(p, 0);\r
+\r
+ // go scan the parent from the given index, if\r
+ // the index is valid else there is no child with that index\r
+\r
+ int idx = p->Index(b);\r
+ wxCHECK(idx >= 0, 0);\r
+\r
+ value = FindNextVisibleWindowItem(p, idx);\r
+ }\r
+ }\r
+ }\r
+\r
+ return value;\r
+\r
+}\r
+\r
+bool wxTreeMultiCtrl::GetBooleanValue(int wndId)\r
+{\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK(wnd, false);\r
+\r
+ // try a radio button\r
+ wxRadioButton *b = wxDynamicCast(wnd, wxRadioButton);\r
+ if(b)\r
+ return b->GetValue();\r
+\r
+ // try a check box\r
+ wxCheckBox *c = wxDynamicCast(wnd, wxCheckBox);\r
+ if(c)\r
+ return c->GetValue();\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert or just return with false\r
+ wxCHECK(0, false);\r
+}\r
+\r
+void wxTreeMultiCtrl::SetBooleanValue(int wndId, bool value)\r
+{\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK2(wnd, return);\r
+\r
+ // try a radio button\r
+ wxRadioButton *b = wxDynamicCast(wnd, wxRadioButton);\r
+ if(b)\r
+ {\r
+ b->SetValue(value);\r
+ return;\r
+ }\r
+\r
+ // try a check box\r
+ wxCheckBox *c = wxDynamicCast(wnd, wxCheckBox);\r
+ if(c)\r
+ {\r
+ c->SetValue(value);\r
+ return;\r
+ }\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert\r
+ wxCHECK2(0, return);\r
+}\r
+\r
+void wxTreeMultiCtrl::SetTextValue(int wndId, const wxString &value)\r
+{\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK2(wnd, return);\r
+\r
+ // try a radio button\r
+ wxTextCtrl *t = wxDynamicCast(wnd, wxTextCtrl);\r
+ if(t)\r
+ {\r
+ t->SetValue(value);\r
+ return;\r
+ }\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert\r
+ wxCHECK2(0, return);\r
+}\r
+\r
+wxString wxTreeMultiCtrl::GetTextValue(int wndId)\r
+{\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK(wnd, wxEmptyString);\r
+\r
+ // try a radio button\r
+ wxTextCtrl *t = wxDynamicCast(wnd, wxTextCtrl);\r
+ if(t)\r
+ return t->GetValue();\r
+\r
+ // try a choice box\r
+ wxChoice *c1 = wxDynamicCast(wnd, wxChoice);\r
+ if(c1)\r
+ return c1->GetStringSelection();\r
+\r
+ // try a combo box\r
+ wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);\r
+ if(c2)\r
+ return c2->GetStringSelection();\r
+\r
+ // try a listbox\r
+ wxListBox *l = wxDynamicCast(wnd, wxListBox);\r
+ if(l)\r
+ return l->GetStringSelection();\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert or just return with string\r
+ wxCHECK(0, wxEmptyString);\r
+}\r
+\r
+int wxTreeMultiCtrl::GetSelectionValue(int wndId)\r
+{\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK(wnd, -1);\r
+\r
+ // try a choice box\r
+ wxChoice *c1 = wxDynamicCast(wnd, wxChoice);\r
+ if(c1)\r
+ return c1->GetSelection();\r
+\r
+ // try a combo box\r
+ wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);\r
+ if(c2)\r
+ return c2->GetSelection();\r
+\r
+ // try a listbox\r
+ wxListBox *l = wxDynamicCast(wnd, wxListBox);\r
+ if(l)\r
+ return l->GetSelection();\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert or just return with string\r
+ wxCHECK(0, -1);\r
+}\r
+\r
+void wxTreeMultiCtrl::GetSelectionValues(int wndId, wxArrayInt &sels)\r
+{\r
+ sels.Clear();\r
+\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK2(wnd, return);\r
+\r
+ // try a listbox\r
+ wxListBox *l = wxDynamicCast(wnd, wxListBox);\r
+ if(l)\r
+ {\r
+ l->GetSelections(sels);\r
+ return;\r
+ }\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert or just return with string\r
+ wxCHECK2(0, return);\r
+}\r
+\r
+void wxTreeMultiCtrl::SetSelectionValue(int wndId, int sel)\r
+{\r
+ wxWindow *wnd = wxWindow::FindWindow(wndId);\r
+ wxCHECK2(wnd, return);\r
+\r
+ // try a choice box\r
+ wxChoice *c1 = wxDynamicCast(wnd, wxChoice);\r
+ if(c1)\r
+ {\r
+ c1->SetSelection(sel);\r
+ return;\r
+ }\r
+\r
+ // try a combo box\r
+ wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);\r
+ if(c2)\r
+ {\r
+ c2->SetSelection(sel);\r
+ return;\r
+ }\r
+\r
+ // try a listbox\r
+ wxListBox *l = wxDynamicCast(wnd, wxListBox);\r
+ if(l)\r
+ {\r
+ l->SetSelection(sel);\r
+ return;\r
+ }\r
+\r
+ /** \todo For custom controls we should put something in wxMultiTreeItemData class\r
+ which can be overridden to retrieve the boolean value. It will also be passed\r
+ the pointer to the window, so the derived class can figure out how to get a boolean\r
+ value.\r
+ */\r
+\r
+ // generate assert or just return with string\r
+ wxCHECK2(0, return);\r
+}\r
+\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetParent(wxTreeMultiItem const& item) const\r
+{\r
+ // check if valid or root item has been passed, both do not have parents:\r
+ if (!(item.IsOk()) || item.GetItem()->IsTreeMultiItemRoot())\r
+ return wxTreeMultiItem();\r
+ else\r
+ return wxTreeMultiItem(item.GetItem()->GetParent()); // GetParent() returns a valid pointer in case of a root item!!\r
+ // therefore, the check if the passed item is a root item is necessary\r
+} /* wxTreeMultiCtrl::GetParent(wxTreeMultiItem const& item) const */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetFirstChild(const wxTreeMultiItem &item, int &cookie) const\r
+{\r
+ if(item.IsNodeItem())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();\r
+\r
+ if(n->GetNodeCount() > 0)\r
+ {\r
+ cookie = 0;\r
+ return wxTreeMultiItem(n->GetNode(0));\r
+ }\r
+ }\r
+\r
+ // no children or no valid node\r
+ cookie = -1;\r
+ return wxTreeMultiItem(0);\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetNextChild(const wxTreeMultiItem &item, int &cookie) const\r
+{\r
+ if(item.IsNodeItem())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();\r
+\r
+ if(cookie >= 0 && cookie < (n->GetNodeCount()-1))\r
+ {\r
+ // increment cookie, return node\r
+ cookie ++;\r
+ return wxTreeMultiItem(n->GetNode(cookie));\r
+ }\r
+ }\r
+\r
+ // end of query, or no valid node\r
+ cookie = -1;\r
+ return wxTreeMultiItem(0);\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetLastChild(const wxTreeMultiItem &item) const\r
+{\r
+ if(item.IsNodeItem())\r
+ {\r
+ TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();\r
+\r
+ if(n->GetNodeCount() > 0)\r
+ return wxTreeMultiItem(n->GetNode(n->GetNodeCount()-1));\r
+ }\r
+\r
+ return wxTreeMultiItem(0);\r
+}\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetNextSibling(wxTreeMultiItem const& item) const\r
+{\r
+ // check if a valid item has been passed:\r
+ if (!(item.IsOk()))\r
+ return wxTreeMultiItem();\r
+\r
+ TreeMultiItemNode* ParentPtr(item.GetItem()->GetParent());\r
+\r
+\r
+ if (ParentPtr != NULL) // the parent pointer is only null if the passed item is the root\r
+ {\r
+ // find the current item in the parent's list; the next sibling has an index that is one higher than the one of the current item:\r
+ int NextItemIndex(ParentPtr->Index(item.GetItem())+1); // variable definition and initialization\r
+\r
+ if (NextItemIndex < ParentPtr->GetNodeCount())\r
+ return ParentPtr->GetNode(NextItemIndex);\r
+ else\r
+ return wxTreeMultiItem();\r
+ } /* if */\r
+ else\r
+ return wxTreeMultiItem();\r
+} /* wxTreeMultiCtrl::GetNextSibling(wxTreeMultiItem const&) const */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetPrevSibling(wxTreeMultiItem const& item) const\r
+{\r
+ // check if a valid item has been passed:\r
+ if (!(item.IsOk()))\r
+ return wxTreeMultiItem();\r
+\r
+ TreeMultiItemNode* ParentPtr(item.GetItem()->GetParent());\r
+\r
+\r
+ if (ParentPtr != NULL)\r
+ {\r
+ // find the current item in the parent's list; the next sibling has an index that is one higher than the one of the current item:\r
+ int PrevItemIndex(ParentPtr->Index(item.GetItem())-1); // variable definition and initialization\r
+\r
+ if (PrevItemIndex >= 0)\r
+ return ParentPtr->GetNode(PrevItemIndex);\r
+ else\r
+ return wxTreeMultiItem();\r
+ } /* if */\r
+ else\r
+ return wxTreeMultiItem();\r
+} /* wxTreeMultiCtrl::GetPrevSibling(wxTreeMultiItem const&) const */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetNext(wxTreeMultiItem const& item) const\r
+{\r
+ // check if a valid item has been passed:\r
+ if (!(item.IsOk()))\r
+ return wxTreeMultiItem();\r
+\r
+ TreeMultiItemNode* NodePtr(item.GetItem()->IsTreeMultiItemNode()); // variable definition and initialization\r
+\r
+ if ((NodePtr != NULL) && (NodePtr->GetNodeCount() > 0))\r
+ return wxTreeMultiItem(NodePtr->First());\r
+ else\r
+ {\r
+ // variable definitions and initializations:\r
+ wxTreeMultiItem Parent(item);\r
+ wxTreeMultiItem Sibling;\r
+\r
+ do\r
+ {\r
+ Sibling = this->GetNextSibling(Parent); // try to find next sibling\r
+ Parent = this->GetParent(Parent); // get next ancestor\r
+ } while (!(Sibling.IsOk()) && Parent.IsOk());\r
+ // in case the loop ended with Sibling.IsOk() "Sibling" contains a valid sibling otherwise an invalid\r
+ return Sibling;\r
+ } /* if */\r
+} /* wxTreeMultiCtrl::GetNextSibling(wxTreeMultiItem const&) const */\r
+\r
+wxTreeMultiItem wxTreeMultiCtrl::GetPrevious(wxTreeMultiItem const& item) const\r
+{\r
+ // check if a valid item has been passed:\r
+ if (!(item.IsOk()))\r
+ return wxTreeMultiItem();\r
+\r
+ TreeMultiItemNode* NodePtr(item.GetItem()->IsTreeMultiItemNode()); // variable definition and initialization\r
+\r
+ if ((NodePtr != NULL) && (NodePtr->GetNodeCount() > 0))\r
+ return wxTreeMultiItem(NodePtr->Last());\r
+ else\r
+ {\r
+ // variable definitions and initializations:\r
+ wxTreeMultiItem Parent(item);\r
+ wxTreeMultiItem Sibling;\r
+\r
+ do\r
+ {\r
+ Sibling = this->GetPrevSibling(Parent); // try to find next sibling\r
+ Parent = this->GetParent(Parent); // get next ancestor\r
+ } while (!(Sibling.IsOk()) && Parent.IsOk());\r
+ // in case the loop ended with Sibling.IsOk() "Sibling" contains a valid sibling otherwise an invalid\r
+ return Sibling;\r
+ } /* if */\r
+} /* wxTreeMultiCtrl::GetPrevious(wxTreeMultiItem const&) const */\r
+\r
+// WDR: handler implementations for wxTreeMultiCtrl\r
+\r
+void wxTreeMultiCtrl::OnDraw(wxDC& dc)\r
+{\r
+ // go recursive and draw the whole visible tree.\r
+ dc.SetFont(_captionFont);\r
+ for(int i = 0; i < _root.GetNodeCount(); i++)\r
+ DrawNode(_root.GetNode(i), dc);\r
+} /* */\r
--- /dev/null
+//---------------------------------------------------------------------------\r
+// $RCSfile: wxTreeMultiCtrl.h,v $\r
+// $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/wxTreeMultiCtrl.h,v $\r
+// $Revision: 1.1 $\r
+// $Date: 2008/03/28 13:42:19 $\r
+//---------------------------------------------------------------------------\r
+// Author: Jorgen Bodde\r
+// Copyright: (c) Jorgen Bodde\r
+// License: wxWidgets License
+//---------------------------------------------------------------------------
+
+#ifndef __WXTREEMULTICTRL_H__
+#define __WXTREEMULTICTRL_H__
+
+/** \author Jorgen Bodde
+ \mainpage
+
+ This is the wxTreeMultiCtrl documentation guide. For the upcoming CodeShop project I am working on, I've
+ created a new control for wxWidgets (http://www.wxwidgets.com), with similar functionality as
+ the wxTreeCtrl. This control allows you to add multiple wxWindow based components in a tree shaped form,
+ with multiple root entries, which can contain multiple sub nodes, which can contain the visual controls
+ in the tree. The tree behaves very much like a wxTreeCtrl, showing all controls in a more structured way.
+
+ wxTreeMultiCtrl is freeware and distributed under the wxWidgets license. wxWidgets is THE toolkit for
+ (cross platform) C++ / Python programming!
+
+ \section how_work How does it work?
+
+ The internals of the wxTreeMultiCtrl are built up from a composite pattern. This pattern forms a recursive
+ tree where each end node can consist of a Window or a Node type. The Node type can consist out of multiple
+ Window or Node types, and the Window type is an end node which contains an assigned wxWindow to be displayed
+ on the current level.
+
+ The wxTreeMultiCtrl communicates to the developer by using the wxTreeMultiItem class, which is about the same
+ as a wxTreeItemId. The wxTreeMultiItem class can be used in add or delete operations, fold operations, find
+ operations, data get and set methods, and more. It helps the developer build up the tree, and later on,
+ get and set data from it.
+
+ \section what_dp What can it do and what not?
+
+ What it can do:
+
+ - Run-time addition / deletion of nodes, with an unlimited level depth
+ - Inheriting the control makes it possible to respond to the events of the added wxWindow based components
+ - Since all structured controls are owned by the wxTreeMultiCtrl, FindWindow will work, and all events can be captured
+ - Collapsing and expanding of a (or all) sub nodes from a specific location by method or by mouse click
+ - Typesafe getting or setting boolean, text or selection values by simply passing the window ID
+ - Run-time adjustment of spacing between controls
+ - Easy indenting of Window nodes
+ - Contain complex controls per Window node by putting them on a wxPanel, allowing custom behavior of those controls on the wxPanel
+ - Automatic deep background color adjustment of every window added, which means that every control on a wxPanel will be
+ automatically set to the proper background. There is also an exception flag for wxButton controls, so that they remain
+ their original color (if desired).
+
+ What it cannot do:
+
+ - Drag and drop support of individual nodes. Since the purpose was creating a tree shaped / property sheet kind of window,
+ dragging and dropping is not really desired behavior.
+ - No selection possible. Click on the controls to edit, double click on a container node to collapse and expand.
+ - Draw a selection border. Since there is no selection possible, no selection will be drawn
+ - Editing of captions like point and click in wxTreeCtrl. Again this is not desired behavior, because the (sub)
+ items are not really the same as wxTreeCtrl items.
+
+ Special thanks to Phil for testing, Julian Smart et al. for making this great toolkit!
+*/
+
+#ifdef __GNUG__
+ #pragma interface "wxTreeMultiCtrl.cpp"
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+#endif
+
+#include <wx/dynarray.h>
+
+
+// classes for internal tree structure
+#include "TreeMultiItemRoot.h"
+
+// Flags for wxTreeMultCtrl use
+#define wxTMC_DEFAULT_STYLE wxSIMPLE_BORDER
+
+/** @defgroup wndflags wxTreeMultiWindowItem flags
+ These flags can be used in wxTreeMultiCtrl::AppendWindow as enforced flags, or in wxTreeMultiWindowInfo to set the flags
+ for repetetive adding of Window nodes with the same (or near same) properties.
+ @{
+*/
+/** When set, this flag will change the background of all the panels
+ and subwindows added to the wxTreeMultiCtrl. */
+#define wxTMC_BG_ADJUST_CNT 0x000000001
+/** When set, the background of the wxButton windows will also be changed.
+ This needs wxTMC_ADJUST_BACKGROUND to be set as well. */
+#define wxTMC_BG_ADJUST_BTN 0x000000002
+/** When set, all backgrounds from windows and buttons will be adjusted
+ to match the control background */
+#define wxTMC_BG_ADJUST_ALL (wxTMC_BG_ADJUST_CNT | wxTMC_BG_ADJUST_BTN)
+/** When set, the control added is resized horizontally over the complete
+ length. When the user resizes the window, the control is resized as well */
+#define wxTMC_SPAN_WIDTH 0x000000004
+/** @}
+*/
+
+
+#define wxTreeMultiCtrlNameStr wxT("wxTreeMultiCtrl")
+
+#define WXTMC_GUTTER_DEFAULT 6 // gutter before and after image of [+] or [-]
+#define WXTMC_YSPACING_DEFAULT 10 // per item 10 pixels spacing extra for every item
+#define WXTMC_PIXELS_PER_UNIT 10
+
+/** \defgroup hitflags wxTreeMultiCtrl HitTest flags
+ @{
+*/
+
+enum
+{
+ /// wxCoord was found in the gutter of the node (in front of the [+])
+ wxTMC_HITTEST_GUTTER = 1,
+ /// wxCoord was found inside a window, or behind it, on a Window node
+ wxTMC_HITTEST_WINDOW,
+ /// wxCoord was found on a caption of a Node or Root item
+ wxTMC_HITTEST_CAPTION,
+ /// wxCoord was found on a checkbox (only when item really has a checkbox)
+ wxTMC_HITTEST_CHECKBOX
+};
+
+/** @}
+*/
+
+/** @defgroup classes wxTreeMultiCtrl Classes
+ These classes are all the available classes in the wxTreeMultiCtrl you should know about.
+ @{
+
+ @}
+*/
+
+/** \class wxTreeMultiItem
+ \ingroup classes
+ \brief An intermediate class which is used to return as 'item' value for the wxTreeMultiCtrl. This class
+ is comparable with wxTreeItemId.
+
+ The wxTreeMultiItem is used to pass information to the user about the tree node in question. It can also be used point out where the
+ subnodes should be added.
+
+ For example:
+ \code
+
+ wxTreeMultiItem item = MyMultiTreeCtrl->AddRoot("This is the first root");
+
+ // now add a node to the root
+ if(item.IsOk())
+ MyMultiTreeCtrl->AppendWindow(item, new wxStaticText(MyMultiTreeCtrl, -1, "This is a static text");
+
+
+ \endcode
+
+ The wxTreeMultiItem comes in three internal types which are used in the wxTreeMultiCtrl. For functions such as
+ wxTreeMultiCtrl::AddRoot, a Root item is returned. For functions such as wxTreeMultiCtrl::AppendWindow, a
+ Window node is returned. For functions such as wxTreeMultiCtrl::AppendNode, a Node item is returned.
+
+ \li A Root item represents a top level item. Special operations on this item is adding multiple nodes to it from a
+ top level.
+
+ \li A Node item represents a container item which has multiple sub items which can both be Window items, or Node items.
+ A root item is a special type of Node item, so all operations which are only for Node items, are also for Root items.
+
+ \li A Window node represents an end node, which points to a wxWindow which represents the visual contents of this node.
+ This type of node can hold any wxWindow derived class.
+
+*/
+
+class wxTreeMultiItem
+{
+private:
+ TreeMultiItemBase *_item;
+public:
+ /** Default declaration constructor, and should be used when declaring an item which gets assigned a new
+ value by e.g. wxTreeMultiCtrl::AppendNode. */
+ wxTreeMultiItem() {
+ _item = 0;
+ };
+
+#ifndef _NO_DOXYGEN_
+
+ wxTreeMultiItem(TreeMultiItemBase *ptr) {
+ _item = ptr;
+ };\r
+\r
+ // Returns the TreeMultiItemBase class. This shoult *NOT* be\r
+ // used if you don't know what you are doing! This means never use it. */\r
+ TreeMultiItemBase *GetItem() const {\r
+ return _item;\r
+ };\r
+
+#endif // _NO_DOXYGEN_
+
+ /** The copy operator. Used in assigning one wxTreeMultiItem to another, usually in returning wxTreeMultiItem
+ classes from the wxTreeMultiCtrl.
+ */
+ void operator=(const wxTreeMultiItem &item) {
+ _item = item._item;\r
+ };\r
+\r
+ /** Equality operator. It returns true if the items are identical or if both items are invalid. */\r
+ bool operator==(wxTreeMultiItem const& item) const {return (this->GetItem() == item.GetItem());}\r
+\r
+ /** Inequality operator. It returns true if the items are different or one of them is invalid. */\r
+ bool operator!=(wxTreeMultiItem const& item) const {return (this->GetItem() != item.GetItem());}\r
+\r
+ /** Returns the parent of the current wxTreeMultiItem. This means the wxTreeMultiNode is returned. It can\r
+ be useful to check or clear the checkbox at this level. */\r
+ wxTreeMultiItem GetParent() const{\r
+ wxCHECK(IsOk(), wxTreeMultiItem(0));\r
+ return wxTreeMultiItem(_item->GetParent());\r
+ };\r
+
+ /** Validates if the wxTreeMultiItem is a valid instance to use in the wxTreeMultiCtrl. Returns TRUE when there
+ is a member value is associated with it, or FALSE when not. This value can also be checked when this class is returned from a wxTreeMultiCtrl operation. For example:
+
+ \code
+
+ wxTreeMultiItem item = MyTreeMultiCtrl->FindNode("NAME");
+ if(item.IsOk())
+ {
+ // Found the node, now do something with it
+ }
+ else
+ {
+ // Sorry, not found
+ }
+
+ \endcode
+
+ */
+ bool IsOk() const {
+ return _item != 0;
+ };
+
+ /** Returns TRUE when the wxTreeMultiItem is a Window item. This means the item is both valid, and points to a
+ window node. This means it can be used in functions that expect a Window node. If the item is invalid or a Window
+ item, FALSE is returned
+ \sa wxTreeMultiCtrl::AppendWindow
+ */
+ bool IsWindowItem() const {
+ if(_item && _item->IsTreeMultiItemWindow())
+ return true;
+ return false;
+ };
+
+ /** Returns TRUE when the wxTreeMultiItem is a Node item. This means the item is both valid, and points to a
+ node element (i.e. setting the caption, counting node children, etc). If the item is invalid or not a Node
+ item, FALSE is returned.
+ When the item is actually a root item (specialised node type), this also returns TRUE.
+ \sa wxTreeMultiCtrl::AppendNode wxTreeMultiCtrl::AddRoot
+ */
+ bool IsNodeItem() const {
+ if(_item && (_item->IsTreeMultiItemNode() || _item->IsTreeMultiItemRoot()))
+ return true;
+ return false;
+ };
+
+ /** Returns True when the wxTreeMultiItem is a Root (top node) item. This means the item is both valid,
+ and points to a root element (this item is always shown as first node in the tree). A root node is
+ always visible, but can contain other collapsed children. If the item is invalid or not a Root node,
+ FALSE is returned.
+ */
+ bool IsRootItem() const {
+ if(_item && _item->IsTreeMultiItemRoot())
+ return true;
+ return false;
+ };
+
+ /** Returns TRUE if the node is expanded, else FALSE if it is collapsed. If the item is not a Root or Node
+ item, an assertion failure is generated (in debug mode) or FALSE is returned (in release mode).
+
+ \sa wxTreeMultiCtrl::Expand, wxTreeMultiCtrl::Collapse, wxTreeMultiCtrl::CollapseAndReset
+ */
+ bool IsExpanded() const {
+ wxCHECK(_item, false);
+ TreeMultiItemNode *n = _item->IsTreeMultiItemNode();
+ wxCHECK(n, false);
+
+ return n->IsExpanded();
+ };
+
+ /** Returns true if this node is excluded from drawing. Please note that when this node is not visible
+ due to a higher excluded parent node but not literally excluded itself, it will return false (not excluded).
+ Use wxTreeMultiCtrl::GetExcludedParent() to get the node that hides this one. */
+ bool IsExcluded() {
+ wxCHECK(_item, false);
+ return _item->IsExcluded();\r
+ }\r
+\r
+ /** Returns true if the item is selected.\r
+ Please note that currently only nodes can be selected.\r
+ */\r
+ bool IsSelected(void) const\r
+ {\r
+ wxCHECK(this->GetItem(),false);\r
+ return this->GetItem()->IsSelected();\r
+ }\r
+ /** Returns true if this node is visible. Please note that when this node is a child node of a collapsed\r
+ node, it is not visible. Also if this node is a child node of an excluded node, it is also not visible.\r
+ It does <b>NOT</b> return false when it's drawn somewhere outside of the visible area. */\r
+ bool IsVisible() {
+ wxCHECK(_item, false);
+ return _item->IsVisible();
+ }
+\r
+};\r
+\r
+WX_DECLARE_OBJARRAY(wxTreeMultiItem,wxArrayTreeMultiItem);\r
+\r
+/** \class wxTreeMultiWindowInfo\r
+ \ingroup classes\r
+ \brief This class contains information for every Window node to be added.\r
+
+ This class can be used to modify the behaviour of the Window node to be added, and can be reused to pass along
+ upon every wxTreeMultiCtrl::AppendWindow call. For example:
+
+ \code
+
+ wxTreeMultiWindowInfo wndinfo;
+
+ MyTreeMultiCtrl->AppendWindow(item, new wxStaticText(MyTreeMultiCtrl,
+ -1, "Press this button"), "", wndinfo));
+
+ // now adjust the spacing of our next window to add, by indenting
+ // 4 times the indent size
+
+ wndinfo.Indent(4);
+ MyTreeMultiCtrl->AppendWindow(item, new wxButton(MyTreeMultiCtrl,
+ -1, "Apply"), "", wndinfo);
+
+ \endcode
+
+ The class is created to prevent long parameter lists in the functions. Other ways to manipulate a newly added
+ Window node are;
+
+ \li Change top spacing of the Window node to be added
+ \li Change front spacing (indent) of the Window node
+ \li Set extra flags for this Window node
+*/
+
+//-------------------------------------------------------------------------------------------------------------------
+
+class wxTreeMultiWindowInfo
+{
+private:
+ /** Flag that indicates that every window background in the assigned wxWindow needs te be overriden with the
+ current colour of the TreeMultiCtrl. This is a deep adjustment and will do every subwindow until none are
+ left. If 'false' no adjustment is done. For AppendWindow only */
+ int _flags;
+ /** Extra indent for every item that is added. This will add front spacing to the item's x calculation.
+ For AppendNode and AppendWindow. Spacing is added behind the collapse image not in front. */
+ int _frontSpacing,
+ _frontSpacingOrg;
+
+ /** Extra top spacing for every item that is added. This will add top spacing to the item's y calculation */
+ int _topSpacing;
+
+#if(CHECKBOXVIEW)
+ /** Checkstate for checkboxed property sheets */
+ bool _checkState;
+#endif\r
+\r
+public:\r
+#if(CHECKBOXVIEW)\r
+ wxTreeMultiWindowInfo(int flags, int frontSpacing, int topSpacing, bool checkState = false)\r
+ : _flags(flags)\r
+ , _frontSpacing(frontSpacing)\r
+ , _frontSpacingOrg(frontSpacing)\r
+ , _topSpacing(topSpacing)\r
+ , _checkState(checkState)\r
+#else\r
+ wxTreeMultiWindowInfo(int flags, int frontSpacing, int topSpacing)\r
+ : _flags(flags)\r
+ , _frontSpacing(frontSpacing)\r
+ , _frontSpacingOrg(frontSpacing)\r
+ , _topSpacing(topSpacing)\r
+#endif\r
+ {\r
+ // constructor\r
+ }
+ /** Adds indent to original front spacing and increments it with that value (quick extra indent).
+ The original value of FrontSpacing (see SetFrontSpacing() gets indented by multiplying
+ the 'num' factor (default = 1) times the indent value. So if the FrontSpacing was set to 10,
+ and Indent(2) is called, the new indent will be 30. (10 + 2 * 10). The original FrontSpacing
+ value is remembered, so calling Outdent(2) will bring it back to 10 (30 - (2*10). Calling
+ SetFrontSpacing with a new value, deletes the old indent.
+
+ \sa Outdent, SetFrontSpacing
+ */
+ int Indent(int num = 1) {
+ if(num > 0)
+ _frontSpacing += (_frontSpacingOrg * num);
+ return _frontSpacing;
+ };
+ /** Reduces indent a number of times, by subtracting 'num' times the original FrontSpacing value from
+ the current FrontSpacing value (quick extra indent). Thus if the original FrontSpacing was set to
+ 10, and the current indent value is 40, Outdent(2) will do 40 - (2 * 10) = 20
+
+ \sa Indent, SetFrontSpacing
+ */
+ int Outdent(int num = 1) {
+ _frontSpacing -= (_frontSpacingOrg * num);
+ if(_frontSpacing < 0)
+ _frontSpacing = 0;
+ return _frontSpacing;
+ };
+
+ /** Sets FrontSpacing value. This also resets the current indent level. */
+ void SetFrontSpacing(int frontSpacing) {
+ _frontSpacing = frontSpacing;
+ _frontSpacingOrg = frontSpacing;
+ };
+ /** Gets front spacing. This will return the current indent level set. If Indent or Outdent is used,
+ this level represents the current Indent level.*/
+ int GetFrontSpacing() const {
+ return _frontSpacing;
+ };
+
+ /** Sets top spacing. This means the number of pixels spacing between the last node and the next one to
+ be added.
+ */
+ void SetTopSpacing(int topSpacing) {
+ _topSpacing = topSpacing;
+ if(_topSpacing < 0)
+ _topSpacing = 0;
+ };
+
+ /* Gets top spacing currently set. */
+ int GetTopSpacing() const {
+ return _topSpacing;
+ };
+
+ /** Sets the current flags set, and returns previous flags state.
+ \sa @link wndflags wxTreeMultiWindowInfo flags@endlink
+ */
+ int SetFlags(int flags) {
+ int tmp = _flags;
+ _flags = flags;
+ return tmp;
+ };
+
+ /** Gets the current flags set.
+ \sa @link wndflags wxTreeMultiWindowInfo flags@endlink
+ */
+ int GetFlags() const {
+ return _flags;
+ };
+
+ /** Or's the given flag with the current flagset, and adds it. The
+ old flag set is returned before the OR is applied.
+ \sa @link wndflags wxTreeMultiWindowInfo flags@endlink
+ */
+ int AddFlag(int flag_mask) {
+ int tmp = _flags;
+ _flags |= flag_mask;
+ return tmp;
+ };
+
+ /** And's the given flag in a negated manner and removes this flag set from
+ the current flags. The old flag set is returned.
+ \sa @link wndflags wxTreeMultiWindowInfo flags@endlink
+ */
+ int RemoveFlag(int flag_mask) {
+ int tmp = _flags;
+ _flags &= ~(flag_mask);
+ return tmp;
+ };
+
+#if(CHECKBOXVIEW)
+ /** Sets the default checkstate if checkboxes if SetCheckboxView is chosen. For all the
+ items to be added (even captions) this checkstate is chosen. The default checkstate
+ is false. <b>This needs USE_CHECKBOXVIEW set to YES, or CHECKBOXVIEW=1 during compile</b> */
+ void SetDefaultCheckState(bool checkState = true) {
+ _checkState = checkState;
+ };
+
+ /** Gets the default checkstate of the item. <b>This needs USE_CHECKBOXVIEW set to YES, or CHECKBOXVIEW=1 during compile</b>
+ \sa SetDefaultCheckState */
+ bool GetDefaultCheckState() const {
+ return _checkState;
+ };
+#endif
+};
+
+// Default info string
+#ifndef LINUX
+ #define wxTreeMultiWindowInfoDefault wxTreeMultiWindowInfo(wxTMC_BG_ADJUST_CNT, 8, 0)
+#else
+ #define wxTreeMultiWindowInfoDefault wxTreeMultiWindowInfo(wxTMC_BG_ADJUST_ALL, 8, 0)
+#endif
+
+/** \class wxTreeMultiCtrl
+ \ingroup classes
+ \brief This is the visual control, which will contain all the logic for the tree mechanism.
+
+ The wxTreeMultiCtrl is the container class which can be filled in to get the tree shaped structure in
+ which the controls are displayed. The user can add / delete new nodes at runtime, expand or collapse
+ nodes, perform get or set actions on the controls inside, and iterate over the items.
+
+ A typical usage of the wxTreeCtrl is;
+
+ \code
+ wxTreeMultiCtrl *tmc = new wxTreeMultiCtrl(this, -1);
+
+ // add root
+ wxTreeMultiItem item = tmc->AddRoot("This is the first root");
+
+ // create a wxTreeMultiWindowInfo object for indenting etc
+ wxTreeMultiWindowInfo wndinfo;
+
+ // add subitem to root
+ tmc->AppendWindow(item, new wxButton(tmc, -1, "Press this"), "", wndinfo);
+
+ // indent a few
+ wndinfo.Indent(4);
+
+ // add a new one
+ tmc->AddWindow(item, new wxCheckBox(tmc, ID_MYCHECK, "Check this!"), "", wndinfo);
+
+ // now check the value of the checkbox
+ tmc->SetBooleanValue(ID_MYCHECK, true);
+
+ \endcode
+
+ <b>IMPORTANT:</b> Every control added to the wxTreeMultiCtrl has to be child of the wxTreeMultiCtrl.
+
+*/
+class wxTreeMultiCtrl: public wxScrolledWindow
+{
+ DECLARE_DYNAMIC_CLASS(wxTreeMultiCtrl)
+
+ /** \todo When tab is pressed, the focus can get out of sight. This should be resolved by
+ catching the TAB, see what window is focussed, and scroll the window so it's visible */
+private:
+ TreeMultiItemRoot _root;
+
+ long _style;
+ wxBitmap *_expandBmp, *_collBmp;
+
+ /** Delta Y for bitmap, to center it on the caption */
+ int _iconDeltaY, _checkDeltaY;
+
+ /* Caption height. This is the height of the font of this window */
+ int _captionHeight;
+
+ /** The gutter spacing in front and back of the image. This determines the amount of spacing in front
+ of each item */
+ int _gutterWidth;
+
+ /** The image width of the [+] / [-] icon. This is also calculated in the gutter */
+ int _iconWidth;
+
+ /** The image height of the [+] / [-] icon. This is calculated as minimal size and to allign */
+ int _iconHeight;
+
+ /** Max height. This is either the [+] bitmap or the checkbox */
+ int _maxHeight;
+
+
+ /** Extra Y spacing between the items. */
+ int _spacingY;
+
+ /** Two step create prevention. Something with GetWindowSize freaks out when not actually created */
+ bool _create_called;
+
+#if(CHECKBOXVIEW)
+ wxBitmap *_checkBmp, *_uncheckBmp, *_tristateBmp;
+
+ /** Toggles checkbox view. If true, every item created (caption or node) will be created with checkbox */
+ bool _checkboxView;
+
+ /** Height and weight for checkbox */
+ int _checkHeight, _checkWidth;\r
+#endif\r
+\r
+ /** brush for highlighting nodes */\r
+ wxBrush* m_HilightBrush;\r
+\r
+ /** This captionFont is made equal to the font of the wxScrolledWindow. As extra the bold face\r
+ is set on it when this is wanted by the user (see flags) */\r
+ wxFont _captionFont;\r
+\r
+ /** list of selected items */\r
+ wxArrayTreeMultiItem m_SelectedItems;\r
+\r
+ /** Does the actual collapsing / expanding. So that Expand and Collapse aren't using the same code twice */\r
+ void DoFold(TreeMultiItemBase *item, bool expand, bool recursive);\r
+\r
+ /** Redraws and recalculates the nodes from the current node. It will also clear all 'dirty' flags when
+ they are recalculated */
+ void RedrawFromNode(TreeMultiItemNode *n);
+
+ /** Redraws from parent node of this node */
+ void RedrawFromParentNode(TreeMultiItemBase *b);
+
+ /** Draws checkbox belonging to this node, in the given state */
+ void DrawCheckbox(TreeMultiItemBase *b, wxDC &dc, bool convertScrolled = false);
+
+ /** Recalculate the space needed based on every node. It goes as follows.
+ - A foldable node (TreeMultiItemNode) is as high as the 'Jg' y-size. This type only has a caption plus a
+ picture which explains the state ([+] or [-]), the width will be the caption length
+ - A window node will be as high as the y size of the window. The X size is the total length of the
+ window.
+ - For every child node an indent will be added to the x size.
+
+ Only visible nodes will be recalculated. Non visible (collapsed) children will be skipped */
+ void RecalculateNodePositions();
+
+ /** Recurses into the whole tree and provides every node with the proper x and y values. All non visible items
+ are skipped (so when it encounters a collapsed node, it's children are not calculated). Returns the last Y */
+ int CalculateNodeDimensions(TreeMultiItemBase *b, int currentY, int level);
+
+ void DrawNode(TreeMultiItemBase *b, wxDC &dc);
+
+ /** Sets background colour of all the windows and subwindows in this wxWindow. This is very handy
+ for wxPanel derived classes which need to be made equal to the background colour of the wxTreeMultiCtrl */
+ void SetWindowBackgroundColour(wxWindow *wnd, const wxColour &col, int flags);
+
+ /** Shows or hides the assigned window (if there is any) */
+ void ShowTreeMultiWindow(TreeMultiItemWindow *window, bool show = true);
+
+ /** Goes down the tree, and if a window is not visible (thus all it's children aren't too) it will hide
+ the window so it is not shown on the control */
+ void UpdateAllWindowVisibility();
+
+ /** Hides tree multi window. It this is a TreeMultiItemNode, hide all subwindows as well. */
+ void UpdateTreeMultiWindowVisibility(TreeMultiItemBase *b, bool show);
+
+ /** Recalculates totally needed virtual size of the wxTreeMultiCtrl. It will scan for
+ the largest window, with the biggest size, and report that back */
+ void RecalculateVirtualSize();\r
+\r
+ /** Adjusts scrollbars in window, usually done after virtual size (x,y) is recalculated */\r
+ using wxScrolledWindow::AdjustScrollbars;\r
+ virtual void AdjustScrollbars(int x, int y);\r
+\r
+ /** Recalculates and accumulates largest x and y */\r
+ void RecalculateVirtualSizeFromNode(const TreeMultiItemNode *node, int &x, int &y);
+\r
+ /** Scans for TreeMultiItemBase node that contains x,y and in area returns a hittest constant to\r
+ indicate what matched */\r
+ TreeMultiItemBase *FindNodeByPoint(TreeMultiItemBase *b, wxPoint const& pt, int &area);\r
+\r
+ /** Scans for TreeMultiItemWindow that holds the wxWindow pointer. Does not scan in panels or does\r
+ a deep search. Reason, this function is used to advance to next TreeMultiItemWindow for focus\r
+ on this wxScrolledWindow. If a sub window is found, it will skip other windows on that same level */
+ wxTreeMultiItem FindWindowNode(wxWindow *wnd, TreeMultiItemNode *n = 0);
+
+ /** Finds next visible window item in chain. If not found use FindFirstVisibleItem to start from the
+ beginning */\r
+ TreeMultiItemWindow *FindNextVisibleWindowItem(TreeMultiItemBase *b, int index = -1);\r
+\r
+ /** Adjust the centering of the bitmap icons (collapse / expand) when the caption font changes. They need to\r
+ be centered in the middle of the font, so a bit of deltaY adjustment is needed */\r
+ void AdjustIconsDeltaY();\r
+
+ /** Calculate the spanning of the individual nodes */
+ void CalculateNodeSpanning(TreeMultiItemBase *b);
+
+#if(CHECKBOXVIEW)
+ /** Recurse to all the children and set the checkbox state (even when there is no checkbox) */
+ void SetRecursiveCheckState(TreeMultiItemNode *n, bool check);
+
+ /** From current checked node, all children will be scanned and the parent node of this node
+ will get tristate if the checked items are scattered (some are some aren't). If all nodes in this
+ node are checked, the parent node gets checked all the way up to the last one that matches
+ criteria. If all are cleared, parent node gets cleared */
+ void ScanTristateCheckstates(TreeMultiItemBase *b);\r
+#endif\r
+\r
+ /** \name Private add and delete methods\r
+ @{\r
+ */\r
+\r
+ /** Inserts a node into the parent's node at the specified position.\r
+ As this is a private method error checking is limited. Therefore, it has to be guaranteed that this method\r
+ is only called with a valid parent node pointer.\r
+ The position is zero based. In case the position is equal or larger than the current number of\r
+ parent's elements the new node is appended.\r
+ The newly inserted node is being returned.\r
+ */\r
+ wxTreeMultiItem InsertNode(TreeMultiItemNode* ParentPtr, size_t Position, wxString const& Caption, wxString const& Name);\r
+\r
+ /** Inserts a window into the parent's node at the specified position.\r
+ As this is a private method error checking is limited. Therefore, it has to be guaranteed that this method\r
+ is only called with a valid parent node and window pointer.\r
+ The position is zero based. In case the position is equal or larger than the current number of\r
+ parent's elements the new node is appended.\r
+ The newly inserted window is being returned.\r
+ */\r
+ wxTreeMultiItem InsertWindow(TreeMultiItemNode* ParentPtr, size_t Position, wxWindow* WindowPtr, wxString const& Name,\r
+ wxTreeMultiWindowInfo const& Info, int Flags);\r
+\r
+ /** @}\r
+ */\r
+private:\r
+ void Init();\r
+\r
+ // handlers
+ //---------
+
+ //virtual void OnDraw(wxDC& dc);\r
+ void OnPaint(wxPaintEvent &event);\r
+ void OnMouseClick (wxMouseEvent& event);\r
+ void OnRightMouseClick(wxMouseEvent& Event);\r
+ void OnKey(wxKeyEvent &event);\r
+ void OnSize(wxSizeEvent &event);\r
+\r
+ /** Recalculates the spanning controls */
+ void RecalculateSpanSizes();
+
+public:
+ /** Two step constructor. Call Create when this constructor is called to build up the
+ wxTreeMultiCtrl
+ */
+ wxTreeMultiCtrl()
+ : _create_called(false)
+ {
+
+ Init();
+ }
+
+ /** The default constructor. The style wxTAB_TRAVERSAL is enforced to make sure that the
+ focus handling is being done correctly. The styles to be used are styles valid for
+ the wxWindow and wxScrolledWindow
+ */
+ 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)
+ : _style(style | wxTAB_TRAVERSAL)
+ , _create_called(false)
+ {
+ Create(parent, id, pos, size, style, validator, name);
+ }
+
+ /** Destructor */
+ virtual ~wxTreeMultiCtrl();
+
+ /** Two step creation. Whenever the control is created without any parameters, use Create to actually
+ create it. Don't access the control's public methods before this is called
+
+ \sa wxTreeMultiCtrl()
+ */
+ 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);
+
+ // accessors
+ //----------
+
+ /** @name Add and delete methods
+ To add and delete node items like a Root item, Window item or Node item. This allows the user to
+ manipulate the tree, and build it up.
+ @{
+ */
+
+ /** Adds a root node to the wxTreeMultiItem. There can be many root nodes. Use this wxTreeMultiNode pointer to add
+ more subnodes to it. */\r
+ wxTreeMultiItem AddRoot(const wxString &caption, const wxString &name = wxEmptyString);\r
+\r
+ /** Adds a window to the tree control. Use this wxTreeMultiItem method to add a window class to the\r
+ current wxTreeMultiItem. The wxTreeMultiItem must point to a Node class. If this is not the case\r
+ an empty wxTreeMultiItem is returned. The mask is used to override the mask settings of the\r
+ wxTreeMultiWindowInfo class. This can be handy to set or clear extra flags only needed for certain\r
+ situations */\r
+ wxTreeMultiItem AppendWindow(const wxTreeMultiItem &ParentItem, wxWindow *window = NULL, const wxString &name = wxEmptyString,\r
+ wxTreeMultiWindowInfo const& info = wxTreeMultiWindowInfoDefault, int flags = 0);\r
+\r
+ /** Adds a window to the tree control. Use this method to add a window class at the specified position\r
+ of the parent's wxTreeMultiItem. In case the position is smaller than the current number of children all elements\r
+ are shifted upwards, otherwise the new window is appended to the parent's wxTreeMultiItem.\r
+ The parent wxTreeMultiItem must point to a Node class. If this is not the case an\r
+ empty wxTreeMultiItem is returned.\r
+ */\r
+ wxTreeMultiItem InsertWindow(wxTreeMultiItem const& ParentItem, size_t Position, wxWindow *window = NULL, wxString const& Name = wxEmptyString,\r
+ wxTreeMultiWindowInfo const& info = wxTreeMultiWindowInfoDefault, int flags = 0);\r
+\r
+ /** Adds a window to the tree control. Use this method to add a window class as the first element\r
+ of the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an\r
+ empty wxTreeMultiItem is returned.\r
+ */\r
+ wxTreeMultiItem PrependWindow(wxTreeMultiItem const& ParentItem, wxWindow *window = NULL, const wxString &name = wxEmptyString,\r
+ wxTreeMultiWindowInfo const& info = wxTreeMultiWindowInfoDefault, int flags = 0);\r
+\r
+ /** Adds a node to the tree control. Use this wxTreeMultiItem method to add a recursive subnode class as the last element\r
+ of the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case\r
+ an empty wxTreeMultiItem is returned. A node can contain multiple nodes or window classes */\r
+ wxTreeMultiItem AppendNode(wxTreeMultiItem const& ParentItem, const wxString &caption = wxEmptyString,\r
+ const wxString &name = wxEmptyString);\r
+\r
+ /** Adds a node to the tree control. Use this method to add a recursive subnode class at the specified position\r
+ of the parent's wxTreeMultiItem. In case the position is smaller than the current number of nodes all elements\r
+ are shifted upwards, otherwise the new node is appended to the parent's wxTreeMultiItem.\r
+ The parent wxTreeMultiItem must point to a Node class. If this is not the case an\r
+ empty wxTreeMultiItem is returned. A node can contain multiple nodes or window classes.\r
+ */\r
+ wxTreeMultiItem InsertNode(wxTreeMultiItem const& ParentItem, size_t Position, wxString const& caption, wxString const& name);\r
+\r
+ /** Adds a node to the tree control. Use this method to add a recursive subnode class as the first element\r
+ of the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an\r
+ empty wxTreeMultiItem is returned. A node can contain multiple nodes or window classes.\r
+ */\r
+ wxTreeMultiItem PrependNode(wxTreeMultiItem const& ParentItem, wxString const& caption = wxEmptyString,\r
+ wxString const& name = wxEmptyString);\r
+\r
+ /** Delete item from the tree control. Whenever it is present, delete it. If not, return false. After\r
+ deletion the wxTreeMultiItem is 0, thus IsOk will return false */\r
+ bool Delete(wxTreeMultiItem &item);\r
+\r
+ /** Deletes all the items from the wxTreeMultiCtrl. */\r
+ void DeleteAllItems(void)\r
+ {\r
+ this->_root.Clear();\r
+ this->m_SelectedItems.Clear();\r
+ Refresh();\r
+ };\r
+\r
+ /** Deletes all children of the current node. The wxTreeMultiItem needs to be of type Node to
+ do this. Call GetParentNode to get the parent wxTreeMultiItem which is always a node. */
+ void DeleteChildren(const wxTreeMultiItem &item);
+
+ /** @}
+ */
+
+ /** @name Expand and collapse methods
+ These methods are all for items of type Node.
+ @{
+ */
+
+ /** Expand all nodes and subnodes. Recursive = true means all subnodes are also expanded. */
+ void ExpandNodes(bool recursive = false);
+
+ /** Collapses all nodes and subnodes. Recursive = true means all subnodes are also expanded. */
+ void CollapseNodes(bool recursive = false);
+
+ /** Expands given node, and with recursive, also the subnodes */
+ void Expand(const wxTreeMultiItem &item, bool recursive);
+
+ /** Collapses given node, and with recursive, also the subnodes. If this item is not a node, but a window.
+ the parent is resolved and that node is collapsed */
+ void Collapse(const wxTreeMultiItem &item, bool recursive);
+
+ /** Collapses this node and removes all children from it. This is only applicable on
+ wxTreeMultiItems which are of type Node / Root. */
+ void CollapseAndReset(const wxTreeMultiItem &item);
+
+ /** Folds the given node. The same as Expand and Collapse, but the state can be
+ given through a parameter */
+ void Fold(const wxTreeMultiItem &item, bool expand = true) {
+ if(expand)
+ Expand(item, false);
+ else
+ Collapse(item, false);
+ };
+
+ /** @}\r
+ */\r
+\r
+ /** @name Selection manipulation\r
+ These methods allow you to select, unselect or test wxTreeMultiItems on selection.\r
+ Currently only items of type Node can be manipulated.\r
+ @{\r
+ */\r
+\r
+ /** Returns the number of selected items. */\r
+ size_t GetSelectedItemCount(void) const {return this->m_SelectedItems.GetCount();}\r
+\r
+ /** Returns the first selected item.\r
+ If there is no selected item an invalid tree multi item is returned.\r
+ */\r
+ wxTreeMultiItem GetFirstSelectedItem(void) const;\r
+\r
+ /** Returns the last selected item.\r
+ If there is no selected item an invalid tree multi item is returned.\r
+ */\r
+ wxTreeMultiItem GetLastSelectedItem(void) const;\r
+\r
+ /** Returns a selected item with the specified index.\r
+ If there is no selected item with the passed index an invalide tree multi item is returned.\r
+ */\r
+ wxTreeMultiItem GetSelectedItem(size_t Index) const;\r
+\r
+ /** Returns the index of the selected item.\r
+ In case the item is not selected "GetSelectedItemCount()" - which is an invalid index - is returned.\r
+ */\r
+ size_t GetSelectedItemIndex(wxTreeMultiItem const& Item) const;\r
+\r
+ /** Selects the specified item AND in case\r
+ - UnselectOthers is set all other selected items are going to be unselected;\r
+ - ExpandSelection is set all items between the last selected item and the passed item\r
+ are selected, too (in case there this is the first selection all items between the first root\r
+ and the passed item are selected).\r
+ If the passed item is already selected the other parameters are ignored.\r
+ Please not that currently only nodes can be selected, therefore, if any other item is passed nothing will happen.\r
+ */\r
+ void SelectItem(wxTreeMultiItem const& Item, bool UnselectOthers=true, bool ExpandSelection=false);\r
+\r
+ /** Unselect all selected items. */\r
+ void UnselectAll(void);\r
+\r
+ /** Unselect specified item */\r
+ void Unselect(wxTreeMultiItem const& Item);\r
+\r
+ /** @}\r
+ */\r
+\r
+\r
+ /** \name Visibility manipulation\r
+ These methods allow you to manipulate a certain wxTreeMultiItem to temporarily exclude or to include\r
+ the node from drawing. Whenever it is excluded, all operations can still be performed, however\r
+ the node may not be visible.
+ @{
+ */
+
+ /** Excludes this node from drawing. When excluded, the node will dissapear from the control but is still
+ physically present in the tree itself. If this node is a composite node with children, they will all be
+ hidden from the control. */
+ void Exclude(const wxTreeMultiItem &item);
+
+ /** Includes an excluded node. If the node was already present on the drawing, nothing happens. If the
+ node is included after exclusion it will become visible. If the parent node is still excluded or
+ collapsed (not visible) this will not show, until the parent node shows */
+ void Include(const wxTreeMultiItem &item);
+
+ /** Returns the parent that is responsible for excluding this node. If there is no excluded node as parent,
+ the wxTreeMultiItem is zero. */
+ wxTreeMultiItem GetExcludedParent(const wxTreeMultiItem &item);
+
+ /** @}
+ */
+
+ /** Checks if the point is under one of the given areas. The returned areas can be
+ \li wxTMC_HITTEST_GUTTER If the front part of the item is clicked (where the node is)
+ \li wxTMC_HITTEST_WINDOW If located in the window area
+ \li wxTMC_HITTEST_CAPTION If located on the caption of the MultiTreeItemNode
+\r
+ Returned is the item which is located under the mouse, or none (IsOk = false) if\r
+ no item under the mouse */\r
+ wxTreeMultiItem HitTest(wxPoint const& pt, int &flags);\r
+\r
+ /** @name Find methods\r
+ These methods are used for finding a node in the wxTreeMultiCtrl.\r
+ @{
+ */
+
+ /** Searches for the given name from the given level and lower. It will return a wxTreeMultiItem which needs
+ to be checked with IsOk() to see if it is a correct item. IsRootItem, IsNodeItem and IsWindowItem can be
+ used to determine the type of item. If the search returned an item which doesn't satisfy the query, you can
+ restart the search from here, with skip = true to skip the passed item. */
+ wxTreeMultiItem FindItem(const wxTreeMultiItem &item, const wxString &name, bool ignoreCase = false,
+ bool skipFirst = false);
+
+ /** Searches all nodes for the given name and returns the one found. This is a specialised method for FindItem */
+ wxTreeMultiItem FindItem(const wxString &name, bool ignoreCase = false) {
+ return FindItem(wxTreeMultiItem(&_root), name, ignoreCase, false);
+ };
+
+ /** @}
+ */
+
+ /** Returns the number of children in this node. If this node is not of type Node, count returns -1. */
+ int GetChildrenCount(const wxTreeMultiItem &item) {
+ if(item.IsNodeItem())
+ {
+ TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
+ return n->GetNodeCount();
+ }
+
+ return -1;
+ };
+
+ /** This method finds the current focused window, and returns the wxTreeMultiItem that has this window as pointer.
+ If the wxTreeMultiItem is not ok, the focused window is on a sub-panel, or not on this control. If the focus is
+ on a sub-panel, this panel will handle the focusing. If you are still interested in this window, try
+ wxWindow::FindFocus which will always return with a pointer if a wxWindow has focus */
+ wxTreeMultiItem GetFocus();
+
+ /** @name Smart window Get/Set methods
+ These methods are used for quickly getting or setting primitive values, like boolean, string, or selections into
+ primitive wxWindow controls like a wxRadioButton, wxCheckBox, wxTextCtrl, etc.
+ The methods allow you to quickly set e.g. a boolean value by using the wxWindow ID of the control. A type
+ check is performed before the value is actually set with the appropiate method for it. If it fails, an assertion
+ will follow in debug mode. If you want to get values back similar get methods are present to return values.
+ This allows the user to quickly retrieve or set values by ID, without the fuss of remembering the pointer or
+ node ID of the wxTreeMultiCtrl.
+ @{
+ */
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxCheckBox</b> and <b>wxRadioButton</b>. Whenever
+ it finds a proper type it will return true or false. Whenever no proper type is found, it will return with false.
+ In debug mode it will cause an assertion failure as well, to notify the developer something is wrong.
+
+ \sa SetBooleanValue
+ */
+ bool GetBooleanValue(int wndId);
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxTextCtrl</b>, <b>wxChoice</b> and <b>wxComboBox</b>.
+ Whenever it finds a proper type it will return the (selected) text in the control. Whenever no proper type is found,
+ it will return with an empty string. In debug mode it will cause an exception error as well if the cast fails, to notify
+ the developer something is wrong.
+
+ \sa SetTextValue
+ */
+ wxString GetTextValue(int wndId);
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxCheckBox</b> and <b>wxRadioButton</b>. Whenever
+ it finds a proper type it set the control's value to the given boolean parameter. Nothing happens when no proper type
+ is found, however debug mode it will cause an assertion failure.
+
+ \sa GetBooleanValue
+ */
+ void SetBooleanValue(int wndId, bool value = true);
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxTextCtrl</b>. If the control is not found or
+ of the wrong type, an asserion failure (in debug mode) follows. <br><i><b>NOTE: </b></i> this method
+ does not typecast to wxChoice or wxComboBox and the likes. If a selection in one of those needs to be set, use the
+ SetSelectionValue / GetSelectionValue combination.
+ \sa GetTextValue, GetSelectionValue, SetSelectionValue
+ */
+ void SetTextValue(int wndId, const wxString &value = wxEmptyString);
+
+ /** Retrieves the wxWindow * associated with the wxTreeMultiItem. This only works for Window typed wxTreeMultiItem
+ classes. If this type does not match or no window is associated, 0 is returned. */
+ wxWindow *GetWindow(const wxTreeMultiItem &item) {
+ if(item.IsWindowItem())
+ return ((TreeMultiItemWindow *)item.GetItem())->GetWindow();
+ return 0;
+ };
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxListBox, wxChoice, wxComboBox</b>.
+ If the control is not found or of the wrong type, an asserion failure (in debug mode) follows. If it is found
+ the selection is set in the control.
+ */
+ void SetSelectionValue(int wndId, int sel);
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxListBox, wxChoice, wxComboBox</b>.
+ If the control is not found or of the wrong type, an asserion failure (in debug mode) follows. In release mode -1 is
+ returned. If it is found the selection index is returned.
+ */
+ int GetSelectionValue(int wndId);
+
+ /** This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with
+ AppendWindow). When it is found, it is type casted towards a <b>wxListBox</b>. If the control is not found or
+ of the wrong type, an asserion failure (in debug mode) follows. In release mode an empty wxArrayInt is returned.
+ If it is found the selections are stored in the wxArrayInt. This is only valid for wxListBox classes with multiple
+ selection flag set.
+ */
+ void GetSelectionValues(int wndId, wxArrayInt &sels);
+
+#if(CHECKBOXVIEW)
+ /** Gets the checkbox state of the wxTreeMultiItem pointed out by "item". If the item does not have a checkbox
+ associated (or the item is not ok), it will return -1. If the checkbox is checked it will return 1,\r
+ unchecked is 0, and tri-state (usually only for caption nodes) it will return 2. <b>This needs USE_CHECKBOXVIEW\r
+ set to YES, or CHECKBOXVIEW=1 during compile</b>*/\r
+ int GetCheckboxState(const wxTreeMultiItem &item, bool WXUNUSED(recursive)) {\r
+ wxCHECK(item.IsOk(), -1);\r
+\r
+ // return the checkbox state\r
+ TreeMultiItemBase *b = item.GetItem();
+ if(b->GetCheckbox())
+ return b->GetCheckboxState();
+
+ return -1;
+ };
+
+ /** Sets the checkbox state of the wxTreeMultiItem pointed out by "item". If the item does not have a checkbox
+ associated (or the item is not ok), it will simply ignore this. <b>This needs USE_CHECKBOXVIEW
+ set to YES, or CHECKBOXVIEW=1 during compile</b>. Contributed by Thomas Enickl.*/
+ void SetCheckboxState( const wxTreeMultiItem &item, int state ) {
+ wxCHECK2( item.IsOk(), return );
+ TreeMultiItemBase *b = item.GetItem();
+ if( b->GetCheckbox() )
+ b->SetCheckboxState( state );
+ RedrawFromNode( item.GetItem()->GetParent() );
+ };
+#endif
+
+ /** @}
+ */
+
+ /** @name Extended visibility and manipulation methods
+ These methods alter the wxTreeMultiCtrl appearance, or add more functionality like checkboxes before each node.
+ @{
+ */
+
+ /** Sets the Y spacing of the wxTreeMultiCtrl to a new size. This can be used to give the controls some more
+ spacing in between */
+
+ void SetSpacingY(int spacingY) {
+ if(spacingY >= 0)
+ {
+ _spacingY = spacingY;
+ RedrawFromNode(0);
+ }
+ };
+
+ /** Gets the Y spacing of the wxTreeMultiCtrl. */
+
+ int GetSpacingY() const {
+ return _spacingY;
+ };
+
+#if(CHECKBOXVIEW)
+ /** This method toggles the checkbox view mode. Whenever set to true, the next window item, or caption node item
+ will get a checkbox. <b>This needs USE_CHECKBOXVIEW set to YES, or CHECKBOXVIEW=1 during compile</b>
+ \sa GetCheckboxView, wxTreeMultiWindowInfo::SetDefaultCheckState
+ */
+ void SetCheckboxView(bool value) {
+ _checkboxView = value;
+ };
+
+ /** This method returns the checkbox state currently used. <b>This needs USE_CHECKBOXVIEW set to YES, or
+ CHECKBOXVIEW=1 during compile</b>
+ \sa SetCheckboxView, wxTreeMultiWindowInfo::SetDefaultCheckState, wxTreeMultiWindowInfo::GetDefaultCheckState
+ */
+ bool GetCheckboxView() const {
+ return _checkboxView;
+ };
+#endif
+
+ /** @}
+ */\r
+\r
+ /** @name Iteration methods\r
+ Allows the user to iterate through a wxTreeMultiCtrl node, and get all the children or siblings.\r
+ To start an iteration from the lowest level the functions GetFirstRoot and GetLastRoot are provided.\r
+ @{\r
+ */\r
+\r
+ /** Returns the first root. */\r
+ wxTreeMultiItem GetFirstRoot(void) const {return wxTreeMultiItem(this->_root.First());}\r
+\r
+ /** Returns the last root. */\r
+ wxTreeMultiItem GetLastRoot(void) const {return wxTreeMultiItem(this->_root.Last());}\r
+\r
+ /** Returns the items parent. */\r
+ wxTreeMultiItem GetParent(wxTreeMultiItem const& item) const;\r
+\r
+ /** Returns the first child of this node. The type of wxTreeMultiItem needs to be of Node. Whenever not succesful,\r
+ the item returned is not ok (IsOk = false). Upon success, a valid child is returned. The cookie variable doesn't\r
+ need to be initialized */\r
+ wxTreeMultiItem GetFirstChild(const wxTreeMultiItem &item, int &cookie) const;
+
+ /** Returns the next child in the iteration on the level of 'item'. Make sure you called GetFirstChild first
+ before calling this one */
+ wxTreeMultiItem GetNextChild(const wxTreeMultiItem &item, int &cookie) const;
+
+ /** Returns the last child of this node. The type of 'item' needs to be of Node. Whenever not succesful,
+ the item returned is not ok (IsOk = false). Upon success, a valid last child is returned. */\r
+ wxTreeMultiItem GetLastChild(const wxTreeMultiItem &item) const;\r
+\r
+ /** Returns the next sibling of the passed item. */\r
+ wxTreeMultiItem GetNextSibling(wxTreeMultiItem const& item) const;\r
+\r
+ /** Returns the previous sibling of the passed item. */\r
+ wxTreeMultiItem GetPrevSibling(wxTreeMultiItem const& item) const;\r
+\r
+ /** Returns the next item. "Next" is defined by the following order:\r
+ - in case the current item has a child it is the first child of the current item;\r
+ - in case the current item has a next sibling as the next sibling;\r
+ - as the parent's (or one of its ancestor's) next sibling.\r
+ */\r
+ wxTreeMultiItem GetNext(wxTreeMultiItem const& item) const;\r
+\r
+ /** Returns the previous item. "Previous" is defined by the following order:\r
+ - in case the current item has a child it is the last child of the current item;\r
+ - in case the current item has a previous sibling it is the previous sibling;\r
+ - as the parent's (or one of its ancestor's) previous sibling.\r
+ */\r
+ wxTreeMultiItem GetPrevious(wxTreeMultiItem const& item) const;\r
+\r
+\r
+ /** @}\r
+ */\r
+\r
+ /** @name Get and set methods
+ These methods allow you to set or get certain properties of the wxTreeMultiCtrl.
+ @{
+ */
+
+ /** Get the currently used font for the caption headers in the wxTreeMultiCtrl. If you want to alter this
+ font, simply obtain it and copy it to a local font. After that, set this font back using SetCaptionFont()
+ */
+ const wxFont &GetCaptionFont() const {
+ return _captionFont;
+ };
+
+ /** Sets the font to be used for the text caption headers. This triggers a complete redraw because x,y sizes can
+ differ, and ofcourse all nodes need to be updated. You can call this method at any time not only at the
+ beginning. */
+ void SetCaptionFont(const wxFont &font);
+
+ /** @}\r
+ */\r
+\r
+ void OnDraw(wxDC& dc);\r
+\r
+private:\r
+ DECLARE_EVENT_TABLE()\r
+};\r
+
+#endif
--- /dev/null
+
+#include "wx/treemultictrl/wxTreeMultiEvent.h"
+
+
+// constructors / destructor:
+wxTreeMultiEvent::wxTreeMultiEvent(wxEventType InitEventType, wxTreeMultiItem const& InitItem)
+ :wxNotifyEvent(InitEventType), m_Item(InitItem)
+{
+} /* wxTreeMultiEvent::wxTreeMultiEvent(wxEventType, wxTreeMultiItem const&) */
+
+// inherited functions:
+// wxEvent:
+// cloning:
+
+// class identification:
+IMPLEMENT_DYNAMIC_CLASS(wxTreeMultiEvent, wxNotifyEvent)
+
+// event types:
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_BEGIN_DRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_BEGIN_RDRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_BEGIN_LABEL_EDIT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_END_LABEL_EDIT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_DELETE_ITEM)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_GET_INFO)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_SET_INFO)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_EXPANDED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_EXPANDING)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_COLLAPSED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_COLLAPSING)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGING)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_KEY_DOWN)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_ACTIVATED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_RIGHT_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_MIDDLE_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_END_DRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_STATE_IMAGE_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_GETTOOLTIP)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_MENU)
+
--- /dev/null
+
+#ifndef wxtreemultievent_header
+#define wxtreemultievent_header
+
+#include "wx/event.h"
+
+#include "wx/treemultictrl/wxTreeMultiCtrl.h"
+
+
+/**
+ \section treemultievent Event handlers for wxTreeMultiCtrl
+
+ Event handlers for wxTreeMultiCtrl are similar to wxTreeEvents. But they are
+ optimized for the wxTreeMultiCtrl class.
+*/
+
+class WXDLLEXPORT wxTreeMultiEvent : public wxNotifyEvent
+{
+public:
+ ///
+ /// The default constructor
+ ///
+ wxTreeMultiEvent(wxEventType EventType=wxEVT_NULL, wxTreeMultiItem const& InitItem=wxTreeMultiItem());
+
+ // inherited functions:
+ // wxEvent:
+ // cloning:
+ virtual wxEvent* Clone() const {return new wxTreeMultiEvent(*this);}
+
+ // item handling:
+ wxTreeMultiItem GetItem(void) const
+ {
+ return this->m_Item;
+ }
+ void SetItem(wxTreeMultiItem const& NewItem)
+ {
+ this->m_Item = NewItem;
+ }
+
+ // old item handling:
+ wxTreeMultiItem GetOldItem(void) const
+ {
+ return this->m_OldItem;
+ }
+ void SetOldItem(wxTreeMultiItem const& NewItem)
+ {
+ this->m_OldItem = NewItem;
+ }
+
+protected:
+private:
+ // variables:
+ wxTreeMultiItem m_Item, m_OldItem;
+
+ // class identification:
+ DECLARE_DYNAMIC_CLASS(wxTreeMultiEvent)
+};
+
+
+// event handler function:
+typedef void (wxEvtHandler::*wxTreeMultiEventFunction)(wxTreeMultiEvent&);
+
+// event types:
+BEGIN_DECLARE_EVENT_TYPES()
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_BEGIN_DRAG, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_BEGIN_RDRAG, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_BEGIN_LABEL_EDIT, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_END_LABEL_EDIT, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_DELETE_ITEM, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_GET_INFO, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_SET_INFO, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_EXPANDED, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_EXPANDING, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_COLLAPSED, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_COLLAPSING, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGED, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGING, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_KEY_DOWN, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_ACTIVATED, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_RIGHT_CLICK, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_MIDDLE_CLICK, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_END_DRAG, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_STATE_IMAGE_CLICK, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_GETTOOLTIP, -1)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_MULTI_ITEM_MENU, -1)
+END_DECLARE_EVENT_TYPES()
+
+#define wxTreeMultiEventHandler(func) (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxTreeMultiEventFunction, &func)
+
+
+// standard events similar or identical to wxTreeEvent:
+#define EVT_TREE_MULTI_BEGIN_DRAG (id,fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_BEGIN_DRAG, id,wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_BEGIN_RDRAG(id,fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_BEGIN_RDRAG,id,wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_END_DRAG (id,fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_END_DRAG, id,wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_END_LABEL_EDIT(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_END_LABEL_EDIT, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_GET_INFO(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_GET_INFO, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_SET_INFO(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_SET_INFO, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_EXPANDED(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_EXPANDED, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_EXPANDING(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_EXPANDING, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_COLLAPSED(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_COLLAPSED, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_COLLAPSING(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_COLLAPSING, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_SEL_CHANGED(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_SEL_CHANGED, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_SEL_CHANGING(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_SEL_CHANGING, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_KEY_DOWN(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_KEY_DOWN, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_DELETE_ITEM(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_DELETE_ITEM, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_ACTIVATED(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_ACTIVATED, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_MENU(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_MENU, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_RIGHT_CLICK, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_MIDDLE_CLICK, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, id, wxTreeMultiEventHandler(fn))
+#define EVT_TREE_MULTI_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_MULTI_ITEM_GETTOOLTIP, id, wxTreeMultiEventHandler(fn))
+
+#endif
Program: bbtk
Module: $RCSfile: bbtkFactory.h,v $
Language: C++
- Date: $Date: 2008/03/07 08:40:14 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2008/03/28 13:42:17 $
+ Version: $Revision: 1.11 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
std::string pkgname,
std::string path);
+ public:
/// The structure storing info on a package
class PackageInfoType
{
};
/// The type of map of packages
typedef std::map< std::string, PackageInfoType > PackageMapType;
+
+ const PackageMapType& GetPackageMap() const { return mPackageMap; }
+
+ private:
/// The map of packages
PackageMapType mPackageMap;
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbtkWxGUIPackageBrowser.cxx,v $
+ Language: C++
+ Date: $Date: 2008/03/28 13:42:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*//**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief
+ */
+/**
+ * \class bbtk::
+ * \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+#include "bbtkWxGUIPackageBrowser.h"
+#include "ThirdParty/wx/treemultictrl/wxTreeMultiCtrl.h"
+#include "bbtkInterpreter.h"
+
+namespace bbtk
+{
+ //================================================================
+ WxGUIPackageBrowserBlackBox::WxGUIPackageBrowserBlackBox(wxWindow* parent,
+ WxGUIPackageBrowser* browser,
+ BlackBoxDescriptor* descr) :
+ wxPanel(parent, -1),
+ mBrowser(browser),
+ mDescriptor(descr)
+ {
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+ wxStaticText* s = new wxStaticText(this,-1,
+ std2wx(descr->GetTypeName()));
+
+ sizer->Add(s,1,wxGROW);
+
+ SetSizer(sizer);
+ SetAutoLayout(true);
+ Layout();
+ }
+ //================================================================
+
+
+ //================================================================
+ WxGUIPackageBrowserBlackBox::~WxGUIPackageBrowserBlackBox()
+ {
+ }
+ //================================================================
+
+
+ //================================================================
+ WxGUIPackageBrowser::WxGUIPackageBrowser( wxWindow *parent,
+ WxGUIPackageBrowserUser* user )
+ : wxPanel(parent, -1),
+ mUser(user),
+ mInterpreter(0)
+ {
+ std::cout << "WxGUIPackageBrowser::WxGUIPackageBrowser"<<std::endl;
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ mTree = new wxTreeMultiCtrl(this, -1);
+
+ mTree->SetBackgroundColour(*wxWHITE);
+ sizer->Add(mTree,1,wxGROW);
+
+#ifndef LINUX
+ wxTreeMultiWindowInfo wndinfo(wxTMC_BG_ADJUST_CNT, 8, 0);
+#else
+ wxTreeMultiWindowInfo wndinfo(wxTMC_BG_ADJUST_ALL, 8, 0);
+#endif
+
+ // make it a bit bigger
+ wxFont somefont;
+ somefont = mTree->GetCaptionFont();
+ somefont.SetFamily(wxMODERN);
+ somefont.SetWeight(wxBOLD);
+ somefont.SetPointSize(somefont.GetPointSize()+1);
+ mTree->SetCaptionFont(somefont);
+
+ mTree->SetSpacingY(1);
+
+ SetSizer(sizer);
+ SetAutoLayout(true);
+ Layout();
+
+ }
+ //================================================================
+
+ //================================================================
+ WxGUIPackageBrowser::~WxGUIPackageBrowser()
+ {
+ if (mInterpreter) delete mInterpreter;
+ }
+ //================================================================
+
+ //================================================================
+ void WxGUIPackageBrowser::IncludeAll()
+ {
+#ifndef LINUX
+ wxTreeMultiWindowInfo wndinfo(wxTMC_BG_ADJUST_CNT, 8, 0);
+#else
+ wxTreeMultiWindowInfo wndinfo(wxTMC_BG_ADJUST_ALL, 8, 0);
+#endif
+
+ if (!mInterpreter) mInterpreter = new bbtk::Interpreter();
+ mInterpreter->SetCommandLine(true);
+ mInterpreter->InterpretLine("include *");
+
+ Factory* F = mInterpreter->GetExecuter()->GetFactory();
+
+ const Factory::PackageMapType& M = F->GetPackageMap();
+ Factory::PackageMapType::const_iterator i;
+ for (i=M.begin();i!=M.end();++i)
+ {
+ Package* P = i->second.mPackage;
+ wxString packname = std2wx(P->GetName());
+ if (packname==_T("user")) continue;
+ wxTreeMultiItem pack = mTree->AddRoot(packname,packname);
+
+ Package::BlackBoxMapType::iterator j;
+ for (j=P->GetBlackBoxMap().begin();
+ j!=P->GetBlackBoxMap().end();
+ ++j)
+ {
+ wxString boxname = std2wx(j->second->GetTypeName());
+ wxTreeMultiItem box = mTree->AppendNode(pack,boxname,boxname);
+ WxGUIPackageBrowserBlackBox* boxdescr
+ = new WxGUIPackageBrowserBlackBox(mTree,this,j->second);
+ mTree->AppendWindow(box, boxdescr, _T(""),
+ wndinfo, wxTMC_SPAN_WIDTH);
+
+ }
+ }
+ mTree->CollapseNodes(true);
+
+ // Test exclude
+ // wxTreeMultiItem item = mTree->FindItem(_T("Add"));
+ // if(item.IsOk()) mTree->Exclude(item);
+ }
+ //================================================================
+
+ //================================================================
+ WxGUIPackageBrowserWindow::WxGUIPackageBrowserWindow( wxWindow *parent,
+ wxString title,
+ wxSize size)
+ : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
+ {
+
+
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+ mBrowser = new WxGUIPackageBrowser(this);
+ mBrowser->IncludeAll();
+ sizer->Add(mBrowser,1,wxGROW);
+
+ // WxGUICommand* com = new WxGUICommand(this,this);
+ // sizer->Add(com);
+
+ SetSizer(sizer);
+
+ // Creates and sets the parent window of all bbtk windows
+ wxWindow* top = new wxPanel(this,-1);
+ top->Hide();
+
+ Wx::SetTopWindow(top);
+
+ SetAutoLayout(true);
+ Layout();
+ }
+ //================================================================
+
+ //================================================================
+ WxGUIPackageBrowserWindow::~WxGUIPackageBrowserWindow()
+ {
+ }
+ //================================================================
+
+} // namespace bbtk
+
+
+#endif //_USE_WXWIDGETS_
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbtkWxGUIPackageBrowser.h,v $
+ Language: C++
+ Date: $Date: 2008/03/28 13:42:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*//**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief
+ */
+/**
+ * \class bbtk::
+ * \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#ifndef __bbtkWxGUIPackageBrowser_h__
+#define __bbtkWxGUIPackageBrowser_h__
+
+
+#include "bbtkWx.h"
+
+#include "bbtkInterpreter.h"
+
+class wxTreeMultiCtrl;
+
+namespace bbtk
+{
+ //================================================================
+ class WxGUIPackageBrowser;
+ //================================================================
+
+
+ //================================================================
+ /// Abstract class which defines the callbacks invoked by WxGUIPackageBrowser
+ class BBTK_EXPORT WxGUIPackageBrowserUser
+ {
+ public:
+ WxGUIPackageBrowserUser() {}
+ ~WxGUIPackageBrowserUser() {}
+ /// Callback invoked when the 'run' button is pressed
+ virtual void WxGUIPackageBrowserRun() {}
+ };
+ //================================================================
+
+ //================================================================
+ class WxGUIPackageBrowserBlackBox : public wxPanel
+ {
+ public:
+ WxGUIPackageBrowserBlackBox(wxWindow* parent,
+ WxGUIPackageBrowser* browser,
+ BlackBoxDescriptor* descr);
+ ~WxGUIPackageBrowserBlackBox();
+
+ private:
+ WxGUIPackageBrowser* mBrowser;
+ BlackBoxDescriptor* mDescriptor;
+ } ;
+ //================================================================
+
+
+ //================================================================
+ /// A package browser panel
+ class BBTK_EXPORT WxGUIPackageBrowser : public wxPanel
+ {
+ public:
+ WxGUIPackageBrowser( wxWindow *parent,
+ WxGUIPackageBrowserUser* user = 0 );
+ ~WxGUIPackageBrowser();
+
+ void IncludeAll();
+
+ private:
+ WxGUIPackageBrowserUser* mUser;
+ Interpreter* mInterpreter;
+ wxTreeMultiCtrl* mTree;
+
+ };
+ //================================================================
+
+
+ //================================================================
+ /// Browser in a frame
+ class BBTK_EXPORT WxGUIPackageBrowserWindow : public wxFrame
+ //, public WxGUICommandUser
+ {
+ public:
+ WxGUIPackageBrowserWindow( wxWindow *parent, wxString title, wxSize size);
+ ~WxGUIPackageBrowserWindow();
+ // void Open(const std::string& filename) { mBrowser->Open(filename); }
+ // void WxGUICommandEnter(const std::string& s);
+
+
+ private :
+
+ WxGUIPackageBrowser* mBrowser;
+ };
+ //================================================================
+
+
+} // namespace bbtk
+
+
+#endif // __bbtkWxGUIPackageBrowser_h__
+
+#endif //_USE_WXWIDGETS_