| 1 |
#include "ribbon_page_wrapper.h" |
| 2 |
|
| 3 |
#include "allocator_mgr.h" |
| 4 |
#include "bool_property.h" |
| 5 |
#include "file_ficker_property.h" |
| 6 |
#include "string_property.h" |
| 7 |
#include "wxc_bitmap_code_generator.h" |
| 8 |
#include "wxgui_defs.h" |
| 9 |
|
| 10 |
#include <wx/ribbon/page.h> |
| 11 |
|
| 12 |
RibbonPageWrapper::RibbonPageWrapper() |
| 13 |
: wxcWidget(ID_WXRIBBONPAGE) |
| 14 |
, m_selected(false) |
| 15 |
{ |
| 16 |
SetPropertyString(_("Common Settings"), "wxRibbonPage"); |
| 17 |
AddProperty(new BitmapPickerProperty(PROP_BITMAP_PATH, "", _("Page Icon"))); |
| 18 |
AddProperty(new StringProperty(PROP_LABEL, "Page", _("Page Label"))); |
| 19 |
AddProperty(new BoolProperty(PROP_SELECTED, false, _("Selected"))); |
| 20 |
m_namePattern = "m_ribbonPage"; |
| 21 |
SetName(GenerateName()); |
| 22 |
} |
| 23 |
|
| 24 |
RibbonPageWrapper::~RibbonPageWrapper() {} |
| 25 |
|
| 26 |
wxcWidget* RibbonPageWrapper::Clone() const { return new RibbonPageWrapper(); } |
| 27 |
|
| 28 |
wxString RibbonPageWrapper::CppCtorCode() const |
| 29 |
{ |
| 30 |
wxcCodeGeneratorHelper::Get().AddBitmap(PropertyFile(PROP_BITMAP_PATH)); |
| 31 |
wxString cppCode; |
| 32 |
cppCode << GetName() << " = new " << GetRealClassName() << "(" << GetWindowParent() << ", " << GetId() << ", " |
| 33 |
<< Label() << ", " << wxcCodeGeneratorHelper::Get().BitmapCode(PropertyFile(PROP_BITMAP_PATH)) << ", " |
| 34 |
<< StyleFlags("0") << ");\n"; |
| 35 |
cppCode << CPPCommonAttributes(); |
| 36 |
if(PropertyBool(PROP_SELECTED) == "true") { |
| 37 |
cppCode << GetParent()->GetName() << "->SetActivePage( " << GetName() << " );\n"; |
| 38 |
} |
| 39 |
return cppCode; |
| 40 |
} |
| 41 |
|
| 42 |
void RibbonPageWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add("#include <wx/ribbon/page.h>"); } |
| 43 |
|
| 44 |
wxString RibbonPageWrapper::GetWxClassName() const { return "wxRibbonPage"; } |
| 45 |
|
| 46 |
void RibbonPageWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 47 |
{ |
| 48 |
text << XRCPrefix() << XRCBitmap("icon") << XRCLabel() << XRCCommonAttributes() << XRCStyle() << XRCSize() |
| 49 |
<< "<selected>" << (m_selected ? 1 : 0) << "</selected>"; |
| 50 |
|
| 51 |
ChildrenXRC(text, type); |
| 52 |
text << XRCSuffix(); |
| 53 |
} |
| 54 |
|
| 55 |
wxString RibbonPageWrapper::DoGenerateCppCtorCode_End() const |
| 56 |
{ |
| 57 |
// return wxString() << GetName() << "->Realize();\n\n"; |
| 58 |
return ""; |
| 59 |
} |
| 60 |
|
| 61 |
void RibbonPageWrapper::Select(bool b) { m_selected = b; } |
| 62 |
|
| 63 |
bool RibbonPageWrapper::IsSelected() const { return m_selected; } |