Applied Greg's patch to tree control and related.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1170,21 +1170,6 @@ enum wxBorder
|
|||||||
#define wxSB_HORIZONTAL wxHORIZONTAL
|
#define wxSB_HORIZONTAL wxHORIZONTAL
|
||||||
#define wxSB_VERTICAL wxVERTICAL
|
#define wxSB_VERTICAL wxVERTICAL
|
||||||
|
|
||||||
/*
|
|
||||||
* wxTreeCtrl flags
|
|
||||||
*/
|
|
||||||
#define wxTR_HAS_BUTTONS 0x0004
|
|
||||||
#define wxTR_EDIT_LABELS 0x0008
|
|
||||||
#define wxTR_LINES_AT_ROOT 0x0010
|
|
||||||
|
|
||||||
#define wxTR_SINGLE 0x0000
|
|
||||||
#define wxTR_MULTIPLE 0x0020
|
|
||||||
#define wxTR_EXTENDED 0x0040
|
|
||||||
#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080
|
|
||||||
#define wxTR_NO_LINES 0x0100
|
|
||||||
#define wxTR_MAC_BUTTONS 0x0200
|
|
||||||
#define wxTR_ROW_LINES 0x0400
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxSpinButton flags.
|
* wxSpinButton flags.
|
||||||
* Note that a wxSpinCtrl is sometimes defined as
|
* Note that a wxSpinCtrl is sometimes defined as
|
||||||
|
@@ -18,16 +18,8 @@
|
|||||||
|
|
||||||
#if wxUSE_TREECTRL
|
#if wxUSE_TREECTRL
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
#include "wx/string.h"
|
|
||||||
#include "wx/object.h"
|
|
||||||
#include "wx/event.h"
|
|
||||||
#include "wx/scrolwin.h"
|
#include "wx/scrolwin.h"
|
||||||
#include "wx/textctrl.h"
|
|
||||||
#include "wx/pen.h"
|
#include "wx/pen.h"
|
||||||
#include "wx/dynarray.h"
|
|
||||||
#include "wx/timer.h"
|
|
||||||
#include "wx/treebase.h"
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// forward declaration
|
// forward declaration
|
||||||
@@ -55,11 +47,7 @@ public:
|
|||||||
wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = -1,
|
wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
#ifdef __WXMAC__
|
long style = wxTR_DEFAULT_STYLE,
|
||||||
long style = wxTR_MAC_BUTTONS | wxTR_NO_LINES | wxTR_ROW_LINES,
|
|
||||||
#else
|
|
||||||
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
|
|
||||||
#endif
|
|
||||||
const wxValidator &validator = wxDefaultValidator,
|
const wxValidator &validator = wxDefaultValidator,
|
||||||
const wxString& name = wxTreeCtrlNameStr)
|
const wxString& name = wxTreeCtrlNameStr)
|
||||||
{
|
{
|
||||||
@@ -72,11 +60,7 @@ public:
|
|||||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
#ifdef __WXMAC__
|
long style = wxTR_DEFAULT_STYLE,
|
||||||
long style = wxTR_MAC_BUTTONS | wxTR_NO_LINES | wxTR_ROW_LINES,
|
|
||||||
#else
|
|
||||||
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
|
|
||||||
#endif
|
|
||||||
const wxValidator &validator = wxDefaultValidator,
|
const wxValidator &validator = wxDefaultValidator,
|
||||||
const wxString& name = wxTreeCtrlNameStr);
|
const wxString& name = wxTreeCtrlNameStr);
|
||||||
|
|
||||||
@@ -110,18 +94,21 @@ public:
|
|||||||
// checked/unchecked) which are taken from the state image list.
|
// checked/unchecked) which are taken from the state image list.
|
||||||
wxImageList *GetImageList() const;
|
wxImageList *GetImageList() const;
|
||||||
wxImageList *GetStateImageList() const;
|
wxImageList *GetStateImageList() const;
|
||||||
|
wxImageList *GetButtonsImageList() const;
|
||||||
|
|
||||||
void SetImageList(wxImageList *imageList);
|
void SetImageList(wxImageList *imageList);
|
||||||
void SetStateImageList(wxImageList *imageList);
|
void SetStateImageList(wxImageList *imageList);
|
||||||
|
void SetButtonsImageList(wxImageList *imageList);
|
||||||
void AssignImageList(wxImageList *imageList);
|
void AssignImageList(wxImageList *imageList);
|
||||||
void AssignStateImageList(wxImageList *imageList);
|
void AssignStateImageList(wxImageList *imageList);
|
||||||
|
void AssignButtonsImageList(wxImageList *imageList);
|
||||||
|
|
||||||
// Functions to work with tree ctrl items.
|
// Functions to work with tree ctrl items.
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
// ---------
|
// ---------
|
||||||
|
|
||||||
// retrieve items label
|
// retrieve item's label
|
||||||
wxString GetItemText(const wxTreeItemId& item) const;
|
wxString GetItemText(const wxTreeItemId& item) const;
|
||||||
// get one of the images associated with the item (normal by default)
|
// get one of the images associated with the item (normal by default)
|
||||||
int GetItemImage(const wxTreeItemId& item,
|
int GetItemImage(const wxTreeItemId& item,
|
||||||
@@ -132,7 +119,7 @@ public:
|
|||||||
// modifiers
|
// modifiers
|
||||||
// ---------
|
// ---------
|
||||||
|
|
||||||
// set items label
|
// set item's label
|
||||||
void SetItemText(const wxTreeItemId& item, const wxString& text);
|
void SetItemText(const wxTreeItemId& item, const wxString& text);
|
||||||
// get one of the images associated with the item (normal by default)
|
// get one of the images associated with the item (normal by default)
|
||||||
void SetItemImage(const wxTreeItemId& item, int image,
|
void SetItemImage(const wxTreeItemId& item, int image,
|
||||||
@@ -149,18 +136,22 @@ public:
|
|||||||
// the item will be shown in bold
|
// the item will be shown in bold
|
||||||
void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
|
void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
|
||||||
|
|
||||||
// set the items text colour
|
// set the item's text colour
|
||||||
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
|
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
|
||||||
|
|
||||||
// set the items background colour
|
// set the item's background colour
|
||||||
void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
|
void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
|
||||||
|
|
||||||
// set the items font (should be of the same height for all items)
|
// set the item's font (should be of the same height for all items)
|
||||||
void SetItemFont(const wxTreeItemId& item, const wxFont& font);
|
void SetItemFont(const wxTreeItemId& item, const wxFont& font);
|
||||||
|
|
||||||
// set the window font
|
// set the window font
|
||||||
virtual bool SetFont( const wxFont &font );
|
virtual bool SetFont( const wxFont &font );
|
||||||
|
|
||||||
|
// set the styles. No need to specify a GetWindowStyle here since
|
||||||
|
// the base wxWindow member function will do it for us
|
||||||
|
void SetWindowStyle(const long styles);
|
||||||
|
|
||||||
// item status inquiries
|
// item status inquiries
|
||||||
// ---------------------
|
// ---------------------
|
||||||
|
|
||||||
@@ -176,6 +167,7 @@ public:
|
|||||||
bool IsSelected(const wxTreeItemId& item) const;
|
bool IsSelected(const wxTreeItemId& item) const;
|
||||||
// is item text in bold font?
|
// is item text in bold font?
|
||||||
bool IsBold(const wxTreeItemId& item) const;
|
bool IsBold(const wxTreeItemId& item) const;
|
||||||
|
// does the layout include space for a button?
|
||||||
|
|
||||||
// number of children
|
// number of children
|
||||||
// ------------------
|
// ------------------
|
||||||
@@ -296,6 +288,7 @@ public:
|
|||||||
void EnsureVisible(const wxTreeItemId& item);
|
void EnsureVisible(const wxTreeItemId& item);
|
||||||
// scroll to this item (but don't expand its parent)
|
// scroll to this item (but don't expand its parent)
|
||||||
void ScrollTo(const wxTreeItemId& item);
|
void ScrollTo(const wxTreeItemId& item);
|
||||||
|
void AdjustMyScrollbars();
|
||||||
|
|
||||||
// The first function is more portable (because easier to implement
|
// The first function is more portable (because easier to implement
|
||||||
// on other platforms), but the second one returns some extra info.
|
// on other platforms), but the second one returns some extra info.
|
||||||
@@ -360,29 +353,30 @@ protected:
|
|||||||
|
|
||||||
wxGenericTreeItem *m_anchor;
|
wxGenericTreeItem *m_anchor;
|
||||||
wxGenericTreeItem *m_current, *m_key_current, *m_currentEdit;
|
wxGenericTreeItem *m_current, *m_key_current, *m_currentEdit;
|
||||||
bool m_hasFocus;
|
unsigned short m_indent;
|
||||||
bool m_dirty;
|
unsigned short m_spacing;
|
||||||
int m_xScroll,m_yScroll;
|
|
||||||
unsigned int m_indent;
|
|
||||||
unsigned int m_spacing;
|
|
||||||
int m_lineHeight;
|
int m_lineHeight;
|
||||||
wxPen m_dottedPen;
|
wxPen m_dottedPen;
|
||||||
wxBrush *m_hilightBrush;
|
wxBrush *m_hilightBrush;
|
||||||
wxImageList *m_imageListNormal,
|
bool m_hasFocus;
|
||||||
*m_imageListState;
|
bool m_dirty;
|
||||||
bool m_ownsImageListNormal,
|
bool m_ownsImageListNormal,
|
||||||
m_ownsImageListState;
|
m_ownsImageListState,
|
||||||
|
m_ownsImageListButtons;
|
||||||
|
bool m_isDragging; // true between BEGIN/END drag events
|
||||||
|
bool m_renameAccept;
|
||||||
|
bool m_lastOnSame; // last click on the same item as prev
|
||||||
|
wxImageList *m_imageListNormal,
|
||||||
|
*m_imageListState,
|
||||||
|
*m_imageListButtons;
|
||||||
|
|
||||||
int m_dragCount;
|
int m_dragCount;
|
||||||
wxPoint m_dragStart;
|
wxPoint m_dragStart;
|
||||||
bool m_isDragging; // true between BEGIN/END drag events
|
|
||||||
wxGenericTreeItem *m_dropTarget;
|
wxGenericTreeItem *m_dropTarget;
|
||||||
wxCursor m_oldCursor; // cursor is changed while dragging
|
wxCursor m_oldCursor; // cursor is changed while dragging
|
||||||
wxGenericTreeItem *m_oldSelection;
|
wxGenericTreeItem *m_oldSelection;
|
||||||
|
|
||||||
wxTimer *m_renameTimer;
|
wxTimer *m_renameTimer;
|
||||||
bool m_renameAccept;
|
|
||||||
bool m_lastOnSame; // last click on the same item as prev
|
|
||||||
wxString m_renameRes;
|
wxString m_renameRes;
|
||||||
|
|
||||||
// the common part of all ctors
|
// the common part of all ctors
|
||||||
@@ -394,10 +388,12 @@ protected:
|
|||||||
const wxString& text,
|
const wxString& text,
|
||||||
int image, int selectedImage,
|
int image, int selectedImage,
|
||||||
wxTreeItemData *data);
|
wxTreeItemData *data);
|
||||||
|
bool HasButtons(void) const
|
||||||
|
{ return (m_imageListButtons != NULL)
|
||||||
|
|| HasFlag(wxTR_TWIST_BUTTONS|wxTR_HAS_BUTTONS); }
|
||||||
|
|
||||||
public:
|
|
||||||
void AdjustMyScrollbars();
|
|
||||||
protected:
|
protected:
|
||||||
|
void CalculateLineHeight();
|
||||||
int GetLineHeight(wxGenericTreeItem *item) const;
|
int GetLineHeight(wxGenericTreeItem *item) const;
|
||||||
void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y );
|
void PaintLevel( wxGenericTreeItem *item, wxDC& dc, int level, int &y );
|
||||||
void PaintItem( wxGenericTreeItem *item, wxDC& dc);
|
void PaintItem( wxGenericTreeItem *item, wxDC& dc);
|
||||||
@@ -433,24 +429,22 @@ private:
|
|||||||
|
|
||||||
class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl
|
class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
|
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
|
||||||
|
|
||||||
|
public:
|
||||||
wxTreeCtrl() {}
|
wxTreeCtrl() {}
|
||||||
|
|
||||||
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
|
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
|
long style = wxTR_DEFAULT_STYLE,
|
||||||
const wxValidator &validator = wxDefaultValidator,
|
const wxValidator &validator = wxDefaultValidator,
|
||||||
const wxString& name = wxTreeCtrlNameStr)
|
const wxString& name = wxTreeCtrlNameStr)
|
||||||
|
: wxGenericTreeCtrl(parent, id, pos, size, style, validator, name)
|
||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, validator, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#endif // !__WXMSW__ || __WIN16__ || __WXUNIVERSAL__
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // wxUSE_TREECTRL
|
#endif // wxUSE_TREECTRL
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#if wxUSE_TREECTRL
|
#if wxUSE_TREECTRL
|
||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/window.h" // for wxClientData
|
||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -110,6 +110,40 @@ enum wxTreeItemIcon
|
|||||||
wxTreeItemIcon_Max
|
wxTreeItemIcon_Max
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum wxButtonImage // effectively the same as wxTreeItemIcon
|
||||||
|
{
|
||||||
|
wxCLOSED_BUTTON = 0, // closed, not selected
|
||||||
|
wxCLOSED_BUTTON_SELECTED, // closed, selected
|
||||||
|
wxOPEN_BUTTON, // open, not selected
|
||||||
|
wxOPEN_BUTTON_SELECTED // open, selected
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wxTreeCtrl flags
|
||||||
|
*/
|
||||||
|
// TODO: maybe renumber these?
|
||||||
|
#define wxTR_NO_BUTTONS 0x0000 // for convenience
|
||||||
|
#define wxTR_HAS_BUTTONS 0x0004 // generates a +/- button
|
||||||
|
#define wxTR_TWIST_BUTTONS 0x0008 // twister buttons
|
||||||
|
#define wxTR_NO_LINES 0x0100 // don't generate level connectors
|
||||||
|
#define wxTR_MAC_BUTTONS wxTR_TWIST_BUTTONS // backward compatibility
|
||||||
|
|
||||||
|
#define wxTR_SINGLE 0x0000 // for convenience
|
||||||
|
#define wxTR_MULTIPLE 0x0020 // can select multiple items
|
||||||
|
#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
|
||||||
|
|
||||||
|
#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
|
||||||
|
#define wxTR_LINES_AT_ROOT 0x0010 // specific to wxMSW
|
||||||
|
#define wxTR_HIDE_ROOT 0x0800 // don't display root node
|
||||||
|
#define wxTR_ROW_LINES 0x0400 // put border around items
|
||||||
|
#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
|
||||||
|
|
||||||
|
// TODO: different default styles for wxGTK, wxMotif, whatever?
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
#define wxTR_DEFAULT_STYLE (wxTR_TWIST_BUTTONS|wxTR_NO_LINES|wxTR_ROW_LINES)
|
||||||
|
#else
|
||||||
|
#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT)
|
||||||
|
#endif
|
||||||
|
|
||||||
// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
|
// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
|
||||||
// where exactly the specified point is situated:
|
// where exactly the specified point is situated:
|
||||||
@@ -220,8 +254,6 @@ private:
|
|||||||
m_itemOld;
|
m_itemOld;
|
||||||
wxPoint m_pointDrag;
|
wxPoint m_pointDrag;
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxTreeEvent)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&);
|
typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&);
|
||||||
@@ -303,6 +335,5 @@ END_DECLARE_EVENT_TYPES()
|
|||||||
|
|
||||||
#endif // wxUSE_TREECTRL
|
#endif // wxUSE_TREECTRL
|
||||||
|
|
||||||
#endif
|
#endif // _WX_TREEBASE_H_
|
||||||
// _WX_TREEBASE_H_
|
|
||||||
|
|
||||||
|
@@ -36,7 +36,5 @@
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif // _WX_TREECTRL_H_BASE_
|
||||||
// _WX_TREECTRL_H_BASE_
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -65,37 +65,48 @@
|
|||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_SIZE(MyFrame::OnSize)
|
EVT_SIZE(MyFrame::OnSize)
|
||||||
|
|
||||||
EVT_MENU(TreeTest_Quit, MyFrame::OnQuit)
|
#define MENU_LINK(name) EVT_MENU(TreeTest_##name, MyFrame::On##name)
|
||||||
EVT_MENU(TreeTest_About, MyFrame::OnAbout)
|
MENU_LINK(Quit)
|
||||||
EVT_MENU(TreeTest_Dump, MyFrame::OnDump)
|
MENU_LINK(About)
|
||||||
|
MENU_LINK(TogButtons)
|
||||||
|
MENU_LINK(TogTwist)
|
||||||
|
MENU_LINK(TogLines)
|
||||||
|
MENU_LINK(TogEdit)
|
||||||
|
MENU_LINK(TogHideRoot)
|
||||||
|
MENU_LINK(TogRootLines)
|
||||||
|
MENU_LINK(TogBorder)
|
||||||
|
MENU_LINK(Dump)
|
||||||
#ifndef NO_MULTIPLE_SELECTION
|
#ifndef NO_MULTIPLE_SELECTION
|
||||||
EVT_MENU(TreeTest_DumpSelected, MyFrame::OnDumpSelected)
|
MENU_LINK(DumpSelected)
|
||||||
EVT_MENU(TreeTest_Select, MyFrame::OnSelect)
|
MENU_LINK(Select)
|
||||||
EVT_MENU(TreeTest_Unselect, MyFrame::OnUnselect)
|
MENU_LINK(Unselect)
|
||||||
EVT_MENU(TreeTest_ToggleSel, MyFrame::OnToggleSel)
|
MENU_LINK(ToggleSel)
|
||||||
#endif // NO_MULTIPLE_SELECTION
|
#endif // NO_MULTIPLE_SELECTION
|
||||||
EVT_MENU(TreeTest_Rename, MyFrame::OnRename)
|
MENU_LINK(Rename)
|
||||||
EVT_MENU(TreeTest_Count, MyFrame::OnCount)
|
MENU_LINK(Count)
|
||||||
EVT_MENU(TreeTest_CountRec, MyFrame::OnCountRec)
|
MENU_LINK(CountRec)
|
||||||
EVT_MENU(TreeTest_Sort, MyFrame::OnSort)
|
MENU_LINK(Sort)
|
||||||
EVT_MENU(TreeTest_SortRev, MyFrame::OnSortRev)
|
MENU_LINK(SortRev)
|
||||||
EVT_MENU(TreeTest_Bold, MyFrame::OnSetBold)
|
MENU_LINK(SetBold)
|
||||||
EVT_MENU(TreeTest_UnBold, MyFrame::OnClearBold)
|
MENU_LINK(ClearBold)
|
||||||
EVT_MENU(TreeTest_Delete, MyFrame::OnDelete)
|
MENU_LINK(Delete)
|
||||||
EVT_MENU(TreeTest_DeleteChildren, MyFrame::OnDeleteChildren)
|
MENU_LINK(DeleteChildren)
|
||||||
EVT_MENU(TreeTest_DeleteAll, MyFrame::OnDeleteAll)
|
MENU_LINK(DeleteAll)
|
||||||
EVT_MENU(TreeTest_Recreate, MyFrame::OnRecreate)
|
MENU_LINK(Recreate)
|
||||||
EVT_MENU(TreeTest_ToggleImages, MyFrame::OnToggleImages)
|
MENU_LINK(ToggleImages)
|
||||||
EVT_MENU(TreeTest_SetImageSize, MyFrame::OnSetImageSize)
|
MENU_LINK(ToggleButtons)
|
||||||
EVT_MENU(TreeTest_CollapseAndReset, MyFrame::OnCollapseAndReset)
|
MENU_LINK(SetImageSize)
|
||||||
EVT_MENU(TreeTest_EnsureVisible, MyFrame::OnEnsureVisible)
|
MENU_LINK(CollapseAndReset)
|
||||||
EVT_MENU(TreeTest_AddItem, MyFrame::OnAddItem)
|
MENU_LINK(EnsureVisible)
|
||||||
EVT_MENU(TreeTest_InsertItem, MyFrame::OnInsertItem)
|
MENU_LINK(AddItem)
|
||||||
EVT_MENU(TreeTest_IncIndent, MyFrame::OnIncIndent)
|
MENU_LINK(InsertItem)
|
||||||
EVT_MENU(TreeTest_DecIndent, MyFrame::OnDecIndent)
|
MENU_LINK(IncIndent)
|
||||||
EVT_MENU(TreeTest_IncSpacing, MyFrame::OnIncSpacing)
|
MENU_LINK(DecIndent)
|
||||||
EVT_MENU(TreeTest_DecSpacing, MyFrame::OnDecSpacing)
|
MENU_LINK(IncSpacing)
|
||||||
EVT_MENU(TreeTest_ToggleIcon, MyFrame::OnToggleIcon)
|
MENU_LINK(DecSpacing)
|
||||||
|
MENU_LINK(ToggleIcon)
|
||||||
|
#undef MENU_LINK
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#if USE_GENERIC_TREECTRL
|
#if USE_GENERIC_TREECTRL
|
||||||
@@ -158,6 +169,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
|||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenu *file_menu = new wxMenu,
|
wxMenu *file_menu = new wxMenu,
|
||||||
|
*style_menu = new wxMenu,
|
||||||
*tree_menu = new wxMenu,
|
*tree_menu = new wxMenu,
|
||||||
*item_menu = new wxMenu;
|
*item_menu = new wxMenu;
|
||||||
|
|
||||||
@@ -165,11 +177,21 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
|||||||
file_menu->AppendSeparator();
|
file_menu->AppendSeparator();
|
||||||
file_menu->Append(TreeTest_Quit, "E&xit\tAlt-X");
|
file_menu->Append(TreeTest_Quit, "E&xit\tAlt-X");
|
||||||
|
|
||||||
|
style_menu->Append(TreeTest_TogButtons, "Toggle &normal buttons");
|
||||||
|
style_menu->Append(TreeTest_TogTwist, "Toggle &twister buttons");
|
||||||
|
style_menu->Append(TreeTest_ToggleButtons, "Toggle image &buttons");
|
||||||
|
style_menu->AppendSeparator();
|
||||||
|
style_menu->Append(TreeTest_TogLines, "Toggle &connecting lines");
|
||||||
|
style_menu->Append(TreeTest_TogRootLines, "Toggle &lines at root");
|
||||||
|
style_menu->Append(TreeTest_TogHideRoot, "Toggle &hidden root");
|
||||||
|
style_menu->Append(TreeTest_TogBorder, "Toggle &item border");
|
||||||
|
style_menu->Append(TreeTest_TogEdit, "Toggle &edit mode");
|
||||||
#ifndef NO_MULTIPLE_SELECTION
|
#ifndef NO_MULTIPLE_SELECTION
|
||||||
tree_menu->Append(TreeTest_ToggleSel, "&Toggle selection mode");
|
style_menu->Append(TreeTest_ToggleSel, "Toggle &selection mode");
|
||||||
#endif // NO_MULTIPLE_SELECTION
|
#endif // NO_MULTIPLE_SELECTION
|
||||||
tree_menu->Append(TreeTest_ToggleImages, "&Show images", "", TRUE);
|
style_menu->Append(TreeTest_ToggleImages, "Toggle show ima&ges");
|
||||||
tree_menu->Append(TreeTest_SetImageSize, "Set image si&ze...");
|
style_menu->Append(TreeTest_SetImageSize, "Set image si&ze...");
|
||||||
|
|
||||||
tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
|
tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
|
||||||
tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
|
tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
|
||||||
tree_menu->AppendSeparator();
|
tree_menu->AppendSeparator();
|
||||||
@@ -197,10 +219,10 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
|||||||
item_menu->Append(TreeTest_Rename, "&Rename item...");
|
item_menu->Append(TreeTest_Rename, "&Rename item...");
|
||||||
|
|
||||||
item_menu->AppendSeparator();
|
item_menu->AppendSeparator();
|
||||||
item_menu->Append(TreeTest_Bold, "Make item &bold");
|
item_menu->Append(TreeTest_SetBold, "Make item &bold");
|
||||||
item_menu->Append(TreeTest_UnBold, "Make item ¬ bold");
|
item_menu->Append(TreeTest_ClearBold, "Make item ¬ bold");
|
||||||
item_menu->AppendSeparator();
|
item_menu->AppendSeparator();
|
||||||
item_menu->Append(TreeTest_ToggleIcon, "Toggle the items &icon");
|
item_menu->Append(TreeTest_ToggleIcon, "Toggle the item's &icon");
|
||||||
|
|
||||||
#ifndef NO_MULTIPLE_SELECTION
|
#ifndef NO_MULTIPLE_SELECTION
|
||||||
item_menu->AppendSeparator();
|
item_menu->AppendSeparator();
|
||||||
@@ -211,16 +233,17 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
|||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
menu_bar->Append(file_menu, "&File");
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
menu_bar->Append(style_menu, "&Style");
|
||||||
menu_bar->Append(tree_menu, "&Tree");
|
menu_bar->Append(tree_menu, "&Tree");
|
||||||
menu_bar->Append(item_menu, "&Item");
|
menu_bar->Append(item_menu, "&Item");
|
||||||
SetMenuBar(menu_bar);
|
SetMenuBar(menu_bar);
|
||||||
|
|
||||||
menu_bar->Check(TreeTest_ToggleImages, TRUE);
|
//menu_bar->Check(TreeTest_ToggleImages, TRUE);
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
m_treeCtrl = new MyTreeCtrl(this, TreeTest_Ctrl,
|
m_treeCtrl = new MyTreeCtrl(this, TreeTest_Ctrl,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTR_MAC_BUTTONS | wxTR_NO_LINES |
|
wxTR_TWIST_BUTTONS | wxTR_NO_LINES |
|
||||||
wxTR_EDIT_LABELS |
|
wxTR_EDIT_LABELS |
|
||||||
#ifndef NO_VARIABLE_HEIGHT
|
#ifndef NO_VARIABLE_HEIGHT
|
||||||
wxTR_HAS_VARIABLE_ROW_HEIGHT |
|
wxTR_HAS_VARIABLE_ROW_HEIGHT |
|
||||||
@@ -253,6 +276,11 @@ MyFrame::~MyFrame()
|
|||||||
delete wxLog::SetActiveTarget(NULL);
|
delete wxLog::SetActiveTarget(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::TogStyle(long flag)
|
||||||
|
{
|
||||||
|
m_treeCtrl->SetWindowStyle(m_treeCtrl->GetWindowStyle() ^ flag);
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnSize(wxSizeEvent& event)
|
void MyFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
if ( m_treeCtrl && m_textCtrl )
|
if ( m_treeCtrl && m_textCtrl )
|
||||||
@@ -347,6 +375,8 @@ void MyFrame::OnDump(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnToggleSel(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnToggleSel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
TogStyle(wxTR_MULTIPLE);
|
||||||
|
#if 0
|
||||||
long style = m_treeCtrl->GetWindowStyle();
|
long style = m_treeCtrl->GetWindowStyle();
|
||||||
if ( style & wxTR_MULTIPLE )
|
if ( style & wxTR_MULTIPLE )
|
||||||
style &= ~wxTR_MULTIPLE;
|
style &= ~wxTR_MULTIPLE;
|
||||||
@@ -359,6 +389,7 @@ void MyFrame::OnToggleSel(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
style);
|
style);
|
||||||
Resize(GetClientSize());
|
Resize(GetClientSize());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -421,21 +452,20 @@ void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnRecreate(wxCommandEvent& event)
|
void MyFrame::OnRecreate(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
OnDeleteAll(event);
|
OnDeleteAll(event);
|
||||||
m_treeCtrl->AddTestItemsToTree(3, 2);
|
m_treeCtrl->AddTestItemsToTree(5, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnSetImageSize(wxCommandEvent& event)
|
void MyFrame::OnSetImageSize(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
long size = wxGetNumberFromUser("Enter the size for the images to use",
|
int size = wxGetNumberFromUser("Enter the size for the images to use",
|
||||||
"Size: ",
|
"Size: ",
|
||||||
"TreeCtrl sample",
|
"TreeCtrl sample",
|
||||||
16);
|
m_treeCtrl->ImageSize());
|
||||||
if ( size == -1 )
|
if ( size == -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_treeCtrl->CreateImageList((int)size);
|
m_treeCtrl->CreateImageList(size);
|
||||||
|
wxGetApp().SetShowImages(TRUE);
|
||||||
OnRecreate(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnToggleImages(wxCommandEvent& event)
|
void MyFrame::OnToggleImages(wxCommandEvent& event)
|
||||||
@@ -443,17 +473,27 @@ void MyFrame::OnToggleImages(wxCommandEvent& event)
|
|||||||
if ( wxGetApp().ShowImages() )
|
if ( wxGetApp().ShowImages() )
|
||||||
{
|
{
|
||||||
m_treeCtrl->CreateImageList(-1);
|
m_treeCtrl->CreateImageList(-1);
|
||||||
|
|
||||||
wxGetApp().SetShowImages(FALSE);
|
wxGetApp().SetShowImages(FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_treeCtrl->CreateImageList();
|
m_treeCtrl->CreateImageList(0);
|
||||||
|
|
||||||
wxGetApp().SetShowImages(TRUE);
|
wxGetApp().SetShowImages(TRUE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnRecreate(event);
|
void MyFrame::OnToggleButtons(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
if ( wxGetApp().ShowButtons() )
|
||||||
|
{
|
||||||
|
m_treeCtrl->CreateButtonsImageList(-1);
|
||||||
|
wxGetApp().SetShowButtons(FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_treeCtrl->CreateButtonsImageList(15);
|
||||||
|
wxGetApp().SetShowButtons(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnCollapseAndReset(wxCommandEvent& event)
|
void MyFrame::OnCollapseAndReset(wxCommandEvent& event)
|
||||||
@@ -534,35 +574,37 @@ MyTreeCtrl::MyTreeCtrl(wxWindow *parent, const wxWindowID id,
|
|||||||
: wxTreeCtrl(parent, id, pos, size, style)
|
: wxTreeCtrl(parent, id, pos, size, style)
|
||||||
{
|
{
|
||||||
m_reverseSort = FALSE;
|
m_reverseSort = FALSE;
|
||||||
m_imageListNormal = NULL;
|
|
||||||
|
|
||||||
CreateImageList();
|
CreateImageList();
|
||||||
|
|
||||||
// Add some items to the tree
|
// Add some items to the tree
|
||||||
AddTestItemsToTree(3, 2);
|
AddTestItemsToTree(5, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyTreeCtrl::CreateImageList(int size)
|
void MyTreeCtrl::CreateImageList(int size)
|
||||||
{
|
{
|
||||||
delete m_imageListNormal;
|
|
||||||
|
|
||||||
if ( size == -1 )
|
if ( size == -1 )
|
||||||
{
|
{
|
||||||
m_imageListNormal = NULL;
|
SetImageList(NULL);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if ( size == 0 )
|
||||||
|
size = m_imageSize;
|
||||||
else
|
else
|
||||||
{
|
m_imageSize = size;
|
||||||
|
|
||||||
// Make an image list containing small icons
|
// Make an image list containing small icons
|
||||||
m_imageListNormal = new wxImageList(size, size, TRUE);
|
wxImageList *images = new wxImageList(size, size, TRUE);
|
||||||
|
|
||||||
// should correspond to TreeCtrlIcon_xxx enum
|
// should correspond to TreeCtrlIcon_xxx enum
|
||||||
#if defined(__WXMSW__) && defined(__WIN16__)
|
#if defined(__WXMSW__) && defined(__WIN16__)
|
||||||
m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
images->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
images->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
|
images->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
|
images->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
|
images->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
#else // !MSW
|
#else // !MSW
|
||||||
|
wxBusyCursor wait;
|
||||||
wxIcon icons[5];
|
wxIcon icons[5];
|
||||||
icons[0] = wxICON(icon1);
|
icons[0] = wxICON(icon1);
|
||||||
icons[1] = wxICON(icon2);
|
icons[1] = wxICON(icon2);
|
||||||
@@ -575,23 +617,65 @@ void MyTreeCtrl::CreateImageList(int size)
|
|||||||
{
|
{
|
||||||
if ( size == sizeOrig )
|
if ( size == sizeOrig )
|
||||||
{
|
{
|
||||||
m_imageListNormal->Add(icons[i]);
|
images->Add(icons[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size).
|
images->Add(wxImage(icons[i]).Rescale(size, size).
|
||||||
ConvertToBitmap());
|
ConvertToBitmap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // MSW/!MSW
|
#endif // MSW/!MSW
|
||||||
|
|
||||||
|
AssignImageList(images);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetImageList(m_imageListNormal);
|
void MyTreeCtrl::CreateButtonsImageList(int size)
|
||||||
|
{
|
||||||
|
if ( size == -1 )
|
||||||
|
{
|
||||||
|
SetButtonsImageList(NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make an image list containing small icons
|
||||||
|
wxImageList *images = new wxImageList(size, size, TRUE);
|
||||||
|
|
||||||
|
// should correspond to TreeCtrlIcon_xxx enum
|
||||||
|
#if defined(__WXMSW__) && defined(__WIN16__)
|
||||||
|
images->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
|
images->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
|
images->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
|
images->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
|
images->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||||
|
#else // !MSW
|
||||||
|
wxBusyCursor wait;
|
||||||
|
wxIcon icons[4];
|
||||||
|
icons[0] = wxICON(icon3); // closed
|
||||||
|
icons[1] = wxICON(icon3); // closed, selected
|
||||||
|
icons[2] = wxICON(icon5); // open
|
||||||
|
icons[3] = wxICON(icon5); // open, selected
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
|
||||||
|
{
|
||||||
|
int sizeOrig = icons[i].GetWidth();
|
||||||
|
if ( size == sizeOrig )
|
||||||
|
{
|
||||||
|
images->Add(icons[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
images->Add(wxImage(icons[i]).Rescale(size, size).
|
||||||
|
ConvertToBitmap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // MSW/!MSW
|
||||||
|
|
||||||
|
AssignButtonsImageList(images);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyTreeCtrl::~MyTreeCtrl()
|
MyTreeCtrl::~MyTreeCtrl()
|
||||||
{
|
{
|
||||||
delete m_imageListNormal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
|
int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
|
||||||
@@ -795,7 +879,7 @@ void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event)
|
|||||||
{
|
{
|
||||||
wxLogMessage("OnBeginLabelEdit");
|
wxLogMessage("OnBeginLabelEdit");
|
||||||
|
|
||||||
// for testing, prevent this items label editing
|
// for testing, prevent this item's label editing
|
||||||
wxTreeItemId itemId = event.GetItem();
|
wxTreeItemId itemId = event.GetItem();
|
||||||
if ( IsTestItem(itemId) )
|
if ( IsTestItem(itemId) )
|
||||||
{
|
{
|
||||||
|
@@ -23,15 +23,18 @@
|
|||||||
class MyApp : public wxApp
|
class MyApp : public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp() { m_showImages = TRUE; }
|
MyApp() { m_showImages = TRUE; m_showButtons = FALSE; }
|
||||||
|
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
|
|
||||||
void SetShowImages(bool show) { m_showImages = show; }
|
void SetShowImages(bool show) { m_showImages = show; }
|
||||||
bool ShowImages() const { return m_showImages; }
|
bool ShowImages() const { return m_showImages; }
|
||||||
|
|
||||||
|
void SetShowButtons(bool show) { m_showButtons = show; }
|
||||||
|
bool ShowButtons() const { return m_showButtons; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_showImages;
|
bool m_showImages, m_showButtons;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyTreeItemData : public wxTreeItemData
|
class MyTreeItemData : public wxTreeItemData
|
||||||
@@ -88,6 +91,7 @@ public:
|
|||||||
void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
|
void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
|
||||||
|
|
||||||
void CreateImageList(int size = 16);
|
void CreateImageList(int size = 16);
|
||||||
|
void CreateButtonsImageList(int size = 11);
|
||||||
|
|
||||||
void AddTestItemsToTree(size_t numChildren, size_t depth);
|
void AddTestItemsToTree(size_t numChildren, size_t depth);
|
||||||
|
|
||||||
@@ -99,6 +103,8 @@ public:
|
|||||||
|
|
||||||
void ShowMenu(wxTreeItemId id, const wxPoint& pt);
|
void ShowMenu(wxTreeItemId id, const wxPoint& pt);
|
||||||
|
|
||||||
|
int ImageSize(void) const { return m_imageSize; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);
|
virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);
|
||||||
|
|
||||||
@@ -115,7 +121,7 @@ private:
|
|||||||
size_t depth,
|
size_t depth,
|
||||||
size_t folder);
|
size_t folder);
|
||||||
|
|
||||||
wxImageList *m_imageListNormal;
|
int m_imageSize; // current size of images
|
||||||
bool m_reverseSort; // flag for OnCompareItems
|
bool m_reverseSort; // flag for OnCompareItems
|
||||||
wxTreeItemId m_lastItem, // for OnEnsureVisible()
|
wxTreeItemId m_lastItem, // for OnEnsureVisible()
|
||||||
m_draggedItem; // item being dragged right now
|
m_draggedItem; // item being dragged right now
|
||||||
@@ -140,6 +146,14 @@ public:
|
|||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
|
void OnTogButtons(wxCommandEvent& event) { TogStyle(wxTR_HAS_BUTTONS); }
|
||||||
|
void OnTogTwist(wxCommandEvent& event) { TogStyle(wxTR_TWIST_BUTTONS); }
|
||||||
|
void OnTogLines(wxCommandEvent& event) { TogStyle(wxTR_NO_LINES); }
|
||||||
|
void OnTogEdit(wxCommandEvent& event) { TogStyle(wxTR_EDIT_LABELS); }
|
||||||
|
void OnTogHideRoot(wxCommandEvent& event) { TogStyle(wxTR_HIDE_ROOT); }
|
||||||
|
void OnTogRootLines(wxCommandEvent& event) { TogStyle(wxTR_LINES_AT_ROOT); }
|
||||||
|
void OnTogBorder(wxCommandEvent& event) { TogStyle(wxTR_ROW_LINES); }
|
||||||
|
|
||||||
void OnDump(wxCommandEvent& event);
|
void OnDump(wxCommandEvent& event);
|
||||||
#ifndef NO_MULTIPLE_SELECTION
|
#ifndef NO_MULTIPLE_SELECTION
|
||||||
void OnDumpSelected(wxCommandEvent& event);
|
void OnDumpSelected(wxCommandEvent& event);
|
||||||
@@ -152,6 +166,7 @@ public:
|
|||||||
void OnDeleteAll(wxCommandEvent& event);
|
void OnDeleteAll(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnRecreate(wxCommandEvent& event);
|
void OnRecreate(wxCommandEvent& event);
|
||||||
|
void OnToggleButtons(wxCommandEvent& event);
|
||||||
void OnToggleImages(wxCommandEvent& event);
|
void OnToggleImages(wxCommandEvent& event);
|
||||||
void OnSetImageSize(wxCommandEvent& event);
|
void OnSetImageSize(wxCommandEvent& event);
|
||||||
void OnCollapseAndReset(wxCommandEvent& event);
|
void OnCollapseAndReset(wxCommandEvent& event);
|
||||||
@@ -182,6 +197,8 @@ public:
|
|||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void TogStyle(long flag);
|
||||||
|
|
||||||
void DoSort(bool reverse = FALSE);
|
void DoSort(bool reverse = FALSE);
|
||||||
|
|
||||||
void Resize(const wxSize& size);
|
void Resize(const wxSize& size);
|
||||||
@@ -199,20 +216,28 @@ enum
|
|||||||
{
|
{
|
||||||
TreeTest_Quit,
|
TreeTest_Quit,
|
||||||
TreeTest_About,
|
TreeTest_About,
|
||||||
|
TreeTest_TogButtons,
|
||||||
|
TreeTest_TogTwist,
|
||||||
|
TreeTest_TogLines,
|
||||||
|
TreeTest_TogEdit,
|
||||||
|
TreeTest_TogHideRoot,
|
||||||
|
TreeTest_TogRootLines,
|
||||||
|
TreeTest_TogBorder,
|
||||||
TreeTest_Dump,
|
TreeTest_Dump,
|
||||||
TreeTest_DumpSelected,
|
TreeTest_DumpSelected,
|
||||||
TreeTest_Count,
|
TreeTest_Count,
|
||||||
TreeTest_CountRec,
|
TreeTest_CountRec,
|
||||||
TreeTest_Sort,
|
TreeTest_Sort,
|
||||||
TreeTest_SortRev,
|
TreeTest_SortRev,
|
||||||
TreeTest_Bold,
|
TreeTest_SetBold,
|
||||||
TreeTest_UnBold,
|
TreeTest_ClearBold,
|
||||||
TreeTest_Rename,
|
TreeTest_Rename,
|
||||||
TreeTest_Delete,
|
TreeTest_Delete,
|
||||||
TreeTest_DeleteChildren,
|
TreeTest_DeleteChildren,
|
||||||
TreeTest_DeleteAll,
|
TreeTest_DeleteAll,
|
||||||
TreeTest_Recreate,
|
TreeTest_Recreate,
|
||||||
TreeTest_ToggleImages,
|
TreeTest_ToggleImages,
|
||||||
|
TreeTest_ToggleButtons,
|
||||||
TreeTest_SetImageSize,
|
TreeTest_SetImageSize,
|
||||||
TreeTest_ToggleSel,
|
TreeTest_ToggleSel,
|
||||||
TreeTest_CollapseAndReset,
|
TreeTest_CollapseAndReset,
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
#include "wx/statbmp.h"
|
#include "wx/statbmp.h"
|
||||||
#include "wx/gauge.h"
|
#include "wx/gauge.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/treebase.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -67,8 +67,6 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG)
|
|||||||
// Tree event
|
// Tree event
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent)
|
|
||||||
|
|
||||||
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
|
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
|
||||||
: wxNotifyEvent(commandType, id)
|
: wxNotifyEvent(commandType, id)
|
||||||
{
|
{
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "wx/button.h"
|
#include "wx/button.h"
|
||||||
#include "wx/layout.h"
|
#include "wx/layout.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
#include "wx/textdlg.h"
|
#include "wx/textdlg.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "wx/button.h"
|
#include "wx/button.h"
|
||||||
#include "wx/layout.h"
|
#include "wx/layout.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
#include "wx/textdlg.h"
|
#include "wx/textdlg.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "wx/html/helpfrm.h"
|
#include "wx/html/helpfrm.h"
|
||||||
#include "wx/html/helpctrl.h"
|
#include "wx/html/helpctrl.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
#include "wx/treectrl.h"
|
#include "wx/treectrl.h"
|
||||||
|
Reference in New Issue
Block a user