]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_frame.cpp
Initial checkin of the wxFrame support added by Aleks G.
[wxWidgets.git] / contrib / src / xml / xh_frame.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_frame.cpp
3 // Purpose: XML resource for dialogs
4 // Author: Vaclav Slavik & Aleks.
5 // Created: 2000/03/05
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "xh_frame.h"
13 #endif
14
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #include "wx/xml/xh_frame.h"
23 #include "wx/frame.h"
24 #include "wx/log.h"
25 #include "wx/intl.h"
26
27
28 wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
29 {
30 ADD_STYLE(wxSTAY_ON_TOP);
31 ADD_STYLE(wxCAPTION);
32 ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
33 ADD_STYLE(wxTHICK_FRAME);
34 ADD_STYLE(wxSYSTEM_MENU);
35 ADD_STYLE(wxRESIZE_BORDER);
36 ADD_STYLE(wxRESIZE_BOX);
37
38 ADD_STYLE(wxFRAME_TOOL_WINDOW);
39 ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
40 ADD_STYLE(wxMAXIMIZE_BOX);
41 ADD_STYLE(wxMINIMIZE_BOX);
42 ADD_STYLE(wxSTAY_ON_TOP);
43
44 ADD_STYLE(wxNO_3D);
45 ADD_STYLE(wxTAB_TRAVERSAL);
46 ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
47 ADD_STYLE(wxCLIP_CHILDREN);
48 AddWindowStyles();
49 }
50
51
52
53 wxObject *wxFrameXmlHandler::DoCreateResource()
54 {
55 wxFrame *frame = wxDynamicCast(m_Instance, wxFrame);
56
57 wxASSERT_MSG(frame, _("XML resource: Cannot create dialog without instance."));
58
59 frame->Create(m_ParentAsWindow,
60 GetID(),
61 GetText(_T("title")),
62 wxDefaultPosition, wxDefaultSize,
63 GetStyle(_T("style"), wxDEFAULT_FRAME_STYLE),
64 GetName());
65 frame->SetClientSize(GetSize());
66 frame->Move(GetPosition());
67 SetupWindow(frame);
68
69 CreateChildren(frame);
70
71 if (GetBool(_("centered"), FALSE))
72 frame->Centre();
73
74 return frame;
75 }
76
77
78
79 bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
80 {
81 return IsOfClass(node, _T("wxFrame"));
82 }
83
84