]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_frame.cpp
Define __VISUALC__ for ICC under Windows again.
[wxWidgets.git] / src / xrc / xh_frame.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_frame.cpp
3 // Purpose: XRC resource for dialogs
4 // Author: Vaclav Slavik & Aleks.
5 // Created: 2000/03/05
6 // Copyright: (c) 2000 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #if wxUSE_XRC
18
19 #include "wx/xrc/xh_frame.h"
20
21 #ifndef WX_PRECOMP
22 #include "wx/intl.h"
23 #include "wx/log.h"
24 #include "wx/frame.h"
25 #include "wx/dialog.h" // to get wxDEFAULT_DIALOG_STYLE
26 #endif
27
28 IMPLEMENT_DYNAMIC_CLASS(wxFrameXmlHandler, wxXmlResourceHandler)
29
30 wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
31 {
32 XRC_ADD_STYLE(wxSTAY_ON_TOP);
33 XRC_ADD_STYLE(wxCAPTION);
34 XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
35 XRC_ADD_STYLE(wxDEFAULT_FRAME_STYLE);
36 #if WXWIN_COMPATIBILITY_2_6
37 XRC_ADD_STYLE(wxTHICK_FRAME);
38 #endif // WXWIN_COMPATIBILITY_2_6
39 XRC_ADD_STYLE(wxSYSTEM_MENU);
40 XRC_ADD_STYLE(wxRESIZE_BORDER);
41 #if WXWIN_COMPATIBILITY_2_6
42 XRC_ADD_STYLE(wxRESIZE_BOX);
43 #endif // WXWIN_COMPATIBILITY_2_6
44 XRC_ADD_STYLE(wxCLOSE_BOX);
45
46 XRC_ADD_STYLE(wxFRAME_NO_TASKBAR);
47 XRC_ADD_STYLE(wxFRAME_SHAPED);
48 XRC_ADD_STYLE(wxFRAME_TOOL_WINDOW);
49 XRC_ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
50 XRC_ADD_STYLE(wxMAXIMIZE_BOX);
51 XRC_ADD_STYLE(wxMINIMIZE_BOX);
52 XRC_ADD_STYLE(wxSTAY_ON_TOP);
53
54 #if WXWIN_COMPATIBILITY_2_6
55 XRC_ADD_STYLE(wxNO_3D);
56 #endif // WXWIN_COMPATIBILITY_2_6
57 XRC_ADD_STYLE(wxTAB_TRAVERSAL);
58 XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
59 XRC_ADD_STYLE(wxFRAME_EX_METAL);
60 XRC_ADD_STYLE(wxFRAME_EX_CONTEXTHELP);
61
62 AddWindowStyles();
63 }
64
65 wxObject *wxFrameXmlHandler::DoCreateResource()
66 {
67 XRC_MAKE_INSTANCE(frame, wxFrame);
68
69 frame->Create(m_parentAsWindow,
70 GetID(),
71 GetText(wxT("title")),
72 wxDefaultPosition, wxDefaultSize,
73 GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE),
74 GetName());
75
76 if (HasParam(wxT("size")))
77 frame->SetClientSize(GetSize(wxT("size"), frame));
78 if (HasParam(wxT("pos")))
79 frame->Move(GetPosition());
80 if (HasParam(wxT("icon")))
81 frame->SetIcons(GetIconBundle(wxT("icon"), wxART_FRAME_ICON));
82
83 SetupWindow(frame);
84
85 CreateChildren(frame);
86
87 if (GetBool(wxT("centered"), false))
88 frame->Centre();
89
90 return frame;
91 }
92
93 bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
94 {
95 return IsOfClass(node, wxT("wxFrame"));
96 }
97
98 #endif // wxUSE_XRC