| 1 |
#include "static_bitmap_wrapper.h" |
| 2 |
#include "allocator_mgr.h" |
| 3 |
#include "file_ficker_property.h" |
| 4 |
#include "import_from_wxFB.h" |
| 5 |
#include "import_from_xrc.h" |
| 6 |
#include "wxc_bitmap_code_generator.h" |
| 7 |
#include "xmlutils.h" |
| 8 |
|
| 9 |
StaticBitmapWrapper::StaticBitmapWrapper() |
| 10 |
: wxcWidget(ID_WXSTATICBITMAP) |
| 11 |
{ |
| 12 |
SetPropertyString(_("Common Settings"), "wxStaticBitmap"); |
| 13 |
AddProperty(new BitmapPickerProperty(PROP_BITMAP_PATH, wxT(""), _("Select the bitmap file"))); |
| 14 |
m_namePattern = wxT("m_staticBitmap"); |
| 15 |
SetName(GenerateName()); |
| 16 |
} |
| 17 |
|
| 18 |
StaticBitmapWrapper::~StaticBitmapWrapper() {} |
| 19 |
|
| 20 |
wxcWidget* StaticBitmapWrapper::Clone() const { return new StaticBitmapWrapper(); } |
| 21 |
|
| 22 |
void StaticBitmapWrapper::GetIncludeFile(wxArrayString& headers) const { headers.Add(wxT("#include <wx/statbmp.h>")); } |
| 23 |
|
| 24 |
wxString StaticBitmapWrapper::GetWxClassName() const { return wxT("wxStaticBitmap"); } |
| 25 |
|
| 26 |
wxString StaticBitmapWrapper::CppCtorCode() const |
| 27 |
{ |
| 28 |
wxString code; |
| 29 |
wxcCodeGeneratorHelper::Get().AddBitmap(PropertyFile(PROP_BITMAP_PATH)); |
| 30 |
code << GetName() << wxT(" = new ") << GetRealClassName() << "(" << GetWindowParent() << wxT(", ") |
| 31 |
<< PropertyString(PROP_WINDOW_ID) << wxT(", ") |
| 32 |
<< wxcCodeGeneratorHelper::Get().BitmapCode(PropertyFile(PROP_BITMAP_PATH)) << wxT(", ") |
| 33 |
<< wxT("wxDefaultPosition, ") << SizeAsString() << wxT(", 0 );\n"); |
| 34 |
code << CPPCommonAttributes(); |
| 35 |
return code; |
| 36 |
} |
| 37 |
|
| 38 |
void StaticBitmapWrapper::ToXRC(wxString& text, XRC_TYPE type) const |
| 39 |
{ |
| 40 |
text << XRCPrefix() << XRCBitmap() << XRCSize() << XRCCommonAttributes() << XRCSuffix(); |
| 41 |
} |
| 42 |
|
| 43 |
void StaticBitmapWrapper::LoadPropertiesFromXRC(const wxXmlNode* node) |
| 44 |
{ |
| 45 |
// First call the base-class for the standard things |
| 46 |
wxcWidget::LoadPropertiesFromXRC(node); |
| 47 |
|
| 48 |
wxXmlNode* propertynode = XmlUtils::FindFirstByTagName(node, wxT("bitmap")); |
| 49 |
if(propertynode) { ImportFromXrc::ProcessBitmapProperty(propertynode, this, PROP_BITMAP_PATH, "wxART_BUTTON"); } |
| 50 |
} |
| 51 |
|
| 52 |
void StaticBitmapWrapper::LoadPropertiesFromwxSmith(const wxXmlNode* node) |
| 53 |
{ |
| 54 |
// First call the base-class for the standard things |
| 55 |
wxcWidget::LoadPropertiesFromwxSmith(node); |
| 56 |
|
| 57 |
wxXmlNode* propertynode = XmlUtils::FindFirstByTagName(node, wxT("bitmap")); |
| 58 |
if(propertynode) { ImportFromXrc::ProcessBitmapProperty(propertynode, this, PROP_BITMAP_PATH, "wxART_BUTTON"); } |
| 59 |
} |
| 60 |
|
| 61 |
void StaticBitmapWrapper::LoadPropertiesFromwxFB(const wxXmlNode* node) |
| 62 |
{ |
| 63 |
// First call the base-class for the standard things |
| 64 |
wxcWidget::LoadPropertiesFromwxFB(node); |
| 65 |
|
| 66 |
wxXmlNode* propertynode = XmlUtils::FindNodeByName(node, "property", "bitmap"); |
| 67 |
if(propertynode) { |
| 68 |
ImportFromwxFB::ProcessBitmapProperty(propertynode->GetNodeContent(), this, PROP_BITMAP_PATH, "wxART_BUTTON"); |
| 69 |
} |
| 70 |
} |