wxWidgets/samples/xrc/rc/objref.xrc
Vadim Zeitlin 50c16da687 Remove invalid "option" elements from XRC sample file
<option> can't be used for wxFlexGridSizer items, remove all these tags to
allow the file to validate against the XRC schema.
2016-07-06 18:48:35 +02:00

411 lines
20 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
<object class="wxDialog" name="objref_dialog">
<object class="wxFlexGridSizer">
<object class="sizeritem">
<object class="wxNotebook" name="objref_notebook">
<object class="notebookpage">
<object class="wxPanel" name="page1">
<object class="wxFlexGridSizer">
<object class="sizeritem">
<object class="wxTextCtrl" name="description_text">
<value>This dialog demonstrates the use of object references and ID arrays.\n\nAs you turn the pages of the notebook, you will notice that each has an identical section at the bottom. Instead of writing that section's xml several times, this is done just once, as a wxPanel named 'bottom__panel'. The panel is then added to each page's sizer by the single line: &lt;object__ref ref=&quot;bottom__panel&quot;/&gt;</value>
<style>wxTE_MULTILINE|wxTE_READONLY</style>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object_ref ref="bottom_panel"/>
<flag>wxEXPAND</flag>
</object>
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>10</hgap>
<growablecols>0</growablecols>
<growablerows>1</growablerows>
</object>
</object>
<label>Page 1</label>
</object>
<object class="notebookpage">
<object_ref ref="page1"/>
<label>Page 1 copy</label>
</object>
<object class="notebookpage">
<object class="wxPanel" name="page2">
<object class="wxFlexGridSizer">
<object class="sizeritem">
<object class="wxTextCtrl" name="description_text">
<value>ID ranges are a way to simplify the management of several similar controls, especially their event-handling.\nAn ID range is declared by putting something like this into the XRC file:\n &lt;ids-range name=&quot;check&quot; size=&quot;3&quot; start=&quot;10000&quot; /&gt;\n'size' and 'start' being optional.\n\nIf you then give an item the name 'check[2]', it will be allocated that ID in the range.\n\nBy default the IDs in a range are negative, being assigned by wxWindow::NewControlId. If you wish, you can specify the start of the range; if so, the IDs *must* be positive (and it's your responsibility to avoid clashes, so start above wxID__HIGHEST).</value>
<style>wxTE_MULTILINE|wxTE_READONLY</style>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="spacer">
<option>1</option>
<flag>wxLEFT</flag>
<border>100</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxStaticText">
<label>Uncheck to disable a row</label>
</object>
</object>
<object class="sizeritem">
<object_ref ref="checkboxes"/>
<flag>wxALIGN_CENTRE</flag>
</object>
<orient>wxVERTICAL</orient>
</object>
<flag>wxALIGN_CENTRE_VERTICAL</flag>
</object>
<orient>wxHORIZONTAL</orient>
<object class="spacer">
<size>50,-1</size>
</object>
<object class="sizeritem">
<object class="wxStaticBoxSizer">
<object class="sizeritem">
<object class="wxGridSizer">
<object class="sizeritem">
<object class="wxStaticBitmap" name="first_row[0]">
<bitmap>update.gif</bitmap>
<tooltip>See the tooltip!</tooltip>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="first_row[1]">
<bitmap>basicdlg.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="first_row[2]">
<bitmap>controls.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="second_row[0]">
<bitmap>custclas.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="second_row[1]">
<bitmap>derivdlg.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="second_row[2]">
<bitmap>platform.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="third_row[0]">
<bitmap>objrefdlg.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="third_row[1]">
<bitmap>uncenter.xpm</bitmap>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticBitmap" name="third_row[2]">
<bitmap>variable.xpm</bitmap>
</object>
</object>
<rows>3</rows>
<vgap>7</vgap>
<hgap>7</hgap>
</object>
<flag>wxALL</flag>
<border>3</border>
</object>
<label>Icons</label>
<orient>wxVERTICAL</orient>
</object>
<flag>wxALIGN_CENTRE_VERTICAL</flag>
</object>
<object class="spacer">
<option>1</option>
<flag>wxLEFT</flag>
<border>100</border>
</object>
</object>
<flag>wxTOP|wxBOTTOM|wxEXPAND</flag>
<border>15</border>
</object>
<object class="sizeritem">
<object_ref ref="bottom_panel"/>
<flag>wxEXPAND</flag>
</object>
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>10</hgap>
<growablecols>0</growablecols>
<growablerows>2</growablerows>
</object>
</object>
<label>Icons</label>
</object>
<object class="notebookpage">
<object class="wxPanel" name="page3">
<object class="wxFlexGridSizer">
<object class="sizeritem">
<object class="wxTextCtrl" name="description_text">
<value>This not very useful calculator demonstrates some features of ID ranges. One range is defined for the number keys, and another for the operators.\n\nIf you look at the .xrc file, you'll see that I wrote:\n &lt;ids-range name=&quot;digits&quot; size=&quot;8&quot;/&gt;\ncreating that range with a size of 8 (I must have forgotten to count my thumbs). The code will still work, though: the actual number of range items is counted when the file is loaded, and the range extended if necessary to accommodate them. However if the size is too big, it isn't truncated.\n\nAn ID range always has the special items defined: &lt;rangename&gt;[start] and &lt;rangename&gt;[end]. So, for the range 'digits', digits[start] == digits[0], and digits[end] == digits[9]. [end] will always refer to the end of the range, even if there's no object with that ID.\n\nThe digits of the calculator are named 'digits[0]' to 'digits[9]'. Adjacent range items are guaranteed to be assigned consecutive IDs, so code such as this will work as expected:\n for (int n=XRCID(&quot;digits[start]&quot;); n &lt; XRCID(&quot;digits[end]&quot;); ++n) { DoFoo(n); }\nor\n int index = event.GetId() - XRCID(&quot;digits[0]&quot;);</value>
<style>wxTE_MULTILINE|wxTE_READONLY</style>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticBoxSizer">
<object class="sizeritem">
<object class="wxGridBagSizer">
<object class="sizeritem">
<object class="wxButton" name="digits[7]">
<label>7</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>0,0</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[8]">
<label>8</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>0,1</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[9]">
<label>9</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>0,2</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="operators[3]">
<label>/</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>0,3</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[4]">
<label>4</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>1,0</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[5]">
<label>5</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>1,1</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[6]">
<label>6</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>1,2</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="operators[2]">
<label>X</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>1,3</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[1]">
<label>1</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>2,0</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[2]">
<label>2</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>2,1</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[3]">
<label>3</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>2,2</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="operators[1]">
<label>-</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>2,3</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="digits[0]">
<label>0</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>3,0</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="operators[4]">
<label>=</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>3,1</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="operators[end]">
<label>Cl</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>3,2</cellpos>
</object>
<object class="sizeritem">
<object class="wxButton" name="operators[0]">
<label>+</label>
<style>wxBU_EXACTFIT</style>
</object>
<flag>wxEXPAND</flag>
<cellpos>3,3</cellpos>
</object>
<object class="sizeritem">
<object class="wxTextCtrl" name="result"/>
<flag>wxEXPAND</flag>
<cellpos>4,0</cellpos>
<cellspan>1,4</cellspan>
</object>
<vgap>5</vgap>
<hgap>5</hgap>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<label>Calculator</label>
<orient>wxVERTICAL</orient>
</object>
<flag>wxTOP|wxALIGN_CENTRE_HORIZONTAL</flag>
<border>10</border>
</object>
<object class="sizeritem">
<object_ref ref="bottom_panel"/>
<flag>wxEXPAND</flag>
</object>
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>10</hgap>
<growablecols>0</growablecols>
<growablerows>2</growablerows>
</object>
</object>
<label>Calc</label>
</object>
</object>
<flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxButton" name="wxID_OK">
<label>OK</label>
<default>1</default>
</object>
<flag>wxTOP|wxBOTTOM|wxALIGN_CENTRE</flag>
<border>20</border>
</object>
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0</growablecols>
<growablerows>0</growablerows>
</object>
<title>Object References and ID Ranges Example</title>
<centered>1</centered>
<style>wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER</style>
<exstyle>wxDIALOG_EX_CONTEXTHELP</exstyle>
</object>
<object class="wxPanel" name="bottom_panel">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxStaticLine">
<style>wxLI_HORIZONTAL</style>
</object>
<flag>wxTOP|wxEXPAND</flag>
<border>20</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Log window:</label>
</object>
<flag>wxTOP</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxTextCtrl" name="log_text">
<size>-1,100</size>
<style>wxTE_MULTILINE</style>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
</object>
</object>
<object class="wxPanel" name="checkboxes">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxCheckBox" name="check[0]">
<checked>1</checked>
</object>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="check[1]">
<checked>1</checked>
</object>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="check[2]">
<checked>1</checked>
</object>
</object>
</object>
</object>
<ids-range name="check" size="3" start="10000"/>
<ids-range name="first_row"/>
<ids-range name="second_row"/>
<ids-range name="third_row"/>
<ids-range name="digits" size="8"/>
<ids-range name="operators"/>
</resource>