Debian Codegraph @

wxcrafter/controls/grid_column_wrapper.cpp

raw
1 #include "grid_column_wrapper.h"
2 #include "allocator_mgr.h"
3 #include "wxgui_defs.h"
4 #include "wxgui_helpers.h"
5
6 GridColumnWrapper::GridColumnWrapper()
7 : wxcWidget(ID_WXGRIDCOL)
8 {
9 m_styles.Clear();
10 m_sizerFlags.Clear();
11 m_properties.DeleteValues();
12
13 SetPropertyString(_("Common Settings"), "wxGridColumn");
14 AddProperty(new CategoryProperty(_("wxGrid Column")));
15 AddText(PROP_NAME, _("The Column Label"), _("My Column"));
16 AddInteger(PROP_WIDTH,
17 _("Sets the width of the specified column.\nThe new column width in pixels, 0 to hide the column or -1 "
18 "to fit the column width to its label width"),
19 -1);
20
21 m_namePattern = "Column";
22 SetName(GenerateName());
23 }
24
25 GridColumnWrapper::~GridColumnWrapper() {}
26
27 wxcWidget* GridColumnWrapper::Clone() const { return new GridColumnWrapper(); }
28
29 wxString GridColumnWrapper::CppCtorCode() const
30 {
31 return ""; // The code is generated inside the wxGrid wrapper
32 }
33
34 void GridColumnWrapper::GetIncludeFile(wxArrayString& headers) const { wxUnusedVar(headers); }
35
36 wxString GridColumnWrapper::GetWxClassName() const { return ""; }
37
38 void GridColumnWrapper::ToXRC(wxString& text, XRC_TYPE type) const
39 {
40 wxUnusedVar(text);
41 text << "<col>"
42 << "<name>" << wxCrafter::CDATA(GetName()) << "</name>"
43 << "<colsize>" << PropertyInt(PROP_WIDTH, -1) << "</colsize>"
44 << "</col>";
45 }
46
47 wxString GridColumnWrapper::Code(int colIndex) const
48 {
49 wxString cppCode;
50 cppCode << GetParent()->GetName() << wxT("->SetColLabelValue(") << colIndex << wxT(", ")
51 << wxCrafter::UNDERSCORE(GetName()) << wxT(");\n");
52 int width = PropertyInt(PROP_WIDTH, -1);
53 if(width != -1) {
54 cppCode << GetParent()->GetName() << wxT("->SetColSize(") << colIndex << ", " << width << ");\n";
55 }
56 return cppCode;
57 }