]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_statbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_statbar.cpp
3 // Purpose: XRC resource for wxStatusBar
4 // Author: Brian Ravnsgaard Riis
7 // Copyright: (c) 2004 Brian Ravnsgaard Riis
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "xh_statbar.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
23 #include "wx/string.h"
27 #include "wx/xrc/xh_statbar.h"
28 #include "wx/statusbr.h"
30 IMPLEMENT_DYNAMIC_CLASS(wxStatusBarXmlHandler
, wxXmlResourceHandler
)
32 wxStatusBarXmlHandler::wxStatusBarXmlHandler() :
33 wxXmlResourceHandler()
35 XRC_ADD_STYLE(wxST_SIZEGRIP
);
39 wxObject
*wxStatusBarXmlHandler::DoCreateResource()
41 XRC_MAKE_INSTANCE(statbar
, wxStatusBar
)
43 statbar
->Create(m_parentAsWindow
,
48 int fields
= GetLong(wxT("fields"), 1);
49 wxString widths
= GetParamValue(wxT("widths"));
51 if (fields
> 1 && !widths
.IsEmpty())
53 int *width
= new int[fields
];
55 for (int i
= 0; i
< fields
; ++i
)
57 width
[i
] = wxAtoi(widths
.BeforeFirst(wxT(',')));
58 if(widths
.Find(wxT(',')))
59 widths
.Remove(0, widths
.Find(wxT(',')) + 1);
61 statbar
->SetFieldsCount(fields
, width
);
65 statbar
->SetFieldsCount(fields
);
69 wxFrame
*parentFrame
= wxDynamicCast(m_parent
, wxFrame
);
71 parentFrame
->SetStatusBar(statbar
);
77 bool wxStatusBarXmlHandler::CanHandle(wxXmlNode
*node
)
79 return IsOfClass(node
, wxT("wxStatusBar"));