wxMSW::wxTreeCtrl has multiple selection too (somewhat documented)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-07-30 22:45:55 +00:00
parent 717b9bf234
commit 9dfbf520eb
7 changed files with 433 additions and 151 deletions

View File

@@ -32,7 +32,7 @@ WXDLLEXPORT_DATA(extern const char*) wxTreeCtrlNameStr;
#include "wx/dynarray.h"
#include "wx/timer.h"
//those defines should only be done in generic/treectrl.h,
//those defines should only be done in generic/treectrl.h,
//because wxMSW doesn't allow mutiple selection
#ifndef wxTR_SINGLE
@@ -177,7 +177,7 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl
public:
wxTreeTextCtrl(void) {};
wxTreeTextCtrl( wxWindow *parent, const wxWindowID id,
wxTreeTextCtrl( wxWindow *parent, const wxWindowID id,
bool *accept, wxString *res, wxTreeCtrl *owner,
const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
@@ -185,7 +185,7 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl
const wxString &name = "wxTreeTextCtrlText" );
void OnChar( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
DECLARE_EVENT_TABLE()
};
@@ -231,10 +231,10 @@ public:
unsigned int GetIndent() const { return m_indent; }
void SetIndent(unsigned int indent);
// spacing is the number of pixels between the start and the Text
// spacing is the number of pixels between the start and the Text
unsigned int GetSpacing() const { return m_spacing; }
void SetSpacing(unsigned int spacing);
// image list: these functions allow to associate an image list with
// the control and retrieve it. Note that the control does _not_ delete
// the associated image list when it's deleted in order to allow image
@@ -420,7 +420,7 @@ public:
// been before.
void EditLabel( const wxTreeItemId& item ) { Edit( item ); }
void Edit( const wxTreeItemId& item );
// sorting
// this function is called to compare 2 items and should return -1, 0
// or +1 if the first item is less than, equal to or greater than the
@@ -447,7 +447,7 @@ public:
// Draw Special Information
void DrawBorder(wxTreeItemId& item);
void DrawLine(wxTreeItemId& item, bool below);
protected:
friend class wxGenericTreeItem;
friend class wxTreeRenameTimer;
@@ -491,7 +491,7 @@ protected:
void RefreshSubtree( wxGenericTreeItem *item );
void RefreshLine( wxGenericTreeItem *item );
void OnRenameTimer();
void OnRenameAccept();

View File

@@ -121,6 +121,8 @@ protected:
long m_itemId;
};
WX_DEFINE_ARRAY(wxTreeItemId, wxArrayTreeItemIds);
// ----------------------------------------------------------------------------
// wxTreeItemData is some (arbitrary) user class associated with some item. The
// main advantage of having this class (compared to old untyped interface) is
@@ -275,7 +277,8 @@ public:
// if 'recursively' is FALSE, only immediate children count, otherwise
// the returned number is the number of all items in this branch
size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE);
size_t GetChildrenCount(const wxTreeItemId& item,
bool recursively = TRUE) const;
// navigation
// ----------
@@ -288,6 +291,12 @@ public:
// get the item currently selected (may return NULL if no selection)
wxTreeItemId GetSelection() const;
// get the items currently selected, return the number of such item
//
// NB: this operation is expensive and can take a long time for a
// control with a lot of items (~ O(number of items)).
size_t GetSelections(wxArrayTreeItemIds& selections) const;
// get the parent of this item (may return NULL if root)
wxTreeItemId GetParent(const wxTreeItemId& item) const;
@@ -365,6 +374,8 @@ public:
// remove the selection from currently selected item (if any)
void Unselect();
// unselect all items (only makes sense for multiple selection control)
void UnselectAll();
// select this item
void SelectItem(const wxTreeItemId& item);
// make sure this item is visible (expanding the parent item and/or
@@ -445,6 +456,10 @@ public:
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
// get/set the check state for the item (only for wxTR_MULTIPLE)
bool IsItemChecked(const wxTreeItemId& item) const;
void SetItemCheck(const wxTreeItemId& item, bool check = TRUE);
protected:
// SetImageList helper
void SetAnyImageList(wxImageList *imageList, int which);
@@ -469,6 +484,8 @@ private:
int image, int selectedImage,
wxTreeItemData *data);
void DoSetItemImages(const wxTreeItemId& item, int image, int imageSel);
void DeleteTextCtrl();
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)