]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_bannerwindow.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: srx/xrc/xh_bannerwindow.h
3 // Purpose: Implementation of wxBannerWindow XRC handler.
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_BANNERWINDOW
20 #include "wx/xrc/xh_bannerwindow.h"
21 #include "wx/bannerwindow.h"
23 wxIMPLEMENT_DYNAMIC_CLASS(wxBannerWindowXmlHandler
, wxXmlResourceHandler
)
25 wxBannerWindowXmlHandler::wxBannerWindowXmlHandler()
26 : wxXmlResourceHandler()
31 wxObject
*wxBannerWindowXmlHandler::DoCreateResource()
33 XRC_MAKE_INSTANCE(banner
, wxBannerWindow
)
35 banner
->Create(m_parentAsWindow
,
37 GetDirection(wxS("direction")),
40 GetStyle(wxS("style")),
45 const wxColour colStart
= GetColour(wxS("gradient-start"));
46 const wxColour colEnd
= GetColour(wxS("gradient-end"));
47 if ( colStart
.IsOk() || colEnd
.IsOk() )
49 if ( !colStart
.IsOk() || !colEnd
.IsOk() )
53 "Both start and end gradient colours must be "
54 "specified if either one is."
59 banner
->SetGradient(colStart
, colEnd
);
63 wxBitmap bitmap
= GetBitmap();
66 if ( colStart
.IsOk() || colEnd
.IsOk() )
70 "Gradient colours are ignored by wxBannerWindow "
71 "if the background bitmap is specified."
75 banner
->SetBitmap(bitmap
);
78 banner
->SetText(GetText(wxS("title")), GetText(wxS("message")));
83 bool wxBannerWindowXmlHandler::CanHandle(wxXmlNode
*node
)
85 return IsOfClass(node
, wxS("wxBannerWindow"));
88 #endif // wxUSE_XRC && wxUSE_BANNERWINDOW