| 1 |
#include "ribbon_panel_wrapper.h" |
| 2 |
|
| 3 |
#include "allocator_mgr.h" |
| 4 |
#include "file_ficker_property.h" |
| 5 |
#include "string_property.h" |
| 6 |
#include "wxc_bitmap_code_generator.h" |
| 7 |
#include "wxgui_defs.h" |
| 8 |
|
| 9 |
#include <wx/ribbon/panel.h> |
| 10 |
|
| 11 |
RibbonPanelWrapper::RibbonPanelWrapper() |
| 12 |
: wxcWidget(ID_WXRIBBONPANEL) |
| 13 |
{ |
| 14 |
PREPEND_STYLE_TRUE(wxRIBBON_PANEL_DEFAULT_STYLE); |
| 15 |
PREPEND_STYLE_FALSE(wxRIBBON_PANEL_NO_AUTO_MINIMISE); |
| 16 |
PREPEND_STYLE_FALSE(wxRIBBON_PANEL_EXT_BUTTON); |
| 17 |
PREPEND_STYLE_FALSE(wxRIBBON_PANEL_MINIMISE_BUTTON); |
| 18 |
PREPEND_STYLE_FALSE(wxRIBBON_PANEL_STRETCH); |
| 19 |
PREPEND_STYLE_FALSE(wxRIBBON_PANEL_FLEXIBLE); |
| 20 |
|
| 21 |
SetPropertyString(_("Common Settings"), "wxRibbonPanel"); |
| 22 |
AddProperty(new StringProperty(PROP_LABEL, _("My Label"), _("The Label"))); |
| 23 |
AddProperty(new BitmapPickerProperty( |
| 24 |
PROP_BITMAP_PATH, "", _("Icon to be used in place of the panel's children when the panel is minimised"))); |
| 25 |
|
| 26 |
RegisterEvent("wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED", "wxRibbonPanelEvent", |
| 27 |
_("Triggered when the user activate the panel extension button")); |
| 28 |
m_namePattern = "m_ribbonPanel"; |
| 29 |
|
| 30 |
SetName(GenerateName()); |
| 31 |
} |
| 32 |
|
| 33 |
RibbonPanelWrapper::~RibbonPanelWrapper() {} |
| 34 |
|
| 35 |
wxcWidget* RibbonPanelWrapper::Clone() const { return new RibbonPanelWrapper(); } |
| 36 |
|
| 37 |
wxString RibbonPanelWrapper::CppCtorCode() const |
| 38 |
{ |
| 39 |
wxString cppCode; |
| 40 |
wxcCodeGeneratorHelper::Get().AddBitmap(PropertyFile(PROP_BITMAP_PATH)); |
| 41 |
|
| 42 |
cppCode << GetName() << " = new " << GetRealClassName() << "(" << GetWindowParent() << ", " << GetId() << ", " |
| 43 |
<< Label() << ", " << wxcCodeGeneratorHelper::Get().BitmapCode(PropertyFile(PROP_BITMAP_PATH)) << ", " |
| 44 |
<< "wxDefaultPosition, " << SizeAsString() << ", " << StyleFlags("wxRIBBON_PANEL_DEFAULT_STYLE") << ");\n"; |
| 45 |
cppCode << CPPCommonAttributes(); |
| 46 |
return cppCode; |
| 47 |
} |
| 48 |
|
| 49 |
void RibbonPanelWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add("#include <wx/ribbon/panel.h>"); } |
| 50 |
|
| 51 |
wxString RibbonPanelWrapper::GetWxClassName() const { return "wxRibbonPanel"; } |
| 52 |
|
| 53 |
void RibbonPanelWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 54 |
{ |
| 55 |
text << XRCPrefix() << XRCCommonAttributes() << XRCSize() << XRCBitmap("icon") << XRCStyle() << XRCLabel(); |
| 56 |
ChildrenXRC(text, type); |
| 57 |
text << XRCSuffix(); |
| 58 |
} |