Debian Codegraph @

wxcrafter/controls/tree_ctrl_wrapper.cpp

raw
1 #include "tree_ctrl_wrapper.h"
2 #include "allocator_mgr.h"
3 #include "wxgui_defs.h"
4 #include <wx/treectrl.h>
5
6 TreeCtrlWrapper::TreeCtrlWrapper()
7 : wxcWidget(ID_WXTREECTRL)
8 {
9 SetPropertyString(_("Common Settings"), "wxTreeCtrl");
10 PREPEND_STYLE(wxTR_EDIT_LABELS, false);
11 PREPEND_STYLE(wxTR_NO_BUTTONS, false);
12 PREPEND_STYLE(wxTR_HAS_BUTTONS, false);
13 PREPEND_STYLE(wxTR_TWIST_BUTTONS, false);
14 PREPEND_STYLE(wxTR_NO_LINES, false);
15 PREPEND_STYLE(wxTR_FULL_ROW_HIGHLIGHT, false);
16 PREPEND_STYLE(wxTR_LINES_AT_ROOT, false);
17 PREPEND_STYLE(wxTR_HIDE_ROOT, false);
18 PREPEND_STYLE(wxTR_ROW_LINES, false);
19 PREPEND_STYLE(wxTR_HAS_VARIABLE_ROW_HEIGHT, false);
20 PREPEND_STYLE(wxTR_SINGLE, false);
21 PREPEND_STYLE(wxTR_MULTIPLE, false);
22 PREPEND_STYLE(wxTR_DEFAULT_STYLE, true);
23
24 RegisterEvent(wxT("wxEVT_COMMAND_TREE_BEGIN_DRAG"), wxT("wxTreeEvent"),
25 _("The user has started dragging an item with the left mouse button.\nThe event handler must call "
26 "wxTreeEvent::Allow() for the drag operation to continue."));
27 RegisterEvent(wxT("wxEVT_COMMAND_TREE_BEGIN_RDRAG"), wxT("wxTreeEvent"),
28 _("The user has started dragging an item with the right mouse button.\nThe event handler must call "
29 "wxTreeEvent::Allow() for the drag operation to continue."));
30 RegisterEvent(wxT("wxEVT_COMMAND_TREE_END_DRAG"), wxT("wxTreeEvent"),
31 _("The user has released the mouse after dragging an item."));
32 RegisterEvent(wxT("wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT"), wxT("wxTreeEvent"),
33 _("Begin editing a label. This can be prevented by calling Veto()."));
34 RegisterEvent(wxT("wxEVT_COMMAND_TREE_END_LABEL_EDIT"), wxT("wxTreeEvent"),
35 _("The user has finished editing a label. This can be prevented by calling Veto()."));
36 RegisterEvent(wxT("wxEVT_COMMAND_TREE_DELETE_ITEM"), wxT("wxTreeEvent"), _("A tree item has been deleted."));
37 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_EXPANDED"), wxT("wxTreeEvent"), _("The item has been expanded."));
38 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_EXPANDING"), wxT("wxTreeEvent"),
39 _("The item is being expanded. This can be prevented by calling Veto()."));
40 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_COLLAPSED"), wxT("wxTreeEvent"), _("The item has been collapsed."));
41 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_COLLAPSING"), wxT("wxTreeEvent"),
42 _("The item is being collapsed. This can be prevented by calling Veto()."));
43 RegisterEvent(wxT("wxEVT_COMMAND_TREE_SEL_CHANGED"), wxT("wxTreeEvent"), _("Selection has changed."));
44 RegisterEvent(wxT("wxEVT_COMMAND_TREE_SEL_CHANGING"), wxT("wxTreeEvent"),
45 _("Selection is changing. This can be prevented by calling Veto()."));
46 RegisterEvent(wxT("wxEVT_COMMAND_TREE_KEY_DOWN"), wxT("wxTreeEvent"), _("A key has been pressed."));
47 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_ACTIVATED"), wxT("wxTreeEvent"),
48 _("An item has been activated (e.g. double clicked)."));
49 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK"), wxT("wxTreeEvent"),
50 _("The user has clicked the item with the right mouse button."));
51 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK"), wxT("wxTreeEvent"),
52 _("The user has clicked the item with the middle mouse button."));
53 RegisterEvent(wxT("wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK"), wxT("wxTreeEvent"),
54 _("The state image has been clicked. Windows only."));
55 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP"), wxT("wxTreeEvent"),
56 _("The opportunity to set the item tooltip is being given to the application\n (call "
57 "wxTreeEvent::SetToolTip). Windows only."));
58 RegisterEvent(wxT("wxEVT_COMMAND_TREE_ITEM_MENU"), wxT("wxTreeEvent"),
59 _("The context menu for the selected item has been requested,\neither by a right click or by using "
60 "the menu key."));
61
62 m_namePattern = wxT("m_treeCtrl");
63 SetName(GenerateName());
64 }
65
66 TreeCtrlWrapper::~TreeCtrlWrapper() {}
67
68 wxcWidget* TreeCtrlWrapper::Clone() const { return new TreeCtrlWrapper(); }
69
70 wxString TreeCtrlWrapper::CppCtorCode() const
71 {
72 wxString code;
73 code << GetName() << wxT(" = new ") << GetRealClassName() << "(" << GetWindowParent() << wxT(", ") << WindowID()
74 << wxT(", ") << wxT("wxDefaultPosition, ") << SizeAsString() << wxT(", ")
75 << StyleFlags(wxT("wxTR_DEFAULT_STYLE")) << wxT(");\n");
76 code << CPPCommonAttributes();
77 return code;
78 }
79
80 void TreeCtrlWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add(wxT("#include <wx/treectrl.h>")); }
81
82 wxString TreeCtrlWrapper::GetWxClassName() const { return wxT("wxTreeCtrl"); }
83
84 void TreeCtrlWrapper::ToXRC(wxString& text, XRC_TYPE type) const
85 {
86 text << XRCPrefix() << XRCStyle() << XRCSize() << XRCCommonAttributes() << XRCSuffix();
87 }