]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_bannerwindow.cpp
Fix wxHash{Set,Map} compilation with g++ 4.7 in C++11 mode.
[wxWidgets.git] / src / xrc / xh_bannerwindow.cpp
CommitLineData
ae2047c3
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: srx/xrc/xh_bannerwindow.h
3// Purpose: Implementation of wxBannerWindow XRC handler.
4// Author: Vadim Zeitlin
5// Created: 2011-08-16
6// RCS-ID: $Id$
7// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#if wxUSE_XRC && wxUSE_BANNERWINDOW
19
20#include "wx/xrc/xh_bannerwindow.h"
21#include "wx/bannerwindow.h"
22
23wxIMPLEMENT_DYNAMIC_CLASS(wxBannerWindowXmlHandler, wxXmlResourceHandler)
24
25wxBannerWindowXmlHandler::wxBannerWindowXmlHandler()
26 : wxXmlResourceHandler()
27{
28 AddWindowStyles();
29}
30
31wxObject *wxBannerWindowXmlHandler::DoCreateResource()
32{
33 XRC_MAKE_INSTANCE(banner, wxBannerWindow)
34
35 banner->Create(m_parentAsWindow,
36 GetID(),
37 GetDirection(wxS("direction")),
38 GetPosition(),
39 GetSize(),
40 GetStyle(wxS("style")),
41 GetName());
42
43 SetupWindow(banner);
44
45 const wxColour colStart = GetColour(wxS("gradient-start"));
46 const wxColour colEnd = GetColour(wxS("gradient-end"));
47 if ( colStart.IsOk() || colEnd.IsOk() )
48 {
49 if ( !colStart.IsOk() || !colEnd.IsOk() )
50 {
51 ReportError
52 (
53 "Both start and end gradient colours must be "
54 "specified if either one is."
55 );
56 }
57 else
58 {
59 banner->SetGradient(colStart, colEnd);
60 }
61 }
62
63 wxBitmap bitmap = GetBitmap();
64 if ( bitmap.IsOk() )
65 {
66 if ( colStart.IsOk() || colEnd.IsOk() )
67 {
68 ReportError
69 (
70 "Gradient colours are ignored by wxBannerWindow "
71 "if the background bitmap is specified."
72 );
73 }
74
75 banner->SetBitmap(bitmap);
76 }
77
78 banner->SetText(GetText(wxS("title")), GetText(wxS("message")));
79
80 return banner;
81}
82
83bool wxBannerWindowXmlHandler::CanHandle(wxXmlNode *node)
84{
85 return IsOfClass(node, wxS("wxBannerWindow"));
86}
87
88#endif // wxUSE_XRC && wxUSE_BANNERWINDOW