Add new wxBookCtrlXmlHandlerBase and inherit the XRC handlers of all the wxBookCtrlBase-derived classes except for wxTreebookXmlHandler, which will require special handling, from it to avoid duplicating the same code in all of them. This commit is best viewed with --color-moved git option.
62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: wx/xrc/xh_bookctrlbase.h
|
|
// Purpose: Base class for wxBookCtrl-derived classes XRC handlers
|
|
// Author: Vadim Zeitlin
|
|
// Created: 2022-02-23
|
|
// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _WX_XRC_XH_BOOKCTRLBASE_H_
|
|
#define _WX_XRC_XH_BOOKCTRLBASE_H_
|
|
|
|
#include "wx/xrc/xmlres.h"
|
|
|
|
#if wxUSE_XRC && wxUSE_BOOKCTRL
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase;
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxBookCtrlXmlHandlerBase: base class of handlers for wxBookCtrl subclasses
|
|
// ----------------------------------------------------------------------------
|
|
|
|
class WXDLLIMPEXP_XRC wxBookCtrlXmlHandlerBase : public wxXmlResourceHandler
|
|
{
|
|
protected:
|
|
wxBookCtrlXmlHandlerBase();
|
|
virtual ~wxBookCtrlXmlHandlerBase();
|
|
|
|
// Create all pages under the current node and add them to the book control.
|
|
//
|
|
// This should be called instead of calling CreateChildren() directly by
|
|
// the derived class to deal with the contents of the book control node.
|
|
void DoCreatePages(wxBookCtrlBase* book);
|
|
|
|
// Create a new page using the contents of the current node.
|
|
//
|
|
// This should be called to handle the book control page node.
|
|
wxObject* DoCreatePage(wxBookCtrlBase* book);
|
|
|
|
// Return true if we're parsing the book control node itself.
|
|
bool IsInside() const { return m_isInside; }
|
|
|
|
private:
|
|
// This struct contains the actual page, created by DoCreatePage(), and all
|
|
// its attributes read from wxXmlNode.
|
|
struct PageWithAttrs;
|
|
|
|
// And this vector contains all the pages created so far.
|
|
wxVector<PageWithAttrs> m_bookPages;
|
|
|
|
// All bitmaps defined for the pages, may be empty.
|
|
wxVector<wxBitmapBundle> m_bookImages;
|
|
|
|
// True if we're used for parsing the contents of the book control node.
|
|
bool m_isInside;
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxBookCtrlXmlHandlerBase);
|
|
};
|
|
|
|
#endif // wxUSE_XRC && wxUSE_BOOKCTRL
|
|
|
|
#endif // _WX_XRC_XH_BOOKCTRLBASE_H_
|