added wxHyperlinkCtrl (patch 1476781 from Francesco)
[wxWidgets.git] / src / xrc / xh_hyperlink.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: hyperlink.cpp
3 // Purpose: Hyperlink control
4 // Author: David Norris <danorris@gmail.com>
5 // Modified by: Ryan Norton, Francesco Montorsi
6 // Created: 04/02/2005
7 // RCS-ID: $Id$
8 // Copyright: (c) 2005 David Norris
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 //===========================================================================
13 // Declarations
14 //===========================================================================
15
16 //---------------------------------------------------------------------------
17 // Pre-compiled header stuff
18 //---------------------------------------------------------------------------
19
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "hyperlink.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 //---------------------------------------------------------------------------
32 // Includes
33 //---------------------------------------------------------------------------
34
35 #include "wx/hyperlink.h"
36 #include "wx/utils.h" // wxLaunchDefaultBrowser
37 #include "wx/xrc/xmlres.h"
38 #include "wx/xrc/xh_hyperlink.h"
39
40 #if wxUSE_HYPERLINKCTRL
41
42 //===========================================================================
43 // Implementation
44 //===========================================================================
45
46 //---------------------------------------------------------------------------
47 // wxHyperlinkCtrlXmlHandler
48 //---------------------------------------------------------------------------
49
50 // Register with wxWindows' dynamic class subsystem.
51 IMPLEMENT_DYNAMIC_CLASS(wxHyperlinkCtrlXmlHandler, wxXmlResourceHandler)
52
53 wxHyperlinkCtrlXmlHandler::wxHyperlinkCtrlXmlHandler()
54 {
55 AddWindowStyles();
56 }
57
58 wxObject *wxHyperlinkCtrlXmlHandler::DoCreateResource()
59 {
60 XRC_MAKE_INSTANCE(control, wxHyperlinkCtrl)
61
62 SetupWindow(control);
63 control->Create(m_parentAsWindow, GetID(),
64 GetParamValue(wxT("label")), GetParamValue(wxT("url")),
65 GetPosition(), GetSize(), GetStyle());
66
67 return control;
68 }
69
70 bool wxHyperlinkCtrlXmlHandler::CanHandle(wxXmlNode *node)
71 {
72 return IsOfClass(node, wxT("wxHyperlinkCtrl"));
73 }
74
75 #endif // wxUSE_HYPERLINKCTRL