Add support for id ranges to XRC.

Allow to declare ranges of consecutive IDs in XRC by using the "id[n]" syntax.
Show this functionality in the xrc sample and test it in the new unit test.

Also show and test the "object reference" XRC functionality.

Closes #11431.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-11-07 14:00:59 +00:00
parent 1f6ea93556
commit 0526c8cc07
37 changed files with 1671 additions and 23 deletions

64
samples/xrc/objrefdlg.h Normal file
View File

@@ -0,0 +1,64 @@
//-----------------------------------------------------------------------------
// Name: objref.h
// Purpose: XML resources sample: Object references and ID ranges dialog
// Author: David Hart, Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Begin single inclusion of this .h file condition
//-----------------------------------------------------------------------------
#ifndef _OBJREFDLG_H_
#define _OBJREFDLG_H_
//-----------------------------------------------------------------------------
// Headers
//-----------------------------------------------------------------------------
#include "wx/dialog.h"
#include "wx/notebook.h"
//-----------------------------------------------------------------------------
// Class definition: ObjrefDialog
//-----------------------------------------------------------------------------
class ObjrefDialog : public wxDialog
{
public:
// Constructor.
ObjrefDialog( wxWindow* parent );
// Destructor.
~ObjrefDialog();
private:
enum PageNumbers { first_page, copy_page, icons_page, calc_page };
enum CalcOperator { operator_plus, operator_minus, operator_multiply, operator_divide, operator_equals };
void OnNotebookPageChanged( wxNotebookEvent &event );
void OnUpdateUIFirst(wxUpdateUIEvent& event);
void OnUpdateUISecond(wxUpdateUIEvent& event);
void OnUpdateUIThird(wxUpdateUIEvent& event);
void OnNumeralClick(wxCommandEvent& event);
void OnOperatorClick(wxCommandEvent& event);
void Calculate();
void ClearCalculator();
wxNotebook *nb;
wxTextCtrl *text;
wxTextCtrl *result_txt;
bool iconspage_bound;
bool calcpage_bound;
int current;
int previous;
bool operator_expected;
CalcOperator curr_operator;
};
#endif //_OBJREFDLG_H_