add support for loading wxListCtrl items and wxImageLists from XRC (closes #10647)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60548 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -333,6 +333,7 @@ All:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
All (GUI):
 | 
					All (GUI):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Support loading wxListCtrl items and image lists from XRC (Kinaou Herv<72>).
 | 
				
			||||||
- wxGrid: add possibility to prevent resizing of individual rows/columns.
 | 
					- wxGrid: add possibility to prevent resizing of individual rows/columns.
 | 
				
			||||||
- wxHTML: add support for table borders width (Laurent Humbertclaude).
 | 
					- wxHTML: add support for table borders width (Laurent Humbertclaude).
 | 
				
			||||||
- Added wxMouseEventsManager.
 | 
					- Added wxMouseEventsManager.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -384,6 +384,7 @@ This is the XML file (resource.xrc) for the XRC sample.
 | 
				
			|||||||
              </object>
 | 
					              </object>
 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
            <label>Page</label>
 | 
					            <label>Page</label>
 | 
				
			||||||
 | 
					            <image>0</image>
 | 
				
			||||||
          </object>
 | 
					          </object>
 | 
				
			||||||
          <object class="notebookpage">
 | 
					          <object class="notebookpage">
 | 
				
			||||||
            <object class="wxPanel">
 | 
					            <object class="wxPanel">
 | 
				
			||||||
@@ -397,8 +398,14 @@ This is the XML file (resource.xrc) for the XRC sample.
 | 
				
			|||||||
              </object>
 | 
					              </object>
 | 
				
			||||||
            </object>
 | 
					            </object>
 | 
				
			||||||
            <label>Page 2</label>
 | 
					            <label>Page 2</label>
 | 
				
			||||||
 | 
					            <image>1</image>
 | 
				
			||||||
          </object>
 | 
					          </object>
 | 
				
			||||||
          <usenotebooksizer>1</usenotebooksizer>
 | 
					          <usenotebooksizer>1</usenotebooksizer>
 | 
				
			||||||
 | 
					        <imagelist>
 | 
				
			||||||
 | 
					            <size>16,16</size>
 | 
				
			||||||
 | 
					            <bitmap stock_id="wxART_QUESTION"/>
 | 
				
			||||||
 | 
					            <bitmap stock_id="wxART_WARNING"/>
 | 
				
			||||||
 | 
					        </imagelist>
 | 
				
			||||||
        </object>
 | 
					        </object>
 | 
				
			||||||
        <flag>wxEXPAND</flag>
 | 
					        <flag>wxEXPAND</flag>
 | 
				
			||||||
      </object>
 | 
					      </object>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -660,11 +660,10 @@ Example:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxchoicebook wxChoicebook
 | 
					@subsubsection xrc_wxchoicebook wxChoicebook
 | 
				
			||||||
 | 
					
 | 
				
			||||||
No additional properties.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
A choicebook can have one or more child objects of the @c choicebookpage
 | 
					A choicebook can have one or more child objects of the @c choicebookpage
 | 
				
			||||||
pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
					pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
				
			||||||
@c notebookpage). @c choicebookpage objects have the following properties:
 | 
					@c notebookpage) and one child object of the @ref xrc_wximagelist class.
 | 
				
			||||||
 | 
					@c choicebookpage objects have the following properties:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@beginTable
 | 
					@beginTable
 | 
				
			||||||
@hdr3col{property, type, description}
 | 
					@hdr3col{property, type, description}
 | 
				
			||||||
@@ -672,6 +671,9 @@ pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
				
			|||||||
     Sheet page's title (required).}
 | 
					     Sheet page's title (required).}
 | 
				
			||||||
@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
					@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
     Bitmap shown alongside the label (default: none).}
 | 
					     Bitmap shown alongside the label (default: none).}
 | 
				
			||||||
 | 
					@row3col{image, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    into the image list.}
 | 
				
			||||||
@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
					@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
				
			||||||
     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
					     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
				
			||||||
@endTable
 | 
					@endTable
 | 
				
			||||||
@@ -868,6 +870,42 @@ page.
 | 
				
			|||||||
@endTable
 | 
					@endTable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@subsubsection xrc_wximagelist wxImageList
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The imagelist can be used as a child object for the following classes:
 | 
				
			||||||
 | 
					    - @ref xrc_wxchoicebook
 | 
				
			||||||
 | 
					    - @ref xrc_wxlistbook
 | 
				
			||||||
 | 
					    - @ref xrc_wxlistctrl
 | 
				
			||||||
 | 
					    - @ref xrc_wxnotebook
 | 
				
			||||||
 | 
					    - @ref xrc_wxtreebook
 | 
				
			||||||
 | 
					    - @ref xrc_wxtreectrl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The available properties are:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@beginTable
 | 
				
			||||||
 | 
					@hdr3col{property, type, description}
 | 
				
			||||||
 | 
					@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
 | 
					     Adds a new image by keeping its optional mask bitmap (see below).}
 | 
				
			||||||
 | 
					@row3col{mask, @ref overview_xrcformat_type_bool,
 | 
				
			||||||
 | 
					     If masks should be created for all images (default: true).}
 | 
				
			||||||
 | 
					@row3col{size, @ref overview_xrcformat_type_size,
 | 
				
			||||||
 | 
					     The size of the images in the list (default: system default icon size)).}
 | 
				
			||||||
 | 
					@endTable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Example:
 | 
				
			||||||
 | 
					@code
 | 
				
			||||||
 | 
					<imagelist>
 | 
				
			||||||
 | 
					    <size>32,32</size>
 | 
				
			||||||
 | 
					    <bitmap stock_id="wxART_QUESTION"/>
 | 
				
			||||||
 | 
					    <bitmap stock_id="wxART_INFORMATION"/>
 | 
				
			||||||
 | 
					</imagelist>
 | 
				
			||||||
 | 
					@endcode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In the specific case of the @ref xrc_wxlistctrl, the tag can take the name
 | 
				
			||||||
 | 
					@c \<imagelist-small\> to define the 'small' image list, related to the flag
 | 
				
			||||||
 | 
					@c wxIMAGE_LIST_SMALL (see wxListCtrl documentation).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxlistbox wxListBox
 | 
					@subsubsection xrc_wxlistbox wxListBox
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@beginTable
 | 
					@beginTable
 | 
				
			||||||
@@ -898,11 +936,10 @@ Example:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxlistbook wxListbook
 | 
					@subsubsection xrc_wxlistbook wxListbook
 | 
				
			||||||
 | 
					
 | 
				
			||||||
No additional properties.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
A listbook can have one or more child objects of the @c listbookpage
 | 
					A listbook can have one or more child objects of the @c listbookpage
 | 
				
			||||||
pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
					pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
				
			||||||
@c notebookpage). @c listbookpage objects have the following properties:
 | 
					@c notebookpage) and one child object of the @ref xrc_wximagelist class.
 | 
				
			||||||
 | 
					@c listbookpage objects have the following properties:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@beginTable
 | 
					@beginTable
 | 
				
			||||||
@hdr3col{property, type, description}
 | 
					@hdr3col{property, type, description}
 | 
				
			||||||
@@ -910,6 +947,9 @@ pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
				
			|||||||
     Sheet page's title (required).}
 | 
					     Sheet page's title (required).}
 | 
				
			||||||
@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
					@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
     Bitmap shown alongside the label (default: none).}
 | 
					     Bitmap shown alongside the label (default: none).}
 | 
				
			||||||
 | 
					@row3col{image, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    into the image list.}
 | 
				
			||||||
@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
					@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
				
			||||||
     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
					     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
				
			||||||
@endTable
 | 
					@endTable
 | 
				
			||||||
@@ -919,7 +959,79 @@ Each @c listbookpage has exactly one non-toplevel window as its child.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxlistctrl wxListCtrl
 | 
					@subsubsection xrc_wxlistctrl wxListCtrl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
No additional properties.
 | 
					A listctrl can have one or more child objects of the class @ref xrc_wxlistitem
 | 
				
			||||||
 | 
					and one or more objects of the @ref xrc_wximagelist class. The latter is
 | 
				
			||||||
 | 
					defined either using @c \<imagelist\> tag for the control with @c wxLC_ICON
 | 
				
			||||||
 | 
					style or using @c \<imagelist-small\> tag for the control with @c
 | 
				
			||||||
 | 
					wxLC_SMALL_ICON style.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@subsubsection xrc_wxlistitem wxListItem
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The @c listitem is a child object for the class @ref xrc_wxlistctrl.
 | 
				
			||||||
 | 
					It can have the following properties:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@beginTable
 | 
				
			||||||
 | 
					@hdr3col{property, type, description}
 | 
				
			||||||
 | 
					@row3col{align, wxListColumnFormat,
 | 
				
			||||||
 | 
					    The alignment for the item.
 | 
				
			||||||
 | 
					    Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or
 | 
				
			||||||
 | 
					    @c wxLIST_FORMAT_CENTRE.}
 | 
				
			||||||
 | 
					@row3col{bg, @ref overview_xrcformat_type_colour,
 | 
				
			||||||
 | 
					    The background color for the item.}
 | 
				
			||||||
 | 
					@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
 | 
					    Add a bitmap to the (normal) @ref xrc_wximagelist associated with the
 | 
				
			||||||
 | 
					    @ref xrc_wxlistctrl parent and associate it with this item.
 | 
				
			||||||
 | 
					    If the imagelist is not defined it will be created implicitly.}
 | 
				
			||||||
 | 
					@row3col{bitmap-small, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
 | 
					    Add a bitmap in the 'small' @ref xrc_wximagelist associated with the
 | 
				
			||||||
 | 
					    @ref xrc_wxlistctrl parent and associate it with this item.
 | 
				
			||||||
 | 
					    If the 'small' imagelist is not defined it will be created implicitly.}
 | 
				
			||||||
 | 
					@row3col{image, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    in the (normal) image list.}
 | 
				
			||||||
 | 
					@row3col{image-small, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    in the 'small' image list.}
 | 
				
			||||||
 | 
					@row3col{col, integer,
 | 
				
			||||||
 | 
					    The zero-based column index.}
 | 
				
			||||||
 | 
					@row3col{data, integer,
 | 
				
			||||||
 | 
					    The client data for the item.}
 | 
				
			||||||
 | 
					@row3col{font, @ref overview_xrcformat_type_font,
 | 
				
			||||||
 | 
					    The font for the item.}
 | 
				
			||||||
 | 
					@row3col{image, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    into the image list.}
 | 
				
			||||||
 | 
					@row3col{mask, @ref overview_xrcformat_type_style,
 | 
				
			||||||
 | 
					    The mask indicating which fields of this class are valid.
 | 
				
			||||||
 | 
					    Can be any combination of the following values:
 | 
				
			||||||
 | 
					        - wxLIST_MASK_STATE: @b GetState is valid.
 | 
				
			||||||
 | 
					        - wxLIST_MASK_TEXT: @b GetText is valid.
 | 
				
			||||||
 | 
					        - wxLIST_MASK_IMAGE: @b GetImage is valid.
 | 
				
			||||||
 | 
					        - wxLIST_MASK_DATA: @b GetData is valid.
 | 
				
			||||||
 | 
					        - wxLIST_MASK_WIDTH: @b GetWidth is valid.
 | 
				
			||||||
 | 
					        - wxLIST_MASK_FORMAT: @b GetFormat is valid. }
 | 
				
			||||||
 | 
					@row3col{state, @ref overview_xrcformat_type_style,
 | 
				
			||||||
 | 
					    The item state flags (note that the valid state flags are influenced
 | 
				
			||||||
 | 
					    by the value of the @c statemask, see below).
 | 
				
			||||||
 | 
					    Can be any combination of the following values:
 | 
				
			||||||
 | 
					        - @c wxLIST_STATE_FOCUSED: The item has the focus.
 | 
				
			||||||
 | 
					        - @c wxLIST_STATE_SELECTED: The item is selected.
 | 
				
			||||||
 | 
					        - @c wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
 | 
				
			||||||
 | 
					        - @c wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
 | 
				
			||||||
 | 
					        - @c wxLIST_STATE_CUT: The item is in the cut state. Win32 only. }
 | 
				
			||||||
 | 
					@row3col{statemask, bitlist,
 | 
				
			||||||
 | 
					    A mask indicating which state flags are valid. This is a bitlist of the
 | 
				
			||||||
 | 
					    flags reported above for the item state. }
 | 
				
			||||||
 | 
					@row3col{text, @ref overview_xrcformat_type_string,
 | 
				
			||||||
 | 
					    The text label (or header for columns) for the item. }
 | 
				
			||||||
 | 
					@row3col{textcolour, @ref overview_xrcformat_type_colour,
 | 
				
			||||||
 | 
					    The text colour for the item. }
 | 
				
			||||||
 | 
					@row3col{width, integer,
 | 
				
			||||||
 | 
					    The column width. }
 | 
				
			||||||
 | 
					@endTable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Notice that the item position can't be specified here, the items are appended
 | 
				
			||||||
 | 
					to the list control in order of their appearance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxmdiparentframe wxMDIParentFrame
 | 
					@subsubsection xrc_wxmdiparentframe wxMDIParentFrame
 | 
				
			||||||
@@ -1030,10 +1142,9 @@ class.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxnotebook wxNotebook
 | 
					@subsubsection xrc_wxnotebook wxNotebook
 | 
				
			||||||
 | 
					
 | 
				
			||||||
No additional properties.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
A notebook can have one or more child objects of the @c notebookpage
 | 
					A notebook can have one or more child objects of the @c notebookpage
 | 
				
			||||||
pseudo-class. @c notebookpage objects have the following properties:
 | 
					pseudo-class and one child object of the @ref xrc_wximagelist class.
 | 
				
			||||||
 | 
					@c notebookpage objects have the following properties:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@beginTable
 | 
					@beginTable
 | 
				
			||||||
@hdr3col{property, type, description}
 | 
					@hdr3col{property, type, description}
 | 
				
			||||||
@@ -1041,6 +1152,9 @@ pseudo-class. @c notebookpage objects have the following properties:
 | 
				
			|||||||
     Page's title (required).}
 | 
					     Page's title (required).}
 | 
				
			||||||
@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
					@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
     Bitmap shown alongside the label (default: none).}
 | 
					     Bitmap shown alongside the label (default: none).}
 | 
				
			||||||
 | 
					@row3col{image, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    into the image list.}
 | 
				
			||||||
@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
					@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
				
			||||||
     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
					     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
				
			||||||
@endTable
 | 
					@endTable
 | 
				
			||||||
@@ -1502,16 +1616,17 @@ Example:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxtreectrl wxTreeCtrl
 | 
					@subsubsection xrc_wxtreectrl wxTreeCtrl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A treectrl can have one child object of the @ref xrc_wximagelist class.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
No additional properties.
 | 
					No additional properties.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@subsubsection xrc_wxtreebook wxTreebook
 | 
					@subsubsection xrc_wxtreebook wxTreebook
 | 
				
			||||||
 | 
					
 | 
				
			||||||
No additional properties.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
A treebook can have one or more child objects of the @c treebookpage
 | 
					A treebook can have one or more child objects of the @c treebookpage
 | 
				
			||||||
pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
					pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
				
			||||||
@c notebookpage). @c treebookpage objects have the following properties:
 | 
					@c notebookpage) and one child object of the @ref xrc_wximagelist class.
 | 
				
			||||||
 | 
					@c treebookpage objects have the following properties:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@beginTable
 | 
					@beginTable
 | 
				
			||||||
@hdr3col{property, type, description}
 | 
					@hdr3col{property, type, description}
 | 
				
			||||||
@@ -1521,6 +1636,9 @@ pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
 | 
				
			|||||||
     Sheet page's title (required).}
 | 
					     Sheet page's title (required).}
 | 
				
			||||||
@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
					@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
 | 
				
			||||||
     Bitmap shown alongside the label (default: none).}
 | 
					     Bitmap shown alongside the label (default: none).}
 | 
				
			||||||
 | 
					@row3col{image, integer,
 | 
				
			||||||
 | 
					    The zero-based index of the image associated with the item
 | 
				
			||||||
 | 
					    into the image list.}
 | 
				
			||||||
@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
					@row3col{selected, @ref overview_xrcformat_type_bool,
 | 
				
			||||||
     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
					     Is the page selected initially (only one page can be selected; default: 0)?}
 | 
				
			||||||
@endTable
 | 
					@endTable
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,14 +15,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#if wxUSE_XRC && wxUSE_LISTCTRL
 | 
					#if wxUSE_XRC && wxUSE_LISTCTRL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WXDLLIMPEXP_FWD_CORE wxListCtrl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WXDLLIMPEXP_XRC wxListCtrlXmlHandler : public wxXmlResourceHandler
 | 
					class WXDLLIMPEXP_XRC wxListCtrlXmlHandler : public wxXmlResourceHandler
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DECLARE_DYNAMIC_CLASS(wxListCtrlXmlHandler)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    wxListCtrlXmlHandler();
 | 
					    wxListCtrlXmlHandler();
 | 
				
			||||||
    virtual wxObject *DoCreateResource();
 | 
					    virtual wxObject *DoCreateResource();
 | 
				
			||||||
    virtual bool CanHandle(wxXmlNode *node);
 | 
					    virtual bool CanHandle(wxXmlNode *node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    long Handle_wxListItem();
 | 
				
			||||||
 | 
					    wxObject* Handle_wxListCtrl();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // gets the items image index in the corresponding image list (normal if
 | 
				
			||||||
 | 
					    // which is wxIMAGE_LIST_NORMAL or small if it is wxIMAGE_LIST_SMALL)
 | 
				
			||||||
 | 
					    long GetImageIndex(wxListCtrl *listctrl, int which);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DECLARE_DYNAMIC_CLASS(wxListCtrlXmlHandler)
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // wxUSE_XRC && wxUSE_LISTCTRL
 | 
					#endif // wxUSE_XRC && wxUSE_LISTCTRL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,7 @@
 | 
				
			|||||||
class WXDLLIMPEXP_FWD_BASE wxFileName;
 | 
					class WXDLLIMPEXP_FWD_BASE wxFileName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
 | 
					class WXDLLIMPEXP_FWD_CORE wxIconBundle;
 | 
				
			||||||
 | 
					class WXDLLIMPEXP_FWD_CORE wxImageList;
 | 
				
			||||||
class WXDLLIMPEXP_FWD_CORE wxMenu;
 | 
					class WXDLLIMPEXP_FWD_CORE wxMenu;
 | 
				
			||||||
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
 | 
					class WXDLLIMPEXP_FWD_CORE wxMenuBar;
 | 
				
			||||||
class WXDLLIMPEXP_FWD_CORE wxDialog;
 | 
					class WXDLLIMPEXP_FWD_CORE wxDialog;
 | 
				
			||||||
@@ -442,7 +443,7 @@ protected:
 | 
				
			|||||||
    // wxXML_ENTITY_NODE name="tag", content=""
 | 
					    // wxXML_ENTITY_NODE name="tag", content=""
 | 
				
			||||||
    //    |-- wxXML_TEXT_NODE or
 | 
					    //    |-- wxXML_TEXT_NODE or
 | 
				
			||||||
    //        wxXML_CDATA_SECTION_NODE name="" content="content"
 | 
					    //        wxXML_CDATA_SECTION_NODE name="" content="content"
 | 
				
			||||||
    wxString GetNodeContent(wxXmlNode *node);
 | 
					    wxString GetNodeContent(const wxXmlNode *node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check to see if a parameter exists.
 | 
					    // Check to see if a parameter exists.
 | 
				
			||||||
    bool HasParam(const wxString& param);
 | 
					    bool HasParam(const wxString& param);
 | 
				
			||||||
@@ -453,6 +454,9 @@ protected:
 | 
				
			|||||||
    // Finds the parameter value or returns the empty string.
 | 
					    // Finds the parameter value or returns the empty string.
 | 
				
			||||||
    wxString GetParamValue(const wxString& param);
 | 
					    wxString GetParamValue(const wxString& param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Returns the parameter value from given node.
 | 
				
			||||||
 | 
					    wxString GetParamValue(const wxXmlNode* node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags
 | 
					    // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags
 | 
				
			||||||
    // understood by this handler.
 | 
					    // understood by this handler.
 | 
				
			||||||
    void AddStyle(const wxString& name, int value);
 | 
					    void AddStyle(const wxString& name, int value);
 | 
				
			||||||
@@ -504,15 +508,28 @@ protected:
 | 
				
			|||||||
                       const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
					                       const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
                       wxSize size = wxDefaultSize);
 | 
					                       wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Gets a bitmap from an XmlNode.
 | 
				
			||||||
 | 
					    wxBitmap GetBitmap(const wxXmlNode* node,
 | 
				
			||||||
 | 
					                       const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
 | 
					                       wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Gets an icon.
 | 
					    // Gets an icon.
 | 
				
			||||||
    wxIcon GetIcon(const wxString& param = wxT("icon"),
 | 
					    wxIcon GetIcon(const wxString& param = wxT("icon"),
 | 
				
			||||||
                   const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
					                   const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
                   wxSize size = wxDefaultSize);
 | 
					                   wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Gets an icon from an XmlNode.
 | 
				
			||||||
 | 
					    wxIcon GetIcon(const wxXmlNode* node,
 | 
				
			||||||
 | 
					                   const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
 | 
					                   wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Gets an icon bundle.
 | 
					    // Gets an icon bundle.
 | 
				
			||||||
    wxIconBundle GetIconBundle(const wxString& param,
 | 
					    wxIconBundle GetIconBundle(const wxString& param,
 | 
				
			||||||
                               const wxArtClient& defaultArtClient = wxART_OTHER);
 | 
					                               const wxArtClient& defaultArtClient = wxART_OTHER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Gets an image list.
 | 
				
			||||||
 | 
					    wxImageList *GetImageList(const wxString& param = wxT("imagelist"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if wxUSE_ANIMATIONCTRL
 | 
					#if wxUSE_ANIMATIONCTRL
 | 
				
			||||||
    // Gets an animation.
 | 
					    // Gets an animation.
 | 
				
			||||||
    wxAnimation GetAnimation(const wxString& param = wxT("animation"));
 | 
					    wxAnimation GetAnimation(const wxString& param = wxT("animation"));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -492,6 +492,14 @@ protected:
 | 
				
			|||||||
    wxBitmap GetBitmap(const wxString& param = "bitmap",
 | 
					    wxBitmap GetBitmap(const wxString& param = "bitmap",
 | 
				
			||||||
                       const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
					                       const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
                       wxSize size = wxDefaultSize);
 | 
					                       wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					        Gets a bitmap from an XmlNode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @since 2.9.1
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    wxBitmap GetBitmap(const wxXmlNode* node,
 | 
				
			||||||
 | 
					                       const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
 | 
					                       wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
        Gets a bool flag (1, t, yes, on, true are @true, everything else is @false).
 | 
					        Gets a bool flag (1, t, yes, on, true are @true, everything else is @false).
 | 
				
			||||||
@@ -532,6 +540,15 @@ protected:
 | 
				
			|||||||
                   const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
					                   const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
                   wxSize size = wxDefaultSize);
 | 
					                   wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					        Gets an icon from an XmlNode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @since 2.9.1
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    wxIcon GetIcon(const wxXmlNode* node,
 | 
				
			||||||
 | 
					                   const wxArtClient& defaultArtClient = wxART_OTHER,
 | 
				
			||||||
 | 
					                   wxSize size = wxDefaultSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
        Returns an icon bundle.
 | 
					        Returns an icon bundle.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -545,6 +562,16 @@ protected:
 | 
				
			|||||||
    wxIconBundle GetIconBundle(const wxString& param,
 | 
					    wxIconBundle GetIconBundle(const wxString& param,
 | 
				
			||||||
                               const wxArtClient& defaultArtClient = wxART_OTHER);
 | 
					                               const wxArtClient& defaultArtClient = wxART_OTHER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					        Creates an image list from the @a param markup data.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @return
 | 
				
			||||||
 | 
					            The new instance of wxImageList or @NULL if no data is found.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @since 2.9.1
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    wxImageList *GetImageList(const wxString& param = wxT("imagelist"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
        Gets the integer value from the parameter.
 | 
					        Gets the integer value from the parameter.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
@@ -570,6 +597,13 @@ protected:
 | 
				
			|||||||
    */
 | 
					    */
 | 
				
			||||||
    wxString GetParamValue(const wxString& param);
 | 
					    wxString GetParamValue(const wxString& param);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					        Returns the node parameter value.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @since 2.9.1
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    wxString GetParamValue(const wxXmlNode* node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
        Gets the position (may be in dialog units).
 | 
					        Gets the position (may be in dialog units).
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -578,19 +578,51 @@
 | 
				
			|||||||
                <object class="notebookpage">
 | 
					                <object class="notebookpage">
 | 
				
			||||||
                    <label>wxListCtrl</label>
 | 
					                    <label>wxListCtrl</label>
 | 
				
			||||||
                    <object class="wxPanel" name="listctrl">
 | 
					                    <object class="wxPanel" name="listctrl">
 | 
				
			||||||
                        <object class="wxFlexGridSizer">
 | 
					                        <object class="wxBoxSizer">
 | 
				
			||||||
                            <cols>1</cols>
 | 
					 | 
				
			||||||
                            <rows>0</rows>
 | 
					 | 
				
			||||||
                            <vgap>0</vgap>
 | 
					 | 
				
			||||||
                            <hgap>0</hgap>
 | 
					 | 
				
			||||||
                            <growablecols>0</growablecols>
 | 
					 | 
				
			||||||
                            <growablerows>0</growablerows>
 | 
					 | 
				
			||||||
                            <object class="sizeritem">
 | 
					                            <object class="sizeritem">
 | 
				
			||||||
                                <flag>wxALIGN_CENTER|wxALL</flag>
 | 
					                                <flag>wxALIGN_CENTER|wxALL</flag>
 | 
				
			||||||
                                <border>5</border>
 | 
					                                <border>5</border>
 | 
				
			||||||
                                <object class="wxListCtrl" name="controls_listctrl">
 | 
					                                <object class="wxListCtrl" name="controls_listctrl">
 | 
				
			||||||
                                    <size>220,160</size>
 | 
					                                    <size>220,160</size>
 | 
				
			||||||
                                    <style>wxLC_REPORT|wxSUNKEN_BORDER</style>
 | 
					                                    <style>wxLC_REPORT</style>
 | 
				
			||||||
 | 
					                                    <!-- this control is filled in from the code -->
 | 
				
			||||||
 | 
					                                </object>
 | 
				
			||||||
 | 
					                            </object>
 | 
				
			||||||
 | 
					                            <object class="sizeritem">
 | 
				
			||||||
 | 
					                                <flag>wxALIGN_CENTER|wxALL</flag>
 | 
				
			||||||
 | 
					                                <border>5</border>
 | 
				
			||||||
 | 
					                                <object class="wxListCtrl" name="controls_listctrl2">
 | 
				
			||||||
 | 
					                                    <size>220,160</size>
 | 
				
			||||||
 | 
					                                    <style>wxLC_ICON</style>
 | 
				
			||||||
 | 
					                                    <object class="listitem">
 | 
				
			||||||
 | 
					                                        <text>Information</text>
 | 
				
			||||||
 | 
					                                        <bitmap stock_id="wxART_INFORMATION"/>
 | 
				
			||||||
 | 
					                                    </object>
 | 
				
			||||||
 | 
					                                    <object class="listitem">
 | 
				
			||||||
 | 
					                                        <text>Question?</text>
 | 
				
			||||||
 | 
					                                        <bitmap stock_id="wxART_QUESTION"/>
 | 
				
			||||||
 | 
					                                    </object>
 | 
				
			||||||
 | 
					                                </object>
 | 
				
			||||||
 | 
					                            </object>
 | 
				
			||||||
 | 
					                            <object class="sizeritem">
 | 
				
			||||||
 | 
					                                <flag>wxALIGN_CENTER|wxALL</flag>
 | 
				
			||||||
 | 
					                                <border>5</border>
 | 
				
			||||||
 | 
					                                <object class="wxListCtrl" name="controls_listctrl3">
 | 
				
			||||||
 | 
					                                    <size>220,160</size>
 | 
				
			||||||
 | 
					                                    <style>wxLC_SMALL_ICON</style>
 | 
				
			||||||
 | 
					                                    <imagelist-small>
 | 
				
			||||||
 | 
					                                        <size>20,20</size>
 | 
				
			||||||
 | 
					                                        <bitmap stock_id="wxART_INFORMATION"/>
 | 
				
			||||||
 | 
					                                        <bitmap stock_id="wxART_QUESTION"/>
 | 
				
			||||||
 | 
					                                    </imagelist-small>
 | 
				
			||||||
 | 
					                                    <object class="listitem">
 | 
				
			||||||
 | 
					                                        <text>Information</text>
 | 
				
			||||||
 | 
					                                        <image-small>0</image-small>
 | 
				
			||||||
 | 
					                                    </object>
 | 
				
			||||||
 | 
					                                    <object class="listitem">
 | 
				
			||||||
 | 
					                                        <text>Question?</text>
 | 
				
			||||||
 | 
					                                        <image-small>1</image-small>
 | 
				
			||||||
 | 
					                                    </object>
 | 
				
			||||||
                                </object>
 | 
					                                </object>
 | 
				
			||||||
                            </object>
 | 
					                            </object>
 | 
				
			||||||
                        </object>
 | 
					                        </object>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,6 +84,19 @@ wxObject *wxChoicebookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                    int imgIndex = imgList->Add(bmp);
 | 
					                    int imgIndex = imgList->Add(bmp);
 | 
				
			||||||
                    m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, imgIndex );
 | 
					                    m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, imgIndex );
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                else if ( HasParam(wxT("image")) )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if ( m_choicebook->GetImageList() )
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1,
 | 
				
			||||||
 | 
					                                                   GetLong(wxT("image")) );
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else // image without image list?
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        ReportError(n, "image can only be used in conjunction "
 | 
				
			||||||
 | 
					                                       "with imagelist");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -108,6 +121,10 @@ wxObject *wxChoicebookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                   GetStyle(wxT("style")),
 | 
					                   GetStyle(wxT("style")),
 | 
				
			||||||
                   GetName());
 | 
					                   GetName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        wxImageList *imagelist = GetImageList();
 | 
				
			||||||
 | 
					        if ( imagelist )
 | 
				
			||||||
 | 
					            nb->AssignImageList(imagelist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wxChoicebook *old_par = m_choicebook;
 | 
					        wxChoicebook *old_par = m_choicebook;
 | 
				
			||||||
        m_choicebook = nb;
 | 
					        m_choicebook = nb;
 | 
				
			||||||
        bool old_ins = m_isInside;
 | 
					        bool old_ins = m_isInside;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,6 +84,19 @@ wxObject *wxListbookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                    int imgIndex = imgList->Add(bmp);
 | 
					                    int imgIndex = imgList->Add(bmp);
 | 
				
			||||||
                    m_listbook->SetPageImage(m_listbook->GetPageCount()-1, imgIndex );
 | 
					                    m_listbook->SetPageImage(m_listbook->GetPageCount()-1, imgIndex );
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                else if ( HasParam(wxT("image")) )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if ( m_listbook->GetImageList() )
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        m_listbook->SetPageImage(m_listbook->GetPageCount()-1,
 | 
				
			||||||
 | 
					                                                 GetLong(wxT("image")) );
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else // image without image list?
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        ReportError(n, "image can only be used in conjunction "
 | 
				
			||||||
 | 
					                                       "with imagelist");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -108,6 +121,10 @@ wxObject *wxListbookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                   GetStyle(wxT("style")),
 | 
					                   GetStyle(wxT("style")),
 | 
				
			||||||
                   GetName());
 | 
					                   GetName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        wxImageList *imagelist = GetImageList();
 | 
				
			||||||
 | 
					        if ( imagelist )
 | 
				
			||||||
 | 
					            nb->AssignImageList(imagelist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wxListbook *old_par = m_listbook;
 | 
					        wxListbook *old_par = m_listbook;
 | 
				
			||||||
        m_listbook = nb;
 | 
					        m_listbook = nb;
 | 
				
			||||||
        bool old_ins = m_isInside;
 | 
					        bool old_ins = m_isInside;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "wx/listctrl.h"
 | 
					#include "wx/listctrl.h"
 | 
				
			||||||
 | 
					#include "wx/imaglist.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
IMPLEMENT_DYNAMIC_CLASS(wxListCtrlXmlHandler, wxXmlResourceHandler)
 | 
					IMPLEMENT_DYNAMIC_CLASS(wxListCtrlXmlHandler, wxXmlResourceHandler)
 | 
				
			||||||
@@ -31,6 +32,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxListCtrlXmlHandler, wxXmlResourceHandler)
 | 
				
			|||||||
wxListCtrlXmlHandler::wxListCtrlXmlHandler()
 | 
					wxListCtrlXmlHandler::wxListCtrlXmlHandler()
 | 
				
			||||||
: wxXmlResourceHandler()
 | 
					: wxXmlResourceHandler()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    // wxListItem styles
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_FORMAT_LEFT);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_FORMAT_RIGHT);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_FORMAT_CENTRE);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_MASK_STATE);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_MASK_TEXT);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_MASK_IMAGE);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_MASK_DATA);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_MASK_WIDTH);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_MASK_FORMAT);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_STATE_DONTCARE);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_STATE_DROPHILITED);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_STATE_FOCUSED);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_STATE_SELECTED);
 | 
				
			||||||
 | 
					    XRC_ADD_STYLE(wxLIST_STATE_CUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // wxListCtrl styles
 | 
				
			||||||
    XRC_ADD_STYLE(wxLC_LIST);
 | 
					    XRC_ADD_STYLE(wxLC_LIST);
 | 
				
			||||||
    XRC_ADD_STYLE(wxLC_REPORT);
 | 
					    XRC_ADD_STYLE(wxLC_REPORT);
 | 
				
			||||||
    XRC_ADD_STYLE(wxLC_ICON);
 | 
					    XRC_ADD_STYLE(wxLC_ICON);
 | 
				
			||||||
@@ -52,6 +70,73 @@ wxListCtrlXmlHandler::wxListCtrlXmlHandler()
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxObject *wxListCtrlXmlHandler::DoCreateResource()
 | 
					wxObject *wxListCtrlXmlHandler::DoCreateResource()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (m_class == wxT("listitem"))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Handle_wxListItem();
 | 
				
			||||||
 | 
					        return m_parentAsWindow;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        return Handle_wxListCtrl();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return IsOfClass(node, wxT("wxListCtrl")) ||
 | 
				
			||||||
 | 
					            IsOfClass(node, wxT("listitem"));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					long wxListCtrlXmlHandler::Handle_wxListItem()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl);
 | 
				
			||||||
 | 
					    wxCHECK_MSG( list, -1, "must have wxListCtrl parent" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wxListItem item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (HasParam(wxT("align")))
 | 
				
			||||||
 | 
					        item.SetAlign((wxListColumnFormat)GetStyle(wxT("align")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("bg")))
 | 
				
			||||||
 | 
					        item.SetBackgroundColour(GetColour(wxT("bg")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("col")))
 | 
				
			||||||
 | 
					        item.SetColumn((int)GetLong(wxT("col")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("data")))
 | 
				
			||||||
 | 
					        item.SetData(GetLong(wxT("data")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("font")))
 | 
				
			||||||
 | 
					        item.SetFont(GetFont());
 | 
				
			||||||
 | 
					    if (HasParam(wxT("mask")))
 | 
				
			||||||
 | 
					        item.SetMask(GetStyle(wxT("mask")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("state")))
 | 
				
			||||||
 | 
					        item.SetState(GetStyle(wxT("state")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("statemask")))
 | 
				
			||||||
 | 
					        item.SetStateMask(GetStyle(wxT("statemask")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("text")))
 | 
				
			||||||
 | 
					        item.SetText(GetText(wxT("text")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("textcolour")))
 | 
				
			||||||
 | 
					        item.SetTextColour(GetColour(wxT("textcolour")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("textcolor")))
 | 
				
			||||||
 | 
					        item.SetTextColour(GetColour(wxT("textcolor")));
 | 
				
			||||||
 | 
					    if (HasParam(wxT("width")))
 | 
				
			||||||
 | 
					        item.SetWidth((int)GetLong(wxT("width")));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // the list control icon style, may be 0
 | 
				
			||||||
 | 
					    int image;
 | 
				
			||||||
 | 
					    if ( list->HasFlag(wxLC_ICON) )
 | 
				
			||||||
 | 
					        image = GetImageIndex(list, wxIMAGE_LIST_NORMAL);
 | 
				
			||||||
 | 
					    else if ( list->HasFlag(wxLC_SMALL_ICON) )
 | 
				
			||||||
 | 
					        image = GetImageIndex(list, wxIMAGE_LIST_SMALL);
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        image = wxNOT_FOUND;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ( image != wxNOT_FOUND )
 | 
				
			||||||
 | 
					        item.SetImage(image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // append the list item to the control
 | 
				
			||||||
 | 
					    item.SetId(list->GetItemCount());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return list->InsertItem(item);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxObject* wxListCtrlXmlHandler::Handle_wxListCtrl()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    XRC_MAKE_INSTANCE(list, wxListCtrl)
 | 
					    XRC_MAKE_INSTANCE(list, wxListCtrl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,16 +147,80 @@ wxObject *wxListCtrlXmlHandler::DoCreateResource()
 | 
				
			|||||||
                 wxDefaultValidator,
 | 
					                 wxDefaultValidator,
 | 
				
			||||||
                 GetName());
 | 
					                 GetName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // FIXME: add columns definition
 | 
					    // we can optionally have normal and/or small image lists
 | 
				
			||||||
 | 
					    wxImageList *imagelist;
 | 
				
			||||||
 | 
					    imagelist = GetImageList(wxT("imagelist"));
 | 
				
			||||||
 | 
					    if ( imagelist )
 | 
				
			||||||
 | 
					        list->AssignImageList(imagelist, wxIMAGE_LIST_NORMAL);
 | 
				
			||||||
 | 
					    imagelist = GetImageList(wxT("imagelist-small"));
 | 
				
			||||||
 | 
					    if ( imagelist )
 | 
				
			||||||
 | 
					        list->AssignImageList(imagelist, wxIMAGE_LIST_SMALL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    CreateChildrenPrivately(list);
 | 
				
			||||||
    SetupWindow(list);
 | 
					    SetupWindow(list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return list;
 | 
					    return list;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
 | 
					long wxListCtrlXmlHandler::GetImageIndex(wxListCtrl *listctrl, int which)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return IsOfClass(node, wxT("wxListCtrl"));
 | 
					    // use different tag names depending on whether we need a normal or small
 | 
				
			||||||
 | 
					    // image
 | 
				
			||||||
 | 
					    wxString
 | 
				
			||||||
 | 
					        bmpParam("bitmap"),
 | 
				
			||||||
 | 
					        imgParam("image");
 | 
				
			||||||
 | 
					    switch ( which )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        case wxIMAGE_LIST_SMALL:
 | 
				
			||||||
 | 
					            bmpParam += "-small";
 | 
				
			||||||
 | 
					            imgParam += "-small";
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case wxIMAGE_LIST_NORMAL:
 | 
				
			||||||
 | 
					            // nothing to do
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            wxFAIL_MSG( "unsupported image list kind" );
 | 
				
			||||||
 | 
					            return wxNOT_FOUND;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // look for either bitmap or image tags
 | 
				
			||||||
 | 
					    int imgIndex = wxNOT_FOUND;
 | 
				
			||||||
 | 
					    if ( HasParam(bmpParam) )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // we implicitly construct an image list containing the specified
 | 
				
			||||||
 | 
					        // bitmaps
 | 
				
			||||||
 | 
					        wxBitmap bmp = GetBitmap(bmpParam, wxART_OTHER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // create the image list on demand for the first bitmap
 | 
				
			||||||
 | 
					        wxImageList *imgList = listctrl->GetImageList(which);
 | 
				
			||||||
 | 
					        if ( !imgList )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() );
 | 
				
			||||||
 | 
					            listctrl->AssignImageList( imgList, which );
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        imgIndex = imgList->Add(bmp);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ( HasParam(imgParam) )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( imgIndex != wxNOT_FOUND )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            // TODO: we should really check that only bitmap or only image tags
 | 
				
			||||||
 | 
					            //       are used across all items of the control, not just in this
 | 
				
			||||||
 | 
					            //       one
 | 
				
			||||||
 | 
					            ReportError(wxString::Format(
 | 
				
			||||||
 | 
					                "listitem %s attribute ignored because %s is also specified",
 | 
				
			||||||
 | 
					                bmpParam, imgParam));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // just use the specified index directly
 | 
				
			||||||
 | 
					        imgIndex = GetLong(imgParam);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return imgIndex;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // wxUSE_XRC && wxUSE_LISTCTRL
 | 
					#endif // wxUSE_XRC && wxUSE_LISTCTRL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,19 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                    int imgIndex = imgList->Add(bmp);
 | 
					                    int imgIndex = imgList->Add(bmp);
 | 
				
			||||||
                    m_notebook->SetPageImage(m_notebook->GetPageCount()-1, imgIndex );
 | 
					                    m_notebook->SetPageImage(m_notebook->GetPageCount()-1, imgIndex );
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                else if ( HasParam(wxT("image")) )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if ( m_notebook->GetImageList() )
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        m_notebook->SetPageImage(m_notebook->GetPageCount()-1,
 | 
				
			||||||
 | 
					                                                 GetLong(wxT("image")) );
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else // image without image list?
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        ReportError(n, "image can only be used in conjunction "
 | 
				
			||||||
 | 
					                                       "with imagelist");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -111,6 +124,10 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                   GetStyle(wxT("style")),
 | 
					                   GetStyle(wxT("style")),
 | 
				
			||||||
                   GetName());
 | 
					                   GetName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        wxImageList *imagelist = GetImageList();
 | 
				
			||||||
 | 
					        if ( imagelist )
 | 
				
			||||||
 | 
					            nb->AssignImageList(imagelist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SetupWindow(nb);
 | 
					        SetupWindow(nb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wxNotebook *old_par = m_notebook;
 | 
					        wxNotebook *old_par = m_notebook;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,10 @@ wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
 | 
				
			|||||||
                wxDefaultValidator,
 | 
					                wxDefaultValidator,
 | 
				
			||||||
                GetName());
 | 
					                GetName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wxImageList *imagelist = GetImageList();
 | 
				
			||||||
 | 
					    if ( imagelist )
 | 
				
			||||||
 | 
					        tree->AssignImageList(imagelist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SetupWindow(tree);
 | 
					    SetupWindow(tree);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return tree;
 | 
					    return tree;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,10 @@ wxObject *wxTreebookXmlHandler::DoCreateResource()
 | 
				
			|||||||
                    GetStyle(wxT("style")),
 | 
					                    GetStyle(wxT("style")),
 | 
				
			||||||
                    GetName());
 | 
					                    GetName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        wxImageList *imagelist = GetImageList();
 | 
				
			||||||
 | 
					        if ( imagelist )
 | 
				
			||||||
 | 
					            tbk->AssignImageList(imagelist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wxTreebook * old_par = m_tbk;
 | 
					        wxTreebook * old_par = m_tbk;
 | 
				
			||||||
        m_tbk = tbk;
 | 
					        m_tbk = tbk;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -117,6 +121,18 @@ wxObject *wxTreebookXmlHandler::DoCreateResource()
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            imgIndex = imgList->Add(bmp);
 | 
					            imgIndex = imgList->Add(bmp);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        else if ( HasParam(wxT("image")) )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if ( m_tbk->GetImageList() )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                imgIndex = GetLong(wxT("image"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else // image without image list?
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                ReportError(n, "image can only be used in conjunction "
 | 
				
			||||||
 | 
					                               "with imagelist");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // then add the page to the corresponding parent
 | 
					        // then add the page to the corresponding parent
 | 
				
			||||||
        if( depth < m_treeContext.GetCount() )
 | 
					        if( depth < m_treeContext.GetCount() )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,6 +44,7 @@
 | 
				
			|||||||
#include "wx/fontenum.h"
 | 
					#include "wx/fontenum.h"
 | 
				
			||||||
#include "wx/fontmap.h"
 | 
					#include "wx/fontmap.h"
 | 
				
			||||||
#include "wx/artprov.h"
 | 
					#include "wx/artprov.h"
 | 
				
			||||||
 | 
					#include "wx/imaglist.h"
 | 
				
			||||||
#include "wx/dir.h"
 | 
					#include "wx/dir.h"
 | 
				
			||||||
#include "wx/xml/xml.h"
 | 
					#include "wx/xml/xml.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1332,10 +1333,17 @@ bool GetStockArtAttrs(const wxXmlNode *paramNode,
 | 
				
			|||||||
wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 | 
					wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 | 
				
			||||||
                                         const wxArtClient& defaultArtClient,
 | 
					                                         const wxArtClient& defaultArtClient,
 | 
				
			||||||
                                         wxSize size)
 | 
					                                         wxSize size)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return GetBitmap(GetParamNode(param), defaultArtClient, size);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxBitmap wxXmlResourceHandler::GetBitmap(const wxXmlNode* node,
 | 
				
			||||||
 | 
					                                         const wxArtClient& defaultArtClient,
 | 
				
			||||||
 | 
					                                         wxSize size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* If the bitmap is specified as stock item, query wxArtProvider for it: */
 | 
					    /* If the bitmap is specified as stock item, query wxArtProvider for it: */
 | 
				
			||||||
    wxString art_id, art_client;
 | 
					    wxString art_id, art_client;
 | 
				
			||||||
    if ( GetStockArtAttrs(GetParamNode(param), defaultArtClient,
 | 
					    if ( GetStockArtAttrs(node, defaultArtClient,
 | 
				
			||||||
                          art_id, art_client) )
 | 
					                          art_id, art_client) )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        wxBitmap stockArt(wxArtProvider::GetBitmap(art_id, art_client, size));
 | 
					        wxBitmap stockArt(wxArtProvider::GetBitmap(art_id, art_client, size));
 | 
				
			||||||
@@ -1344,7 +1352,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* ...or load the bitmap from file: */
 | 
					    /* ...or load the bitmap from file: */
 | 
				
			||||||
    wxString name = GetParamValue(param);
 | 
					    wxString name = GetParamValue(node);
 | 
				
			||||||
    if (name.empty()) return wxNullBitmap;
 | 
					    if (name.empty()) return wxNullBitmap;
 | 
				
			||||||
#if wxUSE_FILESYSTEM
 | 
					#if wxUSE_FILESYSTEM
 | 
				
			||||||
    wxFSFile *fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE);
 | 
					    wxFSFile *fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE);
 | 
				
			||||||
@@ -1352,7 +1360,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        ReportParamError
 | 
					        ReportParamError
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
            param,
 | 
					            node->GetName(),
 | 
				
			||||||
            wxString::Format("cannot open bitmap resource \"%s\"", name)
 | 
					            wxString::Format("cannot open bitmap resource \"%s\"", name)
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        return wxNullBitmap;
 | 
					        return wxNullBitmap;
 | 
				
			||||||
@@ -1367,7 +1375,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        ReportParamError
 | 
					        ReportParamError
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
            param,
 | 
					            node->GetName(),
 | 
				
			||||||
            wxString::Format("cannot create bitmap from \"%s\"", name)
 | 
					            wxString::Format("cannot create bitmap from \"%s\"", name)
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        return wxNullBitmap;
 | 
					        return wxNullBitmap;
 | 
				
			||||||
@@ -1380,12 +1388,20 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
 | 
				
			|||||||
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
 | 
					wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
 | 
				
			||||||
                                     const wxArtClient& defaultArtClient,
 | 
					                                     const wxArtClient& defaultArtClient,
 | 
				
			||||||
                                     wxSize size)
 | 
					                                     wxSize size)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return GetIcon(GetParamNode(param), defaultArtClient, size);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxIcon wxXmlResourceHandler::GetIcon(const wxXmlNode* node,
 | 
				
			||||||
 | 
					                                     const wxArtClient& defaultArtClient,
 | 
				
			||||||
 | 
					                                     wxSize size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxIcon icon;
 | 
					    wxIcon icon;
 | 
				
			||||||
    icon.CopyFromBitmap(GetBitmap(param, defaultArtClient, size));
 | 
					    icon.CopyFromBitmap(GetBitmap(node, defaultArtClient, size));
 | 
				
			||||||
    return icon;
 | 
					    return icon;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxIconBundle wxXmlResourceHandler::GetIconBundle(const wxString& param,
 | 
					wxIconBundle wxXmlResourceHandler::GetIconBundle(const wxString& param,
 | 
				
			||||||
                                                 const wxArtClient& defaultArtClient)
 | 
					                                                 const wxArtClient& defaultArtClient)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -1434,6 +1450,46 @@ wxIconBundle wxXmlResourceHandler::GetIconBundle(const wxString& param,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxImageList *wxXmlResourceHandler::GetImageList(const wxString& param)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    wxXmlNode * const imagelist_node = GetParamNode(param);
 | 
				
			||||||
 | 
					    if ( !imagelist_node )
 | 
				
			||||||
 | 
					        return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wxXmlNode * const oldnode = m_node;
 | 
				
			||||||
 | 
					    m_node = imagelist_node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // size
 | 
				
			||||||
 | 
					    wxSize size = GetSize();
 | 
				
			||||||
 | 
					    size.SetDefaults(wxSize(wxSystemSettings::GetMetric(wxSYS_ICON_X),
 | 
				
			||||||
 | 
					                            wxSystemSettings::GetMetric(wxSYS_ICON_Y)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // mask: true by default
 | 
				
			||||||
 | 
					    bool mask = HasParam(wxT("mask")) ? GetBool(wxT("mask"), true) : true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // now we have everything we need to create the image list
 | 
				
			||||||
 | 
					    wxImageList *imagelist = new wxImageList(size.x, size.y, mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // add images
 | 
				
			||||||
 | 
					    wxString parambitmap = wxT("bitmap");
 | 
				
			||||||
 | 
					    if ( HasParam(parambitmap) )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        wxXmlNode *n = m_node->GetChildren();
 | 
				
			||||||
 | 
					        while (n)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (n->GetType() == wxXML_ELEMENT_NODE && n->GetName() == parambitmap)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                // add icon instead of bitmap to keep the bitmap mask
 | 
				
			||||||
 | 
					                imagelist->Add(GetIcon(n));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            n = n->GetNext();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_node = oldnode;
 | 
				
			||||||
 | 
					    return imagelist;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxXmlNode *wxXmlResourceHandler::GetParamNode(const wxString& param)
 | 
					wxXmlNode *wxXmlResourceHandler::GetParamNode(const wxString& param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxCHECK_MSG(m_node, NULL, wxT("You can't access handler data before it was initialized!"));
 | 
					    wxCHECK_MSG(m_node, NULL, wxT("You can't access handler data before it was initialized!"));
 | 
				
			||||||
@@ -1464,9 +1520,9 @@ bool wxXmlResourceHandler::IsOfClass(wxXmlNode *node, const wxString& classname)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxString wxXmlResourceHandler::GetNodeContent(wxXmlNode *node)
 | 
					wxString wxXmlResourceHandler::GetNodeContent(const wxXmlNode *node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wxXmlNode *n = node;
 | 
					    const wxXmlNode *n = node;
 | 
				
			||||||
    if (n == NULL) return wxEmptyString;
 | 
					    if (n == NULL) return wxEmptyString;
 | 
				
			||||||
    n = n->GetChildren();
 | 
					    n = n->GetChildren();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1490,6 +1546,10 @@ wxString wxXmlResourceHandler::GetParamValue(const wxString& param)
 | 
				
			|||||||
        return GetNodeContent(GetParamNode(param));
 | 
					        return GetNodeContent(GetParamNode(param));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxString wxXmlResourceHandler::GetParamValue(const wxXmlNode* node)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return GetNodeContent(node);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxSize wxXmlResourceHandler::GetSize(const wxString& param,
 | 
					wxSize wxXmlResourceHandler::GetSize(const wxString& param,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user