From 1540e053dd87095c23c1d9a42db4f395621af240 Mon Sep 17 00:00:00 2001 From: George Tasker <gtasker@allenbrook.com> Date: Sat, 3 Feb 2001 21:44:28 +0000 Subject: [PATCH] Initial checkin of the wxFrame support added by Aleks G. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/xml/xh_frame.h | 29 +++++++++++ contrib/src/xml/xh_frame.cpp | 84 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 contrib/include/wx/xml/xh_frame.h create mode 100644 contrib/src/xml/xh_frame.cpp diff --git a/contrib/include/wx/xml/xh_frame.h b/contrib/include/wx/xml/xh_frame.h new file mode 100644 index 0000000000..d70579c8d0 --- /dev/null +++ b/contrib/include/wx/xml/xh_frame.h @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: xh_frame.h +// Purpose: XML resource handler for dialogs +// Author: Vaclav Slavik & Aleks. +// Created: 2000/03/05 +// RCS-ID: $Id$ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_FRAME_H_ +#define _WX_XH_FRAME_H_ + +#ifdef __GNUG__ +#pragma interface "xh_frame.h" +#endif + +#include "wx/xml/xmlres.h" + +class WXDLLEXPORT wxFrameXmlHandler : public wxXmlResourceHandler +{ + public: + wxFrameXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + + +#endif // _WX_XH_FRAME_H_ diff --git a/contrib/src/xml/xh_frame.cpp b/contrib/src/xml/xh_frame.cpp new file mode 100644 index 0000000000..dd56ad7004 --- /dev/null +++ b/contrib/src/xml/xh_frame.cpp @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: xh_frame.cpp +// Purpose: XML resource for dialogs +// Author: Vaclav Slavik & Aleks. +// Created: 2000/03/05 +// RCS-ID: $Id$ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "xh_frame.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/xml/xh_frame.h" +#include "wx/frame.h" +#include "wx/log.h" +#include "wx/intl.h" + + +wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler() +{ + ADD_STYLE(wxSTAY_ON_TOP); + ADD_STYLE(wxCAPTION); + ADD_STYLE(wxDEFAULT_DIALOG_STYLE); + ADD_STYLE(wxTHICK_FRAME); + ADD_STYLE(wxSYSTEM_MENU); + ADD_STYLE(wxRESIZE_BORDER); + ADD_STYLE(wxRESIZE_BOX); + + ADD_STYLE(wxFRAME_TOOL_WINDOW); + ADD_STYLE(wxFRAME_FLOAT_ON_PARENT); + ADD_STYLE(wxMAXIMIZE_BOX); + ADD_STYLE(wxMINIMIZE_BOX); + ADD_STYLE(wxSTAY_ON_TOP); + + ADD_STYLE(wxNO_3D); + ADD_STYLE(wxTAB_TRAVERSAL); + ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); + ADD_STYLE(wxCLIP_CHILDREN); + AddWindowStyles(); +} + + + +wxObject *wxFrameXmlHandler::DoCreateResource() +{ + wxFrame *frame = wxDynamicCast(m_Instance, wxFrame); + + wxASSERT_MSG(frame, _("XML resource: Cannot create dialog without instance.")); + + frame->Create(m_ParentAsWindow, + GetID(), + GetText(_T("title")), + wxDefaultPosition, wxDefaultSize, + GetStyle(_T("style"), wxDEFAULT_FRAME_STYLE), + GetName()); + frame->SetClientSize(GetSize()); + frame->Move(GetPosition()); + SetupWindow(frame); + + CreateChildren(frame); + + if (GetBool(_("centered"), FALSE)) + frame->Centre(); + + return frame; +} + + + +bool wxFrameXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, _T("wxFrame")); +} + + -- 2.45.2