| 1 |
#include "tree_list_ctrl_wrapper.h" |
| 2 |
|
| 3 |
#include "allocator_mgr.h" |
| 4 |
|
| 5 |
#include <wx/treelist.h> |
| 6 |
|
| 7 |
TreeListCtrlWrapper::TreeListCtrlWrapper() |
| 8 |
: wxcWidget(ID_WXTREELISTCTRL) |
| 9 |
{ |
| 10 |
SetPropertyString(_("Common Settings"), "wxTreeListCtrl"); |
| 11 |
PREPEND_STYLE(wxTL_SINGLE, false); |
| 12 |
PREPEND_STYLE(wxTL_MULTIPLE, false); |
| 13 |
PREPEND_STYLE(wxTL_CHECKBOX, false); |
| 14 |
PREPEND_STYLE(wxTL_3STATE, false); |
| 15 |
PREPEND_STYLE(wxTL_USER_3STATE, false); |
| 16 |
PREPEND_STYLE(wxTL_DEFAULT_STYLE, true); |
| 17 |
|
| 18 |
RegisterEvent( |
| 19 |
"wxEVT_TREELIST_SELECTION_CHANGED", "wxTreeListEvent", |
| 20 |
_("Process wxEVT_TREELIST_SELECTION_CHANGED event and notifies about the selection change in the " |
| 21 |
"control. In the single selection case the item indicated by the event has been selected and " |
| 22 |
"previously selected item, if any, was deselected. In multiple selection case, the selection of this " |
| 23 |
"item has just changed (it may have been either selected or deselected) but notice that the " |
| 24 |
"selection of other items could have changed as well, use wxTreeListCtrl::GetSelections() to " |
| 25 |
"retrieve the new selection if necessary.")); |
| 26 |
RegisterEvent("wxEVT_TREELIST_ITEM_EXPANDING", "wxTreeListEvent", |
| 27 |
_("Process wxEVT_TREELIST_ITEM_EXPANDING event notifying about the given branch being expanded. This " |
| 28 |
"event is sent before the expansion occurs and can be vetoed to prevent it from happening.")); |
| 29 |
RegisterEvent( |
| 30 |
"wxEVT_TREELIST_ITEM_EXPANDED", "wxTreeListEvent", |
| 31 |
_("Process wxEVT_TREELIST_ITEM_EXPANDED event notifying about the expansion of the given branch. This " |
| 32 |
"event is sent after the expansion occurs and can't be vetoed.")); |
| 33 |
RegisterEvent( |
| 34 |
"wxEVT_TREELIST_ITEM_CHECKED", "wxTreeListEvent", |
| 35 |
_("Process wxEVT_TREELIST_ITEM_CHECKED event notifying about the user checking or unchecking the item. " |
| 36 |
"You can use wxTreeListCtrl::GetCheckedState() to retrieve the new item state and " |
| 37 |
"wxTreeListEvent::GetOldCheckedState() to get the previous one.")); |
| 38 |
RegisterEvent("wxEVT_TREELIST_ITEM_ACTIVATED", "wxTreeListEvent", |
| 39 |
_("Process wxEVT_TREELIST_ITEM_ACTIVATED event notifying about the user double clicking the item or " |
| 40 |
"activating it from keyboard.")); |
| 41 |
RegisterEvent("wxEVT_TREELIST_ITEM_CONTEXT_MENU", "wxTreeListEvent", |
| 42 |
_("Process wxEVT_TREELIST_ITEM_CONTEXT_MENU event indicating that the popup menu for the given item " |
| 43 |
"should be displayed.")); |
| 44 |
RegisterEvent("wxEVT_TREELIST_COLUMN_SORTED", "wxTreeListEvent", |
| 45 |
_("Process wxEVT_TREELIST_COLUMN_SORTED event indicating that the control contents has just been " |
| 46 |
"resorted using the specified column. The event doesn't carry the sort direction, use " |
| 47 |
"GetSortColumn() method if you need to know it.")); |
| 48 |
|
| 49 |
m_namePattern = "m_treeListCtrl"; |
| 50 |
SetName(GenerateName()); |
| 51 |
} |
| 52 |
|
| 53 |
TreeListCtrlWrapper::~TreeListCtrlWrapper() {} |
| 54 |
|
| 55 |
wxcWidget* TreeListCtrlWrapper::Clone() const { return new TreeListCtrlWrapper(); } |
| 56 |
|
| 57 |
wxString TreeListCtrlWrapper::CppCtorCode() const |
| 58 |
{ |
| 59 |
// wxTreeListCtrl::wxTreeListCtrl ( wxWindow * parent, |
| 60 |
// wxWindowID id, |
| 61 |
// const wxPoint & pos = wxDefaultPosition, |
| 62 |
// const wxSize & size = wxDefaultSize, |
| 63 |
// long style = wxTL_DEFAULT_STYLE, |
| 64 |
// const wxString & name = wxTreeListCtrlNameStr |
| 65 |
// ); |
| 66 |
|
| 67 |
wxString code; |
| 68 |
code << GetName() << " = new " << GetRealClassName() << "(" << GetWindowParent() << ", " << WindowID() << ", " |
| 69 |
<< "wxDefaultPosition, " << SizeAsString() << ", " << StyleFlags("wxTL_DEFAULT_STYLE") << ");\n"; |
| 70 |
code << CPPCommonAttributes(); |
| 71 |
return code; |
| 72 |
} |
| 73 |
|
| 74 |
void TreeListCtrlWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add("#include <wx/treelist.h>"); } |
| 75 |
|
| 76 |
wxString TreeListCtrlWrapper::GetWxClassName() const { return "wxTreeListCtrl"; } |
| 77 |
|
| 78 |
void TreeListCtrlWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 79 |
{ |
| 80 |
text << XRCPrefix() << XRCStyle() << XRCSize() << XRCCommonAttributes(); |
| 81 |
|
| 82 |
// add columns |
| 83 |
ChildrenXRC(text, type); |
| 84 |
|
| 85 |
text << XRCSuffix(); |
| 86 |
} |