| 1 |
#include "collapsible_pane_wrapper.h" |
| 2 |
|
| 3 |
#include "allocator_mgr.h" |
| 4 |
#include "bool_property.h" |
| 5 |
#include "wxgui_defs.h" |
| 6 |
#include "wxgui_helpers.h" |
| 7 |
|
| 8 |
#include <wx/collpane.h> |
| 9 |
|
| 10 |
CollapsiblePaneWrapper::CollapsiblePaneWrapper() |
| 11 |
: wxcWidget(ID_WXCOLLAPSIBLEPANE) |
| 12 |
{ |
| 13 |
RegisterEvent("wxEVT_COMMAND_COLLPANE_CHANGED", "wxCollapsiblePaneEvent", |
| 14 |
_("The user expanded or collapsed the collapsible pane")); |
| 15 |
RegisterEvent("wxEVT_NAVIGATION_KEY", "wxNavigationKeyEvent", _("Process a navigation key event")); |
| 16 |
|
| 17 |
PREPEND_STYLE(wxCP_DEFAULT_STYLE, true); |
| 18 |
PREPEND_STYLE(wxCP_NO_TLW_RESIZE, false); |
| 19 |
|
| 20 |
SetPropertyString(_("Common Settings"), "wxCollapsiblePane"); |
| 21 |
AddProperty(new StringProperty(PROP_LABEL, _("Label"), _("The label"))); |
| 22 |
AddProperty(new BoolProperty(PROP_COLLAPSED, true, _("Set the state of the collapsible pane"))); |
| 23 |
m_namePattern = "m_collPane"; |
| 24 |
SetName(GenerateName()); |
| 25 |
} |
| 26 |
|
| 27 |
CollapsiblePaneWrapper::~CollapsiblePaneWrapper() {} |
| 28 |
|
| 29 |
wxcWidget* CollapsiblePaneWrapper::Clone() const { return new CollapsiblePaneWrapper(); } |
| 30 |
|
| 31 |
wxString CollapsiblePaneWrapper::CppCtorCode() const |
| 32 |
{ |
| 33 |
wxString cppCode = CPPStandardWxCtorWithLabel("wxCP_DEFAULT_STYLE"); |
| 34 |
return cppCode; |
| 35 |
} |
| 36 |
|
| 37 |
void CollapsiblePaneWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add("#include <wx/collpane.h>"); } |
| 38 |
|
| 39 |
wxString CollapsiblePaneWrapper::GetWxClassName() const { return "wxCollapsiblePane"; } |
| 40 |
|
| 41 |
void CollapsiblePaneWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 42 |
{ |
| 43 |
|
| 44 |
text << XRCPrefix() << XRCLabel() << XRCSize() << XRCCommonAttributes(); |
| 45 |
|
| 46 |
if(type == XRC_DESIGNER) { |
| 47 |
text << "<style>wxCP_NO_TLW_RESIZE</style>"; |
| 48 |
|
| 49 |
} else { |
| 50 |
text << XRCStyle() << "<collapsed>" << PropertyString(PROP_COLLAPSED) << "</collapsed>"; |
| 51 |
} |
| 52 |
|
| 53 |
ChildrenXRC(text, type); |
| 54 |
|
| 55 |
text << XRCSuffix(); |
| 56 |
} |