Applied patch [ 882493 ] Added XRC support for wxStatusBar
By Brian Ravnsgaard Riis git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
xh_slidr.cpp
|
xh_slidr.cpp
|
||||||
xh_spin.cpp
|
xh_spin.cpp
|
||||||
xh_split.cpp
|
xh_split.cpp
|
||||||
|
xh_statbar.cpp
|
||||||
xh_stbmp.cpp
|
xh_stbmp.cpp
|
||||||
xh_stbox.cpp
|
xh_stbox.cpp
|
||||||
xh_stlin.cpp
|
xh_stlin.cpp
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
wx/xrc/xh_slidr.h
|
wx/xrc/xh_slidr.h
|
||||||
wx/xrc/xh_spin.h
|
wx/xrc/xh_spin.h
|
||||||
wx/xrc/xh_split.h
|
wx/xrc/xh_split.h
|
||||||
|
wx/xrc/xh_statbar.h
|
||||||
wx/xrc/xh_stbmp.h
|
wx/xrc/xh_stbmp.h
|
||||||
wx/xrc/xh_stbox.h
|
wx/xrc/xh_stbox.h
|
||||||
wx/xrc/xh_stlin.h
|
wx/xrc/xh_stlin.h
|
||||||
|
@@ -49,5 +49,6 @@
|
|||||||
#include "wx/xrc/xh_scwin.h"
|
#include "wx/xrc/xh_scwin.h"
|
||||||
#include "wx/xrc/xh_split.h"
|
#include "wx/xrc/xh_split.h"
|
||||||
#include "wx/xrc/xh_wizrd.h"
|
#include "wx/xrc/xh_wizrd.h"
|
||||||
|
#include "wx/xrc/xh_statbar.h"
|
||||||
|
|
||||||
#endif // _WX_XMLRES_H_
|
#endif // _WX_XMLRES_H_
|
||||||
|
29
contrib/include/wx/xrc/xh_statbar.h
Normal file
29
contrib/include/wx/xrc/xh_statbar.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: xh_statbar.h
|
||||||
|
// Purpose: XML resource handler for wxStatusBar
|
||||||
|
// Author: Brian Ravnsgaard Riis
|
||||||
|
// Created: 2004/01/21
|
||||||
|
// RCS-ID:
|
||||||
|
// Copyright: (c) 2004 Brian Ravnsgaard Riis
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_XH_STATBAR_H_
|
||||||
|
#define _WX_XH_STATBAR_H_
|
||||||
|
|
||||||
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||||
|
#pragma interface "xh_statbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/xrc/xmlres.h"
|
||||||
|
|
||||||
|
class WXXMLDLLEXPORT wxStatusBarXmlHandler : public wxXmlResourceHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxStatusBarXmlHandler();
|
||||||
|
virtual wxObject *DoCreateResource();
|
||||||
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_XH_STATBAR_H_
|
||||||
|
|
79
contrib/src/xrc/xh_statbar.cpp
Normal file
79
contrib/src/xrc/xh_statbar.cpp
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: xh_statbar.cpp
|
||||||
|
// Purpose: XRC resource for wxStatusBar
|
||||||
|
// Author: Brian Ravnsgaard Riis
|
||||||
|
// Created: 2004/01/21
|
||||||
|
// RCS-ID:
|
||||||
|
// Copyright: (c) 2004 Brian Ravnsgaard Riis
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "xh_statbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/frame.h"
|
||||||
|
#include "wx/string.h"
|
||||||
|
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
|
||||||
|
#include "wx/xrc/xh_statbar.h"
|
||||||
|
#include "wx/statusbr.h"
|
||||||
|
|
||||||
|
wxStatusBarXmlHandler::wxStatusBarXmlHandler() :
|
||||||
|
wxXmlResourceHandler()
|
||||||
|
{
|
||||||
|
XRC_ADD_STYLE(wxST_SIZEGRIP);
|
||||||
|
AddWindowStyles();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxObject *wxStatusBarXmlHandler::DoCreateResource()
|
||||||
|
{
|
||||||
|
XRC_MAKE_INSTANCE(statbar, wxStatusBar)
|
||||||
|
|
||||||
|
statbar->Create(m_parentAsWindow,
|
||||||
|
GetID(),
|
||||||
|
GetStyle(),
|
||||||
|
GetName());
|
||||||
|
|
||||||
|
int fields = GetLong(wxT("fields"), 1);
|
||||||
|
wxString widths = GetParamValue(wxT("widths"));
|
||||||
|
|
||||||
|
if(fields > 1)
|
||||||
|
{
|
||||||
|
int *width = new int[fields];
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < fields; ++i)
|
||||||
|
{
|
||||||
|
width[i] = wxAtoi(widths.BeforeFirst(wxT(',')));
|
||||||
|
if(widths.Find(wxT(',')))
|
||||||
|
widths.Remove(0, widths.Find(wxT(',')) + 1);
|
||||||
|
}
|
||||||
|
statbar->SetFieldsCount(fields, width);
|
||||||
|
delete[] width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_parentAsWindow)
|
||||||
|
{
|
||||||
|
wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame);
|
||||||
|
if (parentFrame)
|
||||||
|
parentFrame->SetStatusBar(statbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
return statbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxStatusBarXmlHandler::CanHandle(wxXmlNode *node)
|
||||||
|
{
|
||||||
|
return IsOfClass(node, wxT("wxStatusBar"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@@ -99,4 +99,7 @@ void wxXmlResource::InitAllHandlers()
|
|||||||
#if wxUSE_WIZARDDLG
|
#if wxUSE_WIZARDDLG
|
||||||
AddHandler(new wxWizardXmlHandler);
|
AddHandler(new wxWizardXmlHandler);
|
||||||
#endif
|
#endif
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
AddHandler(new wxStatusBarXmlHandler);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -113,6 +113,7 @@ All (GUI):
|
|||||||
- fixed scrollbar problem in wxGrid (not showing scrollbars
|
- fixed scrollbar problem in wxGrid (not showing scrollbars
|
||||||
when sizing smaller) (Shane Harper)
|
when sizing smaller) (Shane Harper)
|
||||||
- dbbrowse demo fixed for Unicode (Wlodzimierz Skiba)
|
- dbbrowse demo fixed for Unicode (Wlodzimierz Skiba)
|
||||||
|
- added wxStatusBar support to XRC (Brian Ravnsgaard Riis)
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
@@ -323,6 +323,10 @@ and the splitter is created unsplitted. If there are two children, the
|
|||||||
splitter is created splitted, either horizontally or vertically depending
|
splitter is created splitted, either horizontally or vertically depending
|
||||||
on the value of "orientation" attribute.
|
on the value of "orientation" attribute.
|
||||||
|
|
||||||
|
wxStatusBar
|
||||||
|
-----------
|
||||||
|
fields Integer number of fields
|
||||||
|
widths Width1, Width2, Width3, ...
|
||||||
|
|
||||||
wxToolBar
|
wxToolBar
|
||||||
---------
|
---------
|
||||||
|
@@ -49,5 +49,6 @@
|
|||||||
#include "wx/xrc/xh_scwin.h"
|
#include "wx/xrc/xh_scwin.h"
|
||||||
#include "wx/xrc/xh_split.h"
|
#include "wx/xrc/xh_split.h"
|
||||||
#include "wx/xrc/xh_wizrd.h"
|
#include "wx/xrc/xh_wizrd.h"
|
||||||
|
#include "wx/xrc/xh_statbar.h"
|
||||||
|
|
||||||
#endif // _WX_XMLRES_H_
|
#endif // _WX_XMLRES_H_
|
||||||
|
29
include/wx/xrc/xh_statbar.h
Normal file
29
include/wx/xrc/xh_statbar.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: xh_statbar.h
|
||||||
|
// Purpose: XML resource handler for wxStatusBar
|
||||||
|
// Author: Brian Ravnsgaard Riis
|
||||||
|
// Created: 2004/01/21
|
||||||
|
// RCS-ID:
|
||||||
|
// Copyright: (c) 2004 Brian Ravnsgaard Riis
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_XH_STATBAR_H_
|
||||||
|
#define _WX_XH_STATBAR_H_
|
||||||
|
|
||||||
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||||
|
#pragma interface "xh_statbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/xrc/xmlres.h"
|
||||||
|
|
||||||
|
class WXXMLDLLEXPORT wxStatusBarXmlHandler : public wxXmlResourceHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxStatusBarXmlHandler();
|
||||||
|
virtual wxObject *DoCreateResource();
|
||||||
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_XH_STATBAR_H_
|
||||||
|
|
79
src/xrc/xh_statbar.cpp
Normal file
79
src/xrc/xh_statbar.cpp
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: xh_statbar.cpp
|
||||||
|
// Purpose: XRC resource for wxStatusBar
|
||||||
|
// Author: Brian Ravnsgaard Riis
|
||||||
|
// Created: 2004/01/21
|
||||||
|
// RCS-ID:
|
||||||
|
// Copyright: (c) 2004 Brian Ravnsgaard Riis
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "xh_statbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/frame.h"
|
||||||
|
#include "wx/string.h"
|
||||||
|
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
|
||||||
|
#include "wx/xrc/xh_statbar.h"
|
||||||
|
#include "wx/statusbr.h"
|
||||||
|
|
||||||
|
wxStatusBarXmlHandler::wxStatusBarXmlHandler() :
|
||||||
|
wxXmlResourceHandler()
|
||||||
|
{
|
||||||
|
XRC_ADD_STYLE(wxST_SIZEGRIP);
|
||||||
|
AddWindowStyles();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxObject *wxStatusBarXmlHandler::DoCreateResource()
|
||||||
|
{
|
||||||
|
XRC_MAKE_INSTANCE(statbar, wxStatusBar)
|
||||||
|
|
||||||
|
statbar->Create(m_parentAsWindow,
|
||||||
|
GetID(),
|
||||||
|
GetStyle(),
|
||||||
|
GetName());
|
||||||
|
|
||||||
|
int fields = GetLong(wxT("fields"), 1);
|
||||||
|
wxString widths = GetParamValue(wxT("widths"));
|
||||||
|
|
||||||
|
if(fields > 1)
|
||||||
|
{
|
||||||
|
int *width = new int[fields];
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < fields; ++i)
|
||||||
|
{
|
||||||
|
width[i] = wxAtoi(widths.BeforeFirst(wxT(',')));
|
||||||
|
if(widths.Find(wxT(',')))
|
||||||
|
widths.Remove(0, widths.Find(wxT(',')) + 1);
|
||||||
|
}
|
||||||
|
statbar->SetFieldsCount(fields, width);
|
||||||
|
delete[] width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_parentAsWindow)
|
||||||
|
{
|
||||||
|
wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame);
|
||||||
|
if (parentFrame)
|
||||||
|
parentFrame->SetStatusBar(statbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
return statbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxStatusBarXmlHandler::CanHandle(wxXmlNode *node)
|
||||||
|
{
|
||||||
|
return IsOfClass(node, wxT("wxStatusBar"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@@ -99,4 +99,7 @@ void wxXmlResource::InitAllHandlers()
|
|||||||
#if wxUSE_WIZARDDLG
|
#if wxUSE_WIZARDDLG
|
||||||
AddHandler(new wxWizardXmlHandler);
|
AddHandler(new wxWizardXmlHandler);
|
||||||
#endif
|
#endif
|
||||||
|
#if wxUSE_STATUSBAR
|
||||||
|
AddHandler(new wxStatusBarXmlHandler);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user