]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: xh_frame.cpp | |
3 | // Purpose: XRC 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/xrc/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(wxDEFAULT_FRAME_STYLE); | |
34 | ADD_STYLE(wxTHICK_FRAME); | |
35 | ADD_STYLE(wxSYSTEM_MENU); | |
36 | ADD_STYLE(wxRESIZE_BORDER); | |
37 | ADD_STYLE(wxRESIZE_BOX); | |
38 | ||
39 | ADD_STYLE(wxFRAME_TOOL_WINDOW); | |
40 | ADD_STYLE(wxFRAME_FLOAT_ON_PARENT); | |
41 | ADD_STYLE(wxMAXIMIZE_BOX); | |
42 | ADD_STYLE(wxMINIMIZE_BOX); | |
43 | ADD_STYLE(wxSTAY_ON_TOP); | |
44 | ||
45 | ADD_STYLE(wxNO_3D); | |
46 | ADD_STYLE(wxTAB_TRAVERSAL); | |
47 | ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); | |
48 | ADD_STYLE(wxCLIP_CHILDREN); | |
49 | AddWindowStyles(); | |
50 | } | |
51 | ||
52 | ||
53 | ||
54 | wxObject *wxFrameXmlHandler::DoCreateResource() | |
55 | { | |
56 | wxFrame *frame = wxDynamicCast(m_instance, wxFrame); | |
57 | ||
58 | wxASSERT_MSG(frame, _("XRC resource: Cannot create dialog without instance.")); | |
59 | ||
60 | frame->Create(m_parentAsWindow, | |
61 | GetID(), | |
62 | GetText(_T("title")), | |
63 | wxDefaultPosition, wxDefaultSize, | |
64 | GetStyle(_T("style"), wxDEFAULT_FRAME_STYLE), | |
65 | GetName()); | |
66 | frame->SetClientSize(GetSize()); | |
67 | frame->Move(GetPosition()); | |
68 | SetupWindow(frame); | |
69 | ||
70 | CreateChildren(frame); | |
71 | ||
72 | if (GetBool(_("centered"), FALSE)) | |
73 | frame->Centre(); | |
74 | ||
75 | return frame; | |
76 | } | |
77 | ||
78 | ||
79 | ||
80 | bool wxFrameXmlHandler::CanHandle(wxXmlNode *node) | |
81 | { | |
82 | return IsOfClass(node, _T("wxFrame")); | |
83 | } | |
84 | ||
85 |