| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/xrc/xh_filectrl.cpp |
| 3 | // Purpose: XML resource handler for wxFileCtrl |
| 4 | // Author: Kinaou Hervé |
| 5 | // Created: 2009-05-11 |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) 2009 wxWidgets development team |
| 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_FILECTRL |
| 19 | |
| 20 | #include "wx/xrc/xh_filectrl.h" |
| 21 | #include "wx/filectrl.h" |
| 22 | |
| 23 | IMPLEMENT_DYNAMIC_CLASS(wxFileCtrlXmlHandler, wxXmlResourceHandler) |
| 24 | |
| 25 | wxFileCtrlXmlHandler::wxFileCtrlXmlHandler() : wxXmlResourceHandler() |
| 26 | { |
| 27 | XRC_ADD_STYLE(wxFC_DEFAULT_STYLE); |
| 28 | XRC_ADD_STYLE(wxFC_OPEN); |
| 29 | XRC_ADD_STYLE(wxFC_SAVE); |
| 30 | XRC_ADD_STYLE(wxFC_MULTIPLE); |
| 31 | XRC_ADD_STYLE(wxFC_NOSHOWHIDDEN); |
| 32 | |
| 33 | AddWindowStyles(); |
| 34 | } |
| 35 | |
| 36 | wxObject *wxFileCtrlXmlHandler::DoCreateResource() |
| 37 | { |
| 38 | XRC_MAKE_INSTANCE(filectrl, wxFileCtrl) |
| 39 | |
| 40 | filectrl->Create(m_parentAsWindow, |
| 41 | GetID(), |
| 42 | GetText(wxT("defaultdirectory")), |
| 43 | GetText(wxT("defaultfilename")), |
| 44 | GetParamValue(wxT("wildcard")), |
| 45 | GetStyle(wxT("style"), wxFC_DEFAULT_STYLE), |
| 46 | GetPosition(), |
| 47 | GetSize(), |
| 48 | GetName()); |
| 49 | |
| 50 | SetupWindow(filectrl); |
| 51 | return filectrl; |
| 52 | } |
| 53 | |
| 54 | bool wxFileCtrlXmlHandler::CanHandle(wxXmlNode *node) |
| 55 | { |
| 56 | return IsOfClass(node, wxT("wxFileCtrl")); |
| 57 | } |
| 58 | |
| 59 | #endif // wxUSE_XRC && wxUSE_FILECTRL |