| 1 |
#include "list_ctrl_column_wrapper.h" |
| 2 |
#include "allocator_mgr.h" |
| 3 |
#include "wxgui_helpers.h" |
| 4 |
#include "xmlutils.h" |
| 5 |
|
| 6 |
ListCtrlColumnWrapper::ListCtrlColumnWrapper() |
| 7 |
: wxcWidget(ID_WXLISTCTRL_COL) |
| 8 |
{ |
| 9 |
m_styles.Clear(); |
| 10 |
m_sizerFlags.Clear(); |
| 11 |
m_properties.DeleteValues(); |
| 12 |
|
| 13 |
SetPropertyString(_("Common Settings"), "wxListCtrlColumn"); |
| 14 |
AddProperty(new CategoryProperty(_("wxListCtrl Column"))); |
| 15 |
AddProperty(new StringProperty(PROP_NAME, _("My Column"), _("Column caption"))); |
| 16 |
AddProperty(new StringProperty( |
| 17 |
PROP_WIDTH, wxT("-1"), |
| 18 |
_("Column Width\nSet it to -1 for auto sizing.\nOr set it to -2 to fit the column width to heading or to " |
| 19 |
"extend to fill all the remaining space for the last column\nValue > 0 will set the width in pixels"))); |
| 20 |
} |
| 21 |
|
| 22 |
ListCtrlColumnWrapper::~ListCtrlColumnWrapper() {} |
| 23 |
|
| 24 |
wxcWidget* ListCtrlColumnWrapper::Clone() const { return new ListCtrlColumnWrapper(); } |
| 25 |
|
| 26 |
wxString ListCtrlColumnWrapper::CppCtorCode() const |
| 27 |
{ |
| 28 |
wxString cppCode; |
| 29 |
cppCode << GetWindowParent() << wxT("->InsertColumn(") << GetWindowParent() << wxT("->GetColumnCount(), ") |
| 30 |
<< wxCrafter::UNDERSCORE(GetName()) << wxT(", ") << wxT("wxLIST_FORMAT_LEFT, ") << PropertyString(PROP_WIDTH) << wxT(");"); |
| 31 |
return cppCode; |
| 32 |
} |
| 33 |
|
| 34 |
void ListCtrlColumnWrapper::GetIncludeFile(wxArrayString& headers) const |
| 35 |
{ |
| 36 |
// No need to add anything, we can only be added under wxListCtrl which |
| 37 |
// provides all the needed include files |
| 38 |
} |
| 39 |
|
| 40 |
wxString ListCtrlColumnWrapper::GetWxClassName() const { return wxT(""); } |
| 41 |
|
| 42 |
void ListCtrlColumnWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 43 |
{ |
| 44 |
text << wxT("<object class=\"listcol\">") << wxT("<text>") << wxCrafter::CDATA(GetName()) << wxT("</text>") |
| 45 |
<< wxT("<width>") << PropertyString(PROP_WIDTH) << wxT("</width>") << wxT("</object>"); |
| 46 |
} |
| 47 |
|
| 48 |
void ListCtrlColumnWrapper::LoadPropertiesFromXRC(const wxXmlNode* node) |
| 49 |
{ |
| 50 |
// First call the base-class for the standard things |
| 51 |
wxcWidget::LoadPropertiesFromXRC(node); |
| 52 |
|
| 53 |
wxXmlNode* propertynode = XmlUtils::FindFirstByTagName(node, wxT("text")); |
| 54 |
if(propertynode) { SetName(propertynode->GetNodeContent()); } |
| 55 |
|
| 56 |
propertynode = XmlUtils::FindFirstByTagName(node, wxT("width")); |
| 57 |
if(propertynode) { SetPropertyString(PROP_WIDTH, propertynode->GetNodeContent()); } |
| 58 |
} |
| 59 |
|
| 60 |
// AFAICT wxSmith & wxFB don't do ListCtrlColumns |