]>
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
6 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_BANNERWINDOW
19 #include "wx/xrc/xh_bannerwindow.h"
20 #include "wx/bannerwindow.h"
22 wxIMPLEMENT_DYNAMIC_CLASS(wxBannerWindowXmlHandler
, wxXmlResourceHandler
)
24 wxBannerWindowXmlHandler::wxBannerWindowXmlHandler()
25 : wxXmlResourceHandler()
30 wxObject
*wxBannerWindowXmlHandler::DoCreateResource()
32 XRC_MAKE_INSTANCE(banner
, wxBannerWindow
)
34 banner
->Create(m_parentAsWindow
,
36 GetDirection(wxS("direction")),
39 GetStyle(wxS("style")),
44 const wxColour colStart
= GetColour(wxS("gradient-start"));
45 const wxColour colEnd
= GetColour(wxS("gradient-end"));
46 if ( colStart
.IsOk() || colEnd
.IsOk() )
48 if ( !colStart
.IsOk() || !colEnd
.IsOk() )
52 "Both start and end gradient colours must be "
53 "specified if either one is."
58 banner
->SetGradient(colStart
, colEnd
);
62 wxBitmap bitmap
= GetBitmap();
65 if ( colStart
.IsOk() || colEnd
.IsOk() )
69 "Gradient colours are ignored by wxBannerWindow "
70 "if the background bitmap is specified."
74 banner
->SetBitmap(bitmap
);
77 banner
->SetText(GetText(wxS("title")), GetText(wxS("message")));
82 bool wxBannerWindowXmlHandler::CanHandle(wxXmlNode
*node
)
84 return IsOfClass(node
, wxS("wxBannerWindow"));
87 #endif // wxUSE_XRC && wxUSE_BANNERWINDOW