| 1 |
#include "ribbon_gallery_item_wrapper.h" |
| 2 |
|
| 3 |
#include "allocator_mgr.h" |
| 4 |
#include "file_ficker_property.h" |
| 5 |
#include "wxc_bitmap_code_generator.h" |
| 6 |
#include "wxgui_bitmaploader.h" |
| 7 |
#include "wxgui_defs.h" |
| 8 |
#include "wxgui_helpers.h" |
| 9 |
|
| 10 |
RibbonGalleryItemWrapper::RibbonGalleryItemWrapper() |
| 11 |
: wxcWidget(ID_WXRIBBONGALLERYITME) |
| 12 |
{ |
| 13 |
SetPropertyString(_("Common Settings"), "wxRibbonGalleryItem"); |
| 14 |
AddProperty(new BitmapPickerProperty(PROP_BITMAP_PATH, "", _("Select the bitmap file"))); |
| 15 |
|
| 16 |
wxCrafter::ResourceLoader bl; |
| 17 |
m_properties.Item(PROP_BITMAP_PATH)->SetValue(bl.GetPlaceHolderImagePath().GetFullPath()); |
| 18 |
|
| 19 |
m_namePattern = "galleryItem"; |
| 20 |
SetName(GenerateName()); |
| 21 |
} |
| 22 |
|
| 23 |
RibbonGalleryItemWrapper::~RibbonGalleryItemWrapper() {} |
| 24 |
|
| 25 |
wxcWidget* RibbonGalleryItemWrapper::Clone() const { return new RibbonGalleryItemWrapper(); } |
| 26 |
|
| 27 |
wxString RibbonGalleryItemWrapper::CppCtorCode() const |
| 28 |
{ |
| 29 |
wxcCodeGeneratorHelper::Get().AddBitmap(PropertyFile(PROP_BITMAP_PATH)); |
| 30 |
wxString code; |
| 31 |
code << GetParent()->GetName() << "->Append( " |
| 32 |
<< wxcCodeGeneratorHelper::Get().BitmapCode(PropertyFile(PROP_BITMAP_PATH)) << ", " << GetId() << ");\n"; |
| 33 |
return code; |
| 34 |
} |
| 35 |
|
| 36 |
void RibbonGalleryItemWrapper::GetIncludeFile(wxArrayString& headers) const { wxUnusedVar(headers); } |
| 37 |
|
| 38 |
wxString RibbonGalleryItemWrapper::GetWxClassName() const { return ""; } |
| 39 |
|
| 40 |
void RibbonGalleryItemWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 41 |
{ |
| 42 |
wxUnusedVar(type); |
| 43 |
text << "<object class=\"item\" name=\"" << wxCrafter::XMLEncode(GetName()) << "\">"; |
| 44 |
text << XRCBitmap() << XRCSuffix(); |
| 45 |
} |