| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/xrc/xh_scwin.cpp |
| 3 | // Purpose: XRC resource for wxScrolledWindow |
| 4 | // Author: Vaclav Slavik |
| 5 | // Created: 2002/10/18 |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) 2002 Vaclav Slavik |
| 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 |
| 19 | |
| 20 | #include "wx/xrc/xh_scwin.h" |
| 21 | |
| 22 | #ifndef WX_PRECOMP |
| 23 | #include "wx/frame.h" |
| 24 | #include "wx/scrolwin.h" |
| 25 | #endif |
| 26 | |
| 27 | IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindowXmlHandler, wxXmlResourceHandler) |
| 28 | |
| 29 | wxScrolledWindowXmlHandler::wxScrolledWindowXmlHandler() |
| 30 | : wxXmlResourceHandler() |
| 31 | { |
| 32 | XRC_ADD_STYLE(wxHSCROLL); |
| 33 | XRC_ADD_STYLE(wxVSCROLL); |
| 34 | |
| 35 | // wxPanel styles |
| 36 | #if WXWIN_COMPATIBILITY_2_6 |
| 37 | XRC_ADD_STYLE(wxNO_3D); |
| 38 | #endif // WXWIN_COMPATIBILITY_2_6 |
| 39 | XRC_ADD_STYLE(wxTAB_TRAVERSAL); |
| 40 | XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); |
| 41 | |
| 42 | AddWindowStyles(); |
| 43 | } |
| 44 | |
| 45 | wxObject *wxScrolledWindowXmlHandler::DoCreateResource() |
| 46 | { |
| 47 | XRC_MAKE_INSTANCE(control, wxScrolledWindow) |
| 48 | |
| 49 | control->Create(m_parentAsWindow, |
| 50 | GetID(), |
| 51 | GetPosition(), GetSize(), |
| 52 | GetStyle(wxT("style"), wxHSCROLL | wxVSCROLL), |
| 53 | GetName()); |
| 54 | |
| 55 | SetupWindow(control); |
| 56 | CreateChildren(control); |
| 57 | |
| 58 | if ( HasParam(wxT("scrollrate")) ) |
| 59 | { |
| 60 | wxSize rate = GetSize(wxT("scrollrate")); |
| 61 | control->SetScrollRate(rate.x, rate.y); |
| 62 | } |
| 63 | |
| 64 | return control; |
| 65 | } |
| 66 | |
| 67 | bool wxScrolledWindowXmlHandler::CanHandle(wxXmlNode *node) |
| 68 | { |
| 69 | return IsOfClass(node, wxT("wxScrolledWindow")); |
| 70 | } |
| 71 | |
| 72 | #endif // wxUSE_XRC |