]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_frame.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / xrc / xh_frame.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
1c067fe3 2// Name: src/xrc/xh_frame.cpp
b5d6954b 3// Purpose: XRC resource for dialogs
78d14f80
VS
4// Author: Vaclav Slavik & Aleks.
5// Created: 2000/03/05
78d14f80
VS
6// Copyright: (c) 2000 Vaclav Slavik
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
92e898b0 9
78d14f80
VS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
621be1ec 17#if wxUSE_XRC
a1e4ec87 18
78d14f80 19#include "wx/xrc/xh_frame.h"
88a7a4e1
WS
20
21#ifndef WX_PRECOMP
22 #include "wx/intl.h"
e4db172a 23 #include "wx/log.h"
76b49cf4 24 #include "wx/frame.h"
fdf565fe 25 #include "wx/dialog.h" // to get wxDEFAULT_DIALOG_STYLE
88a7a4e1
WS
26#endif
27
854e189f 28IMPLEMENT_DYNAMIC_CLASS(wxFrameXmlHandler, wxXmlResourceHandler)
78d14f80
VS
29
30wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
31{
544fee32
VS
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);
1c067fe3 36#if WXWIN_COMPATIBILITY_2_6
544fee32 37 XRC_ADD_STYLE(wxTHICK_FRAME);
1c067fe3 38#endif // WXWIN_COMPATIBILITY_2_6
544fee32
VS
39 XRC_ADD_STYLE(wxSYSTEM_MENU);
40 XRC_ADD_STYLE(wxRESIZE_BORDER);
1c067fe3 41#if WXWIN_COMPATIBILITY_2_6
544fee32 42 XRC_ADD_STYLE(wxRESIZE_BOX);
1c067fe3 43#endif // WXWIN_COMPATIBILITY_2_6
79132cd3 44 XRC_ADD_STYLE(wxCLOSE_BOX);
544fee32 45
e7a0050f
VS
46 XRC_ADD_STYLE(wxFRAME_NO_TASKBAR);
47 XRC_ADD_STYLE(wxFRAME_SHAPED);
544fee32
VS
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
1c067fe3 54#if WXWIN_COMPATIBILITY_2_6
544fee32 55 XRC_ADD_STYLE(wxNO_3D);
1c067fe3 56#endif // WXWIN_COMPATIBILITY_2_6
544fee32
VS
57 XRC_ADD_STYLE(wxTAB_TRAVERSAL);
58 XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
32a1ea1c 59 XRC_ADD_STYLE(wxFRAME_EX_METAL);
89c9b933 60 XRC_ADD_STYLE(wxFRAME_EX_CONTEXTHELP);
78d14f80 61
78d14f80
VS
62 AddWindowStyles();
63}
64
78d14f80 65wxObject *wxFrameXmlHandler::DoCreateResource()
92e898b0
RD
66{
67 XRC_MAKE_INSTANCE(frame, wxFrame);
68
78d14f80 69 frame->Create(m_parentAsWindow,
544fee32
VS
70 GetID(),
71 GetText(wxT("title")),
72 wxDefaultPosition, wxDefaultSize,
73 GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE),
74 GetName());
75
f2588180 76 if (HasParam(wxT("size")))
0c00c86f 77 frame->SetClientSize(GetSize(wxT("size"), frame));
f2588180
VS
78 if (HasParam(wxT("pos")))
79 frame->Move(GetPosition());
8b34993d 80 if (HasParam(wxT("icon")))
1c60f644 81 frame->SetIcons(GetIconBundle(wxT("icon"), wxART_FRAME_ICON));
544fee32 82
78d14f80
VS
83 SetupWindow(frame);
84
85 CreateChildren(frame);
92e898b0 86
f80ea77b 87 if (GetBool(wxT("centered"), false))
78d14f80 88 frame->Centre();
92e898b0 89
78d14f80
VS
90 return frame;
91}
92
78d14f80
VS
93bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
94{
f2588180 95 return IsOfClass(node, wxT("wxFrame"));
78d14f80 96}
a1e4ec87 97
621be1ec 98#endif // wxUSE_XRC